Port: Make getAddrRanges const
This patch makes getAddrRanges const throughout the code base. There is no reason why it should not be, and making it const prevents adding any unintentional side-effects.
This commit is contained in:
@@ -303,6 +303,7 @@ X86ISA::Interrupts::setCPU(BaseCPU * newCPU)
|
||||
cpu = newCPU;
|
||||
initialApicId = cpu->cpuId();
|
||||
regs[APIC_ID] = (initialApicId << 24);
|
||||
pioAddr = x86LocalAPICAddress(initialApicId, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -367,20 +368,19 @@ X86ISA::Interrupts::recvResponse(PacketPtr pkt)
|
||||
|
||||
|
||||
AddrRangeList
|
||||
X86ISA::Interrupts::getAddrRanges()
|
||||
X86ISA::Interrupts::getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
Range<Addr> range = RangeEx(x86LocalAPICAddress(initialApicId, 0),
|
||||
x86LocalAPICAddress(initialApicId, 0) +
|
||||
PageBytes);
|
||||
ranges.push_back(range);
|
||||
pioAddr = range.start;
|
||||
return ranges;
|
||||
}
|
||||
|
||||
|
||||
AddrRangeList
|
||||
X86ISA::Interrupts::getIntAddrRange()
|
||||
X86ISA::Interrupts::getIntAddrRange() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
ranges.push_back(RangeEx(x86InterruptAddress(initialApicId, 0),
|
||||
|
||||
@@ -236,8 +236,8 @@ class Interrupts : public BasicPioDevice, IntDev
|
||||
return entry.periodic;
|
||||
}
|
||||
|
||||
AddrRangeList getAddrRanges();
|
||||
AddrRangeList getIntAddrRange();
|
||||
AddrRangeList getAddrRanges() const;
|
||||
AddrRangeList getIntAddrRange() const;
|
||||
|
||||
MasterPort &getMasterPort(const std::string &if_name, int idx = -1)
|
||||
{
|
||||
|
||||
@@ -708,7 +708,7 @@ Gic::postInt(uint32_t cpu, Tick when)
|
||||
}
|
||||
|
||||
AddrRangeList
|
||||
Gic::getAddrRanges()
|
||||
Gic::getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
ranges.push_back(RangeSize(distAddr, DIST_SIZE));
|
||||
|
||||
@@ -261,7 +261,7 @@ class Gic : public PioDevice
|
||||
/** Return the address ranges used by the Gic
|
||||
* This is the distributor address + all cpu addresses
|
||||
*/
|
||||
virtual AddrRangeList getAddrRanges();
|
||||
virtual AddrRangeList getAddrRanges() const;
|
||||
|
||||
/** A PIO read to the device, immediately split up into
|
||||
* readDistributor() or readCpu()
|
||||
|
||||
@@ -746,7 +746,7 @@ Pl111::generateInterrupt()
|
||||
}
|
||||
|
||||
AddrRangeList
|
||||
Pl111::getAddrRanges()
|
||||
Pl111::getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
ranges.push_back(RangeSize(pioAddr, pioSize));
|
||||
|
||||
@@ -329,7 +329,7 @@ class Pl111: public AmbaDmaDevice
|
||||
*
|
||||
* @return a list of non-overlapping address ranges
|
||||
*/
|
||||
AddrRangeList getAddrRanges();
|
||||
AddrRangeList getAddrRanges() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -58,7 +58,7 @@ PioPort::recvAtomic(PacketPtr pkt)
|
||||
}
|
||||
|
||||
AddrRangeList
|
||||
PioPort::getAddrRanges()
|
||||
PioPort::getAddrRanges() const
|
||||
{
|
||||
return device->getAddrRanges();
|
||||
}
|
||||
@@ -106,7 +106,7 @@ BasicPioDevice::BasicPioDevice(const Params *p)
|
||||
{}
|
||||
|
||||
AddrRangeList
|
||||
BasicPioDevice::getAddrRanges()
|
||||
BasicPioDevice::getAddrRanges() const
|
||||
{
|
||||
assert(pioSize != 0);
|
||||
AddrRangeList ranges;
|
||||
|
||||
@@ -67,7 +67,7 @@ class PioPort : public SimpleTimingPort
|
||||
|
||||
virtual Tick recvAtomic(PacketPtr pkt);
|
||||
|
||||
virtual AddrRangeList getAddrRanges();
|
||||
virtual AddrRangeList getAddrRanges() const;
|
||||
|
||||
public:
|
||||
|
||||
@@ -96,7 +96,7 @@ class PioDevice : public MemObject
|
||||
*
|
||||
* @return a list of non-overlapping address ranges
|
||||
*/
|
||||
virtual AddrRangeList getAddrRanges() = 0;
|
||||
virtual AddrRangeList getAddrRanges() const = 0;
|
||||
|
||||
/** Pure virtual function that the device must implement. Called
|
||||
* when a read command is recieved by the port.
|
||||
@@ -160,7 +160,7 @@ class BasicPioDevice : public PioDevice
|
||||
*
|
||||
* @return a list of non-overlapping address ranges
|
||||
*/
|
||||
virtual AddrRangeList getAddrRanges();
|
||||
virtual AddrRangeList getAddrRanges() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ PciConfigAll::write(PacketPtr pkt)
|
||||
|
||||
|
||||
AddrRangeList
|
||||
PciConfigAll::getAddrRanges()
|
||||
PciConfigAll::getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
ranges.push_back(RangeSize(pioAddr, params()->size));
|
||||
|
||||
@@ -80,7 +80,7 @@ class PciConfigAll : public PioDevice
|
||||
|
||||
virtual Tick write(PacketPtr pkt);
|
||||
|
||||
AddrRangeList getAddrRanges();
|
||||
AddrRangeList getAddrRanges() const;
|
||||
|
||||
private:
|
||||
Addr pioAddr;
|
||||
|
||||
@@ -71,7 +71,7 @@ PciDev::PciConfigPort::recvAtomic(PacketPtr pkt)
|
||||
}
|
||||
|
||||
AddrRangeList
|
||||
PciDev::PciConfigPort::getAddrRanges()
|
||||
PciDev::PciConfigPort::getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
if (configAddr != ULL(-1))
|
||||
@@ -208,7 +208,7 @@ PciDev::readConfig(PacketPtr pkt)
|
||||
}
|
||||
|
||||
AddrRangeList
|
||||
PciDev::getAddrRanges()
|
||||
PciDev::getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
int x = 0;
|
||||
|
||||
@@ -65,7 +65,7 @@ class PciDev : public DmaDevice
|
||||
|
||||
virtual Tick recvAtomic(PacketPtr pkt);
|
||||
|
||||
virtual AddrRangeList getAddrRanges();
|
||||
virtual AddrRangeList getAddrRanges() const;
|
||||
|
||||
Platform *platform;
|
||||
|
||||
@@ -191,7 +191,7 @@ class PciDev : public DmaDevice
|
||||
*
|
||||
* @return a list of non-overlapping address ranges
|
||||
*/
|
||||
AddrRangeList getAddrRanges();
|
||||
AddrRangeList getAddrRanges() const;
|
||||
|
||||
/**
|
||||
* Constructor for PCI Dev. This function copies data from the
|
||||
|
||||
@@ -324,7 +324,7 @@ Iob::receiveJBusInterrupt(int cpu_id, int source, uint64_t d0, uint64_t d1)
|
||||
}
|
||||
|
||||
AddrRangeList
|
||||
Iob::getAddrRanges()
|
||||
Iob::getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
ranges.push_back(RangeSize(iobManAddr, iobManSize));
|
||||
|
||||
@@ -141,7 +141,7 @@ class Iob : public PioDevice
|
||||
bool receiveJBusInterrupt(int cpu_id, int source, uint64_t d0,
|
||||
uint64_t d1);
|
||||
|
||||
AddrRangeList getAddrRanges();
|
||||
AddrRangeList getAddrRanges() const;
|
||||
|
||||
virtual void serialize(std::ostream &os);
|
||||
virtual void unserialize(Checkpoint *cp, const std::string §ion);
|
||||
|
||||
@@ -287,7 +287,7 @@ Uart8250::dataAvailable()
|
||||
}
|
||||
|
||||
AddrRangeList
|
||||
Uart8250::getAddrRanges()
|
||||
Uart8250::getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
ranges.push_back(RangeSize(pioAddr, pioSize));
|
||||
|
||||
@@ -100,7 +100,7 @@ class Uart8250 : public Uart
|
||||
|
||||
virtual Tick read(PacketPtr pkt);
|
||||
virtual Tick write(PacketPtr pkt);
|
||||
virtual AddrRangeList getAddrRanges();
|
||||
virtual AddrRangeList getAddrRanges() const;
|
||||
|
||||
/**
|
||||
* Inform the uart that there is data available.
|
||||
|
||||
@@ -44,9 +44,10 @@ const uint8_t CommandNack = 0xfe;
|
||||
const uint8_t BatSuccessful = 0xaa;
|
||||
|
||||
AddrRangeList
|
||||
X86ISA::I8042::getAddrRanges()
|
||||
X86ISA::I8042::getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
// TODO: Are these really supposed to be a single byte and not 4?
|
||||
ranges.push_back(RangeSize(dataPort, 1));
|
||||
ranges.push_back(RangeSize(commandPort, 1));
|
||||
return ranges;
|
||||
|
||||
@@ -255,7 +255,7 @@ class I8042 : public BasicPioDevice
|
||||
commandByte.keyboardFullInt = 1;
|
||||
}
|
||||
|
||||
AddrRangeList getAddrRanges();
|
||||
AddrRangeList getAddrRanges() const;
|
||||
|
||||
Tick read(PacketPtr pkt);
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ class I82094AA : public PioDevice, public IntDev
|
||||
Tick read(PacketPtr pkt);
|
||||
Tick write(PacketPtr pkt);
|
||||
|
||||
AddrRangeList getAddrRanges()
|
||||
AddrRangeList getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
ranges.push_back(RangeEx(pioAddr, pioAddr + 4));
|
||||
@@ -109,7 +109,7 @@ class I82094AA : public PioDevice, public IntDev
|
||||
return ranges;
|
||||
}
|
||||
|
||||
AddrRangeList getIntAddrRange()
|
||||
AddrRangeList getIntAddrRange() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
ranges.push_back(RangeEx(x86InterruptAddress(initialApicId, 0),
|
||||
|
||||
@@ -74,7 +74,7 @@ class IntDev
|
||||
{
|
||||
}
|
||||
|
||||
AddrRangeList getAddrRanges()
|
||||
AddrRangeList getAddrRanges() const
|
||||
{
|
||||
return device->getIntAddrRange();
|
||||
}
|
||||
@@ -152,7 +152,7 @@ class IntDev
|
||||
}
|
||||
|
||||
virtual AddrRangeList
|
||||
getIntAddrRange()
|
||||
getIntAddrRange() const
|
||||
{
|
||||
panic("intAddrRange not implemented.\n");
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ Bridge::BridgeMasterPort::checkFunctional(PacketPtr pkt)
|
||||
}
|
||||
|
||||
AddrRangeList
|
||||
Bridge::BridgeSlavePort::getAddrRanges()
|
||||
Bridge::BridgeSlavePort::getAddrRanges() const
|
||||
{
|
||||
return ranges;
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ class Bridge : public MemObject
|
||||
|
||||
/** When receiving a address range request the peer port,
|
||||
pass it to the bridge. */
|
||||
virtual AddrRangeList getAddrRanges();
|
||||
virtual AddrRangeList getAddrRanges() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ BaseBus::findPort(Addr addr)
|
||||
return dest_id;
|
||||
|
||||
// Check normal port ranges
|
||||
PortIter i = portMap.find(RangeSize(addr,1));
|
||||
PortMapConstIter i = portMap.find(RangeSize(addr,1));
|
||||
if (i != portMap.end()) {
|
||||
dest_id = i->second;
|
||||
updatePortCache(dest_id, i->first.start, i->first.end);
|
||||
@@ -278,8 +278,8 @@ BaseBus::findPort(Addr addr)
|
||||
|
||||
// Check if this matches the default range
|
||||
if (useDefaultRange) {
|
||||
AddrRangeIter a_end = defaultRange.end();
|
||||
for (AddrRangeIter i = defaultRange.begin(); i != a_end; i++) {
|
||||
AddrRangeConstIter a_end = defaultRange.end();
|
||||
for (AddrRangeConstIter i = defaultRange.begin(); i != a_end; i++) {
|
||||
if (*i == addr) {
|
||||
DPRINTF(BusAddrRanges, " found addr %#llx on default\n",
|
||||
addr);
|
||||
@@ -332,7 +332,7 @@ BaseBus::recvRangeChange(PortID master_port_id)
|
||||
MasterPort *port = masterPorts[master_port_id];
|
||||
|
||||
// Clean out any previously existent ids
|
||||
for (PortIter portIter = portMap.begin();
|
||||
for (PortMapIter portIter = portMap.begin();
|
||||
portIter != portMap.end(); ) {
|
||||
if (portIter->second == master_port_id)
|
||||
portMap.erase(portIter++);
|
||||
@@ -367,22 +367,22 @@ BaseBus::recvRangeChange(PortID master_port_id)
|
||||
}
|
||||
|
||||
AddrRangeList
|
||||
BaseBus::getAddrRanges()
|
||||
BaseBus::getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
|
||||
DPRINTF(BusAddrRanges, "received address range request, returning:\n");
|
||||
|
||||
for (AddrRangeIter dflt_iter = defaultRange.begin();
|
||||
for (AddrRangeConstIter dflt_iter = defaultRange.begin();
|
||||
dflt_iter != defaultRange.end(); dflt_iter++) {
|
||||
ranges.push_back(*dflt_iter);
|
||||
DPRINTF(BusAddrRanges, " -- Dflt: %#llx : %#llx\n",dflt_iter->start,
|
||||
dflt_iter->end);
|
||||
}
|
||||
for (PortIter portIter = portMap.begin();
|
||||
for (PortMapConstIter portIter = portMap.begin();
|
||||
portIter != portMap.end(); portIter++) {
|
||||
bool subset = false;
|
||||
for (AddrRangeIter dflt_iter = defaultRange.begin();
|
||||
for (AddrRangeConstIter dflt_iter = defaultRange.begin();
|
||||
dflt_iter != defaultRange.end(); dflt_iter++) {
|
||||
if ((portIter->first.start < dflt_iter->start &&
|
||||
portIter->first.end >= dflt_iter->start) ||
|
||||
|
||||
@@ -85,7 +85,8 @@ class BaseBus : public MemObject
|
||||
|
||||
Event * drainEvent;
|
||||
|
||||
typedef range_map<Addr, PortID>::iterator PortIter;
|
||||
typedef range_map<Addr, PortID>::iterator PortMapIter;
|
||||
typedef range_map<Addr, PortID>::const_iterator PortMapConstIter;
|
||||
range_map<Addr, PortID> portMap;
|
||||
|
||||
AddrRangeList defaultRange;
|
||||
@@ -187,7 +188,7 @@ class BaseBus : public MemObject
|
||||
*
|
||||
* @return a list of non-overlapping address ranges
|
||||
*/
|
||||
AddrRangeList getAddrRanges();
|
||||
AddrRangeList getAddrRanges() const;
|
||||
|
||||
/** Calculate the timing parameters for the packet. Updates the
|
||||
* firstWordTime and finishTime fields of the packet object.
|
||||
|
||||
2
src/mem/cache/cache.hh
vendored
2
src/mem/cache/cache.hh
vendored
@@ -101,7 +101,7 @@ class Cache : public BaseCache
|
||||
virtual unsigned deviceBlockSize() const
|
||||
{ return cache->getBlockSize(); }
|
||||
|
||||
virtual AddrRangeList getAddrRanges();
|
||||
virtual AddrRangeList getAddrRanges() const;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
2
src/mem/cache/cache_impl.hh
vendored
2
src/mem/cache/cache_impl.hh
vendored
@@ -1588,7 +1588,7 @@ Cache<TagStore>::unserialize(Checkpoint *cp, const std::string §ion)
|
||||
|
||||
template<class TagStore>
|
||||
AddrRangeList
|
||||
Cache<TagStore>::CpuSidePort::getAddrRanges()
|
||||
Cache<TagStore>::CpuSidePort::getAddrRanges() const
|
||||
{
|
||||
return cache->getAddrRanges();
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ class CoherentBus : public BaseBus
|
||||
/**
|
||||
* Return the union of all adress ranges seen by this bus.
|
||||
*/
|
||||
virtual AddrRangeList getAddrRanges()
|
||||
virtual AddrRangeList getAddrRanges() const
|
||||
{ return bus.getAddrRanges(); }
|
||||
|
||||
/**
|
||||
|
||||
@@ -345,7 +345,7 @@ CommMonitor::deviceBlockSizeSlave()
|
||||
}
|
||||
|
||||
AddrRangeList
|
||||
CommMonitor::getAddrRanges()
|
||||
CommMonitor::getAddrRanges() const
|
||||
{
|
||||
// get the address ranges of the connected slave port
|
||||
return masterPort.getAddrRanges();
|
||||
|
||||
@@ -230,7 +230,7 @@ class CommMonitor : public MemObject
|
||||
return mon.deviceBlockSizeSlave();
|
||||
}
|
||||
|
||||
AddrRangeList getAddrRanges()
|
||||
AddrRangeList getAddrRanges() const
|
||||
{
|
||||
return mon.getAddrRanges();
|
||||
}
|
||||
@@ -269,7 +269,7 @@ class CommMonitor : public MemObject
|
||||
|
||||
unsigned deviceBlockSizeSlave();
|
||||
|
||||
AddrRangeList getAddrRanges();
|
||||
AddrRangeList getAddrRanges() const;
|
||||
|
||||
bool isSnooping() const;
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ class NoncoherentBus : public BaseBus
|
||||
/**
|
||||
* Return the union of all adress ranges seen by this bus.
|
||||
*/
|
||||
virtual AddrRangeList getAddrRanges()
|
||||
virtual AddrRangeList getAddrRanges() const
|
||||
{ return bus.getAddrRanges(); }
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
|
||||
typedef std::list<Range<Addr> > AddrRangeList;
|
||||
typedef std::list<Range<Addr> >::iterator AddrRangeIter;
|
||||
typedef std::list<Range<Addr> >::const_iterator AddrRangeConstIter;
|
||||
|
||||
class MemObject;
|
||||
|
||||
@@ -379,7 +380,7 @@ class SlavePort : public Port
|
||||
*
|
||||
* @return a list of ranges responded to
|
||||
*/
|
||||
virtual AddrRangeList getAddrRanges() = 0;
|
||||
virtual AddrRangeList getAddrRanges() const = 0;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -669,7 +669,7 @@ RubyPort::PioPort::sendNextCycle(PacketPtr pkt)
|
||||
}
|
||||
|
||||
AddrRangeList
|
||||
RubyPort::M5Port::getAddrRanges()
|
||||
RubyPort::M5Port::getAddrRanges() const
|
||||
{
|
||||
// at the moment the assumption is that the master does not care
|
||||
AddrRangeList ranges;
|
||||
|
||||
@@ -86,7 +86,7 @@ class RubyPort : public MemObject
|
||||
virtual bool recvTimingReq(PacketPtr pkt);
|
||||
virtual Tick recvAtomic(PacketPtr pkt);
|
||||
virtual void recvFunctional(PacketPtr pkt);
|
||||
virtual AddrRangeList getAddrRanges();
|
||||
virtual AddrRangeList getAddrRanges() const;
|
||||
|
||||
private:
|
||||
bool isPhysMemAddress(Addr addr);
|
||||
|
||||
@@ -132,7 +132,7 @@ SimpleMemory::MemoryPort::MemoryPort(const std::string& _name,
|
||||
{ }
|
||||
|
||||
AddrRangeList
|
||||
SimpleMemory::MemoryPort::getAddrRanges()
|
||||
SimpleMemory::MemoryPort::getAddrRanges() const
|
||||
{
|
||||
AddrRangeList ranges;
|
||||
ranges.push_back(memory.getAddrRange());
|
||||
|
||||
@@ -77,7 +77,7 @@ class SimpleMemory : public AbstractMemory
|
||||
|
||||
virtual void recvFunctional(PacketPtr pkt);
|
||||
|
||||
virtual AddrRangeList getAddrRanges();
|
||||
virtual AddrRangeList getAddrRanges() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user