arm: Wire up the GIC with the platform in the base class
authorAndreas Sandberg <Andreas.Sandberg@ARM.com>
Mon, 16 Feb 2015 08:34:18 +0000 (03:34 -0500)
committerAndreas Sandberg <Andreas.Sandberg@ARM.com>
Mon, 16 Feb 2015 08:34:18 +0000 (03:34 -0500)
Move the (common) GIC initialization code that notifies the platform
code of the new GIC to the base class (BaseGic) instead of the Pl390
implementation.

src/dev/arm/base_gic.cc
src/dev/arm/gic_pl390.cc

index 47e21107748b34d1e81b82f3f2fa2b3084e48101..ece8352d3644f39c2eada0a8947900b8bf092dd3 100644 (file)
 
 #include "dev/arm/base_gic.hh"
 
+#include "dev/arm/realview.hh"
 #include "params/BaseGic.hh"
 
 BaseGic::BaseGic(const Params *p)
         : PioDevice(p),
           platform(p->platform)
 {
+    RealView *const rv(dynamic_cast<RealView*>(p->platform));
+    // The platform keeps track of the GIC that is hooked up to the
+    // system. Due to quirks in gem5's configuration system, the
+    // platform can't take a GIC as parameter. Instead, we need to
+    // register with the platform when a new GIC is created. If we
+    // can't find a platform, something is seriously wrong.
+    fatal_if(!rv, "GIC model can't register with platform code");
+    rv->setGic(this);
 }
 
 BaseGic::~BaseGic()
index 019b3ee8bcc8fba06f34e8b14a6dff2de8e83575..e0d75dc6bdba742a5f4d7b1badfe1cbb0114072b 100644 (file)
@@ -47,7 +47,6 @@
 #include "debug/IPI.hh"
 #include "debug/Interrupt.hh"
 #include "dev/arm/gic_pl390.hh"
-#include "dev/arm/realview.hh"
 #include "dev/terminal.hh"
 #include "mem/packet.hh"
 #include "mem/packet_access.hh"
@@ -102,11 +101,6 @@ Pl390::Pl390(const Params *p)
             bankedIntPriority[i][j] = 0;
         }
     }
-
-    RealView *rv = dynamic_cast<RealView*>(p->platform);
-    assert(rv);
-    rv->setGic(this);
-
 }
 
 Tick