Change getDeviceAddressRanges to use bool for snoop arg.
--HG-- extra : convert_revision : 832e52ba80cbab2f5bb6d5b5977a499d41b4d638
This commit is contained in:
parent
05d14cf3e2
commit
41241799ae
21 changed files with 187 additions and 239 deletions
|
@ -115,8 +115,8 @@ class MemTest : public MemObject
|
||||||
virtual void recvRetry();
|
virtual void recvRetry();
|
||||||
|
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{ resp.clear(); snoop.clear(); snoop.push_back(RangeSize(0,0)); }
|
{ resp.clear(); snoop = true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
CpuPort cachePort;
|
CpuPort cachePort;
|
||||||
|
|
|
@ -100,8 +100,8 @@ class DefaultFetch
|
||||||
|
|
||||||
/** Returns the address ranges of this device. */
|
/** Returns the address ranges of this device. */
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{ resp.clear(); snoop.clear(); snoop.push_back(RangeSize(0,0)); }
|
{ resp.clear(); snoop = true; }
|
||||||
|
|
||||||
/** Timing version of receive. Handles setting fetch to the
|
/** Timing version of receive. Handles setting fetch to the
|
||||||
* proper status to start fetching. */
|
* proper status to start fetching. */
|
||||||
|
|
|
@ -316,8 +316,8 @@ class LSQ {
|
||||||
|
|
||||||
/** Returns the address ranges of this device. */
|
/** Returns the address ranges of this device. */
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{ resp.clear(); snoop.clear(); snoop.push_back(RangeSize(0,0)); }
|
{ resp.clear(); snoop = true; }
|
||||||
|
|
||||||
/** Timing version of receive. Handles writing back and
|
/** Timing version of receive. Handles writing back and
|
||||||
* completing the load or store that has returned from
|
* completing the load or store that has returned from
|
||||||
|
|
|
@ -91,8 +91,8 @@ class FrontEnd
|
||||||
|
|
||||||
/** Returns the address ranges of this device. */
|
/** Returns the address ranges of this device. */
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{ resp.clear(); snoop.clear(); snoop.push_back(RangeSize(0,0)); }
|
{ resp.clear(); snoop = true; }
|
||||||
|
|
||||||
/** Timing version of receive. Handles setting fetch to the
|
/** Timing version of receive. Handles setting fetch to the
|
||||||
* proper status to start fetching. */
|
* proper status to start fetching. */
|
||||||
|
|
|
@ -257,8 +257,8 @@ class OzoneLWLSQ {
|
||||||
virtual void recvStatusChange(Status status);
|
virtual void recvStatusChange(Status status);
|
||||||
|
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{ resp.clear(); snoop.clear(); snoop.push_back(RangeSize(0,0)); }
|
{ resp.clear(); snoop = true; }
|
||||||
|
|
||||||
virtual bool recvTiming(PacketPtr pkt);
|
virtual bool recvTiming(PacketPtr pkt);
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,8 @@ class AtomicSimpleCPU : public BaseSimpleCPU
|
||||||
virtual void recvRetry();
|
virtual void recvRetry();
|
||||||
|
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{ resp.clear(); snoop.clear(); snoop.push_back(RangeSize(0,0)); }
|
{ resp.clear(); snoop = true; }
|
||||||
|
|
||||||
};
|
};
|
||||||
CpuPort icachePort;
|
CpuPort icachePort;
|
||||||
|
|
|
@ -91,8 +91,8 @@ class TimingSimpleCPU : public BaseSimpleCPU
|
||||||
virtual void recvStatusChange(Status status);
|
virtual void recvStatusChange(Status status);
|
||||||
|
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{ resp.clear(); snoop.clear(); snoop.push_back(RangeSize(0,0)); }
|
{ resp.clear(); snoop = false; }
|
||||||
|
|
||||||
struct TickEvent : public Event
|
struct TickEvent : public Event
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,9 +48,9 @@ PioPort::recvAtomic(PacketPtr pkt)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PioPort::getDeviceAddressRanges(AddrRangeList &resp, AddrRangeList &snoop)
|
PioPort::getDeviceAddressRanges(AddrRangeList &resp, bool &snoop)
|
||||||
{
|
{
|
||||||
snoop.clear();
|
snoop = false;
|
||||||
device->addressRanges(resp);
|
device->addressRanges(resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class PioPort : public SimpleTimingPort
|
||||||
virtual Tick recvAtomic(PacketPtr pkt);
|
virtual Tick recvAtomic(PacketPtr pkt);
|
||||||
|
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop);
|
bool &snoop);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -127,8 +127,8 @@ class DmaPort : public Port
|
||||||
virtual void recvRetry() ;
|
virtual void recvRetry() ;
|
||||||
|
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{ resp.clear(); snoop.clear(); }
|
{ resp.clear(); snoop = false; }
|
||||||
|
|
||||||
void queueDma(PacketPtr pkt, bool front = false);
|
void queueDma(PacketPtr pkt, bool front = false);
|
||||||
void sendDma();
|
void sendDma();
|
||||||
|
|
|
@ -76,9 +76,9 @@ PciDev::PciConfigPort::recvAtomic(PacketPtr pkt)
|
||||||
|
|
||||||
void
|
void
|
||||||
PciDev::PciConfigPort::getDeviceAddressRanges(AddrRangeList &resp,
|
PciDev::PciConfigPort::getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{
|
{
|
||||||
snoop.clear();
|
snoop = false;;
|
||||||
resp.push_back(RangeSize(configAddr, PCI_CONFIG_SIZE+1));
|
resp.push_back(RangeSize(configAddr, PCI_CONFIG_SIZE+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ class PciDev : public DmaDevice
|
||||||
virtual Tick recvAtomic(PacketPtr pkt);
|
virtual Tick recvAtomic(PacketPtr pkt);
|
||||||
|
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop);
|
bool &snoop);
|
||||||
|
|
||||||
Platform *platform;
|
Platform *platform;
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ BadAddrEvent::process(ThreadContext *tc)
|
||||||
uint64_t a0 = tc->readIntReg(ArgumentReg0);
|
uint64_t a0 = tc->readIntReg(ArgumentReg0);
|
||||||
|
|
||||||
AddrRangeList resp;
|
AddrRangeList resp;
|
||||||
AddrRangeList snoop;
|
bool snoop;
|
||||||
AddrRangeIter iter;
|
AddrRangeIter iter;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
|
|
@ -367,7 +367,7 @@ Bridge::BridgePort::recvStatusChange(Port::Status status)
|
||||||
|
|
||||||
void
|
void
|
||||||
Bridge::BridgePort::getDeviceAddressRanges(AddrRangeList &resp,
|
Bridge::BridgePort::getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{
|
{
|
||||||
otherPort->getPeerAddressRanges(resp, snoop);
|
otherPort->getPeerAddressRanges(resp, snoop);
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ class Bridge : public MemObject
|
||||||
/** When receiving a address range request the peer port,
|
/** When receiving a address range request the peer port,
|
||||||
pass it to the bridge. */
|
pass it to the bridge. */
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop);
|
bool &snoop);
|
||||||
};
|
};
|
||||||
|
|
||||||
BridgePort portA, portB;
|
BridgePort portA, portB;
|
||||||
|
|
178
src/mem/bus.cc
178
src/mem/bus.cc
|
@ -296,16 +296,15 @@ Bus::findPort(Addr addr, int id)
|
||||||
{
|
{
|
||||||
/* An interval tree would be a better way to do this. --ali. */
|
/* An interval tree would be a better way to do this. --ali. */
|
||||||
int dest_id = -1;
|
int dest_id = -1;
|
||||||
AddrRangeIter iter;
|
|
||||||
range_map<Addr,int>::iterator i;
|
|
||||||
|
|
||||||
i = portMap.find(RangeSize(addr,1));
|
PortIter i = portMap.find(RangeSize(addr,1));
|
||||||
if (i != portMap.end())
|
if (i != portMap.end())
|
||||||
dest_id = i->second;
|
dest_id = i->second;
|
||||||
|
|
||||||
// Check if this matches the default range
|
// Check if this matches the default range
|
||||||
if (dest_id == -1) {
|
if (dest_id == -1) {
|
||||||
for (iter = defaultRange.begin(); iter != defaultRange.end(); iter++) {
|
for (AddrRangeIter iter = defaultRange.begin();
|
||||||
|
iter != defaultRange.end(); iter++) {
|
||||||
if (*iter == addr) {
|
if (*iter == addr) {
|
||||||
DPRINTF(Bus, " found addr %#llx on default\n", addr);
|
DPRINTF(Bus, " found addr %#llx on default\n", addr);
|
||||||
return defaultPort;
|
return defaultPort;
|
||||||
|
@ -333,88 +332,63 @@ Bus::findPort(Addr addr, int id)
|
||||||
return interfaces[dest_id];
|
return interfaces[dest_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int>
|
|
||||||
Bus::findSnoopPorts(Addr addr, int id)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
AddrRangeIter iter;
|
|
||||||
std::vector<int> ports;
|
|
||||||
|
|
||||||
while (i < portSnoopList.size())
|
|
||||||
{
|
|
||||||
if (portSnoopList[i].range == addr && portSnoopList[i].portId != id) {
|
|
||||||
//Careful to not overlap ranges
|
|
||||||
//or snoop will be called more than once on the port
|
|
||||||
|
|
||||||
//@todo Fix this hack because ranges are overlapping
|
|
||||||
//need to make sure we dont't create overlapping ranges
|
|
||||||
bool hack_overlap = false;
|
|
||||||
int size = ports.size();
|
|
||||||
for (int j=0; j < size; j++) {
|
|
||||||
if (ports[j] == portSnoopList[i].portId)
|
|
||||||
hack_overlap = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hack_overlap)
|
|
||||||
ports.push_back(portSnoopList[i].portId);
|
|
||||||
// DPRINTF(Bus, " found snoop addr %#llx on device%d\n", addr,
|
|
||||||
// portSnoopList[i].portId);
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return ports;
|
|
||||||
}
|
|
||||||
|
|
||||||
Tick
|
Tick
|
||||||
Bus::atomicSnoop(PacketPtr pkt, Port *responder)
|
Bus::atomicSnoop(PacketPtr pkt, Port *responder)
|
||||||
{
|
{
|
||||||
std::vector<int> ports = findSnoopPorts(pkt->getAddr(), pkt->getSrc());
|
|
||||||
Tick response_time = 0;
|
Tick response_time = 0;
|
||||||
|
|
||||||
while (!ports.empty())
|
for (SnoopIter s_iter = snoopPorts.begin();
|
||||||
{
|
s_iter != snoopPorts.end();
|
||||||
if (interfaces[ports.back()] != responder) {
|
s_iter++) {
|
||||||
Tick response = interfaces[ports.back()]->sendAtomic(pkt);
|
BusPort *p = *s_iter;
|
||||||
|
if (p != responder && p->getId() != pkt->getSrc()) {
|
||||||
|
Tick response = p->sendAtomic(pkt);
|
||||||
if (response) {
|
if (response) {
|
||||||
assert(!response_time); //Multiple responders
|
assert(!response_time); //Multiple responders
|
||||||
response_time = response;
|
response_time = response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ports.pop_back();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return response_time;
|
return response_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Bus::functionalSnoop(PacketPtr pkt, Port *responder)
|
Bus::functionalSnoop(PacketPtr pkt, Port *responder)
|
||||||
{
|
{
|
||||||
std::vector<int> ports = findSnoopPorts(pkt->getAddr(), pkt->getSrc());
|
// The packet may be changed by another bus on snoops, restore the
|
||||||
|
// id after each
|
||||||
|
int src_id = pkt->getSrc();
|
||||||
|
|
||||||
//The packet may be changed by another bus on snoops, restore the id after each
|
for (SnoopIter s_iter = snoopPorts.begin();
|
||||||
int id = pkt->getSrc();
|
s_iter != snoopPorts.end();
|
||||||
while (!ports.empty() && pkt->result != Packet::Success)
|
s_iter++) {
|
||||||
{
|
BusPort *p = *s_iter;
|
||||||
if (interfaces[ports.back()] != responder)
|
if (p != responder && p->getId() != src_id) {
|
||||||
interfaces[ports.back()]->sendFunctional(pkt);
|
p->sendFunctional(pkt);
|
||||||
ports.pop_back();
|
}
|
||||||
pkt->setSrc(id);
|
if (pkt->result == Packet::Success) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pkt->setSrc(src_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Bus::timingSnoop(PacketPtr pkt, Port* responder)
|
Bus::timingSnoop(PacketPtr pkt, Port* responder)
|
||||||
{
|
{
|
||||||
std::vector<int> ports = findSnoopPorts(pkt->getAddr(), pkt->getSrc());
|
for (SnoopIter s_iter = snoopPorts.begin();
|
||||||
bool success = true;
|
s_iter != snoopPorts.end();
|
||||||
|
s_iter++) {
|
||||||
while (!ports.empty() && success)
|
BusPort *p = *s_iter;
|
||||||
{
|
if (p != responder && p->getId() != pkt->getSrc()) {
|
||||||
if (interfaces[ports.back()] != responder) //Don't call if responder also, once will do
|
bool success = p->sendTiming(pkt);
|
||||||
success = interfaces[ports.back()]->sendTiming(pkt);
|
if (!success)
|
||||||
ports.pop_back();
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -467,7 +441,7 @@ void
|
||||||
Bus::recvStatusChange(Port::Status status, int id)
|
Bus::recvStatusChange(Port::Status status, int id)
|
||||||
{
|
{
|
||||||
AddrRangeList ranges;
|
AddrRangeList ranges;
|
||||||
AddrRangeList snoops;
|
bool snoops;
|
||||||
AddrRangeIter iter;
|
AddrRangeIter iter;
|
||||||
|
|
||||||
assert(status == Port::RangeChange &&
|
assert(status == Port::RangeChange &&
|
||||||
|
@ -480,7 +454,7 @@ Bus::recvStatusChange(Port::Status status, int id)
|
||||||
// Only try to update these ranges if the user set a default responder.
|
// Only try to update these ranges if the user set a default responder.
|
||||||
if (responderSet) {
|
if (responderSet) {
|
||||||
defaultPort->getPeerAddressRanges(ranges, snoops);
|
defaultPort->getPeerAddressRanges(ranges, snoops);
|
||||||
assert(snoops.size() == 0);
|
assert(snoops == false);
|
||||||
for(iter = ranges.begin(); iter != ranges.end(); iter++) {
|
for(iter = ranges.begin(); iter != ranges.end(); iter++) {
|
||||||
defaultRange.push_back(*iter);
|
defaultRange.push_back(*iter);
|
||||||
DPRINTF(BusAddrRanges, "Adding range %#llx - %#llx for default range\n",
|
DPRINTF(BusAddrRanges, "Adding range %#llx - %#llx for default range\n",
|
||||||
|
@ -490,36 +464,30 @@ Bus::recvStatusChange(Port::Status status, int id)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
assert((id < maxId && id >= 0) || id == defaultId);
|
assert((id < maxId && id >= 0) || id == defaultId);
|
||||||
Port *port = interfaces[id];
|
BusPort *port = interfaces[id];
|
||||||
range_map<Addr,int>::iterator portIter;
|
|
||||||
std::vector<DevMap>::iterator snoopIter;
|
|
||||||
|
|
||||||
// Clean out any previously existent ids
|
// Clean out any previously existent ids
|
||||||
for (portIter = portMap.begin(); portIter != portMap.end(); ) {
|
for (PortIter portIter = portMap.begin();
|
||||||
|
portIter != portMap.end(); ) {
|
||||||
if (portIter->second == id)
|
if (portIter->second == id)
|
||||||
portMap.erase(portIter++);
|
portMap.erase(portIter++);
|
||||||
else
|
else
|
||||||
portIter++;
|
portIter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (snoopIter = portSnoopList.begin(); snoopIter != portSnoopList.end(); ) {
|
for (SnoopIter s_iter = snoopPorts.begin();
|
||||||
if (snoopIter->portId == id)
|
s_iter != snoopPorts.end(); ) {
|
||||||
snoopIter = portSnoopList.erase(snoopIter);
|
if ((*s_iter)->getId() == id)
|
||||||
|
s_iter = snoopPorts.erase(s_iter);
|
||||||
else
|
else
|
||||||
snoopIter++;
|
s_iter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
port->getPeerAddressRanges(ranges, snoops);
|
port->getPeerAddressRanges(ranges, snoops);
|
||||||
|
|
||||||
for(iter = snoops.begin(); iter != snoops.end(); iter++) {
|
if (snoops) {
|
||||||
DevMap dm;
|
DPRINTF(BusAddrRanges, "Adding id %d to snoop list\n", id);
|
||||||
dm.portId = id;
|
snoopPorts.push_back(port);
|
||||||
dm.range = *iter;
|
|
||||||
|
|
||||||
//@todo, make sure we don't overlap ranges
|
|
||||||
DPRINTF(BusAddrRanges, "Adding snoop range %#llx - %#llx for id %d\n",
|
|
||||||
dm.range.start, dm.range.end, id);
|
|
||||||
portSnoopList.push_back(dm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (iter = ranges.begin(); iter != ranges.end(); iter++) {
|
for (iter = ranges.begin(); iter != ranges.end(); iter++) {
|
||||||
|
@ -545,28 +513,24 @@ Bus::recvStatusChange(Port::Status status, int id)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Bus::addressRanges(AddrRangeList &resp, AddrRangeList &snoop, int id)
|
Bus::addressRanges(AddrRangeList &resp, bool &snoop, int id)
|
||||||
{
|
{
|
||||||
std::vector<DevMap>::iterator snoopIter;
|
|
||||||
range_map<Addr,int>::iterator portIter;
|
|
||||||
AddrRangeIter dflt_iter;
|
|
||||||
bool subset;
|
|
||||||
|
|
||||||
resp.clear();
|
resp.clear();
|
||||||
snoop.clear();
|
snoop = false;
|
||||||
|
|
||||||
DPRINTF(BusAddrRanges, "received address range request, returning:\n");
|
DPRINTF(BusAddrRanges, "received address range request, returning:\n");
|
||||||
|
|
||||||
for (dflt_iter = defaultRange.begin(); dflt_iter != defaultRange.end();
|
for (AddrRangeIter dflt_iter = defaultRange.begin();
|
||||||
dflt_iter++) {
|
dflt_iter != defaultRange.end(); dflt_iter++) {
|
||||||
resp.push_back(*dflt_iter);
|
resp.push_back(*dflt_iter);
|
||||||
DPRINTF(BusAddrRanges, " -- Dflt: %#llx : %#llx\n",dflt_iter->start,
|
DPRINTF(BusAddrRanges, " -- Dflt: %#llx : %#llx\n",dflt_iter->start,
|
||||||
dflt_iter->end);
|
dflt_iter->end);
|
||||||
}
|
}
|
||||||
for (portIter = portMap.begin(); portIter != portMap.end(); portIter++) {
|
for (PortIter portIter = portMap.begin();
|
||||||
subset = false;
|
portIter != portMap.end(); portIter++) {
|
||||||
for (dflt_iter = defaultRange.begin(); dflt_iter != defaultRange.end();
|
bool subset = false;
|
||||||
dflt_iter++) {
|
for (AddrRangeIter dflt_iter = defaultRange.begin();
|
||||||
|
dflt_iter != defaultRange.end(); dflt_iter++) {
|
||||||
if ((portIter->first.start < dflt_iter->start &&
|
if ((portIter->first.start < dflt_iter->start &&
|
||||||
portIter->first.end >= dflt_iter->start) ||
|
portIter->first.end >= dflt_iter->start) ||
|
||||||
(portIter->first.start < dflt_iter->end &&
|
(portIter->first.start < dflt_iter->end &&
|
||||||
|
@ -587,15 +551,11 @@ Bus::addressRanges(AddrRangeList &resp, AddrRangeList &snoop, int id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (snoopIter = portSnoopList.begin();
|
for (SnoopIter s_iter = snoopPorts.begin(); s_iter != snoopPorts.end();
|
||||||
snoopIter != portSnoopList.end(); snoopIter++)
|
s_iter++) {
|
||||||
{
|
if ((*s_iter)->getId() != id) {
|
||||||
if (snoopIter->portId != id) {
|
snoop = true;
|
||||||
snoop.push_back(snoopIter->range);
|
break;
|
||||||
DPRINTF(BusAddrRanges, " -- Snoop: %#llx : %#llx\n",
|
|
||||||
snoopIter->range.start, snoopIter->range.end);
|
|
||||||
//@todo We need to properly insert snoop ranges
|
|
||||||
//not overlapping the ranges (multiple)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -606,17 +566,17 @@ Bus::findBlockSize(int id)
|
||||||
if (cachedBlockSizeValid)
|
if (cachedBlockSizeValid)
|
||||||
return cachedBlockSize;
|
return cachedBlockSize;
|
||||||
|
|
||||||
int max_bs = -1, tmp_bs;
|
int max_bs = -1;
|
||||||
range_map<Addr,int>::iterator portIter;
|
|
||||||
std::vector<DevMap>::iterator snoopIter;
|
for (PortIter portIter = portMap.begin();
|
||||||
for (portIter = portMap.begin(); portIter != portMap.end(); portIter++) {
|
portIter != portMap.end(); portIter++) {
|
||||||
tmp_bs = interfaces[portIter->second]->peerBlockSize();
|
int tmp_bs = interfaces[portIter->second]->peerBlockSize();
|
||||||
if (tmp_bs > max_bs)
|
if (tmp_bs > max_bs)
|
||||||
max_bs = tmp_bs;
|
max_bs = tmp_bs;
|
||||||
}
|
}
|
||||||
for (snoopIter = portSnoopList.begin();
|
for (SnoopIter s_iter = snoopPorts.begin();
|
||||||
snoopIter != portSnoopList.end(); snoopIter++) {
|
s_iter != snoopPorts.end(); s_iter++) {
|
||||||
tmp_bs = interfaces[snoopIter->portId]->peerBlockSize();
|
int tmp_bs = (*s_iter)->peerBlockSize();
|
||||||
if (tmp_bs > max_bs)
|
if (tmp_bs > max_bs)
|
||||||
max_bs = tmp_bs;
|
max_bs = tmp_bs;
|
||||||
}
|
}
|
||||||
|
|
167
src/mem/bus.hh
167
src/mem/bus.hh
|
@ -52,93 +52,6 @@
|
||||||
|
|
||||||
class Bus : public MemObject
|
class Bus : public MemObject
|
||||||
{
|
{
|
||||||
/** a globally unique id for this bus. */
|
|
||||||
int busId;
|
|
||||||
/** the clock speed for the bus */
|
|
||||||
int clock;
|
|
||||||
/** the width of the bus in bytes */
|
|
||||||
int width;
|
|
||||||
/** the next tick at which the bus will be idle */
|
|
||||||
Tick tickNextIdle;
|
|
||||||
|
|
||||||
Event * drainEvent;
|
|
||||||
|
|
||||||
|
|
||||||
static const int defaultId = -3; //Make it unique from Broadcast
|
|
||||||
|
|
||||||
struct DevMap {
|
|
||||||
int portId;
|
|
||||||
Range<Addr> range;
|
|
||||||
};
|
|
||||||
range_map<Addr, int> portMap;
|
|
||||||
AddrRangeList defaultRange;
|
|
||||||
std::vector<DevMap> portSnoopList;
|
|
||||||
|
|
||||||
/** Function called by the port when the bus is recieving a Timing
|
|
||||||
transaction.*/
|
|
||||||
bool recvTiming(PacketPtr pkt);
|
|
||||||
|
|
||||||
/** Function called by the port when the bus is recieving a Atomic
|
|
||||||
transaction.*/
|
|
||||||
Tick recvAtomic(PacketPtr pkt);
|
|
||||||
|
|
||||||
/** Function called by the port when the bus is recieving a Functional
|
|
||||||
transaction.*/
|
|
||||||
void recvFunctional(PacketPtr pkt);
|
|
||||||
|
|
||||||
/** Timing function called by port when it is once again able to process
|
|
||||||
* requests. */
|
|
||||||
void recvRetry(int id);
|
|
||||||
|
|
||||||
/** Function called by the port when the bus is recieving a status change.*/
|
|
||||||
void recvStatusChange(Port::Status status, int id);
|
|
||||||
|
|
||||||
/** Find which port connected to this bus (if any) should be given a packet
|
|
||||||
* with this address.
|
|
||||||
* @param addr Address to find port for.
|
|
||||||
* @param id Id of the port this packet was received from (to prevent
|
|
||||||
* loops)
|
|
||||||
* @return pointer to port that the packet should be sent out of.
|
|
||||||
*/
|
|
||||||
Port *findPort(Addr addr, int id);
|
|
||||||
|
|
||||||
/** Find all ports with a matching snoop range, except src port. Keep in mind
|
|
||||||
* that the ranges shouldn't overlap or you will get a double snoop to the same
|
|
||||||
* interface.and the cache will assert out.
|
|
||||||
* @param addr Address to find snoop prts for.
|
|
||||||
* @param id Id of the src port of the request to avoid calling snoop on src
|
|
||||||
* @return vector of IDs to snoop on
|
|
||||||
*/
|
|
||||||
std::vector<int> findSnoopPorts(Addr addr, int id);
|
|
||||||
|
|
||||||
/** Snoop all relevant ports atomicly. */
|
|
||||||
Tick atomicSnoop(PacketPtr pkt, Port* responder);
|
|
||||||
|
|
||||||
/** Snoop all relevant ports functionally. */
|
|
||||||
void functionalSnoop(PacketPtr pkt, Port *responder);
|
|
||||||
|
|
||||||
/** Call snoop on caches, be sure to set SNOOP_COMMIT bit if you want
|
|
||||||
* the snoop to happen
|
|
||||||
* @return True if succeds.
|
|
||||||
*/
|
|
||||||
bool timingSnoop(PacketPtr pkt, Port *responder);
|
|
||||||
|
|
||||||
/** Process address range request.
|
|
||||||
* @param resp addresses that we can respond to
|
|
||||||
* @param snoop addresses that we would like to snoop
|
|
||||||
* @param id ide of the busport that made the request.
|
|
||||||
*/
|
|
||||||
void addressRanges(AddrRangeList &resp, AddrRangeList &snoop, int id);
|
|
||||||
|
|
||||||
/** Occupy the bus with transmitting the packet pkt */
|
|
||||||
void occupyBus(PacketPtr pkt);
|
|
||||||
|
|
||||||
/** Ask everyone on the bus what their size is
|
|
||||||
* @param id id of the busport that made the request
|
|
||||||
* @return the max of all the sizes
|
|
||||||
*/
|
|
||||||
int findBlockSize(int id);
|
|
||||||
|
|
||||||
/** Declaration of the buses port type, one will be instantiated for each
|
/** Declaration of the buses port type, one will be instantiated for each
|
||||||
of the interfaces connecting to the bus. */
|
of the interfaces connecting to the bus. */
|
||||||
class BusPort : public Port
|
class BusPort : public Port
|
||||||
|
@ -198,7 +111,7 @@ class Bus : public MemObject
|
||||||
// the 'owned' address ranges of all the other interfaces on
|
// the 'owned' address ranges of all the other interfaces on
|
||||||
// this bus...
|
// this bus...
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{ bus->addressRanges(resp, snoop, id); }
|
{ bus->addressRanges(resp, snoop, id); }
|
||||||
|
|
||||||
// Ask the bus to ask everyone on the bus what their block size is and
|
// Ask the bus to ask everyone on the bus what their block size is and
|
||||||
|
@ -219,6 +132,84 @@ class Bus : public MemObject
|
||||||
const char *description();
|
const char *description();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** a globally unique id for this bus. */
|
||||||
|
int busId;
|
||||||
|
/** the clock speed for the bus */
|
||||||
|
int clock;
|
||||||
|
/** the width of the bus in bytes */
|
||||||
|
int width;
|
||||||
|
/** the next tick at which the bus will be idle */
|
||||||
|
Tick tickNextIdle;
|
||||||
|
|
||||||
|
Event * drainEvent;
|
||||||
|
|
||||||
|
|
||||||
|
static const int defaultId = -3; //Make it unique from Broadcast
|
||||||
|
|
||||||
|
typedef range_map<Addr,int>::iterator PortIter;
|
||||||
|
range_map<Addr, int> portMap;
|
||||||
|
|
||||||
|
AddrRangeList defaultRange;
|
||||||
|
|
||||||
|
typedef std::vector<BusPort*>::iterator SnoopIter;
|
||||||
|
std::vector<BusPort*> snoopPorts;
|
||||||
|
|
||||||
|
/** Function called by the port when the bus is recieving a Timing
|
||||||
|
transaction.*/
|
||||||
|
bool recvTiming(PacketPtr pkt);
|
||||||
|
|
||||||
|
/** Function called by the port when the bus is recieving a Atomic
|
||||||
|
transaction.*/
|
||||||
|
Tick recvAtomic(PacketPtr pkt);
|
||||||
|
|
||||||
|
/** Function called by the port when the bus is recieving a Functional
|
||||||
|
transaction.*/
|
||||||
|
void recvFunctional(PacketPtr pkt);
|
||||||
|
|
||||||
|
/** Timing function called by port when it is once again able to process
|
||||||
|
* requests. */
|
||||||
|
void recvRetry(int id);
|
||||||
|
|
||||||
|
/** Function called by the port when the bus is recieving a status change.*/
|
||||||
|
void recvStatusChange(Port::Status status, int id);
|
||||||
|
|
||||||
|
/** Find which port connected to this bus (if any) should be given a packet
|
||||||
|
* with this address.
|
||||||
|
* @param addr Address to find port for.
|
||||||
|
* @param id Id of the port this packet was received from (to prevent
|
||||||
|
* loops)
|
||||||
|
* @return pointer to port that the packet should be sent out of.
|
||||||
|
*/
|
||||||
|
Port *findPort(Addr addr, int id);
|
||||||
|
|
||||||
|
/** Snoop all relevant ports atomicly. */
|
||||||
|
Tick atomicSnoop(PacketPtr pkt, Port* responder);
|
||||||
|
|
||||||
|
/** Snoop all relevant ports functionally. */
|
||||||
|
void functionalSnoop(PacketPtr pkt, Port *responder);
|
||||||
|
|
||||||
|
/** Call snoop on caches, be sure to set SNOOP_COMMIT bit if you want
|
||||||
|
* the snoop to happen
|
||||||
|
* @return True if succeds.
|
||||||
|
*/
|
||||||
|
bool timingSnoop(PacketPtr pkt, Port *responder);
|
||||||
|
|
||||||
|
/** Process address range request.
|
||||||
|
* @param resp addresses that we can respond to
|
||||||
|
* @param snoop addresses that we would like to snoop
|
||||||
|
* @param id ide of the busport that made the request.
|
||||||
|
*/
|
||||||
|
void addressRanges(AddrRangeList &resp, bool &snoop, int id);
|
||||||
|
|
||||||
|
/** Occupy the bus with transmitting the packet pkt */
|
||||||
|
void occupyBus(PacketPtr pkt);
|
||||||
|
|
||||||
|
/** Ask everyone on the bus what their size is
|
||||||
|
* @param id id of the busport that made the request
|
||||||
|
* @return the max of all the sizes
|
||||||
|
*/
|
||||||
|
int findBlockSize(int id);
|
||||||
|
|
||||||
BusFreeEvent busIdle;
|
BusFreeEvent busIdle;
|
||||||
|
|
||||||
bool inRetry;
|
bool inRetry;
|
||||||
|
|
3
src/mem/cache/base_cache.cc
vendored
3
src/mem/cache/base_cache.cc
vendored
|
@ -59,8 +59,7 @@ BaseCache::CachePort::recvStatusChange(Port::Status status)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BaseCache::CachePort::getDeviceAddressRanges(AddrRangeList &resp,
|
BaseCache::CachePort::getDeviceAddressRanges(AddrRangeList &resp, bool &snoop)
|
||||||
AddrRangeList &snoop)
|
|
||||||
{
|
{
|
||||||
cache->getAddressRanges(resp, snoop, isCpuSide);
|
cache->getAddressRanges(resp, snoop, isCpuSide);
|
||||||
}
|
}
|
||||||
|
|
9
src/mem/cache/base_cache.hh
vendored
9
src/mem/cache/base_cache.hh
vendored
|
@ -87,7 +87,7 @@ class BaseCache : public MemObject
|
||||||
virtual void recvStatusChange(Status status);
|
virtual void recvStatusChange(Status status);
|
||||||
|
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop);
|
bool &snoop);
|
||||||
|
|
||||||
virtual int deviceBlockSize();
|
virtual int deviceBlockSize();
|
||||||
|
|
||||||
|
@ -656,19 +656,18 @@ class BaseCache : public MemObject
|
||||||
*/
|
*/
|
||||||
void rangeChange() {}
|
void rangeChange() {}
|
||||||
|
|
||||||
void getAddressRanges(AddrRangeList &resp, AddrRangeList &snoop, bool isCpuSide)
|
void getAddressRanges(AddrRangeList &resp, bool &snoop, bool isCpuSide)
|
||||||
{
|
{
|
||||||
if (isCpuSide)
|
if (isCpuSide)
|
||||||
{
|
{
|
||||||
AddrRangeList dummy;
|
bool dummy;
|
||||||
memSidePort->getPeerAddressRanges(resp, dummy);
|
memSidePort->getPeerAddressRanges(resp, dummy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//This is where snoops get updated
|
//This is where snoops get updated
|
||||||
AddrRangeList dummy;
|
AddrRangeList dummy;
|
||||||
cpuSidePort->getPeerAddressRanges(dummy, snoop);
|
snoop = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -385,18 +385,17 @@ PhysicalMemory::MemoryPort::recvStatusChange(Port::Status status)
|
||||||
|
|
||||||
void
|
void
|
||||||
PhysicalMemory::MemoryPort::getDeviceAddressRanges(AddrRangeList &resp,
|
PhysicalMemory::MemoryPort::getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{
|
{
|
||||||
memory->getAddressRanges(resp, snoop);
|
memory->getAddressRanges(resp, snoop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PhysicalMemory::getAddressRanges(AddrRangeList &resp, AddrRangeList &snoop)
|
PhysicalMemory::getAddressRanges(AddrRangeList &resp, bool &snoop)
|
||||||
{
|
{
|
||||||
snoop.clear();
|
snoop = false;
|
||||||
resp.clear();
|
resp.clear();
|
||||||
resp.push_back(RangeSize(start(),
|
resp.push_back(RangeSize(start(), params()->addrRange.size()));
|
||||||
params()->addrRange.size()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -64,7 +64,7 @@ class PhysicalMemory : public MemObject
|
||||||
virtual void recvStatusChange(Status status);
|
virtual void recvStatusChange(Status status);
|
||||||
|
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop);
|
bool &snoop);
|
||||||
|
|
||||||
virtual int deviceBlockSize();
|
virtual int deviceBlockSize();
|
||||||
};
|
};
|
||||||
|
@ -169,7 +169,7 @@ class PhysicalMemory : public MemObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int deviceBlockSize();
|
int deviceBlockSize();
|
||||||
void getAddressRanges(AddrRangeList &resp, AddrRangeList &snoop);
|
void getAddressRanges(AddrRangeList &resp, bool &snoop);
|
||||||
virtual Port *getPort(const std::string &if_name, int idx = -1);
|
virtual Port *getPort(const std::string &if_name, int idx = -1);
|
||||||
void virtual init();
|
void virtual init();
|
||||||
unsigned int drain(Event *de);
|
unsigned int drain(Event *de);
|
||||||
|
|
|
@ -172,7 +172,7 @@ class Port
|
||||||
@param snoop is a list of ranges snooped
|
@param snoop is a list of ranges snooped
|
||||||
*/
|
*/
|
||||||
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
virtual void getDeviceAddressRanges(AddrRangeList &resp,
|
||||||
AddrRangeList &snoop)
|
bool &snoop)
|
||||||
{ panic("??"); }
|
{ panic("??"); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -222,7 +222,7 @@ class Port
|
||||||
/** Called by the associated device if it wishes to find out the address
|
/** Called by the associated device if it wishes to find out the address
|
||||||
ranges connected to the peer ports devices.
|
ranges connected to the peer ports devices.
|
||||||
*/
|
*/
|
||||||
void getPeerAddressRanges(AddrRangeList &resp, AddrRangeList &snoop)
|
void getPeerAddressRanges(AddrRangeList &resp, bool &snoop)
|
||||||
{ peer->getDeviceAddressRanges(resp, snoop); }
|
{ peer->getDeviceAddressRanges(resp, snoop); }
|
||||||
|
|
||||||
/** This function is a wrapper around sendFunctional()
|
/** This function is a wrapper around sendFunctional()
|
||||||
|
|
Loading…
Reference in a new issue