summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev/ide_disk.cc44
-rw-r--r--dev/pcidev.cc2
-rw-r--r--sim/system.cc3
3 files changed, 35 insertions, 14 deletions
diff --git a/dev/ide_disk.cc b/dev/ide_disk.cc
index 0d12e797d..ddd4a09e7 100644
--- a/dev/ide_disk.cc
+++ b/dev/ide_disk.cc
@@ -644,6 +644,7 @@ IdeDisk::startCommand()
case WIN_RECAL:
case WIN_SPECIFY:
+ case WIN_STANDBYNOW1:
case WIN_FLUSH_CACHE:
case WIN_VERIFY:
case WIN_SEEK:
@@ -655,7 +656,7 @@ IdeDisk::startCommand()
// Supported PIO data-in commands
case WIN_IDENTIFY:
- cmdBytesLeft = drqBytesLeft = sizeof(struct hd_driveid);
+ cmdBytesLeft = sizeof(struct hd_driveid);
devState = Prepare_Data_In;
action = ACT_DATA_READY;
break;
@@ -670,9 +671,9 @@ IdeDisk::startCommand()
else
cmdBytesLeft = (cmdReg.sec_count * SectorSize);
- drqBytesLeft = SectorSize;
curSector = getLBABase();
+ /** @todo make this a scheduled event to simulate disk delay */
devState = Prepare_Data_In;
action = ACT_DATA_READY;
break;
@@ -688,7 +689,6 @@ IdeDisk::startCommand()
else
cmdBytesLeft = (cmdReg.sec_count * SectorSize);
- drqBytesLeft = SectorSize;
curSector = getLBABase();
devState = Prepare_Data_Out;
@@ -707,7 +707,6 @@ IdeDisk::startCommand()
else
cmdBytesLeft = (cmdReg.sec_count * SectorSize);
- drqBytesLeft = SectorSize;
curSector = getLBABase();
devState = Prepare_Data_Dma;
@@ -831,16 +830,23 @@ IdeDisk::updateState(DevAction_t action)
// set the DRQ bit
cmdReg.status |= STATUS_DRQ_BIT;
- // put the first two bytes into the data register
- memcpy((void *)&cmdReg.data0, (void *)dataBuffer,
- sizeof(uint16_t));
-
// copy the data into the data buffer
- if (curCommand == WIN_IDENTIFY)
+ if (curCommand == WIN_IDENTIFY) {
+ // Reset the drqBytes for this block
+ drqBytesLeft = sizeof(struct hd_driveid);
+
memcpy((void *)dataBuffer, (void *)&driveID,
sizeof(struct hd_driveid));
- else
+ } else {
+ // Reset the drqBytes for this block
+ drqBytesLeft = SectorSize;
+
readDisk(curSector++, dataBuffer);
+ }
+
+ // put the first two bytes into the data register
+ memcpy((void *)&cmdReg.data0, (void *)dataBuffer,
+ sizeof(uint16_t));
if (!isIENSet()) {
devState = Data_Ready_INTRQ_In;
@@ -867,9 +873,10 @@ IdeDisk::updateState(DevAction_t action)
cmdBytesLeft -= 2;
// copy next short into data registers
- memcpy((void *)&cmdReg.data0,
- (void *)&dataBuffer[SectorSize - drqBytesLeft],
- sizeof(uint16_t));
+ if (drqBytesLeft)
+ memcpy((void *)&cmdReg.data0,
+ (void *)&dataBuffer[SectorSize - drqBytesLeft],
+ sizeof(uint16_t));
}
if (drqBytesLeft == 0) {
@@ -879,7 +886,14 @@ IdeDisk::updateState(DevAction_t action)
devState = Device_Idle_S;
} else {
devState = Prepare_Data_In;
+ // set the BSY_BIT
cmdReg.status |= STATUS_BSY_BIT;
+ // clear the DRQ_BIT
+ cmdReg.status &= ~STATUS_DRQ_BIT;
+
+ /** @todo change this to a scheduled event to simulate
+ disk delay */
+ updateState(ACT_DATA_READY);
}
}
}
@@ -947,6 +961,10 @@ IdeDisk::updateState(DevAction_t action)
cmdReg.status &= ~STATUS_DRQ_BIT;
devState = Prepare_Data_Out;
+
+ /** @todo change this to a scheduled event to simulate
+ disk delay */
+ updateState(ACT_DATA_READY);
}
}
break;
diff --git a/dev/pcidev.cc b/dev/pcidev.cc
index 9ac170b5c..9d6208d6b 100644
--- a/dev/pcidev.cc
+++ b/dev/pcidev.cc
@@ -247,7 +247,7 @@ PciDev::WriteConfig(int offset, int size, uint32_t data)
break;
default:
- panic("writing to a read only register");
+ DPRINTF(PCIDEV, "Writing to a read only register");
}
break;
}
diff --git a/sim/system.cc b/sim/system.cc
index 619593abd..b801cb254 100644
--- a/sim/system.cc
+++ b/sim/system.cc
@@ -52,6 +52,9 @@ System::System(const std::string _name,
bin(_bin),
binned_fns(binned_fns)
{
+ // increment the number of running systems
+ numSystemsRunning++;
+
// add self to global system list
systemList.push_back(this);
if (bin == true) {