diff options
author | Nathan Binkert <binkertn@umich.edu> | 2005-08-23 11:45:52 -0400 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2005-08-23 11:45:52 -0400 |
commit | c761aaae652b101959a6f5e182b67f841727de85 (patch) | |
tree | 38069755c319cfd6d1da4d8bb8ca362164ae2bc0 /dev/ide_ctrl.cc | |
parent | 1771ee203fd749b21a51439cde853f7134688f30 (diff) | |
download | gem5-c761aaae652b101959a6f5e182b67f841727de85.tar.xz |
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
Diffstat (limited to 'dev/ide_ctrl.cc')
-rw-r--r-- | dev/ide_ctrl.cc | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/dev/ide_ctrl.cc b/dev/ide_ctrl.cc index b9b9df654..6aac136a6 100644 --- a/dev/ide_ctrl.cc +++ b/dev/ide_ctrl.cc @@ -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 §ion) 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)); |