VirtualBox

Changeset 64702 in vbox


Ignore:
Timestamp:
Nov 17, 2016 8:42:42 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
111981
Message:

DevPciIch9: Assert/LogRel on bad PCI bridge config. LogRel the PDM bus number for PCI bridges.

File:
1 edited

Legend:

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

    r64701 r64702  
    16901690 * Initializes bridges registers used for routing.
    16911691 *
     1692 * We ASSUME PDM bus assignments are the same as the PCI bus assignments and
     1693 * will complain if we find any conflicts.  This because it is just soo much
     1694 * simpler to have the two numbers match one another by default.
     1695 *
    16921696 * @returns Max subordinate bus number.
    16931697 * @param   pPciRoot         Global device instance data used to generate unique bus numbers.
    16941698 * @param   pBus             The PCI bus to initialize.
     1699 * @param   pbmUsed          Pointer to a 32-bit bitmap tracking which device
     1700 *                           (ranges) has been used.
    16951701 * @param   uBusPrimary      The primary bus number the bus is connected to.
    1696  * @param   uBusSecondary    The secondary bus number, i.e. the bus number behind the bridge.
    1697  */
    1698 static uint8_t ich9pciBiosInitBridgeTopology(PDEVPCIROOT pPciRoot, PDEVPCIBUS pBus, unsigned uBusPrimary, unsigned uBusSecondary)
     1702 */
     1703static uint8_t ich9pciBiosInitBridgeTopology(PDEVPCIROOT pPciRoot, PDEVPCIBUS pBus, uint32_t *pbmUsed, unsigned uBusPrimary)
    16991704{
    17001705    PPDMPCIDEV pBridgeDev = &pBus->PciDev;
    17011706
     1707    /* Check if the PDM bus assignment makes sense.    */
     1708    AssertLogRelMsg(!(*pbmUsed & RT_BIT_32(pBus->iBus)),
     1709                    ("PCIBIOS: Bad PCI bridge config! Conflict for bus %#x. Make sure to instantiate bridges for a sub-trees in sequence!\n",
     1710                     pBus->iBus));
     1711    *pbmUsed |= RT_BIT_32(pBus->iBus);
     1712
    17021713    /* Set only if we are not on the root bus, it has no primary bus attached. */
    1703     if (uBusSecondary != 0)
     1714    if (pBus->iBus != 0)
    17041715    {
    17051716        PCIDevSetByte(pBridgeDev, VBOX_PCI_PRIMARY_BUS, uBusPrimary);
    1706         PCIDevSetByte(pBridgeDev, VBOX_PCI_SECONDARY_BUS, uBusSecondary);
     1717        PCIDevSetByte(pBridgeDev, VBOX_PCI_SECONDARY_BUS, pBus->iBus);
    17071718    }
    17081719
     
    17141725                  ("Device is not a PCI bridge but on the list of PCI bridges\n"));
    17151726        PDEVPCIBUS pChildBus = PDMINS_2_DATA(pBridge->Int.s.CTX_SUFF(pDevIns), PDEVPCIBUS);
    1716         uint8_t uMaxChildSubBus = ich9pciBiosInitBridgeTopology(pPciRoot, pChildBus, uBusSecondary, pChildBus->iBus);
     1727        uint8_t uMaxChildSubBus = ich9pciBiosInitBridgeTopology(pPciRoot, pChildBus, pbmUsed, pBus->iBus);
    17171728        uMaxSubNum = RT_MAX(uMaxSubNum, uMaxChildSubBus);
    17181729    }
     1730
    17191731    PCIDevSetByte(pBridgeDev, VBOX_PCI_SUBORDINATE_BUS, uMaxSubNum);
     1732    for (uint32_t i = pBus->iBus; i <= uMaxSubNum; i++)
     1733        *pbmUsed |= RT_BIT_32(i);
     1734
    17201735    Log2(("ich9pciBiosInitBridgeTopology: for bus %p: primary=%d secondary=%d subordinate=%d\n",
    17211736          pBus,
     
    17611776    PDEVPCIBUS pBus = &pPciRoot->PciBus;
    17621777    AssertLogRel(pBus->iBus == 0);
    1763     ich9pciBiosInitBridgeTopology(pPciRoot, pBus, 0, pBus->iBus);
     1778    uint32_t bmUsed = 0;
     1779    ich9pciBiosInitBridgeTopology(pPciRoot, pBus, &bmUsed, 0);
    17641780
    17651781    /*
     
    27602776    pBus->pPciHlpRC = pBus->pPciHlpR3->pfnGetRCHelpers(pDevIns);
    27612777    pBus->pPciHlpR0 = pBus->pPciHlpR3->pfnGetR0Helpers(pDevIns);
     2778    LogRel(("PCI: Registered bridge instance #%u as PDM bus no %u.\n", iInstance, pBus->iBus));
    27622779
    27632780
Note: See TracChangeset for help on using the changeset viewer.

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