dev: Explicitly specify the endianness for packet accessors.
[gem5.git] / src / dev / storage / ide_disk.cc
index 4eefdbbd7273897cc336845e45239d25a4f26cc9..020e4582de469b28f3d2151272cb7fcad7bbdc69 100644 (file)
@@ -68,9 +68,14 @@ using namespace TheISA;
 
 IdeDisk::IdeDisk(const Params *p)
     : SimObject(p), ctrl(NULL), image(p->image), diskDelay(p->delay),
-      dmaTransferEvent(this), dmaReadCG(NULL), dmaReadWaitEvent(this),
-      dmaWriteCG(NULL), dmaWriteWaitEvent(this), dmaPrdReadEvent(this),
-      dmaReadEvent(this), dmaWriteEvent(this)
+      dmaTransferEvent([this]{ doDmaTransfer(); }, name()),
+      dmaReadCG(NULL),
+      dmaReadWaitEvent([this]{ doDmaRead(); }, name()),
+      dmaWriteCG(NULL),
+      dmaWriteWaitEvent([this]{ doDmaWrite(); }, name()),
+      dmaPrdReadEvent([this]{ dmaPrdReadDone(); }, name()),
+      dmaReadEvent([this]{ dmaReadDone(); }, name()),
+      dmaWriteEvent([this]{ dmaWriteDone(); }, name())
 {
     // Reset the device state
     reset(p->driveID);
@@ -392,6 +397,8 @@ IdeDisk::doDmaDataRead()
 void
 IdeDisk::regStats()
 {
+    SimObject::regStats();
+
     using namespace Stats;
     dmaReadFullPages
         .name(name() + ".dma_read_full_pages")
@@ -655,6 +662,7 @@ IdeDisk::startCommand()
 
         // Supported PIO data-in commands
       case WDCC_IDENTIFY:
+      case ATAPI_IDENTIFY_DEVICE:
         cmdBytes = cmdBytesLeft = sizeof(struct ataparams);
         devState = Prepare_Data_In;
         action = ACT_DATA_READY;
@@ -697,6 +705,7 @@ IdeDisk::startCommand()
         // Supported DMA commands
       case WDCC_WRITEDMA:
         dmaRead = true;  // a write to the disk is a DMA read from memory
+        M5_FALLTHROUGH;
       case WDCC_READDMA:
         if (!(cmdReg.drive & DRIVE_LBA_BIT))
             panic("Attempt to perform CHS access, only supports LBA\n");
@@ -850,7 +859,8 @@ IdeDisk::updateState(DevAction_t action)
             status |= STATUS_DRQ_BIT;
 
             // copy the data into the data buffer
-            if (cmdReg.command == WDCC_IDENTIFY) {
+            if (cmdReg.command == WDCC_IDENTIFY ||
+                cmdReg.command == ATAPI_IDENTIFY_DEVICE) {
                 // Reset the drqBytes for this block
                 drqBytesLeft = sizeof(struct ataparams);