X86: Rework interrupt pins to allow one to many connections.
[gem5.git] / src / dev / ide_ctrl.cc
index ced7686c7b9f60cd57ad98d82169416cb3c5f8ef..3d4e71888ac5171c117ccaf41006c35ed7c49aa3 100644 (file)
@@ -501,8 +501,8 @@ IdeController::serialize(std::ostream &os)
     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,21 +515,25 @@ IdeController::serialize(std::ostream &os)
     // 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);
-    SERIALIZE_SCALAR((uint8_t)bmiRegs.command);
-    SERIALIZE_SCALAR(bmiRegs.reserved0);
-    SERIALIZE_SCALAR((uint8_t)bmiRegs.status);
-    SERIALIZE_SCALAR(bmiRegs.reserved1);
-    SERIALIZE_SCALAR(bmiRegs.bmidtp);
-    SERIALIZE_SCALAR(selectBit);
+    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;
+    paramOut(os, base + ".bmiRegs.command", command);
+    paramOut(os, base + ".bmiRegs.reserved0", bmiRegs.reserved0);
+    uint8_t status = bmiRegs.status;
+    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
@@ -539,8 +543,8 @@ IdeController::unserialize(Checkpoint *cp, const std::string &section)
     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);
@@ -553,25 +557,28 @@ IdeController::unserialize(Checkpoint *cp, const std::string &section)
     // 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)
 {
-    uint8_t temp;
-    UNSERIALIZE_SCALAR(cmdAddr);
-    UNSERIALIZE_SCALAR(cmdSize);
-    UNSERIALIZE_SCALAR(ctrlAddr);
-    UNSERIALIZE_SCALAR(ctrlSize);
-    UNSERIALIZE_SCALAR(temp);
-    bmiRegs.command = temp;
-    UNSERIALIZE_SCALAR(bmiRegs.reserved0);
-    UNSERIALIZE_SCALAR(temp);
-    bmiRegs.status = temp;
-    UNSERIALIZE_SCALAR(bmiRegs.reserved1);
-    UNSERIALIZE_SCALAR(bmiRegs.bmidtp);
-    UNSERIALIZE_SCALAR(selectBit);
+    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;
+    paramIn(cp, section, base +".bmiRegs.command", command);
+    bmiRegs.command = command;
+    paramIn(cp, section, base + ".bmiRegs.reserved0", bmiRegs.reserved0);
+    uint8_t status;
+    paramIn(cp, section, base + ".bmiRegs.status", status);
+    bmiRegs.status = status;
+    paramIn(cp, section, base + ".bmiRegs.reserved1", bmiRegs.reserved1);
+    paramIn(cp, section, base + ".bmiRegs.bmidtp", bmiRegs.bmidtp);
+    paramIn(cp, section, base + ".selectBit", selectBit);
     select(selectBit);
 }