Changeset 5720 in vbox
- Timestamp:
- Nov 13, 2007 11:07:59 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PDM.cpp
r5031 r5720 309 309 310 310 /** 311 * Worker for pdmR3Term that terminates a LUN chain. 312 * 313 * @param pVM Pointer to the shared VM structure. 314 * @param pLun The head of the chain. 315 * @param pszDevice The name of the device (for logging). 316 * @param iInstance The device instance number (for logging). 317 */ 318 static void pdmR3TermLuns(PVM pVM, PPDMLUN pLun, const char *pszDevice, unsigned iInstance) 319 { 320 for (; pLun; pLun = pLun->pNext) 321 { 322 /* Find the bottom driver. */ 323 /** @todo Add pBottom to PDMLUN, this might not be the only place we will have to work it from the bottom up. */ 324 PPDMDRVINS pDrvIns = pLun->pTop; 325 while (pDrvIns && pDrvIns->Internal.s.pDown) 326 pDrvIns = pDrvIns->Internal.s.pDown; 327 328 /* And destroy them one at a time from the bottom up. */ 329 while (pDrvIns) 330 { 331 PPDMDRVINS pDrvNext = pDrvIns->Internal.s.pUp; 332 333 if (pDrvIns->pDrvReg->pfnDestruct) 334 { 335 LogFlow(("pdmR3DevTerm: Destroying - driver '%s'/%d on LUN#%d of device '%s'/%d\n", 336 pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, pLun->iLun, pszDevice, iInstance)); 337 pDrvIns->pDrvReg->pfnDestruct(pDrvIns); 338 339 } 340 341 TMR3TimerDestroyDriver(pVM, pDrvIns); 342 //PDMR3QueueDestroyDriver(pVM, pDrvIns); 343 //pdmR3ThreadDestroyDriver(pVM, pDrvIns); 344 SSMR3DeregisterDriver(pVM, pDrvIns, NULL, 0); 345 346 pDrvIns = pDrvNext; 347 } 348 } 349 } 350 351 352 /** 311 353 * Terminates the PDM. 312 354 * … … 323 365 324 366 /* 325 * Iterate the device instances. 326 * The attached drivers are processed first. 367 * Iterate the device instances and attach drivers, doing 368 * relevant destruction processing. 369 * 327 370 * N.B. There is no need to mess around freeing memory allocated 328 371 * from any MM heap since MM will do that in its Term function. 329 372 */ 373 /* usb ones first. */ 374 for (PPDMUSBINS pUsbIns = pVM->pdm.s.pUsbInstances; pUsbIns; pUsbIns = pUsbIns->Internal.s.pNext) 375 { 376 pdmR3TermLuns(pVM, pUsbIns->Internal.s.pLuns, pUsbIns->pUsbReg->szDeviceName, pUsbIns->iInstance); 377 378 if (pUsbIns->pUsbReg->pfnDestruct) 379 { 380 LogFlow(("pdmR3DevTerm: Destroying - device '%s'/%d\n", 381 pUsbIns->pUsbReg->szDeviceName, pUsbIns->iInstance)); 382 pUsbIns->pUsbReg->pfnDestruct(pUsbIns); 383 } 384 385 //TMR3TimerDestroyUsb(pVM, pUsbIns); 386 //SSMR3DeregisterUsb(pVM, pUsbIns, NULL, 0); 387 pdmR3ThreadDestroyUsb(pVM, pUsbIns); 388 } 389 390 /* then the 'normal' ones. */ 330 391 for (PPDMDEVINS pDevIns = pVM->pdm.s.pDevInstances; pDevIns; pDevIns = pDevIns->Internal.s.pNextHC) 331 392 { 332 for (PPDMLUN pLun = pDevIns->Internal.s.pLunsHC; pLun; pLun = pLun->pNext) 333 { 334 /* Find the bottom driver. */ 335 /** @todo Add pBottom to PDMLUN, this might not be the only place we will have to work it from the bottom up. */ 336 PPDMDRVINS pDrvIns = pLun->pTop; 337 while (pDrvIns && pDrvIns->Internal.s.pDown) 338 pDrvIns = pDrvIns->Internal.s.pDown; 339 340 /* And destroy them one at a time from the bottom up. */ 341 while (pDrvIns) 342 { 343 PPDMDRVINS pDrvNext = pDrvIns->Internal.s.pUp; 344 345 if (pDrvIns->pDrvReg->pfnDestruct) 346 { 347 LogFlow(("pdmR3DevTerm: Destroying - driver '%s'/%d on LUN#%d of device '%s'/%d\n", 348 pDrvIns->pDrvReg->szDriverName, pDrvIns->iInstance, pLun->iLun, pDevIns->pDevReg->szDeviceName, pDevIns->iInstance)); 349 pDrvIns->pDrvReg->pfnDestruct(pDrvIns); 350 TMR3TimerDestroyDriver(pVM, pDrvIns); 351 } 352 353 pDrvIns = pDrvNext; 354 } 355 } 393 pdmR3TermLuns(pVM, pDevIns->Internal.s.pLunsHC, pDevIns->pDevReg->szDeviceName, pDevIns->iInstance); 356 394 357 395 if (pDevIns->pDevReg->pfnDestruct) … … 360 398 pDevIns->pDevReg->szDeviceName, pDevIns->iInstance)); 361 399 pDevIns->pDevReg->pfnDestruct(pDevIns); 362 TMR3TimerDestroyDevice(pVM, pDevIns); 363 pdmR3CritSectDeleteDevice(pVM, pDevIns); 364 } 400 } 401 402 TMR3TimerDestroyDevice(pVM, pDevIns); 403 //SSMR3DeregisterDriver(pVM, pDevIns, NULL, 0); 404 pdmR3CritSectDeleteDevice(pVM, pDevIns); 405 //pdmR3ThreadDestroyDevice(pVM, pDevIns); 406 //PDMR3QueueDestroyDevice(pVM, pDevIns); 365 407 } 366 408
Note:
See TracChangeset
for help on using the changeset viewer.