MEM: Remove onRetryList from BusPort and rely on retryList

This patch removes the onRetryList field from the BusPort class and
entirely relies on the retryList which holds all ports that are
waiting to retry. The onRetryList field and the retryList were
previously used with overloaded functionalities and only one is really
needed (there were also checks to assert they held the same
information). After this patch the bus ports will be split into master
and slave ports and this simplifies that transition.
This commit is contained in:
Andreas Hansson 2012-02-09 13:06:27 -05:00
parent a6246bb047
commit cdb32860b4
2 changed files with 12 additions and 25 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011 ARM Limited * Copyright (c) 2011-2012 ARM Limited
* All rights reserved * All rights reserved
* *
* The license below extends only to copyright in the software and shall * The license below extends only to copyright in the software and shall
@ -255,7 +255,6 @@ Bus::recvTiming(PacketPtr pkt)
// Also take care of retries // Also take care of retries
if (inRetry) { if (inRetry) {
DPRINTF(Bus, "Remove retry from list %d\n", src); DPRINTF(Bus, "Remove retry from list %d\n", src);
retryList.front()->onRetryList(false);
retryList.pop_front(); retryList.pop_front();
inRetry = false; inRetry = false;
} }
@ -274,7 +273,6 @@ Bus::recvRetry(int id)
// If inRetry is still true, sendTiming wasn't called // If inRetry is still true, sendTiming wasn't called
if (inRetry) if (inRetry)
{ {
retryList.front()->onRetryList(false);
retryList.pop_front(); retryList.pop_front();
inRetry = false; inRetry = false;

View file

@ -71,8 +71,6 @@ class Bus : public MemObject
of the interfaces connecting to the bus. */ of the interfaces connecting to the bus. */
class BusPort : public Port class BusPort : public Port
{ {
bool _onRetryList;
/** A pointer to the bus to which this port belongs. */ /** A pointer to the bus to which this port belongs. */
Bus *bus; Bus *bus;
@ -83,15 +81,9 @@ class Bus : public MemObject
/** Constructor for the BusPort.*/ /** Constructor for the BusPort.*/
BusPort(const std::string &_name, Bus *_bus, int _id) BusPort(const std::string &_name, Bus *_bus, int _id)
: Port(_name, _bus), _onRetryList(false), bus(_bus), id(_id) : Port(_name, _bus), bus(_bus), id(_id)
{ } { }
bool onRetryList()
{ return _onRetryList; }
void onRetryList(bool newVal)
{ _onRetryList = newVal; }
int getId() const { return id; } int getId() const { return id; }
/** /**
@ -301,25 +293,22 @@ class Bus : public MemObject
/** An array of pointers to ports that retry should be called on because the /** An array of pointers to ports that retry should be called on because the
* original send failed for whatever reason.*/ * original send failed for whatever reason.*/
std::list<BusPort*> retryList; std::list<Port*> retryList;
void addToRetryList(BusPort * port) void addToRetryList(Port* port)
{ {
if (!inRetry) { if (!inRetry) {
// The device wasn't retrying a packet, or wasn't at an appropriate // The device wasn't retrying a packet, or wasn't at an
// time. // appropriate time.
assert(!port->onRetryList());
port->onRetryList(true);
retryList.push_back(port); retryList.push_back(port);
} else { } else {
if (port->onRetryList()) { if (!retryList.empty() && port == retryList.front()) {
// The device was retrying a packet. It didn't work, so we'll leave // The device was retrying a packet. It didn't work,
// it at the head of the retry list. // so we'll leave it at the head of the retry list.
assert(port == retryList.front());
inRetry = false; inRetry = false;
} } else {
else { // We are in retry, but not for this port, put it at
port->onRetryList(true); // the end.
retryList.push_back(port); retryList.push_back(port);
} }
} }