diff options
author | Gabe Black <gabeblack@google.com> | 2019-09-10 17:24:47 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-09-21 05:05:18 +0000 |
commit | cc03cf8270fad7261f08527637325cb42615c887 (patch) | |
tree | 2ad5ae3fac7254314146563b9edabb424250f4b9 /src/dev/x86 | |
parent | a9ed1458ba374115e09a83ac5c6eae0e6e929f42 (diff) | |
download | gem5-cc03cf8270fad7261f08527637325cb42615c887.tar.xz |
x86: Templatize IntSlavePort.
This makes the device IntSlavePort calls back into based on a template
parameter so that IntDevice doesn't have to be in the inheritance
hierarchy to use it.
It also makes IntSlavePort inherit from SimpleTimingPort directly,
skipping over MessageSlavePort.
Change-Id: Ic3213edc9c3ed5e506ee1e9f5e082cd47d7c7998
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/20820
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/dev/x86')
-rw-r--r-- | src/dev/x86/i82094aa.cc | 10 | ||||
-rw-r--r-- | src/dev/x86/i82094aa.hh | 2 | ||||
-rw-r--r-- | src/dev/x86/intdev.hh | 65 |
3 files changed, 29 insertions, 48 deletions
diff --git a/src/dev/x86/i82094aa.cc b/src/dev/x86/i82094aa.cc index 1fae67b09..e73eec791 100644 --- a/src/dev/x86/i82094aa.cc +++ b/src/dev/x86/i82094aa.cc @@ -85,16 +85,6 @@ X86ISA::I82094AA::getPort(const std::string &if_name, PortID idx) return BasicPioDevice::getPort(if_name, idx); } -AddrRangeList -X86ISA::I82094AA::getIntAddrRange() const -{ - AddrRangeList ranges; - ranges.push_back(RangeEx(x86InterruptAddress(initialApicId, 0), - x86InterruptAddress(initialApicId, 0) + - PhysAddrAPICRangeSize)); - return ranges; -} - Tick X86ISA::I82094AA::recvResponse(PacketPtr pkt) { diff --git a/src/dev/x86/i82094aa.hh b/src/dev/x86/i82094aa.hh index b0764758a..17a0da486 100644 --- a/src/dev/x86/i82094aa.hh +++ b/src/dev/x86/i82094aa.hh @@ -100,8 +100,6 @@ class I82094AA : public BasicPioDevice, public IntDevice Tick read(PacketPtr pkt) override; Tick write(PacketPtr pkt) override; - AddrRangeList getIntAddrRange() const override; - void writeReg(uint8_t offset, uint32_t value); uint32_t readReg(uint8_t offset); diff --git a/src/dev/x86/intdev.hh b/src/dev/x86/intdev.hh index 0cc2be032..1a198db62 100644 --- a/src/dev/x86/intdev.hh +++ b/src/dev/x86/intdev.hh @@ -54,34 +54,40 @@ namespace X86ISA { -typedef std::list<int> ApicList; - -class IntDevice +template <class Device> +class IntSlavePort : public SimpleTimingPort { - protected: - class IntSlavePort : public MessageSlavePort + Device * device; + + public: + IntSlavePort(const std::string& _name, SimObject* _parent, + Device* dev) : + SimpleTimingPort(_name, _parent), device(dev) { - IntDevice * device; + } - public: - IntSlavePort(const std::string& _name, SimObject* _parent, - IntDevice* dev) : - MessageSlavePort(_name, _parent), device(dev) - { - } + AddrRangeList + getAddrRanges() const + { + return device->getIntAddrRange(); + } - AddrRangeList getAddrRanges() const - { - return device->getIntAddrRange(); - } + Tick + recvAtomic(PacketPtr pkt) + { + panic_if(pkt->cmd != MemCmd::MessageReq, + "%s received unexpected command %s from %s.\n", + name(), pkt->cmd.toString(), getPeer()); + pkt->headerDelay = pkt->payloadDelay = 0; + return device->recvMessage(pkt); + } +}; - Tick recvMessage(PacketPtr pkt) - { - // @todo someone should pay for this - pkt->headerDelay = pkt->payloadDelay = 0; - return device->recvMessage(pkt); - } - }; +typedef std::list<int> ApicList; + +class IntDevice +{ + protected: class IntMasterPort : public MessageMasterPort { @@ -119,24 +125,11 @@ class IntDevice virtual void init(); virtual Tick - recvMessage(PacketPtr pkt) - { - panic("recvMessage not implemented.\n"); - return 0; - } - - virtual Tick recvResponse(PacketPtr pkt) { panic("recvResponse not implemented.\n"); return 0; } - - virtual AddrRangeList - getIntAddrRange() const - { - panic("intAddrRange not implemented.\n"); - } }; } // namespace X86ISA |