diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2009-01-31 23:33:54 -0800 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2009-01-31 23:33:54 -0800 |
commit | 6a3f255a84d93f3e621319fd81f355416e385c8c (patch) | |
tree | e6dd2386d3989fdd3169d66a14c1a057463ca323 /src/dev/x86/intdev.hh | |
parent | 64b663c6071ecd58eff6dacd38ee351038259427 (diff) | |
download | gem5-6a3f255a84d93f3e621319fd81f355416e385c8c.tar.xz |
X86: Rework interrupt pins to allow one to many connections.
Diffstat (limited to 'src/dev/x86/intdev.hh')
-rw-r--r-- | src/dev/x86/intdev.hh | 92 |
1 files changed, 78 insertions, 14 deletions
diff --git a/src/dev/x86/intdev.hh b/src/dev/x86/intdev.hh index ba9a073a4..ca8e7eea5 100644 --- a/src/dev/x86/intdev.hh +++ b/src/dev/x86/intdev.hh @@ -38,7 +38,9 @@ #include "mem/mem_object.hh" #include "mem/mport.hh" #include "sim/sim_object.hh" -#include "params/X86IntPin.hh" +#include "params/X86IntSourcePin.hh" +#include "params/X86IntSinkPin.hh" +#include "params/X86IntLine.hh" namespace X86ISA { @@ -99,6 +101,18 @@ class IntDev panic("signalInterrupt not implemented.\n"); } + virtual void + raiseInterruptPin(int number) + { + panic("raiseInterruptPin not implemented.\n"); + } + + virtual void + lowerInterruptPin(int number) + { + panic("lowerInterruptPin not implemented.\n"); + } + virtual Tick recvMessage(PacketPtr pkt) { @@ -113,20 +127,34 @@ class IntDev } }; -class IntPin : public SimObject +class IntSinkPin : public SimObject { - protected: + public: IntDev * device; - int line; + int number; - public: - typedef X86IntPinParams Params; + typedef X86IntSinkPinParams Params; + + const Params * + params() const + { + return dynamic_cast<const Params *>(_params); + } - IntDev * - getDevice() const + IntSinkPin(Params *p) : SimObject(p), + device(dynamic_cast<IntDev *>(p->device)), number(p->number) { - return device; + assert(device); } +}; + +class IntSourcePin : public SimObject +{ + protected: + std::vector<IntSinkPin *> sinks; + + public: + typedef X86IntSourcePinParams Params; const Params * params() const @@ -134,16 +162,52 @@ class IntPin : public SimObject return dynamic_cast<const Params *>(_params); } - IntPin(Params *p) : SimObject(p), - device(dynamic_cast<IntDev *>(p->device)), line(p->line) + void + addSink(IntSinkPin *sink) { - assert(device); + sinks.push_back(sink); } void - signalInterrupt() + raise() + { + for (int i = 0; i < sinks.size(); i++) { + const IntSinkPin &pin = *sinks[i]; + pin.device->raiseInterruptPin(pin.number); + } + } + + void + lower() + { + for (int i = 0; i < sinks.size(); i++) { + const IntSinkPin &pin = *sinks[i]; + pin.device->lowerInterruptPin(pin.number); + } + } + + IntSourcePin(Params *p) : SimObject(p) + {} +}; + +class IntLine : public SimObject +{ + protected: + IntSourcePin *source; + IntSinkPin *sink; + + public: + typedef X86IntLineParams Params; + + const Params * + params() const + { + return dynamic_cast<const Params *>(_params); + } + + IntLine(Params *p) : SimObject(p), source(p->source), sink(p->sink) { - device->signalInterrupt(line); + source->addSink(sink); } }; |