VirtualBox

Changeset 33687 in vbox


Ignore:
Timestamp:
Nov 2, 2010 1:05:01 PM (14 years ago)
Author:
vboxsync
Message:

PCI: part 1 of PCI slots assignment logic in Main

Location:
trunk/src/VBox
Files:
2 added
3 edited

Legend:

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

    r33606 r33687  
    253253    {
    254254        PPCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PPCIGLOBALS);
     255
    255256        PCI_LOCK(pDevIns, VINF_IOM_HC_IOPORT_WRITE);
    256257        pThis->uConfigReg = u32 & ~3; /* Bits 0-1 are reserved and we silently clear them */
    257258        PCI_UNLOCK(pDevIns);
    258259    }
     260
    259261    return VINF_SUCCESS;
    260262}
     
    311313                pBridgeDevice->Int.s.pfnBridgeConfigWrite(pBridgeDevice->pDevIns, pAddr->iBus, pAddr->iDeviceFunc, pAddr->iRegister, val, cb);
    312314            }
     315            else
     316            {
     317                // do nothing, bridge not found
     318            }
    313319#else
    314320            rc = rcReschedule;
     
    360366static void ich9pciNoMem(void* ptr, int cb)
    361367{
    362     memset(ptr, 0xff, cb);
     368    for (int i = 0; i < cb; i++)
     369        ((uint8_t*)ptr)[i] = 0xff;
    363370}
    364371
     
    448455}
    449456
    450 static int ich9pciDataRead(PPCIGLOBALS pGlobals, uint32_t addr, int len, uint32_t *pu32)
     457static int ich9pciDataRead(PPCIGLOBALS pGlobals, uint32_t addr, int cb, uint32_t *pu32)
    451458{
    452459    PciAddress aPciAddr;
    453460
    454     LogFlow(("ich9pciDataRead: config=%x len=%d\n",  pGlobals->uConfigReg, len));
     461    LogFlow(("ich9pciDataRead: config=%x cb=%d\n",  pGlobals->uConfigReg, cb));
     462
     463    *pu32 = 0xffffffff;
    455464
    456465    if (!(pGlobals->uConfigReg & (1 << 31)))
     
    463472    ich9pciStateToPciAddr(pGlobals, addr, &aPciAddr);
    464473
    465     return ich9pciDataReadAddr(pGlobals, &aPciAddr, len, pu32, VINF_IOM_HC_IOPORT_READ);
     474    return ich9pciDataReadAddr(pGlobals, &aPciAddr, cb, pu32, VINF_IOM_HC_IOPORT_READ);
    466475}
    467476
     
    10381047        }
    10391048        else
    1040             ich9pciNoMem(&u32Value, cb);
     1049            ich9pciNoMem(&u32Value, 4);
    10411050    }
    10421051    else
     
    10501059        }
    10511060        else
    1052             ich9pciNoMem(&u32Value, cb);
     1061            ich9pciNoMem(&u32Value, 4);
    10531062    }
    10541063
     
    19791988    },
    19801989    /* Disable, if we may wish to have multiple AHCI controllers */
    1981 #if 1
    19821990    {
    19831991        "ahci",     31, 2 /* SATA controller */
    19841992    },
    1985 #endif
    19861993    {
    19871994        "smbus",    31, 3 /* System Management Bus */
     
    20212028
    20222029    int iStartPos = 0;
    2023 
    2024     /* We add bridges starting slot 22 */
    2025     if (!strcmp(pszName, "ich9pcibridge"))
    2026     {
    2027         iStartPos = 22 * 8;
    2028     }
    20292030
    20302031    /* Otherwise when assigning a slot, we need to make sure all its functions are available */
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r33606 r33687  
    108108
    109109#include "DHCPServerRunner.h"
     110#include "BusAssignmentManager.h"
    110111
    111112#if defined(RT_OS_DARWIN)
     
    467468{
    468469    LogFlowFuncEnter();
    469     /* Note: hardcoded assumption about number of slots; see rom bios */
    470     bool afPciDeviceNo[32] = {false};
     470    PciBusAddress         PciAddr;
    471471    bool fFdcEnabled = false;
    472472    BOOL fIs64BitGuest = false;
     
    547547        u64McfgBase = _4G - cbRamHole;
    548548    }
     549
     550    ComPtr<BusAssignmentManager> BusMgr =
     551            BusAssignmentManager::getInstance(chipsetType);
    549552
    550553    ULONG cCpus = 1;
     
    879882            InsertConfigNode(pDev,     "0", &pInst);
    880883            InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
     884            PciAddr = PciBusAddress(0, 24, 0);
     885            hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst, PciAddr);                               H();
    881886
    882887            InsertConfigNode(pDev,     "1", &pInst);
    883888            InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
     889            PciAddr = PciBusAddress(0, 25, 0);
     890            hrc = BusMgr->assignPciDevice("ich9pcibridge", pInst, PciAddr);                               H();
    884891        }
    885892
     
    10491056        InsertConfigNode(pDev,     "0", &pInst);
    10501057        InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
    1051         InsertConfigInteger(pInst, "PCIDeviceNo",          2);
    1052         Assert(!afPciDeviceNo[2]);
    1053         afPciDeviceNo[2] = true;
    1054         InsertConfigInteger(pInst, "PCIFunctionNo",        0);
     1058
     1059        PciAddr = PciBusAddress(0, 2, 0);
     1060        hrc = BusMgr->assignPciDevice("vga", pInst, PciAddr);                               H();
    10551061        InsertConfigNode(pInst,    "Config", &pCfg);
    10561062        ULONG cVRamMBs;
     
    13191325                case StorageControllerType_LsiLogic:
    13201326                {
    1321                     // InsertConfigInteger(pCtlInst, "PCIBusNo",             1);
    1322                     InsertConfigInteger(pCtlInst, "PCIDeviceNo",          20);
    1323                     Assert(!afPciDeviceNo[20]);
    1324                     afPciDeviceNo[20] = true;
    1325                     InsertConfigInteger(pCtlInst, "PCIFunctionNo",        0);
     1327                    PciAddr = PciBusAddress(1, 20, 0);
     1328                    hrc = BusMgr->assignPciDevice("lsilogic", pCtlInst, PciAddr);                               H();
     1329
    13261330
    13271331                    /* Attach the status driver */
     
    13391343                case StorageControllerType_BusLogic:
    13401344                {
    1341                     InsertConfigInteger(pCtlInst, "PCIDeviceNo",          21);
    1342                     Assert(!afPciDeviceNo[21]);
    1343                     afPciDeviceNo[21] = true;
    1344                     InsertConfigInteger(pCtlInst, "PCIFunctionNo",        0);
     1345                    PciAddr = PciBusAddress(0, 21, 0);
     1346                    hrc = BusMgr->assignPciDevice("buslogic", pCtlInst, PciAddr);                               H();
    13451347
    13461348                    /* Attach the status driver */
     
    13581360                case StorageControllerType_IntelAhci:
    13591361                {
    1360                     InsertConfigInteger(pCtlInst, "PCIDeviceNo",          13);
    1361                     Assert(!afPciDeviceNo[13]);
    1362                     afPciDeviceNo[13] = true;
    1363                     InsertConfigInteger(pCtlInst, "PCIFunctionNo",        0);
     1362                    PciAddr = PciBusAddress(0, 13, 0);
     1363                    hrc = BusMgr->assignPciDevice("ahci", pCtlInst, PciAddr);                               H();
    13641364
    13651365                    ULONG cPorts = 0;
     
    14061406                     * IDE (update this when the main interface changes)
    14071407                     */
    1408                     InsertConfigInteger(pCtlInst, "PCIDeviceNo",          1);
    1409                     Assert(!afPciDeviceNo[1]);
    1410                     afPciDeviceNo[1] = true;
    1411                     InsertConfigInteger(pCtlInst, "PCIFunctionNo",        1);
     1408                    PciAddr = PciBusAddress(0, 1, 1);
     1409                    hrc = BusMgr->assignPciDevice("ide", pCtlInst, PciAddr);                               H();
    14121410                    InsertConfigString(pCfg,   "Type", controllerString(enmCtrlType));
    14131411
     
    14541452                case StorageControllerType_LsiLogicSas:
    14551453                {
    1456                     InsertConfigInteger(pCtlInst, "PCIDeviceNo",          22);
    1457                     Assert(!afPciDeviceNo[22]);
    1458                     afPciDeviceNo[22] = true;
    1459                     InsertConfigInteger(pCtlInst, "PCIFunctionNo",        0);
     1454                    PciAddr = PciBusAddress(0, 22, 0);
     1455                    hrc = BusMgr->assignPciDevice("lsilogicsas", pCtlInst, PciAddr);                               H();
    14601456
    14611457                    InsertConfigString(pCfg,  "ControllerType", "SAS1068");
     
    15911587                iPciDeviceNo = 3;
    15921588#endif
    1593             InsertConfigInteger(pInst, "PCIDeviceNo", iPciDeviceNo);
    1594             Assert(!afPciDeviceNo[iPciDeviceNo]);
    1595             afPciDeviceNo[iPciDeviceNo] = true;
    1596             InsertConfigInteger(pInst, "PCIFunctionNo",        0);
     1589            PciAddr = PciBusAddress(0, iPciDeviceNo, 0);
     1590            hrc = BusMgr->assignPciDevice(pszAdapterName, pInst, PciAddr);                               H();
     1591
    15971592            InsertConfigNode(pInst, "Config", &pCfg);
    15981593#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE   /* not safe here yet. */
     
    18191814        InsertConfigNode(pInst,    "Config", &pCfg);
    18201815        InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
    1821         InsertConfigInteger(pInst, "PCIDeviceNo",          4);
    1822         Assert(!afPciDeviceNo[4]);
    1823         afPciDeviceNo[4] = true;
    1824         InsertConfigInteger(pInst, "PCIFunctionNo",        0);
     1816        PciAddr = PciBusAddress(0, 4, 0);
     1817        hrc = BusMgr->assignPciDevice("VMMDev", pInst, PciAddr);                               H();
     1818
    18251819        Bstr hwVersion;
    18261820        hrc = pMachine->COMGETTER(HardwareVersion)(hwVersion.asOutParam());                 H();
     
    18831877                    InsertConfigNode(pDev,     "0", &pInst);
    18841878                    InsertConfigInteger(pInst, "Trusted",          1); /* boolean */
    1885                     InsertConfigInteger(pInst, "PCIDeviceNo",      5);
    1886                     Assert(!afPciDeviceNo[5]);
    1887                     afPciDeviceNo[5] = true;
    1888                     InsertConfigInteger(pInst, "PCIFunctionNo",    0);
     1879                    PciAddr = PciBusAddress(0, 5, 0);
     1880                    hrc = BusMgr->assignPciDevice("ichac97", pInst, PciAddr);                               H();
    18891881                    InsertConfigNode(pInst,    "Config", &pCfg);
    18901882                    break;
     
    19101902                    InsertConfigNode(pDev,     "0", &pInst);
    19111903                    InsertConfigInteger(pInst, "Trusted",          1); /* boolean */
    1912                     InsertConfigInteger(pInst, "PCIDeviceNo",      5);
    1913                     Assert(!afPciDeviceNo[5]);
    1914                     afPciDeviceNo[5] = true;
    1915                     InsertConfigInteger(pInst, "PCIFunctionNo",    0);
     1904                    PciAddr = PciBusAddress(0, 5, 0);
     1905                    hrc = BusMgr->assignPciDevice("hda", pInst, PciAddr);                               H();
    19161906                    InsertConfigNode(pInst,    "Config", &pCfg);
    19171907                }
     
    20122002                InsertConfigNode(pInst,    "Config", &pCfg);
    20132003                InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
    2014                 InsertConfigInteger(pInst, "PCIDeviceNo",          6);
    2015                 Assert(!afPciDeviceNo[6]);
    2016                 afPciDeviceNo[6] = true;
    2017                 InsertConfigInteger(pInst, "PCIFunctionNo",        0);
    2018 
     2004                PciAddr = PciBusAddress(0, 6, 0);
     2005                hrc = BusMgr->assignPciDevice("usb-ohci", pInst, PciAddr);                               H();
    20192006                InsertConfigNode(pInst,    "LUN#0", &pLunL0);
    20202007                InsertConfigString(pLunL0, "Driver",               "VUSBRootHub");
     
    20402027                    InsertConfigNode(pInst,    "Config", &pCfg);
    20412028                    InsertConfigInteger(pInst, "Trusted",              1); /* boolean */
    2042                     InsertConfigInteger(pInst, "PCIDeviceNo",          11);
    2043                     Assert(!afPciDeviceNo[11]);
    2044                     afPciDeviceNo[11] = true;
    2045                     InsertConfigInteger(pInst, "PCIFunctionNo",        0);
     2029                    PciAddr = PciBusAddress(0, 11, 0);
     2030                    hrc = BusMgr->assignPciDevice("usb-ohci", pInst, PciAddr);                               H();
    20462031
    20472032                    InsertConfigNode(pInst,    "LUN#0", &pLunL0);
     
    23022287            InsertConfigInteger(pInst, "Trusted", 1); /* boolean */
    23032288            InsertConfigNode(pInst,    "Config", &pCfg);
     2289            PciAddr = PciBusAddress(0, 7, 0);
     2290            hrc = BusMgr->assignPciDevice("acpi", pInst, PciAddr);                               H();
     2291
    23042292            InsertConfigInteger(pCfg,  "RamSize",          cbRam);
    23052293            InsertConfigInteger(pCfg,  "RamHoleSize",      cbRamHole);
     
    23322320            InsertConfigInteger(pCfg,  "ShowCpu", fShowCpu);
    23332321            InsertConfigInteger(pCfg,  "CpuHotPlug", fCpuHotPlug);
    2334             InsertConfigInteger(pInst, "PCIDeviceNo",          7);
    2335             Assert(!afPciDeviceNo[7]);
    2336             afPciDeviceNo[7] = true;
    2337             InsertConfigInteger(pInst, "PCIFunctionNo",        0);
    23382322
    23392323            InsertConfigNode(pInst,    "LUN#0", &pLunL0);
  • trunk/src/VBox/Main/Makefile.kmk

    r33627 r33687  
    636636        VMMDevInterface.cpp \
    637637        EventImpl.cpp \
     638        BusAssignmentManager.cpp \
    638639        $(VBOX_AUTOGEN_EVENT_CPP) \
    639640        $(VBOX_XML_SCHEMADEFS_CPP) \
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