Changeset 44694 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Feb 14, 2013 6:49:30 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
r44571 r44694 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox storage devices:LsiLogic LSI53c1030 SCSI controller.3 * DevLsiLogicSCSI - LsiLogic LSI53c1030 SCSI controller. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 //#define DEBUG 18 /******************************************************************************* 19 * Header Files * 20 *******************************************************************************/ 19 21 #define LOG_GROUP LOG_GROUP_DEV_LSILOGICSCSI 20 22 #include <VBox/vmm/pdmdev.h> … … 38 40 #include "VBoxDD.h" 39 41 42 43 /******************************************************************************* 44 * Defined Constants And Macros * 45 *******************************************************************************/ 40 46 /** The current saved state version. */ 41 47 #define LSILOGIC_SAVED_STATE_VERSION 3 … … 49 55 #define MAX_REL_LOG_ERRORS 1024 50 56 57 #define LSILOGIC_RTGCPHYS_FROM_U32(Hi, Lo) ( (RTGCPHYS)RT_MAKE_U64(Lo, Hi) ) 58 59 60 /******************************************************************************* 61 * Structures and Typedefs * 62 *******************************************************************************/ 51 63 /** 52 64 * Reply data. … … 62 74 /** Different views to the reply depending on the request type. */ 63 75 MptReplyUnion Reply; 64 } LSILOGICSCSIREPLY, *PLSILOGICSCSIREPLY; 76 } LSILOGICSCSIREPLY; 77 /** Pointer to reply data. */ 78 typedef LSILOGICSCSIREPLY *PLSILOGICSCSIREPLY; 65 79 66 80 /** … … 77 91 78 92 /** LUN of the device. */ 79 RTUINTiLUN;93 uint32_t iLUN; 80 94 /** Number of outstanding tasks on the port. */ 81 95 volatile uint32_t cOutstandingRequests; … … 98 112 PDMLED Led; 99 113 100 } LSILOGICDEVICE, *PLSILOGICDEVICE; 114 } LSILOGICDEVICE; 115 /** Pointer to a device state. */ 116 typedef LSILOGICDEVICE *PLSILOGICDEVICE; 101 117 102 118 /** Pointer to a task state. */ … … 104 120 105 121 /** 106 * Device instance data for the emulated 107 * SCSI controller. 122 * Device instance data for the emulated SCSI controller. 108 123 */ 109 124 typedef struct LSILOGICSCSI … … 154 169 155 170 /** Number of device states allocated. */ 156 uint32_t 171 uint32_t cDeviceStates; 157 172 158 173 #if HC_ARCH_BITS == 64 … … 295 310 R3PTRTYPE(volatile PLSILOGICTASKSTATE) pTasksRedoHead; 296 311 297 } LSILOGISCSI, *PLSILOGICSCSI; 312 } LSILOGISCSI; 313 /** Pointer to the device instance data of the LsiLogic emulation. */ 314 typedef LSILOGICSCSI *PLSILOGICSCSI; 298 315 299 316 /** … … 321 338 RTGCPHYS GCPhysAddrBufferUnaligned; 322 339 } u; 323 } LSILOGICTASKSTATESGENTRY, *PLSILOGICTASKSTATESGENTRY; 340 } LSILOGICTASKSTATESGENTRY; 341 /** Pointer to a scatter/gather list entry. */ 342 typedef LSILOGICTASKSTATESGENTRY *PLSILOGICTASKSTATESGENTRY; 324 343 325 344 /** … … 368 387 } LSILOGICTASKSTATE; 369 388 389 370 390 #ifndef VBOX_DEVICE_STRUCT_TESTCASE 371 391 392 /******************************************************************************* 393 * Internal Functions * 394 *******************************************************************************/ 372 395 RT_C_DECLS_BEGIN 373 396 #ifdef IN_RING3 374 static void lsilogic InitializeConfigurationPages(PLSILOGICSCSI pLsiLogic);375 static void lsilogic ConfigurationPagesFree(PLSILOGICSCSI pThis);376 static int lsilogicProcessConfigurationRequest(PLSILOGICSCSI pLsiLogic, PMptConfigurationRequest pConfigurationReq,377 PMptConfigurationReply pReply);397 static void lsilogicR3InitializeConfigurationPages(PLSILOGICSCSI pThis); 398 static void lsilogicR3ConfigurationPagesFree(PLSILOGICSCSI pThis); 399 static int lsilogicR3ProcessConfigurationRequest(PLSILOGICSCSI pThis, PMptConfigurationRequest pConfigurationReq, 400 PMptConfigurationReply pReply); 378 401 #endif 379 402 RT_C_DECLS_END 380 403 381 #define PDMIBASE_2_PLSILOGICDEVICE(pInterface) ( (PLSILOGICDEVICE)((uintptr_t)(pInterface) - RT_OFFSETOF(LSILOGICDEVICE, IBase)) ) 382 #define PDMISCSIPORT_2_PLSILOGICDEVICE(pInterface) ( (PLSILOGICDEVICE)((uintptr_t)(pInterface) - RT_OFFSETOF(LSILOGICDEVICE, ISCSIPort)) ) 383 #define PDMILEDPORTS_2_PLSILOGICDEVICE(pInterface) ( (PLSILOGICDEVICE)((uintptr_t)(pInterface) - RT_OFFSETOF(LSILOGICDEVICE, ILed)) ) 384 #define LSILOGIC_RTGCPHYS_FROM_U32(Hi, Lo) ( (RTGCPHYS)RT_MAKE_U64(Lo, Hi) ) 385 #define PDMIBASE_2_PLSILOGICSCSI(pInterface) ( (PLSILOGICSCSI)((uintptr_t)(pInterface) - RT_OFFSETOF(LSILOGICSCSI, IBase)) ) 386 #define PDMILEDPORTS_2_PLSILOGICSCSI(pInterface) ( (PLSILOGICSCSI)((uintptr_t)(pInterface) - RT_OFFSETOF(LSILOGICSCSI, ILeds)) ) 387 404 405 /******************************************************************************* 406 * Global Variables * 407 *******************************************************************************/ 388 408 /** Key sequence the guest has to write to enable access 389 409 * to diagnostic memory. */ … … 394 414 * 395 415 * @returns nothing. 396 * @param pThis Pointer to the device instance data.416 * @param pThis Pointer to the LsiLogic device state. 397 417 */ 398 418 static void lsilogicUpdateInterrupt(PLSILOGICSCSI pThis) … … 424 444 * 425 445 * @returns nothing. 426 * @param p LsiLogic Pointer to the device instance.427 * @param uStatus 428 */ 429 DECLINLINE(void) lsilogicSetInterrupt(PLSILOGICSCSI p LsiLogic, uint32_t uStatus)430 { 431 ASMAtomicOrU32(&p LsiLogic->uInterruptStatus, uStatus);432 lsilogicUpdateInterrupt(p LsiLogic);446 * @param pThis Pointer to the LsiLogic device state. 447 * @param uStatus The status bit to set. 448 */ 449 DECLINLINE(void) lsilogicSetInterrupt(PLSILOGICSCSI pThis, uint32_t uStatus) 450 { 451 ASMAtomicOrU32(&pThis->uInterruptStatus, uStatus); 452 lsilogicUpdateInterrupt(pThis); 433 453 } 434 454 … … 438 458 * 439 459 * @returns nothing. 440 * @param p LsiLogic Pointer to the device instance.441 * @param uStatus 442 */ 443 DECLINLINE(void) lsilogicClearInterrupt(PLSILOGICSCSI p LsiLogic, uint32_t uStatus)444 { 445 ASMAtomicAndU32(&p LsiLogic->uInterruptStatus, ~uStatus);446 lsilogicUpdateInterrupt(p LsiLogic);460 * @param pThis Pointer to the LsiLogic device state. 461 * @param uStatus The status bit to set. 462 */ 463 DECLINLINE(void) lsilogicClearInterrupt(PLSILOGICSCSI pThis, uint32_t uStatus) 464 { 465 ASMAtomicAndU32(&pThis->uInterruptStatus, ~uStatus); 466 lsilogicUpdateInterrupt(pThis); 447 467 } 448 468 … … 451 471 * 452 472 * @returns nothing 453 * @param p LsiLogic Pointer to the controller device instance.454 * @param uIOCFaultCode 455 */ 456 DECLINLINE(void) lsilogicSetIOCFaultCode(PLSILOGICSCSI p LsiLogic, uint16_t uIOCFaultCode)457 { 458 if (p LsiLogic->enmState != LSILOGICSTATE_FAULT)473 * @param pThis Pointer to the LsiLogic device state. 474 * @param uIOCFaultCode Fault code to set. 475 */ 476 DECLINLINE(void) lsilogicSetIOCFaultCode(PLSILOGICSCSI pThis, uint16_t uIOCFaultCode) 477 { 478 if (pThis->enmState != LSILOGICSTATE_FAULT) 459 479 { 460 480 Log(("%s: Setting I/O controller into FAULT state: uIOCFaultCode=%u\n", __FUNCTION__, uIOCFaultCode)); 461 p LsiLogic->enmState = LSILOGICSTATE_FAULT;462 p LsiLogic->u16IOCFaultCode = uIOCFaultCode;481 pThis->enmState = LSILOGICSTATE_FAULT; 482 pThis->u16IOCFaultCode = uIOCFaultCode; 463 483 } 464 484 else … … 469 489 470 490 #ifdef IN_RING3 491 471 492 /** 472 493 * Performs a hard reset on the controller. 473 494 * 474 495 * @returns VBox status code. 475 * @param pThis Pointer to the device instance to initialize.476 */ 477 static int lsilogic HardReset(PLSILOGICSCSI pThis)496 * @param pThis Pointer to the LsiLogic device state. 497 */ 498 static int lsilogicR3HardReset(PLSILOGICSCSI pThis) 478 499 { 479 500 pThis->enmState = LSILOGICSTATE_RESET; … … 504 525 /** @todo: Put stuff to reset here. */ 505 526 506 lsilogic ConfigurationPagesFree(pThis);507 lsilogic InitializeConfigurationPages(pThis);527 lsilogicR3ConfigurationPagesFree(pThis); 528 lsilogicR3InitializeConfigurationPages(pThis); 508 529 509 530 /* Mark that we finished performing the reset. */ … … 518 539 * @param pThis The LsiLogic controller instance 519 540 */ 520 static void lsilogic ConfigurationPagesFree(PLSILOGICSCSI pThis)541 static void lsilogicR3ConfigurationPagesFree(PLSILOGICSCSI pThis) 521 542 { 522 543 … … 554 575 * 555 576 * @returns nothing 556 * @param p LsiLogic Pointer to the device instance557 * @param u32MessageContext 558 */ 559 static void lsilogic FinishContextReply(PLSILOGICSCSI pLsiLogic, uint32_t u32MessageContext)577 * @param pThis Pointer to the LsiLogic device state. 578 * @param u32MessageContext The message context ID to post. 579 */ 580 static void lsilogicR3FinishContextReply(PLSILOGICSCSI pThis, uint32_t u32MessageContext) 560 581 { 561 582 int rc; 562 583 563 LogFlowFunc(("p LsiLogic=%#p u32MessageContext=%#x\n", pLsiLogic, u32MessageContext));564 565 AssertMsg(!p LsiLogic->fDoorbellInProgress, ("We are in a doorbell function\n"));584 LogFlowFunc(("pThis=%#p u32MessageContext=%#x\n", pThis, u32MessageContext)); 585 586 AssertMsg(!pThis->fDoorbellInProgress, ("We are in a doorbell function\n")); 566 587 567 588 /* Write message context ID into reply post queue. */ 568 rc = PDMCritSectEnter(&p LsiLogic->ReplyPostQueueCritSect, VINF_SUCCESS);589 rc = PDMCritSectEnter(&pThis->ReplyPostQueueCritSect, VINF_SUCCESS); 569 590 AssertRC(rc); 570 591 571 # if 0592 # if 0 572 593 /* Check for a entry in the queue. */ 573 if (RT_UNLIKELY(p LsiLogic->uReplyPostQueueNextAddressRead != pLsiLogic->uReplyPostQueueNextEntryFreeWrite))594 if (RT_UNLIKELY(pThis->uReplyPostQueueNextAddressRead != pThis->uReplyPostQueueNextEntryFreeWrite)) 574 595 { 575 596 /* Set error code. */ 576 lsilogicSetIOCFaultCode(p LsiLogic, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES);577 PDMCritSectLeave(&p LsiLogic->ReplyPostQueueCritSect);597 lsilogicSetIOCFaultCode(pThis, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); 598 PDMCritSectLeave(&pThis->ReplyPostQueueCritSect); 578 599 return; 579 600 } 580 # endif601 # endif 581 602 582 603 /* We have a context reply. */ 583 ASMAtomicWriteU32(&p LsiLogic->CTX_SUFF(pReplyPostQueueBase)[pLsiLogic->uReplyPostQueueNextEntryFreeWrite], u32MessageContext);584 ASMAtomicIncU32(&p LsiLogic->uReplyPostQueueNextEntryFreeWrite);585 p LsiLogic->uReplyPostQueueNextEntryFreeWrite %= pLsiLogic->cReplyQueueEntries;604 ASMAtomicWriteU32(&pThis->CTX_SUFF(pReplyPostQueueBase)[pThis->uReplyPostQueueNextEntryFreeWrite], u32MessageContext); 605 ASMAtomicIncU32(&pThis->uReplyPostQueueNextEntryFreeWrite); 606 pThis->uReplyPostQueueNextEntryFreeWrite %= pThis->cReplyQueueEntries; 586 607 587 608 /* Set interrupt. */ 588 lsilogicSetInterrupt(p LsiLogic, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR);589 590 PDMCritSectLeave(&p LsiLogic->ReplyPostQueueCritSect);591 } 592 593 static void lsilogic TaskStateClear(PLSILOGICTASKSTATE pTaskState)609 lsilogicSetInterrupt(pThis, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR); 610 611 PDMCritSectLeave(&pThis->ReplyPostQueueCritSect); 612 } 613 614 static void lsilogicR3TaskStateClear(PLSILOGICTASKSTATE pTaskState) 594 615 { 595 616 RTMemFree(pTaskState->pSGListHead); … … 607 628 } 608 629 609 static int lsilogicTaskStateCtor(RTMEMCACHE hMemCache, void *pvObj, void *pvUser) 630 /** 631 * @callback_method_impl{FNMEMCACHECTOR} 632 */ 633 static DECLCALLBACK(int) lsilogicR3TaskStateCtor(RTMEMCACHE hMemCache, void *pvObj, void *pvUser) 610 634 { 611 635 memset(pvObj, 0, sizeof(LSILOGICTASKSTATE)); … … 613 637 } 614 638 615 static void lsilogicTaskStateDtor(RTMEMCACHE hMemCache, void *pvObj, void *pvUser) 639 /** 640 * @callback_method_impl{FNMEMCACHEDTOR} 641 */ 642 static DECLCALLBACK(void) lsilogicR3TaskStateDtor(RTMEMCACHE hMemCache, void *pvObj, void *pvUser) 616 643 { 617 644 PLSILOGICTASKSTATE pTaskState = (PLSILOGICTASKSTATE)pvObj; 618 lsilogic TaskStateClear(pTaskState);645 lsilogicR3TaskStateClear(pTaskState); 619 646 } 620 647 … … 625 652 * 626 653 * @returns nothing 627 * @param p LsiLogic Pointer to the device instance654 * @param pThis Pointer to the LsiLogic device state. 628 655 * @param pReply Pointer to the reply message. 629 656 * @param fForceReplyFifo Flag whether the use of the reply post fifo is forced. 630 657 */ 631 static void lsilogicFinishAddressReply(PLSILOGICSCSI p LsiLogic, PMptReplyUnion pReply, bool fForceReplyFifo)658 static void lsilogicFinishAddressReply(PLSILOGICSCSI pThis, PMptReplyUnion pReply, bool fForceReplyFifo) 632 659 { 633 660 /* … … 636 663 * we are ready to send the reply. 637 664 */ 638 if (p LsiLogic->fDoorbellInProgress && !fForceReplyFifo)665 if (pThis->fDoorbellInProgress && !fForceReplyFifo) 639 666 { 640 667 /* Set size of the reply in 16bit words. The size in the reply is in 32bit dwords. */ 641 p LsiLogic->cReplySize = pReply->Header.u8MessageLength * 2;642 Log(("%s: cReplySize=%u\n", __FUNCTION__, p LsiLogic->cReplySize));643 p LsiLogic->uNextReplyEntryRead = 0;644 lsilogicSetInterrupt(p LsiLogic, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL);668 pThis->cReplySize = pReply->Header.u8MessageLength * 2; 669 Log(("%s: cReplySize=%u\n", __FUNCTION__, pThis->cReplySize)); 670 pThis->uNextReplyEntryRead = 0; 671 lsilogicSetInterrupt(pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); 645 672 } 646 673 else … … 654 681 int rc; 655 682 /* Grab a free reply message from the queue. */ 656 rc = PDMCritSectEnter(&p LsiLogic->ReplyFreeQueueCritSect, VINF_SUCCESS);683 rc = PDMCritSectEnter(&pThis->ReplyFreeQueueCritSect, VINF_SUCCESS); 657 684 AssertRC(rc); 658 685 659 686 #if 0 660 687 /* Check for a free reply frame. */ 661 if (RT_UNLIKELY(p LsiLogic->uReplyFreeQueueNextAddressRead != pLsiLogic->uReplyFreeQueueNextEntryFreeWrite))688 if (RT_UNLIKELY(pThis->uReplyFreeQueueNextAddressRead != pThis->uReplyFreeQueueNextEntryFreeWrite)) 662 689 { 663 690 /* Set error code. */ 664 lsilogicSetIOCFaultCode(p LsiLogic, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES);665 PDMCritSectLeave(&p LsiLogic->ReplyFreeQueueCritSect);691 lsilogicSetIOCFaultCode(pThis, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); 692 PDMCritSectLeave(&pThis->ReplyFreeQueueCritSect); 666 693 return; 667 694 } 668 695 #endif 669 696 670 uint32_t u32ReplyFrameAddressLow = p LsiLogic->CTX_SUFF(pReplyFreeQueueBase)[pLsiLogic->uReplyFreeQueueNextAddressRead];671 672 p LsiLogic->uReplyFreeQueueNextAddressRead++;673 p LsiLogic->uReplyFreeQueueNextAddressRead %= pLsiLogic->cReplyQueueEntries;674 675 PDMCritSectLeave(&p LsiLogic->ReplyFreeQueueCritSect);697 uint32_t u32ReplyFrameAddressLow = pThis->CTX_SUFF(pReplyFreeQueueBase)[pThis->uReplyFreeQueueNextAddressRead]; 698 699 pThis->uReplyFreeQueueNextAddressRead++; 700 pThis->uReplyFreeQueueNextAddressRead %= pThis->cReplyQueueEntries; 701 702 PDMCritSectLeave(&pThis->ReplyFreeQueueCritSect); 676 703 677 704 /* Build 64bit physical address. */ 678 RTGCPHYS GCPhysReplyMessage = LSILOGIC_RTGCPHYS_FROM_U32(p LsiLogic->u32HostMFAHighAddr, u32ReplyFrameAddressLow);679 size_t cbReplyCopied = (p LsiLogic->cbReplyFrame < sizeof(MptReplyUnion)) ? pLsiLogic->cbReplyFrame : sizeof(MptReplyUnion);705 RTGCPHYS GCPhysReplyMessage = LSILOGIC_RTGCPHYS_FROM_U32(pThis->u32HostMFAHighAddr, u32ReplyFrameAddressLow); 706 size_t cbReplyCopied = (pThis->cbReplyFrame < sizeof(MptReplyUnion)) ? pThis->cbReplyFrame : sizeof(MptReplyUnion); 680 707 681 708 /* Write reply to guest memory. */ 682 PDMDevHlpPhysWrite(p LsiLogic->CTX_SUFF(pDevIns), GCPhysReplyMessage, pReply, cbReplyCopied);709 PDMDevHlpPhysWrite(pThis->CTX_SUFF(pDevIns), GCPhysReplyMessage, pReply, cbReplyCopied); 683 710 684 711 /* Write low 32bits of reply frame into post reply queue. */ 685 rc = PDMCritSectEnter(&p LsiLogic->ReplyPostQueueCritSect, VINF_SUCCESS);712 rc = PDMCritSectEnter(&pThis->ReplyPostQueueCritSect, VINF_SUCCESS); 686 713 AssertRC(rc); 687 714 688 715 #if 0 689 716 /* Check for a entry in the queue. */ 690 if (RT_UNLIKELY(p LsiLogic->uReplyPostQueueNextAddressRead != pLsiLogic->uReplyPostQueueNextEntryFreeWrite))717 if (RT_UNLIKELY(pThis->uReplyPostQueueNextAddressRead != pThis->uReplyPostQueueNextEntryFreeWrite)) 691 718 { 692 719 /* Set error code. */ 693 lsilogicSetIOCFaultCode(p LsiLogic, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES);694 PDMCritSectLeave(&p LsiLogic->ReplyPostQueueCritSect);720 lsilogicSetIOCFaultCode(pThis, LSILOGIC_IOCSTATUS_INSUFFICIENT_RESOURCES); 721 PDMCritSectLeave(&pThis->ReplyPostQueueCritSect); 695 722 return; 696 723 } … … 698 725 699 726 /* We have a address reply. Set the 31th bit to indicate that. */ 700 ASMAtomicWriteU32(&p LsiLogic->CTX_SUFF(pReplyPostQueueBase)[pLsiLogic->uReplyPostQueueNextEntryFreeWrite],727 ASMAtomicWriteU32(&pThis->CTX_SUFF(pReplyPostQueueBase)[pThis->uReplyPostQueueNextEntryFreeWrite], 701 728 RT_BIT(31) | (u32ReplyFrameAddressLow >> 1)); 702 ASMAtomicIncU32(&p LsiLogic->uReplyPostQueueNextEntryFreeWrite);703 p LsiLogic->uReplyPostQueueNextEntryFreeWrite %= pLsiLogic->cReplyQueueEntries;729 ASMAtomicIncU32(&pThis->uReplyPostQueueNextEntryFreeWrite); 730 pThis->uReplyPostQueueNextEntryFreeWrite %= pThis->cReplyQueueEntries; 704 731 705 732 if (fForceReplyFifo) 706 733 { 707 p LsiLogic->fDoorbellInProgress = false;708 lsilogicSetInterrupt(p LsiLogic, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL);734 pThis->fDoorbellInProgress = false; 735 lsilogicSetInterrupt(pThis, LSILOGIC_REG_HOST_INTR_STATUS_SYSTEM_DOORBELL); 709 736 } 710 737 711 738 /* Set interrupt. */ 712 lsilogicSetInterrupt(p LsiLogic, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR);713 714 PDMCritSectLeave(&p LsiLogic->ReplyPostQueueCritSect);739 lsilogicSetInterrupt(pThis, LSILOGIC_REG_HOST_INTR_STATUS_REPLY_INTR); 740 741 PDMCritSectLeave(&pThis->ReplyPostQueueCritSect); 715 742 #else 716 743 AssertMsgFailed(("This is not allowed to happen.\n")); … … 724 751 * 725 752 * @returns VBox status code. 726 * @param p LsiLogic Pointer to the device instance.727 * @param pMessageHdr 728 * @param pReply 729 */ 730 static int lsilogic ProcessMessageRequest(PLSILOGICSCSI pLsiLogic, PMptMessageHdr pMessageHdr, PMptReplyUnion pReply)753 * @param pThis Pointer to the LsiLogic device state. 754 * @param pMessageHdr Pointer to the message header of the request. 755 * @param pReply Pointer to the reply. 756 */ 757 static int lsilogicR3ProcessMessageRequest(PLSILOGICSCSI pThis, PMptMessageHdr pMessageHdr, PMptReplyUnion pReply) 731 758 { 732 759 int rc = VINF_SUCCESS; 733 760 bool fForceReplyPostFifo = false; 734 761 735 # ifdef DEBUG762 # ifdef LOG_ENABLED 736 763 if (pMessageHdr->u8Function < RT_ELEMENTS(g_apszMPTFunctionNames)) 737 764 Log(("Message request function: %s\n", g_apszMPTFunctionNames[pMessageHdr->u8Function])); 738 765 else 739 766 Log(("Message request function: <unknown>\n")); 740 # endif767 # endif 741 768 742 769 memset(pReply, 0, sizeof(MptReplyUnion)); … … 766 793 767 794 /* Update configuration values. */ 768 p LsiLogic->enmWhoInit = (LSILOGICWHOINIT)pIOCInitReq->u8WhoInit;769 p LsiLogic->cbReplyFrame = pIOCInitReq->u16ReplyFrameSize;770 p LsiLogic->cMaxBuses = pIOCInitReq->u8MaxBuses;771 p LsiLogic->cMaxDevices = pIOCInitReq->u8MaxDevices;772 p LsiLogic->u32HostMFAHighAddr = pIOCInitReq->u32HostMfaHighAddr;773 p LsiLogic->u32SenseBufferHighAddr = pIOCInitReq->u32SenseBufferHighAddr;774 775 if (p LsiLogic->enmState == LSILOGICSTATE_READY)795 pThis->enmWhoInit = (LSILOGICWHOINIT)pIOCInitReq->u8WhoInit; 796 pThis->cbReplyFrame = pIOCInitReq->u16ReplyFrameSize; 797 pThis->cMaxBuses = pIOCInitReq->u8MaxBuses; 798 pThis->cMaxDevices = pIOCInitReq->u8MaxDevices; 799 pThis->u32HostMFAHighAddr = pIOCInitReq->u32HostMfaHighAddr; 800 pThis->u32SenseBufferHighAddr = pIOCInitReq->u32SenseBufferHighAddr; 801 802 if (pThis->enmState == LSILOGICSTATE_READY) 776 803 { 777 p LsiLogic->enmState = LSILOGICSTATE_OPERATIONAL;804 pThis->enmState = LSILOGICSTATE_OPERATIONAL; 778 805 } 779 806 780 807 /* Return reply. */ 781 808 pReply->IOCInit.u8MessageLength = 5; 782 pReply->IOCInit.u8WhoInit = p LsiLogic->enmWhoInit;783 pReply->IOCInit.u8MaxDevices = p LsiLogic->cMaxDevices;784 pReply->IOCInit.u8MaxBuses = p LsiLogic->cMaxBuses;809 pReply->IOCInit.u8WhoInit = pThis->enmWhoInit; 810 pReply->IOCInit.u8MaxDevices = pThis->cMaxDevices; 811 pReply->IOCInit.u8MaxBuses = pThis->cMaxBuses; 785 812 break; 786 813 } … … 789 816 pReply->IOCFacts.u8MessageLength = 15; /* 15 32bit dwords. */ 790 817 791 if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI)818 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI) 792 819 { 793 820 pReply->IOCFacts.u16MessageVersion = 0x0102; /* Version from the specification. */ 794 pReply->IOCFacts.u8NumberOfPorts = p LsiLogic->cPorts;821 pReply->IOCFacts.u8NumberOfPorts = pThis->cPorts; 795 822 } 796 else if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS)823 else if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 797 824 { 798 825 pReply->IOCFacts.u16MessageVersion = 0x0105; /* Version from the specification. */ 799 pReply->IOCFacts.u8NumberOfPorts = p LsiLogic->cPorts;826 pReply->IOCFacts.u8NumberOfPorts = pThis->cPorts; 800 827 } 801 828 else 802 AssertMsgFailed(("Invalid controller type %d\n", p LsiLogic->enmCtrlType));829 AssertMsgFailed(("Invalid controller type %d\n", pThis->enmCtrlType)); 803 830 804 831 pReply->IOCFacts.u8IOCNumber = 0; /* PCI function number. */ 805 832 pReply->IOCFacts.u16IOCExceptions = 0; 806 833 pReply->IOCFacts.u8MaxChainDepth = LSILOGICSCSI_MAXIMUM_CHAIN_DEPTH; 807 pReply->IOCFacts.u8WhoInit = p LsiLogic->enmWhoInit;834 pReply->IOCFacts.u8WhoInit = pThis->enmWhoInit; 808 835 pReply->IOCFacts.u8BlockSize = 12; /* Block size in 32bit dwords. This is the largest request we can get (SCSI I/O). */ 809 836 pReply->IOCFacts.u8Flags = 0; /* Bit 0 is set if the guest must upload the FW prior to using the controller. Obviously not needed here. */ 810 pReply->IOCFacts.u16ReplyQueueDepth = p LsiLogic->cReplyQueueEntries - 1; /* One entry is always free. */837 pReply->IOCFacts.u16ReplyQueueDepth = pThis->cReplyQueueEntries - 1; /* One entry is always free. */ 811 838 pReply->IOCFacts.u16RequestFrameSize = 128; /* @todo Figure out where it is needed. */ 812 839 pReply->IOCFacts.u16ProductID = 0xcafe; /* Our own product ID :) */ 813 pReply->IOCFacts.u32CurrentHostMFAHighAddr = p LsiLogic->u32HostMFAHighAddr;814 pReply->IOCFacts.u16GlobalCredits = p LsiLogic->cRequestQueueEntries - 1; /* One entry is always free. */840 pReply->IOCFacts.u32CurrentHostMFAHighAddr = pThis->u32HostMFAHighAddr; 841 pReply->IOCFacts.u16GlobalCredits = pThis->cRequestQueueEntries - 1; /* One entry is always free. */ 815 842 816 843 pReply->IOCFacts.u8EventState = 0; /* Event notifications not enabled. */ 817 pReply->IOCFacts.u32CurrentSenseBufferHighAddr = p LsiLogic->u32SenseBufferHighAddr;818 pReply->IOCFacts.u16CurReplyFrameSize = p LsiLogic->cbReplyFrame;819 pReply->IOCFacts.u8MaxDevices = p LsiLogic->cMaxDevices;820 pReply->IOCFacts.u8MaxBuses = p LsiLogic->cMaxBuses;844 pReply->IOCFacts.u32CurrentSenseBufferHighAddr = pThis->u32SenseBufferHighAddr; 845 pReply->IOCFacts.u16CurReplyFrameSize = pThis->cbReplyFrame; 846 pReply->IOCFacts.u8MaxDevices = pThis->cMaxDevices; 847 pReply->IOCFacts.u8MaxBuses = pThis->cMaxBuses; 821 848 pReply->IOCFacts.u32FwImageSize = 0; /* No image needed. */ 822 849 pReply->IOCFacts.u32FWVersion = 0; … … 830 857 pReply->PortFacts.u8PortNumber = pPortFactsReq->u8PortNumber; 831 858 832 if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI)859 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI) 833 860 { 834 861 /* This controller only supports one bus with bus number 0. */ 835 if (pPortFactsReq->u8PortNumber >= p LsiLogic->cPorts)862 if (pPortFactsReq->u8PortNumber >= pThis->cPorts) 836 863 { 837 864 pReply->PortFacts.u8PortType = 0; /* Not existant. */ … … 848 875 } 849 876 } 850 else if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS)877 else if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 851 878 { 852 if (pPortFactsReq->u8PortNumber >= p LsiLogic->cPorts)879 if (pPortFactsReq->u8PortNumber >= pThis->cPorts) 853 880 { 854 881 pReply->PortFacts.u8PortType = 0; /* Not existant. */ … … 857 884 { 858 885 pReply->PortFacts.u8PortType = 0x30; /* SAS Port. */ 859 pReply->PortFacts.u16MaxDevices = p LsiLogic->cPorts;886 pReply->PortFacts.u16MaxDevices = pThis->cPorts; 860 887 pReply->PortFacts.u16ProtocolFlags = RT_BIT(3) | RT_BIT(0); /* SCSI initiator and LUN supported. */ 861 pReply->PortFacts.u16PortSCSIID = p LsiLogic->cPorts;888 pReply->PortFacts.u16PortSCSIID = pThis->cPorts; 862 889 pReply->PortFacts.u16MaxPersistentIDs = 0; 863 890 pReply->PortFacts.u16MaxPostedCmdBuffers = 0; /* Only applies for target mode which we dont support. */ … … 866 893 } 867 894 else 868 AssertMsgFailed(("Invalid controller type %d\n", p LsiLogic->enmCtrlType));895 AssertMsgFailed(("Invalid controller type %d\n", pThis->enmCtrlType)); 869 896 break; 870 897 } … … 886 913 887 914 if (pEventNotificationReq->u8Switch) 888 p LsiLogic->fEventNotificationEnabled = true;915 pThis->fEventNotificationEnabled = true; 889 916 else 890 p LsiLogic->fEventNotificationEnabled = false;917 pThis->fEventNotificationEnabled = false; 891 918 892 919 pReply->EventNotification.u16EventDataLength = 1; /* 1 32bit D-Word. */ … … 896 923 pReply->EventNotification.u32Event = MPT_EVENT_EVENT_CHANGE; 897 924 pReply->EventNotification.u32EventContext = 0; 898 pReply->EventNotification.u32EventData = p LsiLogic->fEventNotificationEnabled ? 1 : 0;925 pReply->EventNotification.u32EventData = pThis->fEventNotificationEnabled ? 1 : 0; 899 926 900 927 break; … … 909 936 PMptConfigurationRequest pConfigurationReq = (PMptConfigurationRequest)pMessageHdr; 910 937 911 rc = lsilogic ProcessConfigurationRequest(pLsiLogic, pConfigurationReq, &pReply->Configuration);938 rc = lsilogicR3ProcessConfigurationRequest(pThis, pConfigurationReq, &pReply->Configuration); 912 939 AssertRC(rc); 913 940 break; … … 938 965 pReply->Header.u32MessageContext = pMessageHdr->u32MessageContext; 939 966 940 lsilogicFinishAddressReply(p LsiLogic, pReply, fForceReplyPostFifo);967 lsilogicFinishAddressReply(pThis, pReply, fForceReplyPostFifo); 941 968 return rc; 942 969 } 943 #endif 970 #endif /* IN_RING3 */ 944 971 945 972 /** … … 947 974 * 948 975 * @returns VBox status code. 949 * @param pThis Pointer to the LsiLogic SCSI controller instance data.950 * @param uOffset Offset of the register to write.951 * @param pv Pointer to the value to write952 * @param cb Number of bytes to write.976 * @param pThis Pointer to the LsiLogic device state. 977 * @param uOffset Offset of the register to write. 978 * @param pv Pointer to the value to write 979 * @param cb Number of bytes to write. 953 980 */ 954 981 static int lsilogicRegisterWrite(PLSILOGICSCSI pThis, uint32_t uOffset, void const *pv, unsigned cb) … … 1071 1098 if (pThis->iMessage == pThis->cMessage) 1072 1099 { 1073 int rc = lsilogic ProcessMessageRequest(pThis, (PMptMessageHdr)pThis->aMessage, &pThis->ReplyBuffer);1100 int rc = lsilogicR3ProcessMessageRequest(pThis, (PMptMessageHdr)pThis->aMessage, &pThis->ReplyBuffer); 1074 1101 AssertRC(rc); 1075 1102 } … … 1149 1176 if (u32 & LSILOGIC_REG_HOST_DIAGNOSTIC_RESET_ADAPTER) 1150 1177 { 1151 lsilogic HardReset(pThis);1178 lsilogicR3HardReset(pThis); 1152 1179 } 1153 1180 break; … … 1166 1193 * 1167 1194 * @returns VBox status code. 1168 * @param pThis Pointer to the LsiLogic SCSI controller instance data.1169 * @param uOffset Offset of the register to read.1170 * @param pv Where to store the content of the register.1171 * @param cb Number of bytes to read.1195 * @param pThis Pointer to the LsiLogic device state. 1196 * @param uOffset Offset of the register to read. 1197 * @param pv Where to store the content of the register. 1198 * @param cb Number of bytes to read. 1172 1199 */ 1173 1200 static int lsilogicRegisterRead(PLSILOGICSCSI pThis, uint32_t uOffset, void *pv, unsigned cb) … … 1373 1400 * @param cbCopy Number of bytes to copy. 1374 1401 */ 1375 static void lsilogic ScatterGatherListCopyFromBuffer(PLSILOGICTASKSTATE pTaskState, void *pvBuf, size_t cbCopy)1402 static void lsilogicR3ScatterGatherListCopyFromBuffer(PLSILOGICTASKSTATE pTaskState, void *pvBuf, size_t cbCopy) 1376 1403 { 1377 1404 unsigned cSGEntry = 0; … … 1408 1435 * to write to which are unaligned. 1409 1436 */ 1410 static void lsilogic CopyFromBufferIntoSGList(PPDMDEVINS pDevIns, PLSILOGICTASKSTATESGENTRY pSGInfo)1437 static void lsilogicR3CopyFromBufferIntoSGList(PPDMDEVINS pDevIns, PLSILOGICTASKSTATESGENTRY pSGInfo) 1411 1438 { 1412 1439 RTGCPHYS GCPhysBuffer = pSGInfo->u.GCPhysAddrBufferUnaligned; … … 1427 1454 * to read from which are unaligned. 1428 1455 */ 1429 static void lsilogic CopyFromSGListIntoBuffer(PPDMDEVINS pDevIns, PLSILOGICTASKSTATESGENTRY pSGInfo)1456 static void lsilogicR3CopyFromSGListIntoBuffer(PPDMDEVINS pDevIns, PLSILOGICTASKSTATESGENTRY pSGInfo) 1430 1457 { 1431 1458 RTGCPHYS GCPhysBuffer = pSGInfo->u.GCPhysAddrBufferUnaligned; … … 1437 1464 } 1438 1465 1439 static int lsilogic ScatterGatherListAllocate(PLSILOGICTASKSTATE pTaskState, uint32_t cSGList, uint32_t cSGInfo, uint32_t cbUnaligned)1466 static int lsilogicR3ScatterGatherListAllocate(PLSILOGICTASKSTATE pTaskState, uint32_t cSGList, uint32_t cSGInfo, uint32_t cbUnaligned) 1440 1467 { 1441 1468 if (pTaskState->cSGListSize < cSGList) … … 1528 1555 1529 1556 /* Make debugging easier. */ 1530 # ifdef DEBUG1557 # ifdef LOG_ENABLED 1531 1558 memset(pTaskState->pSGListHead, 0, pTaskState->cSGListSize * sizeof(RTSGSEG)); 1532 1559 memset(pTaskState->paSGEntries, 0, pTaskState->cSGInfoSize * sizeof(LSILOGICTASKSTATESGENTRY)); 1533 1560 if (pTaskState->pvBufferUnaligned) 1534 1561 memset(pTaskState->pvBufferUnaligned, 0, pTaskState->cbBufferUnaligned); 1535 # endif1562 # endif 1536 1563 return VINF_SUCCESS; 1537 1564 } … … 1541 1568 * 1542 1569 * @returns nothing. 1543 * @param p LsiLogic Pointer to the LsiLogic SCSI controller.1544 * @param pTaskState 1545 */ 1546 static void lsilogic ScatterGatherListDestroy(PLSILOGICSCSI pLsiLogic, PLSILOGICTASKSTATE pTaskState)1547 { 1548 PPDMDEVINS pDevIns = p LsiLogic->CTX_SUFF(pDevIns);1570 * @param pThis Pointer to the LsiLogic device state. 1571 * @param pTaskState Pointer to the task state. 1572 */ 1573 static void lsilogicR3ScatterGatherListDestroy(PLSILOGICSCSI pThis, PLSILOGICTASKSTATE pTaskState) 1574 { 1575 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 1549 1576 PLSILOGICTASKSTATESGENTRY pSGInfoCurr = pTaskState->paSGEntries; 1550 1577 … … 1559 1586 { 1560 1587 /* Copy the data into the guest segments now. */ 1561 lsilogic CopyFromBufferIntoSGList(pLsiLogic->CTX_SUFF(pDevIns), pSGInfoCurr);1588 lsilogicR3CopyFromBufferIntoSGList(pThis->CTX_SUFF(pDevIns), pSGInfoCurr); 1562 1589 } 1563 1590 … … 1567 1594 /* Free allocated memory if the list was too big too many times. */ 1568 1595 if (pTaskState->cSGListTooBig >= LSILOGIC_NR_OF_ALLOWED_BIGGER_LISTS) 1569 lsilogic TaskStateClear(pTaskState);1570 } 1571 1572 # ifdef DEBUG1596 lsilogicR3TaskStateClear(pTaskState); 1597 } 1598 1599 # ifdef LOG_ENABLED 1573 1600 /** 1574 1601 * Dump an SG entry. … … 1579 1606 static void lsilogicDumpSGEntry(PMptSGEntryUnion pSGEntry) 1580 1607 { 1581 switch (pSGEntry->Simple32.u2ElementType) 1582 { 1583 case MPTSGENTRYTYPE_SIMPLE: 1584 { 1585 Log(("%s: Dumping info for SIMPLE SG entry:\n", __FUNCTION__)); 1586 Log(("%s: u24Length=%u\n", __FUNCTION__, pSGEntry->Simple32.u24Length)); 1587 Log(("%s: fEndOfList=%d\n", __FUNCTION__, pSGEntry->Simple32.fEndOfList)); 1588 Log(("%s: f64BitAddress=%d\n", __FUNCTION__, pSGEntry->Simple32.f64BitAddress)); 1589 Log(("%s: fBufferContainsData=%d\n", __FUNCTION__, pSGEntry->Simple32.fBufferContainsData)); 1590 Log(("%s: fLocalAddress=%d\n", __FUNCTION__, pSGEntry->Simple32.fLocalAddress)); 1591 Log(("%s: fEndOfBuffer=%d\n", __FUNCTION__, pSGEntry->Simple32.fEndOfBuffer)); 1592 Log(("%s: fLastElement=%d\n", __FUNCTION__, pSGEntry->Simple32.fLastElement)); 1593 Log(("%s: u32DataBufferAddressLow=%u\n", __FUNCTION__, pSGEntry->Simple32.u32DataBufferAddressLow)); 1594 if (pSGEntry->Simple32.f64BitAddress) 1608 if (LogIsEnabled()) 1609 { 1610 switch (pSGEntry->Simple32.u2ElementType) 1611 { 1612 case MPTSGENTRYTYPE_SIMPLE: 1595 1613 { 1596 Log(("%s: u32DataBufferAddressHigh=%u\n", __FUNCTION__, pSGEntry->Simple64.u32DataBufferAddressHigh)); 1597 Log(("%s: GCDataBufferAddress=%RGp\n", __FUNCTION__, 1598 ((uint64_t)pSGEntry->Simple64.u32DataBufferAddressHigh << 32) | pSGEntry->Simple64.u32DataBufferAddressLow)); 1614 Log(("%s: Dumping info for SIMPLE SG entry:\n", __FUNCTION__)); 1615 Log(("%s: u24Length=%u\n", __FUNCTION__, pSGEntry->Simple32.u24Length)); 1616 Log(("%s: fEndOfList=%d\n", __FUNCTION__, pSGEntry->Simple32.fEndOfList)); 1617 Log(("%s: f64BitAddress=%d\n", __FUNCTION__, pSGEntry->Simple32.f64BitAddress)); 1618 Log(("%s: fBufferContainsData=%d\n", __FUNCTION__, pSGEntry->Simple32.fBufferContainsData)); 1619 Log(("%s: fLocalAddress=%d\n", __FUNCTION__, pSGEntry->Simple32.fLocalAddress)); 1620 Log(("%s: fEndOfBuffer=%d\n", __FUNCTION__, pSGEntry->Simple32.fEndOfBuffer)); 1621 Log(("%s: fLastElement=%d\n", __FUNCTION__, pSGEntry->Simple32.fLastElement)); 1622 Log(("%s: u32DataBufferAddressLow=%u\n", __FUNCTION__, pSGEntry->Simple32.u32DataBufferAddressLow)); 1623 if (pSGEntry->Simple32.f64BitAddress) 1624 { 1625 Log(("%s: u32DataBufferAddressHigh=%u\n", __FUNCTION__, pSGEntry->Simple64.u32DataBufferAddressHigh)); 1626 Log(("%s: GCDataBufferAddress=%RGp\n", __FUNCTION__, 1627 ((uint64_t)pSGEntry->Simple64.u32DataBufferAddressHigh << 32) 1628 | pSGEntry->Simple64.u32DataBufferAddressLow)); 1629 } 1630 else 1631 Log(("%s: GCDataBufferAddress=%RGp\n", __FUNCTION__, pSGEntry->Simple32.u32DataBufferAddressLow)); 1632 1633 break; 1599 1634 } 1600 else 1601 Log(("%s: GCDataBufferAddress=%RGp\n", __FUNCTION__, pSGEntry->Simple32.u32DataBufferAddressLow)); 1602 1603 break; 1604 } 1605 case MPTSGENTRYTYPE_CHAIN: 1606 { 1607 Log(("%s: Dumping info for CHAIN SG entry:\n", __FUNCTION__)); 1608 Log(("%s: u16Length=%u\n", __FUNCTION__, pSGEntry->Chain.u16Length)); 1609 Log(("%s: u8NExtChainOffset=%d\n", __FUNCTION__, pSGEntry->Chain.u8NextChainOffset)); 1610 Log(("%s: f64BitAddress=%d\n", __FUNCTION__, pSGEntry->Chain.f64BitAddress)); 1611 Log(("%s: fLocalAddress=%d\n", __FUNCTION__, pSGEntry->Chain.fLocalAddress)); 1612 Log(("%s: u32SegmentAddressLow=%u\n", __FUNCTION__, pSGEntry->Chain.u32SegmentAddressLow)); 1613 Log(("%s: u32SegmentAddressHigh=%u\n", __FUNCTION__, pSGEntry->Chain.u32SegmentAddressHigh)); 1614 if (pSGEntry->Chain.f64BitAddress) 1615 Log(("%s: GCSegmentAddress=%RGp\n", __FUNCTION__, 1616 ((uint64_t)pSGEntry->Chain.u32SegmentAddressHigh << 32) | pSGEntry->Chain.u32SegmentAddressLow)); 1617 else 1618 Log(("%s: GCSegmentAddress=%RGp\n", __FUNCTION__, pSGEntry->Chain.u32SegmentAddressLow)); 1619 break; 1620 } 1621 } 1622 } 1623 #endif 1635 case MPTSGENTRYTYPE_CHAIN: 1636 { 1637 Log(("%s: Dumping info for CHAIN SG entry:\n", __FUNCTION__)); 1638 Log(("%s: u16Length=%u\n", __FUNCTION__, pSGEntry->Chain.u16Length)); 1639 Log(("%s: u8NExtChainOffset=%d\n", __FUNCTION__, pSGEntry->Chain.u8NextChainOffset)); 1640 Log(("%s: f64BitAddress=%d\n", __FUNCTION__, pSGEntry->Chain.f64BitAddress)); 1641 Log(("%s: fLocalAddress=%d\n", __FUNCTION__, pSGEntry->Chain.fLocalAddress)); 1642 Log(("%s: u32SegmentAddressLow=%u\n", __FUNCTION__, pSGEntry->Chain.u32SegmentAddressLow)); 1643 Log(("%s: u32SegmentAddressHigh=%u\n", __FUNCTION__, pSGEntry->Chain.u32SegmentAddressHigh)); 1644 if (pSGEntry->Chain.f64BitAddress) 1645 Log(("%s: GCSegmentAddress=%RGp\n", __FUNCTION__, 1646 ((uint64_t)pSGEntry->Chain.u32SegmentAddressHigh << 32) | pSGEntry->Chain.u32SegmentAddressLow)); 1647 else 1648 Log(("%s: GCSegmentAddress=%RGp\n", __FUNCTION__, pSGEntry->Chain.u32SegmentAddressLow)); 1649 break; 1650 } 1651 } 1652 } 1653 } 1654 # endif /* LOG_ENABLED */ 1624 1655 1625 1656 /** … … 1627 1658 * 1628 1659 * @returns VBox status code. 1629 * @param p LsiLogic Pointer to the LsiLogic SCSI controller.1630 * @param pTaskState Pointer to the task state.1631 * @param GCPhysSGLStart Guest physical address of the first SG entry.1632 * @param uChainOffset Offset in bytes from the beginning of the SGL segment to the chain element.1660 * @param pThis Pointer to the LsiLogic device state. 1661 * @param pTaskState Pointer to the task state. 1662 * @param GCPhysSGLStart Guest physical address of the first SG entry. 1663 * @param uChainOffset Offset in bytes from the beginning of the SGL segment to the chain element. 1633 1664 * @thread EMT 1634 1665 */ 1635 static int lsilogic ScatterGatherListCreate(PLSILOGICSCSI pLsiLogic, PLSILOGICTASKSTATE pTaskState,1636 RTGCPHYS GCPhysSGLStart, uint32_t uChainOffset)1666 static int lsilogicR3ScatterGatherListCreate(PLSILOGICSCSI pThis, PLSILOGICTASKSTATE pTaskState, 1667 RTGCPHYS GCPhysSGLStart, uint32_t uChainOffset) 1637 1668 { 1638 1669 int rc = VINF_SUCCESS; 1639 PPDMDEVINS pDevIns = p LsiLogic->CTX_SUFF(pDevIns);1670 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 1640 1671 PVM pVM = PDMDevHlpGetVM(pDevIns); 1641 1672 bool fUnaligned; /* Flag whether the current buffer is unaligned. */ … … 1673 1704 1674 1705 /* The number of needed SG entries in R3 is known. Allocate needed memory. */ 1675 rc = lsilogic ScatterGatherListAllocate(pTaskState, cSGInfo, cSGInfo, cbUnalignedComplete);1706 rc = lsilogicR3ScatterGatherListAllocate(pTaskState, cSGInfo, cSGInfo, cbUnalignedComplete); 1676 1707 AssertMsgRC(rc, ("Failed to allocate scatter gather array rc=%Rrc\n", rc)); 1677 1708 … … 1698 1729 PDMDevHlpPhysRead(pDevIns, GCPhysSGEntryNext, &SGEntry, sizeof(MptSGEntryUnion)); 1699 1730 1700 # ifdef DEBUG1731 # ifdef LOG_ENABLED 1701 1732 lsilogicDumpSGEntry(&SGEntry); 1702 # endif1733 # endif 1703 1734 1704 1735 AssertMsg(SGEntry.Simple32.u2ElementType == MPTSGENTRYTYPE_SIMPLE, ("Invalid SG entry type\n")); … … 1735 1766 pSGInfoCurr->u.GCPhysAddrBufferUnaligned = GCPhysAddrDataBuffer; 1736 1767 if (fBufferContainsData) 1737 lsilogic CopyFromSGListIntoBuffer(pDevIns, pSGInfoCurr);1768 lsilogicR3CopyFromSGListIntoBuffer(pDevIns, pSGInfoCurr); 1738 1769 pSGInfoCurr++; 1739 1770 } … … 1829 1860 * crosses page boundaries. 1830 1861 */ 1831 # if 01862 # if 0 1832 1863 /** 1833 1864 * Free the sense buffer. … … 1836 1867 * @param pTaskState Pointer to the task state. 1837 1868 */ 1838 static void lsilogicFreeGCSenseBuffer(PLSILOGICSCSI p LsiLogic, PLSILOGICTASKSTATE pTaskState)1839 { 1840 PVM pVM = PDMDevHlpGetVM(p LsiLogic->CTX_SUFF(pDevIns));1869 static void lsilogicFreeGCSenseBuffer(PLSILOGICSCSI pThis, PLSILOGICTASKSTATE pTaskState) 1870 { 1871 PVM pVM = PDMDevHlpGetVM(pThis->CTX_SUFF(pDevIns)); 1841 1872 1842 1873 PGMPhysReleasePageMappingLock(pVM, &pTaskState->PageLockSense); … … 1851 1882 * @note Current assumption is that the sense buffer is not scattered and does not cross a page boundary. 1852 1883 */ 1853 static int lsilogic MapGCSenseBufferIntoR3(PLSILOGICSCSI pLsiLogic, PLSILOGICTASKSTATE pTaskState)1884 static int lsilogicR3MapGCSenseBufferIntoR3(PLSILOGICSCSI pThis, PLSILOGICTASKSTATE pTaskState) 1854 1885 { 1855 1886 int rc = VINF_SUCCESS; 1856 PPDMDEVINS pDevIns = p LsiLogic->CTX_SUFF(pDevIns);1887 PPDMDEVINS pDevIns = pThis->CTX_SUFF(pDevIns); 1857 1888 RTGCPHYS GCPhysAddrSenseBuffer; 1858 1889 1859 1890 GCPhysAddrSenseBuffer = pTaskState->GuestRequest.SCSIIO.u32SenseBufferLowAddress; 1860 GCPhysAddrSenseBuffer |= ((uint64_t)p LsiLogic->u32SenseBufferHighAddr << 32);1861 1862 # ifdef RT_STRICT1891 GCPhysAddrSenseBuffer |= ((uint64_t)pThis->u32SenseBufferHighAddr << 32); 1892 1893 # ifdef RT_STRICT 1863 1894 uint32_t cbSenseBuffer = pTaskState->GuestRequest.SCSIIO.u8SenseBufferLength; 1864 # endif1895 # endif 1865 1896 RTGCPHYS GCPhysAddrSenseBufferBase = PAGE_ADDRESS(GCPhysAddrSenseBuffer); 1866 1897 … … 1880 1911 return rc; 1881 1912 } 1882 #endif 1883 1884 #ifdef DEBUG 1885 static void lsilogicDumpSCSIIORequest(PMptSCSIIORequest pSCSIIORequest) 1886 { 1887 Log(("%s: u8TargetID=%d\n", __FUNCTION__, pSCSIIORequest->u8TargetID)); 1888 Log(("%s: u8Bus=%d\n", __FUNCTION__, pSCSIIORequest->u8Bus)); 1889 Log(("%s: u8ChainOffset=%d\n", __FUNCTION__, pSCSIIORequest->u8ChainOffset)); 1890 Log(("%s: u8Function=%d\n", __FUNCTION__, pSCSIIORequest->u8Function)); 1891 Log(("%s: u8CDBLength=%d\n", __FUNCTION__, pSCSIIORequest->u8CDBLength)); 1892 Log(("%s: u8SenseBufferLength=%d\n", __FUNCTION__, pSCSIIORequest->u8SenseBufferLength)); 1893 Log(("%s: u8MessageFlags=%d\n", __FUNCTION__, pSCSIIORequest->u8MessageFlags)); 1894 Log(("%s: u32MessageContext=%#x\n", __FUNCTION__, pSCSIIORequest->u32MessageContext)); 1895 for (unsigned i = 0; i < RT_ELEMENTS(pSCSIIORequest->au8LUN); i++) 1896 Log(("%s: u8LUN[%d]=%d\n", __FUNCTION__, i, pSCSIIORequest->au8LUN[i])); 1897 Log(("%s: u32Control=%#x\n", __FUNCTION__, pSCSIIORequest->u32Control)); 1898 for (unsigned i = 0; i < RT_ELEMENTS(pSCSIIORequest->au8CDB); i++) 1899 Log(("%s: u8CDB[%d]=%d\n", __FUNCTION__, i, pSCSIIORequest->au8CDB[i])); 1900 Log(("%s: u32DataLength=%#x\n", __FUNCTION__, pSCSIIORequest->u32DataLength)); 1901 Log(("%s: u32SenseBufferLowAddress=%#x\n", __FUNCTION__, pSCSIIORequest->u32SenseBufferLowAddress)); 1902 } 1903 #endif 1904 1905 static void lsilogicWarningDiskFull(PPDMDEVINS pDevIns) 1913 # endif 1914 1915 # ifdef LOG_ENABLED 1916 static void lsilogicR3DumpSCSIIORequest(PMptSCSIIORequest pSCSIIORequest) 1917 { 1918 if (LogIsEnabled()) 1919 { 1920 Log(("%s: u8TargetID=%d\n", __FUNCTION__, pSCSIIORequest->u8TargetID)); 1921 Log(("%s: u8Bus=%d\n", __FUNCTION__, pSCSIIORequest->u8Bus)); 1922 Log(("%s: u8ChainOffset=%d\n", __FUNCTION__, pSCSIIORequest->u8ChainOffset)); 1923 Log(("%s: u8Function=%d\n", __FUNCTION__, pSCSIIORequest->u8Function)); 1924 Log(("%s: u8CDBLength=%d\n", __FUNCTION__, pSCSIIORequest->u8CDBLength)); 1925 Log(("%s: u8SenseBufferLength=%d\n", __FUNCTION__, pSCSIIORequest->u8SenseBufferLength)); 1926 Log(("%s: u8MessageFlags=%d\n", __FUNCTION__, pSCSIIORequest->u8MessageFlags)); 1927 Log(("%s: u32MessageContext=%#x\n", __FUNCTION__, pSCSIIORequest->u32MessageContext)); 1928 for (unsigned i = 0; i < RT_ELEMENTS(pSCSIIORequest->au8LUN); i++) 1929 Log(("%s: u8LUN[%d]=%d\n", __FUNCTION__, i, pSCSIIORequest->au8LUN[i])); 1930 Log(("%s: u32Control=%#x\n", __FUNCTION__, pSCSIIORequest->u32Control)); 1931 for (unsigned i = 0; i < RT_ELEMENTS(pSCSIIORequest->au8CDB); i++) 1932 Log(("%s: u8CDB[%d]=%d\n", __FUNCTION__, i, pSCSIIORequest->au8CDB[i])); 1933 Log(("%s: u32DataLength=%#x\n", __FUNCTION__, pSCSIIORequest->u32DataLength)); 1934 Log(("%s: u32SenseBufferLowAddress=%#x\n", __FUNCTION__, pSCSIIORequest->u32SenseBufferLowAddress)); 1935 } 1936 } 1937 # endif 1938 1939 static void lsilogicR3WarningDiskFull(PPDMDEVINS pDevIns) 1906 1940 { 1907 1941 int rc; … … 1912 1946 } 1913 1947 1914 static void lsilogic WarningFileTooBig(PPDMDEVINS pDevIns)1948 static void lsilogicR3WarningFileTooBig(PPDMDEVINS pDevIns) 1915 1949 { 1916 1950 int rc; … … 1921 1955 } 1922 1956 1923 static void lsilogic WarningISCSI(PPDMDEVINS pDevIns)1957 static void lsilogicR3WarningISCSI(PPDMDEVINS pDevIns) 1924 1958 { 1925 1959 int rc; … … 1930 1964 } 1931 1965 1932 static void lsilogic WarningUnknown(PPDMDEVINS pDevIns, int rc)1966 static void lsilogicR3WarningUnknown(PPDMDEVINS pDevIns, int rc) 1933 1967 { 1934 1968 int rc2; … … 1939 1973 } 1940 1974 1941 static void lsilogicR edoSetWarning(PLSILOGICSCSI pThis, int rc)1975 static void lsilogicR3RedoSetWarning(PLSILOGICSCSI pThis, int rc) 1942 1976 { 1943 1977 if (rc == VERR_DISK_FULL) 1944 lsilogic WarningDiskFull(pThis->CTX_SUFF(pDevIns));1978 lsilogicR3WarningDiskFull(pThis->CTX_SUFF(pDevIns)); 1945 1979 else if (rc == VERR_FILE_TOO_BIG) 1946 lsilogic WarningFileTooBig(pThis->CTX_SUFF(pDevIns));1980 lsilogicR3WarningFileTooBig(pThis->CTX_SUFF(pDevIns)); 1947 1981 else if (rc == VERR_BROKEN_PIPE || rc == VERR_NET_CONNECTION_REFUSED) 1948 1982 { 1949 1983 /* iSCSI connection abort (first error) or failure to reestablish 1950 1984 * connection (second error). Pause VM. On resume we'll retry. */ 1951 lsilogic WarningISCSI(pThis->CTX_SUFF(pDevIns));1985 lsilogicR3WarningISCSI(pThis->CTX_SUFF(pDevIns)); 1952 1986 } 1953 1987 else 1954 lsilogic WarningUnknown(pThis->CTX_SUFF(pDevIns), rc);1988 lsilogicR3WarningUnknown(pThis->CTX_SUFF(pDevIns), rc); 1955 1989 } 1956 1990 … … 1963 1997 * 1964 1998 * @returns VBox status code. 1965 * @param p LsiLogic Pointer to the device instance which sends the request.1966 * @param pTaskState 1967 */ 1968 static int lsilogic ProcessSCSIIORequest(PLSILOGICSCSI pLsiLogic, PLSILOGICTASKSTATE pTaskState)1999 * @param pThis Pointer to the LsiLogic device state. 2000 * @param pTaskState Pointer to the task state data. 2001 */ 2002 static int lsilogicR3ProcessSCSIIORequest(PLSILOGICSCSI pThis, PLSILOGICTASKSTATE pTaskState) 1969 2003 { 1970 2004 int rc = VINF_SUCCESS; 1971 2005 1972 # ifdef DEBUG1973 lsilogic DumpSCSIIORequest(&pTaskState->GuestRequest.SCSIIO);1974 # endif2006 # ifdef LOG_ENABLED 2007 lsilogicR3DumpSCSIIORequest(&pTaskState->GuestRequest.SCSIIO); 2008 # endif 1975 2009 1976 2010 pTaskState->fBIOS = false; 1977 2011 1978 if (RT_LIKELY( (pTaskState->GuestRequest.SCSIIO.u8TargetID < p LsiLogic->cDeviceStates)2012 if (RT_LIKELY( (pTaskState->GuestRequest.SCSIIO.u8TargetID < pThis->cDeviceStates) 1979 2013 && (pTaskState->GuestRequest.SCSIIO.u8Bus == 0))) 1980 2014 { 1981 2015 PLSILOGICDEVICE pTargetDevice; 1982 pTargetDevice = &p LsiLogic->paDeviceStates[pTaskState->GuestRequest.SCSIIO.u8TargetID];2016 pTargetDevice = &pThis->paDeviceStates[pTaskState->GuestRequest.SCSIIO.u8TargetID]; 1983 2017 1984 2018 if (pTargetDevice->pDrvBase) … … 1992 2026 uChainOffset = uChainOffset * sizeof(uint32_t) - sizeof(MptSCSIIORequest); 1993 2027 1994 rc = lsilogic ScatterGatherListCreate(pLsiLogic, pTaskState,2028 rc = lsilogicR3ScatterGatherListCreate(pThis, pTaskState, 1995 2029 pTaskState->GCPhysMessageFrameAddr + sizeof(MptSCSIIORequest), 1996 2030 uChainOffset); 1997 2031 AssertRC(rc); 1998 2032 1999 # if 02033 # if 0 2000 2034 /* Map sense buffer. */ 2001 rc = lsilogic MapGCSenseBufferIntoR3(pLsiLogic, pTaskState);2035 rc = lsilogicR3MapGCSenseBufferIntoR3(pThis, pTaskState); 2002 2036 AssertRC(rc); 2003 # endif2037 # endif 2004 2038 2005 2039 /* Setup the SCSI request. */ … … 2050 2084 if (g_cLogged++ < MAX_REL_LOG_ERRORS) 2051 2085 { 2052 LogRel(("LsiLogic#%d: %d/%d (Bus/Target) doesn't exist\n", p LsiLogic->CTX_SUFF(pDevIns)->iInstance,2086 LogRel(("LsiLogic#%d: %d/%d (Bus/Target) doesn't exist\n", pThis->CTX_SUFF(pDevIns)->iInstance, 2053 2087 pTaskState->GuestRequest.SCSIIO.u8TargetID, pTaskState->GuestRequest.SCSIIO.u8Bus)); 2054 2088 /* Log the CDB too */ 2055 2089 LogRel(("LsiLogic#%d: Guest issued CDB {%#x", 2056 p LsiLogic->CTX_SUFF(pDevIns)->iInstance, pTaskState->GuestRequest.SCSIIO.au8CDB[0]));2090 pThis->CTX_SUFF(pDevIns)->iInstance, pTaskState->GuestRequest.SCSIIO.au8CDB[0])); 2057 2091 for (unsigned i = 1; i < pTaskState->GuestRequest.SCSIIO.u8CDBLength; i++) 2058 2092 LogRel((", %#x", pTaskState->GuestRequest.SCSIIO.au8CDB[i])); … … 2075 2109 pTaskState->IOCReply.SCSIIOError.u32ResponseInfo = 0; 2076 2110 2077 lsilogicFinishAddressReply(p LsiLogic, &pTaskState->IOCReply, false);2078 RTMemCacheFree(p LsiLogic->hTaskCache, pTaskState);2111 lsilogicFinishAddressReply(pThis, &pTaskState->IOCReply, false); 2112 RTMemCacheFree(pThis->hTaskCache, pTaskState); 2079 2113 2080 2114 return rc; … … 2082 2116 2083 2117 2084 static DECLCALLBACK(int) lsilogicDeviceSCSIRequestCompleted(PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest, 2085 int rcCompletion, bool fRedo, int rcReq) 2118 /** 2119 * @interface_method_impl{PDMISCSIPORT,pfnSCSIRequestCompleted} 2120 */ 2121 static DECLCALLBACK(int) lsilogicR3DeviceSCSIRequestCompleted(PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest, 2122 int rcCompletion, bool fRedo, int rcReq) 2086 2123 { 2087 2124 PLSILOGICTASKSTATE pTaskState = (PLSILOGICTASKSTATE)pSCSIRequest->pvUser; 2088 2125 PLSILOGICDEVICE pLsiLogicDevice = pTaskState->pTargetDevice; 2089 PLSILOGICSCSI p LsiLogic= pLsiLogicDevice->CTX_SUFF(pLsiLogic);2126 PLSILOGICSCSI pThis = pLsiLogicDevice->CTX_SUFF(pLsiLogic); 2090 2127 2091 2128 /* If the task failed but it is possible to redo it again after a suspend … … 2094 2131 { 2095 2132 if (!pTaskState->fBIOS) 2096 lsilogic ScatterGatherListDestroy(pLsiLogic, pTaskState);2133 lsilogicR3ScatterGatherListDestroy(pThis, pTaskState); 2097 2134 2098 2135 /* Add to the list. */ 2099 2136 do 2100 2137 { 2101 pTaskState->pRedoNext = ASMAtomicReadPtrT(&p LsiLogic->pTasksRedoHead, PLSILOGICTASKSTATE);2102 } while (!ASMAtomicCmpXchgPtr(&p LsiLogic->pTasksRedoHead, pTaskState, pTaskState->pRedoNext));2138 pTaskState->pRedoNext = ASMAtomicReadPtrT(&pThis->pTasksRedoHead, PLSILOGICTASKSTATE); 2139 } while (!ASMAtomicCmpXchgPtr(&pThis->pTasksRedoHead, pTaskState, pTaskState->pRedoNext)); 2103 2140 2104 2141 /* Suspend the VM if not done already. */ 2105 if (!ASMAtomicXchgBool(&p LsiLogic->fRedo, true))2106 lsilogicR edoSetWarning(pLsiLogic, rcReq);2142 if (!ASMAtomicXchgBool(&pThis->fRedo, true)) 2143 lsilogicR3RedoSetWarning(pThis, rcReq); 2107 2144 } 2108 2145 else … … 2110 2147 if (RT_UNLIKELY(pTaskState->fBIOS)) 2111 2148 { 2112 int rc = vboxscsiRequestFinished(&p LsiLogic->VBoxSCSI, pSCSIRequest, rcCompletion);2149 int rc = vboxscsiRequestFinished(&pThis->VBoxSCSI, pSCSIRequest, rcCompletion); 2113 2150 AssertMsgRC(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc)); 2114 2151 } 2115 2152 else 2116 2153 { 2117 # if 02118 lsilogicFreeGCSenseBuffer(p LsiLogic, pTaskState);2119 # else2154 # if 0 2155 lsilogicFreeGCSenseBuffer(pThis, pTaskState); 2156 # else 2120 2157 RTGCPHYS GCPhysAddrSenseBuffer; 2121 2158 2122 2159 GCPhysAddrSenseBuffer = pTaskState->GuestRequest.SCSIIO.u32SenseBufferLowAddress; 2123 GCPhysAddrSenseBuffer |= ((uint64_t)p LsiLogic->u32SenseBufferHighAddr << 32);2160 GCPhysAddrSenseBuffer |= ((uint64_t)pThis->u32SenseBufferHighAddr << 32); 2124 2161 2125 2162 /* Copy the sense buffer over. */ 2126 PDMDevHlpPhysWrite(p LsiLogic->CTX_SUFF(pDevIns), GCPhysAddrSenseBuffer, pTaskState->abSenseBuffer,2163 PDMDevHlpPhysWrite(pThis->CTX_SUFF(pDevIns), GCPhysAddrSenseBuffer, pTaskState->abSenseBuffer, 2127 2164 RT_UNLIKELY(pTaskState->GuestRequest.SCSIIO.u8SenseBufferLength < pTaskState->PDMScsiRequest.cbSenseBuffer) 2128 2165 ? pTaskState->GuestRequest.SCSIIO.u8SenseBufferLength 2129 2166 : pTaskState->PDMScsiRequest.cbSenseBuffer); 2130 # endif2131 lsilogic ScatterGatherListDestroy(pLsiLogic, pTaskState);2167 # endif 2168 lsilogicR3ScatterGatherListDestroy(pThis, pTaskState); 2132 2169 2133 2170 2134 2171 if (RT_LIKELY(rcCompletion == SCSI_STATUS_OK)) 2135 lsilogic FinishContextReply(pLsiLogic, pTaskState->GuestRequest.SCSIIO.u32MessageContext);2172 lsilogicR3FinishContextReply(pThis, pTaskState->GuestRequest.SCSIIO.u32MessageContext); 2136 2173 else 2137 2174 { … … 2154 2191 pTaskState->IOCReply.SCSIIOError.u32ResponseInfo = 0; 2155 2192 2156 lsilogicFinishAddressReply(p LsiLogic, &pTaskState->IOCReply, true);2193 lsilogicFinishAddressReply(pThis, &pTaskState->IOCReply, true); 2157 2194 } 2158 2195 } 2159 2196 2160 RTMemCacheFree(p LsiLogic->hTaskCache, pTaskState);2197 RTMemCacheFree(pThis->hTaskCache, pTaskState); 2161 2198 } 2162 2199 2163 2200 ASMAtomicDecU32(&pLsiLogicDevice->cOutstandingRequests); 2164 2201 2165 if (pLsiLogicDevice->cOutstandingRequests == 0 && p LsiLogic->fSignalIdle)2166 PDMDevHlpAsyncNotificationCompleted(p LsiLogic->pDevInsR3);2202 if (pLsiLogicDevice->cOutstandingRequests == 0 && pThis->fSignalIdle) 2203 PDMDevHlpAsyncNotificationCompleted(pThis->pDevInsR3); 2167 2204 2168 2205 return VINF_SUCCESS; 2169 2206 } 2170 2207 2171 static DECLCALLBACK(int) lsilogicQueryDeviceLocation(PPDMISCSIPORT pInterface, const char **ppcszController, 2172 uint32_t *piInstance, uint32_t *piLUN) 2173 { 2174 PLSILOGICDEVICE pLsiLogicDevice = PDMISCSIPORT_2_PLSILOGICDEVICE(pInterface); 2208 /** 2209 * @interface_method_impl{PDMISCSIPORT,pfnQueryDeviceLocation} 2210 */ 2211 static DECLCALLBACK(int) lsilogicR3QueryDeviceLocation(PPDMISCSIPORT pInterface, const char **ppcszController, 2212 uint32_t *piInstance, uint32_t *piLUN) 2213 { 2214 PLSILOGICDEVICE pLsiLogicDevice = RT_FROM_MEMBER(pInterface, LSILOGICDEVICE, ISCSIPort); 2175 2215 PPDMDEVINS pDevIns = pLsiLogicDevice->CTX_SUFF(pLsiLogic)->CTX_SUFF(pDevIns); 2176 2216 … … 2196 2236 * @param ppbPageData Where to store the pointer to the page data. 2197 2237 */ 2198 static int lsilogic ConfigurationIOUnitPageGetFromNumber(PLSILOGICSCSI pLsiLogic,2199 PMptConfigurationPagesSupported pPages,2200 uint8_t u8PageNumber,2201 PMptConfigurationPageHeader *ppPageHeader,2202 uint8_t **ppbPageData, size_t *pcbPage)2238 static int lsilogicR3ConfigurationIOUnitPageGetFromNumber(PLSILOGICSCSI pThis, 2239 PMptConfigurationPagesSupported pPages, 2240 uint8_t u8PageNumber, 2241 PMptConfigurationPageHeader *ppPageHeader, 2242 uint8_t **ppbPageData, size_t *pcbPage) 2203 2243 { 2204 2244 int rc = VINF_SUCCESS; 2205 2245 2206 Assert Msg(VALID_PTR(ppPageHeader) && VALID_PTR(ppbPageData), ("Invalid parameters\n"));2207 2208 switch (u8PageNumber)2246 AssertPtr(ppPageHeader); Assert(ppbPageData); 2247 2248 switch (u8PageNumber) 2209 2249 { 2210 2250 case 0: … … 2250 2290 * @param ppbPageData Where to store the pointer to the page data. 2251 2291 */ 2252 static int lsilogic ConfigurationIOCPageGetFromNumber(PLSILOGICSCSI pLsiLogic,2253 PMptConfigurationPagesSupported pPages,2254 uint8_t u8PageNumber,2255 PMptConfigurationPageHeader *ppPageHeader,2256 uint8_t **ppbPageData, size_t *pcbPage)2292 static int lsilogicR3ConfigurationIOCPageGetFromNumber(PLSILOGICSCSI pThis, 2293 PMptConfigurationPagesSupported pPages, 2294 uint8_t u8PageNumber, 2295 PMptConfigurationPageHeader *ppPageHeader, 2296 uint8_t **ppbPageData, size_t *pcbPage) 2257 2297 { 2258 2298 int rc = VINF_SUCCESS; 2259 2299 2260 Assert Msg(VALID_PTR(ppPageHeader) && VALID_PTR(ppbPageData), ("Invalid parameters\n"));2261 2262 switch (u8PageNumber)2300 AssertPtr(ppPageHeader); Assert(ppbPageData); 2301 2302 switch (u8PageNumber) 2263 2303 { 2264 2304 case 0: … … 2309 2349 * @param ppbPageData Where to store the pointer to the page data. 2310 2350 */ 2311 static int lsilogic ConfigurationManufacturingPageGetFromNumber(PLSILOGICSCSI pLsiLogic,2312 PMptConfigurationPagesSupported pPages,2313 uint8_t u8PageNumber,2314 PMptConfigurationPageHeader *ppPageHeader,2315 uint8_t **ppbPageData, size_t *pcbPage)2351 static int lsilogicR3ConfigurationManufacturingPageGetFromNumber(PLSILOGICSCSI pThis, 2352 PMptConfigurationPagesSupported pPages, 2353 uint8_t u8PageNumber, 2354 PMptConfigurationPageHeader *ppPageHeader, 2355 uint8_t **ppbPageData, size_t *pcbPage) 2316 2356 { 2317 2357 int rc = VINF_SUCCESS; 2318 2358 2319 Assert Msg(VALID_PTR(ppPageHeader) && VALID_PTR(ppbPageData), ("Invalid parameters\n"));2320 2321 switch (u8PageNumber)2359 AssertPtr(ppPageHeader); Assert(ppbPageData); 2360 2361 switch (u8PageNumber) 2322 2362 { 2323 2363 case 0: … … 2357 2397 break; 2358 2398 case 7: 2359 if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS)2399 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 2360 2400 { 2361 2401 *ppPageHeader = &pPages->u.SasPages.pManufacturingPage7->u.fields.Header; … … 2398 2438 * @param ppbPageData Where to store the pointer to the page data. 2399 2439 */ 2400 static int lsilogic ConfigurationBiosPageGetFromNumber(PLSILOGICSCSI pLsiLogic,2401 PMptConfigurationPagesSupported pPages,2402 uint8_t u8PageNumber,2403 PMptConfigurationPageHeader *ppPageHeader,2404 uint8_t **ppbPageData, size_t *pcbPage)2440 static int lsilogicR3ConfigurationBiosPageGetFromNumber(PLSILOGICSCSI pThis, 2441 PMptConfigurationPagesSupported pPages, 2442 uint8_t u8PageNumber, 2443 PMptConfigurationPageHeader *ppPageHeader, 2444 uint8_t **ppbPageData, size_t *pcbPage) 2405 2445 { 2406 2446 int rc = VINF_SUCCESS; 2407 2447 2408 Assert Msg(VALID_PTR(ppPageHeader) && VALID_PTR(ppbPageData), ("Invalid parameters\n"));2409 2410 switch (u8PageNumber)2448 AssertPtr(ppPageHeader); Assert(ppbPageData); 2449 2450 switch (u8PageNumber) 2411 2451 { 2412 2452 case 1: … … 2442 2482 * @param ppbPageData Where to store the pointer to the page data. 2443 2483 */ 2444 static int lsilogic ConfigurationSCSISPIPortPageGetFromNumber(PLSILOGICSCSI pLsiLogic,2445 PMptConfigurationPagesSupported pPages,2446 uint8_t u8Port,2447 uint8_t u8PageNumber,2448 PMptConfigurationPageHeader *ppPageHeader,2449 uint8_t **ppbPageData, size_t *pcbPage)2484 static int lsilogicR3ConfigurationSCSISPIPortPageGetFromNumber(PLSILOGICSCSI pThis, 2485 PMptConfigurationPagesSupported pPages, 2486 uint8_t u8Port, 2487 uint8_t u8PageNumber, 2488 PMptConfigurationPageHeader *ppPageHeader, 2489 uint8_t **ppbPageData, size_t *pcbPage) 2450 2490 { 2451 2491 int rc = VINF_SUCCESS; 2452 2453 AssertMsg(VALID_PTR(ppPageHeader) && VALID_PTR(ppbPageData), ("Invalid parameters\n")); 2492 AssertPtr(ppPageHeader); Assert(ppbPageData); 2493 2454 2494 2455 2495 if (u8Port >= RT_ELEMENTS(pPages->u.SpiPages.aPortPages)) 2456 2496 return VERR_NOT_FOUND; 2457 2497 2458 switch (u8PageNumber)2498 switch (u8PageNumber) 2459 2499 { 2460 2500 case 0: … … 2490 2530 * @param ppbPageData Where to store the pointer to the page data. 2491 2531 */ 2492 static int lsilogic ConfigurationSCSISPIDevicePageGetFromNumber(PLSILOGICSCSI pLsiLogic,2493 PMptConfigurationPagesSupported pPages,2494 uint8_t u8Bus,2495 uint8_t u8TargetID, uint8_t u8PageNumber,2496 PMptConfigurationPageHeader *ppPageHeader,2497 uint8_t **ppbPageData, size_t *pcbPage)2532 static int lsilogicR3ConfigurationSCSISPIDevicePageGetFromNumber(PLSILOGICSCSI pThis, 2533 PMptConfigurationPagesSupported pPages, 2534 uint8_t u8Bus, 2535 uint8_t u8TargetID, uint8_t u8PageNumber, 2536 PMptConfigurationPageHeader *ppPageHeader, 2537 uint8_t **ppbPageData, size_t *pcbPage) 2498 2538 { 2499 2539 int rc = VINF_SUCCESS; 2500 2501 AssertMsg(VALID_PTR(ppPageHeader) && VALID_PTR(ppbPageData), ("Invalid parameters\n")); 2540 AssertPtr(ppPageHeader); Assert(ppbPageData); 2502 2541 2503 2542 if (u8Bus >= RT_ELEMENTS(pPages->u.SpiPages.aBuses)) … … 2507 2546 return VERR_NOT_FOUND; 2508 2547 2509 switch (u8PageNumber)2548 switch (u8PageNumber) 2510 2549 { 2511 2550 case 0: … … 2536 2575 } 2537 2576 2538 static int lsilogic ConfigurationSASIOUnitPageGetFromNumber(PLSILOGICSCSI pLsiLogic,2539 PMptConfigurationPagesSupported pPages,2540 uint8_t u8PageNumber,2541 PMptExtendedConfigurationPageHeader *ppPageHeader,2542 uint8_t **ppbPageData, size_t *pcbPage)2577 static int lsilogicR3ConfigurationSASIOUnitPageGetFromNumber(PLSILOGICSCSI pThis, 2578 PMptConfigurationPagesSupported pPages, 2579 uint8_t u8PageNumber, 2580 PMptExtendedConfigurationPageHeader *ppPageHeader, 2581 uint8_t **ppbPageData, size_t *pcbPage) 2543 2582 { 2544 2583 int rc = VINF_SUCCESS; 2545 2584 2546 switch (u8PageNumber)2585 switch (u8PageNumber) 2547 2586 { 2548 2587 case 0: … … 2573 2612 } 2574 2613 2575 static int lsilogic ConfigurationSASPHYPageGetFromNumber(PLSILOGICSCSI pLsiLogic,2576 PMptConfigurationPagesSupported pPages,2577 uint8_t u8PageNumber,2578 MptConfigurationPageAddress PageAddress,2579 PMptExtendedConfigurationPageHeader *ppPageHeader,2580 uint8_t **ppbPageData, size_t *pcbPage)2614 static int lsilogicR3ConfigurationSASPHYPageGetFromNumber(PLSILOGICSCSI pThis, 2615 PMptConfigurationPagesSupported pPages, 2616 uint8_t u8PageNumber, 2617 MptConfigurationPageAddress PageAddress, 2618 PMptExtendedConfigurationPageHeader *ppPageHeader, 2619 uint8_t **ppbPageData, size_t *pcbPage) 2581 2620 { 2582 2621 int rc = VINF_SUCCESS; … … 2614 2653 if (pPHYPages) 2615 2654 { 2616 switch (u8PageNumber)2655 switch (u8PageNumber) 2617 2656 { 2618 2657 case 0: … … 2636 2675 } 2637 2676 2638 static int lsilogic ConfigurationSASDevicePageGetFromNumber(PLSILOGICSCSI pLsiLogic,2639 PMptConfigurationPagesSupported pPages,2640 uint8_t u8PageNumber,2641 MptConfigurationPageAddress PageAddress,2642 PMptExtendedConfigurationPageHeader *ppPageHeader,2643 uint8_t **ppbPageData, size_t *pcbPage)2677 static int lsilogicR3ConfigurationSASDevicePageGetFromNumber(PLSILOGICSCSI pThis, 2678 PMptConfigurationPagesSupported pPages, 2679 uint8_t u8PageNumber, 2680 MptConfigurationPageAddress PageAddress, 2681 PMptExtendedConfigurationPageHeader *ppPageHeader, 2682 uint8_t **ppbPageData, size_t *pcbPage) 2644 2683 { 2645 2684 int rc = VINF_SUCCESS; … … 2700 2739 if (pSASDevice) 2701 2740 { 2702 switch (u8PageNumber)2741 switch (u8PageNumber) 2703 2742 { 2704 2743 case 0: … … 2731 2770 * @returns VINF_SUCCESS if successful 2732 2771 * VERR_NOT_FOUND if the requested page could be found. 2733 * @param p LsiLogic The LsiLogic controller instance.2772 * @param pThis Pointer to the LsiLogic device state. 2734 2773 * @param pConfigurationReq The configuration request. 2735 2774 * @param u8PageNumber Number of the page to get. … … 2737 2776 * @param ppbPageData Where to store the pointer to the page data. 2738 2777 */ 2739 static int lsilogic ConfigurationPageGetExtended(PLSILOGICSCSI pLsiLogic, PMptConfigurationRequest pConfigurationReq,2740 PMptExtendedConfigurationPageHeader *ppPageHeader,2741 uint8_t **ppbPageData, size_t *pcbPage)2778 static int lsilogicR3ConfigurationPageGetExtended(PLSILOGICSCSI pThis, PMptConfigurationRequest pConfigurationReq, 2779 PMptExtendedConfigurationPageHeader *ppPageHeader, 2780 uint8_t **ppbPageData, size_t *pcbPage) 2742 2781 { 2743 2782 int rc = VINF_SUCCESS; … … 2751 2790 case MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_SASIOUNIT: 2752 2791 { 2753 rc = lsilogic ConfigurationSASIOUnitPageGetFromNumber(pLsiLogic,2754 p LsiLogic->pConfigurationPages,2792 rc = lsilogicR3ConfigurationSASIOUnitPageGetFromNumber(pThis, 2793 pThis->pConfigurationPages, 2755 2794 pConfigurationReq->u8PageNumber, 2756 2795 ppPageHeader, ppbPageData, pcbPage); … … 2759 2798 case MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_SASPHYS: 2760 2799 { 2761 rc = lsilogic ConfigurationSASPHYPageGetFromNumber(pLsiLogic,2762 p LsiLogic->pConfigurationPages,2800 rc = lsilogicR3ConfigurationSASPHYPageGetFromNumber(pThis, 2801 pThis->pConfigurationPages, 2763 2802 pConfigurationReq->u8PageNumber, 2764 2803 pConfigurationReq->PageAddress, … … 2768 2807 case MPT_CONFIGURATION_PAGE_TYPE_EXTENDED_SASDEVICE: 2769 2808 { 2770 rc = lsilogic ConfigurationSASDevicePageGetFromNumber(pLsiLogic,2771 p LsiLogic->pConfigurationPages,2809 rc = lsilogicR3ConfigurationSASDevicePageGetFromNumber(pThis, 2810 pThis->pConfigurationPages, 2772 2811 pConfigurationReq->u8PageNumber, 2773 2812 pConfigurationReq->PageAddress, … … 2788 2827 * 2789 2828 * @returns VBox status code. 2790 * @param p LsiLogic Pointer to the device instance which sends the request.2791 * @param pConfigurationReq 2792 * @param pReply 2793 */ 2794 static int lsilogic ProcessConfigurationRequest(PLSILOGICSCSI pLsiLogic, PMptConfigurationRequest pConfigurationReq,2795 PMptConfigurationReply pReply)2829 * @param pThis Pointer to the LsiLogic device state. 2830 * @param pConfigurationReq Pointer to the request structure. 2831 * @param pReply Pointer to the reply message frame 2832 */ 2833 static int lsilogicR3ProcessConfigurationRequest(PLSILOGICSCSI pThis, PMptConfigurationRequest pConfigurationReq, 2834 PMptConfigurationReply pReply) 2796 2835 { 2797 2836 int rc = VINF_SUCCESS; … … 2803 2842 size_t cbPage = 0; 2804 2843 2805 LogFlowFunc(("p LsiLogic=%#p\n", pLsiLogic));2844 LogFlowFunc(("pThis=%#p\n", pThis)); 2806 2845 2807 2846 u8PageType = MPT_CONFIGURATION_PAGE_TYPE_GET(pConfigurationReq->u8PageType); … … 2826 2865 { 2827 2866 /* Get the page data. */ 2828 rc = lsilogic ConfigurationIOUnitPageGetFromNumber(pLsiLogic,2829 p LsiLogic->pConfigurationPages,2867 rc = lsilogicR3ConfigurationIOUnitPageGetFromNumber(pThis, 2868 pThis->pConfigurationPages, 2830 2869 pConfigurationReq->u8PageNumber, 2831 2870 &pPageHeader, &pbPageData, &cbPage); … … 2835 2874 { 2836 2875 /* Get the page data. */ 2837 rc = lsilogic ConfigurationIOCPageGetFromNumber(pLsiLogic,2838 p LsiLogic->pConfigurationPages,2876 rc = lsilogicR3ConfigurationIOCPageGetFromNumber(pThis, 2877 pThis->pConfigurationPages, 2839 2878 pConfigurationReq->u8PageNumber, 2840 2879 &pPageHeader, &pbPageData, &cbPage); … … 2844 2883 { 2845 2884 /* Get the page data. */ 2846 rc = lsilogic ConfigurationManufacturingPageGetFromNumber(pLsiLogic,2847 p LsiLogic->pConfigurationPages,2885 rc = lsilogicR3ConfigurationManufacturingPageGetFromNumber(pThis, 2886 pThis->pConfigurationPages, 2848 2887 pConfigurationReq->u8PageNumber, 2849 2888 &pPageHeader, &pbPageData, &cbPage); … … 2853 2892 { 2854 2893 /* Get the page data. */ 2855 rc = lsilogic ConfigurationSCSISPIPortPageGetFromNumber(pLsiLogic,2856 p LsiLogic->pConfigurationPages,2894 rc = lsilogicR3ConfigurationSCSISPIPortPageGetFromNumber(pThis, 2895 pThis->pConfigurationPages, 2857 2896 pConfigurationReq->PageAddress.MPIPortNumber.u8PortNumber, 2858 2897 pConfigurationReq->u8PageNumber, … … 2863 2902 { 2864 2903 /* Get the page data. */ 2865 rc = lsilogic ConfigurationSCSISPIDevicePageGetFromNumber(pLsiLogic,2866 p LsiLogic->pConfigurationPages,2904 rc = lsilogicR3ConfigurationSCSISPIDevicePageGetFromNumber(pThis, 2905 pThis->pConfigurationPages, 2867 2906 pConfigurationReq->PageAddress.BusAndTargetId.u8Bus, 2868 2907 pConfigurationReq->PageAddress.BusAndTargetId.u8TargetID, … … 2873 2912 case MPT_CONFIGURATION_PAGE_TYPE_BIOS: 2874 2913 { 2875 rc = lsilogic ConfigurationBiosPageGetFromNumber(pLsiLogic,2876 p LsiLogic->pConfigurationPages,2914 rc = lsilogicR3ConfigurationBiosPageGetFromNumber(pThis, 2915 pThis->pConfigurationPages, 2877 2916 pConfigurationReq->u8PageNumber, 2878 2917 &pPageHeader, &pbPageData, &cbPage); … … 2881 2920 case MPT_CONFIGURATION_PAGE_TYPE_EXTENDED: 2882 2921 { 2883 rc = lsilogic ConfigurationPageGetExtended(pLsiLogic,2922 rc = lsilogicR3ConfigurationPageGetExtended(pThis, 2884 2923 pConfigurationReq, 2885 2924 &pExtPageHeader, &pbPageData, &cbPage); … … 2946 2985 GCPhysAddrPageBuffer |= (uint64_t)pConfigurationReq->SimpleSGElement.u32DataBufferAddressHigh << 32; 2947 2986 2948 PDMDevHlpPhysWrite(p LsiLogic->CTX_SUFF(pDevIns), GCPhysAddrPageBuffer, pbPageData,2987 PDMDevHlpPhysWrite(pThis->CTX_SUFF(pDevIns), GCPhysAddrPageBuffer, pbPageData, 2949 2988 RT_MIN(cbBuffer, cbPage)); 2950 2989 } … … 2963 3002 LogFlow(("cbBuffer=%u cbPage=%u\n", cbBuffer, cbPage)); 2964 3003 2965 PDMDevHlpPhysRead(p LsiLogic->CTX_SUFF(pDevIns), GCPhysAddrPageBuffer, pbPageData,3004 PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), GCPhysAddrPageBuffer, pbPageData, 2966 3005 RT_MIN(cbBuffer, cbPage)); 2967 3006 } … … 2979 3018 * 2980 3019 * @returns nothing 2981 * @param p LsiLogic Pointer to the Lsilogic SCSI instance.2982 */ 2983 static void lsilogic InitializeConfigurationPagesSpi(PLSILOGICSCSI pLsiLogic)2984 { 2985 PMptConfigurationPagesSpi pPages = &p LsiLogic->pConfigurationPages->u.SpiPages;2986 2987 AssertMsg(p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI, ("Controller is not the SPI SCSI one\n"));2988 2989 LogFlowFunc(("p LsiLogic=%#p\n", pLsiLogic));3020 * @param pThis Pointer to the LsiLogic device state. 3021 */ 3022 static void lsilogicR3InitializeConfigurationPagesSpi(PLSILOGICSCSI pThis) 3023 { 3024 PMptConfigurationPagesSpi pPages = &pThis->pConfigurationPages->u.SpiPages; 3025 3026 AssertMsg(pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI, ("Controller is not the SPI SCSI one\n")); 3027 3028 LogFlowFunc(("pThis=%#p\n", pThis)); 2990 3029 2991 3030 /* Clear everything first. */ … … 3070 3109 * 3071 3110 * @returns the handle. 3072 * @param pThis The LsiLogic instance.3111 * @param pThis Pointer to the LsiLogic device state. 3073 3112 */ 3074 3113 DECLINLINE(uint16_t) lsilogicGetHandle(PLSILOGICSCSI pThis) … … 3103 3142 * 3104 3143 * @returns nothing 3105 * @param pThis Pointer to the Lsilogic SCSI instance.3106 */ 3107 static void lsilogic InitializeConfigurationPagesSas(PLSILOGICSCSI pThis)3144 * @param pThis Pointer to the LsiLogic device state. 3145 */ 3146 static void lsilogicR3InitializeConfigurationPagesSas(PLSILOGICSCSI pThis) 3108 3147 { 3109 3148 PMptConfigurationPagesSas pPages = &pThis->pConfigurationPages->u.SasPages; … … 3299 3338 * 3300 3339 * @returns nothing 3301 * @param p LsiLogic Pointer to the Lsilogic SCSI instance.3302 */ 3303 static void lsilogic InitializeConfigurationPages(PLSILOGICSCSI pLsiLogic)3340 * @param pThis Pointer to the LsiLogic device state. 3341 */ 3342 static void lsilogicR3InitializeConfigurationPages(PLSILOGICSCSI pThis) 3304 3343 { 3305 3344 /* Initialize the common pages. */ 3306 3345 PMptConfigurationPagesSupported pPages = (PMptConfigurationPagesSupported)RTMemAllocZ(sizeof(MptConfigurationPagesSupported)); 3307 3346 3308 p LsiLogic->pConfigurationPages = pPages;3309 3310 LogFlowFunc(("p LsiLogic=%#p\n", pLsiLogic));3347 pThis->pConfigurationPages = pPages; 3348 3349 LogFlowFunc(("pThis=%#p\n", pThis)); 3311 3350 3312 3351 /* Clear everything first. */ … … 3333 3372 MPT_CONFIGURATION_PAGE_ATTRIBUTE_PERSISTENT_READONLY); 3334 3373 3335 if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI)3374 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI) 3336 3375 { 3337 3376 pPages->ManufacturingPage2.u.fields.u16PCIDeviceID = LSILOGICSCSI_PCI_SPI_DEVICE_ID; 3338 3377 pPages->ManufacturingPage2.u.fields.u8PCIRevisionID = LSILOGICSCSI_PCI_SPI_REVISION_ID; 3339 3378 } 3340 else if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS)3379 else if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 3341 3380 { 3342 3381 pPages->ManufacturingPage2.u.fields.u16PCIDeviceID = LSILOGICSCSI_PCI_SAS_DEVICE_ID; … … 3349 3388 MPT_CONFIGURATION_PAGE_ATTRIBUTE_PERSISTENT_READONLY); 3350 3389 3351 if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI)3390 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI) 3352 3391 { 3353 3392 pPages->ManufacturingPage3.u.fields.u16PCIDeviceID = LSILOGICSCSI_PCI_SPI_DEVICE_ID; 3354 3393 pPages->ManufacturingPage3.u.fields.u8PCIRevisionID = LSILOGICSCSI_PCI_SPI_REVISION_ID; 3355 3394 } 3356 else if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS)3395 else if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 3357 3396 { 3358 3397 pPages->ManufacturingPage3.u.fields.u16PCIDeviceID = LSILOGICSCSI_PCI_SAS_DEVICE_ID; … … 3417 3456 pPages->IOUnitPage2.u.fields.aAdapterOrder[0].fAdapterEmbedded = true; 3418 3457 pPages->IOUnitPage2.u.fields.aAdapterOrder[0].u8PCIBusNumber = 0; 3419 pPages->IOUnitPage2.u.fields.aAdapterOrder[0].u8PCIDevFn = p LsiLogic->PciDev.devfn;3458 pPages->IOUnitPage2.u.fields.aAdapterOrder[0].u8PCIDevFn = pThis->PciDev.devfn; 3420 3459 3421 3460 /* I/O Unit page 3. */ … … 3437 3476 pPages->IOCPage0.u.fields.u32FreeNVStore = 0; 3438 3477 3439 if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI)3478 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI) 3440 3479 { 3441 3480 pPages->IOCPage0.u.fields.u16VendorId = LSILOGICSCSI_PCI_VENDOR_ID; … … 3446 3485 pPages->IOCPage0.u.fields.u16SubsystemId = LSILOGICSCSI_PCI_SPI_SUBSYSTEM_ID; 3447 3486 } 3448 else if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS)3487 else if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 3449 3488 { 3450 3489 pPages->IOCPage0.u.fields.u16VendorId = LSILOGICSCSI_PCI_VENDOR_ID; … … 3503 3542 MPT_CONFIGURATION_PAGE_ATTRIBUTE_CHANGEABLE); 3504 3543 3505 if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI)3506 lsilogic InitializeConfigurationPagesSpi(pLsiLogic);3507 else if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS)3508 lsilogic InitializeConfigurationPagesSas(pLsiLogic);3544 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI) 3545 lsilogicR3InitializeConfigurationPagesSpi(pThis); 3546 else if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 3547 lsilogicR3InitializeConfigurationPagesSas(pThis); 3509 3548 else 3510 AssertMsgFailed(("Invalid controller type %d\n", pLsiLogic->enmCtrlType)); 3511 } 3512 3513 /** 3514 * Transmit queue consumer 3515 * Queue a new async task. 3516 * 3517 * @returns Success indicator. 3518 * If false the item will not be removed and the flushing will stop. 3519 * @param pDevIns The device instance. 3520 * @param pItem The item to consume. Upon return this item will be freed. 3521 */ 3522 static DECLCALLBACK(bool) lsilogicNotifyQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem) 3523 { 3524 PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 3549 AssertMsgFailed(("Invalid controller type %d\n", pThis->enmCtrlType)); 3550 } 3551 3552 /** 3553 * @callback_method_impl{FNPDMQUEUEDEV, Transmit queue consumer.} 3554 */ 3555 static DECLCALLBACK(bool) lsilogicR3NotifyQueueConsumer(PPDMDEVINS pDevIns, PPDMQUEUEITEMCORE pItem) 3556 { 3557 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 3525 3558 int rc = VINF_SUCCESS; 3526 3559 … … 3528 3561 3529 3562 /* Reset notification event. */ 3530 ASMAtomicXchgBool(&p LsiLogic->fNotificationSend, false);3563 ASMAtomicXchgBool(&pThis->fNotificationSend, false); 3531 3564 3532 3565 /* Only process request which arrived before we received the notification. */ 3533 uint32_t uRequestQueueNextEntryWrite = ASMAtomicReadU32(&p LsiLogic->uRequestQueueNextEntryFreeWrite);3566 uint32_t uRequestQueueNextEntryWrite = ASMAtomicReadU32(&pThis->uRequestQueueNextEntryFreeWrite); 3534 3567 3535 3568 /* Go through the messages now and process them. */ 3536 while ( RT_LIKELY(p LsiLogic->enmState == LSILOGICSTATE_OPERATIONAL)3537 && (p LsiLogic->uRequestQueueNextAddressRead != uRequestQueueNextEntryWrite))3538 { 3539 uint32_t u32RequestMessageFrameDesc = p LsiLogic->CTX_SUFF(pRequestQueueBase)[pLsiLogic->uRequestQueueNextAddressRead];3540 RTGCPHYS GCPhysMessageFrameAddr = LSILOGIC_RTGCPHYS_FROM_U32(p LsiLogic->u32HostMFAHighAddr,3569 while ( RT_LIKELY(pThis->enmState == LSILOGICSTATE_OPERATIONAL) 3570 && (pThis->uRequestQueueNextAddressRead != uRequestQueueNextEntryWrite)) 3571 { 3572 uint32_t u32RequestMessageFrameDesc = pThis->CTX_SUFF(pRequestQueueBase)[pThis->uRequestQueueNextAddressRead]; 3573 RTGCPHYS GCPhysMessageFrameAddr = LSILOGIC_RTGCPHYS_FROM_U32(pThis->u32HostMFAHighAddr, 3541 3574 (u32RequestMessageFrameDesc & ~0x07)); 3542 3575 … … 3544 3577 3545 3578 /* Get new task state. */ 3546 rc = RTMemCacheAllocEx(p LsiLogic->hTaskCache, (void **)&pTaskState);3579 rc = RTMemCacheAllocEx(pThis->hTaskCache, (void **)&pTaskState); 3547 3580 AssertRC(rc); 3548 3581 … … 3593 3626 default: 3594 3627 AssertMsgFailed(("Unknown function issued %u\n", pTaskState->GuestRequest.Header.u8Function)); 3595 lsilogicSetIOCFaultCode(p LsiLogic, LSILOGIC_IOCSTATUS_INVALID_FUNCTION);3628 lsilogicSetIOCFaultCode(pThis, LSILOGIC_IOCSTATUS_INVALID_FUNCTION); 3596 3629 } 3597 3630 … … 3604 3637 if (pTaskState->GuestRequest.Header.u8Function == MPT_MESSAGE_HDR_FUNCTION_SCSI_IO_REQUEST) 3605 3638 { 3606 rc = lsilogic ProcessSCSIIORequest(pLsiLogic, pTaskState);3639 rc = lsilogicR3ProcessSCSIIORequest(pThis, pTaskState); 3607 3640 AssertRC(rc); 3608 3641 } … … 3610 3643 { 3611 3644 MptReplyUnion Reply; 3612 rc = lsilogic ProcessMessageRequest(pLsiLogic, &pTaskState->GuestRequest.Header, &Reply);3645 rc = lsilogicR3ProcessMessageRequest(pThis, &pTaskState->GuestRequest.Header, &Reply); 3613 3646 AssertRC(rc); 3614 RTMemCacheFree(p LsiLogic->hTaskCache, pTaskState);3647 RTMemCacheFree(pThis->hTaskCache, pTaskState); 3615 3648 } 3616 3649 3617 p LsiLogic->uRequestQueueNextAddressRead++;3618 p LsiLogic->uRequestQueueNextAddressRead %= pLsiLogic->cRequestQueueEntries;3650 pThis->uRequestQueueNextAddressRead++; 3651 pThis->uRequestQueueNextAddressRead %= pThis->cRequestQueueEntries; 3619 3652 } 3620 3653 } … … 3628 3661 * @returns VBox status code. 3629 3662 * 3630 * @param pThis The LsiLogic devistate.3631 * @param pcszCtrlType The string to use.3632 */ 3633 static int lsilogic GetCtrlTypeFromString(PLSILOGICSCSI pThis, const char *pcszCtrlType)3663 * @param pThis Pointer to the LsiLogic device state. 3664 * @param pcszCtrlType The string to use. 3665 */ 3666 static int lsilogicR3GetCtrlTypeFromString(PLSILOGICSCSI pThis, const char *pcszCtrlType) 3634 3667 { 3635 3668 int rc = VERR_INVALID_PARAMETER; … … 3650 3683 3651 3684 /** 3652 * Port I/O Handler for IN operations - legacy port. 3653 * 3654 * @returns VBox status code. 3655 * 3656 * @param pDevIns The device instance. 3657 * @param pvUser User argument. 3658 * @param uPort Port number used for the IN operation. 3659 * @param pu32 Where to store the result. 3660 * @param cb Number of bytes read. 3661 */ 3662 static int lsilogicIsaIOPortRead (PPDMDEVINS pDevIns, void *pvUser, 3663 RTIOPORT Port, uint32_t *pu32, unsigned cb) 3664 { 3665 int rc; 3685 * @callback_method_impl{FNIOMIOPORTIN, Legacy ISA port.} 3686 */ 3687 static DECLCALLBACK(int) lsilogicR3IsaIOPortRead(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) 3688 { 3666 3689 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 3667 3690 3668 3691 Assert(cb == 1); 3669 3692 3670 uint8_t iRegister = 3671 3672 3673 rc = vboxscsiReadRegister(&pThis->VBoxSCSI, iRegister, pu32);3693 uint8_t iRegister = pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI 3694 ? Port - LSILOGIC_BIOS_IO_PORT 3695 : Port - LSILOGIC_SAS_BIOS_IO_PORT; 3696 int rc = vboxscsiReadRegister(&pThis->VBoxSCSI, iRegister, pu32); 3674 3697 3675 3698 Log2(("%s: pu32=%p:{%.*Rhxs} iRegister=%d rc=%Rrc\n", … … 3683 3706 * 3684 3707 * @returns VBox status code. 3685 * @param p LsiLogic Pointer to the LsiLogic device instance.3686 */ 3687 static int lsilogic PrepareBIOSSCSIRequest(PLSILOGICSCSI pLsiLogic)3708 * @param pThis Pointer to the LsiLogic device state. 3709 */ 3710 static int lsilogicR3PrepareBiosScsiRequest(PLSILOGICSCSI pThis) 3688 3711 { 3689 3712 int rc; … … 3691 3714 uint32_t uTargetDevice; 3692 3715 3693 rc = RTMemCacheAllocEx(p LsiLogic->hTaskCache, (void **)&pTaskState);3716 rc = RTMemCacheAllocEx(pThis->hTaskCache, (void **)&pTaskState); 3694 3717 AssertMsgRCReturn(rc, ("Getting task from cache failed rc=%Rrc\n", rc), rc); 3695 3718 3696 3719 pTaskState->fBIOS = true; 3697 3720 3698 rc = vboxscsiSetupRequest(&p LsiLogic->VBoxSCSI, &pTaskState->PDMScsiRequest, &uTargetDevice);3721 rc = vboxscsiSetupRequest(&pThis->VBoxSCSI, &pTaskState->PDMScsiRequest, &uTargetDevice); 3699 3722 AssertMsgRCReturn(rc, ("Setting up SCSI request failed rc=%Rrc\n", rc), rc); 3700 3723 3701 3724 pTaskState->PDMScsiRequest.pvUser = pTaskState; 3702 3725 3703 if (uTargetDevice < p LsiLogic->cDeviceStates)3704 { 3705 pTaskState->pTargetDevice = &p LsiLogic->paDeviceStates[uTargetDevice];3726 if (uTargetDevice < pThis->cDeviceStates) 3727 { 3728 pTaskState->pTargetDevice = &pThis->paDeviceStates[uTargetDevice]; 3706 3729 3707 3730 if (pTaskState->pTargetDevice->pDrvBase) … … 3726 3749 ScsiInquiryData.u3PeripheralQualifier = SCSI_INQUIRY_DATA_PERIPHERAL_QUALIFIER_NOT_CONNECTED_NOT_SUPPORTED; 3727 3750 3728 memcpy(p LsiLogic->VBoxSCSI.pbBuf, &ScsiInquiryData, 5);3729 3730 rc = vboxscsiRequestFinished(&p LsiLogic->VBoxSCSI, &pTaskState->PDMScsiRequest, SCSI_STATUS_OK);3751 memcpy(pThis->VBoxSCSI.pbBuf, &ScsiInquiryData, 5); 3752 3753 rc = vboxscsiRequestFinished(&pThis->VBoxSCSI, &pTaskState->PDMScsiRequest, SCSI_STATUS_OK); 3731 3754 AssertMsgRCReturn(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc), rc); 3732 3755 3733 RTMemCacheFree(p LsiLogic->hTaskCache, pTaskState);3756 RTMemCacheFree(pThis->hTaskCache, pTaskState); 3734 3757 return rc; 3735 3758 } 3736 3759 3737 3760 /** 3738 * Port I/O Handler for OUT operations - legacy port. 3739 * 3740 * @returns VBox status code. 3741 * 3742 * @param pDevIns The device instance. 3743 * @param pvUser User argument. 3744 * @param uPort Port number used for the IN operation. 3745 * @param u32 The value to output. 3746 * @param cb The value size in bytes. 3747 */ 3748 static int lsilogicIsaIOPortWrite (PPDMDEVINS pDevIns, void *pvUser, 3749 RTIOPORT Port, uint32_t u32, unsigned cb) 3750 { 3751 int rc; 3761 * @callback_method_impl{FNIOMIOPORTOUT, Legacy ISA port.} 3762 */ 3763 static DECLCALLBACK(int) lsilogicR3IsaIOPortWrite(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) 3764 { 3752 3765 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 3753 3754 Log2(("#%d %s: pvUser=%#p cb=%d u32=%#x Port=%#x\n", 3755 pDevIns->iInstance, __FUNCTION__, pvUser, cb, u32, Port)); 3766 Log2(("#%d %s: pvUser=%#p cb=%d u32=%#x Port=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, u32, Port)); 3756 3767 3757 3768 Assert(cb == 1); 3758 3769 3759 uint8_t iRegister = 3760 3761 3762 rc = vboxscsiWriteRegister(&pThis->VBoxSCSI, iRegister, (uint8_t)u32);3770 uint8_t iRegister = pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI 3771 ? Port - LSILOGIC_BIOS_IO_PORT 3772 : Port - LSILOGIC_SAS_BIOS_IO_PORT; 3773 int rc = vboxscsiWriteRegister(&pThis->VBoxSCSI, iRegister, (uint8_t)u32); 3763 3774 if (rc == VERR_MORE_DATA) 3764 3775 { 3765 rc = lsilogic PrepareBIOSSCSIRequest(pThis);3776 rc = lsilogicR3PrepareBiosScsiRequest(pThis); 3766 3777 AssertRC(rc); 3767 3778 } … … 3773 3784 3774 3785 /** 3775 * Port I/O Handler for primary port range OUT string operations. 3776 * @see FNIOMIOPORTOUTSTRING for details. 3777 */ 3778 static DECLCALLBACK(int) lsilogicIsaIOPortWriteStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrSrc, PRTGCUINTREG pcTransfer, unsigned cb) 3786 * @callback_method_impl{FNIOMIOPORTOUTSTRING, 3787 * Port I/O Handler for primary port range OUT string operations.} 3788 */ 3789 static DECLCALLBACK(int) lsilogicR3IsaIOPortWriteStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, 3790 PRTGCPTR pGCPtrSrc, PRTGCUINTREG pcTransfer, unsigned cb) 3779 3791 { 3780 3792 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 3781 int rc; 3782 3783 Log2(("#%d %s: pvUser=%#p cb=%d Port=%#x\n", 3784 pDevIns->iInstance, __FUNCTION__, pvUser, cb, Port)); 3785 3786 uint8_t iRegister = pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI 3787 ? Port - LSILOGIC_BIOS_IO_PORT 3788 : Port - LSILOGIC_SAS_BIOS_IO_PORT; 3789 rc = vboxscsiWriteString(pDevIns, &pThis->VBoxSCSI, iRegister, 3790 pGCPtrSrc, pcTransfer, cb); 3793 Log2(("#%d %s: pvUser=%#p cb=%d Port=%#x\n", pDevIns->iInstance, __FUNCTION__, pvUser, cb, Port)); 3794 3795 uint8_t iRegister = pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI 3796 ? Port - LSILOGIC_BIOS_IO_PORT 3797 : Port - LSILOGIC_SAS_BIOS_IO_PORT; 3798 int rc = vboxscsiWriteString(pDevIns, &pThis->VBoxSCSI, iRegister, pGCPtrSrc, pcTransfer, cb); 3791 3799 if (rc == VERR_MORE_DATA) 3792 3800 { 3793 rc = lsilogic PrepareBIOSSCSIRequest(pThis);3801 rc = lsilogicR3PrepareBiosScsiRequest(pThis); 3794 3802 AssertRC(rc); 3795 3803 } … … 3801 3809 3802 3810 /** 3803 * Port I/O Handler for primary port range IN string operations. 3804 * @see FNIOMIOPORTINSTRING for details. 3805 */ 3806 static DECLCALLBACK(int) lsilogicIsaIOPortReadStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrDst, PRTGCUINTREG pcTransfer, unsigned cb) 3811 * @callback_method_impl{FNIOMIOPORTINSTRING, 3812 * Port I/O Handler for primary port range IN string operations.} 3813 */ 3814 static DECLCALLBACK(int) lsilogicR3IsaIOPortReadStr(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrDst, 3815 PRTGCUINTREG pcTransfer, unsigned cb) 3807 3816 { 3808 3817 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); … … 3818 3827 } 3819 3828 3820 static DECLCALLBACK(int) lsilogic Map(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion,3821 RTGCPHYS GCPhysAddress, uint32_t cb,3822 PCIADDRESSSPACE enmType)3829 static DECLCALLBACK(int) lsilogicR3Map(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion, 3830 RTGCPHYS GCPhysAddress, uint32_t cb, 3831 PCIADDRESSSPACE enmType) 3823 3832 { 3824 3833 PPDMDEVINS pDevIns = pPciDev->pDevIns; … … 3922 3931 3923 3932 /** 3924 * LsiLogic status info callback. 3925 * 3926 * @param pDevIns The device instance. 3927 * @param pHlp The output helpers. 3928 * @param pszArgs The arguments. 3929 */ 3930 static DECLCALLBACK(void) lsilogicInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 3933 * @callback_method_impl{PFNDBGFHANDLERDEV} 3934 */ 3935 static DECLCALLBACK(void) lsilogicR3Info(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 3931 3936 { 3932 3937 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); … … 4020 4025 * @returns VBox status code. 4021 4026 * 4022 * @param pThis The LsiLogic device instance.4023 */ 4024 static int lsilogic QueuesAlloc(PLSILOGICSCSI pThis)4027 * @param pThis Pointer to the LsiLogic device state. 4028 */ 4029 static int lsilogicR3QueuesAlloc(PLSILOGICSCSI pThis) 4025 4030 { 4026 4031 PVM pVM = PDMDevHlpGetVM(pThis->pDevInsR3); … … 4054 4059 * @returns nothing. 4055 4060 * 4056 * @param pThis The LsiLogic device instance.4057 */ 4058 static void lsilogic QueuesFree(PLSILOGICSCSI pThis)4061 * @param pThis Pointer to the LsiLogic device state. 4062 */ 4063 static void lsilogicR3QueuesFree(PLSILOGICSCSI pThis) 4059 4064 { 4060 4065 PVM pVM = PDMDevHlpGetVM(pThis->pDevInsR3); … … 4076 4081 * 4077 4082 * @returns nothing. 4078 * @param pThis The LsiLogic device instance.4079 */ 4080 static void lsilogic Kick(PLSILOGICSCSI pThis)4083 * @param pThis Pointer to the LsiLogic device state. 4084 */ 4085 static void lsilogicR3Kick(PLSILOGICSCSI pThis) 4081 4086 { 4082 4087 if (pThis->fNotificationSend) … … 4090 4095 { 4091 4096 /* The BIOS had a request active when we got suspended. Resume it. */ 4092 int rc = lsilogic PrepareBIOSSCSIRequest(pThis);4097 int rc = lsilogicR3PrepareBiosScsiRequest(pThis); 4093 4098 AssertRC(rc); 4094 4099 } … … 4096 4101 } 4097 4102 4098 static DECLCALLBACK(int) lsilogicLiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass) 4103 4104 /* 4105 * Saved state. 4106 */ 4107 4108 /** 4109 * @callback_method_impl{FNSSMDEVLIVEEXEC} 4110 */ 4111 static DECLCALLBACK(int) lsilogicR3LiveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uPass) 4099 4112 { 4100 4113 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); … … 4111 4124 } 4112 4125 4113 static DECLCALLBACK(int) lsilogicSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 4114 { 4115 PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4126 /** 4127 * @callback_method_impl{FNSSMDEVSAVEEXEC} 4128 */ 4129 static DECLCALLBACK(int) lsilogicR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 4130 { 4131 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4116 4132 4117 4133 /* Every device first. */ 4118 lsilogic LiveExec(pDevIns, pSSM, SSM_PASS_FINAL);4119 for (unsigned i = 0; i < p LsiLogic->cDeviceStates; i++)4120 { 4121 PLSILOGICDEVICE pDevice = &p LsiLogic->paDeviceStates[i];4134 lsilogicR3LiveExec(pDevIns, pSSM, SSM_PASS_FINAL); 4135 for (unsigned i = 0; i < pThis->cDeviceStates; i++) 4136 { 4137 PLSILOGICDEVICE pDevice = &pThis->paDeviceStates[i]; 4122 4138 4123 4139 AssertMsg(!pDevice->cOutstandingRequests, … … 4126 4142 } 4127 4143 /* Now the main device state. */ 4128 SSMR3PutU32 (pSSM, p LsiLogic->enmState);4129 SSMR3PutU32 (pSSM, p LsiLogic->enmWhoInit);4130 SSMR3PutBool (pSSM, p LsiLogic->fDoorbellInProgress);4131 SSMR3PutBool (pSSM, p LsiLogic->fDiagnosticEnabled);4132 SSMR3PutBool (pSSM, p LsiLogic->fNotificationSend);4133 SSMR3PutBool (pSSM, p LsiLogic->fEventNotificationEnabled);4134 SSMR3PutU32 (pSSM, p LsiLogic->uInterruptMask);4135 SSMR3PutU32 (pSSM, p LsiLogic->uInterruptStatus);4136 for (unsigned i = 0; i < RT_ELEMENTS(p LsiLogic->aMessage); i++)4137 SSMR3PutU32 (pSSM, p LsiLogic->aMessage[i]);4138 SSMR3PutU32 (pSSM, p LsiLogic->iMessage);4139 SSMR3PutU32 (pSSM, p LsiLogic->cMessage);4140 SSMR3PutMem (pSSM, &p LsiLogic->ReplyBuffer, sizeof(pLsiLogic->ReplyBuffer));4141 SSMR3PutU32 (pSSM, p LsiLogic->uNextReplyEntryRead);4142 SSMR3PutU32 (pSSM, p LsiLogic->cReplySize);4143 SSMR3PutU16 (pSSM, p LsiLogic->u16IOCFaultCode);4144 SSMR3PutU32 (pSSM, p LsiLogic->u32HostMFAHighAddr);4145 SSMR3PutU32 (pSSM, p LsiLogic->u32SenseBufferHighAddr);4146 SSMR3PutU8 (pSSM, p LsiLogic->cMaxDevices);4147 SSMR3PutU8 (pSSM, p LsiLogic->cMaxBuses);4148 SSMR3PutU16 (pSSM, p LsiLogic->cbReplyFrame);4149 SSMR3PutU32 (pSSM, p LsiLogic->iDiagnosticAccess);4150 SSMR3PutU32 (pSSM, p LsiLogic->cReplyQueueEntries);4151 SSMR3PutU32 (pSSM, p LsiLogic->cRequestQueueEntries);4152 SSMR3PutU32 (pSSM, p LsiLogic->uReplyFreeQueueNextEntryFreeWrite);4153 SSMR3PutU32 (pSSM, p LsiLogic->uReplyFreeQueueNextAddressRead);4154 SSMR3PutU32 (pSSM, p LsiLogic->uReplyPostQueueNextEntryFreeWrite);4155 SSMR3PutU32 (pSSM, p LsiLogic->uReplyPostQueueNextAddressRead);4156 SSMR3PutU32 (pSSM, p LsiLogic->uRequestQueueNextEntryFreeWrite);4157 SSMR3PutU32 (pSSM, p LsiLogic->uRequestQueueNextAddressRead);4158 4159 for (unsigned i = 0; i < p LsiLogic->cReplyQueueEntries; i++)4160 SSMR3PutU32(pSSM, p LsiLogic->pReplyFreeQueueBaseR3[i]);4161 for (unsigned i = 0; i < p LsiLogic->cReplyQueueEntries; i++)4162 SSMR3PutU32(pSSM, p LsiLogic->pReplyPostQueueBaseR3[i]);4163 for (unsigned i = 0; i < p LsiLogic->cRequestQueueEntries; i++)4164 SSMR3PutU32(pSSM, p LsiLogic->pRequestQueueBaseR3[i]);4165 4166 SSMR3PutU16 (pSSM, p LsiLogic->u16NextHandle);4167 4168 PMptConfigurationPagesSupported pPages = p LsiLogic->pConfigurationPages;4144 SSMR3PutU32 (pSSM, pThis->enmState); 4145 SSMR3PutU32 (pSSM, pThis->enmWhoInit); 4146 SSMR3PutBool (pSSM, pThis->fDoorbellInProgress); 4147 SSMR3PutBool (pSSM, pThis->fDiagnosticEnabled); 4148 SSMR3PutBool (pSSM, pThis->fNotificationSend); 4149 SSMR3PutBool (pSSM, pThis->fEventNotificationEnabled); 4150 SSMR3PutU32 (pSSM, pThis->uInterruptMask); 4151 SSMR3PutU32 (pSSM, pThis->uInterruptStatus); 4152 for (unsigned i = 0; i < RT_ELEMENTS(pThis->aMessage); i++) 4153 SSMR3PutU32 (pSSM, pThis->aMessage[i]); 4154 SSMR3PutU32 (pSSM, pThis->iMessage); 4155 SSMR3PutU32 (pSSM, pThis->cMessage); 4156 SSMR3PutMem (pSSM, &pThis->ReplyBuffer, sizeof(pThis->ReplyBuffer)); 4157 SSMR3PutU32 (pSSM, pThis->uNextReplyEntryRead); 4158 SSMR3PutU32 (pSSM, pThis->cReplySize); 4159 SSMR3PutU16 (pSSM, pThis->u16IOCFaultCode); 4160 SSMR3PutU32 (pSSM, pThis->u32HostMFAHighAddr); 4161 SSMR3PutU32 (pSSM, pThis->u32SenseBufferHighAddr); 4162 SSMR3PutU8 (pSSM, pThis->cMaxDevices); 4163 SSMR3PutU8 (pSSM, pThis->cMaxBuses); 4164 SSMR3PutU16 (pSSM, pThis->cbReplyFrame); 4165 SSMR3PutU32 (pSSM, pThis->iDiagnosticAccess); 4166 SSMR3PutU32 (pSSM, pThis->cReplyQueueEntries); 4167 SSMR3PutU32 (pSSM, pThis->cRequestQueueEntries); 4168 SSMR3PutU32 (pSSM, pThis->uReplyFreeQueueNextEntryFreeWrite); 4169 SSMR3PutU32 (pSSM, pThis->uReplyFreeQueueNextAddressRead); 4170 SSMR3PutU32 (pSSM, pThis->uReplyPostQueueNextEntryFreeWrite); 4171 SSMR3PutU32 (pSSM, pThis->uReplyPostQueueNextAddressRead); 4172 SSMR3PutU32 (pSSM, pThis->uRequestQueueNextEntryFreeWrite); 4173 SSMR3PutU32 (pSSM, pThis->uRequestQueueNextAddressRead); 4174 4175 for (unsigned i = 0; i < pThis->cReplyQueueEntries; i++) 4176 SSMR3PutU32(pSSM, pThis->pReplyFreeQueueBaseR3[i]); 4177 for (unsigned i = 0; i < pThis->cReplyQueueEntries; i++) 4178 SSMR3PutU32(pSSM, pThis->pReplyPostQueueBaseR3[i]); 4179 for (unsigned i = 0; i < pThis->cRequestQueueEntries; i++) 4180 SSMR3PutU32(pSSM, pThis->pRequestQueueBaseR3[i]); 4181 4182 SSMR3PutU16 (pSSM, pThis->u16NextHandle); 4183 4184 PMptConfigurationPagesSupported pPages = pThis->pConfigurationPages; 4169 4185 4170 4186 SSMR3PutMem (pSSM, &pPages->ManufacturingPage0, sizeof(MptConfigurationPageManufacturing0)); … … 4194 4210 4195 4211 /* Device dependent pages */ 4196 if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI)4212 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI) 4197 4213 { 4198 4214 PMptConfigurationPagesSpi pSpiPages = &pPages->u.SpiPages; … … 4210 4226 } 4211 4227 } 4212 else if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS)4228 else if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 4213 4229 { 4214 4230 PMptConfigurationPagesSas pSasPages = &pPages->u.SasPages; … … 4247 4263 } 4248 4264 else 4249 AssertMsgFailed(("Invalid controller type %d\n", p LsiLogic->enmCtrlType));4265 AssertMsgFailed(("Invalid controller type %d\n", pThis->enmCtrlType)); 4250 4266 4251 4267 /* Now the data for the BIOS interface. */ 4252 SSMR3PutU8 (pSSM, p LsiLogic->VBoxSCSI.regIdentify);4253 SSMR3PutU8 (pSSM, p LsiLogic->VBoxSCSI.uTargetDevice);4254 SSMR3PutU8 (pSSM, p LsiLogic->VBoxSCSI.uTxDir);4255 SSMR3PutU8 (pSSM, p LsiLogic->VBoxSCSI.cbCDB);4256 SSMR3PutMem (pSSM, p LsiLogic->VBoxSCSI.abCDB, sizeof(pLsiLogic->VBoxSCSI.abCDB));4257 SSMR3PutU8 (pSSM, p LsiLogic->VBoxSCSI.iCDB);4258 SSMR3PutU32 (pSSM, p LsiLogic->VBoxSCSI.cbBuf);4259 SSMR3PutU32 (pSSM, p LsiLogic->VBoxSCSI.iBuf);4260 SSMR3PutBool (pSSM, p LsiLogic->VBoxSCSI.fBusy);4261 SSMR3PutU8 (pSSM, p LsiLogic->VBoxSCSI.enmState);4262 if (p LsiLogic->VBoxSCSI.cbBuf)4263 SSMR3PutMem(pSSM, p LsiLogic->VBoxSCSI.pbBuf, pLsiLogic->VBoxSCSI.cbBuf);4268 SSMR3PutU8 (pSSM, pThis->VBoxSCSI.regIdentify); 4269 SSMR3PutU8 (pSSM, pThis->VBoxSCSI.uTargetDevice); 4270 SSMR3PutU8 (pSSM, pThis->VBoxSCSI.uTxDir); 4271 SSMR3PutU8 (pSSM, pThis->VBoxSCSI.cbCDB); 4272 SSMR3PutMem (pSSM, pThis->VBoxSCSI.abCDB, sizeof(pThis->VBoxSCSI.abCDB)); 4273 SSMR3PutU8 (pSSM, pThis->VBoxSCSI.iCDB); 4274 SSMR3PutU32 (pSSM, pThis->VBoxSCSI.cbBuf); 4275 SSMR3PutU32 (pSSM, pThis->VBoxSCSI.iBuf); 4276 SSMR3PutBool (pSSM, pThis->VBoxSCSI.fBusy); 4277 SSMR3PutU8 (pSSM, pThis->VBoxSCSI.enmState); 4278 if (pThis->VBoxSCSI.cbBuf) 4279 SSMR3PutMem(pSSM, pThis->VBoxSCSI.pbBuf, pThis->VBoxSCSI.cbBuf); 4264 4280 4265 4281 return SSMR3PutU32(pSSM, ~0); 4266 4282 } 4267 4283 4268 static DECLCALLBACK(int) lsilogicLoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 4284 /** 4285 * @callback_method_impl{FNSSMDEVLOADDONE} 4286 */ 4287 static DECLCALLBACK(int) lsilogicR3LoadDone(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 4269 4288 { 4270 4289 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4271 4290 4272 lsilogic Kick(pThis);4291 lsilogicR3Kick(pThis); 4273 4292 return VINF_SUCCESS; 4274 4293 } 4275 4294 4276 static DECLCALLBACK(int) lsilogicLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 4277 { 4278 PLSILOGICSCSI pLsiLogic = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4295 /** 4296 * @callback_method_impl{FNSSMDEVLOADEXEC} 4297 */ 4298 static DECLCALLBACK(int) lsilogicR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 4299 { 4300 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4279 4301 int rc; 4280 4302 … … 4297 4319 AssertRCReturn(rc, rc); 4298 4320 4299 if (enmCtrlType != p LsiLogic->enmCtrlType)4321 if (enmCtrlType != pThis->enmCtrlType) 4300 4322 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Target config mismatch (Controller type): config=%d state=%d"), 4301 p LsiLogic->enmCtrlType, enmCtrlType);4302 if (cDeviceStates != p LsiLogic->cDeviceStates)4323 pThis->enmCtrlType, enmCtrlType); 4324 if (cDeviceStates != pThis->cDeviceStates) 4303 4325 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Target config mismatch (Device states): config=%u state=%u"), 4304 p LsiLogic->cDeviceStates, cDeviceStates);4305 if (cPorts != p LsiLogic->cPorts)4326 pThis->cDeviceStates, cDeviceStates); 4327 if (cPorts != pThis->cPorts) 4306 4328 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Target config mismatch (Ports): config=%u state=%u"), 4307 p LsiLogic->cPorts, cPorts);4329 pThis->cPorts, cPorts); 4308 4330 } 4309 4331 if (uVersion > LSILOGIC_SAVED_STATE_VERSION_VBOX_30) 4310 4332 { 4311 for (unsigned i = 0; i < p LsiLogic->cDeviceStates; i++)4333 for (unsigned i = 0; i < pThis->cDeviceStates; i++) 4312 4334 { 4313 4335 bool fPresent; 4314 4336 rc = SSMR3GetBool(pSSM, &fPresent); 4315 4337 AssertRCReturn(rc, rc); 4316 if (fPresent != (p LsiLogic->paDeviceStates[i].pDrvBase != NULL))4338 if (fPresent != (pThis->paDeviceStates[i].pDrvBase != NULL)) 4317 4339 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Target %u config mismatch: config=%RTbool state=%RTbool"), 4318 i, p LsiLogic->paDeviceStates[i].pDrvBase != NULL, fPresent);4340 i, pThis->paDeviceStates[i].pDrvBase != NULL, fPresent); 4319 4341 } 4320 4342 } … … 4323 4345 4324 4346 /* Every device first. */ 4325 for (unsigned i = 0; i < p LsiLogic->cDeviceStates; i++)4326 { 4327 PLSILOGICDEVICE pDevice = &p LsiLogic->paDeviceStates[i];4347 for (unsigned i = 0; i < pThis->cDeviceStates; i++) 4348 { 4349 PLSILOGICDEVICE pDevice = &pThis->paDeviceStates[i]; 4328 4350 4329 4351 AssertMsg(!pDevice->cOutstandingRequests, … … 4332 4354 } 4333 4355 /* Now the main device state. */ 4334 SSMR3GetU32 (pSSM, (uint32_t *)&p LsiLogic->enmState);4335 SSMR3GetU32 (pSSM, (uint32_t *)&p LsiLogic->enmWhoInit);4336 SSMR3GetBool (pSSM, &p LsiLogic->fDoorbellInProgress);4337 SSMR3GetBool (pSSM, &p LsiLogic->fDiagnosticEnabled);4338 SSMR3GetBool (pSSM, &p LsiLogic->fNotificationSend);4339 SSMR3GetBool (pSSM, &p LsiLogic->fEventNotificationEnabled);4340 SSMR3GetU32 (pSSM, (uint32_t *)&p LsiLogic->uInterruptMask);4341 SSMR3GetU32 (pSSM, (uint32_t *)&p LsiLogic->uInterruptStatus);4342 for (unsigned i = 0; i < RT_ELEMENTS(p LsiLogic->aMessage); i++)4343 SSMR3GetU32 (pSSM, &p LsiLogic->aMessage[i]);4344 SSMR3GetU32 (pSSM, &p LsiLogic->iMessage);4345 SSMR3GetU32 (pSSM, &p LsiLogic->cMessage);4346 SSMR3GetMem (pSSM, &p LsiLogic->ReplyBuffer, sizeof(pLsiLogic->ReplyBuffer));4347 SSMR3GetU32 (pSSM, &p LsiLogic->uNextReplyEntryRead);4348 SSMR3GetU32 (pSSM, &p LsiLogic->cReplySize);4349 SSMR3GetU16 (pSSM, &p LsiLogic->u16IOCFaultCode);4350 SSMR3GetU32 (pSSM, &p LsiLogic->u32HostMFAHighAddr);4351 SSMR3GetU32 (pSSM, &p LsiLogic->u32SenseBufferHighAddr);4352 SSMR3GetU8 (pSSM, &p LsiLogic->cMaxDevices);4353 SSMR3GetU8 (pSSM, &p LsiLogic->cMaxBuses);4354 SSMR3GetU16 (pSSM, &p LsiLogic->cbReplyFrame);4355 SSMR3GetU32 (pSSM, &p LsiLogic->iDiagnosticAccess);4356 SSMR3GetU32 (pSSM, (uint32_t *)&pThis->enmState); 4357 SSMR3GetU32 (pSSM, (uint32_t *)&pThis->enmWhoInit); 4358 SSMR3GetBool (pSSM, &pThis->fDoorbellInProgress); 4359 SSMR3GetBool (pSSM, &pThis->fDiagnosticEnabled); 4360 SSMR3GetBool (pSSM, &pThis->fNotificationSend); 4361 SSMR3GetBool (pSSM, &pThis->fEventNotificationEnabled); 4362 SSMR3GetU32 (pSSM, (uint32_t *)&pThis->uInterruptMask); 4363 SSMR3GetU32 (pSSM, (uint32_t *)&pThis->uInterruptStatus); 4364 for (unsigned i = 0; i < RT_ELEMENTS(pThis->aMessage); i++) 4365 SSMR3GetU32 (pSSM, &pThis->aMessage[i]); 4366 SSMR3GetU32 (pSSM, &pThis->iMessage); 4367 SSMR3GetU32 (pSSM, &pThis->cMessage); 4368 SSMR3GetMem (pSSM, &pThis->ReplyBuffer, sizeof(pThis->ReplyBuffer)); 4369 SSMR3GetU32 (pSSM, &pThis->uNextReplyEntryRead); 4370 SSMR3GetU32 (pSSM, &pThis->cReplySize); 4371 SSMR3GetU16 (pSSM, &pThis->u16IOCFaultCode); 4372 SSMR3GetU32 (pSSM, &pThis->u32HostMFAHighAddr); 4373 SSMR3GetU32 (pSSM, &pThis->u32SenseBufferHighAddr); 4374 SSMR3GetU8 (pSSM, &pThis->cMaxDevices); 4375 SSMR3GetU8 (pSSM, &pThis->cMaxBuses); 4376 SSMR3GetU16 (pSSM, &pThis->cbReplyFrame); 4377 SSMR3GetU32 (pSSM, &pThis->iDiagnosticAccess); 4356 4378 4357 4379 uint32_t cReplyQueueEntries, cRequestQueueEntries; … … 4359 4381 SSMR3GetU32 (pSSM, &cRequestQueueEntries); 4360 4382 4361 if ( cReplyQueueEntries != p LsiLogic->cReplyQueueEntries4362 || cRequestQueueEntries != p LsiLogic->cRequestQueueEntries)4383 if ( cReplyQueueEntries != pThis->cReplyQueueEntries 4384 || cRequestQueueEntries != pThis->cRequestQueueEntries) 4363 4385 { 4364 4386 LogFlow(("Reallocating queues cReplyQueueEntries=%u cRequestQueuEntries=%u\n", 4365 4387 cReplyQueueEntries, cRequestQueueEntries)); 4366 lsilogic QueuesFree(pLsiLogic);4367 p LsiLogic->cReplyQueueEntries = cReplyQueueEntries;4368 p LsiLogic->cRequestQueueEntries = cRequestQueueEntries;4369 rc = lsilogic QueuesAlloc(pLsiLogic);4388 lsilogicR3QueuesFree(pThis); 4389 pThis->cReplyQueueEntries = cReplyQueueEntries; 4390 pThis->cRequestQueueEntries = cRequestQueueEntries; 4391 rc = lsilogicR3QueuesAlloc(pThis); 4370 4392 if (RT_FAILURE(rc)) 4371 4393 return rc; 4372 4394 } 4373 4395 4374 SSMR3GetU32 (pSSM, (uint32_t *)&p LsiLogic->uReplyFreeQueueNextEntryFreeWrite);4375 SSMR3GetU32 (pSSM, (uint32_t *)&p LsiLogic->uReplyFreeQueueNextAddressRead);4376 SSMR3GetU32 (pSSM, (uint32_t *)&p LsiLogic->uReplyPostQueueNextEntryFreeWrite);4377 SSMR3GetU32 (pSSM, (uint32_t *)&p LsiLogic->uReplyPostQueueNextAddressRead);4378 SSMR3GetU32 (pSSM, (uint32_t *)&p LsiLogic->uRequestQueueNextEntryFreeWrite);4379 SSMR3GetU32 (pSSM, (uint32_t *)&p LsiLogic->uRequestQueueNextAddressRead);4380 4381 PMptConfigurationPagesSupported pPages = p LsiLogic->pConfigurationPages;4396 SSMR3GetU32 (pSSM, (uint32_t *)&pThis->uReplyFreeQueueNextEntryFreeWrite); 4397 SSMR3GetU32 (pSSM, (uint32_t *)&pThis->uReplyFreeQueueNextAddressRead); 4398 SSMR3GetU32 (pSSM, (uint32_t *)&pThis->uReplyPostQueueNextEntryFreeWrite); 4399 SSMR3GetU32 (pSSM, (uint32_t *)&pThis->uReplyPostQueueNextAddressRead); 4400 SSMR3GetU32 (pSSM, (uint32_t *)&pThis->uRequestQueueNextEntryFreeWrite); 4401 SSMR3GetU32 (pSSM, (uint32_t *)&pThis->uRequestQueueNextAddressRead); 4402 4403 PMptConfigurationPagesSupported pPages = pThis->pConfigurationPages; 4382 4404 4383 4405 if (uVersion <= LSILOGIC_SAVED_STATE_VERSION_PRE_SAS) … … 4386 4408 MptConfigurationPagesSupported_SSM_V2 ConfigPagesV2; 4387 4409 4388 if (p LsiLogic->enmCtrlType != LSILOGICCTRLTYPE_SCSI_SPI)4410 if (pThis->enmCtrlType != LSILOGICCTRLTYPE_SCSI_SPI) 4389 4411 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Config mismatch: Expected SPI SCSI controller")); 4390 4412 … … 4423 4445 { 4424 4446 /* Queue content */ 4425 for (unsigned i = 0; i < p LsiLogic->cReplyQueueEntries; i++)4426 SSMR3GetU32(pSSM, (uint32_t *)&p LsiLogic->pReplyFreeQueueBaseR3[i]);4427 for (unsigned i = 0; i < p LsiLogic->cReplyQueueEntries; i++)4428 SSMR3GetU32(pSSM, (uint32_t *)&p LsiLogic->pReplyPostQueueBaseR3[i]);4429 for (unsigned i = 0; i < p LsiLogic->cRequestQueueEntries; i++)4430 SSMR3GetU32(pSSM, (uint32_t *)&p LsiLogic->pRequestQueueBaseR3[i]);4431 4432 SSMR3GetU16(pSSM, &p LsiLogic->u16NextHandle);4447 for (unsigned i = 0; i < pThis->cReplyQueueEntries; i++) 4448 SSMR3GetU32(pSSM, (uint32_t *)&pThis->pReplyFreeQueueBaseR3[i]); 4449 for (unsigned i = 0; i < pThis->cReplyQueueEntries; i++) 4450 SSMR3GetU32(pSSM, (uint32_t *)&pThis->pReplyPostQueueBaseR3[i]); 4451 for (unsigned i = 0; i < pThis->cRequestQueueEntries; i++) 4452 SSMR3GetU32(pSSM, (uint32_t *)&pThis->pRequestQueueBaseR3[i]); 4453 4454 SSMR3GetU16(pSSM, &pThis->u16NextHandle); 4433 4455 4434 4456 /* Configuration pages */ … … 4459 4481 4460 4482 /* Device dependent pages */ 4461 if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI)4483 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI) 4462 4484 { 4463 4485 PMptConfigurationPagesSpi pSpiPages = &pPages->u.SpiPages; … … 4475 4497 } 4476 4498 } 4477 else if (p LsiLogic->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS)4499 else if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 4478 4500 { 4479 4501 uint32_t cbPage0, cbPage1, cPHYs, cbManufacturingPage7; … … 4528 4550 } 4529 4551 else 4530 AssertMsgFailed(("Invalid controller type %d\n", p LsiLogic->enmCtrlType));4552 AssertMsgFailed(("Invalid controller type %d\n", pThis->enmCtrlType)); 4531 4553 } 4532 4554 4533 4555 /* Now the data for the BIOS interface. */ 4534 SSMR3GetU8 (pSSM, &p LsiLogic->VBoxSCSI.regIdentify);4535 SSMR3GetU8 (pSSM, &p LsiLogic->VBoxSCSI.uTargetDevice);4536 SSMR3GetU8 (pSSM, &p LsiLogic->VBoxSCSI.uTxDir);4537 SSMR3GetU8 (pSSM, &p LsiLogic->VBoxSCSI.cbCDB);4538 SSMR3GetMem (pSSM, p LsiLogic->VBoxSCSI.abCDB, sizeof(pLsiLogic->VBoxSCSI.abCDB));4539 SSMR3GetU8 (pSSM, &p LsiLogic->VBoxSCSI.iCDB);4540 SSMR3GetU32 (pSSM, &p LsiLogic->VBoxSCSI.cbBuf);4541 SSMR3GetU32 (pSSM, &p LsiLogic->VBoxSCSI.iBuf);4542 SSMR3GetBool(pSSM, (bool *)&p LsiLogic->VBoxSCSI.fBusy);4543 SSMR3GetU8 (pSSM, (uint8_t *)&p LsiLogic->VBoxSCSI.enmState);4544 if (p LsiLogic->VBoxSCSI.cbBuf)4545 { 4546 p LsiLogic->VBoxSCSI.pbBuf = (uint8_t *)RTMemAllocZ(pLsiLogic->VBoxSCSI.cbBuf);4547 if (!p LsiLogic->VBoxSCSI.pbBuf)4556 SSMR3GetU8 (pSSM, &pThis->VBoxSCSI.regIdentify); 4557 SSMR3GetU8 (pSSM, &pThis->VBoxSCSI.uTargetDevice); 4558 SSMR3GetU8 (pSSM, &pThis->VBoxSCSI.uTxDir); 4559 SSMR3GetU8 (pSSM, &pThis->VBoxSCSI.cbCDB); 4560 SSMR3GetMem (pSSM, pThis->VBoxSCSI.abCDB, sizeof(pThis->VBoxSCSI.abCDB)); 4561 SSMR3GetU8 (pSSM, &pThis->VBoxSCSI.iCDB); 4562 SSMR3GetU32 (pSSM, &pThis->VBoxSCSI.cbBuf); 4563 SSMR3GetU32 (pSSM, &pThis->VBoxSCSI.iBuf); 4564 SSMR3GetBool(pSSM, (bool *)&pThis->VBoxSCSI.fBusy); 4565 SSMR3GetU8 (pSSM, (uint8_t *)&pThis->VBoxSCSI.enmState); 4566 if (pThis->VBoxSCSI.cbBuf) 4567 { 4568 pThis->VBoxSCSI.pbBuf = (uint8_t *)RTMemAllocZ(pThis->VBoxSCSI.cbBuf); 4569 if (!pThis->VBoxSCSI.pbBuf) 4548 4570 { 4549 4571 LogRel(("LsiLogic: Out of memory during restore.\n")); … … 4551 4573 N_("LsiLogic: Out of memory during restore\n")); 4552 4574 } 4553 SSMR3GetMem(pSSM, p LsiLogic->VBoxSCSI.pbBuf, pLsiLogic->VBoxSCSI.cbBuf);4575 SSMR3GetMem(pSSM, pThis->VBoxSCSI.pbBuf, pThis->VBoxSCSI.cbBuf); 4554 4576 } 4555 4577 … … 4563 4585 } 4564 4586 4565 /** 4566 * Gets the pointer to the status LED of a device - called from the SCSi driver. 4587 4588 /* 4589 * The device level IBASE and LED interfaces. 4590 */ 4591 4592 /** 4593 * @interface_method_impl{PDMILEDPORTS,pfnQueryInterface, For a SCSI device.} 4567 4594 * 4568 * @returns VBox status code. 4569 * @param pInterface Pointer to the interface structure containing the called function pointer. 4570 * @param iLUN The unit which status LED we desire. Always 0 here as the driver 4571 * doesn't know about other LUN's. 4572 * @param ppLed Where to store the LED pointer. 4573 */ 4574 static DECLCALLBACK(int) lsilogicDeviceQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) 4575 { 4576 PLSILOGICDEVICE pDevice = PDMILEDPORTS_2_PLSILOGICDEVICE(pInterface); 4595 * @remarks Called by the scsi driver, proxying the main calls. 4596 */ 4597 static DECLCALLBACK(int) lsilogicR3DeviceQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) 4598 { 4599 PLSILOGICDEVICE pDevice = RT_FROM_MEMBER(pInterface, LSILOGICDEVICE, ILed); 4577 4600 if (iLUN == 0) 4578 4601 { … … 4588 4611 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 4589 4612 */ 4590 static DECLCALLBACK(void *) lsilogic DeviceQueryInterface(PPDMIBASE pInterface, const char *pszIID)4591 { 4592 PLSILOGICDEVICE pDevice = PDMIBASE_2_PLSILOGICDEVICE(pInterface);4613 static DECLCALLBACK(void *) lsilogicR3DeviceQueryInterface(PPDMIBASE pInterface, const char *pszIID) 4614 { 4615 PLSILOGICDEVICE pDevice = RT_FROM_MEMBER(pInterface, LSILOGICDEVICE, IBase); 4593 4616 4594 4617 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDevice->IBase); … … 4597 4620 return NULL; 4598 4621 } 4622 4623 4624 /* 4625 * The controller level IBASE and LED interfaces. 4626 */ 4599 4627 4600 4628 /** … … 4606 4634 * @param ppLed Where to store the LED pointer. 4607 4635 */ 4608 static DECLCALLBACK(int) lsilogic StatusQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed)4609 { 4610 PLSILOGICSCSI p LsiLogic = PDMILEDPORTS_2_PLSILOGICSCSI(pInterface);4611 if (iLUN < p LsiLogic->cDeviceStates)4612 { 4613 *ppLed = &p LsiLogic->paDeviceStates[iLUN].Led;4636 static DECLCALLBACK(int) lsilogicR3StatusQueryStatusLed(PPDMILEDPORTS pInterface, unsigned iLUN, PPDMLED *ppLed) 4637 { 4638 PLSILOGICSCSI pThis = RT_FROM_MEMBER(pInterface, LSILOGICSCSI, ILeds); 4639 if (iLUN < pThis->cDeviceStates) 4640 { 4641 *ppLed = &pThis->paDeviceStates[iLUN].Led; 4614 4642 Assert((*ppLed)->u32Magic == PDMLED_MAGIC); 4615 4643 return VINF_SUCCESS; … … 4621 4649 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 4622 4650 */ 4623 static DECLCALLBACK(void *) lsilogic StatusQueryInterface(PPDMIBASE pInterface, const char *pszIID)4624 { 4625 PLSILOGICSCSI pThis = PDMIBASE_2_PLSILOGICSCSI(pInterface);4651 static DECLCALLBACK(void *) lsilogicR3StatusQueryInterface(PPDMIBASE pInterface, const char *pszIID) 4652 { 4653 PLSILOGICSCSI pThis = RT_FROM_MEMBER(pInterface, LSILOGICSCSI, IBase); 4626 4654 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis->IBase); 4627 4655 PDMIBASE_RETURN_INTERFACE(pszIID, PDMILEDPORTS, &pThis->ILeds); … … 4629 4657 } 4630 4658 4631 /* -=-=-=-=- Helper -=-=-=-=- */ 4659 4660 /* 4661 * The PDM device interface and some helpers. 4662 */ 4632 4663 4633 4664 /** 4634 4665 * Checks if all asynchronous I/O is finished. 4635 4666 * 4636 * Used by lsilogicR eset, lsilogicSuspend and lsilogicPowerOff.4667 * Used by lsilogicR3Reset, lsilogicR3Suspend and lsilogicR3PowerOff. 4637 4668 * 4638 4669 * @returns true if quiesced, false if busy. … … 4657 4688 4658 4689 /** 4659 * Callback employed by lsilogicR3Suspend and lsilogicR3PowerOff.. 4660 * 4661 * @returns true if we've quiesced, false if we're still working. 4662 * @param pDevIns The device instance. 4690 * @callback_method_impl{FNPDMDEVASYNCNOTIFY, 4691 * Callback employed by lsilogicR3Suspend and lsilogicR3PowerOff.} 4663 4692 */ 4664 4693 static DECLCALLBACK(bool) lsilogicR3IsAsyncSuspendOrPowerOffDone(PPDMDEVINS pDevIns) … … 4732 4761 4733 4762 /** 4734 * Suspend notification. 4735 * 4736 * @param pDevIns The device instance data. 4737 */ 4738 static DECLCALLBACK(void) lsilogicSuspend(PPDMDEVINS pDevIns) 4739 { 4740 Log(("lsilogicSuspend\n")); 4763 * @interface_method_impl{PDMDEVREG,pfnSuspend} 4764 */ 4765 static DECLCALLBACK(void) lsilogicR3Suspend(PPDMDEVINS pDevIns) 4766 { 4767 Log(("lsilogicR3Suspend\n")); 4741 4768 lsilogicR3SuspendOrPowerOff(pDevIns); 4742 4769 } 4743 4770 4744 4771 /** 4745 * Resume notification. 4746 * 4747 * @param pDevIns The device instance data. 4748 */ 4749 static DECLCALLBACK(void) lsilogicResume(PPDMDEVINS pDevIns) 4772 * @interface_method_impl{PDMDEVREG,pfnResume} 4773 */ 4774 static DECLCALLBACK(void) lsilogicR3Resume(PPDMDEVINS pDevIns) 4750 4775 { 4751 4776 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4752 4777 4753 Log(("lsilogicR esume\n"));4754 4755 lsilogic Kick(pThis);4756 } 4757 4758 /** 4759 * Detach notification.4778 Log(("lsilogicR3Resume\n")); 4779 4780 lsilogicR3Kick(pThis); 4781 } 4782 4783 /** 4784 * @interface_method_impl{PDMDEVREG,pfnDetach} 4760 4785 * 4761 4786 * One harddisk at one port has been unplugged. 4762 4787 * The VM is suspended at this point. 4763 * 4764 * @param pDevIns The device instance. 4765 * @param iLUN The logical unit which is being detached. 4766 * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. 4767 */ 4768 static DECLCALLBACK(void) lsilogicDetach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 4788 */ 4789 static DECLCALLBACK(void) lsilogicR3Detach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 4769 4790 { 4770 4791 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); … … 4787 4808 4788 4809 /** 4789 * Attach command. 4790 * 4791 * This is called when we change block driver. 4792 * 4793 * @returns VBox status code. 4794 * @param pDevIns The device instance. 4795 * @param iLUN The logical unit which is being detached. 4796 * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. 4797 */ 4798 static DECLCALLBACK(int) lsilogicAttach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 4810 * @interface_method_impl{PDMDEVREG,pfnAttach} 4811 */ 4812 static DECLCALLBACK(int) lsilogicR3Attach(PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 4799 4813 { 4800 4814 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); … … 4843 4857 static void lsilogicR3ResetCommon(PPDMDEVINS pDevIns) 4844 4858 { 4845 PLSILOGICSCSI p LsiLogic= PDMINS_2_DATA(pDevIns, PLSILOGICSCSI);4859 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4846 4860 int rc; 4847 4861 4848 rc = lsilogic HardReset(pLsiLogic);4862 rc = lsilogicR3HardReset(pThis); 4849 4863 AssertRC(rc); 4850 4864 4851 vboxscsiInitialize(&pLsiLogic->VBoxSCSI); 4852 } 4853 4854 /** 4855 * Callback employed by lsilogicR3Reset. 4856 * 4857 * @returns true if we've quiesced, false if we're still working. 4858 * @param pDevIns The device instance. 4865 vboxscsiInitialize(&pThis->VBoxSCSI); 4866 } 4867 4868 /** 4869 * @callback_method_impl{FNPDMDEVASYNCNOTIFY, 4870 * Callback employed by lsilogicR3Reset.} 4859 4871 */ 4860 4872 static DECLCALLBACK(bool) lsilogicR3IsAsyncResetDone(PPDMDEVINS pDevIns) … … 4871 4883 4872 4884 /** 4873 * @ copydoc FNPDMDEVRESET4874 */ 4875 static DECLCALLBACK(void) lsilogicR eset(PPDMDEVINS pDevIns)4885 * @interface_method_impl{PDMDEVREG,pfnReset} 4886 */ 4887 static DECLCALLBACK(void) lsilogicR3Reset(PPDMDEVINS pDevIns) 4876 4888 { 4877 4889 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); … … 4888 4900 4889 4901 /** 4890 * @ copydoc FNPDMDEVRELOCATE4891 */ 4892 static DECLCALLBACK(void) lsilogicR elocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)4902 * @interface_method_impl{PDMDEVREG,pfnRelocate} 4903 */ 4904 static DECLCALLBACK(void) lsilogicR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 4893 4905 { 4894 4906 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); … … 4904 4916 4905 4917 /** 4906 * @copydoc FNPDMDEVDESTRUCT 4907 */ 4908 static DECLCALLBACK(int) lsilogicDestruct(PPDMDEVINS pDevIns) 4918 * @interface_method_impl{PDMDEVREG,pfnPowerOff} 4919 */ 4920 static DECLCALLBACK(void) lsilogicR3PowerOff(PPDMDEVINS pDevIns) 4921 { 4922 Log(("lsilogicR3PowerOff\n")); 4923 lsilogicR3SuspendOrPowerOff(pDevIns); 4924 } 4925 4926 /** 4927 * @interface_method_impl{PDMDEVREG,pfnDestruct} 4928 */ 4929 static DECLCALLBACK(int) lsilogicR3Destruct(PPDMDEVINS pDevIns) 4909 4930 { 4910 4931 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); … … 4914 4935 PDMR3CritSectDelete(&pThis->ReplyPostQueueCritSect); 4915 4936 4916 if (pThis->paDeviceStates)4917 RTMemFree(pThis->paDeviceStates);4937 RTMemFree(pThis->paDeviceStates); 4938 pThis->paDeviceStates = NULL; 4918 4939 4919 4940 /* Destroy task cache. */ 4920 int rc = VINF_SUCCESS;4921 4941 if (pThis->hTaskCache != NIL_RTMEMCACHE) 4922 rc = RTMemCacheDestroy(pThis->hTaskCache); 4923 4924 lsilogicConfigurationPagesFree(pThis); 4925 4926 return rc; 4927 } 4928 4929 /** 4930 * Poweroff notification. 4931 * 4932 * @param pDevIns Pointer to the device instance 4933 */ 4934 static DECLCALLBACK(void) lsilogicPowerOff(PPDMDEVINS pDevIns) 4935 { 4936 Log(("lsilogicPowerOff\n")); 4937 lsilogicR3SuspendOrPowerOff(pDevIns); 4938 } 4939 4940 /** 4941 * @copydoc FNPDMDEVCONSTRUCT 4942 */ 4943 static DECLCALLBACK(int) lsilogicConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg) 4942 { 4943 int rc = RTMemCacheDestroy(pThis->hTaskCache); Assert(rc); 4944 pThis->hTaskCache = NIL_RTMEMCACHE; 4945 } 4946 4947 lsilogicR3ConfigurationPagesFree(pThis); 4948 4949 return VINF_SUCCESS; 4950 } 4951 4952 /** 4953 * @interface_method_impl{PDMDEVREG,pfnConstruct} 4954 */ 4955 static DECLCALLBACK(int) lsilogicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg) 4944 4956 { 4945 4957 PLSILOGICSCSI pThis = PDMINS_2_DATA(pDevIns, PLSILOGICSCSI); 4946 4958 int rc = VINF_SUCCESS; 4947 char *pszCtrlType = NULL;4948 4959 char szDevTag[20]; 4949 bool fBootable = true;4950 4960 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 4961 4962 /* 4963 * Initialize enought of the state to make the destructure not trip up. 4964 */ 4965 pThis->hTaskCache = NIL_RTMEMCACHE; 4951 4966 4952 4967 /* … … 4991 5006 Log(("%s: RequestQueueDepth=%u\n", __FUNCTION__, pThis->cRequestQueueEntries)); 4992 5007 5008 char *pszCtrlType; 4993 5009 rc = CFGMR3QueryStringAllocDef(pCfg, "ControllerType", 4994 5010 &pszCtrlType, LSILOGICSCSI_PCI_SPI_CTRLNAME); … … 4998 5014 Log(("%s: ControllerType=%s\n", __FUNCTION__, pszCtrlType)); 4999 5015 5000 rc = lsilogic GetCtrlTypeFromString(pThis, pszCtrlType);5016 rc = lsilogicR3GetCtrlTypeFromString(pThis, pszCtrlType); 5001 5017 MMR3HeapFree(pszCtrlType); 5002 5018 … … 5025 5041 N_("LsiLogic configuration error: failed to read NumPorts as integer")); 5026 5042 5043 bool fBootable; 5027 5044 rc = CFGMR3QueryBoolDef(pCfg, "Bootable", &fBootable, true); 5028 5045 if (RT_FAILURE(rc)) … … 5054 5071 PCIDevSetInterruptPin(&pThis->PciDev, 0x01); /* Interrupt pin A */ 5055 5072 5056 # ifdef VBOX_WITH_MSI_DEVICES5073 # ifdef VBOX_WITH_MSI_DEVICES 5057 5074 PCIDevSetStatus(&pThis->PciDev, VBOX_PCI_STATUS_CAP_LIST); 5058 5075 PCIDevSetCapabilityList(&pThis->PciDev, 0x80); 5059 # endif5076 # endif 5060 5077 5061 5078 pThis->pDevInsR3 = pDevIns; 5062 5079 pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 5063 5080 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 5064 pThis->IBase.pfnQueryInterface = lsilogic StatusQueryInterface;5065 pThis->ILeds.pfnQueryStatusLed = lsilogic StatusQueryStatusLed;5081 pThis->IBase.pfnQueryInterface = lsilogicR3StatusQueryInterface; 5082 pThis->ILeds.pfnQueryStatusLed = lsilogicR3StatusQueryStatusLed; 5066 5083 5067 5084 /* 5068 5085 * Register the PCI device, it's I/O regions. 5069 5086 */ 5070 rc = PDMDevHlpPCIRegister 5087 rc = PDMDevHlpPCIRegister(pDevIns, &pThis->PciDev); 5071 5088 if (RT_FAILURE(rc)) 5072 5089 return rc; 5073 5090 5074 # ifdef VBOX_WITH_MSI_DEVICES5091 # ifdef VBOX_WITH_MSI_DEVICES 5075 5092 PDMMSIREG MsiReg; 5076 5093 RT_ZERO(MsiReg); 5077 5094 /* use this code for MSI-X support */ 5078 # if 05095 # if 0 5079 5096 MsiReg.cMsixVectors = 1; 5080 5097 MsiReg.iMsixCapOffset = 0x80; 5081 5098 MsiReg.iMsixNextOffset = 0x00; 5082 5099 MsiReg.iMsixBar = 3; 5083 # else5100 # else 5084 5101 MsiReg.cMsiVectors = 1; 5085 5102 MsiReg.iMsiCapOffset = 0x80; 5086 5103 MsiReg.iMsiNextOffset = 0x00; 5087 # endif5104 # endif 5088 5105 rc = PDMDevHlpPCIRegisterMsi(pDevIns, &MsiReg); 5089 5106 if (RT_FAILURE (rc)) … … 5093 5110 PCIDevSetCapabilityList(&pThis->PciDev, 0x0); 5094 5111 } 5095 # endif5096 5097 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, LSILOGIC_PCI_SPACE_IO_SIZE, PCI_ADDRESS_SPACE_IO, lsilogic Map);5112 # endif 5113 5114 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, LSILOGIC_PCI_SPACE_IO_SIZE, PCI_ADDRESS_SPACE_IO, lsilogicR3Map); 5098 5115 if (RT_FAILURE(rc)) 5099 5116 return rc; 5100 5117 5101 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, LSILOGIC_PCI_SPACE_MEM_SIZE, PCI_ADDRESS_SPACE_MEM, lsilogic Map);5118 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 1, LSILOGIC_PCI_SPACE_MEM_SIZE, PCI_ADDRESS_SPACE_MEM, lsilogicR3Map); 5102 5119 if (RT_FAILURE(rc)) 5103 5120 return rc; 5104 5121 5105 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 2, LSILOGIC_PCI_SPACE_MEM_SIZE, PCI_ADDRESS_SPACE_MEM, lsilogic Map);5122 rc = PDMDevHlpPCIIORegionRegister(pDevIns, 2, LSILOGIC_PCI_SPACE_MEM_SIZE, PCI_ADDRESS_SPACE_MEM, lsilogicR3Map); 5106 5123 if (RT_FAILURE(rc)) 5107 5124 return rc; … … 5111 5128 RTStrPrintf(szTaggedText, sizeof(szTaggedText), "%s-Task", szDevTag); 5112 5129 rc = PDMDevHlpQueueCreate(pDevIns, sizeof(PDMQUEUEITEMCORE), 2, 0, 5113 lsilogic NotifyQueueConsumer, true,5130 lsilogicR3NotifyQueueConsumer, true, 5114 5131 szTaggedText, 5115 5132 &pThis->pNotificationQueueR3); … … 5128 5145 * Allocate memory for the queues. 5129 5146 */ 5130 rc = lsilogic QueuesAlloc(pThis);5147 rc = lsilogicR3QueuesAlloc(pThis); 5131 5148 if (RT_FAILURE(rc)) 5132 5149 return rc; … … 5149 5166 */ 5150 5167 rc = RTMemCacheCreate(&pThis->hTaskCache, sizeof(LSILOGICTASKSTATE), 0, UINT32_MAX, 5151 lsilogic TaskStateCtor, lsilogicTaskStateDtor, NULL, 0);5168 lsilogicR3TaskStateCtor, lsilogicR3TaskStateDtor, NULL, 0); 5152 5169 if (RT_FAILURE(rc)) 5153 5170 return PDMDEV_SET_ERROR(pDevIns, rc, … … 5178 5195 pDevice->pLsiLogicR3 = pThis; 5179 5196 pDevice->Led.u32Magic = PDMLED_MAGIC; 5180 pDevice->IBase.pfnQueryInterface = lsilogic DeviceQueryInterface;5181 pDevice->ISCSIPort.pfnSCSIRequestCompleted = lsilogic DeviceSCSIRequestCompleted;5182 pDevice->ISCSIPort.pfnQueryDeviceLocation = lsilogic QueryDeviceLocation;5183 pDevice->ILed.pfnQueryStatusLed = lsilogic DeviceQueryStatusLed;5197 pDevice->IBase.pfnQueryInterface = lsilogicR3DeviceQueryInterface; 5198 pDevice->ISCSIPort.pfnSCSIRequestCompleted = lsilogicR3DeviceSCSIRequestCompleted; 5199 pDevice->ISCSIPort.pfnQueryDeviceLocation = lsilogicR3QueryDeviceLocation; 5200 pDevice->ILed.pfnQueryStatusLed = lsilogicR3DeviceQueryStatusLed; 5184 5201 5185 5202 RTStrPrintf(szName, sizeof(szName), "Device%d", i); … … 5231 5248 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI) 5232 5249 rc = PDMDevHlpIOPortRegister(pDevIns, LSILOGIC_BIOS_IO_PORT, 4, NULL, 5233 lsilogic IsaIOPortWrite, lsilogicIsaIOPortRead,5234 lsilogic IsaIOPortWriteStr, lsilogicIsaIOPortReadStr,5250 lsilogicR3IsaIOPortWrite, lsilogicR3IsaIOPortRead, 5251 lsilogicR3IsaIOPortWriteStr, lsilogicR3IsaIOPortReadStr, 5235 5252 "LsiLogic BIOS"); 5236 5253 else if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SAS) 5237 5254 rc = PDMDevHlpIOPortRegister(pDevIns, LSILOGIC_SAS_BIOS_IO_PORT, 4, NULL, 5238 lsilogic IsaIOPortWrite, lsilogicIsaIOPortRead,5239 lsilogic IsaIOPortWriteStr, lsilogicIsaIOPortReadStr,5255 lsilogicR3IsaIOPortWrite, lsilogicR3IsaIOPortRead, 5256 lsilogicR3IsaIOPortWriteStr, lsilogicR3IsaIOPortReadStr, 5240 5257 "LsiLogic SAS BIOS"); 5241 5258 else … … 5248 5265 /* Register save state handlers. */ 5249 5266 rc = PDMDevHlpSSMRegisterEx(pDevIns, LSILOGIC_SAVED_STATE_VERSION, sizeof(*pThis), NULL, 5250 NULL, lsilogic LiveExec, NULL,5251 NULL, lsilogic SaveExec, NULL,5252 NULL, lsilogic LoadExec, lsilogicLoadDone);5267 NULL, lsilogicR3LiveExec, NULL, 5268 NULL, lsilogicR3SaveExec, NULL, 5269 NULL, lsilogicR3LoadExec, lsilogicR3LoadDone); 5253 5270 if (RT_FAILURE(rc)) 5254 5271 return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic cannot register save state handlers")); … … 5264 5281 pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI 5265 5282 ? "LsiLogic SPI info." 5266 : "LsiLogic SAS info.", lsilogic Info);5283 : "LsiLogic SAS info.", lsilogicR3Info); 5267 5284 5268 5285 /* Perform hard reset. */ 5269 rc = lsilogic HardReset(pThis);5286 rc = lsilogicR3HardReset(pThis); 5270 5287 AssertRC(rc); 5271 5288 … … 5298 5315 sizeof(LSILOGICSCSI), 5299 5316 /* pfnConstruct */ 5300 lsilogic Construct,5317 lsilogicR3Construct, 5301 5318 /* pfnDestruct */ 5302 lsilogic Destruct,5319 lsilogicR3Destruct, 5303 5320 /* pfnRelocate */ 5304 lsilogicR elocate,5321 lsilogicR3Relocate, 5305 5322 /* pfnIOCtl */ 5306 5323 NULL, … … 5308 5325 NULL, 5309 5326 /* pfnReset */ 5310 lsilogicR eset,5327 lsilogicR3Reset, 5311 5328 /* pfnSuspend */ 5312 lsilogic Suspend,5329 lsilogicR3Suspend, 5313 5330 /* pfnResume */ 5314 lsilogicR esume,5331 lsilogicR3Resume, 5315 5332 /* pfnAttach */ 5316 lsilogic Attach,5333 lsilogicR3Attach, 5317 5334 /* pfnDetach */ 5318 lsilogic Detach,5335 lsilogicR3Detach, 5319 5336 /* pfnQueryInterface. */ 5320 5337 NULL, … … 5322 5339 NULL, 5323 5340 /* pfnPowerOff */ 5324 lsilogic PowerOff,5341 lsilogicR3PowerOff, 5325 5342 /* pfnSoftReset */ 5326 5343 NULL, … … 5355 5372 sizeof(LSILOGICSCSI), 5356 5373 /* pfnConstruct */ 5357 lsilogic Construct,5374 lsilogicR3Construct, 5358 5375 /* pfnDestruct */ 5359 lsilogic Destruct,5376 lsilogicR3Destruct, 5360 5377 /* pfnRelocate */ 5361 lsilogicR elocate,5378 lsilogicR3Relocate, 5362 5379 /* pfnIOCtl */ 5363 5380 NULL, … … 5365 5382 NULL, 5366 5383 /* pfnReset */ 5367 lsilogicR eset,5384 lsilogicR3Reset, 5368 5385 /* pfnSuspend */ 5369 lsilogic Suspend,5386 lsilogicR3Suspend, 5370 5387 /* pfnResume */ 5371 lsilogicR esume,5388 lsilogicR3Resume, 5372 5389 /* pfnAttach */ 5373 lsilogic Attach,5390 lsilogicR3Attach, 5374 5391 /* pfnDetach */ 5375 lsilogic Detach,5392 lsilogicR3Detach, 5376 5393 /* pfnQueryInterface. */ 5377 5394 NULL, … … 5379 5396 NULL, 5380 5397 /* pfnPowerOff */ 5381 lsilogic PowerOff,5398 lsilogicR3PowerOff, 5382 5399 /* pfnSoftReset */ 5383 5400 NULL,
Note:
See TracChangeset
for help on using the changeset viewer.