Changeset 81800 in vbox
- Timestamp:
- Nov 12, 2019 12:59:38 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevBusLogic.cpp
r81765 r81800 95 95 { 96 96 /** Pointer to the owning buslogic device instance. - R3 pointer */ 97 R3PTRTYPE(struct BUSLOGIC *) pBusLogicR3;97 R3PTRTYPE(struct BUSLOGIC *) pBusLogicR3; 98 98 /** Pointer to the owning buslogic device instance. - R0 pointer */ 99 R0PTRTYPE(struct BUSLOGIC *) pBusLogicR0;99 R0PTRTYPE(struct BUSLOGIC *) pBusLogicR0; 100 100 /** Pointer to the owning buslogic device instance. - RC pointer */ 101 RCPTRTYPE(struct BUSLOGIC *) pBusLogicRC; 101 RCPTRTYPE(struct BUSLOGIC *) pBusLogicRC; 102 103 /** LUN of the device. */ 104 uint32_t iLUN; 102 105 103 106 /** Flag whether device is present. */ 104 bool fPresent; 105 /** LUN of the device. */ 106 RTUINT iLUN; 107 bool fPresent; 108 bool afAlignment[HC_ARCH_BITS == 64 ? 3 : 7]; 109 110 /** Our base interface. */ 111 PDMIBASE IBase; 112 /** Media port interface. */ 113 PDMIMEDIAPORT IMediaPort; 114 /** Extended media port interface. */ 115 PDMIMEDIAEXPORT IMediaExPort; 116 /** Led interface. */ 117 PDMILEDPORTS ILed; 118 /** Pointer to the attached driver's base interface. */ 119 R3PTRTYPE(PPDMIBASE) pDrvBase; 120 /** Pointer to the attached driver's media interface. */ 121 R3PTRTYPE(PPDMIMEDIA) pDrvMedia; 122 /** Pointer to the attached driver's extended media interface. */ 123 R3PTRTYPE(PPDMIMEDIAEX) pDrvMediaEx; 124 /** The status LED state for this device. */ 125 PDMLED Led; 126 127 /** Number of outstanding tasks on the port. */ 128 volatile uint32_t cOutstandingRequests; 107 129 108 130 #if HC_ARCH_BITS == 64 109 uint32_t Alignment0;131 uint32_t u32Alignment1; 110 132 #endif 111 112 /** Our base interface. */113 PDMIBASE IBase;114 /** Media port interface. */115 PDMIMEDIAPORT IMediaPort;116 /** Extended media port interface. */117 PDMIMEDIAEXPORT IMediaExPort;118 /** Led interface. */119 PDMILEDPORTS ILed;120 /** Pointer to the attached driver's base interface. */121 R3PTRTYPE(PPDMIBASE) pDrvBase;122 /** Pointer to the attached driver's media interface. */123 R3PTRTYPE(PPDMIMEDIA) pDrvMedia;124 /** Pointer to the attached driver's extended media interface. */125 R3PTRTYPE(PPDMIMEDIAEX) pDrvMediaEx;126 /** The status LED state for this device. */127 PDMLED Led;128 129 #if HC_ARCH_BITS == 64130 uint32_t Alignment1;131 #endif132 133 /** Number of outstanding tasks on the port. */134 volatile uint32_t cOutstandingRequests;135 136 133 } BUSLOGICDEVICE, *PBUSLOGICDEVICE; 137 134 … … 330 327 331 328 /** 332 * Main BusLogic devicestate.329 * The shared BusLogic device emulation state. 333 330 * 334 331 * @implements PDMILEDPORTS … … 502 499 #endif 503 500 504 } BUSLOGIC, *PBUSLOGIC; 501 } BUSLOGIC; 502 /** Pointer to the shared BusLogic device emulation state. */ 503 typedef BUSLOGIC *PBUSLOGIC; 504 505 505 506 506 /** Register offsets in the I/O port space. */ … … 4194 4194 static DECLCALLBACK(int) buslogicR3Destruct(PPDMDEVINS pDevIns) 4195 4195 { 4196 PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns); 4196 4197 PBUSLOGIC pThis = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC); 4197 PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns);4198 4198 4199 4199 PDMR3CritSectDelete(&pThis->CritSectIntr); … … 4213 4213 static DECLCALLBACK(int) buslogicR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg) 4214 4214 { 4215 PBUSLOGIC pThis = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC);4216 int rc = VINF_SUCCESS;4217 bool fBootable = true;4218 char achCfgStr[16];4219 4215 PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); 4216 PBUSLOGIC pThis = PDMDEVINS_2_DATA(pDevIns, PBUSLOGIC); 4217 PCPDMDEVHLPR3 pHlp = pDevIns->pHlpR3; 4218 int rc = VINF_SUCCESS; 4219 char szCfgStr[16]; 4220 4220 4221 4221 /* … … 4248 4248 * Validate and read configuration. 4249 4249 */ 4250 if (!CFGMR3AreValuesValid(pCfg, 4251 "GCEnabled\0" 4252 "R0Enabled\0" 4253 "Bootable\0" 4254 "AdapterType\0" 4255 "ISACompat\0")) 4256 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, 4257 N_("BusLogic configuration error: unknown option specified")); 4258 4259 rc = CFGMR3QueryBoolDef(pCfg, "GCEnabled", &pThis->fGCEnabled, true); 4250 PDMDEV_VALIDATE_CONFIG_RETURN(pDevIns, "Bootable|AdapterType|ISACompat", ""); 4251 4252 pThis->fGCEnabled = pDevIns->fRCEnabled; 4253 pThis->fR0Enabled = pDevIns->fR0Enabled; 4254 4255 bool fBootable = true; 4256 rc = pHlp->pfnCFGMQueryBoolDef(pCfg, "Bootable", &fBootable, true); 4260 4257 if (RT_FAILURE(rc)) 4261 return PDMDEV_SET_ERROR(pDevIns, rc, 4262 N_("BusLogic configuration error: failed to read GCEnabled as boolean"));4263 Log(("%s: fGCEnabled=%d\n", __FUNCTION__, pThis->fGCEnabled)); 4264 4265 rc = CFGMR3QueryBoolDef(pCfg, "R0Enabled", &pThis->fR0Enabled, true);4258 return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic configuration error: failed to read Bootable as boolean")); 4259 Log(("%s: fBootable=%RTbool\n", __FUNCTION__, fBootable)); 4260 4261 /* Figure out the emulated device type. */ 4262 rc = pHlp->pfnCFGMQueryStringDef(pCfg, "AdapterType", szCfgStr, sizeof(szCfgStr), "BT-958D"); 4266 4263 if (RT_FAILURE(rc)) 4267 return PDMDEV_SET_ERROR(pDevIns, rc, 4268 N_("BusLogic configuration error: failed to read R0Enabled as boolean")); 4269 Log(("%s: fR0Enabled=%d\n", __FUNCTION__, pThis->fR0Enabled)); 4270 rc = CFGMR3QueryBoolDef(pCfg, "Bootable", &fBootable, true); 4271 if (RT_FAILURE(rc)) 4272 return PDMDEV_SET_ERROR(pDevIns, rc, 4273 N_("BusLogic configuration error: failed to read Bootable as boolean")); 4274 Log(("%s: fBootable=%RTbool\n", __FUNCTION__, fBootable)); 4275 4276 /* Figure out the emulated device type. */ 4277 rc = CFGMR3QueryStringDef(pCfg, "AdapterType", achCfgStr, sizeof(achCfgStr), "BT-958D"); 4278 if (RT_FAILURE(rc)) 4279 return PDMDEV_SET_ERROR(pDevIns, rc, 4280 N_("BusLogic configuration error: failed to read AdapterType as string")); 4281 Log(("%s: AdapterType=%s\n", __FUNCTION__, achCfgStr)); 4264 return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic configuration error: failed to read AdapterType as string")); 4265 Log(("%s: AdapterType=%s\n", __FUNCTION__, szCfgStr)); 4282 4266 4283 4267 /* Grok the AdapterType setting. */ 4284 if (!strcmp( achCfgStr, "BT-958D")) /* Default PCI device, 32-bit and 24-bit addressing. */4268 if (!strcmp(szCfgStr, "BT-958D")) /* Default PCI device, 32-bit and 24-bit addressing. */ 4285 4269 { 4286 4270 pThis->uDevType = DEV_BT_958D; 4287 4271 pThis->uDefaultISABaseCode = ISA_BASE_DISABLED; 4288 4272 } 4289 else if (!strcmp( achCfgStr, "BT-545C")) /* ISA device, 24-bit addressing only. */4273 else if (!strcmp(szCfgStr, "BT-545C")) /* ISA device, 24-bit addressing only. */ 4290 4274 { 4291 4275 pThis->uDevType = DEV_BT_545C; 4292 4276 pThis->uIsaIrq = 11; 4293 4277 } 4294 else if (!strcmp( achCfgStr, "AHA-1540B")) /* Competitor ISA device. */4278 else if (!strcmp(szCfgStr, "AHA-1540B")) /* Competitor ISA device. */ 4295 4279 { 4296 4280 pThis->uDevType = DEV_AHA_1540B; … … 4303 4287 /* Only the first instance defaults to having the ISA compatibility ports enabled. */ 4304 4288 if (iInstance == 0) 4305 rc = CFGMR3QueryStringDef(pCfg, "ISACompat", achCfgStr, sizeof(achCfgStr), "Alternate");4289 rc = pHlp->pfnCFGMQueryStringDef(pCfg, "ISACompat", szCfgStr, sizeof(szCfgStr), "Alternate"); 4306 4290 else 4307 rc = CFGMR3QueryStringDef(pCfg, "ISACompat", achCfgStr, sizeof(achCfgStr), "Disabled");4291 rc = pHlp->pfnCFGMQueryStringDef(pCfg, "ISACompat", szCfgStr, sizeof(szCfgStr), "Disabled"); 4308 4292 if (RT_FAILURE(rc)) 4309 return PDMDEV_SET_ERROR(pDevIns, rc, 4310 N_("BusLogic configuration error: failed to read ISACompat as string")); 4311 Log(("%s: ISACompat=%s\n", __FUNCTION__, achCfgStr)); 4293 return PDMDEV_SET_ERROR(pDevIns, rc, N_("BusLogic configuration error: failed to read ISACompat as string")); 4294 Log(("%s: ISACompat=%s\n", __FUNCTION__, szCfgStr)); 4312 4295 4313 4296 /* Grok the ISACompat setting. */ 4314 if (!strcmp( achCfgStr, "Disabled"))4297 if (!strcmp(szCfgStr, "Disabled")) 4315 4298 pThis->uDefaultISABaseCode = ISA_BASE_DISABLED; 4316 else if (!strcmp( achCfgStr, "Primary"))4299 else if (!strcmp(szCfgStr, "Primary")) 4317 4300 pThis->uDefaultISABaseCode = 0; /* I/O base at 330h. */ 4318 else if (!strcmp( achCfgStr, "Alternate"))4301 else if (!strcmp(szCfgStr, "Alternate")) 4319 4302 pThis->uDefaultISABaseCode = 1; /* I/O base at 334h. */ 4320 4303 else
Note:
See TracChangeset
for help on using the changeset viewer.