Dev: Make the RTC device ignore writes to a read only bit.
authorGabe Black <gblack@eecs.umich.edu>
Mon, 26 Jan 2009 04:32:26 +0000 (20:32 -0800)
committerGabe Black <gblack@eecs.umich.edu>
Mon, 26 Jan 2009 04:32:26 +0000 (20:32 -0800)
src/dev/mc146818.cc

index e5a81ff7536707054e3d4d1a19b2a01a7c322adc..7b219e30c3f5a25341f316ee6a5c6e9834465a99 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <string>
 
+#include "base/bitfield.hh"
 #include "base/time.hh"
 #include "base/trace.hh"
 #include "dev/mc146818.hh"
@@ -87,9 +88,10 @@ MC146818::writeData(const uint8_t addr, const uint8_t data)
     else {
         switch (addr) {
           case RTC_STAT_REGA:
-            if (data != (RTCA_32768HZ | RTCA_1024HZ))
+            // The "update in progress" bit is read only.
+            if ((data & ~RTCA_UIP) != (RTCA_32768HZ | RTCA_1024HZ))
                 panic("Unimplemented RTC register A value write!\n");
-            stat_regA = data;
+            replaceBits(stat_regA, data, 6, 0);
             break;
           case RTC_STAT_REGB:
             if ((data & ~(RTCB_PRDC_IE | RTCB_SQWE)) != (RTCB_BIN | RTCB_24HR))