Changeset 24052 in vbox for trunk/src/VBox/Devices/Storage/DevATA.cpp
- Timestamp:
- Oct 23, 2009 6:21:13 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r23474 r24052 27 27 #undef VBOX_INSTRUMENT_DMA_WRITES 28 28 29 /** 30 * The SSM saved state versions.29 /** @name The SSM saved state versions. 30 * @{ 31 31 */ 32 #define ATA_SAVED_STATE_VERSION 19 33 #define ATA_SAVED_STATE_VERSION_WITH_BOOL_TYPE 18 34 #define ATA_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE 16 35 #define ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS 17 36 32 /** The current saved state version. */ 33 #define ATA_SAVED_STATE_VERSION 20 34 /** The saved state version used by VirtualBox 3.0. 35 * This lacks the config part and has the type at the and. */ 36 #define ATA_SAVED_STATE_VERSION_VBOX_30 19 37 #define ATA_SAVED_STATE_VERSION_WITH_BOOL_TYPE 18 38 #define ATA_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE 16 39 #define ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS 17 40 /** @} */ 37 41 38 42 /******************************************************************************* … … 6017 6021 } 6018 6022 6019 6020 6023 /** 6021 * Saves a state of the ATA device. 6022 * 6023 * @returns VBox status code. 6024 * @param pDevIns The device instance. 6025 * @param pSSMHandle The handle to save the state to. 6024 * @copydoc FNSSMDEVLIVEEXEC 6026 6025 */ 6027 static DECLCALLBACK(int) ata SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)6026 static DECLCALLBACK(int) ataLiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass) 6028 6027 { 6029 6028 PCIATAState *pThis = PDMINS_2_DATA(pDevIns, PCIATAState *); 6030 6029 6030 SSMR3PutU8(pSSM, pThis->u8Type); 6031 6031 for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aCts); i++) 6032 6032 { 6033 SSMR3PutU8(pSSMHandle, pThis->aCts[i].iSelectedIf); 6034 SSMR3PutU8(pSSMHandle, pThis->aCts[i].iAIOIf); 6035 SSMR3PutU8(pSSMHandle, pThis->aCts[i].uAsyncIOState); 6036 SSMR3PutBool(pSSMHandle, pThis->aCts[i].fChainedTransfer); 6037 SSMR3PutBool(pSSMHandle, pThis->aCts[i].fReset); 6038 SSMR3PutBool(pSSMHandle, pThis->aCts[i].fRedo); 6039 SSMR3PutBool(pSSMHandle, pThis->aCts[i].fRedoIdle); 6040 SSMR3PutBool(pSSMHandle, pThis->aCts[i].fRedoDMALastDesc); 6041 SSMR3PutMem(pSSMHandle, &pThis->aCts[i].BmDma, sizeof(pThis->aCts[i].BmDma)); 6042 SSMR3PutGCPhys32(pSSMHandle, pThis->aCts[i].pFirstDMADesc); 6043 SSMR3PutGCPhys32(pSSMHandle, pThis->aCts[i].pLastDMADesc); 6044 SSMR3PutGCPhys32(pSSMHandle, pThis->aCts[i].pRedoDMABuffer); 6045 SSMR3PutU32(pSSMHandle, pThis->aCts[i].cbRedoDMABuffer); 6046 6033 SSMR3PutBool(pSSM, true); /* For controller enabled / disabled. */ 6047 6034 for (uint32_t j = 0; j < RT_ELEMENTS(pThis->aCts[i].aIfs); j++) 6048 6035 { 6049 SSMR3PutBool(pSSMHandle, pThis->aCts[i].aIfs[j].fLBA48); 6050 SSMR3PutBool(pSSMHandle, pThis->aCts[i].aIfs[j].fATAPI); 6051 SSMR3PutBool(pSSMHandle, pThis->aCts[i].aIfs[j].fIrqPending); 6052 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].cMultSectors); 6053 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].PCHSGeometry.cCylinders); 6054 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].PCHSGeometry.cHeads); 6055 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].PCHSGeometry.cSectors); 6056 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].cSectorsPerIRQ); 6057 SSMR3PutU64(pSSMHandle, pThis->aCts[i].aIfs[j].cTotalSectors); 6058 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegFeature); 6059 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegFeatureHOB); 6060 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegError); 6061 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegNSector); 6062 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegNSectorHOB); 6063 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegSector); 6064 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegSectorHOB); 6065 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegLCyl); 6066 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegLCylHOB); 6067 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegHCyl); 6068 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegHCylHOB); 6069 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegSelect); 6070 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegStatus); 6071 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegCommand); 6072 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATARegDevCtl); 6073 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uATATransferMode); 6074 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].uTxDir); 6075 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].iBeginTransfer); 6076 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].iSourceSink); 6077 SSMR3PutBool(pSSMHandle, pThis->aCts[i].aIfs[j].fDMA); 6078 SSMR3PutBool(pSSMHandle, pThis->aCts[i].aIfs[j].fATAPITransfer); 6079 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].cbTotalTransfer); 6080 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].cbElementaryTransfer); 6081 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].iIOBufferCur); 6082 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].iIOBufferEnd); 6083 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].iIOBufferPIODataStart); 6084 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].iIOBufferPIODataEnd); 6085 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].iATAPILBA); 6086 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].cbATAPISector); 6087 SSMR3PutMem(pSSMHandle, &pThis->aCts[i].aIfs[j].aATAPICmd, sizeof(pThis->aCts[i].aIfs[j].aATAPICmd)); 6088 SSMR3PutMem(pSSMHandle, &pThis->aCts[i].aIfs[j].abATAPISense, sizeof(pThis->aCts[i].aIfs[j].abATAPISense)); 6089 SSMR3PutU8(pSSMHandle, pThis->aCts[i].aIfs[j].cNotifiedMediaChange); 6090 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].MediaEventStatus); 6091 SSMR3PutMem(pSSMHandle, &pThis->aCts[i].aIfs[j].Led, sizeof(pThis->aCts[i].aIfs[j].Led)); 6092 SSMR3PutU32(pSSMHandle, pThis->aCts[i].aIfs[j].cbIOBuffer); 6036 SSMR3PutBool(pSSM, pThis->aCts[i].aIfs[j].pDrvBase != NULL); 6037 SSMR3PutStrZ(pSSM, pThis->aCts[i].aIfs[j].szSerialNumber); 6038 SSMR3PutStrZ(pSSM, pThis->aCts[i].aIfs[j].szFirmwareRevision); 6039 SSMR3PutStrZ(pSSM, pThis->aCts[i].aIfs[j].szModelNumber); 6040 } 6041 } 6042 6043 return VINF_SSM_DONT_CALL_AGAIN; 6044 } 6045 6046 6047 /** 6048 * @copydoc FNSSMDEVSAVEEXEC 6049 */ 6050 static DECLCALLBACK(int) ataSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 6051 { 6052 PCIATAState *pThis = PDMINS_2_DATA(pDevIns, PCIATAState *); 6053 6054 ataLiveExec(pDevIns, pSSM, SSM_PASS_FINAL); 6055 6056 for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aCts); i++) 6057 { 6058 SSMR3PutU8(pSSM, pThis->aCts[i].iSelectedIf); 6059 SSMR3PutU8(pSSM, pThis->aCts[i].iAIOIf); 6060 SSMR3PutU8(pSSM, pThis->aCts[i].uAsyncIOState); 6061 SSMR3PutBool(pSSM, pThis->aCts[i].fChainedTransfer); 6062 SSMR3PutBool(pSSM, pThis->aCts[i].fReset); 6063 SSMR3PutBool(pSSM, pThis->aCts[i].fRedo); 6064 SSMR3PutBool(pSSM, pThis->aCts[i].fRedoIdle); 6065 SSMR3PutBool(pSSM, pThis->aCts[i].fRedoDMALastDesc); 6066 SSMR3PutMem(pSSM, &pThis->aCts[i].BmDma, sizeof(pThis->aCts[i].BmDma)); 6067 SSMR3PutGCPhys32(pSSM, pThis->aCts[i].pFirstDMADesc); 6068 SSMR3PutGCPhys32(pSSM, pThis->aCts[i].pLastDMADesc); 6069 SSMR3PutGCPhys32(pSSM, pThis->aCts[i].pRedoDMABuffer); 6070 SSMR3PutU32(pSSM, pThis->aCts[i].cbRedoDMABuffer); 6071 6072 for (uint32_t j = 0; j < RT_ELEMENTS(pThis->aCts[i].aIfs); j++) 6073 { 6074 SSMR3PutBool(pSSM, pThis->aCts[i].aIfs[j].fLBA48); 6075 SSMR3PutBool(pSSM, pThis->aCts[i].aIfs[j].fATAPI); 6076 SSMR3PutBool(pSSM, pThis->aCts[i].aIfs[j].fIrqPending); 6077 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].cMultSectors); 6078 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].PCHSGeometry.cCylinders); 6079 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].PCHSGeometry.cHeads); 6080 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].PCHSGeometry.cSectors); 6081 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].cSectorsPerIRQ); 6082 SSMR3PutU64(pSSM, pThis->aCts[i].aIfs[j].cTotalSectors); 6083 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegFeature); 6084 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegFeatureHOB); 6085 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegError); 6086 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegNSector); 6087 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegNSectorHOB); 6088 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegSector); 6089 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegSectorHOB); 6090 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegLCyl); 6091 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegLCylHOB); 6092 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegHCyl); 6093 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegHCylHOB); 6094 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegSelect); 6095 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegStatus); 6096 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegCommand); 6097 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATARegDevCtl); 6098 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uATATransferMode); 6099 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].uTxDir); 6100 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].iBeginTransfer); 6101 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].iSourceSink); 6102 SSMR3PutBool(pSSM, pThis->aCts[i].aIfs[j].fDMA); 6103 SSMR3PutBool(pSSM, pThis->aCts[i].aIfs[j].fATAPITransfer); 6104 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].cbTotalTransfer); 6105 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].cbElementaryTransfer); 6106 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].iIOBufferCur); 6107 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].iIOBufferEnd); 6108 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].iIOBufferPIODataStart); 6109 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].iIOBufferPIODataEnd); 6110 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].iATAPILBA); 6111 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].cbATAPISector); 6112 SSMR3PutMem(pSSM, &pThis->aCts[i].aIfs[j].aATAPICmd, sizeof(pThis->aCts[i].aIfs[j].aATAPICmd)); 6113 SSMR3PutMem(pSSM, &pThis->aCts[i].aIfs[j].abATAPISense, sizeof(pThis->aCts[i].aIfs[j].abATAPISense)); 6114 SSMR3PutU8(pSSM, pThis->aCts[i].aIfs[j].cNotifiedMediaChange); 6115 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].MediaEventStatus); 6116 SSMR3PutMem(pSSM, &pThis->aCts[i].aIfs[j].Led, sizeof(pThis->aCts[i].aIfs[j].Led)); 6117 SSMR3PutU32(pSSM, pThis->aCts[i].aIfs[j].cbIOBuffer); 6093 6118 if (pThis->aCts[i].aIfs[j].cbIOBuffer) 6094 SSMR3PutMem(pSSM Handle, pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer), pThis->aCts[i].aIfs[j].cbIOBuffer);6119 SSMR3PutMem(pSSM, pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer), pThis->aCts[i].aIfs[j].cbIOBuffer); 6095 6120 else 6096 6121 Assert(pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer) == NULL); 6097 6122 } 6098 6123 } 6099 SSMR3PutU8(pSSMHandle, pThis->u8Type); 6100 6101 return SSMR3PutU32(pSSMHandle, ~0); /* sanity/terminator */ 6124 6125 return SSMR3PutU32(pSSM, ~0); /* sanity/terminator */ 6102 6126 } 6103 6127 6104 6128 6105 6129 /** 6106 * Loads a saved ATA device state. 6107 * 6108 * @returns VBox status code. 6109 * @param pDevIns The device instance. 6110 * @param pSSMHandle The handle to the saved state. 6111 * @param uVersion The data unit version number. 6112 * @param uPass The data pass. 6130 * FNSSMDEVLOADEXEC 6113 6131 */ 6114 static DECLCALLBACK(int) ataLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM Handle, uint32_t uVersion, uint32_t uPass)6132 static DECLCALLBACK(int) ataLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 6115 6133 { 6116 6134 PCIATAState *pThis = PDMINS_2_DATA(pDevIns, PCIATAState *); … … 6119 6137 6120 6138 if ( uVersion != ATA_SAVED_STATE_VERSION 6139 && uVersion != ATA_SAVED_STATE_VERSION_VBOX_30 6121 6140 && uVersion != ATA_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE 6122 6141 && uVersion != ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS … … 6126 6145 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 6127 6146 } 6128 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); 6147 6148 /* 6149 * Verify the configuration. 6150 */ 6151 if (uVersion > ATA_SAVED_STATE_VERSION_VBOX_30) 6152 { 6153 uint8_t u8Type; 6154 rc = SSMR3GetU8(pSSM, &u8Type); 6155 AssertRCReturn(rc, rc); 6156 if (u8Type != pThis->u8Type) 6157 { 6158 LogRel(("PIIX3 ATA: Config mismatch: u8Type - saved=%u config=%u\n", u8Type, pThis->u8Type)); 6159 return VERR_SSM_LOAD_CONFIG_MISMATCH; 6160 } 6161 6162 for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aCts); i++) 6163 { 6164 bool fEnabled; 6165 rc = SSMR3GetBool(pSSM, &fEnabled); 6166 AssertRCReturn(rc, rc); 6167 if (!fEnabled) 6168 { 6169 LogRel(("PIIX3 ATA: Ctr#%u onfig mismatch: fEnabled != true\n", i)); 6170 return VERR_SSM_LOAD_CONFIG_MISMATCH; 6171 } 6172 6173 for (uint32_t j = 0; j < RT_ELEMENTS(pThis->aCts[i].aIfs); j++) 6174 { 6175 ATADevState const *pIf = &pThis->aCts[i].aIfs[j]; 6176 6177 bool fInUse; 6178 rc = SSMR3GetBool(pSSM, &fInUse); 6179 AssertRCReturn(rc, rc); 6180 if (fInUse != (pIf->pDrvBase != NULL)) 6181 { 6182 LogRel(("PIIX3 ATA: LUN#%u config mismatch: fInUse - saved=%RTbool config=%RTbool\n", 6183 pIf->iLUN, fInUse, (pIf->pDrvBase != NULL))); 6184 return VERR_SSM_LOAD_CONFIG_MISMATCH; 6185 } 6186 6187 char szSerialNumber[ATA_SERIAL_NUMBER_LENGTH+1]; 6188 rc = SSMR3GetStrZ(pSSM, szSerialNumber, sizeof(szSerialNumber)); 6189 AssertRCReturn(rc, rc); 6190 if (strcmp(szSerialNumber, pIf->szSerialNumber)) 6191 LogRel(("PIIX3 ATA: LUN#%u config mismatch: Serial number - saved='%s' config='%s'\n", 6192 pIf->iLUN, szSerialNumber, pIf->szSerialNumber)); 6193 6194 char szFirmwareRevision[ATA_FIRMWARE_REVISION_LENGTH+1]; 6195 rc = SSMR3GetStrZ(pSSM, szFirmwareRevision, sizeof(szFirmwareRevision)); 6196 AssertRCReturn(rc, rc); 6197 if (strcmp(szFirmwareRevision, pIf->szFirmwareRevision)) 6198 LogRel(("PIIX3 ATA: LUN#%u config mismatch: Firmware revision - saved='%s' config='%s'\n", 6199 pIf->iLUN, szFirmwareRevision, pIf->szFirmwareRevision)); 6200 6201 char szModelNumber[ATA_MODEL_NUMBER_LENGTH+1]; 6202 rc = SSMR3GetStrZ(pSSM, szModelNumber, sizeof(szModelNumber)); 6203 AssertRCReturn(rc, rc); 6204 if (strcmp(szModelNumber, pIf->szModelNumber)) 6205 LogRel(("PIIX3 ATA: LUN#%u config mismatch: Model number - saved='%s' config='%s'\n", 6206 pIf->iLUN, szModelNumber, pIf->szModelNumber)); 6207 } 6208 } 6209 } 6210 if (uPass != SSM_PASS_FINAL) 6211 return VINF_SUCCESS; 6129 6212 6130 6213 /* … … 6141 6224 } 6142 6225 6143 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].iSelectedIf);6144 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].iAIOIf);6145 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].uAsyncIOState);6146 SSMR3GetBool(pSSM Handle, &pThis->aCts[i].fChainedTransfer);6147 SSMR3GetBool(pSSM Handle, (bool *)&pThis->aCts[i].fReset);6148 SSMR3GetBool(pSSM Handle, (bool *)&pThis->aCts[i].fRedo);6149 SSMR3GetBool(pSSM Handle, (bool *)&pThis->aCts[i].fRedoIdle);6150 SSMR3GetBool(pSSM Handle, (bool *)&pThis->aCts[i].fRedoDMALastDesc);6151 SSMR3GetMem(pSSM Handle, &pThis->aCts[i].BmDma, sizeof(pThis->aCts[i].BmDma));6152 SSMR3GetGCPhys32(pSSM Handle, &pThis->aCts[i].pFirstDMADesc);6153 SSMR3GetGCPhys32(pSSM Handle, &pThis->aCts[i].pLastDMADesc);6154 SSMR3GetGCPhys32(pSSM Handle, &pThis->aCts[i].pRedoDMABuffer);6155 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].cbRedoDMABuffer);6226 SSMR3GetU8(pSSM, &pThis->aCts[i].iSelectedIf); 6227 SSMR3GetU8(pSSM, &pThis->aCts[i].iAIOIf); 6228 SSMR3GetU8(pSSM, &pThis->aCts[i].uAsyncIOState); 6229 SSMR3GetBool(pSSM, &pThis->aCts[i].fChainedTransfer); 6230 SSMR3GetBool(pSSM, (bool *)&pThis->aCts[i].fReset); 6231 SSMR3GetBool(pSSM, (bool *)&pThis->aCts[i].fRedo); 6232 SSMR3GetBool(pSSM, (bool *)&pThis->aCts[i].fRedoIdle); 6233 SSMR3GetBool(pSSM, (bool *)&pThis->aCts[i].fRedoDMALastDesc); 6234 SSMR3GetMem(pSSM, &pThis->aCts[i].BmDma, sizeof(pThis->aCts[i].BmDma)); 6235 SSMR3GetGCPhys32(pSSM, &pThis->aCts[i].pFirstDMADesc); 6236 SSMR3GetGCPhys32(pSSM, &pThis->aCts[i].pLastDMADesc); 6237 SSMR3GetGCPhys32(pSSM, &pThis->aCts[i].pRedoDMABuffer); 6238 SSMR3GetU32(pSSM, &pThis->aCts[i].cbRedoDMABuffer); 6156 6239 6157 6240 for (uint32_t j = 0; j < RT_ELEMENTS(pThis->aCts[i].aIfs); j++) 6158 6241 { 6159 SSMR3GetBool(pSSM Handle, &pThis->aCts[i].aIfs[j].fLBA48);6160 SSMR3GetBool(pSSM Handle, &pThis->aCts[i].aIfs[j].fATAPI);6161 SSMR3GetBool(pSSM Handle, &pThis->aCts[i].aIfs[j].fIrqPending);6162 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].cMultSectors);6163 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].PCHSGeometry.cCylinders);6164 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].PCHSGeometry.cHeads);6165 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].PCHSGeometry.cSectors);6166 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].cSectorsPerIRQ);6167 SSMR3GetU64(pSSM Handle, &pThis->aCts[i].aIfs[j].cTotalSectors);6168 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegFeature);6169 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegFeatureHOB);6170 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegError);6171 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegNSector);6172 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegNSectorHOB);6173 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegSector);6174 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegSectorHOB);6175 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegLCyl);6176 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegLCylHOB);6177 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegHCyl);6178 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegHCylHOB);6179 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegSelect);6180 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegStatus);6181 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegCommand);6182 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATARegDevCtl);6183 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uATATransferMode);6184 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].uTxDir);6185 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].iBeginTransfer);6186 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].iSourceSink);6187 SSMR3GetBool(pSSM Handle, &pThis->aCts[i].aIfs[j].fDMA);6188 SSMR3GetBool(pSSM Handle, &pThis->aCts[i].aIfs[j].fATAPITransfer);6189 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].cbTotalTransfer);6190 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].cbElementaryTransfer);6191 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].iIOBufferCur);6192 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].iIOBufferEnd);6193 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].iIOBufferPIODataStart);6194 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].iIOBufferPIODataEnd);6195 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].iATAPILBA);6196 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].cbATAPISector);6197 SSMR3GetMem(pSSM Handle, &pThis->aCts[i].aIfs[j].aATAPICmd, sizeof(pThis->aCts[i].aIfs[j].aATAPICmd));6242 SSMR3GetBool(pSSM, &pThis->aCts[i].aIfs[j].fLBA48); 6243 SSMR3GetBool(pSSM, &pThis->aCts[i].aIfs[j].fATAPI); 6244 SSMR3GetBool(pSSM, &pThis->aCts[i].aIfs[j].fIrqPending); 6245 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].cMultSectors); 6246 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].PCHSGeometry.cCylinders); 6247 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].PCHSGeometry.cHeads); 6248 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].PCHSGeometry.cSectors); 6249 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].cSectorsPerIRQ); 6250 SSMR3GetU64(pSSM, &pThis->aCts[i].aIfs[j].cTotalSectors); 6251 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegFeature); 6252 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegFeatureHOB); 6253 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegError); 6254 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegNSector); 6255 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegNSectorHOB); 6256 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegSector); 6257 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegSectorHOB); 6258 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegLCyl); 6259 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegLCylHOB); 6260 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegHCyl); 6261 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegHCylHOB); 6262 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegSelect); 6263 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegStatus); 6264 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegCommand); 6265 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATARegDevCtl); 6266 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uATATransferMode); 6267 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].uTxDir); 6268 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].iBeginTransfer); 6269 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].iSourceSink); 6270 SSMR3GetBool(pSSM, &pThis->aCts[i].aIfs[j].fDMA); 6271 SSMR3GetBool(pSSM, &pThis->aCts[i].aIfs[j].fATAPITransfer); 6272 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].cbTotalTransfer); 6273 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].cbElementaryTransfer); 6274 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].iIOBufferCur); 6275 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].iIOBufferEnd); 6276 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].iIOBufferPIODataStart); 6277 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].iIOBufferPIODataEnd); 6278 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].iATAPILBA); 6279 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].cbATAPISector); 6280 SSMR3GetMem(pSSM, &pThis->aCts[i].aIfs[j].aATAPICmd, sizeof(pThis->aCts[i].aIfs[j].aATAPICmd)); 6198 6281 if (uVersion > ATA_SAVED_STATE_VERSION_WITHOUT_FULL_SENSE) 6199 6282 { 6200 SSMR3GetMem(pSSM Handle, pThis->aCts[i].aIfs[j].abATAPISense, sizeof(pThis->aCts[i].aIfs[j].abATAPISense));6283 SSMR3GetMem(pSSM, pThis->aCts[i].aIfs[j].abATAPISense, sizeof(pThis->aCts[i].aIfs[j].abATAPISense)); 6201 6284 } 6202 6285 else … … 6206 6289 pThis->aCts[i].aIfs[j].abATAPISense[0] = 0x70 | (1 << 7); 6207 6290 pThis->aCts[i].aIfs[j].abATAPISense[7] = 10; 6208 SSMR3GetU8(pSSM Handle, &uATAPISenseKey);6209 SSMR3GetU8(pSSM Handle, &uATAPIASC);6291 SSMR3GetU8(pSSM, &uATAPISenseKey); 6292 SSMR3GetU8(pSSM, &uATAPIASC); 6210 6293 pThis->aCts[i].aIfs[j].abATAPISense[2] = uATAPISenseKey & 0x0f; 6211 6294 pThis->aCts[i].aIfs[j].abATAPISense[12] = uATAPIASC; 6212 6295 } 6213 6296 /** @todo triple-check this hack after passthrough is working */ 6214 SSMR3GetU8(pSSM Handle, &pThis->aCts[i].aIfs[j].cNotifiedMediaChange);6297 SSMR3GetU8(pSSM, &pThis->aCts[i].aIfs[j].cNotifiedMediaChange); 6215 6298 if (uVersion > ATA_SAVED_STATE_VERSION_WITHOUT_EVENT_STATUS) 6216 SSMR3GetU32(pSSM Handle, (uint32_t*)&pThis->aCts[i].aIfs[j].MediaEventStatus);6299 SSMR3GetU32(pSSM, (uint32_t*)&pThis->aCts[i].aIfs[j].MediaEventStatus); 6217 6300 else 6218 6301 pThis->aCts[i].aIfs[j].MediaEventStatus = ATA_EVENT_STATUS_UNCHANGED; 6219 SSMR3GetMem(pSSM Handle, &pThis->aCts[i].aIfs[j].Led, sizeof(pThis->aCts[i].aIfs[j].Led));6220 SSMR3GetU32(pSSM Handle, &pThis->aCts[i].aIfs[j].cbIOBuffer);6302 SSMR3GetMem(pSSM, &pThis->aCts[i].aIfs[j].Led, sizeof(pThis->aCts[i].aIfs[j].Led)); 6303 SSMR3GetU32(pSSM, &pThis->aCts[i].aIfs[j].cbIOBuffer); 6221 6304 if (pThis->aCts[i].aIfs[j].cbIOBuffer) 6222 6305 { 6223 6306 if (pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer)) 6224 SSMR3GetMem(pSSM Handle, pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer), pThis->aCts[i].aIfs[j].cbIOBuffer);6307 SSMR3GetMem(pSSM, pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer), pThis->aCts[i].aIfs[j].cbIOBuffer); 6225 6308 else 6226 6309 { 6227 6310 LogRel(("ATA: No buffer for %d/%d\n", i, j)); 6228 if (SSMR3HandleGetAfter(pSSM Handle) != SSMAFTER_DEBUG_IT)6311 if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT) 6229 6312 return VERR_SSM_LOAD_CONFIG_MISMATCH; 6230 6313 … … 6233 6316 size_t cbLeft = pThis->aCts[i].aIfs[j].cbIOBuffer; 6234 6317 while (cbLeft-- > 0) 6235 SSMR3GetU8(pSSM Handle, &u8Ignored);6318 SSMR3GetU8(pSSM, &u8Ignored); 6236 6319 } 6237 6320 } … … 6240 6323 } 6241 6324 } 6242 SSMR3GetU8(pSSMHandle, &pThis->u8Type); 6243 6244 rc = SSMR3GetU32(pSSMHandle, &u32); 6325 if (uVersion <= ATA_SAVED_STATE_VERSION_VBOX_30) 6326 SSMR3GetU8(pSSM, &pThis->u8Type); 6327 6328 rc = SSMR3GetU32(pSSM, &u32); 6245 6329 if (RT_FAILURE(rc)) 6246 6330 return rc; … … 6325 6409 * Validate and read configuration. 6326 6410 */ 6327 if (!CFGMR3AreValuesValid(pCfgHandle, "GCEnabled\0IRQDelay\0R0Enabled\0Type\0")) 6411 if (!CFGMR3AreValuesValid(pCfgHandle, 6412 "GCEnabled\0" 6413 "R0Enabled\0" 6414 "IRQDelay\0" 6415 "Type\0") 6416 /** @todo || invalid keys */) 6328 6417 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 6329 6418 N_("PIIX3 configuration error: unknown option specified")); … … 6715 6804 6716 6805 rc = PDMDevHlpSSMRegisterEx(pDevIns, ATA_SAVED_STATE_VERSION, sizeof(*pThis) + cbTotalBuffer, NULL, 6717 NULL, NULL, NULL,6806 NULL, ataLiveExec, NULL, 6718 6807 ataSaveLoadPrep, ataSaveExec, NULL, 6719 6808 ataSaveLoadPrep, ataLoadExec, NULL);
Note:
See TracChangeset
for help on using the changeset viewer.