Changeset 81752 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Nov 9, 2019 10:21:23 AM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 134540
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
r81751 r81752 362 362 }; 363 363 364 /** The support driver session handle. */365 R3R0PTRTYPE(PSUPDRVSESSION) pSupDrvSession;366 364 /** Worker thread. */ 367 365 R3PTRTYPE(PPDMTHREAD) pThreadWrk; … … 643 641 644 642 /* Write message context ID into reply post queue. */ 645 rc = PDM CritSectEnter(&pThis->ReplyPostQueueCritSect, VINF_SUCCESS);643 rc = PDMDevHlpCritSectEnter(pThis->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect, VINF_SUCCESS); 646 644 AssertRC(rc); 647 645 … … 651 649 /* Set error code. */ 652 650 lsilogicSetIOCFaultCode(pThis, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); 653 PDM CritSectLeave(&pThis->ReplyPostQueueCritSect);651 PDMDevHlpCritSectLeave(pThis->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect); 654 652 return; 655 653 } … … 663 661 lsilogicSetInterrupt(pThis, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR); 664 662 665 PDM CritSectLeave(&pThis->ReplyPostQueueCritSect);663 PDMDevHlpCritSectLeave(pThis->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect); 666 664 } 667 665 … … 700 698 int rc; 701 699 /* Grab a free reply message from the queue. */ 702 rc = PDM CritSectEnter(&pThis->ReplyFreeQueueCritSect, VINF_SUCCESS);700 rc = PDMDevHlpCritSectEnter(pThis->CTX_SUFF(pDevIns), &pThis->ReplyFreeQueueCritSect, VINF_SUCCESS); 703 701 AssertRC(rc); 704 702 … … 708 706 /* Set error code. */ 709 707 lsilogicSetIOCFaultCode(pThis, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); 710 PDM CritSectLeave(&pThis->ReplyFreeQueueCritSect);708 PDMDevHlpCritSectLeave(pThis->CTX_SUFF(pDevIns), &pThis->ReplyFreeQueueCritSect); 711 709 return; 712 710 } … … 717 715 pThis->uReplyFreeQueueNextAddressRead %= pThis->cReplyQueueEntries; 718 716 719 PDM CritSectLeave(&pThis->ReplyFreeQueueCritSect);717 PDMDevHlpCritSectLeave(pThis->CTX_SUFF(pDevIns), &pThis->ReplyFreeQueueCritSect); 720 718 721 719 /* Build 64bit physical address. */ … … 727 725 728 726 /* Write low 32bits of reply frame into post reply queue. */ 729 rc = PDM CritSectEnter(&pThis->ReplyPostQueueCritSect, VINF_SUCCESS);727 rc = PDMDevHlpCritSectEnter(pThis->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect, VINF_SUCCESS); 730 728 AssertRC(rc); 731 729 … … 735 733 /* Set error code. */ 736 734 lsilogicSetIOCFaultCode(pThis, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); 737 PDM CritSectLeave(&pThis->ReplyPostQueueCritSect);735 PDMDevHlpCritSectLeave(pThis->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect); 738 736 return; 739 737 } … … 754 752 lsilogicSetInterrupt(pThis, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR); 755 753 756 PDM CritSectLeave(&pThis->ReplyPostQueueCritSect);754 PDMDevHlpCritSectLeave(pThis->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect); 757 755 # else 758 756 AssertMsgFailed(("This is not allowed to happen.\n")); … … 1257 1255 case LSILOGIC_REG_REPLY_QUEUE: 1258 1256 { 1259 int rc = PDM CritSectEnter(&pThis->ReplyFreeQueueWriteCritSect, VINF_IOM_R3_MMIO_WRITE);1257 int rc = PDMDevHlpCritSectEnter(pThis->CTX_SUFF(pDevIns), &pThis->ReplyFreeQueueWriteCritSect, VINF_IOM_R3_MMIO_WRITE); 1260 1258 if (rc != VINF_SUCCESS) 1261 1259 return rc; … … 1264 1262 pThis->uReplyFreeQueueNextEntryFreeWrite++; 1265 1263 pThis->uReplyFreeQueueNextEntryFreeWrite %= pThis->cReplyQueueEntries; 1266 PDM CritSectLeave(&pThis->ReplyFreeQueueWriteCritSect);1264 PDMDevHlpCritSectLeave(pThis->CTX_SUFF(pDevIns), &pThis->ReplyFreeQueueWriteCritSect); 1267 1265 break; 1268 1266 } 1269 1267 case LSILOGIC_REG_REQUEST_QUEUE: 1270 1268 { 1271 int rc = PDM CritSectEnter(&pThis->RequestQueueCritSect, VINF_IOM_R3_MMIO_WRITE);1269 int rc = PDMDevHlpCritSectEnter(pThis->CTX_SUFF(pDevIns), &pThis->RequestQueueCritSect, VINF_IOM_R3_MMIO_WRITE); 1272 1270 if (rc != VINF_SUCCESS) 1273 1271 return rc; … … 1286 1284 uNextWrite %= pThis->cRequestQueueEntries; 1287 1285 ASMAtomicWriteU32(&pThis->uRequestQueueNextEntryFreeWrite, uNextWrite); 1288 PDM CritSectLeave(&pThis->RequestQueueCritSect);1286 PDMDevHlpCritSectLeave(pThis->CTX_SUFF(pDevIns), &pThis->RequestQueueCritSect); 1289 1287 1290 1288 /* Send notification to R3 if there is not one sent already. Do this … … 1295 1293 { 1296 1294 LogFlowFunc(("Signal event semaphore\n")); 1297 rc = SUPSemEventSignal(pThis->pSupDrvSession, pThis->hEvtProcess);1295 rc = PDMDevHlpSUPSemEventSignal(pThis->CTX_SUFF(pDevIns), pThis->hEvtProcess); 1298 1296 AssertRC(rc); 1299 1297 } … … 1531 1529 case LSILOGIC_REG_REPLY_QUEUE: 1532 1530 { 1533 rc = PDM CritSectEnter(&pThis->ReplyPostQueueCritSect, VINF_IOM_R3_MMIO_READ);1531 rc = PDMDevHlpCritSectEnter(pThis->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect, VINF_IOM_R3_MMIO_READ); 1534 1532 if (rc != VINF_SUCCESS) 1535 1533 break; … … 1551 1549 lsilogicClearInterrupt(pThis, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR); 1552 1550 } 1553 PDM CritSectLeave(&pThis->ReplyPostQueueCritSect);1551 PDMDevHlpCritSectLeave(pThis->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect); 1554 1552 1555 1553 Log(("%s: Returning address %#x\n", __FUNCTION__, u32)); … … 3916 3914 /* Notify the worker thread that there are pending requests. */ 3917 3915 LogFlowFunc(("Signal event semaphore\n")); 3918 rc = SUPSemEventSignal(pThis->pSupDrvSession, pThis->hEvtProcess);3916 rc = PDMDevHlpSUPSemEventSignal(pThis->CTX_SUFF(pDevIns), pThis->hEvtProcess); 3919 3917 AssertRC(rc); 3920 3918 } … … 3945 3943 /* Notify the worker thread that there are pending requests. */ 3946 3944 LogFlowFunc(("Signal event semaphore\n")); 3947 rc = SUPSemEventSignal(pThis->pSupDrvSession, pThis->hEvtProcess);3945 rc = PDMDevHlpSUPSemEventSignal(pThis->CTX_SUFF(pDevIns), pThis->hEvtProcess); 3948 3946 AssertRC(rc); 3949 3947 } … … 4198 4196 { 4199 4197 Assert(ASMAtomicReadBool(&pThis->fWrkThreadSleeping)); 4200 rc = SUPSemEventWaitNoResume(pThis->pSupDrvSession, pThis->hEvtProcess, RT_INDEFINITE_WAIT);4198 rc = PDMDevHlpSUPSemEventWaitNoResume(pThis->CTX_SUFF(pDevIns), pThis->hEvtProcess, RT_INDEFINITE_WAIT); 4201 4199 AssertLogRelMsgReturn(RT_SUCCESS(rc) || rc == VERR_INTERRUPTED, ("%Rrc\n", rc), rc); 4202 4200 if (RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING)) … … 4313 4311 RT_NOREF(pThread); 4314 4312 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4315 return SUPSemEventSignal(pThis->pSupDrvSession, pThis->hEvtProcess);4313 return PDMDevHlpSUPSemEventSignal(pThis->CTX_SUFF(pDevIns), pThis->hEvtProcess); 4316 4314 } 4317 4315 … … 4330 4328 /* Notify the worker thread that there are pending requests. */ 4331 4329 LogFlowFunc(("Signal event semaphore\n")); 4332 int rc = SUPSemEventSignal(pThis->pSupDrvSession, pThis->hEvtProcess);4330 int rc = PDMDevHlpSUPSemEventSignal(pThis->CTX_SUFF(pDevIns), pThis->hEvtProcess); 4333 4331 AssertRC(rc); 4334 4332 } … … 5224 5222 static DECLCALLBACK(int) lsilogicR3Destruct(PPDMDEVINS pDevIns) 5225 5223 { 5224 PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns); 5226 5225 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 5227 PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns); 5228 5229 PDMR3CritSectDelete(&pThis->ReplyFreeQueueCritSect); 5230 PDMR3CritSectDelete(&pThis->ReplyPostQueueCritSect); 5231 PDMR3CritSectDelete(&pThis->RequestQueueCritSect); 5232 PDMR3CritSectDelete(&pThis->ReplyFreeQueueWriteCritSect); 5226 5227 PDMDevHlpCritSectDelete(pDevIns, &pThis->ReplyFreeQueueCritSect); 5228 PDMDevHlpCritSectDelete(pDevIns, &pThis->ReplyPostQueueCritSect); 5229 PDMDevHlpCritSectDelete(pDevIns, &pThis->RequestQueueCritSect); 5230 PDMDevHlpCritSectDelete(pDevIns, &pThis->ReplyFreeQueueWriteCritSect); 5233 5231 5234 5232 RTMemFree(pThis->paDeviceStates); … … 5237 5235 if (pThis->hEvtProcess != NIL_SUPSEMEVENT) 5238 5236 { 5239 SUPSemEventClose(pThis->pSupDrvSession, pThis->hEvtProcess);5237 PDMDevHlpSUPSemEventClose(pThis->CTX_SUFF(pDevIns), pThis->hEvtProcess); 5240 5238 pThis->hEvtProcess = NIL_SUPSEMEVENT; 5241 5239 } … … 5252 5250 static DECLCALLBACK(int) lsilogicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg) 5253 5251 { 5252 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 5254 5253 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 5255 5254 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 5256 5255 int rc = VINF_SUCCESS; 5257 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);5258 5256 5259 5257 /* … … 5303 5301 Log(("%s: RequestQueueDepth=%u\n", __FUNCTION__, pThis->cRequestQueueEntries)); 5304 5302 5305 char *pszCtrlType;5306 rc = pHlp->pfnCFGMQueryString AllocDef(pCfg, "ControllerType", &pszCtrlType, LSILOGICSCSI_PCI_SPI_CTRLNAME);5303 char szCtrlType[64]; 5304 rc = pHlp->pfnCFGMQueryStringDef(pCfg, "ControllerType", szCtrlType, sizeof(szCtrlType), LSILOGICSCSI_PCI_SPI_CTRLNAME); 5307 5305 if (RT_FAILURE(rc)) 5308 5306 return PDMDEV_SET_ERROR(pDevIns, rc, 5309 5307 N_("LsiLogic configuration error: failed to read ControllerType as string")); 5310 Log(("%s: ControllerType=%s\n", __FUNCTION__, pszCtrlType));5311 5312 rc = lsilogicR3GetCtrlTypeFromString(pThis, pszCtrlType);5313 MMR3HeapFree(pszCtrlType);5308 Log(("%s: ControllerType=%s\n", __FUNCTION__, szCtrlType)); 5309 rc = lsilogicR3GetCtrlTypeFromString(pThis, szCtrlType); 5310 if (RT_FAILURE(rc)) 5311 return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic configuration error: failed to determine controller type from string")); 5314 5312 5315 5313 char szDevTag[20]; … … 5317 5315 pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI ? "SPI" : "SAS", 5318 5316 iInstance); 5319 5320 if (RT_FAILURE(rc))5321 return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic configuration error: failed to determine controller type from string"));5322 5317 5323 5318 rc = pHlp->pfnCFGMQueryU8(pCfg, "NumPorts", &pThis->cPorts); … … 5375 5370 pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 5376 5371 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 5377 pThis->pSupDrvSession = PDMDevHlpGetSupDrvSession(pDevIns);5378 5372 pThis->IBase.pfnQueryInterface = lsilogicR3StatusQueryInterface; 5379 5373 pThis->ILeds.pfnQueryStatusLed = lsilogicR3StatusQueryStatusLed; … … 5462 5456 pThis->cDeviceStates = pThis->cPorts * LSILOGICSCSI_PCI_SAS_DEVICES_PER_PORT_MAX; 5463 5457 else 5464 Assert MsgFailed(("Invalid controller type: %d\n", pThis->enmCtrlType));5458 AssertLogRelMsgFailedReturn(("Invalid controller type: %d\n", pThis->enmCtrlType), VERR_INTERNAL_ERROR_4); 5465 5459 5466 5460 /* … … 5473 5467 N_("LsiLogic: Failed to create worker thread %s"), szDevTag); 5474 5468 5475 rc = SUPSemEventCreate(pThis->pSupDrvSession, &pThis->hEvtProcess);5469 rc = PDMDevHlpSUPSemEventCreate(pThis->CTX_SUFF(pDevIns), &pThis->hEvtProcess); 5476 5470 if (RT_FAILURE(rc)) 5477 5471 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
Note:
See TracChangeset
for help on using the changeset viewer.