summaryrefslogtreecommitdiff
path: root/mem
diff options
context:
space:
mode:
Diffstat (limited to 'mem')
-rw-r--r--mem/bus.cc21
-rw-r--r--mem/bus.hh18
-rw-r--r--mem/packet.hh2
-rw-r--r--mem/physical.cc1
-rw-r--r--mem/port.cc2
5 files changed, 29 insertions, 15 deletions
diff --git a/mem/bus.cc b/mem/bus.cc
index acc941434..f84e38301 100644
--- a/mem/bus.cc
+++ b/mem/bus.cc
@@ -48,9 +48,16 @@ Bus::init()
/** Function called by the port when the bus is recieving a Timing
* transaction.*/
bool
-Bus::recvTiming(Packet &pkt, int id)
+Bus::recvTiming(Packet &pkt)
{
- return findPort(pkt.addr, id)->sendTiming(pkt);
+ Port *port;
+ if (pkt.dest == Packet::Broadcast) {
+ port = findPort(pkt.addr, pkt.src);
+ } else {
+ assert(pkt.dest > 0 && pkt.dest < interfaces.size());
+ port = interfaces[pkt.dest];
+ }
+ return port->sendTiming(pkt);
}
Port *
@@ -82,17 +89,19 @@ Bus::findPort(Addr addr, int id)
/** Function called by the port when the bus is recieving a Atomic
* transaction.*/
Tick
-Bus::recvAtomic(Packet &pkt, int id)
+Bus::recvAtomic(Packet &pkt)
{
- return findPort(pkt.addr, id)->sendAtomic(pkt);
+ assert(pkt.dest == Packet::Broadcast);
+ return findPort(pkt.addr, pkt.src)->sendAtomic(pkt);
}
/** Function called by the port when the bus is recieving a Functional
* transaction.*/
void
-Bus::recvFunctional(Packet &pkt, int id)
+Bus::recvFunctional(Packet &pkt)
{
- findPort(pkt.addr, id)->sendFunctional(pkt);
+ assert(pkt.dest == Packet::Broadcast);
+ findPort(pkt.addr, pkt.src)->sendFunctional(pkt);
}
/** Function called by the port when the bus is recieving a status change.*/
diff --git a/mem/bus.hh b/mem/bus.hh
index de9259a90..40d274037 100644
--- a/mem/bus.hh
+++ b/mem/bus.hh
@@ -57,15 +57,15 @@ class Bus : public MemObject
/** Function called by the port when the bus is recieving a Timing
transaction.*/
- bool recvTiming(Packet &pkt, int id);
+ bool recvTiming(Packet &pkt);
/** Function called by the port when the bus is recieving a Atomic
transaction.*/
- Tick recvAtomic(Packet &pkt, int id);
+ Tick recvAtomic(Packet &pkt);
/** Function called by the port when the bus is recieving a Functional
transaction.*/
- void recvFunctional(Packet &pkt, int id);
+ void recvFunctional(Packet &pkt);
/** Function called by the port when the bus is recieving a status change.*/
void recvStatusChange(Port::Status status, int id);
@@ -77,8 +77,7 @@ class Bus : public MemObject
* loops)
* @return pointer to port that the packet should be sent out of.
*/
- Port *
- Bus::findPort(Addr addr, int id);
+ Port *findPort(Addr addr, int id);
/** Process address range request.
* @param resp addresses that we can respond to
@@ -110,17 +109,17 @@ class Bus : public MemObject
/** When reciving a timing request from the peer port (at id),
pass it to the bus. */
virtual bool recvTiming(Packet &pkt)
- { return bus->recvTiming(pkt, id); }
+ { pkt.src = id; return bus->recvTiming(pkt); }
/** When reciving a Atomic requestfrom the peer port (at id),
pass it to the bus. */
virtual Tick recvAtomic(Packet &pkt)
- { return bus->recvAtomic(pkt, id); }
+ { pkt.src = id; return bus->recvAtomic(pkt); }
/** When reciving a Functional requestfrom the peer port (at id),
pass it to the bus. */
virtual void recvFunctional(Packet &pkt)
- { bus->recvFunctional(pkt, id); }
+ { pkt.src = id; bus->recvFunctional(pkt); }
/** When reciving a status changefrom the peer port (at id),
pass it to the bus. */
@@ -131,7 +130,8 @@ class Bus : public MemObject
// downstream from this bus, yes? That is, the union of all
// the 'owned' address ranges of all the other interfaces on
// this bus...
- virtual void getDeviceAddressRanges(AddrRangeList &resp, AddrRangeList &snoop)
+ virtual void getDeviceAddressRanges(AddrRangeList &resp,
+ AddrRangeList &snoop)
{ bus->addressRanges(resp, snoop, id); }
// Hack to make translating port work without changes
diff --git a/mem/packet.hh b/mem/packet.hh
index 69d00675d..ab961e304 100644
--- a/mem/packet.hh
+++ b/mem/packet.hh
@@ -121,6 +121,8 @@ struct Packet
/** A index of the source of the transaction. */
short src;
+ static const short Broadcast = -1;
+
/** A index to the destination of the transaction. */
short dest;
diff --git a/mem/physical.cc b/mem/physical.cc
index beb97307a..d0409995b 100644
--- a/mem/physical.cc
+++ b/mem/physical.cc
@@ -127,6 +127,7 @@ PhysicalMemory::doTimingAccess (Packet &pkt, MemoryPort* memoryPort)
{
doFunctionalAccess(pkt);
+ pkt.dest = pkt.src;
MemResponseEvent* response = new MemResponseEvent(pkt, memoryPort);
response->schedule(curTick + lat);
diff --git a/mem/port.cc b/mem/port.cc
index 32031d96c..5b1f634d6 100644
--- a/mem/port.cc
+++ b/mem/port.cc
@@ -31,6 +31,7 @@
*/
#include "base/chunk_generator.hh"
+#include "mem/packet_impl.hh"
#include "mem/port.hh"
void
@@ -40,6 +41,7 @@ Port::blobHelper(Addr addr, uint8_t *p, int size, Command cmd)
Packet pkt;
pkt.req = &req;
pkt.cmd = cmd;
+ pkt.dest = Packet::Broadcast;
for (ChunkGenerator gen(addr, size, peerBlockSize());
!gen.done(); gen.next()) {