X86: Make the time on the RTC configurable.
authorGabe Black <gblack@eecs.umich.edu>
Sat, 11 Oct 2008 06:42:31 +0000 (23:42 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Sat, 11 Oct 2008 06:42:31 +0000 (23:42 -0700)
src/dev/x86/south_bridge/SouthBridge.py
src/dev/x86/south_bridge/cmos.hh
src/dev/x86/south_bridge/south_bridge.cc

index bec3c42233ed3409e4285ed5ae6af8316dfdbbd1..9e1b6689657d8a5c40276732d7e86e164eea38c5 100644 (file)
@@ -32,4 +32,6 @@ from Device import PioDevice
 
 class SouthBridge(PioDevice):
     type = 'SouthBridge'
+    time = Param.Time('01/01/2009',
+        "System time to use ('Now' for actual time)")
     pio_latency = Param.Latency('1ns', "Programmed IO latency in simticks")
index 1cb22fa9ea57e4de5f4468af1979503a969d39ab..585d9351e4bc84e7e0df5c30340973ddd878f783 100644 (file)
@@ -44,8 +44,6 @@ class Cmos : public SubDevice
   protected:
     uint8_t address;
 
-    struct tm foo_time;
-
     static const int numRegs = 128;
 
     uint8_t regs[numRegs];
@@ -70,22 +68,17 @@ class Cmos : public SubDevice
 
   public:
 
-    Cmos(EventManager *em) : rtc(em, "rtc", foo_time, true, ULL(5000000000))
-    {
-        memset(regs, 0, numRegs * sizeof(uint8_t));
-        address = 0;
-    }
-
-    Cmos(EventManager *em, Tick _latency) : SubDevice(_latency),
-        rtc(em, "rtc", foo_time, true, ULL(5000000000))
+    Cmos(EventManager *em, Tick _latency, struct tm time) :
+        SubDevice(_latency), rtc(em, "rtc", time, true, ULL(5000000000))
     {
         memset(regs, 0, numRegs * sizeof(uint8_t));
         address = 0;
     }
 
-    Cmos(EventManager *em, Addr start, Addr size, Tick _latency) :
+    Cmos(EventManager *em, Addr start, Addr size,
+            Tick _latency, struct tm time) :
         SubDevice(start, size, _latency),
-        rtc(em, "rtc", foo_time, true, ULL(5000000000))
+        rtc(em, "rtc", time, true, ULL(5000000000))
     {
         memset(regs, 0, numRegs * sizeof(uint8_t));
         address = 0;
index ded5d7ac5ec9dd74ebd0a7b86ae29cde68226184..fda5acbda9aa18a48bcea0940cbf4d99ac97f823 100644 (file)
@@ -70,7 +70,7 @@ SouthBridge::SouthBridge(const Params *p) : PioDevice(p),
     pic1(0x20, 2, p->pio_latency),
     pic2(0xA0, 2, p->pio_latency),
     pit(this, p->name + ".pit", 0x40, 4, p->pio_latency),
-    cmos(this, 0x70, 2, p->pio_latency),
+    cmos(this, 0x70, 2, p->pio_latency, p->time),
     speaker(&pit, 0x61, 1, p->pio_latency)
 {
     addDevice(pic1);