21 #include "pedigree/kernel/Log.h" 22 #include "pedigree/kernel/compiler.h" 23 #include "pedigree/kernel/debugger/Debugger.h" 24 #include "pedigree/kernel/machine/Device.h" 25 #include "pedigree/kernel/machine/openfirmware/Device.h" 26 #include "pedigree/kernel/processor/Processor.h" 32 irq_id_t Heathrow::registerIsaIrqHandler(uint8_t irq,
IrqHandler *handler)
42 irq_id_t Heathrow::registerPciIrqHandler(
IrqHandler *handler)
66 void Heathrow::searchNode(
Device *pDev)
71 OFDevice ofDev(pChild->getOFHandle());
73 ofDev.getProperty(
"device_type", type);
74 if (type ==
"interrupt-controller")
78 ofDev.getProperty(
"compatible", comp);
79 if (!(comp ==
"heathrow"))
85 ofDev.getProperty(
"reg", reg, 8);
88 for (
unsigned int j = 0; j < pDev->
addresses().count(); j++)
90 if (!StringCompare(pDev->
addresses()[j]->m_Name,
"bar0"))
92 uintptr_t regAddr =
static_cast<uintptr_t
>(reg[0]) +
94 size_t regSize = 0x40;
96 String(
"reg"), regAddr, regSize,
120 ERROR(
"Heathrow: Device not found!");
139 for (
size_t i = 0; i < 16; i++)
145 uint32_t low = LITTLE_TO_HOST32(
m_pPort->
read32(0x10)) & m_LowMask;
146 uint32_t high = LITTLE_TO_HOST32(
m_pPort->
read32(0x00)) & m_HighMask;
149 for (
int i = 0; i < 32; i++)
158 for (
int i = 0; i < 32; i++)
200 if (
m_Handler[irq]->irq(irq, state) ==
false)
209 NOTICE(
"PIC: unhandled irq #" << irq <<
" occurred");
224 void Heathrow::eoi(uint8_t irq)
226 uintptr_t reg = 0x18;
233 uint32_t shift = 1 << irq;
236 void Heathrow::enable(uint8_t irq,
bool enable)
238 uintptr_t reg = 0x14;
246 uint32_t shift = 1 << irq;
259 void Heathrow::enableAll(
bool enable)
265 m_LowMask = 0xFFFFFFFF;
266 m_HighMask = 0xFFFFFFFF;
virtual bool registerInterruptHandler(size_t nInterruptNumber, InterruptHandler *pHandler)=0
Heathrow() INITIALISATION_ONLY
Device * getChild(size_t n)
virtual void interrupt(size_t interruptNumber, InterruptState &state)
virtual Vector< Address * > & addresses()
Handles interrupts and interrupt registrations from kernel components.
virtual void unregisterHandler(irq_id_t Id, IrqHandler *handler)
virtual void acknowledgeIrq(irq_id_t Id)
virtual uint32_t read32(size_t offset=0)=0
IrqHandler * m_Handler[64]
static InterruptManager & instance()
virtual void write32(uint32_t value, size_t offset=0)=0
bool initialise() INITIALISATION_ONLY
static Heathrow m_Instance