]> rtime.felk.cvut.cz Git - l4.git/blobdiff - kernel/fiasco/src/kern/arm/bsp/integrator/pic-arm-integrator.cpp
update
[l4.git] / kernel / fiasco / src / kern / arm / bsp / integrator / pic-arm-integrator.cpp
index f8b37df2ab9220ef0781588364a24ed29f76d22d..8eec233016dfa4a2bfe6bd020a25b6d83278a024 100644 (file)
@@ -1,46 +1,50 @@
 // ---------------------------------------------------------------------
-INTERFACE [arm-integrator]:
+IMPLEMENTATION [arm && integrator]:
 
+#include "assert.h"
+#include "initcalls.h"
+#include "irq_chip_generic.h"
+#include "irq_mgr.h"
+#include "mmio_register_block.h"
 #include "kmem.h"
 
-EXTENSION class Pic
+class Irq_chip_arm_integr : public Irq_chip_gen, Mmio_register_block
 {
-public:
+private:
   enum
   {
-    IRQ_STATUS       = Kmem::Pic_map_base + 0x00,
-    IRQ_ENABLE_SET   = Kmem::Pic_map_base + 0x08,
-    IRQ_ENABLE_CLEAR = Kmem::Pic_map_base + 0x0c,
+    IRQ_STATUS       = 0x00,
+    IRQ_ENABLE_SET   = 0x08,
+    IRQ_ENABLE_CLEAR = 0x0c,
 
-    FIQ_ENABLE_CLEAR = Kmem::Pic_map_base + 0x2c,
+    FIQ_ENABLE_CLEAR = 0x2c,
 
     PIC_START = 0,
     PIC_END   = 31,
   };
-};
-
-// ---------------------------------------------------------------------
-IMPLEMENTATION [arm && integrator]:
-
-#include "io.h"
-#include "irq_chip_generic.h"
-#include "irq_mgr.h"
 
-class Irq_chip_arm_integr : public Irq_chip_gen
-{
 public:
-  Irq_chip_arm_integr() : Irq_chip_gen(32) {}
-  unsigned set_mode(Mword, unsigned) { return Irq_base::Trigger_level; }
-  void set_cpu(Mword, unsigned) {}
+  int set_mode(Mword, Mode) { return 0; }
+  bool is_edge_triggered(Mword) const { return false; }
+  void set_cpu(Mword, Cpu_number) {}
   void ack(Mword) { /* ack is empty */ }
 };
 
+PUBLIC
+Irq_chip_arm_integr::Irq_chip_arm_integr()
+: Irq_chip_gen(32),
+  Mmio_register_block(Kmem::mmio_remap(Mem_layout::Pic_phys_base))
+{
+  write<Mword>(0xffffffff, IRQ_ENABLE_CLEAR);
+  write<Mword>(0xffffffff, FIQ_ENABLE_CLEAR);
+}
+
 PUBLIC
 void
 Irq_chip_arm_integr::mask(Mword irq)
 {
   assert(cpu_lock.test());
-  Io::write(1 << (irq - Pic::PIC_START), Pic::IRQ_ENABLE_CLEAR);
+  write<Mword>(1 << (irq - PIC_START), IRQ_ENABLE_CLEAR);
 }
 
 PUBLIC
@@ -48,7 +52,7 @@ void
 Irq_chip_arm_integr::mask_and_ack(Mword irq)
 {
   assert(cpu_lock.test());
-  Io::write(1 << (irq - Pic::PIC_START), Pic::IRQ_ENABLE_CLEAR);
+  write<Mword>(1 << (irq - PIC_START), IRQ_ENABLE_CLEAR);
   // ack is empty
 }
 
@@ -57,7 +61,7 @@ void
 Irq_chip_arm_integr::unmask(Mword irq)
 {
   assert(cpu_lock.test());
-  Io::write(1 << (irq - Pic::PIC_START), Pic::IRQ_ENABLE_SET);
+  write<Mword>(1 << (irq - PIC_START), IRQ_ENABLE_SET);
 }
 
 static Static_object<Irq_mgr_single_chip<Irq_chip_arm_integr> > mgr;
@@ -66,9 +70,6 @@ IMPLEMENT FIASCO_INIT
 void Pic::init()
 {
   Irq_mgr::mgr = mgr.construct();
-
-  Io::write(0xffffffff, IRQ_ENABLE_CLEAR);
-  Io::write(0xffffffff, FIQ_ENABLE_CLEAR);
 }
 
 IMPLEMENT inline
@@ -82,16 +83,28 @@ IMPLEMENT inline
 void Pic::restore_all(Status)
 {}
 
-PUBLIC static inline NEEDS["io.h"]
+PUBLIC inline
 Unsigned32 Irq_chip_arm_integr::pending()
 {
-  return Io::read<Mword>(Pic::IRQ_STATUS);
+  return read<Mword>(IRQ_STATUS);
 }
 
 extern "C"
 void irq_handler()
 { mgr->c.handle_multi_pending<Irq_chip_arm_integr>(0); }
 
+// ------------------------------------------------------------------------
+IMPLEMENTATION [arm && integrator && arm_em_tz]:
+
+#include <cstdio>
+
+PUBLIC static
+void
+Pic::set_pending_irq(unsigned group32num, Unsigned32 val)
+{
+  printf("%s(%d, %x): Not implemented\n", __func__, group32num, val);
+}
+
 //---------------------------------------------------------------------------
 IMPLEMENTATION [debug && integrator]: