Changeset 34009 in vbox
- Timestamp:
- Nov 11, 2010 8:14:36 PM (14 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r33595 r34009 635 635 * a port is entering the idle state. */ 636 636 bool volatile fSignalIdle; 637 bool afAlignment8[1]; 637 /** Flag whether the controller has BIOS access enabled. */ 638 bool fBootable; 638 639 639 640 /** Number of usable ports on this controller. */ … … 6696 6697 } 6697 6698 6698 for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aCts); i++) 6699 if (!ataControllerIsIdle(&pThis->aCts[i])) 6700 return false; 6699 if (pThis->fBootable) 6700 for (uint32_t i = 0; i < RT_ELEMENTS(pThis->aCts); i++) 6701 if (!ataControllerIsIdle(&pThis->aCts[i])) 6702 return false; 6701 6703 6702 6704 return true; … … 7406 7408 7407 7409 Log(("%s:\n", __FUNCTION__)); 7408 for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) 7409 ataControllerResume(&pAhci->aCts[i]); 7410 if (pAhci->fBootable) 7411 for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) 7412 ataControllerResume(&pAhci->aCts[i]); 7410 7413 return; 7411 7414 } … … 7593 7596 ahciPortHwReset(&pAhci->ahciPort[i]); 7594 7597 7595 for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) 7596 ataControllerReset(&pAhci->aCts[i]); 7598 if (pAhci->fBootable) 7599 for (uint32_t i = 0; i < RT_ELEMENTS(pAhci->aCts); i++) 7600 ataControllerReset(&pAhci->aCts[i]); 7597 7601 return VINF_SUCCESS; 7598 7602 } … … 7664 7668 */ 7665 7669 if (!CFGMR3AreValuesValid(pCfg, "GCEnabled\0" 7666 "R0Enabled\0" 7667 "PrimaryMaster\0" 7668 "PrimarySlave\0" 7669 "SecondaryMaster\0" 7670 "SecondarySlave\0" 7671 "PortCount\0" 7672 "UseAsyncInterfaceIfAvailable\0")) 7670 "R0Enabled\0" 7671 "PrimaryMaster\0" 7672 "PrimarySlave\0" 7673 "SecondaryMaster\0" 7674 "SecondarySlave\0" 7675 "PortCount\0" 7676 "UseAsyncInterfaceIfAvailable\0" 7677 "Bootable\0")) 7673 7678 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 7674 7679 N_("AHCI configuration error: unknown option specified")); … … 7704 7709 return PDMDEV_SET_ERROR(pDevIns, rc, 7705 7710 N_("AHCI configuration error: failed to read UseAsyncInterfaceIfAvailable as boolean")); 7711 7712 rc = CFGMR3QueryBoolDef(pCfg, "Bootable", &pThis->fBootable, true); 7713 if (RT_FAILURE(rc)) 7714 return PDMDEV_SET_ERROR(pDevIns, rc, 7715 N_("AHCI configuration error: failed to read Bootable as boolean")); 7706 7716 7707 7717 pThis->fR0Enabled = fR0Enabled; … … 7801 7811 N_("AHCI cannot register PCI memory region for registers")); 7802 7812 7803 rc = PDMDevHlpCritSectInit(pDevIns, &pThis->lock, RT_SRC_POS, "AHCI ");7813 rc = PDMDevHlpCritSectInit(pDevIns, &pThis->lock, RT_SRC_POS, "AHCI%d", pDevIns->iInstance); 7804 7814 if (RT_FAILURE(rc)) 7805 7815 { … … 8050 8060 } 8051 8061 8052 /* 8053 * Setup IDE emulation. 8054 * We only emulate the I/O ports but not bus master DMA. 8055 * If the configuration values are not found the setup of the ports is as follows: 8056 * Primary Master: Port 0 8057 * Primary Slave: Port 1 8058 * Secondary Master: Port 2 8059 * Secondary Slave: Port 3 8060 */ 8061 8062 /* 8063 * Setup I/O ports for the PCI device. 8064 */ 8065 pThis->aCts[0].irq = 12; 8066 pThis->aCts[0].IOPortBase1 = 0x1e8; 8067 pThis->aCts[0].IOPortBase2 = 0x3e6; 8068 pThis->aCts[1].irq = 11; 8069 pThis->aCts[1].IOPortBase1 = 0x168; 8070 pThis->aCts[1].IOPortBase2 = 0x366; 8071 8072 for (i = 0; i < RT_ELEMENTS(pThis->aCts); i++) 8073 { 8074 PAHCIATACONTROLLER pCtl = &pThis->aCts[i]; 8075 uint32_t iPortMaster, iPortSlave; 8076 uint32_t cbSSMState = 0; 8077 static const char *s_apszDescs[RT_ELEMENTS(pThis->aCts)][RT_ELEMENTS(pCtl->aIfs)] = 8078 { 8079 { "PrimaryMaster", "PrimarySlave" }, 8080 { "SecondaryMaster", "SecondarySlave" } 8081 }; 8082 8083 rc = CFGMR3QueryU32Def(pCfg, s_apszDescs[i][0], &iPortMaster, 2 * i); 8084 if (RT_FAILURE(rc)) 8085 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 8086 N_("AHCI configuration error: failed to read %s as U32"), s_apszDescs[i][0]); 8087 8088 rc = CFGMR3QueryU32Def(pCfg, s_apszDescs[i][1], &iPortSlave, 2 * i + 1); 8089 if (RT_FAILURE(rc)) 8090 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 8091 N_("AHCI configuration error: failed to read %s as U32"), s_apszDescs[i][1]); 8092 8093 char szName[24]; 8094 RTStrPrintf(szName, sizeof(szName), "EmulatedATA%d", i); 8095 rc = ataControllerInit(pDevIns, pCtl, 8096 iPortMaster, pThis->ahciPort[iPortMaster].pDrvBase, 8097 iPortSlave, pThis->ahciPort[iPortSlave].pDrvBase, 8098 &cbSSMState, szName, &pThis->ahciPort[iPortMaster].Led, 8099 &pThis->ahciPort[iPortMaster].StatBytesRead, 8100 &pThis->ahciPort[iPortMaster].StatBytesWritten); 8101 if (RT_FAILURE(rc)) 8102 return rc; 8103 8104 cbTotalBufferSize += cbSSMState; 8105 8106 rc = PDMDevHlpIOPortRegister(pDevIns, pCtl->IOPortBase1, 8, (RTHCPTR)i, 8107 ahciIOPortWrite1, ahciIOPortRead1, ahciIOPortWriteStr1, ahciIOPortReadStr1, "AHCI"); 8108 if (RT_FAILURE(rc)) 8109 return rc; 8110 8111 if (pThis->fR0Enabled) 8112 { 8113 rc = PDMDevHlpIOPortRegisterR0(pDevIns, pCtl->IOPortBase1, 8, (RTR0PTR)i, 8114 "ahciIOPortWrite1", "ahciIOPortRead1", NULL, NULL, "AHCI R0"); 8062 if (pThis->fBootable) 8063 { 8064 /* 8065 * Setup IDE emulation. 8066 * We only emulate the I/O ports but not bus master DMA. 8067 * If the configuration values are not found the setup of the ports is as follows: 8068 * Primary Master: Port 0 8069 * Primary Slave: Port 1 8070 * Secondary Master: Port 2 8071 * Secondary Slave: Port 3 8072 */ 8073 8074 /* 8075 * Setup I/O ports for the PCI device. 8076 */ 8077 pThis->aCts[0].irq = 12; 8078 pThis->aCts[0].IOPortBase1 = 0x1e8; 8079 pThis->aCts[0].IOPortBase2 = 0x3e6; 8080 pThis->aCts[1].irq = 11; 8081 pThis->aCts[1].IOPortBase1 = 0x168; 8082 pThis->aCts[1].IOPortBase2 = 0x366; 8083 8084 for (i = 0; i < RT_ELEMENTS(pThis->aCts); i++) 8085 { 8086 PAHCIATACONTROLLER pCtl = &pThis->aCts[i]; 8087 uint32_t iPortMaster, iPortSlave; 8088 uint32_t cbSSMState = 0; 8089 static const char *s_apszDescs[RT_ELEMENTS(pThis->aCts)][RT_ELEMENTS(pCtl->aIfs)] = 8090 { 8091 { "PrimaryMaster", "PrimarySlave" }, 8092 { "SecondaryMaster", "SecondarySlave" } 8093 }; 8094 8095 rc = CFGMR3QueryU32Def(pCfg, s_apszDescs[i][0], &iPortMaster, 2 * i); 8096 if (RT_FAILURE(rc)) 8097 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 8098 N_("AHCI configuration error: failed to read %s as U32"), s_apszDescs[i][0]); 8099 8100 rc = CFGMR3QueryU32Def(pCfg, s_apszDescs[i][1], &iPortSlave, 2 * i + 1); 8101 if (RT_FAILURE(rc)) 8102 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 8103 N_("AHCI configuration error: failed to read %s as U32"), s_apszDescs[i][1]); 8104 8105 char szName[24]; 8106 RTStrPrintf(szName, sizeof(szName), "EmulatedATA%d", i); 8107 rc = ataControllerInit(pDevIns, pCtl, 8108 iPortMaster, pThis->ahciPort[iPortMaster].pDrvBase, 8109 iPortSlave, pThis->ahciPort[iPortSlave].pDrvBase, 8110 &cbSSMState, szName, &pThis->ahciPort[iPortMaster].Led, 8111 &pThis->ahciPort[iPortMaster].StatBytesRead, 8112 &pThis->ahciPort[iPortMaster].StatBytesWritten); 8115 8113 if (RT_FAILURE(rc)) 8116 8114 return rc; 8117 } 8118 8119 if (pThis->fGCEnabled) 8120 { 8121 rc = PDMDevHlpIOPortRegisterRC(pDevIns, pCtl->IOPortBase1, 8, (RTGCPTR)i, 8122 "ahciIOPortWrite1", "ahciIOPortRead1", NULL, NULL, "AHCI GC"); 8115 8116 cbTotalBufferSize += cbSSMState; 8117 8118 rc = PDMDevHlpIOPortRegister(pDevIns, pCtl->IOPortBase1, 8, (RTHCPTR)i, 8119 ahciIOPortWrite1, ahciIOPortRead1, ahciIOPortWriteStr1, ahciIOPortReadStr1, "AHCI"); 8123 8120 if (RT_FAILURE(rc)) 8124 8121 return rc; 8125 } 8126 8127 rc = PDMDevHlpIOPortRegister(pDevIns, pCtl->IOPortBase2, 1, (RTHCPTR)i, 8128 ahciIOPortWrite2, ahciIOPortRead2, NULL, NULL, "AHCI"); 8129 if (RT_FAILURE(rc)) 8130 return rc; 8131 8132 if (pThis->fR0Enabled) 8133 { 8134 rc = PDMDevHlpIOPortRegisterR0(pDevIns, pCtl->IOPortBase2, 1, (RTR0PTR)i, 8135 "ahciIOPortWrite2", "ahciIOPortRead2", NULL, NULL, "AHCI R0"); 8122 8123 if (pThis->fR0Enabled) 8124 { 8125 rc = PDMDevHlpIOPortRegisterR0(pDevIns, pCtl->IOPortBase1, 8, (RTR0PTR)i, 8126 "ahciIOPortWrite1", "ahciIOPortRead1", NULL, NULL, "AHCI R0"); 8127 if (RT_FAILURE(rc)) 8128 return rc; 8129 } 8130 8131 if (pThis->fGCEnabled) 8132 { 8133 rc = PDMDevHlpIOPortRegisterRC(pDevIns, pCtl->IOPortBase1, 8, (RTGCPTR)i, 8134 "ahciIOPortWrite1", "ahciIOPortRead1", NULL, NULL, "AHCI GC"); 8135 if (RT_FAILURE(rc)) 8136 return rc; 8137 } 8138 8139 rc = PDMDevHlpIOPortRegister(pDevIns, pCtl->IOPortBase2, 1, (RTHCPTR)i, 8140 ahciIOPortWrite2, ahciIOPortRead2, NULL, NULL, "AHCI"); 8136 8141 if (RT_FAILURE(rc)) 8137 8142 return rc; 8138 } 8139 8140 if (pThis->fGCEnabled) 8141 { 8142 rc = PDMDevHlpIOPortRegisterRC(pDevIns, pCtl->IOPortBase2, 1, (RTGCPTR)i, 8143 "ahciIOPortWrite2", "ahciIOPortRead2", NULL, NULL, "AHCI GC"); 8144 if (RT_FAILURE(rc)) 8145 return rc; 8143 8144 if (pThis->fR0Enabled) 8145 { 8146 rc = PDMDevHlpIOPortRegisterR0(pDevIns, pCtl->IOPortBase2, 1, (RTR0PTR)i, 8147 "ahciIOPortWrite2", "ahciIOPortRead2", NULL, NULL, "AHCI R0"); 8148 if (RT_FAILURE(rc)) 8149 return rc; 8150 } 8151 8152 if (pThis->fGCEnabled) 8153 { 8154 rc = PDMDevHlpIOPortRegisterRC(pDevIns, pCtl->IOPortBase2, 1, (RTGCPTR)i, 8155 "ahciIOPortWrite2", "ahciIOPortRead2", NULL, NULL, "AHCI GC"); 8156 if (RT_FAILURE(rc)) 8157 return rc; 8158 } 8146 8159 } 8147 8160 } -
trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
r33676 r34009 2960 2960 PBUSLOGIC pThis = PDMINS_2_DATA(pDevIns, PBUSLOGIC); 2961 2961 int rc = VINF_SUCCESS; 2962 bool fBootable = true; 2962 2963 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 2963 2964 … … 2967 2968 if (!CFGMR3AreValuesValid(pCfg, 2968 2969 "GCEnabled\0" 2969 "R0Enabled\0")) 2970 "R0Enabled\0" 2971 "Bootable\0")) 2970 2972 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 2971 2973 N_("BusLogic configuration error: unknown option specified")); … … 2982 2984 N_("BusLogic configuration error: failed to read R0Enabled as boolean")); 2983 2985 Log(("%s: fR0Enabled=%d\n", __FUNCTION__, pThis->fR0Enabled)); 2984 2986 rc = CFGMR3QueryBoolDef(pCfg, "Bootable", &fBootable, true); 2987 if (RT_FAILURE(rc)) 2988 return PDMDEV_SET_ERROR(pDevIns, rc, 2989 N_("BusLogic configuration error: failed to read Bootable as boolean")); 2990 Log(("%s: fBootable=%RTbool\n", __FUNCTION__, fBootable)); 2985 2991 2986 2992 pThis->pDevInsR3 = pDevIns; … … 3019 3025 return rc; 3020 3026 3021 /* Register I/O port space in ISA region for BIOS access. */ 3022 rc = PDMDevHlpIOPortRegister(pDevIns, BUSLOGIC_ISA_IO_PORT, 3, NULL, 3023 buslogicIsaIOPortWrite, buslogicIsaIOPortRead, 3024 buslogicIsaIOPortWriteStr, buslogicIsaIOPortReadStr, 3025 "BusLogic BIOS"); 3026 if (RT_FAILURE(rc)) 3027 return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic cannot register legacy I/O handlers")); 3027 if (fBootable) 3028 { 3029 /* Register I/O port space in ISA region for BIOS access. */ 3030 rc = PDMDevHlpIOPortRegister(pDevIns, BUSLOGIC_ISA_IO_PORT, 3, NULL, 3031 buslogicIsaIOPortWrite, buslogicIsaIOPortRead, 3032 buslogicIsaIOPortWriteStr, buslogicIsaIOPortReadStr, 3033 "BusLogic BIOS"); 3034 if (RT_FAILURE(rc)) 3035 return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic cannot register legacy I/O handlers")); 3036 } 3028 3037 3029 3038 /* Initialize task cache. */ -
trunk/src/VBox/Devices/Storage/DevLsiLogicSCSI.cpp
r33919 r34009 4940 4940 char *pszCtrlType = NULL; 4941 4941 char szDevTag[20], szTaggedText[64]; 4942 bool fBootable = true; 4942 4943 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 4943 4944 … … 4950 4951 "RequestQueueDepth\0" 4951 4952 "ControllerType\0" 4952 "NumPorts\0"); 4953 "NumPorts\0" 4954 "Bootable\0"); 4953 4955 if (RT_FAILURE(rc)) 4954 4956 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, … … 4988 4990 N_("LsiLogic configuration error: failed to read ControllerType as string")); 4989 4991 Log(("%s: ControllerType=%s\n", __FUNCTION__, pszCtrlType)); 4990 4992 4991 4993 rc = lsilogicGetCtrlTypeFromString(pThis, pszCtrlType); 4992 4994 MMR3HeapFree(pszCtrlType); … … 5015 5017 return PDMDEV_SET_ERROR(pDevIns, rc, 5016 5018 N_("LsiLogic configuration error: failed to read NumPorts as integer")); 5019 5020 rc = CFGMR3QueryBoolDef(pCfg, "Bootable", &fBootable, true); 5021 if (RT_FAILURE(rc)) 5022 return PDMDEV_SET_ERROR(pDevIns, rc, 5023 N_("LsiLogic configuration error: failed to read Bootable as boolean")); 5024 Log(("%s: Bootable=%RTbool\n", __FUNCTION__, fBootable)); 5017 5025 5018 5026 /* Init static parts. */ … … 5119 5127 * Create critical sections protecting the reply post and free queues. 5120 5128 */ 5121 RTStrPrintf(szTaggedText, sizeof(szTaggedText), "%sRFQ", szDevTag); 5129 RTStrPrintf(szTaggedText, sizeof(szTaggedText), "%sRFQ", szDevTag); 5122 5130 rc = PDMDevHlpCritSectInit(pDevIns, &pThis->ReplyFreeQueueCritSect, RT_SRC_POS, 5123 5131 szTaggedText); … … 5126 5134 N_("LsiLogic: cannot create critical section for reply free queue")); 5127 5135 5128 RTStrPrintf(szTaggedText, sizeof(szTaggedText), "%sRPQ", szDevTag); 5136 RTStrPrintf(szTaggedText, sizeof(szTaggedText), "%sRPQ", szDevTag); 5129 5137 rc = PDMDevHlpCritSectInit(pDevIns, &pThis->ReplyPostQueueCritSect, RT_SRC_POS, 5130 5138 szTaggedText); … … 5210 5218 AssertRC(rc); 5211 5219 5212 /* Register I/O port space in ISA region for BIOS access, only for first controller. */ 5213 if (iInstance == 0) 5220 /* 5221 * Register I/O port space in ISA region for BIOS access 5222 * if the controller is marked as bootable. 5223 */ 5224 if (fBootable) 5214 5225 { 5215 5226 if (pThis->enmCtrlType == LSILOGICCTRLTYPE_SCSI_SPI) … … 5228 5239 if (RT_FAILURE(rc)) 5229 5240 return PDMDEV_SET_ERROR(pDevIns, rc, N_("LsiLogic cannot register legacy I/O handlers")); 5230 } 5241 } 5231 5242 5232 5243 /* Register save state handlers. */ -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r33648 r34009 1269 1269 GEN_CHECK_OFF(AHCI, fR0Enabled); 1270 1270 GEN_CHECK_OFF(AHCI, fSignalIdle); 1271 GEN_CHECK_OFF(AHCI, fBootable); 1271 1272 GEN_CHECK_OFF(AHCI, cPortsImpl); 1272 1273 GEN_CHECK_OFF(AHCI, f8ByteMMIO4BytesWrittenSuccessfully);
Note:
See TracChangeset
for help on using the changeset viewer.