Changeset 24145 in vbox
- Timestamp:
- Oct 28, 2009 4:17:37 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 54072
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r23253 r24145 1326 1326 1327 1327 /** 1328 * Disables all PCI devices prior to state loading.1329 *1330 * @returns VINF_SUCCESS.1331 * @param pBus The PCI bus instance.1332 */1333 static int pciR3CommonLoadPrep(PPCIBUS pBus)1334 {1335 /*1336 * Iterate thru all the devices and write 0 to the COMMAND register.1337 * The register value is restored afterwards so we can do proper1338 * LogRels in pciR3CommonRestoreConfig.1339 */1340 for (uint32_t i = 0; i < RT_ELEMENTS(pBus->devices); i++)1341 {1342 PPCIDEVICE pDev = pBus->devices[i];1343 if (pDev)1344 {1345 uint16_t u16 = PCIDevGetCommand(pDev);1346 pDev->Int.s.pfnConfigWrite(pDev, VBOX_PCI_COMMAND, 0, 2);1347 PCIDevSetCommand(pDev, u16);1348 Assert(PCIDevGetCommand(pDev) == u16);1349 }1350 }1351 return VINF_SUCCESS;1352 }1353 1354 1355 /**1356 * Prepares a state load.1357 *1358 * This will disable all the device so that the I/O regions gets unmapped.1359 *1360 * @returns VINF_SUCCESS1361 * @param pDevIns The device instance.1362 * @param pSSMHandle The saved state handle.1363 */1364 static DECLCALLBACK(int) pciR3LoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)1365 {1366 PPCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);1367 return pciR3CommonLoadPrep(&pThis->PciBus);1368 }1369 1370 1371 /**1372 1328 * Common routine for restoring the config registers of a PCI device. 1373 1329 * … … 1513 1469 } 1514 1470 if (off == VBOX_PCI_COMMAND) 1515 PCIDevSetCommand(pDev, 0); /* For remapping, see pciR3CommonLoad Prep. */1471 PCIDevSetCommand(pDev, 0); /* For remapping, see pciR3CommonLoadExec. */ 1516 1472 pDev->Int.s.pfnConfigWrite(pDev, off, u32Src, cb); 1517 1473 } … … 1551 1507 1552 1508 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); 1509 1510 /* 1511 * Iterate thru all the devices and write 0 to the COMMAND register so 1512 * that all the memory is unmapped before we start restoring the saved 1513 * mapping locations. 1514 * 1515 * The register value is restored afterwards so we can do proper 1516 * LogRels in pciR3CommonRestoreConfig. 1517 */ 1518 for (uint32_t i = 0; i < RT_ELEMENTS(pBus->devices); i++) 1519 { 1520 PPCIDEVICE pDev = pBus->devices[i]; 1521 if (pDev) 1522 { 1523 uint16_t u16 = PCIDevGetCommand(pDev); 1524 pDev->Int.s.pfnConfigWrite(pDev, VBOX_PCI_COMMAND, 0, 2); 1525 PCIDevSetCommand(pDev, u16); 1526 Assert(PCIDevGetCommand(pDev) == u16); 1527 } 1528 } 1553 1529 1554 1530 /* … … 2152 2128 NULL, NULL, NULL, 2153 2129 NULL, pciR3SaveExec, NULL, 2154 pciR3LoadPrep, pciR3LoadExec, NULL);2130 NULL, pciR3LoadExec, NULL); 2155 2131 if (RT_FAILURE(rc)) 2156 2132 return rc; … … 2328 2304 2329 2305 /** 2330 * Prepares a state load.2331 *2332 * This will disable all the device so that the I/O regions gets unmapped.2333 *2334 * @returns VINF_SUCCESS2335 * @param pDevIns The device instance.2336 * @param pSSMHandle The saved state handle.2337 */2338 static DECLCALLBACK(int) pcibridgeR3LoadPrep(PPDMDEVINS pDevIns, PSSMHANDLE pSSMHandle)2339 {2340 PPCIBUS pThis = PDMINS_2_DATA(pDevIns, PPCIBUS);2341 return pciR3CommonLoadPrep(pThis);2342 }2343 2344 2345 /**2346 2306 * Loads a saved PCI bridge device state. 2347 2307 * … … 2541 2501 NULL, NULL, NULL, 2542 2502 NULL, pcibridgeR3SaveExec, NULL, 2543 pcibridgeR3LoadPrep, pcibridgeR3LoadExec, NULL);2503 NULL, pcibridgeR3LoadExec, NULL); 2544 2504 if (RT_FAILURE(rc)) 2545 2505 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.