Changeset 11144 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Aug 5, 2008 9:05:57 PM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/ATAController.h
r11143 r11144 37 37 #include "ide.h" 38 38 39 40 /******************************************************************************* 41 * Defined Constants And Macros * 42 *******************************************************************************/ 39 43 /** 40 44 * Maximum number of sectors to transfer in a READ/WRITE MULTIPLE request. … … 61 65 #define MAX_LOG_REL_ERRORS 1024 62 66 67 68 /******************************************************************************* 69 * Structures and Typedefs * 70 *******************************************************************************/ 63 71 typedef struct ATADevState { 64 72 /** Flag indicating whether the current command uses LBA48 mode. */ … … 154 162 uint32_t cbIOBuffer; 155 163 /** Pointer to the I/O buffer. */ 156 R3R0PTRTYPE(uint8_t *) pbIOBufferHC; 164 R3PTRTYPE(uint8_t *) pbIOBufferR3; 165 /** Pointer to the I/O buffer. */ 166 R0PTRTYPE(uint8_t *) pbIOBufferR0; 157 167 /** Pointer to the I/O buffer. */ 158 168 RCPTRTYPE(uint8_t *) pbIOBufferGC; 159 #if HC_ARCH_BITS == 64169 #if 1 /*HC_ARCH_BITS == 64*/ 160 170 RTRCPTR Aligmnent0; /**< Align the statistics at an 8-byte boundrary. */ 161 171 #endif … … 217 227 RTUINT iLUN; 218 228 #if HC_ARCH_BITS == 64 219 RTUINT Alignment2; /**< Align pDevIns HCcorrectly. */229 RTUINT Alignment2; /**< Align pDevInsR3 correctly. */ 220 230 #endif 221 231 /** Pointer to device instance. */ 222 R3R0PTRTYPE(PPDMDEVINS) pDevInsHC;232 PPDMDEVINSR3 pDevInsR3; 223 233 /** Pointer to controller instance. */ 224 R3R0PTRTYPE(struct ATACONTROLLER *) pControllerHC; 225 /** Pointer to device instance. */ 226 RCPTRTYPE(PPDMDEVINS) pDevInsGC; 234 R3PTRTYPE(struct ATACONTROLLER *) pControllerR3; 235 /** Pointer to device instance. */ 236 PPDMDEVINSR0 pDevInsR0; 237 /** Pointer to controller instance. */ 238 R0PTRTYPE(struct ATACONTROLLER *) pControllerR0; 239 /** Pointer to device instance. */ 240 PPDMDEVINSGC pDevInsGC; 227 241 /** Pointer to controller instance. */ 228 242 RCPTRTYPE(struct ATACONTROLLER *) pControllerGC; … … 317 331 318 332 /** Pointer to device instance. */ 319 R3R0PTRTYPE(PPDMDEVINS) pDevInsHC; 320 /** Pointer to device instance. */ 321 RCPTRTYPE(PPDMDEVINS) pDevInsGC; 333 PPDMDEVINSR3 pDevInsR3; 334 /** Pointer to device instance. */ 335 PPDMDEVINSR0 pDevInsR0; 336 /** Pointer to device instance. */ 337 PPDMDEVINSGC pDevInsGC; 322 338 323 339 /** Set when the destroying the device instance and the thread must exit. */ … … 340 356 /** The event semaphore the thread is waiting on during suspended I/O. */ 341 357 RTSEMEVENT SuspendIOSem; 342 #if HC_ARCH_BITS == 32358 #if 0 /*HC_ARCH_BITS == 32*/ 343 359 uint32_t Alignment0; 344 360 #endif 345 361 346 362 /* Statistics */ 347 STAMCOUNTER StatAsyncOps;348 uint64_t StatAsyncMinWait;349 uint64_t StatAsyncMaxWait;350 STAMCOUNTER StatAsyncTimeUS;351 STAMPROFILEADV StatAsyncTime;352 STAMPROFILE StatLockWait;363 STAMCOUNTER StatAsyncOps; 364 uint64_t StatAsyncMinWait; 365 uint64_t StatAsyncMaxWait; 366 STAMCOUNTER StatAsyncTimeUS; 367 STAMPROFILEADV StatAsyncTime; 368 STAMPROFILE StatLockWait; 353 369 } ATACONTROLLER, *PATACONTROLLER; 354 370 355 #define ATADEVSTATE_2_CONTROLLER(pIf) ( (pIf)->CTXSUFF(pController) ) 356 #define ATADEVSTATE_2_DEVINS(pIf) ( (pIf)->CTXSUFF(pDevIns) ) 357 #define CONTROLLER_2_DEVINS(pController) ( (pController)->CTXSUFF(pDevIns) ) 371 #ifndef VBOX_DEVICE_STRUCT_TESTCASE 372 373 #define ATADEVSTATE_2_CONTROLLER(pIf) ( (pIf)->CTXALLSUFF(pController) ) 374 #define ATADEVSTATE_2_DEVINS(pIf) ( (pIf)->CTXALLSUFF(pDevIns) ) 375 #define CONTROLLER_2_DEVINS(pController) ( (pController)->CTXALLSUFF(pDevIns) ) 358 376 #define PDMIBASE_2_ATASTATE(pInterface) ( (ATADevState *)((uintptr_t)(pInterface) - RT_OFFSETOF(ATADevState, IBase)) ) 359 377 360 #ifndef VBOX_DEVICE_STRUCT_TESTCASE 378 361 379 /******************************************************************************* 362 380 * Internal Functions * -
trunk/src/VBox/Devices/Storage/DevATA.cpp
r11143 r11144 19 19 * additional information or have any questions. 20 20 */ 21 22 /******************************************************************************* 23 * Defined Constants And Macros * 24 *******************************************************************************/ 25 /** Temporary instrumentation for tracking down potential virtual disk 26 * write performance issues. */ 27 #undef VBOX_INSTRUMENT_DMA_WRITES 28 29 /** 30 * The SSM saved state version. 31 */ 32 #define ATA_SAVED_STATE_VERSION 16 21 33 22 34 … … 47 59 #include "ATAController.h" 48 60 #include "../Builtins.h" 49 50 /**51 * The SSM saved state version.52 */53 #define ATA_SAVED_STATE_VERSION 1654 55 /** Temporary instrumentation for tracking down potential virtual disk56 * write performance issues. */57 #undef VBOX_INSTRUMENT_DMA_WRITES58 61 59 62 … … 751 754 RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]); 752 755 753 p = (uint16_t *)s->CTX SUFF(pbIOBuffer);756 p = (uint16_t *)s->CTXALLSUFF(pbIOBuffer); 754 757 memset(p, 0, 512); 755 758 p[0] = RT_H2LE_U16(0x0040); … … 875 878 RTStrPrintf(aSerial, sizeof(aSerial), "VB%08x-%08x", Uuid.au32[0], Uuid.au32[3]); 876 879 877 p = (uint16_t *)s->CTX SUFF(pbIOBuffer);880 p = (uint16_t *)s->CTXALLSUFF(pbIOBuffer); 878 881 memset(p, 0, 512); 879 882 /* Removable CDROM, 50us response, 12 byte packets */ … … 1118 1121 iLBA = ataGetSector(s); 1119 1122 Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA)); 1120 rc = ataReadSectors(s, iLBA, s->CTX SUFF(pbIOBuffer), cSectors);1123 rc = ataReadSectors(s, iLBA, s->CTXALLSUFF(pbIOBuffer), cSectors); 1121 1124 if (VBOX_SUCCESS(rc)) 1122 1125 { … … 1165 1168 iLBA = ataGetSector(s); 1166 1169 Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA)); 1167 rc = ataWriteSectors(s, iLBA, s->CTX SUFF(pbIOBuffer), cSectors);1170 rc = ataWriteSectors(s, iLBA, s->CTXALLSUFF(pbIOBuffer), cSectors); 1168 1171 if (VBOX_SUCCESS(rc)) 1169 1172 { … … 1340 1343 { 1341 1344 case 2048: 1342 rc = s->pDrvBlock->pfnRead(s->pDrvBlock, (uint64_t)s->iATAPILBA * s->cbATAPISector, s->CTX SUFF(pbIOBuffer), s->cbATAPISector * cSectors);1345 rc = s->pDrvBlock->pfnRead(s->pDrvBlock, (uint64_t)s->iATAPILBA * s->cbATAPISector, s->CTXALLSUFF(pbIOBuffer), s->cbATAPISector * cSectors); 1343 1346 break; 1344 1347 case 2352: 1345 1348 { 1346 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1349 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1347 1350 1348 1351 for (uint32_t i = s->iATAPILBA; i < s->iATAPILBA + cSectors; i++) … … 1411 1414 1412 1415 if (s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE) 1413 Log3(("ATAPI PT data write (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTX SUFF(pbIOBuffer)));1416 Log3(("ATAPI PT data write (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTXALLSUFF(pbIOBuffer))); 1414 1417 1415 1418 /* Simple heuristics: if there is at least one sector of data … … 1440 1443 uint32_t iATAPILBA, cSectors, cReqSectors; 1441 1444 size_t cbCurrTX; 1442 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1445 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1443 1446 1444 1447 switch (s->aATAPICmd[0]) … … 1514 1517 } 1515 1518 else 1516 rc = s->pDrvBlock->pfnSendCmd(s->pDrvBlock, s->aATAPICmd, (PDMBLOCKTXDIR)s->uTxDir, s->CTX SUFF(pbIOBuffer), &cbTransfer, &uATAPISenseKey, 30000 /**< @todo timeout */);1519 rc = s->pDrvBlock->pfnSendCmd(s->pDrvBlock, s->aATAPICmd, (PDMBLOCKTXDIR)s->uTxDir, s->CTXALLSUFF(pbIOBuffer), &cbTransfer, &uATAPISenseKey, 30000 /**< @todo timeout */); 1517 1520 if (pProf) { STAM_PROFILE_ADV_STOP(pProf, b); } 1518 1521 … … 1552 1555 * Motivation: changing the VM configuration should be as 1553 1556 * invisible as possible to the guest. */ 1554 Log3(("ATAPI PT inquiry data before (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTX SUFF(pbIOBuffer)));1555 ataSCSIPadStr(s->CTX SUFF(pbIOBuffer) + 8, "VBOX", 8);1556 ataSCSIPadStr(s->CTX SUFF(pbIOBuffer) + 16, "CD-ROM", 16);1557 ataSCSIPadStr(s->CTX SUFF(pbIOBuffer) + 32, "1.0", 4);1557 Log3(("ATAPI PT inquiry data before (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTXALLSUFF(pbIOBuffer))); 1558 ataSCSIPadStr(s->CTXALLSUFF(pbIOBuffer) + 8, "VBOX", 8); 1559 ataSCSIPadStr(s->CTXALLSUFF(pbIOBuffer) + 16, "CD-ROM", 16); 1560 ataSCSIPadStr(s->CTXALLSUFF(pbIOBuffer) + 32, "1.0", 4); 1558 1561 } 1559 1562 if (cbTransfer) 1560 Log3(("ATAPI PT data read (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTX SUFF(pbIOBuffer)));1563 Log3(("ATAPI PT data read (%d): %.*Vhxs\n", cbTransfer, cbTransfer, s->CTXALLSUFF(pbIOBuffer))); 1561 1564 } 1562 1565 s->iSourceSink = ATAFN_SS_NULL; … … 1604 1607 static bool atapiReadCapacitySS(ATADevState *s) 1605 1608 { 1606 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1609 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1607 1610 1608 1611 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); … … 1618 1621 static bool atapiReadDiscInformationSS(ATADevState *s) 1619 1622 { 1620 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1623 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1621 1624 1622 1625 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); … … 1644 1647 static bool atapiReadTrackInformationSS(ATADevState *s) 1645 1648 { 1646 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1649 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1647 1650 1648 1651 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); … … 1673 1676 static bool atapiGetConfigurationSS(ATADevState *s) 1674 1677 { 1675 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1678 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1676 1679 1677 1680 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); … … 1708 1711 static bool atapiInquirySS(ATADevState *s) 1709 1712 { 1710 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1713 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1711 1714 1712 1715 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); … … 1736 1739 static bool atapiModeSenseErrorRecoverySS(ATADevState *s) 1737 1740 { 1738 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1741 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1739 1742 1740 1743 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); … … 1764 1767 static bool atapiModeSenseCDStatusSS(ATADevState *s) 1765 1768 { 1766 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1769 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1767 1770 1768 1771 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); … … 1812 1815 static bool atapiRequestSenseSS(ATADevState *s) 1813 1816 { 1814 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1817 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1815 1818 1816 1819 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); … … 1829 1832 static bool atapiMechanismStatusSS(ATADevState *s) 1830 1833 { 1831 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1834 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1832 1835 1833 1836 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); … … 1848 1851 static bool atapiReadTOCNormalSS(ATADevState *s) 1849 1852 { 1850 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer), *q, iStartTrack;1853 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer), *q, iStartTrack; 1851 1854 bool fMSF; 1852 1855 uint32_t cbSize; … … 1910 1913 static bool atapiReadTOCMultiSS(ATADevState *s) 1911 1914 { 1912 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer);1915 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer); 1913 1916 bool fMSF; 1914 1917 … … 1942 1945 static bool atapiReadTOCRawSS(ATADevState *s) 1943 1946 { 1944 uint8_t *pbBuf = s->CTX SUFF(pbIOBuffer), *q, iStartTrack;1947 uint8_t *pbBuf = s->CTXALLSUFF(pbIOBuffer), *q, iStartTrack; 1945 1948 bool fMSF; 1946 1949 uint32_t cbSize; … … 2034 2037 2035 2038 pbPacket = s->aATAPICmd; 2036 pbBuf = s->CTX SUFF(pbIOBuffer);2039 pbBuf = s->CTXALLSUFF(pbIOBuffer); 2037 2040 switch (pbPacket[0]) 2038 2041 { … … 2387 2390 2388 2391 pbPacket = s->aATAPICmd; 2389 pbBuf = s->CTX SUFF(pbIOBuffer);2392 pbBuf = s->CTXALLSUFF(pbIOBuffer); 2390 2393 switch (pbPacket[0]) 2391 2394 { … … 2676 2679 { 2677 2680 s->fDMA = !!(s->uATARegFeature & 1); 2678 memcpy(s->aATAPICmd, s->CTX SUFF(pbIOBuffer), ATAPI_PACKET_SIZE);2681 memcpy(s->aATAPICmd, s->CTXALLSUFF(pbIOBuffer), ATAPI_PACKET_SIZE); 2679 2682 s->uTxDir = PDMBLOCKTXDIR_NONE; 2680 2683 s->cbTotalTransfer = 0; … … 3515 3518 { 3516 3519 Assert(s->uTxDir == PDMBLOCKTXDIR_TO_DEVICE); 3517 p = s->CTX SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;3520 p = s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart; 3518 3521 #ifndef IN_RING3 3519 3522 /* All but the last transfer unit is simple enough for GC, but … … 3547 3550 { 3548 3551 Assert(s->uTxDir == PDMBLOCKTXDIR_FROM_DEVICE); 3549 p = s->CTX SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;3552 p = s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart; 3550 3553 #ifndef IN_RING3 3551 3554 /* All but the last transfer unit is simple enough for GC, but … … 3657 3660 (int)pDesc, pBuffer, cbBuffer)); 3658 3661 if (uTxDir == PDMBLOCKTXDIR_FROM_DEVICE) 3659 PDMDevHlpPhysWrite(pDevIns, pBuffer, s->CTX SUFF(pbIOBuffer) + iIOBufferCur, dmalen);3662 PDMDevHlpPhysWrite(pDevIns, pBuffer, s->CTXALLSUFF(pbIOBuffer) + iIOBufferCur, dmalen); 3660 3663 else 3661 PDMDevHlpPhysRead(pDevIns, pBuffer, s->CTX SUFF(pbIOBuffer) + iIOBufferCur, dmalen);3664 PDMDevHlpPhysRead(pDevIns, pBuffer, s->CTXALLSUFF(pbIOBuffer) + iIOBufferCur, dmalen); 3662 3665 iIOBufferCur += dmalen; 3663 3666 cbTotalTransfer -= dmalen; … … 4713 4716 #ifdef IN_GC 4714 4717 for (uint32_t i = 0; i < cbTransfer; i += cb) 4715 MMGCRamWriteNoTrapHandler((char *)GCDst + i, s->CTX SUFF(pbIOBuffer) + s->iIOBufferPIODataStart + i, cb);4718 MMGCRamWriteNoTrapHandler((char *)GCDst + i, s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart + i, cb); 4716 4719 #else /* !IN_GC */ 4717 rc = PGMPhysWriteGCPtrDirty(PDMDevHlpGetVM(pDevIns), GCDst, s->CTX SUFF(pbIOBuffer) + s->iIOBufferPIODataStart, cbTransfer);4720 rc = PGMPhysWriteGCPtrDirty(PDMDevHlpGetVM(pDevIns), GCDst, s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart, cbTransfer); 4718 4721 Assert(rc == VINF_SUCCESS); 4719 4722 #endif /* IN_GC */ 4720 4723 4721 4724 if (cbTransfer) 4722 Log3(("%s: addr=%#x val=%.*Vhxs\n", __FUNCTION__, Port, cbTransfer, s->CTX SUFF(pbIOBuffer) + s->iIOBufferPIODataStart));4725 Log3(("%s: addr=%#x val=%.*Vhxs\n", __FUNCTION__, Port, cbTransfer, s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart)); 4723 4726 s->iIOBufferPIODataStart += cbTransfer; 4724 4727 *pGCPtrDst = (RTGCPTR)((RTGCUINTPTR)GCDst + cbTransfer); … … 4770 4773 #ifdef IN_GC 4771 4774 for (uint32_t i = 0; i < cbTransfer; i += cb) 4772 MMGCRamReadNoTrapHandler(s->CTX SUFF(pbIOBuffer) + s->iIOBufferPIODataStart + i, (char *)GCSrc + i, cb);4775 MMGCRamReadNoTrapHandler(s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart + i, (char *)GCSrc + i, cb); 4773 4776 #else /* !IN_GC */ 4774 rc = PGMPhysReadGCPtr(PDMDevHlpGetVM(pDevIns), s->CTX SUFF(pbIOBuffer) + s->iIOBufferPIODataStart, GCSrc, cbTransfer);4777 rc = PGMPhysReadGCPtr(PDMDevHlpGetVM(pDevIns), s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart, GCSrc, cbTransfer); 4775 4778 Assert(rc == VINF_SUCCESS); 4776 4779 #endif /* IN_GC */ 4777 4780 4778 4781 if (cbTransfer) 4779 Log3(("%s: addr=%#x val=%.*Vhxs\n", __FUNCTION__, Port, cbTransfer, s->CTX SUFF(pbIOBuffer) + s->iIOBufferPIODataStart));4782 Log3(("%s: addr=%#x val=%.*Vhxs\n", __FUNCTION__, Port, cbTransfer, s->CTXALLSUFF(pbIOBuffer) + s->iIOBufferPIODataStart)); 4780 4783 s->iIOBufferPIODataStart += cbTransfer; 4781 4784 *pGCPtrSrc = (RTGCPTR)((RTGCUINTPTR)GCSrc + cbTransfer); … … 4905 4908 DECLINLINE(void) ataRelocBuffer(PPDMDEVINS pDevIns, ATADevState *s) 4906 4909 { 4907 if (s->pbIOBuffer HC)4908 s->pbIOBufferGC = MMHyper HC2GC(PDMDevHlpGetVM(pDevIns), s->pbIOBufferHC);4910 if (s->pbIOBufferR3) 4911 s->pbIOBufferGC = MMHyperR3ToGC(PDMDevHlpGetVM(pDevIns), s->pbIOBufferR3); 4909 4912 } 4910 4913 … … 5088 5091 else 5089 5092 AssertRelease(pIf->cbIOBuffer == ATA_MAX_MULT_SECTORS * 512); 5090 Assert(pIf->pbIOBufferHC); 5091 Assert(pIf->pbIOBufferGC == MMHyperHC2GC(pVM, pIf->pbIOBufferHC)); 5093 Assert(pIf->pbIOBufferR3); 5094 Assert(pIf->pbIOBufferR0 == MMHyperR3ToR0(pVM, pIf->pbIOBufferR3)); 5095 Assert(pIf->pbIOBufferGC == MMHyperR3ToGC(pVM, pIf->pbIOBufferR3)); 5092 5096 } 5093 5097 else … … 5097 5101 else 5098 5102 pIf->cbIOBuffer = ATA_MAX_MULT_SECTORS * 512; 5099 Assert(!pIf->pbIOBuffer HC);5100 rc = MMHyperAlloc(pVM, pIf->cbIOBuffer, 1, MM_TAG_PDM_DEVICE_USER, (void **)&pIf->pbIOBuffer HC);5103 Assert(!pIf->pbIOBufferR3); 5104 rc = MMHyperAlloc(pVM, pIf->cbIOBuffer, 1, MM_TAG_PDM_DEVICE_USER, (void **)&pIf->pbIOBufferR3); 5101 5105 if (VBOX_FAILURE(rc)) 5102 5106 return VERR_NO_MEMORY; 5103 pIf->pbIOBufferGC = MMHyperHC2GC(pVM, pIf->pbIOBufferHC); 5107 pIf->pbIOBufferR0 = MMHyperR3ToR0(pVM, pIf->pbIOBufferR3); 5108 pIf->pbIOBufferGC = MMHyperR3ToGC(pVM, pIf->pbIOBufferR3); 5104 5109 } 5105 5110 … … 5355 5360 SSMR3PutU32(pSSMHandle, pData->aCts[i].aIfs[j].cbIOBuffer); 5356 5361 if (pData->aCts[i].aIfs[j].cbIOBuffer) 5357 SSMR3PutMem(pSSMHandle, pData->aCts[i].aIfs[j].CTX SUFF(pbIOBuffer), pData->aCts[i].aIfs[j].cbIOBuffer);5362 SSMR3PutMem(pSSMHandle, pData->aCts[i].aIfs[j].CTXALLSUFF(pbIOBuffer), pData->aCts[i].aIfs[j].cbIOBuffer); 5358 5363 else 5359 Assert(pData->aCts[i].aIfs[j].CTX SUFF(pbIOBuffer) == NULL);5364 Assert(pData->aCts[i].aIfs[j].CTXALLSUFF(pbIOBuffer) == NULL); 5360 5365 } 5361 5366 } … … 5461 5466 if (pData->aCts[i].aIfs[j].cbIOBuffer) 5462 5467 { 5463 if (pData->aCts[i].aIfs[j].CTX SUFF(pbIOBuffer))5464 SSMR3GetMem(pSSMHandle, pData->aCts[i].aIfs[j].CTX SUFF(pbIOBuffer), pData->aCts[i].aIfs[j].cbIOBuffer);5468 if (pData->aCts[i].aIfs[j].CTXALLSUFF(pbIOBuffer)) 5469 SSMR3GetMem(pSSMHandle, pData->aCts[i].aIfs[j].CTXALLSUFF(pbIOBuffer), pData->aCts[i].aIfs[j].cbIOBuffer); 5465 5470 else 5466 5471 { … … 5477 5482 } 5478 5483 else 5479 Assert(pData->aCts[i].aIfs[j].CTX SUFF(pbIOBuffer) == NULL);5484 Assert(pData->aCts[i].aIfs[j].CTXALLSUFF(pbIOBuffer) == NULL); 5480 5485 } 5481 5486 } … … 5595 5600 for (uint32_t i = 0; i < RT_ELEMENTS(pData->aCts); i++) 5596 5601 { 5597 pData->aCts[i].pDevInsHC = pDevIns; 5602 pData->aCts[i].pDevInsR3 = pDevIns; 5603 pData->aCts[i].pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 5598 5604 pData->aCts[i].pDevInsGC = PDMDEVINS_2_GCPTR(pDevIns); 5599 5605 pData->aCts[i].DelayIRQMillies = (uint32_t)DelayIRQMillies; … … 5601 5607 { 5602 5608 pData->aCts[i].aIfs[j].iLUN = i * RT_ELEMENTS(pData->aCts) + j; 5603 pData->aCts[i].aIfs[j].pDevInsHC = pDevIns; 5609 pData->aCts[i].aIfs[j].pDevInsR3 = pDevIns; 5610 pData->aCts[i].aIfs[j].pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 5604 5611 pData->aCts[i].aIfs[j].pDevInsGC = PDMDEVINS_2_GCPTR(pDevIns); 5605 pData->aCts[i].aIfs[j].pControllerHC = &pData->aCts[i]; 5606 pData->aCts[i].aIfs[j].pControllerGC = MMHyperHC2GC(PDMDevHlpGetVM(pDevIns), &pData->aCts[i]); 5612 pData->aCts[i].aIfs[j].pControllerR3 = &pData->aCts[i]; 5613 pData->aCts[i].aIfs[j].pControllerR0 = MMHyperR3ToR0(PDMDevHlpGetVM(pDevIns), &pData->aCts[i]); 5614 pData->aCts[i].aIfs[j].pControllerGC = MMHyperR3ToGC(PDMDevHlpGetVM(pDevIns), &pData->aCts[i]); 5607 5615 pData->aCts[i].aIfs[j].IBase.pfnQueryInterface = ataQueryInterface; 5608 5616 pData->aCts[i].aIfs[j].IMountNotify.pfnMountNotify = ataMountNotify; … … 5785 5793 pIf->pDrvBlock = NULL; 5786 5794 pIf->cbIOBuffer = 0; 5787 pIf->pbIOBufferHC = NULL; 5795 pIf->pbIOBufferR3 = NULL; 5796 pIf->pbIOBufferR0 = NIL_RTR0PTR; 5788 5797 pIf->pbIOBufferGC = NIL_RTGCPTR; 5789 5798 LogRel(("PIIX3 ATA: LUN#%d: no unit\n", pIf->iLUN)); -
trunk/src/VBox/Devices/Storage/ide.h
r8155 r11144 1 /* $Id$ */ 1 2 /** @file 2 * 3 * VBox storage devices: 4 * ATA/ATAPI declarations 3 * VBox storage devices: ATA/ATAPI declarations 5 4 */ 6 5 … … 21 20 */ 22 21 23 #ifndef __ IDE_h__24 #define __ IDE_h__22 #ifndef ___Storage_IDE_h 23 #define ___Storage_IDE_h 25 24 26 25 … … 447 446 448 447 449 #endif /* __IDE_h__ */ 448 #endif /* !___Storage_IDE_h */ 449
Note:
See TracChangeset
for help on using the changeset viewer.