Changeset 82224 in vbox
- Timestamp:
- Nov 26, 2019 4:12:30 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 135038
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmdev.h
r82049 r82224 1975 1975 1976 1976 /** Current PDMDEVHLPR3 version number. */ 1977 #define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 3 7, 0)1977 #define PDM_DEVHLPR3_VERSION PDM_VERSION_MAKE_PP(0xffe7, 38, 0) 1978 1978 1979 1979 /** … … 3444 3444 DECLR3CALLBACKMEMBER(int, pfnDriverDetach,(PPDMDEVINS pDevIns, PPDMDRVINS pDrvIns, uint32_t fFlags)); 3445 3445 3446 /** 3447 * Reconfigures the driver chain for a LUN, detaching any driver currently 3448 * present there. 3449 * 3450 * Caller will have attach it, of course. 3451 * 3452 * @returns VBox status code. 3453 * @param pDevIns The device instance. 3454 * @param iLun The logical unit to reconfigure. 3455 * @param cDepth The depth of the driver chain. Determins the 3456 * size of @a papszDrivers and @a papConfigs. 3457 * @param papszDrivers The names of the drivers to configure in the 3458 * chain, first entry is the one immediately 3459 * below the device/LUN 3460 * @param papConfigs The configurations for each of the drivers 3461 * in @a papszDrivers array. NULL entries 3462 * corresponds to empty 'Config' nodes. This 3463 * function will take ownership of non-NULL 3464 * CFGM sub-trees and set the array member to 3465 * NULL, so the caller can do cleanups on 3466 * failure. This parameter is optional. 3467 * @param fFlags Reserved, MBZ. 3468 */ 3469 DECLR3CALLBACKMEMBER(int, pfnDriverReconfigure,(PPDMDEVINS pDevIns, uint32_t iLun, uint32_t cDepth, 3470 const char * const *papszDrivers, PCFGMNODE *papConfigs, uint32_t fFlags)); 3471 3446 3472 /** @name Exported PDM Queue Functions 3447 3473 * @{ */ … … 7238 7264 7239 7265 /** 7266 * @copydoc PDMDEVHLPR3::pfnDriverReconfigure 7267 */ 7268 DECLINLINE(int) PDMDevHlpDriverReconfigure(PPDMDEVINS pDevIns, uint32_t iLun, uint32_t cDepth, 7269 const char * const *papszDrivers, PCFGMNODE *papConfigs, uint32_t fFlags) 7270 { 7271 return pDevIns->pHlpR3->pfnDriverReconfigure(pDevIns, iLun, cDepth, papszDrivers, papConfigs, fFlags); 7272 } 7273 7274 /** 7275 * Reconfigures with a single driver reattachement, no config, noflags. 7276 * @sa PDMDevHlpDriverReconfigure 7277 */ 7278 DECLINLINE(int) PDMDevHlpDriverReconfigure1(PPDMDEVINS pDevIns, uint32_t iLun, const char *pszDriver0) 7279 { 7280 return pDevIns->pHlpR3->pfnDriverReconfigure(pDevIns, iLun, 1, &pszDriver0, NULL, 0); 7281 } 7282 7283 /** 7284 * Reconfigures with a two drivers reattachement, no config, noflags. 7285 * @sa PDMDevHlpDriverReconfigure 7286 */ 7287 DECLINLINE(int) PDMDevHlpDriverReconfigure2(PPDMDEVINS pDevIns, uint32_t iLun, const char *pszDriver0, const char *pszDriver1) 7288 { 7289 char const * apszDrivers[2]; 7290 apszDrivers[0] = pszDriver0; 7291 apszDrivers[1] = pszDriver1; 7292 return pDevIns->pHlpR3->pfnDriverReconfigure(pDevIns, iLun, 2, apszDrivers, NULL, 0); 7293 } 7294 7295 /** 7240 7296 * @copydoc PDMDEVHLPR3::pfnQueueCreatePtr 7241 7297 */ -
trunk/src/VBox/VMM/VMMR3/PDMDevHlp.cpp
r82067 r82224 2503 2503 2504 2504 LogFlow(("pdmR3DevHlp_DriverDetach: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); 2505 return rc; 2506 } 2507 2508 2509 /** @interface_method_impl{PDMDEVHLPR3,pfnDriverReconfigure} */ 2510 static DECLCALLBACK(int) pdmR3DevHlp_DriverReconfigure(PPDMDEVINS pDevIns, uint32_t iLun, uint32_t cDepth, 2511 const char * const *papszDrivers, PCFGMNODE *papConfigs, uint32_t fFlags) 2512 { 2513 PDMDEV_ASSERT_DEVINS(pDevIns); 2514 PVM pVM = pDevIns->Internal.s.pVMR3; 2515 VM_ASSERT_EMT(pVM); 2516 LogFlow(("pdmR3DevHlp_DriverReconfigure: caller='%s'/%d: iLun=%u cDepth=%u fFlags=%#x\n", 2517 pDevIns->pReg->szName, pDevIns->iInstance, iLun, cDepth, fFlags)); 2518 2519 /* 2520 * Validate input. 2521 */ 2522 AssertReturn(cDepth <= 8, VERR_INVALID_PARAMETER); 2523 AssertPtrReturn(papszDrivers, VERR_INVALID_POINTER); 2524 AssertPtrNullReturn(papConfigs, VERR_INVALID_POINTER); 2525 for (uint32_t i = 0; i < cDepth; i++) 2526 { 2527 AssertPtrReturn(papszDrivers[i], VERR_INVALID_POINTER); 2528 size_t cchDriver = strlen(papszDrivers[i]); 2529 AssertPtrReturn(cchDriver > 0 && cchDriver < RT_SIZEOFMEMB(PDMDRVREG, szName), VERR_OUT_OF_RANGE); 2530 2531 if (papConfigs) 2532 AssertPtrNullReturn(papConfigs[i], VERR_INVALID_POINTER); 2533 } 2534 AssertReturn(fFlags == 0, VERR_INVALID_FLAGS); 2535 2536 /* 2537 * Do we have to detach an existing driver first? 2538 */ 2539 for (PPDMLUN pLun = pDevIns->Internal.s.pLunsR3; pLun; pLun = pLun->pNext) 2540 if (pLun->iLun == iLun) 2541 { 2542 if (pLun->pTop) 2543 { 2544 int rc = pdmR3DrvDetach(pLun->pTop, 0); 2545 AssertRCReturn(rc, rc); 2546 } 2547 break; 2548 } 2549 2550 /* 2551 * Remove the old tree. 2552 */ 2553 PCFGMNODE pCfgDev = CFGMR3GetChildF(CFGMR3GetRoot(pVM), "Devices/%s/%u/", pDevIns->pReg->szName, pDevIns->iInstance); 2554 AssertReturn(pCfgDev, VERR_INTERNAL_ERROR_2); 2555 PCFGMNODE pCfgLun = CFGMR3GetChildF(pCfgDev, "LUN#%u", iLun); 2556 if (pCfgLun) 2557 CFGMR3RemoveNode(pCfgLun); 2558 2559 /* 2560 * Construct a new tree. 2561 */ 2562 int rc = CFGMR3InsertNodeF(pCfgDev, &pCfgLun, "LUN#%u", iLun); 2563 AssertRCReturn(rc, rc); 2564 PCFGMNODE pCfgDrv = pCfgLun; 2565 for (uint32_t i = 0; i < cDepth; i++) 2566 { 2567 rc = CFGMR3InsertString(pCfgDrv, "Driver", papszDrivers[i]); 2568 AssertRCReturn(rc, rc); 2569 if (papConfigs && papConfigs[i]) 2570 { 2571 rc = CFGMR3InsertSubTree(pCfgDrv, "Config", papConfigs[i], NULL); 2572 AssertRCReturn(rc, rc); 2573 papConfigs[i] = NULL; 2574 } 2575 else 2576 { 2577 rc = CFGMR3InsertNode(pCfgDrv, "Config", NULL); 2578 AssertRCReturn(rc, rc); 2579 } 2580 2581 if (i + 1 >= cDepth) 2582 break; 2583 rc = CFGMR3InsertNode(pCfgDrv, "AttachedDriver", &pCfgDrv); 2584 AssertRCReturn(rc, rc); 2585 } 2586 2587 LogFlow(("pdmR3DevHlp_DriverReconfigure: caller='%s'/%d: returns %Rrc\n", pDevIns->pReg->szName, pDevIns->iInstance, rc)); 2505 2588 return rc; 2506 2589 } … … 4498 4581 pdmR3DevHlp_DriverAttach, 4499 4582 pdmR3DevHlp_DriverDetach, 4583 pdmR3DevHlp_DriverReconfigure, 4500 4584 pdmR3DevHlp_QueueCreatePtr, 4501 4585 pdmR3DevHlp_QueueCreate, … … 4995 5079 pdmR3DevHlp_DriverAttach, 4996 5080 pdmR3DevHlp_DriverDetach, 5081 pdmR3DevHlp_DriverReconfigure, 4997 5082 pdmR3DevHlp_QueueCreatePtr, 4998 5083 pdmR3DevHlp_QueueCreate,
Note:
See TracChangeset
for help on using the changeset viewer.