VirtualBox

Changeset 24145 in vbox


Ignore:
Timestamp:
Oct 28, 2009 4:17:37 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
54072
Message:

DevPCI: Don't disable PCI device before the PCI state is being loaded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevPCI.cpp

    r23253 r24145  
    13261326
    13271327/**
    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 proper
    1338      * 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_SUCCESS
    1361  * @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 /**
    13721328 * Common routine for restoring the config registers of a PCI device.
    13731329 *
     
    15131469                }
    15141470                if (off == VBOX_PCI_COMMAND)
    1515                     PCIDevSetCommand(pDev, 0); /* For remapping, see pciR3CommonLoadPrep. */
     1471                    PCIDevSetCommand(pDev, 0); /* For remapping, see pciR3CommonLoadExec. */
    15161472                pDev->Int.s.pfnConfigWrite(pDev, off, u32Src, cb);
    15171473            }
     
    15511507
    15521508    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    }
    15531529
    15541530    /*
     
    21522128                                NULL, NULL, NULL,
    21532129                                NULL, pciR3SaveExec, NULL,
    2154                                 pciR3LoadPrep, pciR3LoadExec, NULL);
     2130                                NULL, pciR3LoadExec, NULL);
    21552131    if (RT_FAILURE(rc))
    21562132        return rc;
     
    23282304
    23292305/**
    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_SUCCESS
    2335  * @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 /**
    23462306 * Loads a saved PCI bridge device state.
    23472307 *
     
    25412501                                NULL, NULL, NULL,
    25422502                                NULL, pcibridgeR3SaveExec, NULL,
    2543                                 pcibridgeR3LoadPrep, pcibridgeR3LoadExec, NULL);
     2503                                NULL, pcibridgeR3LoadExec, NULL);
    25442504    if (RT_FAILURE(rc))
    25452505        return rc;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette