Changeset 81781 in vbox
- Timestamp:
- Nov 11, 2019 9:57:39 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
r81777 r81781 81 81 *********************************************************************************************************************************/ 82 82 83 /** Pointer to the device instance data ofthe LsiLogic emulation. */83 /** Pointer to the shared instance data for the LsiLogic emulation. */ 84 84 typedef struct LSILOGICSCSI *PLSILOGICSCSI; 85 85 … … 89 89 * 90 90 * @returns nothing. 91 * @param p This The LsiLogic controllerinstance.92 * @param GCPhys The guest physical address of the memory buffer.93 * @param pSgBuf The pointer to the host R3 S/G buffer.94 * @param cbCopy How many bytes to copy between the two buffers.95 * @param pcbSkip Initially contains the amount of bytes to skip96 * starting from the guest physical address before97 * accessing the S/G buffer and start copying data.98 * On return this contains the remaining amount if99 * cbCopy < *pcbSkip or 0 otherwise.100 */ 101 typedef DECLCALLBACK(void) LSILOGICR3MEMCOPYCALLBACK(P LSILOGICSCSI pThis, RTGCPHYS GCPhys, PRTSGBUF pSgBuf, size_t cbCopy,102 size_t *pcbSkip);91 * @param pDevIns The device instance. 92 * @param GCPhys The guest physical address of the memory buffer. 93 * @param pSgBuf The pointer to the host R3 S/G buffer. 94 * @param cbCopy How many bytes to copy between the two buffers. 95 * @param pcbSkip Initially contains the amount of bytes to skip 96 * starting from the guest physical address before 97 * accessing the S/G buffer and start copying data. 98 * On return this contains the remaining amount if 99 * cbCopy < *pcbSkip or 0 otherwise. 100 */ 101 typedef DECLCALLBACK(void) LSILOGICR3MEMCOPYCALLBACK(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, 102 PRTSGBUF pSgBuf, size_t cbCopy, size_t *pcbSkip); 103 103 /** Pointer to a memory copy buffer callback. */ 104 104 typedef LSILOGICR3MEMCOPYCALLBACK *PLSILOGICR3MEMCOPYCALLBACK; … … 148 148 typedef struct LSILOGICDEVICE 149 149 { 150 /** Pointer to the owning lsilogic device instance .- R3 pointer */151 R3PTRTYPE(PLSILOGICSCSI) pLsiLogicR3;150 /** Pointer to the owning lsilogic device instance - R3 pointer */ 151 PPDMDEVINSR3 pDevIns; 152 152 153 153 /** LUN of the device. */ … … 155 155 /** Number of outstanding tasks on the port. */ 156 156 volatile uint32_t cOutstandingRequests; 157 158 #if HC_ARCH_BITS == 64159 uint32_t Alignment0;160 #endif161 157 162 158 /** Our base interface. */ … … 176 172 /** The status LED state for this device. */ 177 173 PDMLED Led; 178 174 /** Device name. */ 175 char szName[16]; 179 176 } LSILOGICDEVICE; 180 177 /** Pointer to a device state. */ … … 190 187 typedef struct LSILOGICSCSI 191 188 { 192 /** Pointer to the device instance. - R3 ptr. */193 PPDMDEVINSR3 pDevInsR3;194 /** Pointer to the device instance. - R0 ptr. */195 PPDMDEVINSR0 pDevInsR0;196 /** Pointer to the device instance. - RC ptr. */197 PPDMDEVINSRC pDevInsRC;198 199 /** Flag whether the GC part of the device is enabled. */200 bool fGCEnabled;201 /** Flag whether the R0 part of the device is enabled. */202 bool fR0Enabled;203 bool afPaddingMinus1[2+4];204 205 189 /** The state the controller is currently in. */ 206 190 LSILOGICSTATE enmState; … … 220 204 /** Number of device states allocated. */ 221 205 uint32_t cDeviceStates; 222 223 /** States for attached devices. */ 224 R3PTRTYPE(PLSILOGICDEVICE) paDeviceStates; 225 #if HC_ARCH_BITS == 32 226 RTR3PTR R3PtrPadding0; 227 #endif 206 uint32_t u32Padding1; 228 207 229 208 /** Interrupt mask. */ … … 250 229 /** The fault code of the I/O controller if we are in the fault state. */ 251 230 uint16_t u16IOCFaultCode; 252 uint16_t u16Padding 0b;231 uint16_t u16Padding2; 253 232 254 233 /** Upper 32 bits of the message frame address to locate requests in guest memory. */ … … 305 284 volatile uint32_t uRequestQueueNextAddressRead; 306 285 286 /** Indicates that PDMDevHlpAsyncNotificationCompleted should be called when 287 * a port is entering the idle state. */ 288 bool volatile fSignalIdle; 289 /** Flag whether the worker thread is sleeping. */ 290 volatile bool fWrkThreadSleeping; 291 /** Flag whether a request from the BIOS is pending which the 292 * worker thread needs to process. */ 293 volatile bool fBiosReqPending; 294 bool fPadding3; 295 296 /** Current address to read from or write to in the diagnostic memory region. */ 297 uint32_t u32DiagMemAddr; 298 307 299 /** Emulated controller type */ 308 300 LSILOGICCTRLTYPE enmCtrlType; … … 312 304 /** Number of ports this controller has. */ 313 305 uint8_t cPorts; 314 315 /** BIOS emulation. */ 316 VBOXSCSI VBoxSCSI; 317 306 uint8_t afPadding4; 307 308 /** The event semaphore the processing thread waits on. */ 309 SUPSEMEVENT hEvtProcess; 310 311 /** PCI Region \#0: I/O ports register access. */ 312 IOMIOPORTHANDLE hIoPortsReg; 313 /** PCI Region \#1: MMIO register access. */ 314 IOMMMIOHANDLE hMmioReg; 315 /** PCI Region \#2: MMIO diag. */ 316 IOMMMIOHANDLE hMmioDiag; 317 /** ISA Ports for the BIOS (when booting is configured). */ 318 IOMIOPORTHANDLE hIoPortsBios; 319 } LSILOGICSCSI; 320 AssertCompileMemberAlignment(LSILOGICSCSI, ReplyPostQueueCritSect, 8); 321 322 /** 323 * Ring-3 instance data for the LsiLogic emulation. 324 */ 325 typedef struct LSILOGICSCSIR3 326 { 327 /** States for attached devices. */ 328 R3PTRTYPE(PLSILOGICDEVICE) paDeviceStates; 318 329 /** Status LUN: The base interface. */ 319 330 PDMIBASE IBase; … … 327 338 R3PTRTYPE(PMptConfigurationPagesSupported) pConfigurationPages; 328 339 329 /** Indicates that PDMDevHlpAsyncNotificationCompleted should be called when 330 * a port is entering the idle state. */ 331 bool volatile fSignalIdle; 332 /** Flag whether we have tasks which need to be processed again- */ 333 bool volatile fRedo; 334 /** Flag whether the worker thread is sleeping. */ 335 volatile bool fWrkThreadSleeping; 336 /** Flag whether a request from the BIOS is pending which the 337 * worker thread needs to process. */ 338 volatile bool fBiosReqPending; 339 #if HC_ARCH_BITS == 64 340 /** Alignment padding. */ 341 bool afPadding2[4]; 342 #endif 343 /** List of tasks which can be redone. */ 344 R3PTRTYPE(volatile PLSILOGICREQ) pTasksRedoHead; 345 346 /** Current address to read from or write to in the diagnostic memory region. */ 347 uint32_t u32DiagMemAddr; 340 /** BIOS emulation. */ 341 VBOXSCSI VBoxSCSI; 342 348 343 /** Current size of the memory regions. */ 349 344 uint32_t cbMemRegns; 350 351 #if HC_ARCH_BITS ==32352 345 uint32_t u32Padding3; 353 #endif 354 355 union 356 { 357 /** List of memory regions - PLSILOGICMEMREGN. */ 358 RTLISTANCHOR ListMemRegns; 359 uint8_t u8Padding[2 * sizeof(RTUINTPTR)]; 360 }; 346 347 /** List of memory regions - PLSILOGICMEMREGN. */ 348 RTLISTANCHORR3 ListMemRegns; 361 349 362 350 /** Worker thread. */ 363 351 R3PTRTYPE(PPDMTHREAD) pThreadWrk; 364 /** The event semaphore the processing thread waits on. */ 365 SUPSEMEVENT hEvtProcess; 366 367 /** PCI Region \#0: I/O ports register access. */ 368 IOMIOPORTHANDLE hIoPortsReg; 369 /** PCI Region \#1: MMIO register access. */ 370 IOMMMIOHANDLE hMmioReg; 371 /** PCI Region \#2: MMIO diag. */ 372 IOMMMIOHANDLE hMmioDiag; 373 /** ISA Ports for the BIOS (when booting is configured). */ 374 IOMIOPORTHANDLE hIoPortsBios; 375 } LSILOGISCSI; 352 353 /** The device instace - only for getting bearings in interface methods. */ 354 PPDMDEVINSR3 pDevIns; 355 } LSILOGICSCSIR3; 356 /** Pointer to the ring-3 instance data for the LsiLogic emulation. */ 357 typedef LSILOGICSCSIR3 *PLSILOGICSCSIR3; 358 359 360 /** 361 * Ring-0 instance data for the LsiLogic emulation. 362 */ 363 typedef struct LSILOGICSCSIR0 364 { 365 uint64_t u64Unused; 366 } LSILOGICSCSIR0; 367 /** Pointer to the ring-0 instance data for the LsiLogic emulation. */ 368 typedef LSILOGICSCSIR0 *PLSILOGICSCSIR0; 369 370 371 /** 372 * Raw-mode instance data for the LsiLogic emulation. 373 */ 374 typedef struct LSILOGICSCSIRC 375 { 376 uint64_t u64Unused; 377 } LSILOGICSCSIRC; 378 /** Pointer to the raw-mode instance data for the LsiLogic emulation. */ 379 typedef LSILOGICSCSIRC *PLSILOGICSCSIRC; 380 381 382 /** The current context instance data for the LsiLogic emulation. */ 383 typedef CTX_SUFF(LSILOGICSCSI) LSILOGICSCSICC; 384 /** Pointer to the current context instance data for the LsiLogic emulation. */ 385 typedef CTX_SUFF(PLSILOGICSCSI) PLSILOGICSCSICC; 376 386 377 387 … … 414 424 RT_C_DECLS_BEGIN 415 425 #ifdef IN_RING3 416 static void lsilogicR3InitializeConfigurationPages(P LSILOGICSCSI pThis);417 static void lsilogicR3ConfigurationPagesFree(PLSILOGICSCSI pThis );418 static int lsilogicR3ProcessConfigurationRequest(P LSILOGICSCSI pThis, PMptConfigurationRequest pConfigurationReq,419 PMptConfigurationRe ply pReply);426 static void lsilogicR3InitializeConfigurationPages(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC); 427 static void lsilogicR3ConfigurationPagesFree(PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC); 428 static int lsilogicR3ProcessConfigurationRequest(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC, 429 PMptConfigurationRequest pConfigurationReq, PMptConfigurationReply pReply); 420 430 #endif 421 431 RT_C_DECLS_END … … 433 443 * 434 444 * @returns nothing. 435 * @param pThis Pointer to the LsiLogic device state. 436 */ 437 static void lsilogicUpdateInterrupt(PLSILOGICSCSI pThis) 445 * @param pDevIns The device instance. 446 * @param pThis Pointer to the shared LsiLogic device state. 447 */ 448 static void lsilogicUpdateInterrupt(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis) 438 449 { 439 450 uint32_t uIntSts; … … 449 460 { 450 461 LogFlowFunc(("Setting interrupt\n")); 451 PDMDevHlpPCISetIrq(p This->CTX_SUFF(pDevIns), 0, 1);462 PDMDevHlpPCISetIrq(pDevIns, 0, 1); 452 463 } 453 464 else 454 465 { 455 466 LogFlowFunc(("Clearing interrupt\n")); 456 PDMDevHlpPCISetIrq(p This->CTX_SUFF(pDevIns), 0, 0);467 PDMDevHlpPCISetIrq(pDevIns, 0, 0); 457 468 } 458 469 } … … 463 474 * 464 475 * @returns nothing. 465 * @param pThis Pointer to the LsiLogic device state. 476 * @param pDevIns The device instance. 477 * @param pThis Pointer to the shared LsiLogic device state. 466 478 * @param uStatus The status bit to set. 467 479 */ 468 DECLINLINE(void) lsilogicSetInterrupt(P LSILOGICSCSI pThis, uint32_t uStatus)480 DECLINLINE(void) lsilogicSetInterrupt(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, uint32_t uStatus) 469 481 { 470 482 ASMAtomicOrU32(&pThis->uInterruptStatus, uStatus); 471 lsilogicUpdateInterrupt(p This);483 lsilogicUpdateInterrupt(pDevIns, pThis); 472 484 } 473 485 … … 477 489 * 478 490 * @returns nothing. 479 * @param pThis Pointer to the LsiLogic device state. 491 * @param pDevIns The device instance. 492 * @param pThis Pointer to the shared LsiLogic device state. 480 493 * @param uStatus The status bit to set. 481 494 */ 482 DECLINLINE(void) lsilogicClearInterrupt(P LSILOGICSCSI pThis, uint32_t uStatus)495 DECLINLINE(void) lsilogicClearInterrupt(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, uint32_t uStatus) 483 496 { 484 497 ASMAtomicAndU32(&pThis->uInterruptStatus, ~uStatus); 485 lsilogicUpdateInterrupt(p This);498 lsilogicUpdateInterrupt(pDevIns, pThis); 486 499 } 487 500 … … 492 505 * 493 506 * @returns nothing 494 * @param pThis Pointer to the LsiLogic device state.507 * @param pThis Pointer to the shared LsiLogic device state. 495 508 * @param uIOCFaultCode Fault code to set. 496 509 */ … … 513 526 * 514 527 * @returns Number of frames in the reply free queue. 515 * @param pThis Pointer to the LsiLogic device state.528 * @param pThis Pointer to the shared LsiLogic device state. 516 529 */ 517 530 DECLINLINE(uint32_t) lsilogicReplyFreeQueueGetFrameCount(PLSILOGICSCSI pThis) … … 533 546 * 534 547 * @returns Number of frames in the reply free queue. 535 * @param pThis Pointer to the LsiLogic device state.548 * @param pThis Pointer to the shared LsiLogic device state. 536 549 */ 537 550 DECLINLINE(uint32_t) lsilogicReplyPostQueueGetFrameCount(PLSILOGICSCSI pThis) … … 552 565 * 553 566 * @returns VBox status code. 554 * @param pThis Pointer to the LsiLogic device state. 555 */ 556 static int lsilogicR3HardReset(PLSILOGICSCSI pThis) 567 * @param pDevIns The device instance. 568 * @param pThis Pointer to the shared LsiLogic device state. 569 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 570 */ 571 static int lsilogicR3HardReset(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC) 557 572 { 558 573 pThis->enmState = LSILOGICSTATE_RESET; … … 564 579 /* Reset interrupt states. */ 565 580 pThis->uInterruptStatus = 0; 566 lsilogicUpdateInterrupt(p This);581 lsilogicUpdateInterrupt(pDevIns, pThis); 567 582 568 583 /* Reset the queues. */ … … 586 601 pThis->u32DiagMemAddr = 0; 587 602 588 lsilogicR3ConfigurationPagesFree(pThis );589 lsilogicR3InitializeConfigurationPages(p This);603 lsilogicR3ConfigurationPagesFree(pThis, pThisCC); 604 lsilogicR3InitializeConfigurationPages(pDevIns, pThis, pThisCC); 590 605 591 606 /* Mark that we finished performing the reset. */ … … 598 613 * 599 614 * @returns nothing. 600 * @param pThis The LsiLogic controller instance 601 */ 602 static void lsilogicR3ConfigurationPagesFree(PLSILOGICSCSI pThis) 603 { 604 605 if (pThis->pConfigurationPages) 615 * @param pThis Pointer to the shared LsiLogic device state. 616 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 617 */ 618 static void lsilogicR3ConfigurationPagesFree(PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC) 619 { 620 621 if (pThisCC->pConfigurationPages) 606 622 { 607 623 /* Destroy device list if we emulate a SAS controller. */ 608 624 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 609 625 { 610 PMptConfigurationPagesSas pSasPages = &pThis ->pConfigurationPages->u.SasPages;626 PMptConfigurationPagesSas pSasPages = &pThisCC->pConfigurationPages->u.SasPages; 611 627 PMptSASDevice pSASDeviceCurr = pSasPages->pSASDeviceHead; 612 628 … … 628 644 } 629 645 630 RTMemFree(pThis ->pConfigurationPages);646 RTMemFree(pThisCC->pConfigurationPages); 631 647 } 632 648 } … … 636 652 * 637 653 * @returns nothing 638 * @param pThis Pointer to the LsiLogic device state. 654 * @param pDevIns The device instance. 655 * @param pThis Pointer to the shared LsiLogic device state. 639 656 * @param u32MessageContext The message context ID to post. 640 657 */ 641 static void lsilogicR3FinishContextReply(P LSILOGICSCSI pThis, uint32_t u32MessageContext)658 static void lsilogicR3FinishContextReply(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, uint32_t u32MessageContext) 642 659 { 643 660 int rc; … … 648 665 649 666 /* Write message context ID into reply post queue. */ 650 rc = PDMDevHlpCritSectEnter(p This->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect, VINF_SUCCESS);667 rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->ReplyPostQueueCritSect, VINF_SUCCESS); 651 668 AssertRC(rc); 652 669 … … 656 673 /* Set error code. */ 657 674 lsilogicSetIOCFaultCode(pThis, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); 658 PDMDevHlpCritSectLeave(p This->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect);675 PDMDevHlpCritSectLeave(pDevIns, &pThis->ReplyPostQueueCritSect); 659 676 return; 660 677 } … … 666 683 667 684 /* Set interrupt. */ 668 lsilogicSetInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR);669 670 PDMDevHlpCritSectLeave(p This->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect);685 lsilogicSetInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR); 686 687 PDMDevHlpCritSectLeave(pDevIns, &pThis->ReplyPostQueueCritSect); 671 688 } 672 689 … … 676 693 * 677 694 * @returns nothing 678 * @param pThis Pointer to the LsiLogic device state. 695 * @param pDevIns The device instance. 696 * @param pThis Pointer to the shared LsiLogic device state. 679 697 * @param pReply Pointer to the reply message. 680 698 * @param fForceReplyFifo Flag whether the use of the reply post fifo is forced. 681 699 */ 682 static void lsilogicFinishAddressReply(P LSILOGICSCSI pThis, PMptReplyUnion pReply, bool fForceReplyFifo)700 static void lsilogicFinishAddressReply(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, PMptReplyUnion pReply, bool fForceReplyFifo) 683 701 { 684 702 /* … … 693 711 Log(("%s: cReplySize=%u\n", __FUNCTION__, pThis->cReplySize)); 694 712 pThis->uNextReplyEntryRead = 0; 695 lsilogicSetInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL);713 lsilogicSetInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); 696 714 } 697 715 else … … 705 723 int rc; 706 724 /* Grab a free reply message from the queue. */ 707 rc = PDMDevHlpCritSectEnter(p This->CTX_SUFF(pDevIns), &pThis->ReplyFreeQueueCritSect, VINF_SUCCESS);725 rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->ReplyFreeQueueCritSect, VINF_SUCCESS); 708 726 AssertRC(rc); 709 727 … … 713 731 /* Set error code. */ 714 732 lsilogicSetIOCFaultCode(pThis, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); 715 PDMDevHlpCritSectLeave(p This->CTX_SUFF(pDevIns), &pThis->ReplyFreeQueueCritSect);733 PDMDevHlpCritSectLeave(pDevIns, &pThis->ReplyFreeQueueCritSect); 716 734 return; 717 735 } … … 722 740 pThis->uReplyFreeQueueNextAddressRead %= pThis->cReplyQueueEntries; 723 741 724 PDMDevHlpCritSectLeave(p This->CTX_SUFF(pDevIns), &pThis->ReplyFreeQueueCritSect);742 PDMDevHlpCritSectLeave(pDevIns, &pThis->ReplyFreeQueueCritSect); 725 743 726 744 /* Build 64bit physical address. */ … … 729 747 730 748 /* Write reply to guest memory. */ 731 PDMDevHlpPCIPhysWrite(p This->CTX_SUFF(pDevIns), GCPhysReplyMessage, pReply, cbReplyCopied);749 PDMDevHlpPCIPhysWrite(pDevIns, GCPhysReplyMessage, pReply, cbReplyCopied); 732 750 733 751 /* Write low 32bits of reply frame into post reply queue. */ 734 rc = PDMDevHlpCritSectEnter(p This->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect, VINF_SUCCESS);752 rc = PDMDevHlpCritSectEnter(pDevIns, &pThis->ReplyPostQueueCritSect, VINF_SUCCESS); 735 753 AssertRC(rc); 736 754 … … 740 758 /* Set error code. */ 741 759 lsilogicSetIOCFaultCode(pThis, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); 742 PDMDevHlpCritSectLeave(p This->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect);760 PDMDevHlpCritSectLeave(pDevIns, &pThis->ReplyPostQueueCritSect); 743 761 return; 744 762 } … … 753 771 { 754 772 pThis->enmDoorbellState = LSILOGICDOORBELLSTATE_NOT_IN_USE; 755 lsilogicSetInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL);773 lsilogicSetInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); 756 774 } 757 775 758 776 /* Set interrupt. */ 759 lsilogicSetInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR);760 761 PDMDevHlpCritSectLeave(p This->CTX_SUFF(pDevIns), &pThis->ReplyPostQueueCritSect);777 lsilogicSetInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR); 778 779 PDMDevHlpCritSectLeave(pDevIns, &pThis->ReplyPostQueueCritSect); 762 780 # else 763 781 AssertMsgFailed(("This is not allowed to happen.\n")); … … 771 789 * 772 790 * @returns Pointer to memory region or NULL if not found. 773 * @param pThis Pointer to theLsiLogic device state.791 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 774 792 * @param u32Addr The 32bit address to search for. 775 793 */ 776 static PLSILOGICMEMREGN lsilogicR3MemRegionFindByAddr(PLSILOGICSCSI pThis, uint32_t u32Addr)794 static PLSILOGICMEMREGN lsilogicR3MemRegionFindByAddr(PLSILOGICSCSICC pThisCC, uint32_t u32Addr) 777 795 { 778 796 PLSILOGICMEMREGN pRegion = NULL; 779 797 780 798 PLSILOGICMEMREGN pIt; 781 RTListForEach(&pThis ->ListMemRegns, pIt, LSILOGICMEMREGN, NodeList)799 RTListForEach(&pThisCC->ListMemRegns, pIt, LSILOGICMEMREGN, NodeList) 782 800 { 783 801 if ( u32Addr >= pIt->u32AddrStart … … 796 814 * 797 815 * @returns nothing. 798 * @param pThis Pointer to theLsiLogic device state.799 */ 800 static void lsilogicR3MemRegionsFree(PLSILOGICSCSI pThis)816 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 817 */ 818 static void lsilogicR3MemRegionsFree(PLSILOGICSCSICC pThisCC) 801 819 { 802 820 PLSILOGICMEMREGN pItNext; 803 821 804 822 PLSILOGICMEMREGN pIt; 805 RTListForEachSafe(&pThis ->ListMemRegns, pIt, pItNext, LSILOGICMEMREGN, NodeList)823 RTListForEachSafe(&pThisCC->ListMemRegns, pIt, pItNext, LSILOGICMEMREGN, NodeList) 806 824 { 807 825 RTListNodeRemove(&pIt->NodeList); 808 826 RTMemFree(pIt); 809 827 } 810 pThis ->cbMemRegns = 0;828 pThisCC->cbMemRegns = 0; 811 829 } 812 830 … … 815 833 * 816 834 * @returns nothing. 817 * @param pThis Pointer to theLsiLogic device state.835 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 818 836 * @param pRegion The region to insert. 819 837 */ 820 static void lsilogicR3MemRegionInsert(PLSILOGICSCSI pThis, PLSILOGICMEMREGN pRegion)838 static void lsilogicR3MemRegionInsert(PLSILOGICSCSICC pThisCC, PLSILOGICMEMREGN pRegion) 821 839 { 822 840 bool fInserted = false; … … 824 842 /* Insert at the right position. */ 825 843 PLSILOGICMEMREGN pIt; 826 RTListForEach(&pThis ->ListMemRegns, pIt, LSILOGICMEMREGN, NodeList)844 RTListForEach(&pThisCC->ListMemRegns, pIt, LSILOGICMEMREGN, NodeList) 827 845 { 828 846 if (pRegion->u32AddrEnd < pIt->u32AddrStart) … … 834 852 } 835 853 if (!fInserted) 836 RTListAppend(&pThis ->ListMemRegns, &pRegion->NodeList);854 RTListAppend(&pThisCC->ListMemRegns, &pRegion->NodeList); 837 855 } 838 856 … … 841 859 * 842 860 * @returns Number of memory regions. 843 * @param pThis Pointer to theLsiLogic device state.844 */ 845 static uint32_t lsilogicR3MemRegionsCount(PLSILOGICSCSI pThis)861 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 862 */ 863 static uint32_t lsilogicR3MemRegionsCount(PLSILOGICSCSICC pThisCC) 846 864 { 847 865 uint32_t cRegions = 0; 848 866 849 867 PLSILOGICMEMREGN pIt; 850 RTListForEach(&pThis ->ListMemRegns, pIt, LSILOGICMEMREGN, NodeList)868 RTListForEach(&pThisCC->ListMemRegns, pIt, LSILOGICMEMREGN, NodeList) 851 869 { 852 870 cRegions++; … … 860 878 * 861 879 * @returns nothing. 862 * @param pThis Pointer to the LsiLogic device state. 880 * @param pThis Pointer to the shared LsiLogic device state. 881 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 863 882 * @param u32Data Data to write. 864 883 */ 865 static void lsilogicR3DiagRegDataWrite(PLSILOGICSCSI pThis, uint32_t u32Data)866 { 867 PLSILOGICMEMREGN pRegion = lsilogicR3MemRegionFindByAddr(pThis , pThis->u32DiagMemAddr);884 static void lsilogicR3DiagRegDataWrite(PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC, uint32_t u32Data) 885 { 886 PLSILOGICMEMREGN pRegion = lsilogicR3MemRegionFindByAddr(pThisCC, pThis->u32DiagMemAddr); 868 887 869 888 if (pRegion) … … 884 903 /* Create new region, first check whether we can extend another region. */ 885 904 PLSILOGICMEMREGN pIt; 886 RTListForEach(&pThis ->ListMemRegns, pIt, LSILOGICMEMREGN, NodeList)905 RTListForEach(&pThisCC->ListMemRegns, pIt, LSILOGICMEMREGN, NodeList) 887 906 { 888 907 if (pThis->u32DiagMemAddr == pIt->u32AddrEnd + sizeof(uint32_t)) … … 901 920 uint32_t cRegionSizeNew = cRegionSizeOld + 512; 902 921 903 if (pThis ->cbMemRegns + 512 * sizeof(uint32_t) < LSILOGIC_MEMORY_REGIONS_MAX)922 if (pThisCC->cbMemRegns + 512 * sizeof(uint32_t) < LSILOGIC_MEMORY_REGIONS_MAX) 904 923 { 905 924 PLSILOGICMEMREGN pRegionNew; … … 911 930 pRegion->au32Data[cRegionSizeOld] = u32Data; 912 931 pRegion->u32AddrEnd = pRegion->u32AddrStart + (cRegionSizeNew - 1) * sizeof(uint32_t); 913 pThis ->cbMemRegns += 512 * sizeof(uint32_t);932 pThisCC->cbMemRegns += 512 * sizeof(uint32_t); 914 933 } 915 934 /* else: Silently fail, there is nothing we can do here and the guest might work nevertheless. */ 916 935 917 lsilogicR3MemRegionInsert(pThis , pRegion);936 lsilogicR3MemRegionInsert(pThisCC, pRegion); 918 937 } 919 938 } 920 939 else 921 940 { 922 if (pThis ->cbMemRegns + 512 * sizeof(uint32_t) < LSILOGIC_MEMORY_REGIONS_MAX)941 if (pThisCC->cbMemRegns + 512 * sizeof(uint32_t) < LSILOGIC_MEMORY_REGIONS_MAX) 923 942 { 924 943 /* Create completely new. */ … … 929 948 pRegion->u32AddrEnd = pRegion->u32AddrStart + (512 - 1) * sizeof(uint32_t); 930 949 pRegion->au32Data[0] = u32Data; 931 pThis ->cbMemRegns += 512 * sizeof(uint32_t);932 933 lsilogicR3MemRegionInsert(pThis , pRegion);950 pThisCC->cbMemRegns += 512 * sizeof(uint32_t); 951 952 lsilogicR3MemRegionInsert(pThisCC, pRegion); 934 953 } 935 954 /* else: Silently fail, there is nothing we can do here and the guest might work nevertheless. */ … … 947 966 * 948 967 * @returns nothing. 949 * @param pThis Pointer to the LsiLogic device state. 968 * @param pThis Pointer to the shared LsiLogic device state. 969 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 950 970 * @param pu32Data Where to store the data. 951 971 */ 952 static void lsilogicR3DiagRegDataRead(PLSILOGICSCSI pThis, uint32_t *pu32Data)953 { 954 PLSILOGICMEMREGN pRegion = lsilogicR3MemRegionFindByAddr(pThis , pThis->u32DiagMemAddr);972 static void lsilogicR3DiagRegDataRead(PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC, uint32_t *pu32Data) 973 { 974 PLSILOGICMEMREGN pRegion = lsilogicR3MemRegionFindByAddr(pThisCC, pThis->u32DiagMemAddr); 955 975 956 976 if (pRegion) … … 976 996 * 977 997 * @returns nothing. 978 * @param pThis Pointer to the LsiLogic device state.998 * @param pThis Pointer to the shared LsiLogic device state. 979 999 * @param u32Addr Address to write. 980 1000 */ … … 988 1008 * 989 1009 * @returns nothing. 990 * @param pThis Pointer to the LsiLogic device state.1010 * @param pThis Pointer to the shared LsiLogic device state. 991 1011 * @param pu32Addr Where to store the current address. 992 1012 */ … … 1000 1020 * 1001 1021 * @returns VBox status code. 1002 * @param pThis Pointer to the LsiLogic device state. 1022 * @param pDevIns The device instance. 1023 * @param pThis Pointer to the shared LsiLogic device state. 1024 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 1003 1025 * @param pMessageHdr Pointer to the message header of the request. 1004 1026 * @param pReply Pointer to the reply. 1005 1027 */ 1006 static int lsilogicR3ProcessMessageRequest(PLSILOGICSCSI pThis, PMptMessageHdr pMessageHdr, PMptReplyUnion pReply) 1028 static int lsilogicR3ProcessMessageRequest(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC, 1029 PMptMessageHdr pMessageHdr, PMptReplyUnion pReply) 1007 1030 { 1008 1031 int rc = VINF_SUCCESS; … … 1096 1119 1097 1120 /* Check for a valid firmware image in the IOC memory which was downlaoded by tzhe guest earlier. */ 1098 PLSILOGICMEMREGN pRegion = lsilogicR3MemRegionFindByAddr(pThis , LSILOGIC_FWIMGHDR_LOAD_ADDRESS);1121 PLSILOGICMEMREGN pRegion = lsilogicR3MemRegionFindByAddr(pThisCC, LSILOGIC_FWIMGHDR_LOAD_ADDRESS); 1099 1122 1100 1123 if (pRegion) … … 1211 1234 PMptConfigurationRequest pConfigurationReq = (PMptConfigurationRequest)pMessageHdr; 1212 1235 1213 rc = lsilogicR3ProcessConfigurationRequest(p This, pConfigurationReq, &pReply->Configuration);1236 rc = lsilogicR3ProcessConfigurationRequest(pDevIns, pThis, pThisCC, pConfigurationReq, &pReply->Configuration); 1214 1237 AssertRC(rc); 1215 1238 break; … … 1241 1264 pReply->Header.u32MessageContext = pMessageHdr->u32MessageContext; 1242 1265 1243 lsilogicFinishAddressReply(p This, pReply, fForceReplyPostFifo);1266 lsilogicFinishAddressReply(pDevIns, pThis, pReply, fForceReplyPostFifo); 1244 1267 return rc; 1245 1268 } … … 1252 1275 * @returns Strict VBox status code. 1253 1276 * @param pDevIns The devie instance. 1254 * @param pThis Pointer to the LsiLogic device state.1277 * @param pThis Pointer to the shared LsiLogic device state. 1255 1278 * @param offReg Offset of the register to write. 1256 1279 * @param u32 The value being written. … … 1334 1357 /* Reset interrupt status. */ 1335 1358 pThis->uInterruptStatus = 0; 1336 lsilogicUpdateInterrupt(p This);1359 lsilogicUpdateInterrupt(pDevIns, pThis); 1337 1360 1338 1361 /* Reset the queues. */ … … 1357 1380 pThis->enmDoorbellState = LSILOGICDOORBELLSTATE_FN_HANDSHAKE; 1358 1381 /* Update the interrupt status to notify the guest that a doorbell function was started. */ 1359 lsilogicSetInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL);1382 lsilogicSetInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); 1360 1383 break; 1361 1384 } … … 1364 1387 pThis->enmDoorbellState = LSILOGICDOORBELLSTATE_RFR_FRAME_COUNT_LOW; 1365 1388 /* Update the interrupt status to notify the guest that a doorbell function was started. */ 1366 lsilogicSetInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL);1389 lsilogicSetInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); 1367 1390 break; 1368 1391 } … … 1390 1413 if (pThis->iMessage == pThis->cMessage) 1391 1414 { 1392 int rc = lsilogicR3ProcessMessageRequest(pThis, (PMptMessageHdr)pThis->aMessage, &pThis->ReplyBuffer); 1415 int rc = lsilogicR3ProcessMessageRequest(pDevIns, pThis, PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC), 1416 (PMptMessageHdr)pThis->aMessage, &pThis->ReplyBuffer); 1393 1417 AssertRC(rc); 1394 1418 } … … 1434 1458 } 1435 1459 1436 lsilogicUpdateInterrupt(p This);1460 lsilogicUpdateInterrupt(pDevIns, pThis); 1437 1461 break; 1438 1462 } … … 1440 1464 { 1441 1465 ASMAtomicWriteU32(&pThis->uInterruptMask, u32 & LSILOGIC_REG_HOST_INTR_MASK_W_MASK); 1442 lsilogicUpdateInterrupt(p This);1466 lsilogicUpdateInterrupt(pDevIns, pThis); 1443 1467 break; 1444 1468 } … … 1479 1503 #else 1480 1504 if (u32 & LSILOGIC_REG_HOST_DIAGNOSTIC_RESET_ADAPTER) 1481 lsilogicR3HardReset(p This);1505 lsilogicR3HardReset(pDevIns, pThis, PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC)); 1482 1506 else if (u32 & LSILOGIC_REG_HOST_DIAGNOSTIC_DIAG_RW_ENABLE) 1483 1507 pThis->fDiagRegsEnabled = true; … … 1493 1517 return VINF_IOM_R3_MMIO_WRITE; 1494 1518 #else 1495 lsilogicR3DiagRegDataWrite(pThis, u32);1519 lsilogicR3DiagRegDataWrite(pThis, PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC), u32); 1496 1520 #endif 1497 1521 } … … 1523 1547 * @returns VBox status code. 1524 1548 * @param pDevIns The device instance. 1525 * @param pThis Pointer to the LsiLogic device state.1549 * @param pThis Pointer to the shared LsiLogic device state. 1526 1550 * @param offReg Offset of the register to read. 1527 1551 * @param pu32 Where to store the content of the register. … … 1556 1580 /* The reply post queue is empty. Reset interrupt. */ 1557 1581 u32 = UINT32_C(0xffffffff); 1558 lsilogicClearInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR);1582 lsilogicClearInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR); 1559 1583 } 1560 1584 PDMDevHlpCritSectLeave(pDevIns, &pThis->ReplyPostQueueCritSect); … … 1583 1607 if (pThis->uNextReplyEntryRead < pThis->cReplySize) 1584 1608 u32 |= pThis->ReplyBuffer.au16Reply[pThis->uNextReplyEntryRead++]; 1585 lsilogicSetInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL);1609 lsilogicSetInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); 1586 1610 break; 1587 1611 case LSILOGICDOORBELLSTATE_RFR_FRAME_COUNT_LOW: … … 1591 1615 u32 |= cReplyFrames & UINT32_C(0xffff); 1592 1616 pThis->enmDoorbellState = LSILOGICDOORBELLSTATE_RFR_FRAME_COUNT_HIGH; 1593 lsilogicSetInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL);1617 lsilogicSetInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); 1594 1618 break; 1595 1619 } … … 1600 1624 u32 |= cReplyFrames >> 16; 1601 1625 pThis->enmDoorbellState = LSILOGICDOORBELLSTATE_RFR_NEXT_FRAME_LOW; 1602 lsilogicSetInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL);1626 lsilogicSetInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); 1603 1627 break; 1604 1628 } … … 1608 1632 u32 |= pThis->aReplyFreeQueue[pThis->uReplyFreeQueueNextAddressRead] & UINT32_C(0xffff); 1609 1633 pThis->enmDoorbellState = LSILOGICDOORBELLSTATE_RFR_NEXT_FRAME_HIGH; 1610 lsilogicSetInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL);1634 lsilogicSetInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); 1611 1635 } 1612 1636 break; … … 1616 1640 pThis->uReplyFreeQueueNextAddressRead %= pThis->cReplyQueueEntries; 1617 1641 pThis->enmDoorbellState = LSILOGICDOORBELLSTATE_RFR_NEXT_FRAME_LOW; 1618 lsilogicSetInterrupt(p This, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL);1642 lsilogicSetInterrupt(pDevIns, pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); 1619 1643 break; 1620 1644 default: … … 1649 1673 return VINF_IOM_R3_MMIO_READ; 1650 1674 #else 1651 lsilogicR3DiagRegDataRead(pThis, &u32);1675 lsilogicR3DiagRegDataRead(pThis, PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC), &u32); 1652 1676 #endif 1653 1677 } … … 1853 1877 * @copydoc LSILOGICR3MEMCOPYCALLBACK 1854 1878 */ 1855 static DECLCALLBACK(void) lsilogicR3CopyBufferFromGuestWorker(P LSILOGICSCSI pThis, RTGCPHYS GCPhys, PRTSGBUF pSgBuf,1856 size_t cbCopy, size_t *pcbSkip)1879 static DECLCALLBACK(void) lsilogicR3CopyBufferFromGuestWorker(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, 1880 PRTSGBUF pSgBuf, size_t cbCopy, size_t *pcbSkip) 1857 1881 { 1858 1882 size_t cbSkipped = RT_MIN(cbCopy, *pcbSkip); … … 1867 1891 1868 1892 AssertPtr(pvSeg); 1869 PDMDevHlpPhysRead(p This->CTX_SUFF(pDevIns), GCPhys, pvSeg, cbSeg);1893 PDMDevHlpPhysRead(pDevIns, GCPhys, pvSeg, cbSeg); 1870 1894 GCPhys += cbSeg; 1871 1895 cbCopy -= cbSeg; … … 1878 1902 * @copydoc LSILOGICR3MEMCOPYCALLBACK 1879 1903 */ 1880 static DECLCALLBACK(void) lsilogicR3CopyBufferToGuestWorker(P LSILOGICSCSI pThis, RTGCPHYS GCPhys, PRTSGBUF pSgBuf,1881 size_t cbCopy, size_t *pcbSkip)1904 static DECLCALLBACK(void) lsilogicR3CopyBufferToGuestWorker(PPDMDEVINS pDevIns, RTGCPHYS GCPhys, 1905 PRTSGBUF pSgBuf, size_t cbCopy, size_t *pcbSkip) 1882 1906 { 1883 1907 size_t cbSkipped = RT_MIN(cbCopy, *pcbSkip); … … 1892 1916 1893 1917 AssertPtr(pvSeg); 1894 PDMDevHlpPCIPhysWrite(p This->CTX_SUFF(pDevIns), GCPhys, pvSeg, cbSeg);1918 PDMDevHlpPCIPhysWrite(pDevIns, GCPhys, pvSeg, cbSeg); 1895 1919 GCPhys += cbSeg; 1896 1920 cbCopy -= cbSeg; … … 1902 1926 * 1903 1927 * @returns The amout of bytes actually copied. 1904 * @param pThis Pointer to the LsiLogic device state. 1905 * @param pLsiReq LSI request state. 1906 * @param pfnCopyWorker The copy method to apply for each guest buffer. 1907 * @param pSgBuf The host S/G buffer. 1908 * @param cbSkip How many bytes to skip in advance before starting to copy. 1909 * @param cbCopy How many bytes to copy. 1910 */ 1911 static size_t lsilogicSgBufWalker(PLSILOGICSCSI pThis, PLSILOGICREQ pLsiReq, 1928 * @param pDevIns The device instance. 1929 * @param pLsiReq LSI request state. 1930 * @param pfnCopyWorker The copy method to apply for each guest buffer. 1931 * @param pSgBuf The host S/G buffer. 1932 * @param cbSkip How many bytes to skip in advance before starting to 1933 * copy. 1934 * @param cbCopy How many bytes to copy. 1935 */ 1936 static size_t lsilogicSgBufWalker(PPDMDEVINS pDevIns, PLSILOGICREQ pLsiReq, 1912 1937 PLSILOGICR3MEMCOPYCALLBACK pfnCopyWorker, 1913 1938 PRTSGBUF pSgBuf, size_t cbSkip, size_t cbCopy) … … 1917 1942 RTGCPHYS GCPhysSegmentStart = pLsiReq->GCPhysSgStart; 1918 1943 uint32_t cChainOffsetNext = pLsiReq->cChainOffset; 1919 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns);1920 1944 size_t cbCopied = 0; 1921 1945 … … 1965 1989 GCPhysSgEntryNext += sizeof(MptSGEntrySimple32); 1966 1990 1967 pfnCopyWorker(p This, GCPhysAddrDataBuffer, pSgBuf, cbCopyThis, &cbSkip);1991 pfnCopyWorker(pDevIns, GCPhysAddrDataBuffer, pSgBuf, cbCopyThis, &cbSkip); 1968 1992 cbCopy -= cbCopyThis; 1969 1993 cbCopied += cbCopyThis; … … 2006 2030 * 2007 2031 * @returns Amount of bytes copied to the guest. 2008 * @param p This The LsiLogic controllerdevice instance.2009 * @param pReq 2010 * @param pSgBuf 2011 * @param cbSkip 2012 * @param cbCopy 2013 */ 2014 static size_t lsilogicR3CopySgBufToGuest(P LSILOGICSCSI pThis, PLSILOGICREQ pReq, PRTSGBUF pSgBuf,2032 * @param pDevIns The device instance. 2033 * @param pReq Request structure. 2034 * @param pSgBuf The S/G buffer to copy from. 2035 * @param cbSkip How many bytes to skip in advance before starting to copy. 2036 * @param cbCopy How many bytes to copy. 2037 */ 2038 static size_t lsilogicR3CopySgBufToGuest(PPDMDEVINS pDevIns, PLSILOGICREQ pReq, PRTSGBUF pSgBuf, 2015 2039 size_t cbSkip, size_t cbCopy) 2016 2040 { 2017 return lsilogicSgBufWalker(pThis, pReq, lsilogicR3CopyBufferToGuestWorker, 2018 pSgBuf, cbSkip, cbCopy); 2041 return lsilogicSgBufWalker(pDevIns, pReq, lsilogicR3CopyBufferToGuestWorker, pSgBuf, cbSkip, cbCopy); 2019 2042 } 2020 2043 … … 2023 2046 * 2024 2047 * @returns Amount of bytes copied from the guest. 2025 * @param p This The LsiLogic controllerdevice instance.2026 * @param pReq 2027 * @param pSgBuf 2028 * @param cbSkip 2029 * @param cbCopy 2030 */ 2031 static size_t lsilogicR3CopySgBufFromGuest(P LSILOGICSCSI pThis, PLSILOGICREQ pReq, PRTSGBUF pSgBuf,2048 * @param pDevIns The device instance. 2049 * @param pReq Request structure. 2050 * @param pSgBuf The S/G buffer to copy into. 2051 * @param cbSkip How many bytes to skip in advance before starting to copy. 2052 * @param cbCopy How many bytes to copy. 2053 */ 2054 static size_t lsilogicR3CopySgBufFromGuest(PPDMDEVINS pDevIns, PLSILOGICREQ pReq, PRTSGBUF pSgBuf, 2032 2055 size_t cbSkip, size_t cbCopy) 2033 2056 { 2034 return lsilogicSgBufWalker(pThis, pReq, lsilogicR3CopyBufferFromGuestWorker, 2035 pSgBuf, cbSkip, cbCopy); 2057 return lsilogicSgBufWalker(pDevIns, pReq, lsilogicR3CopyBufferFromGuestWorker, pSgBuf, cbSkip, cbCopy); 2036 2058 } 2037 2059 … … 2108 2130 * 2109 2131 * @returns nothing. 2110 * @param pThis Pointer to the LsiLogic device state. 2111 * @param pReq The request to complete. 2112 * @param rcReq Status code of the request. 2113 */ 2114 static void lsilogicR3ReqComplete(PLSILOGICSCSI pThis, PLSILOGICREQ pReq, int rcReq) 2132 * @param pDevIns The device instance. 2133 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 2134 * @param pThis Pointer to the shared LsiLogic device state. 2135 * @param pReq The request to complete. 2136 * @param rcReq Status code of the request. 2137 */ 2138 static void lsilogicR3ReqComplete(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC, PLSILOGICREQ pReq, int rcReq) 2115 2139 { 2116 2140 PLSILOGICDEVICE pTgtDev = pReq->pTargetDevice; 2117 2141 2118 if (RT_UNLIKELY(pReq->fBIOS)) 2119 { 2120 uint8_t u8ScsiSts = pReq->u8ScsiSts; 2121 pTgtDev->pDrvMediaEx->pfnIoReqFree(pTgtDev->pDrvMediaEx, pReq->hIoReq); 2122 int rc = vboxscsiRequestFinished(&pThis->VBoxSCSI, u8ScsiSts); 2123 AssertMsgRC(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc)); 2124 } 2125 else 2142 if (!pReq->fBIOS) 2126 2143 { 2127 2144 RTGCPHYS GCPhysAddrSenseBuffer; … … 2131 2148 2132 2149 /* Copy the sense buffer over. */ 2133 PDMDevHlpPCIPhysWrite(p This->CTX_SUFF(pDevIns), GCPhysAddrSenseBuffer, pReq->abSenseBuffer,2150 PDMDevHlpPCIPhysWrite(pDevIns, GCPhysAddrSenseBuffer, pReq->abSenseBuffer, 2134 2151 RT_UNLIKELY( pReq->GuestRequest.SCSIIO.u8SenseBufferLength 2135 2152 < sizeof(pReq->abSenseBuffer)) … … 2143 2160 /* Free the request before posting completion. */ 2144 2161 pTgtDev->pDrvMediaEx->pfnIoReqFree(pTgtDev->pDrvMediaEx, pReq->hIoReq); 2145 lsilogicR3FinishContextReply(p This, u32MsgCtx);2162 lsilogicR3FinishContextReply(pDevIns, pThis, u32MsgCtx); 2146 2163 } 2147 2164 else … … 2169 2186 /* Free the request before posting completion. */ 2170 2187 pTgtDev->pDrvMediaEx->pfnIoReqFree(pTgtDev->pDrvMediaEx, pReq->hIoReq); 2171 lsilogicFinishAddressReply(pThis, &IOCReply, false); 2172 } 2188 lsilogicFinishAddressReply(pDevIns, pThis, &IOCReply, false); 2189 } 2190 } 2191 else 2192 { 2193 uint8_t u8ScsiSts = pReq->u8ScsiSts; 2194 pTgtDev->pDrvMediaEx->pfnIoReqFree(pTgtDev->pDrvMediaEx, pReq->hIoReq); 2195 int rc = vboxscsiRequestFinished(&pThisCC->VBoxSCSI, u8ScsiSts); 2196 AssertMsgRC(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc)); 2173 2197 } 2174 2198 … … 2176 2200 2177 2201 if (pTgtDev->cOutstandingRequests == 0 && pThis->fSignalIdle) 2178 PDMDevHlpAsyncNotificationCompleted(p This->pDevInsR3);2202 PDMDevHlpAsyncNotificationCompleted(pDevIns); 2179 2203 } 2180 2204 … … 2187 2211 * 2188 2212 * @returns VBox status code. 2189 * @param pThis Pointer to the LsiLogic device state. 2190 * @param GCPhysMessageFrameAddr Guest physical address where the request is located. 2191 * @param pGuestReq The request read fro th guest memory. 2192 */ 2193 static int lsilogicR3ProcessSCSIIORequest(PLSILOGICSCSI pThis, RTGCPHYS GCPhysMessageFrameAddr, 2194 PMptRequestUnion pGuestReq) 2213 * @param pDevIns The device instance. 2214 * @param pThis Pointer to the shared LsiLogic device state. 2215 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 2216 * @param GCPhysMessageFrameAddr Guest physical address where the request is located. 2217 * @param pGuestReq The request read fro th guest memory. 2218 */ 2219 static int lsilogicR3ProcessSCSIIORequest(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC, 2220 RTGCPHYS GCPhysMessageFrameAddr, PMptRequestUnion pGuestReq) 2195 2221 { 2196 2222 MptReplyUnion IOCReply; … … 2204 2230 && (pGuestReq->SCSIIO.u8Bus == 0))) 2205 2231 { 2206 PLSILOGICDEVICE pTgtDev = &pThis ->paDeviceStates[pGuestReq->SCSIIO.u8TargetID];2232 PLSILOGICDEVICE pTgtDev = &pThisCC->paDeviceStates[pGuestReq->SCSIIO.u8TargetID]; 2207 2233 2208 2234 if (pTgtDev->pDrvBase) … … 2250 2276 &pLsiReq->u8ScsiSts, 30 * RT_MS_1SEC); 2251 2277 if (rc != VINF_PDM_MEDIAEX_IOREQ_IN_PROGRESS) 2252 lsilogicR3ReqComplete(p This, pLsiReq, rc);2278 lsilogicR3ReqComplete(pDevIns, pThis, pThisCC, pLsiReq, rc); 2253 2279 2254 2280 return VINF_SUCCESS; … … 2276 2302 if (g_cLogged++ < MAX_REL_LOG_ERRORS) 2277 2303 { 2278 LogRel(("LsiLogic#%d: %d/%d (Bus/Target) doesn't exist\n", p This->CTX_SUFF(pDevIns)->iInstance,2304 LogRel(("LsiLogic#%d: %d/%d (Bus/Target) doesn't exist\n", pDevIns->iInstance, 2279 2305 pGuestReq->SCSIIO.u8TargetID, pGuestReq->SCSIIO.u8Bus)); 2280 2306 /* Log the CDB too */ 2281 2307 LogRel(("LsiLogic#%d: Guest issued CDB {%#x", 2282 p This->CTX_SUFF(pDevIns)->iInstance, pGuestReq->SCSIIO.au8CDB[0]));2308 pDevIns->iInstance, pGuestReq->SCSIIO.au8CDB[0])); 2283 2309 for (unsigned i = 1; i < pGuestReq->SCSIIO.u8CDBLength; i++) 2284 2310 LogRel((", %#x", pGuestReq->SCSIIO.au8CDB[i])); … … 2301 2327 IOCReply.SCSIIOError.u32ResponseInfo = 0; 2302 2328 2303 lsilogicFinishAddressReply(p This, &IOCReply, false);2329 lsilogicFinishAddressReply(pDevIns, pThis, &IOCReply, false); 2304 2330 2305 2331 return rc; … … 2314 2340 { 2315 2341 PLSILOGICDEVICE pTgtDev = RT_FROM_MEMBER(pInterface, LSILOGICDEVICE, IMediaPort); 2316 PPDMDEVINS pDevIns = pTgtDev-> CTX_SUFF(pLsiLogic)->CTX_SUFF(pDevIns);2342 PPDMDEVINS pDevIns = pTgtDev->pDevIns; 2317 2343 2318 2344 AssertPtrReturn(ppcszController, VERR_INVALID_POINTER); … … 2337 2363 RT_NOREF1(hIoReq); 2338 2364 PLSILOGICDEVICE pTgtDev = RT_FROM_MEMBER(pInterface, LSILOGICDEVICE, IMediaExPort); 2339 PLSILOGICREQ pReq = (PLSILOGICREQ)pvIoReqAlloc; 2365 PPDMDEVINS pDevIns = pTgtDev->pDevIns; 2366 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 2367 PLSILOGICREQ pReq = (PLSILOGICREQ)pvIoReqAlloc; 2340 2368 2341 2369 size_t cbCopied = 0; 2342 if ( RT_UNLIKELY(pReq->fBIOS))2343 cbCopied = vboxscsiCopyToBuf(&pTgtDev->CTX_SUFF(pLsiLogic)->VBoxSCSI, pSgBuf, offDst, cbCopy);2370 if (!pReq->fBIOS) 2371 cbCopied = lsilogicR3CopySgBufToGuest(pDevIns, pReq, pSgBuf, offDst, cbCopy); 2344 2372 else 2345 cbCopied = lsilogicR3CopySgBufToGuest(pTgtDev->CTX_SUFF(pLsiLogic), pReq, pSgBuf, offDst, cbCopy);2373 cbCopied = vboxscsiCopyToBuf(&pThisCC->VBoxSCSI, pSgBuf, offDst, cbCopy); 2346 2374 return cbCopied == cbCopy ? VINF_SUCCESS : VERR_PDM_MEDIAEX_IOBUF_OVERFLOW; 2347 2375 } … … 2356 2384 RT_NOREF1(hIoReq); 2357 2385 PLSILOGICDEVICE pTgtDev = RT_FROM_MEMBER(pInterface, LSILOGICDEVICE, IMediaExPort); 2358 PLSILOGICREQ pReq = (PLSILOGICREQ)pvIoReqAlloc; 2386 PPDMDEVINS pDevIns = pTgtDev->pDevIns; 2387 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 2388 PLSILOGICREQ pReq = (PLSILOGICREQ)pvIoReqAlloc; 2359 2389 2360 2390 size_t cbCopied = 0; 2361 if ( RT_UNLIKELY(pReq->fBIOS))2362 cbCopied = vboxscsiCopyFromBuf(&pTgtDev->CTX_SUFF(pLsiLogic)->VBoxSCSI, pSgBuf, offSrc, cbCopy);2391 if (!pReq->fBIOS) 2392 cbCopied = lsilogicR3CopySgBufFromGuest(pDevIns, pReq, pSgBuf, offSrc, cbCopy); 2363 2393 else 2364 cbCopied = lsilogicR3CopySgBufFromGuest(pTgtDev->CTX_SUFF(pLsiLogic), pReq, pSgBuf, offSrc, cbCopy);2394 cbCopied = vboxscsiCopyFromBuf(&pThisCC->VBoxSCSI, pSgBuf, offSrc, cbCopy); 2365 2395 return cbCopied == cbCopy ? VINF_SUCCESS : VERR_PDM_MEDIAEX_IOBUF_UNDERRUN; 2366 2396 } … … 2374 2404 RT_NOREF(hIoReq); 2375 2405 PLSILOGICDEVICE pTgtDev = RT_FROM_MEMBER(pInterface, LSILOGICDEVICE, IMediaExPort); 2376 lsilogicR3ReqComplete(pTgtDev->CTX_SUFF(pLsiLogic), (PLSILOGICREQ)pvIoReqAlloc, rcReq); 2406 PPDMDEVINS pDevIns = pTgtDev->pDevIns; 2407 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 2408 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 2409 lsilogicR3ReqComplete(pDevIns, pThis, pThisCC, (PLSILOGICREQ)pvIoReqAlloc, rcReq); 2377 2410 return VINF_SUCCESS; 2378 2411 } … … 2392 2425 { 2393 2426 /* Make sure the request is not accounted for so the VM can suspend successfully. */ 2427 PPDMDEVINS pDevIns = pTgtDev->pDevIns; 2428 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 2394 2429 uint32_t cTasksActive = ASMAtomicDecU32(&pTgtDev->cOutstandingRequests); 2395 if (!cTasksActive && pT gtDev->CTX_SUFF(pLsiLogic)->fSignalIdle)2396 PDMDevHlpAsyncNotificationCompleted(p TgtDev->CTX_SUFF(pLsiLogic)->pDevInsR3);2430 if (!cTasksActive && pThis->fSignalIdle) 2431 PDMDevHlpAsyncNotificationCompleted(pDevIns); 2397 2432 break; 2398 2433 } … … 2412 2447 { 2413 2448 PLSILOGICDEVICE pTgtDev = RT_FROM_MEMBER(pInterface, LSILOGICDEVICE, IMediaExPort); 2414 PLSILOGICSCSI pThis = pTgtDev->CTX_SUFF(pLsiLogic); 2415 2416 if (pThis->pMediaNotify) 2417 { 2418 int rc = VMR3ReqCallNoWait(PDMDevHlpGetVM(pThis->CTX_SUFF(pDevIns)), VMCPUID_ANY, 2419 (PFNRT)pThis->pMediaNotify->pfnEjected, 2, 2420 pThis->pMediaNotify, pTgtDev->iLUN); 2449 PPDMDEVINS pDevIns = pTgtDev->pDevIns; 2450 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 2451 2452 if (pThisCC->pMediaNotify) 2453 { 2454 int rc = VMR3ReqCallNoWait(PDMDevHlpGetVM(pDevIns), VMCPUID_ANY, 2455 (PFNRT)pThisCC->pMediaNotify->pfnEjected, 2, 2456 pThisCC->pMediaNotify, pTgtDev->iLUN); 2421 2457 AssertRC(rc); 2422 2458 } … … 2430 2466 * @returns VINF_SUCCESS if successful 2431 2467 * VERR_NOT_FOUND if the requested page could be found. 2432 * @param pThis The LsiLogic controller instancedata.2468 * @param pThis Pointer to the shared LsiLogic device state. data. 2433 2469 * @param pPages The pages supported by the controller. 2434 2470 * @param u8PageNumber Number of the page to get. … … 2488 2524 * @returns VINF_SUCCESS if successful 2489 2525 * VERR_NOT_FOUND if the requested page could be found. 2490 * @param pThis The LsiLogic controller instancedata.2526 * @param pThis Pointer to the shared LsiLogic device state. data. 2491 2527 * @param pPages The pages supported by the controller. 2492 2528 * @param u8PageNumber Number of the page to get. … … 2551 2587 * @returns VINF_SUCCESS if successful 2552 2588 * VERR_NOT_FOUND if the requested page could be found. 2553 * @param pThis The LsiLogic controller instancedata.2589 * @param pThis Pointer to the shared LsiLogic device state. data. 2554 2590 * @param pPages The pages supported by the controller. 2555 2591 * @param u8PageNumber Number of the page to get. … … 2643 2679 * @returns VINF_SUCCESS if successful 2644 2680 * VERR_NOT_FOUND if the requested page could be found. 2645 * @param pThis The LsiLogic controller instancedata.2681 * @param pThis Pointer to the shared LsiLogic device state. data. 2646 2682 * @param pPages The pages supported by the controller. 2647 2683 * @param u8PageNumber Number of the page to get. … … 2691 2727 * @returns VINF_SUCCESS if successful 2692 2728 * VERR_NOT_FOUND if the requested page could be found. 2693 * @param pThis The LsiLogic controller instancedata.2729 * @param pThis Pointer to the shared LsiLogic device state. data. 2694 2730 * @param pPages The pages supported by the controller. 2695 2731 * @param u8Port The port to retrieve the page for. … … 2744 2780 * @returns VINF_SUCCESS if successful 2745 2781 * VERR_NOT_FOUND if the requested page could be found. 2746 * @param pThis The LsiLogic controller instancedata.2782 * @param pThis Pointer to the shared LsiLogic device state. data. 2747 2783 * @param pPages The pages supported by the controller. 2748 2784 * @param u8Bus The bus the device is on the page should be returned. … … 2799 2835 } 2800 2836 2801 static int lsilogicR3ConfigurationSASIOUnitPageGetFromNumber(PLSILOGICSCSI pThis, 2802 PMptConfigurationPagesSupported pPages, 2837 static int lsilogicR3ConfigurationSASIOUnitPageGetFromNumber(PMptConfigurationPagesSupported pPages, 2803 2838 uint8_t u8PageNumber, 2804 2839 PMptExtendedConfigurationPageHeader *ppPageHeader, 2805 2840 uint8_t **ppbPageData, size_t *pcbPage) 2806 2841 { 2807 RT_NOREF(pThis);2808 2842 int rc = VINF_SUCCESS; 2809 2843 … … 2837 2871 } 2838 2872 2839 static int lsilogicR3ConfigurationSASPHYPageGetFromNumber(PLSILOGICSCSI pThis, 2840 PMptConfigurationPagesSupported pPages, 2873 static int lsilogicR3ConfigurationSASPHYPageGetFromNumber(PMptConfigurationPagesSupported pPages, 2841 2874 uint8_t u8PageNumber, 2842 2875 MptConfigurationPageAddress PageAddress, … … 2844 2877 uint8_t **ppbPageData, size_t *pcbPage) 2845 2878 { 2846 RT_NOREF(pThis);2847 2879 int rc = VINF_SUCCESS; 2848 2880 uint8_t uAddressForm = MPT_CONFIGURATION_PAGE_ADDRESS_GET_SAS_FORM(PageAddress); … … 2901 2933 } 2902 2934 2903 static int lsilogicR3ConfigurationSASDevicePageGetFromNumber(PLSILOGICSCSI pThis, 2904 PMptConfigurationPagesSupported pPages, 2935 static int lsilogicR3ConfigurationSASDevicePageGetFromNumber(PMptConfigurationPagesSupported pPages, 2905 2936 uint8_t u8PageNumber, 2906 2937 MptConfigurationPageAddress PageAddress, … … 2908 2939 uint8_t **ppbPageData, size_t *pcbPage) 2909 2940 { 2910 RT_NOREF(pThis);2911 2941 int rc = VINF_SUCCESS; 2912 2942 uint8_t uAddressForm = MPT_CONFIGURATION_PAGE_ADDRESS_GET_SAS_FORM(PageAddress); … … 2997 3027 * @returns VINF_SUCCESS if successful 2998 3028 * VERR_NOT_FOUND if the requested page could be found. 2999 * @param pThis Pointer to theLsiLogic device state.3029 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 3000 3030 * @param pConfigurationReq The configuration request. 3001 3031 * @param ppPageHeader Where to return the pointer to the page header on success. … … 3003 3033 * @param pcbPage Where to store the size of the page in bytes. 3004 3034 */ 3005 static int lsilogicR3ConfigurationPageGetExtended(PLSILOGICSCSI pThis, PMptConfigurationRequest pConfigurationReq,3035 static int lsilogicR3ConfigurationPageGetExtended(PLSILOGICSCSICC pThisCC, PMptConfigurationRequest pConfigurationReq, 3006 3036 PMptExtendedConfigurationPageHeader *ppPageHeader, 3007 3037 uint8_t **ppbPageData, size_t *pcbPage) … … 3017 3047 case MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_SASIOUNIT: 3018 3048 { 3019 rc = lsilogicR3ConfigurationSASIOUnitPageGetFromNumber(pThis, 3020 pThis->pConfigurationPages, 3021 pConfigurationReq->u8PageNumber, 3022 ppPageHeader, ppbPageData, pcbPage); 3049 rc = lsilogicR3ConfigurationSASIOUnitPageGetFromNumber(pThisCC->pConfigurationPages, 3050 pConfigurationReq->u8PageNumber, 3051 ppPageHeader, ppbPageData, pcbPage); 3023 3052 break; 3024 3053 } 3025 3054 case MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_SASPHYS: 3026 3055 { 3027 rc = lsilogicR3ConfigurationSASPHYPageGetFromNumber(pThis, 3028 pThis->pConfigurationPages, 3029 pConfigurationReq->u8PageNumber, 3030 pConfigurationReq->PageAddress, 3031 ppPageHeader, ppbPageData, pcbPage); 3056 rc = lsilogicR3ConfigurationSASPHYPageGetFromNumber(pThisCC->pConfigurationPages, 3057 pConfigurationReq->u8PageNumber, 3058 pConfigurationReq->PageAddress, 3059 ppPageHeader, ppbPageData, pcbPage); 3032 3060 break; 3033 3061 } 3034 3062 case MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_SASDEVICE: 3035 3063 { 3036 rc = lsilogicR3ConfigurationSASDevicePageGetFromNumber(pThis, 3037 pThis->pConfigurationPages, 3038 pConfigurationReq->u8PageNumber, 3039 pConfigurationReq->PageAddress, 3040 ppPageHeader, ppbPageData, pcbPage); 3064 rc = lsilogicR3ConfigurationSASDevicePageGetFromNumber(pThisCC->pConfigurationPages, 3065 pConfigurationReq->u8PageNumber, 3066 pConfigurationReq->PageAddress, 3067 ppPageHeader, ppbPageData, pcbPage); 3041 3068 break; 3042 3069 } … … 3054 3081 * 3055 3082 * @returns VBox status code. 3056 * @param pThis Pointer to the LsiLogic device state. 3083 * @param pDevIns The device instance. 3084 * @param pThis Pointer to the shared LsiLogic device state. 3085 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 3057 3086 * @param pConfigurationReq Pointer to the request structure. 3058 3087 * @param pReply Pointer to the reply message frame 3059 3088 */ 3060 static int lsilogicR3ProcessConfigurationRequest(P LSILOGICSCSI pThis, PMptConfigurationRequest pConfigurationReq,3061 PMptConfigurationRe ply pReply)3089 static int lsilogicR3ProcessConfigurationRequest(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC, 3090 PMptConfigurationRequest pConfigurationReq, PMptConfigurationReply pReply) 3062 3091 { 3063 3092 int rc = VINF_SUCCESS; … … 3093 3122 /* Get the page data. */ 3094 3123 rc = lsilogicR3ConfigurationIOUnitPageGetFromNumber(pThis, 3095 pThis->pConfigurationPages, 3124 pThisCC->pConfigurationPages, 3125 pConfigurationReq->u8PageNumber, 3126 &pPageHeader, &pbPageData, &cbPage); 3127 break; 3128 } 3129 case MPT_CONFIGURATION_PAGE_TYPE_IOC: 3130 { 3131 /* Get the page data. */ 3132 rc = lsilogicR3ConfigurationIOCPageGetFromNumber(pThis, 3133 pThisCC->pConfigurationPages, 3134 pConfigurationReq->u8PageNumber, 3135 &pPageHeader, &pbPageData, &cbPage); 3136 break; 3137 } 3138 case MPT_CONFIGURATION_PAGE_TYPE_MANUFACTURING: 3139 { 3140 /* Get the page data. */ 3141 rc = lsilogicR3ConfigurationManufacturingPageGetFromNumber(pThis, 3142 pThisCC->pConfigurationPages, 3143 pConfigurationReq->u8PageNumber, 3144 &pPageHeader, &pbPageData, &cbPage); 3145 break; 3146 } 3147 case MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_PORT: 3148 { 3149 /* Get the page data. */ 3150 rc = lsilogicR3ConfigurationSCSISPIPortPageGetFromNumber(pThis, 3151 pThisCC->pConfigurationPages, 3152 pConfigurationReq->PageAddress.MPIPortNumber.u8PortNumber, 3153 pConfigurationReq->u8PageNumber, 3154 &pPageHeader, &pbPageData, &cbPage); 3155 break; 3156 } 3157 case MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_DEVICE: 3158 { 3159 /* Get the page data. */ 3160 rc = lsilogicR3ConfigurationSCSISPIDevicePageGetFromNumber(pThis, 3161 pThisCC->pConfigurationPages, 3162 pConfigurationReq->PageAddress.BusAndTargetId.u8Bus, 3163 pConfigurationReq->PageAddress.BusAndTargetId.u8TargetID, 3164 pConfigurationReq->u8PageNumber, 3165 &pPageHeader, &pbPageData, &cbPage); 3166 break; 3167 } 3168 case MPT_CONFIGURATION_PAGE_TYPE_BIOS: 3169 { 3170 rc = lsilogicR3ConfigurationBiosPageGetFromNumber(pThis, 3171 pThisCC->pConfigurationPages, 3096 3172 pConfigurationReq->u8PageNumber, 3097 3173 &pPageHeader, &pbPageData, &cbPage); 3098 3174 break; 3099 3175 } 3100 case MPT_CONFIGURATION_PAGE_TYPE_IOC:3101 {3102 /* Get the page data. */3103 rc = lsilogicR3ConfigurationIOCPageGetFromNumber(pThis,3104 pThis->pConfigurationPages,3105 pConfigurationReq->u8PageNumber,3106 &pPageHeader, &pbPageData, &cbPage);3107 break;3108 }3109 case MPT_CONFIGURATION_PAGE_TYPE_MANUFACTURING:3110 {3111 /* Get the page data. */3112 rc = lsilogicR3ConfigurationManufacturingPageGetFromNumber(pThis,3113 pThis->pConfigurationPages,3114 pConfigurationReq->u8PageNumber,3115 &pPageHeader, &pbPageData, &cbPage);3116 break;3117 }3118 case MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_PORT:3119 {3120 /* Get the page data. */3121 rc = lsilogicR3ConfigurationSCSISPIPortPageGetFromNumber(pThis,3122 pThis->pConfigurationPages,3123 pConfigurationReq->PageAddress.MPIPortNumber.u8PortNumber,3124 pConfigurationReq->u8PageNumber,3125 &pPageHeader, &pbPageData, &cbPage);3126 break;3127 }3128 case MPT_CONFIGURATION_PAGE_TYPE_SCSI_SPI_DEVICE:3129 {3130 /* Get the page data. */3131 rc = lsilogicR3ConfigurationSCSISPIDevicePageGetFromNumber(pThis,3132 pThis->pConfigurationPages,3133 pConfigurationReq->PageAddress.BusAndTargetId.u8Bus,3134 pConfigurationReq->PageAddress.BusAndTargetId.u8TargetID,3135 pConfigurationReq->u8PageNumber,3136 &pPageHeader, &pbPageData, &cbPage);3137 break;3138 }3139 case MPT_CONFIGURATION_PAGE_TYPE_BIOS:3140 {3141 rc = lsilogicR3ConfigurationBiosPageGetFromNumber(pThis,3142 pThis->pConfigurationPages,3143 pConfigurationReq->u8PageNumber,3144 &pPageHeader, &pbPageData, &cbPage);3145 break;3146 }3147 3176 case MPT_CONFIGURATION_PAGE_TYPE_EXTENDED: 3148 3177 { 3149 rc = lsilogicR3ConfigurationPageGetExtended(pThis ,3150 pConfigurationReq,3151 &pExtPageHeader, &pbPageData, &cbPage);3178 rc = lsilogicR3ConfigurationPageGetExtended(pThisCC, 3179 pConfigurationReq, 3180 &pExtPageHeader, &pbPageData, &cbPage); 3152 3181 break; 3153 3182 } … … 3212 3241 GCPhysAddrPageBuffer |= (uint64_t)pConfigurationReq->SimpleSGElement.u32DataBufferAddressHigh << 32; 3213 3242 3214 PDMDevHlpPCIPhysWrite(p This->CTX_SUFF(pDevIns), GCPhysAddrPageBuffer, pbPageData, RT_MIN(cbBuffer, cbPage));3243 PDMDevHlpPCIPhysWrite(pDevIns, GCPhysAddrPageBuffer, pbPageData, RT_MIN(cbBuffer, cbPage)); 3215 3244 } 3216 3245 break; … … 3228 3257 LogFlow(("cbBuffer=%u cbPage=%u\n", cbBuffer, cbPage)); 3229 3258 3230 PDMDevHlpPhysRead(p This->CTX_SUFF(pDevIns), GCPhysAddrPageBuffer, pbPageData,3259 PDMDevHlpPhysRead(pDevIns, GCPhysAddrPageBuffer, pbPageData, 3231 3260 RT_MIN(cbBuffer, cbPage)); 3232 3261 } … … 3244 3273 * 3245 3274 * @returns nothing 3246 * @param pThis Pointer to the LsiLogic device state. 3247 */ 3248 static void lsilogicR3InitializeConfigurationPagesSpi(PLSILOGICSCSI pThis) 3249 { 3250 PMptConfigurationPagesSpi pPages = &pThis->pConfigurationPages->u.SpiPages; 3275 * @param pThis Pointer to the shared LsiLogic device state. 3276 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 3277 */ 3278 static void lsilogicR3InitializeConfigurationPagesSpi(PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC) 3279 { 3280 PMptConfigurationPagesSpi pPages = &pThisCC->pConfigurationPages->u.SpiPages; 3251 3281 3252 3282 AssertMsg(pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI, ("Controller is not the SPI SCSI one\n")); … … 3335 3365 * 3336 3366 * @returns the handle. 3337 * @param pThis Pointer to the LsiLogic device state.3367 * @param pThis Pointer to the shared LsiLogic device state. 3338 3368 */ 3339 3369 DECLINLINE(uint16_t) lsilogicGetHandle(PLSILOGICSCSI pThis) … … 3368 3398 * 3369 3399 * @returns nothing 3370 * @param pThis Pointer to the LsiLogic device state. 3371 */ 3372 static void lsilogicR3InitializeConfigurationPagesSas(PLSILOGICSCSI pThis) 3373 { 3374 PMptConfigurationPagesSas pPages = &pThis->pConfigurationPages->u.SasPages; 3400 * @param pThis Pointer to the shared LsiLogic device state. 3401 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 3402 */ 3403 static void lsilogicR3InitializeConfigurationPagesSas(PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC) 3404 { 3405 PMptConfigurationPagesSas pPages = &pThisCC->pConfigurationPages->u.SasPages; 3375 3406 3376 3407 AssertMsg(pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS, ("Controller is not the SAS SCSI one\n")); … … 3480 3511 3481 3512 /* Settings for present devices. */ 3482 if (pThis ->paDeviceStates[i].pDrvBase)3513 if (pThisCC->paDeviceStates[i].pDrvBase) 3483 3514 { 3484 3515 uint16_t u16DeviceHandle = lsilogicGetHandle(pThis); … … 3564 3595 * 3565 3596 * @returns nothing 3566 * @param pThis Pointer to the LsiLogic device state. 3567 */ 3568 static void lsilogicR3InitializeConfigurationPages(PLSILOGICSCSI pThis) 3597 * @param pDevIns The device instance. 3598 * @param pThis Pointer to the shared LsiLogic device state. 3599 * @param pThisCC Pointer to the ring-3 LsiLogic device state. 3600 */ 3601 static void lsilogicR3InitializeConfigurationPages(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC) 3569 3602 { 3570 3603 /* Initialize the common pages. */ 3571 3604 PMptConfigurationPagesSupported pPages = (PMptConfigurationPagesSupported)RTMemAllocZ(sizeof(MptConfigurationPagesSupported)); 3572 3573 pThis->pConfigurationPages = pPages; 3605 /** @todo r=bird: Missing alloc failure check. Why do we allocate this 3606 * structure? It's fixed size... */ 3607 3608 pThisCC->pConfigurationPages = pPages; 3574 3609 3575 3610 LogFlowFunc(("pThis=%#p\n", pThis)); … … 3682 3717 pPages->IOUnitPage2.u.fields.aAdapterOrder[0].fAdapterEmbedded = true; 3683 3718 pPages->IOUnitPage2.u.fields.aAdapterOrder[0].u8PCIBusNumber = 0; 3684 pPages->IOUnitPage2.u.fields.aAdapterOrder[0].u8PCIDevFn = p This->CTX_SUFF(pDevIns)->apPciDevs[0]->uDevFn;3719 pPages->IOUnitPage2.u.fields.aAdapterOrder[0].u8PCIDevFn = pDevIns->apPciDevs[0]->uDevFn; 3685 3720 3686 3721 /* I/O Unit page 3. */ … … 3769 3804 3770 3805 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI) 3771 lsilogicR3InitializeConfigurationPagesSpi(pThis );3806 lsilogicR3InitializeConfigurationPagesSpi(pThis, pThisCC); 3772 3807 else if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 3773 lsilogicR3InitializeConfigurationPagesSas(pThis );3808 lsilogicR3InitializeConfigurationPagesSas(pThis, pThisCC); 3774 3809 else 3775 3810 AssertMsgFailed(("Invalid controller type %d\n", pThis->enmCtrlType)); … … 3781 3816 * @returns VBox status code. 3782 3817 * 3783 * @param pThis Pointer to the LsiLogic device state.3818 * @param pThis Pointer to the shared LsiLogic device state. 3784 3819 * @param pcszCtrlType The string to use. 3785 3820 */ … … 3809 3844 { 3810 3845 RT_NOREF(pvUser, cb); 3811 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI);3846 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 3812 3847 3813 3848 ASSERT_GUEST(cb == 1); 3814 3849 3815 int rc = vboxscsiReadRegister(&pThis ->VBoxSCSI, offPort, pu32);3850 int rc = vboxscsiReadRegister(&pThisCC->VBoxSCSI, offPort, pu32); 3816 3851 AssertMsg(rc == VINF_SUCCESS, ("Unexpected BIOS register read status: %Rrc\n", rc)); 3817 3852 … … 3825 3860 * 3826 3861 * @returns VBox status code. 3827 * @param pThis Pointer to the LsiLogic device state.3828 */ 3829 static int lsilogicR3PrepareBiosScsiRequest(PLSILOGICSCSI pThis )3862 * @param pThis Pointer to the shared LsiLogic device state. 3863 */ 3864 static int lsilogicR3PrepareBiosScsiRequest(PLSILOGICSCSI pThis, PLSILOGICSCSICC pThisCC) 3830 3865 { 3831 3866 int rc; … … 3836 3871 size_t cbBuf; 3837 3872 3838 rc = vboxscsiSetupRequest(&pThis ->VBoxSCSI, &uLun, &pbCdb, &cbCdb, &cbBuf, &uTargetDevice);3873 rc = vboxscsiSetupRequest(&pThisCC->VBoxSCSI, &uLun, &pbCdb, &cbCdb, &cbBuf, &uTargetDevice); 3839 3874 AssertMsgRCReturn(rc, ("Setting up SCSI request failed rc=%Rrc\n", rc), rc); 3840 3875 3841 3876 if ( uTargetDevice < pThis->cDeviceStates 3842 && pThis ->paDeviceStates[uTargetDevice].pDrvBase)3843 { 3844 PLSILOGICDEVICE pTgtDev = &pThis ->paDeviceStates[uTargetDevice];3877 && pThisCC->paDeviceStates[uTargetDevice].pDrvBase) 3878 { 3879 PLSILOGICDEVICE pTgtDev = &pThisCC->paDeviceStates[uTargetDevice]; 3845 3880 PDMMEDIAEXIOREQ hIoReq; 3846 3881 PLSILOGICREQ pReq; … … 3863 3898 uint8_t u8ScsiSts = pReq->u8ScsiSts; 3864 3899 pTgtDev->pDrvMediaEx->pfnIoReqFree(pTgtDev->pDrvMediaEx, pReq->hIoReq); 3865 rc = vboxscsiRequestFinished(&pThis ->VBoxSCSI, u8ScsiSts);3900 rc = vboxscsiRequestFinished(&pThisCC->VBoxSCSI, u8ScsiSts); 3866 3901 } 3867 3902 else if (rc == VINF_PDM_MEDIAEX_IOREQ_IN_PROGRESS) … … 3881 3916 ScsiInquiryData.u3PeripheralQualifier = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_NOT_CONNECTED_NOT_SUPPORTED; 3882 3917 3883 memcpy(pThis ->VBoxSCSI.pbBuf, &ScsiInquiryData, 5);3884 3885 rc = vboxscsiRequestFinished(&pThis ->VBoxSCSI, SCSI_STATUS_OK);3918 memcpy(pThisCC->VBoxSCSI.pbBuf, &ScsiInquiryData, 5); 3919 3920 rc = vboxscsiRequestFinished(&pThisCC->VBoxSCSI, SCSI_STATUS_OK); 3886 3921 AssertMsgRCReturn(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc), rc); 3887 3922 … … 3895 3930 lsilogicR3IsaIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT offPort, uint32_t u32, unsigned cb) 3896 3931 { 3932 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 3933 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 3934 Log2(("#%d %s: pvUser=%#p cb=%d u32=%#x offPort=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, u32, offPort)); 3897 3935 RT_NOREF(pvUser, cb); 3898 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI);3899 Log2(("#%d %s: pvUser=%#p cb=%d u32=%#x offPort=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, u32, offPort));3900 3936 3901 3937 ASSERT_GUEST(cb == 1); … … 3908 3944 return VINF_SUCCESS; 3909 3945 3910 int rc = vboxscsiWriteRegister(&pThis ->VBoxSCSI, offPort, (uint8_t)u32);3946 int rc = vboxscsiWriteRegister(&pThisCC->VBoxSCSI, offPort, (uint8_t)u32); 3911 3947 if (rc == VERR_MORE_DATA) 3912 3948 { … … 3930 3966 uint8_t const *pbSrc, uint32_t *pcTransfers, unsigned cb) 3931 3967 { 3968 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 3969 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 3970 Log2(("#%d %s: pvUser=%#p cb=%d offPort=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, offPort)); 3932 3971 RT_NOREF(pvUser); 3933 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 3934 Log2(("#%d %s: pvUser=%#p cb=%d offPort=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, offPort)); 3935 3936 int rc = vboxscsiWriteString(pDevIns, &pThis->VBoxSCSI, offPort, pbSrc, pcTransfers, cb); 3972 3973 int rc = vboxscsiWriteString(pDevIns, &pThisCC->VBoxSCSI, offPort, pbSrc, pcTransfers, cb); 3937 3974 if (rc == VERR_MORE_DATA) 3938 3975 { … … 3940 3977 /* Notify the worker thread that there are pending requests. */ 3941 3978 LogFlowFunc(("Signal event semaphore\n")); 3942 rc = PDMDevHlpSUPSemEventSignal(p This->CTX_SUFF(pDevIns), pThis->hEvtProcess);3979 rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEvtProcess); 3943 3980 AssertRC(rc); 3944 3981 } … … 3956 3993 uint8_t *pbDst, uint32_t *pcTransfers, unsigned cb) 3957 3994 { 3995 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 3996 LogFlowFunc(("#%d %s: pvUser=%#p cb=%d offPort=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, offPort)); 3958 3997 RT_NOREF(pvUser); 3959 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 3960 LogFlowFunc(("#%d %s: pvUser=%#p cb=%d offPort=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, offPort)); 3961 3962 int rc = vboxscsiReadString(pDevIns, &pThis->VBoxSCSI, offPort, pbDst, pcTransfers, cb); 3998 3999 int rc = vboxscsiReadString(pDevIns, &pThisCC->VBoxSCSI, offPort, pbDst, pcTransfers, cb); 3963 4000 AssertMsg(rc == VINF_SUCCESS, ("Unexpected BIOS register read status: %Rrc\n", rc)); 3964 4001 return rc; … … 3970 4007 static DECLCALLBACK(void) lsilogicR3Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 3971 4008 { 3972 PLSILOGICSCSI pThis= PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI);3973 bool fVerbose = false;4009 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4010 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 3974 4011 3975 4012 /* 3976 4013 * Parse args. 3977 4014 */ 3978 if (pszArgs) 3979 fVerbose = strstr(pszArgs, "verbose") != NULL; 4015 bool const fVerbose = pszArgs && strstr(pszArgs, "verbose") != NULL; 3980 4016 3981 4017 /* … … 3984 4020 pHlp->pfnPrintf(pHlp, 3985 4021 "%s#%d: port=%04x mmio=%RGp max-devices=%u GC=%RTbool R0=%RTbool\n", 3986 pDevIns->pReg->szName, 3987 pDevIns->iInstance, 4022 pDevIns->pReg->szName, pDevIns->iInstance, 3988 4023 PDMDevHlpIoPortGetMappingAddress(pDevIns, pThis->hIoPortsReg), 3989 4024 PDMDevHlpMmioGetMappingAddress(pDevIns, pThis->hMmioReg), 3990 pThis->cDeviceStates, 3991 pThis->fGCEnabled ? true : false, 3992 pThis->fR0Enabled ? true : false); 4025 pThis->cDeviceStates, pDevIns->fRCEnabled, pDevIns->fR0Enabled); 3993 4026 3994 4027 /* … … 4047 4080 for (unsigned i = 0; i < pThis->cDeviceStates; i++) 4048 4081 { 4049 PLSILOGICDEVICE pDevice = &pThis ->paDeviceStates[i];4082 PLSILOGICDEVICE pDevice = &pThisCC->paDeviceStates[i]; 4050 4083 4051 4084 pHlp->pfnPrintf(pHlp, "\n"); … … 4057 4090 4058 4091 4059 /* The worker thread. */ 4092 /** 4093 * @callback_method_impl{FNPDMTHREADDEV} 4094 */ 4060 4095 static DECLCALLBACK(int) lsilogicR3Worker(PPDMDEVINS pDevIns, PPDMTHREAD pThread) 4061 4096 { 4062 PLSILOGICSCSI pThis = (PLSILOGICSCSI)pThread->pvUser; 4063 int rc = VINF_SUCCESS; 4097 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4098 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 4099 int rc = VINF_SUCCESS; 4064 4100 4065 4101 if (pThread->enmState == PDMTHREADSTATE_INITIALIZING) … … 4073 4109 { 4074 4110 Assert(ASMAtomicReadBool(&pThis->fWrkThreadSleeping)); 4075 rc = PDMDevHlpSUPSemEventWaitNoResume(p This->CTX_SUFF(pDevIns), pThis->hEvtProcess, RT_INDEFINITE_WAIT);4111 rc = PDMDevHlpSUPSemEventWaitNoResume(pDevIns, pThis->hEvtProcess, RT_INDEFINITE_WAIT); 4076 4112 AssertLogRelMsgReturn(RT_SUCCESS(rc) || rc == VERR_INTERRUPTED, ("%Rrc\n", rc), rc); 4077 4113 if (RT_UNLIKELY(pThread->enmState != PDMTHREADSTATE_RUNNING)) … … 4086 4122 if (ASMAtomicReadBool(&pThis->fBiosReqPending)) 4087 4123 { 4088 rc = lsilogicR3PrepareBiosScsiRequest(pThis );4124 rc = lsilogicR3PrepareBiosScsiRequest(pThis, pThisCC); 4089 4125 AssertRC(rc); 4090 4126 ASMAtomicXchgBool(&pThis->fBiosReqPending, false); … … 4157 4193 if (GuestRequest.Header.u8Function == MPT_MESSAGE_HDR_FUNCTION_SCSI_IO_REQUEST) 4158 4194 { 4159 rc = lsilogicR3ProcessSCSIIORequest(p This, GCPhysMessageFrameAddr, &GuestRequest);4195 rc = lsilogicR3ProcessSCSIIORequest(pDevIns, pThis, pThisCC, GCPhysMessageFrameAddr, &GuestRequest); 4160 4196 AssertRC(rc); 4161 4197 } … … 4163 4199 { 4164 4200 MptReplyUnion Reply; 4165 rc = lsilogicR3ProcessMessageRequest(p This, &GuestRequest.Header, &Reply);4201 rc = lsilogicR3ProcessMessageRequest(pDevIns, pThis, pThisCC, &GuestRequest.Header, &Reply); 4166 4202 AssertRC(rc); 4167 4203 } … … 4178 4214 4179 4215 /** 4180 * Unblock the worker thread so it can respond to a state change. 4181 * 4182 * @returns VBox status code. 4183 * @param pDevIns The pcnet device instance. 4184 * @param pThread The send thread. 4216 * @callback_method_impl{FNPDMTHREADWAKEUPDEV} 4185 4217 */ 4186 4218 static DECLCALLBACK(int) lsilogicR3WorkerWakeUp(PPDMDEVINS pDevIns, PPDMTHREAD pThread) … … 4188 4220 RT_NOREF(pThread); 4189 4221 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4190 return PDMDevHlpSUPSemEventSignal(p This->CTX_SUFF(pDevIns), pThis->hEvtProcess);4222 return PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEvtProcess); 4191 4223 } 4192 4224 … … 4197 4229 * 4198 4230 * @returns nothing. 4199 * @param pThis Pointer to the LsiLogic device state. 4200 */ 4201 static void lsilogicR3Kick(PLSILOGICSCSI pThis) 4231 * @param pDevIns The device instance. 4232 * @param pThis Pointer to the shared LsiLogic device state. 4233 */ 4234 static void lsilogicR3Kick(PPDMDEVINS pDevIns, PLSILOGICSCSI pThis) 4202 4235 { 4203 4236 if (pThis->fNotificationSent) … … 4205 4238 /* Notify the worker thread that there are pending requests. */ 4206 4239 LogFlowFunc(("Signal event semaphore\n")); 4207 int rc = PDMDevHlpSUPSemEventSignal(p This->CTX_SUFF(pDevIns), pThis->hEvtProcess);4240 int rc = PDMDevHlpSUPSemEventSignal(pDevIns, pThis->hEvtProcess); 4208 4241 AssertRC(rc); 4209 4242 } … … 4221 4254 { 4222 4255 RT_NOREF(uPass); 4223 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4224 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 4256 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4257 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 4258 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 4225 4259 4226 4260 pHlp->pfnSSMPutU32(pSSM, pThis->enmCtrlType); … … 4230 4264 /* Save the device config. */ 4231 4265 for (unsigned i = 0; i < pThis->cDeviceStates; i++) 4232 pHlp->pfnSSMPutBool(pSSM, pThis ->paDeviceStates[i].pDrvBase != NULL);4266 pHlp->pfnSSMPutBool(pSSM, pThisCC->paDeviceStates[i].pDrvBase != NULL); 4233 4267 4234 4268 return VINF_SSM_DONT_CALL_AGAIN; … … 4240 4274 static DECLCALLBACK(int) lsilogicR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 4241 4275 { 4242 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4243 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 4276 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4277 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 4278 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 4244 4279 4245 4280 /* Every device first. */ … … 4247 4282 for (unsigned i = 0; i < pThis->cDeviceStates; i++) 4248 4283 { 4249 PLSILOGICDEVICE pDevice = &pThis ->paDeviceStates[i];4284 PLSILOGICDEVICE pDevice = &pThisCC->paDeviceStates[i]; 4250 4285 4251 4286 AssertMsg(!pDevice->cOutstandingRequests, … … 4279 4314 { 4280 4315 AssertMsg(!pReq->pRedoNext, ("Only one BIOS task can be active!\n")); 4281 vboxscsiSetRequestRedo(&pThis ->VBoxSCSI);4316 vboxscsiSetRequestRedo(&pThisCC->VBoxSCSI); 4282 4317 } 4283 4318 … … 4337 4372 /* Save diagnostic memory register and data regions. */ 4338 4373 pHlp->pfnSSMPutU32(pSSM, pThis->u32DiagMemAddr); 4339 pHlp->pfnSSMPutU32(pSSM, lsilogicR3MemRegionsCount(pThis ));4374 pHlp->pfnSSMPutU32(pSSM, lsilogicR3MemRegionsCount(pThisCC)); 4340 4375 4341 4376 PLSILOGICMEMREGN pIt; 4342 RTListForEach(&pThis ->ListMemRegns, pIt, LSILOGICMEMREGN, NodeList)4377 RTListForEach(&pThisCC->ListMemRegns, pIt, LSILOGICMEMREGN, NodeList) 4343 4378 { 4344 4379 pHlp->pfnSSMPutU32(pSSM, pIt->u32AddrStart); … … 4347 4382 } 4348 4383 4349 PMptConfigurationPagesSupported pPages = pThis ->pConfigurationPages;4384 PMptConfigurationPagesSupported pPages = pThisCC->pConfigurationPages; 4350 4385 4351 4386 pHlp->pfnSSMPutMem(pSSM, &pPages->ManufacturingPage0, sizeof(MptConfigurationPageManufacturing0)); … … 4426 4461 AssertMsgFailed(("Invalid controller type %d\n", pThis->enmCtrlType)); 4427 4462 4428 vboxscsiR3SaveExec(pHlp, &pThis ->VBoxSCSI, pSSM);4463 vboxscsiR3SaveExec(pHlp, &pThisCC->VBoxSCSI, pSSM); 4429 4464 return pHlp->pfnSSMPutU32(pSSM, UINT32_MAX); 4430 4465 } … … 4438 4473 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4439 4474 4440 lsilogicR3Kick(p This);4475 lsilogicR3Kick(pDevIns, pThis); 4441 4476 return VINF_SUCCESS; 4442 4477 } … … 4447 4482 static DECLCALLBACK(int) lsilogicR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 4448 4483 { 4449 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4450 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 4484 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4485 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 4486 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 4451 4487 int rc; 4452 4488 … … 4486 4522 rc = pHlp->pfnSSMGetBool(pSSM, &fPresent); 4487 4523 AssertRCReturn(rc, rc); 4488 if (fPresent != (pThis ->paDeviceStates[i].pDrvBase != NULL))4524 if (fPresent != (pThisCC->paDeviceStates[i].pDrvBase != NULL)) 4489 4525 return pHlp->pfnSSMSetCfgError(pSSM, RT_SRC_POS, N_("Target %u config mismatch: config=%RTbool state=%RTbool"), 4490 i, pThis ->paDeviceStates[i].pDrvBase != NULL, fPresent);4526 i, pThisCC->paDeviceStates[i].pDrvBase != NULL, fPresent); 4491 4527 } 4492 4528 } … … 4497 4533 for (unsigned i = 0; i < pThis->cDeviceStates; i++) 4498 4534 { 4499 PLSILOGICDEVICE pDevice = &pThis ->paDeviceStates[i];4535 PLSILOGICDEVICE pDevice = &pThisCC->paDeviceStates[i]; 4500 4536 4501 4537 AssertMsg(!pDevice->cOutstandingRequests, … … 4568 4604 pHlp->pfnSSMGetU32V(pSSM, &pThis->uRequestQueueNextAddressRead); 4569 4605 4570 PMptConfigurationPagesSupported pPages = pThis ->pConfigurationPages;4606 PMptConfigurationPagesSupported pPages = pThisCC->pConfigurationPages; 4571 4607 4572 4608 if (uVersion <= LSILOGIC_SAVED_STATE_VERSION_PRE_SAS) … … 4644 4680 pRegion->u32AddrEnd = u32AddrEnd; 4645 4681 pHlp->pfnSSMGetMem(pSSM, &pRegion->au32Data[0], cRegion * sizeof(uint32_t)); 4646 lsilogicR3MemRegionInsert(pThis , pRegion);4647 pThis ->cbMemRegns += cRegion * sizeof(uint32_t);4682 lsilogicR3MemRegionInsert(pThisCC, pRegion); 4683 pThisCC->cbMemRegns += cRegion * sizeof(uint32_t); 4648 4684 } 4649 4685 else … … 4762 4798 } 4763 4799 4764 rc = vboxscsiR3LoadExec(pHlp, &pThis ->VBoxSCSI, pSSM);4800 rc = vboxscsiR3LoadExec(pHlp, &pThisCC->VBoxSCSI, pSSM); 4765 4801 if (RT_FAILURE(rc)) 4766 4802 { … … 4830 4866 static DECLCALLBACK(int) lsilogicR3StatusQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) 4831 4867 { 4832 PLSILOGICSCSI pThis = RT_FROM_MEMBER(pInterface, LSILOGICSCSI, ILeds); 4868 PLSILOGICSCSICC pThisCC = RT_FROM_MEMBER(pInterface, LSILOGICSCSICC, ILeds); 4869 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pThisCC->pDevIns, PLSILOGICSCSI); 4833 4870 if (iLUN < pThis->cDeviceStates) 4834 4871 { 4835 *ppLed = &pThis ->paDeviceStates[iLUN].Led;4872 *ppLed = &pThisCC->paDeviceStates[iLUN].Led; 4836 4873 Assert((*ppLed)->u32Magic == PDMLED_MAGIC); 4837 4874 return VINF_SUCCESS; … … 4845 4882 static DECLCALLBACK(void *) lsilogicR3StatusQueryInterface(PPDMIBASE pInterface, const char *pszIID) 4846 4883 { 4847 PLSILOGICSCSI pThis = RT_FROM_MEMBER(pInterface, LSILOGICSCSI, IBase);4848 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis ->IBase);4849 PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis ->ILeds);4884 PLSILOGICSCSICC pThisCC = RT_FROM_MEMBER(pInterface, LSILOGICSCSICC, IBase); 4885 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThisCC->IBase); 4886 PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThisCC->ILeds); 4850 4887 return NULL; 4851 4888 } … … 4866 4903 static bool lsilogicR3AllAsyncIOIsFinished(PPDMDEVINS pDevIns) 4867 4904 { 4868 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4905 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4906 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 4869 4907 4870 4908 for (uint32_t i = 0; i < pThis->cDeviceStates; i++) 4871 4909 { 4872 PLSILOGICDEVICE pThisDevice = &pThis ->paDeviceStates[i];4910 PLSILOGICDEVICE pThisDevice = &pThisCC->paDeviceStates[i]; 4873 4911 if (pThisDevice->pDrvBase) 4874 4912 { … … 4900 4938 static void lsilogicR3SuspendOrPowerOff(PPDMDEVINS pDevIns) 4901 4939 { 4902 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4940 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4941 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 4903 4942 4904 4943 ASMAtomicWriteBool(&pThis->fSignalIdle, true); … … 4914 4953 for (uint32_t i = 0; i < pThis->cDeviceStates; i++) 4915 4954 { 4916 PLSILOGICDEVICE pThisDevice = &pThis ->paDeviceStates[i];4955 PLSILOGICDEVICE pThisDevice = &pThisCC->paDeviceStates[i]; 4917 4956 if (pThisDevice->pDrvMediaEx) 4918 4957 pThisDevice->pDrvMediaEx->pfnNotifySuspend(pThisDevice->pDrvMediaEx); … … 4938 4977 Log(("lsilogicR3Resume\n")); 4939 4978 4940 lsilogicR3Kick(p This);4979 lsilogicR3Kick(pDevIns, pThis); 4941 4980 } 4942 4981 … … 4949 4988 static DECLCALLBACK(void) lsilogicR3Detach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 4950 4989 { 4990 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4991 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 4992 Log(("%s: iLUN=%#x\n", __FUNCTION__, iLUN)); 4951 4993 RT_NOREF(fFlags); 4952 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4953 PLSILOGICDEVICE pDevice = &pThis->paDeviceStates[iLUN];4994 4995 AssertMsg(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG, ("LsiLogic: Device does not support hotplugging\n")); 4954 4996 4955 4997 if (iLUN >= pThis->cDeviceStates) 4956 4998 return; 4957 4958 AssertMsg(fFlags & PDM_TACH_FLAGS_NOT_HOT_PLUG,4959 ("LsiLogic: Device does not support hotplugging\n"));4960 4961 Log(("%s:\n", __FUNCTION__));4962 4999 4963 5000 /* 4964 5001 * Zero some important members. 4965 5002 */ 5003 PLSILOGICDEVICE pDevice = &pThisCC->paDeviceStates[iLUN]; 4966 5004 pDevice->pDrvBase = NULL; 4967 5005 pDevice->pDrvMedia = NULL; … … 4974 5012 static DECLCALLBACK(int) lsilogicR3Attach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 4975 5013 { 4976 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 4977 PLSILOGICDEVICE pDevice = &pThis->paDeviceStates[iLUN]; 5014 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 5015 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 5016 PLSILOGICDEVICE pDevice = &pThisCC->paDeviceStates[iLUN]; 4978 5017 int rc; 4979 5018 … … 5033 5072 static void lsilogicR3ResetCommon(PPDMDEVINS pDevIns) 5034 5073 { 5035 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 5074 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 5075 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 5036 5076 int rc; 5037 5077 5038 rc = lsilogicR3HardReset(p This);5078 rc = lsilogicR3HardReset(pDevIns, pThis, pThisCC); 5039 5079 AssertRC(rc); 5040 5080 5041 vboxscsiInitialize(&pThis ->VBoxSCSI);5081 vboxscsiInitialize(&pThisCC->VBoxSCSI); 5042 5082 } 5043 5083 … … 5076 5116 5077 5117 /** 5078 * @interface_method_impl{PDMDEVREG,pfnRelocate}5079 */5080 static DECLCALLBACK(void) lsilogicR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)5081 {5082 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI);5083 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);5084 RT_NOREF(offDelta);5085 }5086 5087 /**5088 5118 * @interface_method_impl{PDMDEVREG,pfnPowerOff} 5089 5119 */ … … 5100 5130 { 5101 5131 PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns); 5102 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 5132 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 5133 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 5103 5134 5104 5135 PDMDevHlpCritSectDelete(pDevIns, &pThis->ReplyFreeQueueCritSect); … … 5107 5138 PDMDevHlpCritSectDelete(pDevIns, &pThis->ReplyFreeQueueWriteCritSect); 5108 5139 5109 RTMemFree(pThis ->paDeviceStates);5110 pThis ->paDeviceStates = NULL;5140 RTMemFree(pThisCC->paDeviceStates); 5141 pThisCC->paDeviceStates = NULL; 5111 5142 5112 5143 if (pThis->hEvtProcess != NIL_SUPSEMEVENT) 5113 5144 { 5114 PDMDevHlpSUPSemEventClose(p This->CTX_SUFF(pDevIns), pThis->hEvtProcess);5145 PDMDevHlpSUPSemEventClose(pDevIns, pThis->hEvtProcess); 5115 5146 pThis->hEvtProcess = NIL_SUPSEMEVENT; 5116 5147 } 5117 5148 5118 lsilogicR3ConfigurationPagesFree(pThis );5119 lsilogicR3MemRegionsFree(pThis );5149 lsilogicR3ConfigurationPagesFree(pThis, pThisCC); 5150 lsilogicR3MemRegionsFree(pThisCC); 5120 5151 5121 5152 return VINF_SUCCESS; … … 5128 5159 { 5129 5160 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 5130 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 5131 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 5132 int rc = VINF_SUCCESS; 5161 PLSILOGICSCSI pThis = PDMDEVINS_2_DATA(pDevIns, PLSILOGICSCSI); 5162 PLSILOGICSCSICC pThisCC = PDMDEVINS_2_DATA_CC(pDevIns, PLSILOGICSCSICC); 5163 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 5164 int rc = VINF_SUCCESS; 5133 5165 5134 5166 /* … … 5137 5169 pThis->hEvtProcess = NIL_SUPSEMEVENT; 5138 5170 pThis->fBiosReqPending = false; 5139 RTListInit(&pThis ->ListMemRegns);5171 RTListInit(&pThisCC->ListMemRegns); 5140 5172 pThis->hMmioReg = NIL_IOMMMIOHANDLE; 5141 5173 pThis->hMmioDiag = NIL_IOMMMIOHANDLE; 5142 5174 pThis->hIoPortsReg = NIL_IOMIOPORTHANDLE; 5143 5175 pThis->hIoPortsBios = NIL_IOMIOPORTHANDLE; 5176 pThisCC->pDevIns = pDevIns; 5177 pThisCC->IBase.pfnQueryInterface = lsilogicR3StatusQueryInterface; 5178 pThisCC->ILeds.pfnQueryStatusLed = lsilogicR3StatusQueryStatusLed; 5179 5144 5180 5145 5181 /* … … 5153 5189 "Bootable", 5154 5190 ""); 5155 5156 pThis->fGCEnabled = pDevIns->fRCEnabled;5157 pThis->fR0Enabled = pDevIns->fR0Enabled;5158 5191 5159 5192 rc = pHlp->pfnCFGMQueryU32Def(pCfg, "ReplyQueueDepth", … … 5247 5280 PDMPciDevSetCapabilityList(pPciDev, 0x80); 5248 5281 # endif 5249 5250 pThis->pDevInsR3 = pDevIns;5251 pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);5252 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);5253 pThis->IBase.pfnQueryInterface = lsilogicR3StatusQueryInterface;5254 pThis->ILeds.pfnQueryStatusLed = lsilogicR3StatusQueryStatusLed;5255 5282 5256 5283 /* … … 5367 5394 * Create event semaphore and worker thread. 5368 5395 */ 5369 rc = PDMDevHlpThreadCreate(pDevIns, &pThis ->pThreadWrk, pThis, lsilogicR3Worker,5396 rc = PDMDevHlpThreadCreate(pDevIns, &pThisCC->pThreadWrk, pThis, lsilogicR3Worker, 5370 5397 lsilogicR3WorkerWakeUp, 0, RTTHREADTYPE_IO, szDevTag); 5371 5398 if (RT_FAILURE(rc)) … … 5373 5400 N_("LsiLogic: Failed to create worker thread %s"), szDevTag); 5374 5401 5375 rc = PDMDevHlpSUPSemEventCreate(p This->CTX_SUFF(pDevIns), &pThis->hEvtProcess);5402 rc = PDMDevHlpSUPSemEventCreate(pDevIns, &pThis->hEvtProcess); 5376 5403 if (RT_FAILURE(rc)) 5377 5404 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, … … 5381 5408 * Allocate device states. 5382 5409 */ 5383 pThis ->paDeviceStates = (PLSILOGICDEVICE)RTMemAllocZ(sizeof(LSILOGICDEVICE) * pThis->cDeviceStates);5384 if (!pThis ->paDeviceStates)5410 pThisCC->paDeviceStates = (PLSILOGICDEVICE)RTMemAllocZ(sizeof(LSILOGICDEVICE) * pThis->cDeviceStates); 5411 if (!pThisCC->paDeviceStates) 5385 5412 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to allocate memory for device states")); 5386 5413 5387 5414 for (unsigned i = 0; i < pThis->cDeviceStates; i++) 5388 5415 { 5389 PLSILOGICDEVICE pDevice = &pThis ->paDeviceStates[i];5416 PLSILOGICDEVICE pDevice = &pThisCC->paDeviceStates[i]; 5390 5417 5391 5418 /* Initialize static parts of the device. */ 5392 5419 pDevice->iLUN = i; 5393 pDevice->p LsiLogicR3 = pThis;5420 pDevice->pDevIns = pDevIns; 5394 5421 pDevice->Led.u32Magic = PDMLED_MAGIC; 5395 5422 pDevice->IBase.pfnQueryInterface = lsilogicR3DeviceQueryInterface; … … 5403 5430 pDevice->IMediaExPort.pfnMediumEjected = lsilogicR3MediumEjected; 5404 5431 pDevice->ILed.pfnQueryStatusLed = lsilogicR3DeviceQueryStatusLed; 5405 5406 char *pszName; 5407 if (RTStrAPrintf(&pszName, "Device%u", i) <= 0) 5408 AssertLogRelFailedReturn(VERR_NO_MEMORY); 5432 RTStrPrintf(pDevice->szName, sizeof(pDevice->szName), "Device%u", i); 5409 5433 5410 5434 /* Attach SCSI driver. */ 5411 rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, p szName);5435 rc = PDMDevHlpDriverAttach(pDevIns, pDevice->iLUN, &pDevice->IBase, &pDevice->pDrvBase, pDevice->szName); 5412 5436 if (RT_SUCCESS(rc)) 5413 5437 { … … 5434 5458 pDevice->pDrvBase = NULL; 5435 5459 rc = VINF_SUCCESS; 5436 Log(("LsiLogic: no driver attached to device %s\n", p szName));5460 Log(("LsiLogic: no driver attached to device %s\n", pDevice->szName)); 5437 5461 } 5438 5462 else 5439 5463 { 5440 AssertLogRelMsgFailed(("LsiLogic: Failed to attach %s\n", p szName));5464 AssertLogRelMsgFailed(("LsiLogic: Failed to attach %s\n", pDevice->szName)); 5441 5465 return rc; 5442 5466 } … … 5447 5471 */ 5448 5472 PPDMIBASE pBase; 5449 rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThis ->IBase, &pBase, "Status Port");5473 rc = PDMDevHlpDriverAttach(pDevIns, PDM_STATUS_LUN, &pThisCC->IBase, &pBase, "Status Port"); 5450 5474 if (RT_SUCCESS(rc)) 5451 5475 { 5452 pThis ->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS);5453 pThis ->pMediaNotify = PDMIBASE_QUERY_INTERFACE(pBase, PDMIMEDIANOTIFY);5476 pThisCC->pLedsConnector = PDMIBASE_QUERY_INTERFACE(pBase, PDMILEDCONNECTORS); 5477 pThisCC->pMediaNotify = PDMIBASE_QUERY_INTERFACE(pBase, PDMIMEDIANOTIFY); 5454 5478 } 5455 5479 else … … 5459 5483 5460 5484 /* Initialize the SCSI emulation for the BIOS. */ 5461 rc = vboxscsiInitialize(&pThis ->VBoxSCSI);5485 rc = vboxscsiInitialize(&pThisCC->VBoxSCSI); 5462 5486 AssertRC(rc); 5463 5487 … … 5504 5528 5505 5529 /* Perform hard reset. */ 5506 rc = lsilogicR3HardReset(p This);5530 rc = lsilogicR3HardReset(pDevIns, pThis, pThisCC); 5507 5531 AssertRC(rc); 5508 5532 … … 5547 5571 /* .uReserved0 = */ 0, 5548 5572 /* .szName = */ "lsilogicscsi", 5549 /* .fFlags = */ PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RZ | 5550 PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION,5573 /* .fFlags = */ PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RZ | PDM_DEVREG_FLAGS_NEW_STYLE 5574 | PDM_DEVREG_FLAGS_FIRST_SUSPEND_NOTIFICATION | PDM_DEVREG_FLAGS_FIRST_POWEROFF_NOTIFICATION, 5551 5575 /* .fClass = */ PDM_DEVREG_CLASS_STORAGE, 5552 5576 /* .cMaxInstances = */ ~0U, 5553 5577 /* .uSharedVersion = */ 42, 5554 5578 /* .cbInstanceShared = */ sizeof(LSILOGICSCSI), 5555 /* .cbInstanceCC = */ 0,5556 /* .cbInstanceRC = */ 0,5579 /* .cbInstanceCC = */ sizeof(LSILOGICSCSICC), 5580 /* .cbInstanceRC = */ sizeof(LSILOGICSCSIRC), 5557 5581 /* .cMaxPciDevices = */ 1, 5558 5582 /* .cMaxMsixVectors = */ 0, … … 5563 5587 /* .pfnConstruct = */ lsilogicR3Construct, 5564 5588 /* .pfnDestruct = */ lsilogicR3Destruct, 5565 /* .pfnRelocate = */ lsilogicR3Relocate,5589 /* .pfnRelocate = */ NULL, 5566 5590 /* .pfnMemSetup = */ NULL, 5567 5591 /* .pfnPowerOn = */ NULL, … … 5628 5652 /* .uSharedVersion = */ 42, 5629 5653 /* .cbInstanceShared = */ sizeof(LSILOGICSCSI), 5630 /* .cbInstanceCC = */ 0,5631 /* .cbInstanceRC = */ 0,5654 /* .cbInstanceCC = */ sizeof(LSILOGICSCSICC), 5655 /* .cbInstanceRC = */ sizeof(LSILOGICSCSIRC), 5632 5656 /* .cMaxPciDevices = */ 1, 5633 5657 /* .cMaxMsixVectors = */ 0, … … 5638 5662 /* .pfnConstruct = */ lsilogicR3Construct, 5639 5663 /* .pfnDestruct = */ lsilogicR3Destruct, 5640 /* .pfnRelocate = */ lsilogicR3Relocate,5664 /* .pfnRelocate = */ NULL, 5641 5665 /* .pfnMemSetup = */ NULL, 5642 5666 /* .pfnPowerOn = */ NULL,
Note:
See TracChangeset
for help on using the changeset viewer.