Lots of fixes to serialization and naming of various device

objects.  The improper serialization of arrays was particularly
bad.

dev/alpha_console.cc:
dev/isa_fake.cc:
dev/ns_gige.cc:
dev/pciconfigall.cc:
dev/tsunami_cchip.cc:
dev/tsunami_io.cc:
dev/tsunami_pchip.cc:
    the pio interface is a different simobject and should have a
    different name.
dev/ethertap.cc:
    fix serialization.
dev/ide_ctrl.cc:
    - the pio interface is a different simobject and should have a
    different name.
    - properly initialize variables
    - When serializing an array, the size is the number of elements,
    not the number of bytes!
dev/pcidev.cc:
    When serializing an array, the size is the number of elements,
    not the number of bytes!
dev/tsunami_io.hh:
    Don't make objects SimObjects if they're not exposed to python.
    Don't add serialization functions to events, it's generally not
    what you want.
    allow the real time clock and interval timer to serialize themselves,
    must pass a base name since it is not a SimObject and the values will
    be going into the section of the parent.

--HG--
extra : convert_revision : 3fc5de9b858ed770c8f385cf38b53242cf859c33
This commit is contained in:
Nathan Binkert
2005-08-23 11:45:52 -04:00
parent 1771ee203f
commit c761aaae65
11 changed files with 157 additions and 192 deletions

View File

@@ -92,7 +92,7 @@ IdeController::IdeController(Params *p)
// create the PIO and DMA interfaces
if (params()->host_bus) {
pioInterface = newPioInterface(name(), params()->hier,
pioInterface = newPioInterface(name() + ".pio", params()->hier,
params()->host_bus, this,
&IdeController::cacheAccess);
@@ -101,10 +101,13 @@ IdeController::IdeController(Params *p)
params()->host_bus, 1,
true);
pioLatency = params()->pio_latency * params()->host_bus->clockRate;
} else {
pioInterface = NULL;
dmaInterface = NULL;
}
// setup the disks attached to controller
memset(disks, 0, sizeof(IdeDisk *) * 4);
memset(disks, 0, sizeof(disks));
dev[0] = 0;
dev[1] = 0;
@@ -648,14 +651,17 @@ IdeController::serialize(std::ostream &os)
SERIALIZE_SCALAR(bmi_size);
// Serialize registers
SERIALIZE_ARRAY(bmi_regs.data, sizeof(bmi_regs));
SERIALIZE_ARRAY(dev, sizeof(dev));
SERIALIZE_ARRAY(config_regs.data, sizeof(config_regs));
SERIALIZE_ARRAY(bmi_regs.data,
sizeof(bmi_regs.data) / sizeof(bmi_regs.data[0]));
SERIALIZE_ARRAY(dev, sizeof(dev) / sizeof(dev[0]));
SERIALIZE_ARRAY(config_regs.data,
sizeof(config_regs.data) / sizeof(config_regs.data[0]));
// Serialize internal state
SERIALIZE_SCALAR(io_enabled);
SERIALIZE_SCALAR(bm_enabled);
SERIALIZE_ARRAY(cmd_in_progress, sizeof(cmd_in_progress));
SERIALIZE_ARRAY(cmd_in_progress,
sizeof(cmd_in_progress) / sizeof(cmd_in_progress[0]));
}
void
@@ -677,14 +683,17 @@ IdeController::unserialize(Checkpoint *cp, const std::string &section)
UNSERIALIZE_SCALAR(bmi_size);
// Unserialize registers
UNSERIALIZE_ARRAY(bmi_regs.data, sizeof(bmi_regs));
UNSERIALIZE_ARRAY(dev, sizeof(dev));
UNSERIALIZE_ARRAY(config_regs.data, sizeof(config_regs));
UNSERIALIZE_ARRAY(bmi_regs.data,
sizeof(bmi_regs.data) / sizeof(bmi_regs.data[0]));
UNSERIALIZE_ARRAY(dev, sizeof(dev) / sizeof(dev[0]));
UNSERIALIZE_ARRAY(config_regs.data,
sizeof(config_regs.data) / sizeof(config_regs.data[0]));
// Unserialize internal state
UNSERIALIZE_SCALAR(io_enabled);
UNSERIALIZE_SCALAR(bm_enabled);
UNSERIALIZE_ARRAY(cmd_in_progress, sizeof(cmd_in_progress));
UNSERIALIZE_ARRAY(cmd_in_progress,
sizeof(cmd_in_progress) / sizeof(cmd_in_progress[0]));
if (pioInterface) {
pioInterface->addAddrRange(RangeSize(pri_cmd_addr, pri_cmd_size));