changeset e4e22240398f in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=e4e22240398f
description:
        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.

diffstat:

 src/arch/x86/interrupts.cc      |   6 +++---
 src/arch/x86/interrupts.hh      |   4 ++--
 src/dev/arm/gic.cc              |   2 +-
 src/dev/arm/gic.hh              |   2 +-
 src/dev/arm/pl111.cc            |   2 +-
 src/dev/arm/pl111.hh            |   2 +-
 src/dev/io_device.cc            |   4 ++--
 src/dev/io_device.hh            |   6 +++---
 src/dev/pciconfigall.cc         |   2 +-
 src/dev/pciconfigall.hh         |   2 +-
 src/dev/pcidev.cc               |   4 ++--
 src/dev/pcidev.hh               |   4 ++--
 src/dev/sparc/iob.cc            |   2 +-
 src/dev/sparc/iob.hh            |   2 +-
 src/dev/uart8250.cc             |   2 +-
 src/dev/uart8250.hh             |   2 +-
 src/dev/x86/i8042.cc            |   3 ++-
 src/dev/x86/i8042.hh            |   2 +-
 src/dev/x86/i82094aa.hh         |   4 ++--
 src/dev/x86/intdev.hh           |   4 ++--
 src/mem/bridge.cc               |   2 +-
 src/mem/bridge.hh               |   2 +-
 src/mem/bus.cc                  |  16 ++++++++--------
 src/mem/bus.hh                  |   5 +++--
 src/mem/cache/cache.hh          |   2 +-
 src/mem/cache/cache_impl.hh     |   2 +-
 src/mem/coherent_bus.hh         |   2 +-
 src/mem/comm_monitor.cc         |   2 +-
 src/mem/comm_monitor.hh         |   4 ++--
 src/mem/noncoherent_bus.hh      |   2 +-
 src/mem/port.hh                 |   3 ++-
 src/mem/ruby/system/RubyPort.cc |   2 +-
 src/mem/ruby/system/RubyPort.hh |   2 +-
 src/mem/simple_mem.cc           |   2 +-
 src/mem/simple_mem.hh           |   2 +-
 35 files changed, 57 insertions(+), 54 deletions(-)

diffs (truncated from 584 to 300 lines):

diff -r da918cb3462e -r e4e22240398f src/arch/x86/interrupts.cc
--- a/src/arch/x86/interrupts.cc        Mon Jul 09 12:35:33 2012 -0400
+++ b/src/arch/x86/interrupts.cc        Mon Jul 09 12:35:34 2012 -0400
@@ -303,6 +303,7 @@
     cpu = newCPU;
     initialApicId = cpu->cpuId();
     regs[APIC_ID] = (initialApicId << 24);
+    pioAddr = x86LocalAPICAddress(initialApicId, 0);
 }
 
 
@@ -367,20 +368,19 @@
 
 
 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),
diff -r da918cb3462e -r e4e22240398f src/arch/x86/interrupts.hh
--- a/src/arch/x86/interrupts.hh        Mon Jul 09 12:35:33 2012 -0400
+++ b/src/arch/x86/interrupts.hh        Mon Jul 09 12:35:34 2012 -0400
@@ -236,8 +236,8 @@
         return entry.periodic;
     }
 
-    AddrRangeList getAddrRanges();
-    AddrRangeList getIntAddrRange();
+    AddrRangeList getAddrRanges() const;
+    AddrRangeList getIntAddrRange() const;
 
     MasterPort &getMasterPort(const std::string &if_name, int idx = -1)
     {
diff -r da918cb3462e -r e4e22240398f src/dev/arm/gic.cc
--- a/src/dev/arm/gic.cc        Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/arm/gic.cc        Mon Jul 09 12:35:34 2012 -0400
@@ -708,7 +708,7 @@
 }
 
 AddrRangeList
-Gic::getAddrRanges()
+Gic::getAddrRanges() const
 {
     AddrRangeList ranges;
     ranges.push_back(RangeSize(distAddr, DIST_SIZE));
diff -r da918cb3462e -r e4e22240398f src/dev/arm/gic.hh
--- a/src/dev/arm/gic.hh        Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/arm/gic.hh        Mon Jul 09 12:35:34 2012 -0400
@@ -261,7 +261,7 @@
     /** 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()
diff -r da918cb3462e -r e4e22240398f src/dev/arm/pl111.cc
--- a/src/dev/arm/pl111.cc      Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/arm/pl111.cc      Mon Jul 09 12:35:34 2012 -0400
@@ -746,7 +746,7 @@
 }
 
 AddrRangeList
-Pl111::getAddrRanges()
+Pl111::getAddrRanges() const
 {
     AddrRangeList ranges;
     ranges.push_back(RangeSize(pioAddr, pioSize));
diff -r da918cb3462e -r e4e22240398f src/dev/arm/pl111.hh
--- a/src/dev/arm/pl111.hh      Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/arm/pl111.hh      Mon Jul 09 12:35:34 2012 -0400
@@ -329,7 +329,7 @@
      *
      * @return a list of non-overlapping address ranges
      */
-    AddrRangeList getAddrRanges();
+    AddrRangeList getAddrRanges() const;
 };
 
 #endif
diff -r da918cb3462e -r e4e22240398f src/dev/io_device.cc
--- a/src/dev/io_device.cc      Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/io_device.cc      Mon Jul 09 12:35:34 2012 -0400
@@ -58,7 +58,7 @@
 }
 
 AddrRangeList
-PioPort::getAddrRanges()
+PioPort::getAddrRanges() const
 {
     return device->getAddrRanges();
 }
@@ -106,7 +106,7 @@
 {}
 
 AddrRangeList
-BasicPioDevice::getAddrRanges()
+BasicPioDevice::getAddrRanges() const
 {
     assert(pioSize != 0);
     AddrRangeList ranges;
diff -r da918cb3462e -r e4e22240398f src/dev/io_device.hh
--- a/src/dev/io_device.hh      Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/io_device.hh      Mon Jul 09 12:35:34 2012 -0400
@@ -67,7 +67,7 @@
 
     virtual Tick recvAtomic(PacketPtr pkt);
 
-    virtual AddrRangeList getAddrRanges();
+    virtual AddrRangeList getAddrRanges() const;
 
   public:
 
@@ -96,7 +96,7 @@
      *
      * @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 @@
      *
      * @return a list of non-overlapping address ranges
      */
-    virtual AddrRangeList getAddrRanges();
+    virtual AddrRangeList getAddrRanges() const;
 
 };
 
diff -r da918cb3462e -r e4e22240398f src/dev/pciconfigall.cc
--- a/src/dev/pciconfigall.cc   Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/pciconfigall.cc   Mon Jul 09 12:35:34 2012 -0400
@@ -85,7 +85,7 @@
 
 
 AddrRangeList
-PciConfigAll::getAddrRanges()
+PciConfigAll::getAddrRanges() const
 {
     AddrRangeList ranges;
     ranges.push_back(RangeSize(pioAddr, params()->size));
diff -r da918cb3462e -r e4e22240398f src/dev/pciconfigall.hh
--- a/src/dev/pciconfigall.hh   Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/pciconfigall.hh   Mon Jul 09 12:35:34 2012 -0400
@@ -80,7 +80,7 @@
 
     virtual Tick write(PacketPtr pkt);
 
-    AddrRangeList getAddrRanges();
+    AddrRangeList getAddrRanges() const;
 
   private:
     Addr pioAddr;
diff -r da918cb3462e -r e4e22240398f src/dev/pcidev.cc
--- a/src/dev/pcidev.cc Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/pcidev.cc Mon Jul 09 12:35:34 2012 -0400
@@ -71,7 +71,7 @@
 }
 
 AddrRangeList
-PciDev::PciConfigPort::getAddrRanges()
+PciDev::PciConfigPort::getAddrRanges() const
 {
     AddrRangeList ranges;
     if (configAddr != ULL(-1))
@@ -208,7 +208,7 @@
 }
 
 AddrRangeList
-PciDev::getAddrRanges()
+PciDev::getAddrRanges() const
 {
     AddrRangeList ranges;
     int x = 0;
diff -r da918cb3462e -r e4e22240398f src/dev/pcidev.hh
--- a/src/dev/pcidev.hh Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/pcidev.hh Mon Jul 09 12:35:34 2012 -0400
@@ -65,7 +65,7 @@
 
         virtual Tick recvAtomic(PacketPtr pkt);
 
-        virtual AddrRangeList getAddrRanges();
+        virtual AddrRangeList getAddrRanges() const;
 
         Platform *platform;
 
@@ -191,7 +191,7 @@
      *
      * @return a list of non-overlapping address ranges
      */
-    AddrRangeList getAddrRanges();
+    AddrRangeList getAddrRanges() const;
 
     /**
      * Constructor for PCI Dev. This function copies data from the
diff -r da918cb3462e -r e4e22240398f src/dev/sparc/iob.cc
--- a/src/dev/sparc/iob.cc      Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/sparc/iob.cc      Mon Jul 09 12:35:34 2012 -0400
@@ -324,7 +324,7 @@
 }
 
 AddrRangeList
-Iob::getAddrRanges()
+Iob::getAddrRanges() const
 {
     AddrRangeList ranges;
     ranges.push_back(RangeSize(iobManAddr, iobManSize));
diff -r da918cb3462e -r e4e22240398f src/dev/sparc/iob.hh
--- a/src/dev/sparc/iob.hh      Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/sparc/iob.hh      Mon Jul 09 12:35:34 2012 -0400
@@ -141,7 +141,7 @@
     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 &section);
diff -r da918cb3462e -r e4e22240398f src/dev/uart8250.cc
--- a/src/dev/uart8250.cc       Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/uart8250.cc       Mon Jul 09 12:35:34 2012 -0400
@@ -287,7 +287,7 @@
 }
 
 AddrRangeList
-Uart8250::getAddrRanges()
+Uart8250::getAddrRanges() const
 {
     AddrRangeList ranges;
     ranges.push_back(RangeSize(pioAddr, pioSize));
diff -r da918cb3462e -r e4e22240398f src/dev/uart8250.hh
--- a/src/dev/uart8250.hh       Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/uart8250.hh       Mon Jul 09 12:35:34 2012 -0400
@@ -100,7 +100,7 @@
 
     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.
diff -r da918cb3462e -r e4e22240398f src/dev/x86/i8042.cc
--- a/src/dev/x86/i8042.cc      Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/x86/i8042.cc      Mon Jul 09 12:35:34 2012 -0400
@@ -44,9 +44,10 @@
 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;
diff -r da918cb3462e -r e4e22240398f src/dev/x86/i8042.hh
--- a/src/dev/x86/i8042.hh      Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/x86/i8042.hh      Mon Jul 09 12:35:34 2012 -0400
@@ -255,7 +255,7 @@
         commandByte.keyboardFullInt = 1;
     }
 
-    AddrRangeList getAddrRanges();
+    AddrRangeList getAddrRanges() const;
 
     Tick read(PacketPtr pkt);
 
diff -r da918cb3462e -r e4e22240398f src/dev/x86/i82094aa.hh
--- a/src/dev/x86/i82094aa.hh   Mon Jul 09 12:35:33 2012 -0400
+++ b/src/dev/x86/i82094aa.hh   Mon Jul 09 12:35:34 2012 -0400
@@ -101,7 +101,7 @@
     Tick read(PacketPtr pkt);
     Tick write(PacketPtr pkt);
 
-    AddrRangeList getAddrRanges()
+    AddrRangeList getAddrRanges() const
     {
         AddrRangeList ranges;
         ranges.push_back(RangeEx(pioAddr, pioAddr + 4));
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to