VirtualBox

Changeset 32776 in vbox for trunk/src/VBox/Devices/Bus


Ignore:
Timestamp:
Sep 27, 2010 1:31:42 PM (14 years ago)
Author:
vboxsync
Message:

PCI: refactoring for PCIe work

Location:
trunk/src/VBox/Devices/Bus
Files:
3 edited

Legend:

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

    r32490 r32776  
    773773         */
    774774        PPCIDEVICE pBridgeTemp = pBus->papBridgesR3[iBridge];
    775         AssertMsg(pBridgeTemp && pBridgeTemp->Int.s.fPciToPciBridge,
     775        AssertMsg(pBridgeTemp && PCIIsPci2PciBridge(pBridgeTemp),
    776776                  ("Device is not a PCI bridge but on the list of PCI bridges\n"));
    777777
     
    17211721            }
    17221722        }
    1723         pPciDev->Int.s.fRequestedDevFn = false;
     1723        PCIClearRequestedDevfunc(pPciDev);
    17241724    }
    17251725    else
     
    17421742            AssertReleaseMsg(!(iDev % 8), ("PCI Configuration Conflict! iDev=%d pszName=%s clashes with %s\n",
    17431743                                           iDev, pszName, pBus->devices[iDev]->name));
    1744             if (    pBus->devices[iDev]->Int.s.fRequestedDevFn
    1745                 ||  (pBus->devices[iDev + 1] && pBus->devices[iDev + 1]->Int.s.fRequestedDevFn)
    1746                 ||  (pBus->devices[iDev + 2] && pBus->devices[iDev + 2]->Int.s.fRequestedDevFn)
    1747                 ||  (pBus->devices[iDev + 3] && pBus->devices[iDev + 3]->Int.s.fRequestedDevFn)
    1748                 ||  (pBus->devices[iDev + 4] && pBus->devices[iDev + 4]->Int.s.fRequestedDevFn)
    1749                 ||  (pBus->devices[iDev + 5] && pBus->devices[iDev + 5]->Int.s.fRequestedDevFn)
    1750                 ||  (pBus->devices[iDev + 6] && pBus->devices[iDev + 6]->Int.s.fRequestedDevFn)
    1751                 ||  (pBus->devices[iDev + 7] && pBus->devices[iDev + 7]->Int.s.fRequestedDevFn))
     1744            if (    PCIIsRequestedDevfunc(pBus->devices[iDev])
     1745                ||  (pBus->devices[iDev + 1] && PCIIsRequestedDevfunc(pBus->devices[iDev + 1]))
     1746                ||  (pBus->devices[iDev + 2] && PCIIsRequestedDevfunc(pBus->devices[iDev + 2]))
     1747                ||  (pBus->devices[iDev + 3] && PCIIsRequestedDevfunc(pBus->devices[iDev + 3]))
     1748                ||  (pBus->devices[iDev + 4] && PCIIsRequestedDevfunc(pBus->devices[iDev + 4]))
     1749                ||  (pBus->devices[iDev + 5] && PCIIsRequestedDevfunc(pBus->devices[iDev + 5]))
     1750                ||  (pBus->devices[iDev + 6] && PCIIsRequestedDevfunc(pBus->devices[iDev + 6]))
     1751                ||  (pBus->devices[iDev + 7] && PCIIsRequestedDevfunc(pBus->devices[iDev + 7])))
    17521752            {
    17531753                AssertReleaseMsgFailed(("Configuration error:'%s' and '%s' are both configured as device %d\n",
     
    17861786            }
    17871787        } /* if conflict */
    1788         pPciDev->Int.s.fRequestedDevFn = true;
     1788        PCISetRequestedDevfunc(pPciDev);
    17891789    }
    17901790
     
    17981798    pPciDev->Int.s.pfnConfigWrite   = pci_default_write_config;
    17991799    pBus->devices[iDev]             = pPciDev;
    1800     if (pPciDev->Int.s.fPciToPciBridge)
     1800    if (PCIIsPci2PciBridge(pPciDev))
    18011801    {
    18021802        AssertMsg(pBus->cBridges < RT_ELEMENTS(pBus->devices), ("Number of bridges exceeds the number of possible devices on the bus\n"));
     
    20732073
    20742074    pBus->PciDev.pDevIns              = pDevIns;
    2075     pBus->PciDev.Int.s.fRequestedDevFn= true;
     2075    PCISetRequestedDevfunc(&pBus->PciDev);
    20762076    pciRegisterInternal(pBus, 0, &pBus->PciDev, "i440FX");
    20772077
     
    20842084
    20852085    pGlobals->PIIX3State.dev.pDevIns      = pDevIns;
    2086     pGlobals->PIIX3State.dev.Int.s.fRequestedDevFn= true;
     2086    PCISetRequestedDevfunc(&pGlobals->PIIX3State.dev);
    20872087    pciRegisterInternal(pBus, 8, &pGlobals->PIIX3State.dev, "PIIX3");
    20882088    piix3_reset(&pGlobals->PIIX3State);
     
    24532453
    24542454    pBus->PciDev.pDevIns                    = pDevIns;
    2455     pBus->PciDev.Int.s.fPciToPciBridge      = true;
     2455
     2456    /* Bridge-specific data */
     2457    PCISetPci2PciBridge(&pBus->PciDev);
    24562458    pBus->PciDev.Int.s.pfnBridgeConfigRead  = pcibridgeConfigRead;
    24572459    pBus->PciDev.Int.s.pfnBridgeConfigWrite = pcibridgeConfigWrite;
  • trunk/src/VBox/Devices/Bus/DevPciIch9.cpp

    r32765 r32776  
    621621         */
    622622        PPCIDEVICE pBridgeTemp = pBus->papBridgesR3[iBridge];
    623         AssertMsg(pBridgeTemp && pBridgeTemp->Int.s.fPciToPciBridge,
     623        AssertMsg(pBridgeTemp && PCIIsPci2PciBridge(pBridgeTemp),
    624624                  ("Device is not a PCI bridge but on the list of PCI bridges\n"));
    625625
     
    771771static DECLCALLBACK(int) ich9pcibridgeRegister(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, const char *pszName, int iDev)
    772772{
    773     return 0;
     773
     774    PPCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS);
     775   
     776    /*
     777     * Check input.
     778     */
     779    if (    !pszName
     780        ||  !pPciDev
     781        ||  iDev >= (int)RT_ELEMENTS(pBus->apDevices))
     782    {
     783        AssertMsgFailed(("Invalid argument! pszName=%s pPciDev=%p iDev=%d\n", pszName, pPciDev, iDev));
     784        return VERR_INVALID_PARAMETER;
     785    }
     786
     787    /*
     788     * Register the device.
     789     */
     790    return ich9pciRegisterInternal(pBus, iDev, pPciDev, pszName);
    774791}
    775792
     
    831848 * @param   pSSM            The handle to save the state to.
    832849 */
    833 static DECLCALLBACK(int) pciGenericSaveExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
     850static DECLCALLBACK(int) ich9pciGenericSaveExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
    834851{
    835852    return SSMR3PutMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config));
    836853}
    837854
    838 static int pciR3CommonSaveExec(PPCIBUS pBus, PSSMHANDLE pSSM)
     855static int ich9pciR3CommonSaveExec(PPCIBUS pBus, PSSMHANDLE pSSM)
    839856{
    840857    /*
     
    860877}
    861878
    862 static DECLCALLBACK(int) pciR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     879static DECLCALLBACK(int) ich9pciR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    863880{
    864881    PPCIBUS pThis = PDMINS_2_DATA(pDevIns, PPCIBUS);
    865     return pciR3CommonSaveExec(pThis, pSSM);
    866 }
    867 
    868 
    869 static DECLCALLBACK(int) pcibridgeR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
     882    return ich9pciR3CommonSaveExec(pThis, pSSM);
     883}
     884
     885
     886static DECLCALLBACK(int) ich9pcibridgeR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
    870887{
    871888    PPCIBUS pThis = PDMINS_2_DATA(pDevIns, PPCIBUS);
    872     return pciR3CommonSaveExec(pThis, pSSM);
     889    return ich9pciR3CommonSaveExec(pThis, pSSM);
     890}
     891
     892
     893static void ich9pcibridgeConfigWrite(PPDMDEVINSR3 pDevIns, uint8_t iBus, uint8_t iDevice, uint32_t u32Address, uint32_t u32Value, unsigned cb)
     894{
     895    PPCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS);
     896
     897    LogFlowFunc((": pDevIns=%p iBus=%d iDevice=%d u32Address=%u u32Value=%u cb=%d\n", pDevIns, iBus, iDevice, u32Address, u32Value, cb));
     898
     899    /* If the current bus is not the target bus search for the bus which contains the device. */
     900    if (iBus != PCIDevGetByte(&pBus->aPciDev, VBOX_PCI_SECONDARY_BUS))
     901    {
     902        PPCIDEVICE pBridgeDevice = ich9pciFindBridge(pBus, iBus);
     903        if (pBridgeDevice)
     904        {
     905            AssertPtr(pBridgeDevice->Int.s.pfnBridgeConfigWrite);
     906            pBridgeDevice->Int.s.pfnBridgeConfigWrite(pBridgeDevice->pDevIns, iBus, iDevice, u32Address, u32Value, cb);
     907        }
     908    }
     909    else
     910    {
     911        /* This is the target bus, pass the write to the device. */
     912        PPCIDEVICE pPciDev = pBus->apDevices[iDevice];
     913        if (pPciDev)
     914        {
     915            Log(("%s: %s: addr=%02x val=%08x len=%d\n", __FUNCTION__, pPciDev->name, u32Address, u32Value, cb));
     916            pPciDev->Int.s.pfnConfigWrite(pPciDev, u32Address, u32Value, cb);
     917        }
     918    }
     919}
     920
     921static uint32_t ich9pcibridgeConfigRead(PPDMDEVINSR3 pDevIns, uint8_t iBus, uint8_t iDevice, uint32_t u32Address, unsigned cb)
     922{
     923    PPCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS);
     924    uint32_t u32Value = 0xffffffff; /* Return value in case there is no device. */
     925
     926    LogFlowFunc((": pDevIns=%p iBus=%d iDevice=%d u32Address=%u cb=%d\n", pDevIns, iBus, iDevice, u32Address, cb));
     927
     928    /* If the current bus is not the target bus search for the bus which contains the device. */
     929    if (iBus != PCIDevGetByte(&pBus->aPciDev, VBOX_PCI_SECONDARY_BUS))
     930    {
     931        PPCIDEVICE pBridgeDevice = ich9pciFindBridge(pBus, iBus);
     932        if (pBridgeDevice)
     933        {
     934            AssertPtr( pBridgeDevice->Int.s.pfnBridgeConfigRead);
     935            u32Value = pBridgeDevice->Int.s.pfnBridgeConfigRead(pBridgeDevice->pDevIns, iBus, iDevice, u32Address, cb);
     936        }
     937    }
     938    else
     939    {
     940        /* This is the target bus, pass the read to the device. */
     941        PPCIDEVICE pPciDev = pBus->apDevices[iDevice];
     942        if (pPciDev)
     943        {
     944            u32Value = pPciDev->Int.s.pfnConfigRead(pPciDev, u32Address, cb);
     945            Log(("%s: %s: u32Address=%02x u32Value=%08x cb=%d\n", __FUNCTION__, pPciDev->name, u32Address, u32Value, cb));
     946        }
     947    }
     948
     949    return u32Value;
    873950}
    874951
     
    10181095                }
    10191096                if (off == VBOX_PCI_COMMAND)
    1020                     PCIDevSetCommand(pDev, 0); /* For remapping, see pciR3CommonLoadExec. */
     1097                    PCIDevSetCommand(pDev, 0); /* For remapping, see ich9pciR3CommonLoadExec. */
    10211098                pDev->Int.s.pfnConfigWrite(pDev, off, u32Src, cb);
    10221099            }
     
    10401117
    10411118/**
    1042  * Common worker for pciR3LoadExec and pcibridgeR3LoadExec.
     1119 * Common worker for ich9pciR3LoadExec and ich9pcibridgeR3LoadExec.
    10431120 *
    10441121 * @returns VBox status code.
     
    10481125 * @param   uPass               The pass.
    10491126 */
    1050 static DECLCALLBACK(int) pciR3CommonLoadExec(PPCIBUS pBus, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
     1127static DECLCALLBACK(int) ich9pciR3CommonLoadExec(PPCIBUS pBus, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    10511128{
    10521129    uint32_t    u32;
     
    11541231 * @param   pSSM            The handle to the saved state.
    11551232 */
    1156 static DECLCALLBACK(int) pciGenericLoadExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
     1233static DECLCALLBACK(int) ich9pciGenericLoadExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
    11571234{
    11581235    return SSMR3GetMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config));
    11591236}
    11601237
    1161 static DECLCALLBACK(int) pciR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
     1238static DECLCALLBACK(int) ich9pciR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    11621239{
    11631240    PPCIBUS pThis = PDMINS_2_DATA(pDevIns, PPCIBUS);
    11641241    if (uVersion > VBOX_ICH9PCI_SAVED_STATE_VERSION)
    11651242        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
    1166     return pciR3CommonLoadExec(pThis, pSSM, uVersion, uPass);
    1167 }
    1168 
    1169 static DECLCALLBACK(int) pcibridgeR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
     1243    return ich9pciR3CommonLoadExec(pThis, pSSM, uVersion, uPass);
     1244}
     1245
     1246static DECLCALLBACK(int) ich9pcibridgeR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
    11701247{
    11711248    PPCIBUS pThis = PDMINS_2_DATA(pDevIns, PPCIBUS);
    11721249    if (uVersion > VBOX_ICH9PCI_SAVED_STATE_VERSION)
    11731250        return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
    1174     return pciR3CommonLoadExec(pThis, pSSM, uVersion, uPass);
     1251    return ich9pciR3CommonLoadExec(pThis, pSSM, uVersion, uPass);
    11751252}
    11761253
     
    16931770        if (!strcmp(pszName, PciSlotAssignments[i].pszName))
    16941771        {
    1695             pPciDev->Int.s.fRequestedDevFn = true;
     1772            PCISetRequestedDevfunc(pPciDev);
    16961773            return (PciSlotAssignments[i].iSlot << 3) + PciSlotAssignments[i].iFunction;
    16971774        }
     
    17091786                &&  !pBus->apDevices[iPos + 7])
    17101787        {
    1711             pPciDev->Int.s.fRequestedDevFn = false;
     1788            PCIClearRequestedDevfunc(pPciDev);
    17121789            return iPos;
    17131790        }
     
    17201797    PCIDevice** aSlot = &pBus->apDevices[iSlot << 3];
    17211798
    1722     return    (aSlot[0] && aSlot[0]->Int.s.fRequestedDevFn)
    1723            || (aSlot[1] && aSlot[1]->Int.s.fRequestedDevFn)
    1724            || (aSlot[2] && aSlot[2]->Int.s.fRequestedDevFn)
    1725            || (aSlot[3] && aSlot[3]->Int.s.fRequestedDevFn)
    1726            || (aSlot[4] && aSlot[4]->Int.s.fRequestedDevFn)
    1727            || (aSlot[5] && aSlot[5]->Int.s.fRequestedDevFn)
    1728            || (aSlot[6] && aSlot[6]->Int.s.fRequestedDevFn)
    1729            || (aSlot[7] && aSlot[7]->Int.s.fRequestedDevFn)
     1799    return     (aSlot[0] && PCIIsRequestedDevfunc(aSlot[0]))
     1800            || (aSlot[1] && PCIIsRequestedDevfunc(aSlot[1]))
     1801            || (aSlot[2] && PCIIsRequestedDevfunc(aSlot[2]))
     1802            || (aSlot[3] && PCIIsRequestedDevfunc(aSlot[3]))
     1803            || (aSlot[4] && PCIIsRequestedDevfunc(aSlot[4]))
     1804            || (aSlot[5] && PCIIsRequestedDevfunc(aSlot[5]))
     1805            || (aSlot[6] && PCIIsRequestedDevfunc(aSlot[6]))
     1806            || (aSlot[7] && PCIIsRequestedDevfunc(aSlot[7]))
    17301807           ;
    17311808}
     
    17501827     * its current habitant, if it wasn't hard assigned too.
    17511828     */
    1752     if (pPciDev->Int.s.fRequestedDevFn &&
    1753         pBus->apDevices[iDev]            &&
    1754         pBus->apDevices[iDev]->Int.s.fRequestedDevFn)
     1829    if (PCIIsRequestedDevfunc(pPciDev) &&
     1830        pBus->apDevices[iDev]          &&
     1831        PCIIsRequestedDevfunc(pBus->apDevices[iDev]))
    17551832    {
    17561833        /*
     
    17961873    pPciDev->Int.s.pfnConfigWrite   = ich9pciConfigWrite;
    17971874    pBus->apDevices[iDev]           = pPciDev;
    1798     if (pPciDev->Int.s.fPciToPciBridge)
     1875    if (PCIIsPci2PciBridge(pPciDev))
    17991876    {
    18001877        AssertMsg(pBus->cBridges < RT_ELEMENTS(pBus->apDevices), ("Number of bridges exceeds the number of possible devices on the bus\n"));
     
    19181995    PciBusReg.pfnSetConfigCallbacksR3 = ich9pciSetConfigCallbacks;
    19191996    PciBusReg.pfnSetIrqR3             = ich9pciSetIrq;
    1920     PciBusReg.pfnSaveExecR3           = pciGenericSaveExec;
    1921     PciBusReg.pfnLoadExecR3           = pciGenericLoadExec;
     1997    PciBusReg.pfnSaveExecR3           = ich9pciGenericSaveExec;
     1998    PciBusReg.pfnLoadExecR3           = ich9pciGenericLoadExec;
    19221999    PciBusReg.pfnFakePCIBIOSR3        = ich9pciFakePCIBIOS;
    19232000    PciBusReg.pszSetIrqRC             = fGCEnabled ? "ich9pciSetIrq" : NULL;
     
    20912168                                N_("Configuration error: Failed to query boolean value \"R0Enabled\""));
    20922169    Log(("PCI: fGCEnabled=%RTbool fR0Enabled=%RTbool\n", fGCEnabled, fR0Enabled));
     2170
     2171    /*
     2172     * Init data and register the PCI bus.
     2173     */
     2174    PPCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS);
     2175    pBus->pDevInsR3 = pDevIns;
     2176    pBus->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
     2177    pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
     2178    pBus->papBridgesR3 = (PPCIDEVICE *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPCIDEVICE) * RT_ELEMENTS(pBus->apDevices));
     2179
     2180    PDMPCIBUSREG PciBusReg;
     2181    PciBusReg.u32Version              = PDM_PCIBUSREG_VERSION;
     2182    PciBusReg.pfnRegisterR3           = ich9pcibridgeRegister;
     2183    PciBusReg.pfnIORegionRegisterR3   = ich9pciIORegionRegister;
     2184    PciBusReg.pfnSetConfigCallbacksR3 = ich9pciSetConfigCallbacks;
     2185    PciBusReg.pfnSetIrqR3             = ich9pcibridgeSetIrq;
     2186    PciBusReg.pfnSaveExecR3           = ich9pciGenericSaveExec;
     2187    PciBusReg.pfnLoadExecR3           = ich9pciGenericLoadExec;
     2188    PciBusReg.pfnFakePCIBIOSR3        = NULL; /* Only needed for the first bus. */
     2189    PciBusReg.pszSetIrqRC             = fGCEnabled ? "ich9pcibridgeSetIrq" : NULL;
     2190    PciBusReg.pszSetIrqR0             = fR0Enabled ? "ich9pcibridgeSetIrq" : NULL;
     2191    rc = PDMDevHlpPCIBusRegister(pDevIns, &PciBusReg, &pBus->pPciHlpR3);
     2192    if (RT_FAILURE(rc))
     2193        return PDMDEV_SET_ERROR(pDevIns, rc,
     2194                                N_("Failed to register ourselves as a PCI Bus"));
     2195    if (pBus->pPciHlpR3->u32Version != PDM_PCIHLPR3_VERSION)
     2196        return PDMDevHlpVMSetError(pDevIns, VERR_VERSION_MISMATCH, RT_SRC_POS,
     2197                                   N_("PCI helper version mismatch; got %#x expected %#x"),
     2198                                   pBus->pPciHlpR3->u32Version, PDM_PCIHLPR3_VERSION);
     2199
     2200    pBus->pPciHlpRC = pBus->pPciHlpR3->pfnGetRCHelpers(pDevIns);
     2201    pBus->pPciHlpR0 = pBus->pPciHlpR3->pfnGetR0Helpers(pDevIns);
     2202
     2203    /*
     2204     * Fill in PCI configs and add them to the bus.
     2205     */
     2206    PCIDevSetVendorId(  &pBus->aPciDev, 0x8086); /* Intel */
     2207    PCIDevSetDeviceId(  &pBus->aPciDev, 0x2448); /* 82801 Mobile PCI bridge. */
     2208    PCIDevSetRevisionId(&pBus->aPciDev,   0xf2);
     2209    PCIDevSetClassSub(  &pBus->aPciDev,   0x04); /* pci2pci */
     2210    PCIDevSetClassBase( &pBus->aPciDev,   0x06); /* PCI_bridge */
     2211    PCIDevSetClassProg( &pBus->aPciDev,   0x01); /* Supports subtractive decoding. */
     2212    PCIDevSetHeaderType(&pBus->aPciDev,   0x01); /* Single function device which adheres to the PCI-to-PCI bridge spec. */
     2213    PCIDevSetCommand(   &pBus->aPciDev,   0x00);
     2214    PCIDevSetStatus(    &pBus->aPciDev,   0x20); /* 66MHz Capable. */
     2215    PCIDevSetInterruptLine(&pBus->aPciDev, 0x00); /* This device does not assert interrupts. */
     2216
     2217    /*
     2218     * This device does not generate interrupts. Interrupt delivery from
     2219     * devices attached to the bus is unaffected.
     2220     */
     2221    PCIDevSetInterruptPin (&pBus->aPciDev, 0x00);
     2222
     2223    pBus->aPciDev.pDevIns                    = pDevIns;
     2224
     2225    /* Bridge-specific data */
     2226    PCISetPci2PciBridge(&pBus->aPciDev);
     2227    pBus->aPciDev.Int.s.pfnBridgeConfigRead  = ich9pcibridgeConfigRead;
     2228    pBus->aPciDev.Int.s.pfnBridgeConfigWrite = ich9pcibridgeConfigWrite;
     2229
     2230    /*
     2231     * Register this PCI bridge. The called function will take care on which bus we will get registered.
     2232     */
     2233    rc = PDMDevHlpPCIRegister (pDevIns, &pBus->aPciDev);
     2234    if (RT_FAILURE(rc))
     2235        return rc;
     2236
     2237    /*
     2238     * The iBus property doesn't really represent the bus number
     2239     * because the guest and the BIOS can choose different bus numbers
     2240     * for them.
     2241     * The bus number is mainly for the setIrq function to indicate
     2242     * when the host bus is reached which will have iBus = 0.
     2243     * Thathswhy the + 1.
     2244     */
     2245    pBus->iBus = iInstance + 1;
     2246
     2247    /*
     2248     * Register SSM handlers. We use the same saved state version as for the host bridge
     2249     * to make changes easier.
     2250     */
     2251    rc = PDMDevHlpSSMRegisterEx(pDevIns, VBOX_ICH9PCI_SAVED_STATE_VERSION, sizeof(*pBus) + 16*128, "pgm",
     2252                                NULL, NULL, NULL,
     2253                                NULL, ich9pcibridgeR3SaveExec, NULL,
     2254                                NULL, ich9pcibridgeR3LoadExec, NULL);
     2255    if (RT_FAILURE(rc))
     2256        return rc;
     2257
    20932258
    20942259    return VINF_SUCCESS;
  • trunk/src/VBox/Devices/Bus/PCIInternal.h

    r32216 r32776  
    7272struct PCIBus;
    7373
     74enum {
     75    /** Set if the specific device fun was requested by PDM.
     76     * If clear the device and it's functions can be relocated to satisfy the slot request of another device. */
     77    PCIDEV_FLAG_REQUESTED_DEVFUNC = 1<<0,
     78    /** Flag whether the device is a pci-to-pci bridge.
     79     * This is set prior to device registration.  */
     80    PCIDEV_FLAG_PCI_TO_PCI_BRIDGE = 1<<1,
     81    /** Flag whether the device is a PCI Express device.
     82     * This is set prior to device registration.  */
     83    PCIDEV_FLAG_PCI_EXPRESS_DEVICE = 1<<2
     84};
     85
    7486/**
    7587 * PCI Device - Internal data.
     
    94106    R3PTRTYPE(PFNPCICONFIGWRITE)    pfnConfigWrite;
    95107
    96     /** Set if the specific device fun was requested by PDM.
    97      * If clear the device and it's functions can be relocated to satisfy the slot request of another device. */
    98     bool                            fRequestedDevFn;
    99     /** Flag whether the device is a pci-to-pci bridge.
    100      * This is set prior to device registration.  */
    101     bool                            fPciToPciBridge;
     108    /* Flags of this PCI device, see PCIDEV_FLAG_ constants */
     109    int32_t                         uFlags;
    102110    /** Current state of the IRQ pin of the device. */
    103111    int32_t                         uIrqPinState;
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