3 #include "irq_chip_ia32.h"
6 * IRQ Chip based on the IA32 legacy PIC.
8 * Vectors for the PIC are from 0x20 to 0x2f statically assigned.
10 class Irq_chip_ia32_pic : public Irq_chip_ia32
13 char const *chip_type() const { return "PIC"; }
21 #include "boot_alloc.h"
23 #include "globalconfig.h"
29 Irq_chip_ia32_pic::Irq_chip_ia32_pic() : Irq_chip_ia32(16)
34 Irq_chip_ia32_pic::alloc(Irq_base *irq, Mword irqn)
36 // no mor than 16 IRQs
40 // PIC uses vectors from 0x20 to 0x2f statically
41 unsigned vector = 0x20 + irqn;
43 return valloc(irq, irqn, vector);
49 Irq_chip_ia32_pic::mask(Mword irq)
51 Pic::disable_locked(irq);
57 Irq_chip_ia32_pic::mask_and_ack(Mword irq)
59 Pic::disable_locked(irq);
60 Pic::acknowledge_locked(irq);
65 Irq_chip_ia32_pic::ack(Mword irq)
67 Pic::acknowledge_locked(irq);
72 Irq_chip_ia32_pic::set_mode(Mword, unsigned)
73 { return Irq_base::Trigger_level | Irq_base::Polarity_low; }
77 Irq_chip_ia32_pic::unmask(Mword irq)
79 Pic::enable_locked(irq, 0xa); //prio);
83 if (EXPECT_FALSE(!Irq::self(this)->owner()))
85 if (Irq::self(this)->owner() == (Receiver*)-1)
86 prio = ~0UL; // highes prio for JDB IRQs
88 prio = Irq::self(this)->owner()->sched()->prio();
95 Irq_chip_ia32_pic::set_cpu(Mword, unsigned)
99 class Pic_irq_mgr : public Irq_mgr
102 mutable Irq_chip_ia32_pic _pic;
106 Pic_irq_mgr::chip(Mword irq) const
109 return Irq(&_pic, irq);
116 Pic_irq_mgr::nr_irqs() const
123 Pic_irq_mgr::nr_msis() const
127 // ------------------------------------------------------------------------
130 PUBLIC static FIASCO_INIT
132 Irq_chip_ia32_pic::init()
134 Irq_mgr::mgr = new Boot_object<Pic_irq_mgr>();
137 // ------------------------------------------------------------------------
138 IMPLEMENTATION [!ux]:
140 PUBLIC static FIASCO_INIT
142 Irq_chip_ia32_pic::init()
144 Irq_mgr::mgr = new Boot_object<Pic_irq_mgr>();
146 // initialize interrupts
148 Irq_mgr::mgr->reserve(2); // reserve cascade irq
149 Irq_mgr::mgr->reserve(7); // reserve spurious vect
150 Irq_mgr::mgr->reserve(0xf); // reserve spurious vect
152 Pic::enable_locked(2); // allow cascaded irqs