diff --git a/src/arch/x86/interrupts.cc b/src/arch/x86/interrupts.cc index dc4193f36..88d200b80 100644 --- a/src/arch/x86/interrupts.cc +++ b/src/arch/x86/interrupts.cc @@ -59,6 +59,9 @@ #include "arch/x86/interrupts.hh" #include "arch/x86/intmessage.hh" #include "cpu/base.hh" +#include "dev/x86/i82094aa.hh" +#include "dev/x86/pc.hh" +#include "dev/x86/south_bridge.hh" #include "mem/packet_access.hh" #include "sim/system.hh" @@ -306,6 +309,16 @@ X86ISA::Interrupts::setCPU(BaseCPU * newCPU) } +void +X86ISA::Interrupts::init() +{ + BasicPioDevice::init(); + Pc * pc = dynamic_cast(platform); + assert(pc); + pc->southBridge->ioApic->registerLocalApic(initialApicId, this); +} + + Tick X86ISA::Interrupts::recvMessage(PacketPtr pkt) { diff --git a/src/arch/x86/interrupts.hh b/src/arch/x86/interrupts.hh index 33fafd941..e1bd676db 100644 --- a/src/arch/x86/interrupts.hh +++ b/src/arch/x86/interrupts.hh @@ -213,6 +213,11 @@ class Interrupts : public BasicPioDevice, IntDev return dynamic_cast(_params); } + /* + * Initialize this object by registering it with the IO APIC. + */ + void init(); + /* * Functions to interact with the interrupt port from IntDev. */ diff --git a/src/dev/x86/i82094aa.cc b/src/dev/x86/i82094aa.cc index e55f1ec87..3f0ed9e96 100644 --- a/src/dev/x86/i82094aa.cc +++ b/src/dev/x86/i82094aa.cc @@ -182,6 +182,13 @@ X86ISA::I82094AA::lowerInterruptPin(int number) pinStates[number] = false; } +void +X86ISA::I82094AA::registerLocalApic(int initialId, Interrupts *localApic) +{ + assert(localApic); + localApics[initialId] = localApic; +} + X86ISA::I82094AA * I82094AAParams::create() { diff --git a/src/dev/x86/i82094aa.hh b/src/dev/x86/i82094aa.hh index 7501259c1..e81d85fa9 100644 --- a/src/dev/x86/i82094aa.hh +++ b/src/dev/x86/i82094aa.hh @@ -37,10 +37,13 @@ #include "dev/x86/intdev.hh" #include "params/I82094AA.hh" +#include + namespace X86ISA { class I8259; +class Interrupts; class I82094AA : public PioDevice, public IntDev { @@ -67,6 +70,8 @@ class I82094AA : public PioDevice, public IntDev I8259 * extIntPic; + std::map localApics; + uint8_t regSel; uint8_t initialApicId; uint8_t id; @@ -122,6 +127,7 @@ class I82094AA : public PioDevice, public IntDev void signalInterrupt(int line); void raiseInterruptPin(int number); void lowerInterruptPin(int number); + void registerLocalApic(int id, Interrupts *localApic); }; }; // namespace X86ISA