int initialApicId;
// Port for receiving interrupts
- IntSlavePort intSlavePort;
+ IntSlavePort<Interrupts> intSlavePort;
Tick pioDelay;
Addr pioAddr = MaxAddr;
void init() override;
/*
- * Functions to interact with the interrupt port from IntDevice.
+ * Functions to interact with the interrupt port.
*/
Tick read(PacketPtr pkt) override;
Tick write(PacketPtr pkt) override;
- Tick recvMessage(PacketPtr pkt) override;
+ Tick recvMessage(PacketPtr pkt);
Tick recvResponse(PacketPtr pkt) override;
bool
}
AddrRangeList getAddrRanges() const override;
- AddrRangeList getIntAddrRange() const override;
+ AddrRangeList getIntAddrRange() const;
Port &getPort(const std::string &if_name,
PortID idx=InvalidPortID) override
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)
{
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
{
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