MEM: Prepare mport for master/slave split
This patch simplifies the mport in preparation for a split into a master and slave role for the message ports. In particular, sendMessageAtomic was only used in a single location and similarly so sendMessageTiming. The affected interrupt device is updated accordingly.
This commit is contained in:
parent
86c2aad482
commit
77878d0a87
|
@ -1,4 +1,16 @@
|
||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2012 ARM Limited
|
||||||
|
* All rights reserved
|
||||||
|
*
|
||||||
|
* The license below extends only to copyright in the software and shall
|
||||||
|
* not be construed as granting a license to any other intellectual
|
||||||
|
* property including but not limited to intellectual property relating
|
||||||
|
* to a hardware implementation of the functionality of the software
|
||||||
|
* licensed hereunder. You may use the software subject to the license
|
||||||
|
* terms below provided that you ensure that this notice is replicated
|
||||||
|
* unmodified and in its entirety in all distributions of the software,
|
||||||
|
* modified or unmodified, in source code or in binary form.
|
||||||
|
*
|
||||||
* Copyright (c) 2008 The Regents of The University of Michigan
|
* Copyright (c) 2008 The Regents of The University of Michigan
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -31,17 +43,21 @@
|
||||||
#include "dev/x86/intdev.hh"
|
#include "dev/x86/intdev.hh"
|
||||||
|
|
||||||
void
|
void
|
||||||
X86ISA::IntDev::IntPort::sendMessage(ApicList apics,
|
X86ISA::IntDev::IntPort::sendMessage(ApicList apics, TriggerIntMessage message,
|
||||||
TriggerIntMessage message, bool timing)
|
bool timing)
|
||||||
{
|
{
|
||||||
ApicList::iterator apicIt;
|
ApicList::iterator apicIt;
|
||||||
for (apicIt = apics.begin(); apicIt != apics.end(); apicIt++) {
|
for (apicIt = apics.begin(); apicIt != apics.end(); apicIt++) {
|
||||||
PacketPtr pkt = buildIntRequest(*apicIt, message);
|
PacketPtr pkt = buildIntRequest(*apicIt, message);
|
||||||
if (timing) {
|
if (timing) {
|
||||||
sendMessageTiming(pkt, latency);
|
schedSendTiming(pkt, curTick() + latency);
|
||||||
// The target handles cleaning up the packet in timing mode.
|
// The target handles cleaning up the packet in timing mode.
|
||||||
} else {
|
} else {
|
||||||
sendMessageAtomic(pkt);
|
// ignore the latency involved in the atomic transaction
|
||||||
|
sendAtomic(pkt);
|
||||||
|
assert(pkt->isResponse());
|
||||||
|
// also ignore the latency in handling the response
|
||||||
|
recvResponse(pkt);
|
||||||
delete pkt->req;
|
delete pkt->req;
|
||||||
delete pkt;
|
delete pkt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,16 @@
|
||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2012 ARM Limited
|
||||||
|
* All rights reserved
|
||||||
|
*
|
||||||
|
* The license below extends only to copyright in the software and shall
|
||||||
|
* not be construed as granting a license to any other intellectual
|
||||||
|
* property including but not limited to intellectual property relating
|
||||||
|
* to a hardware implementation of the functionality of the software
|
||||||
|
* licensed hereunder. You may use the software subject to the license
|
||||||
|
* terms below provided that you ensure that this notice is replicated
|
||||||
|
* unmodified and in its entirety in all distributions of the software,
|
||||||
|
* modified or unmodified, in source code or in binary form.
|
||||||
|
*
|
||||||
* Copyright (c) 2008 The Regents of The University of Michigan
|
* Copyright (c) 2008 The Regents of The University of Michigan
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -34,30 +46,14 @@ Tick
|
||||||
MessagePort::recvAtomic(PacketPtr pkt)
|
MessagePort::recvAtomic(PacketPtr pkt)
|
||||||
{
|
{
|
||||||
if (pkt->cmd == MemCmd::MessageReq) {
|
if (pkt->cmd == MemCmd::MessageReq) {
|
||||||
// We received a message.
|
|
||||||
return recvMessage(pkt);
|
return recvMessage(pkt);
|
||||||
} else if (pkt->cmd == MemCmd::MessageResp) {
|
} else if (pkt->cmd == MemCmd::MessageResp) {
|
||||||
|
// normally we would never see responses in recvAtomic, but
|
||||||
|
// since the timing port uses recvAtomic to implement
|
||||||
|
// recvTiming we have to deal with both cases
|
||||||
return recvResponse(pkt);
|
return recvResponse(pkt);
|
||||||
} else if (pkt->wasNacked()) {
|
|
||||||
return recvNack(pkt);
|
|
||||||
} else if (pkt->isError()) {
|
|
||||||
panic("Packet is error.\n");
|
|
||||||
} else {
|
} else {
|
||||||
panic("Unexpected memory command %s.\n", pkt->cmd.toString());
|
panic("%s received unexpected atomic command %s from %s.\n",
|
||||||
|
name(), pkt->cmd.toString(), getPeer()->name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
MessagePort::sendMessageTiming(PacketPtr pkt, Tick latency)
|
|
||||||
{
|
|
||||||
schedSendTiming(pkt, curTick() + latency);
|
|
||||||
}
|
|
||||||
|
|
||||||
Tick
|
|
||||||
MessagePort::sendMessageAtomic(PacketPtr pkt)
|
|
||||||
{
|
|
||||||
Tick latency = sendAtomic(pkt);
|
|
||||||
assert(pkt->isResponse());
|
|
||||||
latency += recvResponse(pkt);
|
|
||||||
return latency;
|
|
||||||
}
|
|
||||||
|
|
|
@ -59,6 +59,8 @@ class MessagePort : public SimpleTimingPort
|
||||||
|
|
||||||
Tick recvAtomic(PacketPtr pkt);
|
Tick recvAtomic(PacketPtr pkt);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
virtual Tick recvMessage(PacketPtr pkt) = 0;
|
virtual Tick recvMessage(PacketPtr pkt) = 0;
|
||||||
|
|
||||||
// Accept and ignore responses.
|
// Accept and ignore responses.
|
||||||
|
@ -66,15 +68,6 @@ class MessagePort : public SimpleTimingPort
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since by default we're assuming everything we send is accepted, panic.
|
|
||||||
virtual Tick recvNack(PacketPtr pkt)
|
|
||||||
{
|
|
||||||
panic("Unhandled message nack.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
void sendMessageTiming(PacketPtr pkt, Tick latency);
|
|
||||||
Tick sendMessageAtomic(PacketPtr pkt);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue