VirtualBox

Changeset 36053 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 22, 2011 2:52:02 PM (14 years ago)
Author:
vboxsync
Message:

PCI: first version allowing registers visibility

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r36041 r36053  
    471471        return hrc;
    472472
     473    PCFGMNODE pBridges = CFGMR3GetChild(pDevices, "ich9pcibridge");
     474    Assert(pBridges);
     475
     476    /* Find required bridges, and add missing ones */
     477    for (size_t iDev = 0; iDev < assignments.size(); iDev++)
     478    {
     479        ComPtr<IPciDeviceAttachment> assignment = assignments[iDev];
     480        LONG guest = 0;
     481        PciBusAddress GuestPciAddress;
     482
     483        assignment->COMGETTER(GuestAddress)(&guest);
     484        GuestPciAddress.fromLong(guest);
     485        Assert(GuestPciAddress.valid());
     486
     487        if (GuestPciAddress.iBus > 0)
     488        {
     489            int iBridgesMissed = 0;
     490            int iBase = GuestPciAddress.iBus - 1;
     491
     492            while (!BusMgr->hasPciDevice("ich9pcibridge", iBase) && iBase > 0)
     493            {
     494                iBridgesMissed++; iBase--;
     495            }
     496            iBase++;
     497
     498            for (int iBridge = 0; iBridge < iBridgesMissed; iBridge++)
     499            {
     500                InsertConfigNode(pBridges, Utf8StrFmt("%d", iBase + iBridge).c_str(), &pInst);
     501                InsertConfigInteger(pInst, "Trusted",              1);
     502                hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst);
     503            }
     504        }
     505    }
     506
     507    /* Now actually add devices */
    473508    for (size_t iDev = 0; iDev < assignments.size(); iDev++)
    474509    {
     
    500535        if (hrc != S_OK)
    501536            return hrc;
     537
    502538        InsertConfigInteger(pCfg,      "GuestPCIBusNo",      GuestPciAddress.iBus);
    503539        InsertConfigInteger(pCfg,      "GuestPCIDeviceNo",   GuestPciAddress.iDevice);
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