VirtualBox

Changeset 36107 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Feb 28, 2011 6:24:32 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
70264
Message:

PCI: some Main work to provide correct attachment info for physical devices

Location:
trunk/src/VBox/Main/src-client
Files:
2 edited

Legend:

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

    r35368 r36107  
    219219    struct PciDeviceRecord
    220220    {
    221         char szDevName[32];
     221        char          szDevName[32];
     222        PciBusAddress HostAddress;
     223
     224        PciDeviceRecord(const char* pszName, PciBusAddress aHostAddress)
     225        {
     226            RTStrCopy(this->szDevName, sizeof(szDevName), pszName);
     227            this->HostAddress = aHostAddress;
     228        }
    222229
    223230        PciDeviceRecord(const char* pszName)
    224231        {
    225             RTStrCopy(szDevName, sizeof(szDevName), pszName);
     232            RTStrCopy(this->szDevName, sizeof(szDevName), pszName);
    226233        }
    227234
     
    255262    HRESULT init(ChipsetType_T chipsetType);
    256263
    257     HRESULT record(const char* pszName, PciBusAddress& Address);
     264    HRESULT record(const char* pszName, PciBusAddress& GuestAddress, PciBusAddress HostAddress);
    258265    HRESULT autoAssign(const char* pszName, PciBusAddress& Address);
    259266    bool    checkAvailable(PciBusAddress& Address);
     
    271278}
    272279
    273 HRESULT BusAssignmentManager::State::record(const char* pszName, PciBusAddress& Address)
    274 {
    275     PciDeviceRecord devRec(pszName);
     280HRESULT BusAssignmentManager::State::record(const char* pszName, PciBusAddress& Address, PciBusAddress HostAddress)
     281{
     282    PciDeviceRecord devRec(pszName, HostAddress);
    276283
    277284    /* Remember address -> device mapping */
     
    399406        dev.createObject();
    400407        com::Bstr devname(it->second.szDevName);
    401         dev->init(NULL, devname, -1, it->first.asLong(), FALSE);
     408        dev->init(NULL, devname,
     409                  it->second.HostAddress.valid() ? it->second.HostAddress.asLong() : -1,
     410                  it->first.asLong(), it->second.HostAddress.valid());
    402411        result.setElement(iIndex++, dev);
    403412    }
     
    449458}
    450459
    451 HRESULT BusAssignmentManager::assignPciDevice(const char* pszDevName, PCFGMNODE pCfg,
    452                                               PciBusAddress& Address,    bool fAddressRequired)
     460HRESULT BusAssignmentManager::assignPciDeviceImpl(const char* pszDevName,
     461                                                  PCFGMNODE pCfg,
     462                                                  PciBusAddress& GuestAddress,
     463                                                  PciBusAddress HostAddress,
     464                                                  bool fGuestAddressRequired)
    453465{
    454466    HRESULT rc = S_OK;
    455467
    456     if (!Address.valid())
    457         rc = pState->autoAssign(pszDevName, Address);
     468    if (!GuestAddress.valid())
     469        rc = pState->autoAssign(pszDevName, GuestAddress);
    458470    else
    459471    {
    460         bool fAvailable = pState->checkAvailable(Address);
     472        bool fAvailable = pState->checkAvailable(GuestAddress);
    461473
    462474        if (!fAvailable)
    463475        {
    464             if (fAddressRequired)
     476            if (fGuestAddressRequired)
    465477                rc = E_ACCESSDENIED;
    466478            else
    467                 rc = pState->autoAssign(pszDevName, Address);
     479                rc = pState->autoAssign(pszDevName, GuestAddress);
    468480        }
    469481    }
     
    472484        return rc;
    473485
    474     Assert(Address.valid() && pState->checkAvailable(Address));
    475 
    476     rc = pState->record(pszDevName, Address);
     486    Assert(GuestAddress.valid() && pState->checkAvailable(GuestAddress));
     487
     488    rc = pState->record(pszDevName, GuestAddress, HostAddress);
    477489    if (FAILED(rc))
    478490        return rc;
    479491
    480     rc = InsertConfigInteger(pCfg, "PCIBusNo",             Address.iBus);
     492    rc = InsertConfigInteger(pCfg, "PCIBusNo",      GuestAddress.iBus);
    481493    if (FAILED(rc))
    482494        return rc;
    483     rc = InsertConfigInteger(pCfg, "PCIDeviceNo",          Address.iDevice);
     495    rc = InsertConfigInteger(pCfg, "PCIDeviceNo",   GuestAddress.iDevice);
    484496    if (FAILED(rc))
    485497        return rc;
    486     rc = InsertConfigInteger(pCfg, "PCIFunctionNo",        Address.iFn);
     498    rc = InsertConfigInteger(pCfg, "PCIFunctionNo", GuestAddress.iFn);
    487499    if (FAILED(rc))
    488500        return rc;
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r36082 r36107  
    532532        GuestPciAddress.fromLong(guest);
    533533        Assert(GuestPciAddress.valid());
    534         hrc = BusMgr->assignPciDevice("pciraw", pInst, GuestPciAddress, true);
     534        hrc = BusMgr->assignHostPciDevice("pciraw", pInst, HostPciAddress, GuestPciAddress, true);
    535535        if (hrc != S_OK)
    536536            return hrc;
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