- Timestamp:
- Oct 13, 2010 11:53:15 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
r33096 r33097 259 259 #pragma pack() 260 260 261 /** Pointer to a task state. */262 typedef struct BUSLOGICTASKSTATE *PBUSLOGICTASKSTATE;263 264 261 /** 265 262 * Main BusLogic device state. … … 394 391 * a port is entering the idle state. */ 395 392 bool volatile fSignalIdle; 396 /** Flag whether we have tasks which need to be processed again- */397 bool volatile fRedo;398 /** List of tasks which can be redone. */399 R3PTRTYPE(volatile PBUSLOGICTASKSTATE) pTasksRedoHead;400 393 401 394 } BUSLOGIC, *PBUSLOGIC; … … 744 737 typedef struct BUSLOGICTASKSTATE 745 738 { 746 /** Pointer to the next task to redo. */747 PBUSLOGICTASKSTATE pTaskRedoNext;748 739 /** Device this task is assigned to. */ 749 R3PTRTYPE(PBUSLOGICDEVICE) pTargetDeviceR3;740 R3PTRTYPE(PBUSLOGICDEVICE) pTargetDeviceR3; 750 741 /** The command control block from the guest. */ 751 CommandControlBlock 742 CommandControlBlock CommandControlBlockGuest; 752 743 /** Mailbox read from guest memory. */ 753 Mailbox 744 Mailbox MailboxGuest; 754 745 /** The SCSI request we pass to the underlying SCSI engine. */ 755 PDMSCSIREQUEST 746 PDMSCSIREQUEST PDMScsiRequest; 756 747 /** Data buffer segment */ 757 RTSGSEG 748 RTSGSEG DataSeg; 758 749 /** Pointer to the R3 sense buffer. */ 759 uint8_t 750 uint8_t *pbSenseBuffer; 760 751 /** Flag whether this is a request from the BIOS. */ 761 bool 762 } BUSLOGICTASKSTATE ;752 bool fBIOS; 753 } BUSLOGICTASKSTATE, *PBUSLOGICTASKSTATE; 763 754 764 755 #ifndef VBOX_DEVICE_STRUCT_TESTCASE … … 1870 1861 rc = pTaskState->CTX_SUFF(pTargetDevice)->pDrvSCSIConnector->pfnSCSIRequestSend(pTaskState->CTX_SUFF(pTargetDevice)->pDrvSCSIConnector, 1871 1862 &pTaskState->PDMScsiRequest); 1872 AssertMsgRC(rc, ("Sending request to SCSI layer failed rc=%Rrc\n", rc)); 1873 1874 if (rc == VINF_VD_ASYNC_IO_FINISHED) 1875 { 1876 vboxscsiRequestFinished(&pBusLogic->VBoxSCSI, &pTaskState->PDMScsiRequest); 1877 RTMemCacheFree(pBusLogic->hTaskCache, pTaskState); 1878 rc = VINF_SUCCESS; 1879 } 1863 AssertMsgRCReturn(rc, ("Sending request to SCSI layer failed rc=%Rrc\n", rc), rc); 1880 1864 } 1881 1865 … … 2029 2013 } 2030 2014 2031 static void buslogicWarningDiskFull(PPDMDEVINS pDevIns)2032 {2033 int rc;2034 LogRel(("BusLogic#%d: Host disk full\n", pDevIns->iInstance));2035 rc = PDMDevHlpVMSetRuntimeError(pDevIns, VMSETRTERR_FLAGS_SUSPEND | VMSETRTERR_FLAGS_NO_WAIT, "DevBusLogic_DISKFULL",2036 N_("Host system reported disk full. VM execution is suspended. You can resume after freeing some space"));2037 AssertRC(rc);2038 }2039 2040 static void buslogicWarningFileTooBig(PPDMDEVINS pDevIns)2041 {2042 int rc;2043 LogRel(("BusLogic#%d: File too big\n", pDevIns->iInstance));2044 rc = PDMDevHlpVMSetRuntimeError(pDevIns, VMSETRTERR_FLAGS_SUSPEND | VMSETRTERR_FLAGS_NO_WAIT, "DevBusLogic_FILETOOBIG",2045 N_("Host system reported that the file size limit of the host file system has been exceeded. VM execution is suspended. You need to move your virtual hard disk to a filesystem which allows bigger files"));2046 AssertRC(rc);2047 }2048 2049 static void buslogicWarningISCSI(PPDMDEVINS pDevIns)2050 {2051 int rc;2052 LogRel(("BusLogic#%d: iSCSI target unavailable\n", pDevIns->iInstance));2053 rc = PDMDevHlpVMSetRuntimeError(pDevIns, VMSETRTERR_FLAGS_SUSPEND | VMSETRTERR_FLAGS_NO_WAIT, "DevBusLogic_ISCSIDOWN",2054 N_("The iSCSI target has stopped responding. VM execution is suspended. You can resume when it is available again"));2055 AssertRC(rc);2056 }2057 2058 static void buslogicWarningUnknown(PPDMDEVINS pDevIns, int rc)2059 {2060 int rc2;2061 LogRel(("BusLogic#%d: Unknown but recoverable error has occurred (rc=%Rrc)\n", pDevIns->iInstance, rc));2062 rc2 = PDMDevHlpVMSetRuntimeError(pDevIns, VMSETRTERR_FLAGS_SUSPEND | VMSETRTERR_FLAGS_NO_WAIT, "DevBusLogic_UNKNOWN",2063 N_("An unknown but recoverable I/O error has occurred (rc=%Rrc). VM execution is suspended. You can resume when the error is fixed"), rc);2064 AssertRC(rc2);2065 }2066 2067 static void buslogicRedoSetWarning(PBUSLOGIC pThis, int rc)2068 {2069 if (rc == VERR_DISK_FULL)2070 buslogicWarningDiskFull(pThis->CTX_SUFF(pDevIns));2071 else if (rc == VERR_FILE_TOO_BIG)2072 buslogicWarningFileTooBig(pThis->CTX_SUFF(pDevIns));2073 else if (rc == VERR_BROKEN_PIPE || rc == VERR_NET_CONNECTION_REFUSED)2074 {2075 /* iSCSI connection abort (first error) or failure to reestablish2076 * connection (second error). Pause VM. On resume we'll retry. */2077 buslogicWarningISCSI(pThis->CTX_SUFF(pDevIns));2078 }2079 else2080 buslogicWarningUnknown(pThis->CTX_SUFF(pDevIns), rc);2081 }2082 2083 2084 2015 static DECLCALLBACK(int) buslogicDeviceSCSIRequestCompleted(PPDMISCSIPORT pInterface, PPDMSCSIREQUEST pSCSIRequest, 2085 2016 int rcCompletion, bool fRedo, int rcReq) … … 2090 2021 PBUSLOGIC pBusLogic = pBusLogicDevice->CTX_SUFF(pBusLogic); 2091 2022 2092 if (fRedo) 2093 { 2094 2023 LogFlowFunc(("before decrement %u\n", pBusLogicDevice->cOutstandingRequests)); 2024 ASMAtomicDecU32(&pBusLogicDevice->cOutstandingRequests); 2025 LogFlowFunc(("after decrement %u\n", pBusLogicDevice->cOutstandingRequests)); 2026 2027 if (pTaskState->fBIOS) 2028 { 2029 rc = vboxscsiRequestFinished(&pBusLogic->VBoxSCSI, pSCSIRequest); 2030 AssertMsgRC(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc)); 2095 2031 } 2096 2032 else 2097 2033 { 2098 if (pTaskState->fBIOS) 2099 { 2100 rc = vboxscsiRequestFinished(&pBusLogic->VBoxSCSI, pSCSIRequest); 2101 AssertMsgRC(rc, ("Finishing BIOS SCSI request failed rc=%Rrc\n", rc)); 2102 } 2103 else 2104 { 2105 buslogicDataBufferFree(pTaskState); 2106 2107 if (pTaskState->pbSenseBuffer) 2108 buslogicSenseBufferFree(pTaskState, (rcCompletion != SCSI_STATUS_OK)); 2109 2110 buslogicSendIncomingMailbox(pBusLogic, pTaskState, 2111 BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_CMD_COMPLETED, 2112 BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS_OPERATION_GOOD, 2113 BUSLOGIC_MAILBOX_INCOMING_COMPLETION_WITHOUT_ERROR); 2114 } 2115 2116 /* Add task to the cache. */ 2117 RTMemCacheFree(pBusLogic->hTaskCache, pTaskState); 2118 } 2119 2120 ASMAtomicDecU32(&pBusLogicDevice->cOutstandingRequests); 2034 buslogicDataBufferFree(pTaskState); 2035 2036 if (pTaskState->pbSenseBuffer) 2037 buslogicSenseBufferFree(pTaskState, (rcCompletion != SCSI_STATUS_OK)); 2038 2039 buslogicSendIncomingMailbox(pBusLogic, pTaskState, 2040 BUSLOGIC_MAILBOX_INCOMING_ADAPTER_STATUS_CMD_COMPLETED, 2041 BUSLOGIC_MAILBOX_INCOMING_DEVICE_STATUS_OPERATION_GOOD, 2042 BUSLOGIC_MAILBOX_INCOMING_COMPLETION_WITHOUT_ERROR); 2043 } 2044 2045 /* Add task to the cache. */ 2046 RTMemCacheFree(pBusLogic->hTaskCache, pTaskState); 2121 2047 2122 2048 if (pBusLogicDevice->cOutstandingRequests == 0 && pBusLogic->fSignalIdle)
Note:
See TracChangeset
for help on using the changeset viewer.