changeset 3c020ea5eb70 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=3c020ea5eb70
description:
        The ide_ctrl serialize and unserialize were broken.
        Multiple channels were saving their state under the
        same name. This patch separates the saved state of
        the primary and secondary channel.

diffstat:

2 files changed, 2 insertions(+), 3 deletions(-)
src/dev/ide_ctrl.cc |    1 -
src/dev/ide_ctrl.hh |    4 ++--

diffs (123 lines):

diff -r 436cb149e756 -r 3c020ea5eb70 src/dev/ide_ctrl.cc
--- a/src/dev/ide_ctrl.cc       Tue Dec 09 10:34:08 2008 -0800
+++ b/src/dev/ide_ctrl.cc       Sun Dec 14 23:29:49 2008 -0800
@@ -501,8 +501,8 @@
     PciDev::serialize(os);
 
     // Serialize channels
-    primary.serialize(os);
-    secondary.serialize(os);
+    primary.serialize("primary", os);
+    secondary.serialize("secondary", os);
 
     // Serialize config registers
     SERIALIZE_SCALAR(primaryTiming);
@@ -515,23 +515,25 @@
     // Serialize internal state
     SERIALIZE_SCALAR(ioEnabled);
     SERIALIZE_SCALAR(bmEnabled);
+    SERIALIZE_SCALAR(bmiAddr);
+    SERIALIZE_SCALAR(bmiSize);
 }
 
 void
-IdeController::Channel::serialize(std::ostream &os)
+IdeController::Channel::serialize(const std::string &base, std::ostream &os)
 {
-    SERIALIZE_SCALAR(cmdAddr);
-    SERIALIZE_SCALAR(cmdSize);
-    SERIALIZE_SCALAR(ctrlAddr);
-    SERIALIZE_SCALAR(ctrlSize);
+    paramOut(os, base + ".cmdAddr", cmdAddr);
+    paramOut(os, base + ".cmdSize", cmdSize);
+    paramOut(os, base + ".ctrlAddr", ctrlAddr);
+    paramOut(os, base + ".ctrlSize", ctrlSize);
     uint8_t command = bmiRegs.command;
-    SERIALIZE_SCALAR(command);
-    SERIALIZE_SCALAR(bmiRegs.reserved0);
+    paramOut(os, base + ".bmiRegs.command", command);
+    paramOut(os, base + ".bmiRegs.reserved0", bmiRegs.reserved0);
     uint8_t status = bmiRegs.status;
-    SERIALIZE_SCALAR(status);
-    SERIALIZE_SCALAR(bmiRegs.reserved1);
-    SERIALIZE_SCALAR(bmiRegs.bmidtp);
-    SERIALIZE_SCALAR(selectBit);
+    paramOut(os, base + ".bmiRegs.status", status);
+    paramOut(os, base + ".bmiRegs.reserved1", bmiRegs.reserved1);
+    paramOut(os, base + ".bmiRegs.bmidtp", bmiRegs.bmidtp);
+    paramOut(os, base + ".selectBit", selectBit);
 }
 
 void
@@ -541,8 +543,8 @@
     PciDev::unserialize(cp, section);
 
     // Unserialize channels
-    primary.unserialize(cp, section);
-    secondary.unserialize(cp, section);
+    primary.unserialize("primary", cp, section);
+    secondary.unserialize("secondary", cp, section);
 
     // Unserialize config registers
     UNSERIALIZE_SCALAR(primaryTiming);
@@ -555,26 +557,28 @@
     // Unserialize internal state
     UNSERIALIZE_SCALAR(ioEnabled);
     UNSERIALIZE_SCALAR(bmEnabled);
+    UNSERIALIZE_SCALAR(bmiAddr);
+    UNSERIALIZE_SCALAR(bmiSize);
 }
 
 void
-IdeController::Channel::unserialize(
-        Checkpoint *cp, const std::string &section)
+IdeController::Channel::unserialize(const std::string &base, Checkpoint *cp,
+    const std::string &section)
 {
-    UNSERIALIZE_SCALAR(cmdAddr);
-    UNSERIALIZE_SCALAR(cmdSize);
-    UNSERIALIZE_SCALAR(ctrlAddr);
-    UNSERIALIZE_SCALAR(ctrlSize);
+    paramIn(cp, section, base + ".cmdAddr", cmdAddr);
+    paramIn(cp, section, base + ".cmdSize", cmdSize);
+    paramIn(cp, section, base + ".ctrlAddr", ctrlAddr);
+    paramIn(cp, section, base + ".ctrlSize", ctrlSize);
     uint8_t command;
-    UNSERIALIZE_SCALAR(command);
+    paramIn(cp, section, base +".bmiRegs.command", command);
     bmiRegs.command = command;
-    UNSERIALIZE_SCALAR(bmiRegs.reserved0);
+    paramIn(cp, section, base + ".bmiRegs.reserved0", bmiRegs.reserved0);
     uint8_t status;
-    UNSERIALIZE_SCALAR(status);
+    paramIn(cp, section, base + ".bmiRegs.status", status);
     bmiRegs.status = status;
-    UNSERIALIZE_SCALAR(bmiRegs.reserved1);
-    UNSERIALIZE_SCALAR(bmiRegs.bmidtp);
-    UNSERIALIZE_SCALAR(selectBit);
+    paramIn(cp, section, base + ".bmiRegs.reserved1", bmiRegs.reserved1);
+    paramIn(cp, section, base + ".bmiRegs.bmidtp", bmiRegs.bmidtp);
+    paramIn(cp, section, base + ".selectBit", selectBit);
     select(selectBit);
 }
 
diff -r 436cb149e756 -r 3c020ea5eb70 src/dev/ide_ctrl.hh
--- a/src/dev/ide_ctrl.hh       Tue Dec 09 10:34:08 2008 -0800
+++ b/src/dev/ide_ctrl.hh       Sun Dec 14 23:29:49 2008 -0800
@@ -111,10 +111,13 @@
         Channel(std::string newName, Addr _cmdSize, Addr _ctrlSize);
         ~Channel();
 
-        void serialize(std::ostream &os);
-        void unserialize(Checkpoint *cp, const std::string &section);
+        void serialize(const std::string &base, std::ostream &os);
+        void unserialize(const std::string &base, Checkpoint *cp,
+            const std::string &section);
+    };
 
-    } primary, secondary;
+    Channel primary;
+    Channel secondary;
 
     /** Bus master interface (BMI) registers */
     Addr bmiAddr, bmiSize;
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to