changeset 491297d019f3 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=491297d019f3
description:
        SE/FS: Remove System::platform and Platform::intrFrequency.

        In order for a system object to work in SE mode and FS mode, it has to 
either
        always require a platform object even in SE mode, or get rid of the
        requirement all together. Making SE mode carry around 
unnecessary/unused bits
        of FS seems less than ideal, so I decided to go with the second option. 
The
        platform pointer in the System class was used for exactly one purpose, 
a path
        for the Alpha Linux system object to get to the real time clock and 
read its
        frequency so that it could short cut the loops_per_jiffy calculation. 
There
        was also a copy and pasted implementation in MIPS, but since it was 
only there
        because it was there in Alpha I still count that as one use.

        This change reverses the mechanism that communicates the RTC frequency 
so that
        the Tsunami platform object pushes it up to the AlphaSystem object. 
This is
        slightly less specific than it could be because really only the
        AlphaLinuxSystem uses it. Because the intrFrequency function on the 
Platform
        class was no longer necessary (and unimplemented on anything but Alpha) 
it was
        eliminated.

        After this change, a platform will need to have a system, but a system 
won't
        have to have a platform.

diffstat:

 src/arch/alpha/linux/system.cc |   3 +--
 src/arch/alpha/system.cc       |   2 +-
 src/arch/alpha/system.hh       |   5 +++++
 src/arch/mips/linux/system.cc  |  10 +---------
 src/dev/alpha/backdoor.cc      |   7 ++++++-
 src/dev/alpha/tsunami.cc       |  22 +++++++++++++---------
 src/dev/alpha/tsunami.hh       |   8 ++------
 src/dev/arm/realview.cc        |  14 +-------------
 src/dev/arm/realview.hh        |   6 ------
 src/dev/mips/malta.cc          |  11 -----------
 src/dev/mips/malta.hh          |   6 ------
 src/dev/platform.hh            |   1 -
 src/dev/sparc/t1000.cc         |  14 +-------------
 src/dev/sparc/t1000.hh         |   6 ------
 src/dev/x86/pc.cc              |  11 -----------
 src/dev/x86/pc.hh              |   6 ------
 src/sim/system.hh              |   1 -
 17 files changed, 31 insertions(+), 102 deletions(-)

diffs (truncated from 359 to 300 lines):

diff -r 253aeee61e66 -r 491297d019f3 src/arch/alpha/linux/system.cc
--- a/src/arch/alpha/linux/system.cc    Fri Sep 30 00:28:40 2011 -0700
+++ b/src/arch/alpha/linux/system.cc    Fri Sep 30 00:29:07 2011 -0700
@@ -49,7 +49,6 @@
 #include "cpu/base.hh"
 #include "cpu/thread_context.hh"
 #include "debug/Thread.hh"
-#include "dev/platform.hh"
 #include "kern/linux/events.hh"
 #include "kern/linux/printk.hh"
 #include "mem/physical.hh"
@@ -164,7 +163,7 @@
     Addr addr = 0;
     if (kernelSymtab->findAddress("loops_per_jiffy", addr)) {
         Tick cpuFreq = tc->getCpuPtr()->frequency();
-        Tick intrFreq = platform->intrFrequency();
+        assert(intrFreq);
         VirtualPort *vp;
 
         vp = tc->getVirtPort();
diff -r 253aeee61e66 -r 491297d019f3 src/arch/alpha/system.cc
--- a/src/arch/alpha/system.cc  Fri Sep 30 00:28:40 2011 -0700
+++ b/src/arch/alpha/system.cc  Fri Sep 30 00:29:07 2011 -0700
@@ -46,7 +46,7 @@
 using namespace AlphaISA;
 
 AlphaSystem::AlphaSystem(Params *p)
-    : System(p)
+    : System(p), intrFreq(0)
 {
     consoleSymtab = new SymbolTable;
     palSymtab = new SymbolTable;
diff -r 253aeee61e66 -r 491297d019f3 src/arch/alpha/system.hh
--- a/src/arch/alpha/system.hh  Fri Sep 30 00:28:40 2011 -0700
+++ b/src/arch/alpha/system.hh  Fri Sep 30 00:29:07 2011 -0700
@@ -79,6 +79,8 @@
 #endif
 
   protected:
+    Tick intrFreq;
+
     const Params *params() const { return (const Params *)_params; }
 
     /** Add a function-based event to PALcode. */
@@ -98,6 +100,9 @@
     }
 
     virtual Addr fixFuncEventAddr(Addr addr);
+
+  public:
+    void setIntrFreq(Tick freq) { intrFreq = freq; }
 };
 
 #endif // __ARCH_ALPHA_SYSTEM_HH__
diff -r 253aeee61e66 -r 491297d019f3 src/arch/mips/linux/system.cc
--- a/src/arch/mips/linux/system.cc     Fri Sep 30 00:28:40 2011 -0700
+++ b/src/arch/mips/linux/system.cc     Fri Sep 30 00:29:07 2011 -0700
@@ -153,15 +153,7 @@
 void
 LinuxMipsSystem::setDelayLoop(ThreadContext *tc)
 {
-    Addr addr = 0;
-    if (kernelSymtab->findAddress("loops_per_jiffy", addr)) {
-        Tick cpuFreq = tc->getCpuPtr()->frequency();
-        Tick intrFreq = platform->intrFrequency();
-        VirtualPort *vp;
-
-        vp = tc->getVirtPort();
-        vp->writeHtoG(addr, (uint32_t)((cpuFreq / intrFreq) * 0.9988));
-    }
+    panic("setDelayLoop not implemented.\n");
 }
 
 
diff -r 253aeee61e66 -r 491297d019f3 src/dev/alpha/backdoor.cc
--- a/src/dev/alpha/backdoor.cc Fri Sep 30 00:28:40 2011 -0700
+++ b/src/dev/alpha/backdoor.cc Fri Sep 30 00:29:07 2011 -0700
@@ -50,6 +50,9 @@
 #include "cpu/thread_context.hh"
 #include "debug/AlphaBackdoor.hh"
 #include "dev/alpha/backdoor.hh"
+#include "dev/alpha/tsunami.hh"
+#include "dev/alpha/tsunami_cchip.hh"
+#include "dev/alpha/tsunami_io.hh"
 #include "dev/platform.hh"
 #include "dev/simple_disk.hh"
 #include "dev/terminal.hh"
@@ -99,7 +102,9 @@
     alphaAccess->entryPoint = system->getKernelEntry();
     alphaAccess->mem_size = system->physmem->size();
     alphaAccess->cpuClock = cpu->frequency() / 1000000; // In MHz
-    alphaAccess->intrClockFrequency = params()->platform->intrFrequency();
+    Tsunami *tsunami = dynamic_cast<Tsunami *>(params()->platform);
+    assert(tsunami);
+    alphaAccess->intrClockFrequency = tsunami->io->frequency();
 #endif
 }
 
diff -r 253aeee61e66 -r 491297d019f3 src/dev/alpha/tsunami.cc
--- a/src/dev/alpha/tsunami.cc  Fri Sep 30 00:28:40 2011 -0700
+++ b/src/dev/alpha/tsunami.cc  Fri Sep 30 00:29:07 2011 -0700
@@ -36,6 +36,12 @@
 #include <string>
 #include <vector>
 
+#include "config/full_system.hh"
+
+#if FULL_SYSTEM //XXX AlphaSystem doesn't build in SE mode yet.
+#include "arch/alpha/system.hh"
+#endif
+
 #include "config/the_isa.hh"
 #include "cpu/intr_control.hh"
 #include "dev/alpha/tsunami.hh"
@@ -43,7 +49,6 @@
 #include "dev/alpha/tsunami_io.hh"
 #include "dev/alpha/tsunami_pchip.hh"
 #include "dev/terminal.hh"
-#include "sim/system.hh"
 
 using namespace std;
 //Should this be AlphaISA?
@@ -52,19 +57,18 @@
 Tsunami::Tsunami(const Params *p)
     : Platform(p), system(p->system)
 {
-#if FULL_SYSTEM //XXX No platform pointer in SE mode.
-    // set the back pointer from the system to myself
-    system->platform = this;
-#endif
-
     for (int i = 0; i < Tsunami::Max_CPUs; i++)
         intr_sum_type[i] = 0;
 }
 
-Tick
-Tsunami::intrFrequency()
+void
+Tsunami::init()
 {
-    return io->frequency();
+#if FULL_SYSTEM //XXX AlphaSystem doesn't build in SE mode yet.
+    AlphaSystem *alphaSystem = dynamic_cast<AlphaSystem *>(system);
+    assert(alphaSystem);
+    alphaSystem->setIntrFreq(io->frequency());
+#endif
 }
 
 void
diff -r 253aeee61e66 -r 491297d019f3 src/dev/alpha/tsunami.hh
--- a/src/dev/alpha/tsunami.hh  Fri Sep 30 00:28:40 2011 -0700
+++ b/src/dev/alpha/tsunami.hh  Fri Sep 30 00:29:07 2011 -0700
@@ -80,17 +80,13 @@
     int intr_sum_type[Tsunami::Max_CPUs];
     int ipi_pending[Tsunami::Max_CPUs];
 
+    void init();
+
   public:
     typedef TsunamiParams Params;
     Tsunami(const Params *p);
 
     /**
-     * Return the interrupting frequency to AlphaAccess
-     * @return frequency of RTC interrupts
-     */
-    virtual Tick intrFrequency();
-
-    /**
      * Cause the cpu to post a serial interrupt to the CPU.
      */
     virtual void postConsoleInt();
diff -r 253aeee61e66 -r 491297d019f3 src/dev/arm/realview.cc
--- a/src/dev/arm/realview.cc   Fri Sep 30 00:28:40 2011 -0700
+++ b/src/dev/arm/realview.cc   Fri Sep 30 00:29:07 2011 -0700
@@ -60,19 +60,7 @@
 
 RealView::RealView(const Params *p)
     : Platform(p), system(p->system)
-{
-#if FULL_SYSTEM //XXX No platform pointer on the system object in SE mode.
-    // set the back pointer from the system to myself
-    system->platform = this;
-#endif
-}
-
-Tick
-RealView::intrFrequency()
-{
-    panic("Need implementation\n");
-    M5_DUMMY_RETURN
-}
+{}
 
 void
 RealView::postConsoleInt()
diff -r 253aeee61e66 -r 491297d019f3 src/dev/arm/realview.hh
--- a/src/dev/arm/realview.hh   Fri Sep 30 00:28:40 2011 -0700
+++ b/src/dev/arm/realview.hh   Fri Sep 30 00:29:07 2011 -0700
@@ -82,12 +82,6 @@
     void setGic(Gic *_gic) { gic = _gic; }
 
     /**
-     * Return the interrupting frequency to AlphaAccess
-     * @return frequency of RTC interrupts
-     */
-    virtual Tick intrFrequency();
-
-    /**
      * Cause the cpu to post a serial interrupt to the CPU.
      */
     virtual void postConsoleInt();
diff -r 253aeee61e66 -r 491297d019f3 src/dev/mips/malta.cc
--- a/src/dev/mips/malta.cc     Fri Sep 30 00:28:40 2011 -0700
+++ b/src/dev/mips/malta.cc     Fri Sep 30 00:29:07 2011 -0700
@@ -54,21 +54,10 @@
 Malta::Malta(const Params *p)
     : Platform(p), system(p->system)
 {
-#if FULL_SYSTEM //XXX No platform pointer on the system object in SE mode.
-    // set the back pointer from the system to myself
-    system->platform = this;
-#endif
-
     for (int i = 0; i < Malta::Max_CPUs; i++)
         intr_sum_type[i] = 0;
 }
 
-Tick
-Malta::intrFrequency()
-{
-    return io->frequency();
-}
-
 void
 Malta::postConsoleInt()
 {
diff -r 253aeee61e66 -r 491297d019f3 src/dev/mips/malta.hh
--- a/src/dev/mips/malta.hh     Fri Sep 30 00:28:40 2011 -0700
+++ b/src/dev/mips/malta.hh     Fri Sep 30 00:29:07 2011 -0700
@@ -92,12 +92,6 @@
     Malta(const Params *p);
 
     /**
-     * Return the interrupting frequency to MipsAccess
-     * @return frequency of RTC interrupts
-     */
-    virtual Tick intrFrequency();
-
-    /**
      * Cause the cpu to post a serial interrupt to the CPU.
      */
     virtual void postConsoleInt();
diff -r 253aeee61e66 -r 491297d019f3 src/dev/platform.hh
--- a/src/dev/platform.hh       Fri Sep 30 00:28:40 2011 -0700
+++ b/src/dev/platform.hh       Fri Sep 30 00:29:07 2011 -0700
@@ -64,7 +64,6 @@
     virtual ~Platform();
     virtual void postConsoleInt() = 0;
     virtual void clearConsoleInt() = 0;
-    virtual Tick intrFrequency() = 0;
     virtual void postPciInt(int line);
     virtual void clearPciInt(int line);
     virtual Addr pciToDma(Addr pciAddr) const;
diff -r 253aeee61e66 -r 491297d019f3 src/dev/sparc/t1000.cc
--- a/src/dev/sparc/t1000.cc    Fri Sep 30 00:28:40 2011 -0700
+++ b/src/dev/sparc/t1000.cc    Fri Sep 30 00:29:07 2011 -0700
@@ -48,19 +48,7 @@
 
 T1000::T1000(const Params *p)
     : Platform(p), system(p->system)
-{
-#if FULL_SYSTEM //XXX No platform pointer on system objects in SE mode.
-    // set the back pointer from the system to myself
-    system->platform = this;
-#endif
-}
-
-Tick
-T1000::intrFrequency()
-{
-    panic("Need implementation\n");
-    M5_DUMMY_RETURN
-}
+{}
 
 void
 T1000::postConsoleInt()
diff -r 253aeee61e66 -r 491297d019f3 src/dev/sparc/t1000.hh
--- a/src/dev/sparc/t1000.hh    Fri Sep 30 00:28:40 2011 -0700
+++ b/src/dev/sparc/t1000.hh    Fri Sep 30 00:29:07 2011 -0700
@@ -60,12 +60,6 @@
     T1000(const Params *p);
 
     /**
-     * Return the interrupting frequency to AlphaAccess
-     * @return frequency of RTC interrupts
-     */
-    virtual Tick intrFrequency();
-
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to