Changeset 81842 in vbox
- Timestamp:
- Nov 14, 2019 2:23:32 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r81839 r81842 183 183 typedef struct ATADevState 184 184 { 185 /** The I/O buffer. 186 * @note Page aligned in case it helps. */ 187 uint8_t abIOBuffer[ATA_MAX_IO_BUFFER_SIZE]; 188 185 189 /** Flag indicating whether the current command uses LBA48 mode. */ 186 190 bool fLBA48; … … 285 289 /** Size of I/O buffer. */ 286 290 uint32_t cbIOBuffer; 287 /** Pointer to the I/O buffer. */288 R3PTRTYPE(uint8_t *) pbIOBufferR3;289 /** Pointer to the I/O buffer. */290 R0PTRTYPE(uint8_t *) pbIOBufferR0;291 /** Pointer to the I/O buffer. */292 RCPTRTYPE(uint8_t *) pbIOBufferRC;293 291 294 292 /* … … 391 389 R3PTRTYPE(PTRACKLIST) pTrackList; 392 390 393 uint8_t abAlignment4[HC_ARCH_BITS == 64 ? 7 : 3];391 uint8_t abAlignment4[HC_ARCH_BITS == 64 ? 7 + 3432 : 3 + 3432 + 13*4]; 394 392 } ATADevState; 395 393 AssertCompileMemberAlignment(ATADevState, cTotalSectors, 8); … … 398 396 AssertCompileMemberAlignment(ATADevState, pDevInsR3, 8); 399 397 AssertCompileMemberAlignment(ATADevState, szSerialNumber, 8); 400 AssertCompileSizeAlignment(ATADevState, 8);398 AssertCompileSizeAlignment(ATADevState, 4096); /* To align the buffer on a page boundrary. */ 401 399 402 400 … … 475 473 typedef struct ATACONTROLLER 476 474 { 475 /** The ATA/ATAPI interfaces of this controller. */ 476 ATADevState aIfs[2]; 477 477 478 /** The base of the first I/O Port range. */ 478 479 RTIOPORT IOPortBase1; … … 511 512 uint32_t cbRedoDMABuffer; 512 513 513 /** The ATA/ATAPI interfaces of this controller. */514 ATADevState aIfs[2];515 516 514 /** Pointer to device instance. */ 517 515 PPDMDEVINSR3 pDevInsR3; … … 553 551 STAMPROFILEADV StatAsyncTime; 554 552 STAMPROFILE StatLockWait; 553 uint8_t abAlignment4[3440]; 555 554 } ATACONTROLLER, *PATACONTROLLER; 556 555 AssertCompileMemberAlignment(ATACONTROLLER, lock, 8); … … 560 559 AssertCompileMemberAlignment(ATACONTROLLER, AsyncIORequestLock, 8); 561 560 AssertCompileSizeAlignment(ATACONTROLLER, 8); 561 AssertCompileSizeAlignment(ATACONTROLLER, 4096); /* To align the controllers, devices and I/O buffers on page boundaries. */ 562 562 563 563 564 typedef enum CHIPSET … … 1303 1304 Assert(s->cbElementaryTransfer == 512); 1304 1305 1305 p = (uint16_t *) s->CTX_SUFF(pbIOBuffer);1306 p = (uint16_t *)&s->abIOBuffer[0]; 1306 1307 memset(p, 0, 512); 1307 1308 p[0] = RT_H2LE_U16(0x0040); … … 1436 1437 Assert(s->cbElementaryTransfer == 512); 1437 1438 1438 p = (uint16_t *) s->CTX_SUFF(pbIOBuffer);1439 p = (uint16_t *)&s->abIOBuffer[0]; 1439 1440 memset(p, 0, 512); 1440 1441 /* Removable CDROM, 3ms response, 12 byte packets */ … … 1736 1737 iLBA = ataR3GetSector(s); 1737 1738 Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA)); 1738 rc = ataR3ReadSectors(s, iLBA, s-> CTX_SUFF(pbIOBuffer), cSectors, &fRedo);1739 rc = ataR3ReadSectors(s, iLBA, s->abIOBuffer, cSectors, &fRedo); 1739 1740 if (RT_SUCCESS(rc)) 1740 1741 { … … 1775 1776 iLBA = ataR3GetSector(s); 1776 1777 Log(("%s: %d sectors at LBA %d\n", __FUNCTION__, cSectors, iLBA)); 1777 rc = ataR3WriteSectors(s, iLBA, s-> CTX_SUFF(pbIOBuffer), cSectors, &fRedo);1778 rc = ataR3WriteSectors(s, iLBA, s->abIOBuffer, cSectors, &fRedo); 1778 1779 if (RT_SUCCESS(rc)) 1779 1780 { … … 1893 1894 if (cbBlockRegion == s->cbATAPISector) 1894 1895 rc = s->pDrvMedia->pfnRead(s->pDrvMedia, (uint64_t)s->iATAPILBA * s->cbATAPISector, 1895 s-> CTX_SUFF(pbIOBuffer), s->cbATAPISector * cSectors);1896 s->abIOBuffer, s->cbATAPISector * cSectors); 1896 1897 else 1897 1898 { … … 1899 1900 { 1900 1901 /* Generate the sync bytes. */ 1901 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);1902 uint8_t *pbBuf = s->abIOBuffer; 1902 1903 1903 1904 for (uint32_t i = s->iATAPILBA; i < s->iATAPILBA + cSectors; i++) … … 1930 1931 { 1931 1932 /* Read only the user data portion. */ 1932 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);1933 uint8_t *pbBuf = s->abIOBuffer; 1933 1934 1934 1935 for (uint32_t i = s->iATAPILBA; i < s->iATAPILBA + cSectors; i++) … … 1997 1998 1998 1999 if (s->uTxDir == PDMMEDIATXDIR_TO_DEVICE) 1999 Log3(("ATAPI PT data write (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s-> CTX_SUFF(pbIOBuffer)));2000 Log3(("ATAPI PT data write (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->abIOBuffer)); 2000 2001 2001 2002 /* Simple heuristics: if there is at least one sector of data … … 2026 2027 case SCSI_MODE_SELECT_10: 2027 2028 { 2028 size_t cbBlkDescLength = scsiBE2H_U16(&s-> CTX_SUFF(pbIOBuffer)[6]);2029 size_t cbBlkDescLength = scsiBE2H_U16(&s->abIOBuffer[6]); 2029 2030 2030 2031 SCSILogModePage(szBuf, sizeof(szBuf) - 1, 2031 s-> CTX_SUFF(pbIOBuffer)+ 8 + cbBlkDescLength,2032 s->abIOBuffer + 8 + cbBlkDescLength, 2032 2033 cbTransfer - 8 - cbBlkDescLength); 2033 2034 break; … … 2036 2037 { 2037 2038 SCSILogCueSheet(szBuf, sizeof(szBuf) - 1, 2038 s-> CTX_SUFF(pbIOBuffer), cbTransfer);2039 s->abIOBuffer, cbTransfer); 2039 2040 break; 2040 2041 } … … 2060 2061 uint8_t aATAPICmd[ATAPI_PACKET_SIZE]; 2061 2062 uint32_t iATAPILBA, cSectors, cReqSectors, cbCurrTX; 2062 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);2063 uint8_t *pbBuf = s->abIOBuffer; 2063 2064 uint32_t cSectorsMax; /**< Maximum amount of sectors to read without exceeding the I/O buffer. */ 2064 2065 … … 2170 2171 else 2171 2172 rc = s->pDrvMedia->pfnSendCmd(s->pDrvMedia, s->aATAPICmd, ATAPI_PACKET_SIZE, (PDMMEDIATXDIR)s->uTxDir, 2172 s-> CTX_SUFF(pbIOBuffer), &cbTransfer, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */);2173 s->abIOBuffer, &cbTransfer, abATAPISense, sizeof(abATAPISense), 30000 /**< @todo timeout */); 2173 2174 if (pProf) { STAM_PROFILE_ADV_STOP(pProf, b); } 2174 2175 … … 2202 2203 2203 2204 if (RT_SUCCESS(rc)) 2204 rc = ATAPIPassthroughTrackListUpdate(s->pTrackList, s->aATAPICmd, s-> CTX_SUFF(pbIOBuffer));2205 rc = ATAPIPassthroughTrackListUpdate(s->pTrackList, s->aATAPICmd, s->abIOBuffer); 2205 2206 2206 2207 if ( RT_FAILURE(rc) … … 2233 2234 * Motivation: changing the VM configuration should be as 2234 2235 * invisible as possible to the guest. */ 2235 Log3(("ATAPI PT inquiry data before (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s-> CTX_SUFF(pbIOBuffer)));2236 scsiPadStr( s->CTX_SUFF(pbIOBuffer) + 8, "VBOX", 8);2237 scsiPadStr( s->CTX_SUFF(pbIOBuffer) + 16, "CD-ROM", 16);2238 scsiPadStr( s->CTX_SUFF(pbIOBuffer) + 32, "1.0", 4);2236 Log3(("ATAPI PT inquiry data before (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->abIOBuffer)); 2237 scsiPadStr(&s->abIOBuffer[8], "VBOX", 8); 2238 scsiPadStr(&s->abIOBuffer[16], "CD-ROM", 16); 2239 scsiPadStr(&s->abIOBuffer[32], "1.0", 4); 2239 2240 } 2240 2241 2241 2242 if (cbTransfer) 2242 Log3(("ATAPI PT data read (%d):\n%.*Rhxd\n", cbTransfer, cbTransfer, s-> CTX_SUFF(pbIOBuffer)));2243 Log3(("ATAPI PT data read (%d):\n%.*Rhxd\n", cbTransfer, cbTransfer, s->abIOBuffer)); 2243 2244 } 2244 2245 … … 2282 2283 static bool atapiR3ReadDVDStructureSS(ATADevState *s) 2283 2284 { 2284 uint8_t *buf = s-> CTX_SUFF(pbIOBuffer);2285 uint8_t *buf = s->abIOBuffer; 2285 2286 int media = s->aATAPICmd[1]; 2286 2287 int format = s->aATAPICmd[7]; … … 2450 2451 static bool atapiR3ReadCapacitySS(ATADevState *s) 2451 2452 { 2452 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);2453 uint8_t *pbBuf = s->abIOBuffer; 2453 2454 2454 2455 Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE); … … 2464 2465 static bool atapiR3ReadDiscInformationSS(ATADevState *s) 2465 2466 { 2466 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);2467 uint8_t *pbBuf = s->abIOBuffer; 2467 2468 2468 2469 Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE); … … 2490 2491 static bool atapiR3ReadTrackInformationSS(ATADevState *s) 2491 2492 { 2492 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);2493 uint8_t *pbBuf = s->abIOBuffer; 2493 2494 uint32_t u32LogAddr = scsiBE2H_U32(&s->aATAPICmd[2]); 2494 2495 uint8_t u8LogAddrType = s->aATAPICmd[1] & 0x03; … … 2745 2746 { 2746 2747 uint32_t const cbIOBuffer = RT_MIN(s->cbIOBuffer, ATA_MAX_IO_BUFFER_SIZE); 2747 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);2748 uint8_t *pbBuf = s->abIOBuffer; 2748 2749 uint32_t cbBuf = cbIOBuffer; 2749 2750 uint32_t cbCopied = 0; … … 2796 2797 2797 2798 /* Set data length now - the field is not included in the final length. */ 2798 scsiH2BE_U32(s-> CTX_SUFF(pbIOBuffer), cbIOBuffer - cbBuf - 4);2799 scsiH2BE_U32(s->abIOBuffer, cbIOBuffer - cbBuf - 4); 2799 2800 2800 2801 /* Other profiles we might want to add in the future: 0x40 (BD-ROM) and 0x50 (HDDVD-ROM) */ … … 2807 2808 static bool atapiR3GetEventStatusNotificationSS(ATADevState *s) 2808 2809 { 2809 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);2810 uint8_t *pbBuf = s->abIOBuffer; 2810 2811 2811 2812 Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE); … … 2882 2883 static bool atapiR3InquirySS(ATADevState *s) 2883 2884 { 2884 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);2885 uint8_t *pbBuf = s->abIOBuffer; 2885 2886 2886 2887 Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE); … … 2910 2911 static bool atapiR3ModeSenseErrorRecoverySS(ATADevState *s) 2911 2912 { 2912 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);2913 uint8_t *pbBuf = s->abIOBuffer; 2913 2914 2914 2915 Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE); … … 2938 2939 static bool atapiR3ModeSenseCDStatusSS(ATADevState *s) 2939 2940 { 2940 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);2941 uint8_t *pbBuf = s->abIOBuffer; 2941 2942 2942 2943 Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE); … … 2986 2987 static bool atapiR3RequestSenseSS(ATADevState *s) 2987 2988 { 2988 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);2989 uint8_t *pbBuf = s->abIOBuffer; 2989 2990 2990 2991 Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE); … … 2999 3000 static bool atapiR3MechanismStatusSS(ATADevState *s) 3000 3001 { 3001 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);3002 uint8_t *pbBuf = s->abIOBuffer; 3002 3003 3003 3004 Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE); … … 3018 3019 static bool atapiR3ReadTOCNormalSS(ATADevState *s) 3019 3020 { 3020 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer), *q, iStartTrack; 3021 uint8_t *pbBuf = s->abIOBuffer; 3022 uint8_t *q; 3023 uint8_t iStartTrack; 3021 3024 bool fMSF; 3022 3025 uint32_t cbSize; … … 3106 3109 static bool atapiR3ReadTOCMultiSS(ATADevState *s) 3107 3110 { 3108 uint8_t *pbBuf = s-> CTX_SUFF(pbIOBuffer);3111 uint8_t *pbBuf = s->abIOBuffer; 3109 3112 bool fMSF; 3110 3113 … … 3150 3153 static bool atapiR3ReadTOCRawSS(ATADevState *s) 3151 3154 { 3152 uint8_t *pbBuf = s->CTX_SUFF(pbIOBuffer), *q, iStartTrack; 3155 uint8_t *pbBuf = s->abIOBuffer; 3156 uint8_t *q; 3157 uint8_t iStartTrack; 3153 3158 bool fMSF; 3154 3159 uint32_t cbSize; … … 3237 3242 static void atapiR3ParseCmdVirtualATAPI(ATADevState *s) 3238 3243 { 3239 const uint8_t *pbPacket; 3240 uint8_t *pbBuf; 3244 const uint8_t *pbPacket = s->aATAPICmd; 3241 3245 uint32_t cbMax; 3242 3246 uint32_t cSectors, iATAPILBA; 3243 3247 3244 pbPacket = s->aATAPICmd;3245 pbBuf = s->CTX_SUFF(pbIOBuffer);3246 3248 switch (pbPacket[0]) 3247 3249 { … … 3791 3793 { 3792 3794 s->fDMA = !!(s->uATARegFeature & 1); 3793 memcpy(s->aATAPICmd, s-> CTX_SUFF(pbIOBuffer), ATAPI_PACKET_SIZE);3795 memcpy(s->aATAPICmd, s->abIOBuffer, ATAPI_PACKET_SIZE); 3794 3796 s->uTxDir = PDMMEDIATXDIR_NONE; 3795 3797 s->cbTotalTransfer = 0; … … 4014 4016 int rc = VERR_GENERAL_FAILURE; 4015 4017 uint32_t cRangesMax; 4016 uint64_t *pu64Range = (uint64_t *) s->CTX_SUFF(pbIOBuffer);4018 uint64_t *pu64Range = (uint64_t *)&s->abIOBuffer[0]; 4017 4019 bool fRedo = false; 4018 4020 … … 4932 4934 * 4933 4935 * The two buffers are either stack (32-bit aligned) or somewhere within 4934 * pIf-> pbIOBuffer.4936 * pIf->abIOBuffer. 4935 4937 * 4936 4938 * @param pIf The device interface to work with. … … 4942 4944 { 4943 4945 /* 4944 * Quick bounds checking can be done by checking that the pbIOBuffer offset4946 * Quick bounds checking can be done by checking that the abIOBuffer offset 4945 4947 * (iIOBufferPIODataStart) is aligned at the transfer size (which is ASSUMED 4946 4948 * to be 1, 2 or 4). However, since we're paranoid and don't currently … … 4989 4991 { 4990 4992 Assert(s->uTxDir == PDMMEDIATXDIR_TO_DEVICE); 4991 uint8_t *pbDst = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;4993 uint8_t *pbDst = &s->abIOBuffer[s->iIOBufferPIODataStart]; 4992 4994 uint8_t const *pbSrc = (uint8_t const *)&u32; 4993 4995 … … 5062 5064 { 5063 5065 Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE); 5064 uint8_t const *pbSrc = s->CTX_SUFF(pbIOBuffer) + s->iIOBufferPIODataStart;5066 uint8_t const *pbSrc = &s->abIOBuffer[s->iIOBufferPIODataStart]; 5065 5067 uint8_t *pbDst = (uint8_t *)pu32; 5066 5068 … … 5167 5169 * Do the transfer. 5168 5170 */ 5169 uint8_t const *pbSrc = s->CTX_SUFF(pbIOBuffer) + offStart;5171 uint8_t const *pbSrc = &s->abIOBuffer[offStart]; 5170 5172 memcpy(pbDst, pbSrc, cbTransfer); 5171 5173 Log3(("%s: addr=%#x cb=%#x cbTransfer=%#x val=%.*Rhxd\n", … … 5256 5258 * Do the transfer. 5257 5259 */ 5258 void *pvDst = s->CTX_SUFF(pbIOBuffer) + offStart;5260 void *pvDst = &s->abIOBuffer[offStart]; 5259 5261 memcpy(pvDst, pbSrc, cbTransfer); 5260 5262 Log3(("%s: addr=%#x val=%.*Rhxs\n", __FUNCTION__, Port, cbTransfer, pvDst)); … … 5379 5381 5380 5382 if (uTxDir == PDMMEDIATXDIR_FROM_DEVICE) 5381 PDMDevHlpPCIPhysWrite(pDevIns, GCPhysBuffer, s->CTX_SUFF(pbIOBuffer) + iIOBufferCur, cbXfer);5383 PDMDevHlpPCIPhysWrite(pDevIns, GCPhysBuffer, &s->abIOBuffer[iIOBufferCur], cbXfer); 5382 5384 else 5383 PDMDevHlpPCIPhysRead(pDevIns, GCPhysBuffer, s->CTX_SUFF(pbIOBuffer) + iIOBufferCur, cbXfer);5385 PDMDevHlpPCIPhysRead(pDevIns, GCPhysBuffer, &s->abIOBuffer[iIOBufferCur], cbXfer); 5384 5386 5385 5387 iIOBufferCur += cbXfer; … … 6496 6498 #ifdef IN_RING3 6497 6499 6498 6499 DECLINLINE(void) ataR3RelocBuffer(PPDMDEVINS pDevIns, ATADevState *s)6500 {6501 if (s->pbIOBufferR3)6502 s->pbIOBufferRC = MMHyperR3ToRC(PDMDevHlpGetVM(pDevIns), s->pbIOBufferR3);6503 }6504 6505 6506 6500 /** 6507 6501 * Detach notification. … … 6550 6544 * @param pIf The ATA unit state. 6551 6545 */ 6552 static int ataR3ConfigLun(PPDMDEVINS pDevIns, ATADevState *pIf) 6553 { 6554 int rc = VINF_SUCCESS; 6555 PDMMEDIATYPE enmType; 6556 6546 static int ataR3ConfigLun(ATADevState *pIf) 6547 { 6557 6548 /* 6558 6549 * Query Block, Bios and Mount interfaces. … … 6570 6561 * Validate type. 6571 6562 */ 6572 enmType = pIf->pDrvMedia->pfnGetType(pIf->pDrvMedia);6563 PDMMEDIATYPE enmType = pIf->pDrvMedia->pfnGetType(pIf->pDrvMedia); 6573 6564 if ( enmType != PDMMEDIATYPE_CDROM 6574 6565 && enmType != PDMMEDIATYPE_DVD … … 6601 6592 } 6602 6593 6603 PVM pVM = PDMDevHlpGetVM(pDevIns);6604 6594 if (pIf->cbIOBuffer) 6605 6595 { … … 6607 6597 * because memory corruption can also overwrite pIf->cbIOBuffer. */ 6608 6598 if (pIf->fATAPI) 6609 Assert ReleaseReturn(pIf->cbIOBuffer == _128K, VERR_BUFFER_OVERFLOW);6599 AssertLogRelReturn(pIf->cbIOBuffer == _128K, VERR_BUFFER_OVERFLOW); 6610 6600 else 6611 AssertReleaseReturn(pIf->cbIOBuffer == ATA_MAX_MULT_SECTORS * pIf->cbSector, VERR_BUFFER_OVERFLOW); 6612 Assert(pIf->pbIOBufferR3); 6613 Assert(pIf->pbIOBufferR0 == MMHyperR3ToR0(pVM, pIf->pbIOBufferR3)); 6614 Assert(pIf->pbIOBufferRC == MMHyperR3ToRC(pVM, pIf->pbIOBufferR3)); 6601 AssertLogRelReturn(pIf->cbIOBuffer == ATA_MAX_MULT_SECTORS * pIf->cbSector, VERR_BUFFER_OVERFLOW); 6615 6602 } 6616 6603 else … … 6620 6607 else 6621 6608 pIf->cbIOBuffer = ATA_MAX_MULT_SECTORS * pIf->cbSector; 6622 AssertLogRelMsgReturn(pIf->cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE, 6623 ("LUN#%u: cbIOBuffer=%#x (%u)\n", pIf->iLUN, pIf->cbIOBuffer, pIf->cbIOBuffer), 6624 VERR_BUFFER_OVERFLOW); 6625 Assert(!pIf->pbIOBufferR3); 6626 rc = MMR3HyperAllocOnceNoRel(pVM, pIf->cbIOBuffer, 0, MM_TAG_PDM_DEVICE_USER, (void **)&pIf->pbIOBufferR3); 6627 if (RT_FAILURE(rc)) 6628 return VERR_NO_MEMORY; 6629 pIf->pbIOBufferR0 = MMHyperR3ToR0(pVM, pIf->pbIOBufferR3); 6630 pIf->pbIOBufferRC = MMHyperR3ToRC(pVM, pIf->pbIOBufferR3); 6631 } 6609 } 6610 AssertCompile(_128K <= ATA_MAX_IO_BUFFER_SIZE); 6611 AssertCompileSize(pIf->abIOBuffer, ATA_MAX_IO_BUFFER_SIZE); 6612 AssertLogRelMsgReturn(pIf->cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE, 6613 ("LUN#%u: cbIOBuffer=%#x (%u)\n", pIf->iLUN, pIf->cbIOBuffer, pIf->cbIOBuffer), 6614 VERR_BUFFER_OVERFLOW); 6632 6615 6633 6616 /* 6634 6617 * Init geometry (only for non-CD/DVD media). 6635 6618 */ 6619 int rc = VINF_SUCCESS; 6636 6620 uint32_t cRegions = pIf->pDrvMedia->pfnGetRegionCount(pIf->pDrvMedia); 6637 6621 pIf->cTotalSectors = 0; … … 6771 6755 if (RT_SUCCESS(rc)) 6772 6756 { 6773 rc = ataR3ConfigLun(p DevIns, pIf);6757 rc = ataR3ConfigLun(pIf); 6774 6758 /* 6775 6759 * In case there is a medium inserted. … … 6970 6954 pHlp->pfnSSMPutU32(pSSM, pThis->aCts[i].aIfs[j].cbIOBuffer); 6971 6955 if (pThis->aCts[i].aIfs[j].cbIOBuffer) 6972 pHlp->pfnSSMPutMem(pSSM, pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer), pThis->aCts[i].aIfs[j].cbIOBuffer); 6973 else 6974 Assert(pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer) == NULL); 6956 pHlp->pfnSSMPutMem(pSSM, pThis->aCts[i].aIfs[j].abIOBuffer, pThis->aCts[i].aIfs[j].cbIOBuffer); 6975 6957 } 6976 6958 } … … 7171 7153 if (cbIOBuffer) 7172 7154 { 7173 if ( pThis->aCts[i].aIfs[j].CTX_SUFF(pbIOBuffer) 7174 && cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE 7155 if ( cbIOBuffer <= ATA_MAX_IO_BUFFER_SIZE 7175 7156 && cbIOBuffer <= pThis->aCts[i].aIfs[j].cbIOBuffer) 7176 7157 { 7177 7158 pThis->aCts[i].aIfs[j].cbIOBuffer = cbIOBuffer; 7178 pHlp->pfnSSMGetMem(pSSM, pThis->aCts[i].aIfs[j]. CTX_SUFF(pbIOBuffer), cbIOBuffer);7159 pHlp->pfnSSMGetMem(pSSM, pThis->aCts[i].aIfs[j].abIOBuffer, cbIOBuffer); 7179 7160 } 7180 7161 else … … 7399 7380 pThis->aCts[i].aIfs[0].pDevInsRC += offDelta; 7400 7381 pThis->aCts[i].aIfs[0].pControllerRC += offDelta; 7401 ataR3RelocBuffer(pDevIns, &pThis->aCts[i].aIfs[0]);7402 7382 pThis->aCts[i].aIfs[1].pDevInsRC += offDelta; 7403 7383 pThis->aCts[i].aIfs[1].pControllerRC += offDelta; 7404 ataR3RelocBuffer(pDevIns, &pThis->aCts[i].aIfs[1]);7405 7384 } 7406 7385 } … … 7811 7790 if (RT_SUCCESS(rc)) 7812 7791 { 7813 rc = ataR3ConfigLun(p DevIns, pIf);7792 rc = ataR3ConfigLun(pIf); 7814 7793 if (RT_SUCCESS(rc)) 7815 7794 { … … 7925 7904 pIf->pDrvMedia = NULL; 7926 7905 pIf->cbIOBuffer = 0; 7927 pIf->pbIOBufferR3 = NULL;7928 pIf->pbIOBufferR0 = NIL_RTR0PTR;7929 pIf->pbIOBufferRC = NIL_RTGCPTR;7930 7906 LogRel(("PIIX3 ATA: LUN#%d: no unit\n", pIf->iLUN)); 7931 7907 }
Note:
See TracChangeset
for help on using the changeset viewer.