VirtualBox

Changeset 36079 in vbox


Ignore:
Timestamp:
Feb 24, 2011 5:10:31 PM (14 years ago)
Author:
vboxsync
Message:

PCI: cleanup, todos, raw PCI regions work

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/pci.h

    r35738 r36079  
    547547DECLINLINE(uint8_t)  PCIDevGetByte(PPCIDEVICE pPciDev, uint32_t uOffset)
    548548{
     549#ifdef PCIDEVICEINT_DECLARED
     550    Assert((pPciDev->Int.s.fFlags & PCIDEV_FLAG_PASSTHROUGH) == 0);
     551#endif
    549552    return pPciDev->config[uOffset];
    550553}
     
    557560DECLINLINE(uint16_t) PCIDevGetWord(PPCIDEVICE pPciDev, uint32_t uOffset)
    558561{
     562#ifdef PCIDEVICEINT_DECLARED
     563    Assert((pPciDev->Int.s.fFlags & PCIDEV_FLAG_PASSTHROUGH) == 0);
     564#endif
    559565    uint16_t u16Value = *(uint16_t*)&pPciDev->config[uOffset];
    560566    return RT_H2LE_U16(u16Value);
     
    568574DECLINLINE(uint32_t) PCIDevGetDWord(PPCIDEVICE pPciDev, uint32_t uOffset)
    569575{
     576#ifdef PCIDEVICEINT_DECLARED
     577    Assert((pPciDev->Int.s.fFlags & PCIDEV_FLAG_PASSTHROUGH) == 0);
     578#endif
    570579    uint32_t u32Value = *(uint32_t*)&pPciDev->config[uOffset];
    571580    return RT_H2LE_U32(u32Value);
     
    579588DECLINLINE(uint64_t) PCIDevGetQWord(PPCIDEVICE pPciDev, uint32_t uOffset)
    580589{
     590#ifdef PCIDEVICEINT_DECLARED
     591    Assert((pPciDev->Int.s.fFlags & PCIDEV_FLAG_PASSTHROUGH) == 0);
     592#endif
    581593    uint64_t u64Value = *(uint64_t*)&pPciDev->config[uOffset];
    582594    return RT_H2LE_U64(u64Value);
     
    920932
    921933#ifdef PCIDEVICEINT_DECLARED
    922 /** @todo r=bird: These are internal methods and should start with lowercase
    923  *  prefix as well as including the 'Dev' bit: s/PCI\(Set|Get\)/pciDev\1/
    924  *
    925  *  Also: s/uFlags/fFlags/
    926  */
    927 
    928 DECLINLINE(void) PCISetRequestedDevfunc(PPCIDEVICE pDev)
    929 {
    930     pDev->Int.s.uFlags |= PCIDEV_FLAG_REQUESTED_DEVFUNC;
    931 }
    932 
    933 DECLINLINE(void) PCIClearRequestedDevfunc(PPCIDEVICE pDev)
    934 {
    935     pDev->Int.s.uFlags &= ~PCIDEV_FLAG_REQUESTED_DEVFUNC;
    936 }
    937 
    938 DECLINLINE(bool) PCIIsRequestedDevfunc(PPCIDEVICE pDev)
    939 {
    940     return (pDev->Int.s.uFlags & PCIDEV_FLAG_REQUESTED_DEVFUNC) != 0;
    941 }
    942 
    943 DECLINLINE(void) PCISetPci2PciBridge(PPCIDEVICE pDev)
    944 {
    945     pDev->Int.s.uFlags |= PCIDEV_FLAG_PCI_TO_PCI_BRIDGE;
    946 }
    947 
    948 DECLINLINE(bool) PCIIsPci2PciBridge(PPCIDEVICE pDev)
    949 {
    950     return (pDev->Int.s.uFlags & PCIDEV_FLAG_PCI_TO_PCI_BRIDGE) != 0;
    951 }
    952 
    953 DECLINLINE(void) PCISetPciExpress(PPCIDEVICE pDev)
    954 {
    955     pDev->Int.s.uFlags |= PCIDEV_FLAG_PCI_EXPRESS_DEVICE;
    956 }
    957 
    958 DECLINLINE(bool) PCIIsPciExpress(PPCIDEVICE pDev)
    959 {
    960     return (pDev->Int.s.uFlags & PCIDEV_FLAG_PCI_EXPRESS_DEVICE) != 0;
    961 }
    962 
    963 DECLINLINE(void) PCISetMsiCapable(PPCIDEVICE pDev)
    964 {
    965     pDev->Int.s.uFlags |= PCIDEV_FLAG_MSI_CAPABLE;
    966 }
    967 
    968 DECLINLINE(void) PCIClearMsiCapable(PPCIDEVICE pDev)
    969 {
    970     pDev->Int.s.uFlags &= ~PCIDEV_FLAG_MSI_CAPABLE;
    971 }
    972 
    973 DECLINLINE(bool) PCIIsMsiCapable(PPCIDEVICE pDev)
    974 {
    975     return (pDev->Int.s.uFlags & PCIDEV_FLAG_MSI_CAPABLE) != 0;
    976 }
    977 
    978 DECLINLINE(void) PCISetMsixCapable(PPCIDEVICE pDev)
    979 {
    980     pDev->Int.s.uFlags |= PCIDEV_FLAG_MSIX_CAPABLE;
    981 }
    982 
    983 DECLINLINE(void) PCIClearMsixCapable(PPCIDEVICE pDev)
    984 {
    985     pDev->Int.s.uFlags &= ~PCIDEV_FLAG_MSIX_CAPABLE;
    986 }
    987 
    988 DECLINLINE(bool) PCIIsMsixCapable(PPCIDEVICE pDev)
    989 {
    990     return (pDev->Int.s.uFlags & PCIDEV_FLAG_MSIX_CAPABLE) != 0;
    991 }
    992 
    993 DECLINLINE(void) PCISetPassthrough(PPCIDEVICE pDev)
    994 {
    995     pDev->Int.s.uFlags |= PCIDEV_FLAG_PASSTHROUGH;
    996 }
    997 
    998 DECLINLINE(void) PCIClearPassthrough(PPCIDEVICE pDev)
    999 {
    1000     pDev->Int.s.uFlags &= ~PCIDEV_FLAG_PASSTHROUGH;
    1001 }
    1002 
    1003 DECLINLINE(bool) PCIIsPassthrough(PPCIDEVICE pDev)
    1004 {
    1005     return (pDev->Int.s.uFlags & PCIDEV_FLAG_PASSTHROUGH) != 0;
     934DECLINLINE(void) pciDevSetRequestedDevfunc(PPCIDEVICE pDev)
     935{
     936    pDev->Int.s.fFlags |= PCIDEV_FLAG_REQUESTED_DEVFUNC;
     937}
     938
     939DECLINLINE(void) pciDevClearRequestedDevfunc(PPCIDEVICE pDev)
     940{
     941    pDev->Int.s.fFlags &= ~PCIDEV_FLAG_REQUESTED_DEVFUNC;
     942}
     943
     944DECLINLINE(bool) pciDevIsRequestedDevfunc(PPCIDEVICE pDev)
     945{
     946    return (pDev->Int.s.fFlags & PCIDEV_FLAG_REQUESTED_DEVFUNC) != 0;
     947}
     948
     949DECLINLINE(void) pciDevSetPci2PciBridge(PPCIDEVICE pDev)
     950{
     951    pDev->Int.s.fFlags |= PCIDEV_FLAG_PCI_TO_PCI_BRIDGE;
     952}
     953
     954DECLINLINE(bool) pciDevIsPci2PciBridge(PPCIDEVICE pDev)
     955{
     956    return (pDev->Int.s.fFlags & PCIDEV_FLAG_PCI_TO_PCI_BRIDGE) != 0;
     957}
     958
     959DECLINLINE(void) pciDevSetPciExpress(PPCIDEVICE pDev)
     960{
     961    pDev->Int.s.fFlags |= PCIDEV_FLAG_PCI_EXPRESS_DEVICE;
     962}
     963
     964DECLINLINE(bool) pciDevIsPciExpress(PPCIDEVICE pDev)
     965{
     966    return (pDev->Int.s.fFlags & PCIDEV_FLAG_PCI_EXPRESS_DEVICE) != 0;
     967}
     968
     969DECLINLINE(void) pciDevSetMsiCapable(PPCIDEVICE pDev)
     970{
     971    pDev->Int.s.fFlags |= PCIDEV_FLAG_MSI_CAPABLE;
     972}
     973
     974DECLINLINE(void) pciDevClearMsiCapable(PPCIDEVICE pDev)
     975{
     976    pDev->Int.s.fFlags &= ~PCIDEV_FLAG_MSI_CAPABLE;
     977}
     978
     979DECLINLINE(bool) pciDevIsMsiCapable(PPCIDEVICE pDev)
     980{
     981    return (pDev->Int.s.fFlags & PCIDEV_FLAG_MSI_CAPABLE) != 0;
     982}
     983
     984DECLINLINE(void) pciDevSetMsixCapable(PPCIDEVICE pDev)
     985{
     986    pDev->Int.s.fFlags |= PCIDEV_FLAG_MSIX_CAPABLE;
     987}
     988
     989DECLINLINE(void) pciDevClearMsixCapable(PPCIDEVICE pDev)
     990{
     991    pDev->Int.s.fFlags &= ~PCIDEV_FLAG_MSIX_CAPABLE;
     992}
     993
     994DECLINLINE(bool) pciDevIsMsixCapable(PPCIDEVICE pDev)
     995{
     996    return (pDev->Int.s.fFlags & PCIDEV_FLAG_MSIX_CAPABLE) != 0;
     997}
     998
     999DECLINLINE(void) pciDevSetPassthrough(PPCIDEVICE pDev)
     1000{
     1001    pDev->Int.s.fFlags |= PCIDEV_FLAG_PASSTHROUGH;
     1002}
     1003
     1004DECLINLINE(void) pciDevClearPassthrough(PPCIDEVICE pDev)
     1005{
     1006    pDev->Int.s.fFlags &= ~PCIDEV_FLAG_PASSTHROUGH;
     1007}
     1008
     1009DECLINLINE(bool) pciDevIsPassthrough(PPCIDEVICE pDev)
     1010{
     1011    return (pDev->Int.s.fFlags & PCIDEV_FLAG_PASSTHROUGH) != 0;
    10061012}
    10071013
  • trunk/include/VBox/rawpci.h

    r36055 r36079  
    8787    uint64_t             iRegionSize;
    8888    RTR3PTR              pvAddressR3;
    89     RTR0PTR              pvAddressR0;   
     89    RTR0PTR              pvAddressR0;
    9090} PCIRAWREQUNMAPREGION;
    9191
     
    126126{
    127127    /* in */
    128     RTGCPHYS             Address;
     128    RTR0PTR              Address;
    129129    PCIRAWMEMLOC         Value;
    130130} PCIRAWREQMMIOWRITE;
     
    134134{
    135135    /* in */
    136     RTGCPHYS             Address;
     136    RTR0PTR              Address;
    137137    /* inout (Value.cb is in) */
    138138    PCIRAWMEMLOC         Value;
     
    296296                                             RTHCPHYS       RegionStart,
    297297                                             uint64_t       u64RegionSize,
    298                                              RTR0PTR        *pRegionBase));
     298                                             RTR0PTR        *pRegionBaseR0));
    299299
    300300    /**
  • trunk/src/VBox/Devices/Bus/DevPCI.cpp

    r35753 r36079  
    773773         */
    774774        PPCIDEVICE pBridgeTemp = pBus->papBridgesR3[iBridge];
    775         AssertMsg(pBridgeTemp && PCIIsPci2PciBridge(pBridgeTemp),
     775        AssertMsg(pBridgeTemp && pciDevIsPci2PciBridge(pBridgeTemp),
    776776                  ("Device is not a PCI bridge but on the list of PCI bridges\n"));
    777777
     
    17211721            }
    17221722        }
    1723         PCIClearRequestedDevfunc(pPciDev);
     1723        pciDevClearRequestedDevfunc(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 (    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])))
     1744            if (    pciDevIsRequestedDevfunc(pBus->devices[iDev])
     1745                ||  (pBus->devices[iDev + 1] && pciDevIsRequestedDevfunc(pBus->devices[iDev + 1]))
     1746                ||  (pBus->devices[iDev + 2] && pciDevIsRequestedDevfunc(pBus->devices[iDev + 2]))
     1747                ||  (pBus->devices[iDev + 3] && pciDevIsRequestedDevfunc(pBus->devices[iDev + 3]))
     1748                ||  (pBus->devices[iDev + 4] && pciDevIsRequestedDevfunc(pBus->devices[iDev + 4]))
     1749                ||  (pBus->devices[iDev + 5] && pciDevIsRequestedDevfunc(pBus->devices[iDev + 5]))
     1750                ||  (pBus->devices[iDev + 6] && pciDevIsRequestedDevfunc(pBus->devices[iDev + 6]))
     1751                ||  (pBus->devices[iDev + 7] && pciDevIsRequestedDevfunc(pBus->devices[iDev + 7])))
    17521752            {
    17531753                AssertReleaseMsgFailed(("Configuration error:'%s' and '%s' are both configured as device %d\n",
     
    17861786            }
    17871787        } /* if conflict */
    1788         PCISetRequestedDevfunc(pPciDev);
     1788        pciDevSetRequestedDevfunc(pPciDev);
    17891789    }
    17901790
     
    17981798    pPciDev->Int.s.pfnConfigWrite   = pci_default_write_config;
    17991799    pBus->devices[iDev]             = pPciDev;
    1800     if (PCIIsPci2PciBridge(pPciDev))
     1800    if (pciDevIsPci2PciBridge(pPciDev))
    18011801    {
    18021802        AssertMsg(pBus->cBridges < RT_ELEMENTS(pBus->devices), ("Number of bridges exceeds the number of possible devices on the bus\n"));
     
    21112111
    21122112    pBus->PciDev.pDevIns              = pDevIns;
    2113     PCISetRequestedDevfunc(&pBus->PciDev);
     2113    pciDevSetRequestedDevfunc(&pBus->PciDev);
    21142114    pciRegisterInternal(pBus, 0, &pBus->PciDev, "i440FX");
    21152115
     
    21222122
    21232123    pGlobals->PIIX3State.dev.pDevIns      = pDevIns;
    2124     PCISetRequestedDevfunc(&pGlobals->PIIX3State.dev);
     2124    pciDevSetRequestedDevfunc(&pGlobals->PIIX3State.dev);
    21252125    pciRegisterInternal(pBus, 8, &pGlobals->PIIX3State.dev, "PIIX3");
    21262126    piix3_reset(&pGlobals->PIIX3State);
     
    24962496
    24972497    /* Bridge-specific data */
    2498     PCISetPci2PciBridge(&pBus->PciDev);
     2498    pciDevSetPci2PciBridge(&pBus->PciDev);
    24992499    pBus->PciDev.Int.s.pfnBridgeConfigRead  = pcibridgeConfigRead;
    25002500    pBus->PciDev.Int.s.pfnBridgeConfigWrite = pcibridgeConfigWrite;
  • trunk/src/VBox/Devices/Bus/DevPciIch9.cpp

    r35753 r36079  
    698698         */
    699699        PPCIDEVICE pBridgeTemp = pBus->papBridgesR3[iBridge];
    700         AssertMsg(pBridgeTemp && PCIIsPci2PciBridge(pBridgeTemp),
     700        AssertMsg(pBridgeTemp && pciDevIsPci2PciBridge(pBridgeTemp),
    701701                  ("Device is not a PCI bridge but on the list of PCI bridges\n"));
    702702
     
    949949static DECLCALLBACK(int) ich9pciGenericSaveExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
    950950{
    951     Assert(!PCIIsPassthrough(pPciDev));
     951    Assert(!pciDevIsPassthrough(pPciDev));
    952952    return SSMR3PutMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config));
    953953}
     
    969969
    970970            /* Device flags */
    971             int rc = SSMR3PutU32(pSSM, pDev->Int.s.uFlags);
     971            int rc = SSMR3PutU32(pSSM, pDev->Int.s.fFlags);
    972972            if (RT_FAILURE(rc))
    973973                return rc;
     
    12021202     */
    12031203    uint8_t const fBridge = fIsBridge ? 2 : 1;
    1204     Assert(!PCIIsPassthrough(pDev));
     1204    Assert(!pciDevIsPassthrough(pDev));
    12051205    uint8_t *pbDstConfig = &pDev->config[0];
    12061206
     
    13391339
    13401340        /* get the data */
    1341         DevTmp.Int.s.uFlags = 0;
     1341        DevTmp.Int.s.fFlags = 0;
    13421342        DevTmp.Int.s.u8MsiCapOffset = 0;
    13431343        DevTmp.Int.s.u8MsiCapSize = 0;
     
    13471347        SSMR3GetMem(pSSM, DevTmp.config, sizeof(DevTmp.config));
    13481348
    1349         rc = SSMR3GetU32(pSSM, &DevTmp.Int.s.uFlags);
     1349        rc = SSMR3GetU32(pSSM, &DevTmp.Int.s.fFlags);
    13501350        if (RT_FAILURE(rc))
    13511351            goto out;
     
    13981398
    13991399        /* commit the loaded device config. */
    1400         Assert(!PCIIsPassthrough(pDev));
     1400        Assert(!pciDevIsPassthrough(pDev));
    14011401        pciR3CommonRestoreConfig(pDev, &DevTmp.config[0], false ); /** @todo fix bridge fun! */
    14021402
     
    14301430static DECLCALLBACK(int) ich9pciGenericLoadExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM)
    14311431{
    1432     Assert(!PCIIsPassthrough(pPciDev));
     1432    Assert(!pciDevIsPassthrough(pPciDev));
    14331433    return SSMR3GetMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config));
    14341434}
     
    17581758    AssertMsgReturn(u32Address + len <= 256, ("Read after end of PCI config space\n"),
    17591759                    0);
    1760     if (   PCIIsMsiCapable(aDev)
     1760    if (   pciDevIsMsiCapable(aDev)
    17611761        && (u32Address >= aDev->Int.s.u8MsiCapOffset)
    17621762        && (u32Address <  aDev->Int.s.u8MsiCapOffset + aDev->Int.s.u8MsiCapSize)
     
    17661766    }
    17671767
    1768     if (   PCIIsMsixCapable(aDev)
     1768    if (   pciDevIsMsixCapable(aDev)
    17691769        && (u32Address >= aDev->Int.s.u8MsixCapOffset)
    17701770        && (u32Address <  aDev->Int.s.u8MsixCapOffset + aDev->Int.s.u8MsixCapSize)
     
    18391839    AssertMsgReturnVoid(u32Address + len <= 256, ("Write after end of PCI config space\n"));
    18401840
    1841     if (   PCIIsMsiCapable(aDev)
     1841    if (   pciDevIsMsiCapable(aDev)
    18421842        && (u32Address >= aDev->Int.s.u8MsiCapOffset)
    18431843        && (u32Address <  aDev->Int.s.u8MsiCapOffset + aDev->Int.s.u8MsiCapSize)
     
    18501850    }
    18511851
    1852     if (   PCIIsMsixCapable(aDev)
     1852    if (   pciDevIsMsixCapable(aDev)
    18531853        && (u32Address >= aDev->Int.s.u8MsixCapOffset)
    18541854        && (u32Address <  aDev->Int.s.u8MsixCapOffset + aDev->Int.s.u8MsixCapSize)
     
    20062006        if (!strcmp(pszName, PciSlotAssignments[i].pszName))
    20072007        {
    2008             PCISetRequestedDevfunc(pPciDev);
     2008            pciDevSetRequestedDevfunc(pPciDev);
    20092009            aPosition->iDeviceFunc =
    20102010                    (PciSlotAssignments[i].iSlot << 3) + PciSlotAssignments[i].iFunction;
     
    20312031                &&  !pBus->apDevices[iPos + 7])
    20322032        {
    2033             PCIClearRequestedDevfunc(pPciDev);
     2033            pciDevClearRequestedDevfunc(pPciDev);
    20342034            aPosition->iDeviceFunc = iPos;
    20352035            return true;
     
    20442044    PCIDevice** aSlot = &pBus->apDevices[iSlot << 3];
    20452045
    2046     return     (aSlot[0] && PCIIsRequestedDevfunc(aSlot[0]))
    2047             || (aSlot[1] && PCIIsRequestedDevfunc(aSlot[1]))
    2048             || (aSlot[2] && PCIIsRequestedDevfunc(aSlot[2]))
    2049             || (aSlot[3] && PCIIsRequestedDevfunc(aSlot[3]))
    2050             || (aSlot[4] && PCIIsRequestedDevfunc(aSlot[4]))
    2051             || (aSlot[5] && PCIIsRequestedDevfunc(aSlot[5]))
    2052             || (aSlot[6] && PCIIsRequestedDevfunc(aSlot[6]))
    2053             || (aSlot[7] && PCIIsRequestedDevfunc(aSlot[7]))
     2046    return     (aSlot[0] && pciDevIsRequestedDevfunc(aSlot[0]))
     2047            || (aSlot[1] && pciDevIsRequestedDevfunc(aSlot[1]))
     2048            || (aSlot[2] && pciDevIsRequestedDevfunc(aSlot[2]))
     2049            || (aSlot[3] && pciDevIsRequestedDevfunc(aSlot[3]))
     2050            || (aSlot[4] && pciDevIsRequestedDevfunc(aSlot[4]))
     2051            || (aSlot[5] && pciDevIsRequestedDevfunc(aSlot[5]))
     2052            || (aSlot[6] && pciDevIsRequestedDevfunc(aSlot[6]))
     2053            || (aSlot[7] && pciDevIsRequestedDevfunc(aSlot[7]))
    20542054           ;
    20552055}
     
    20782078     * its current habitant, if it wasn't hard assigned too.
    20792079     */
    2080     if (PCIIsRequestedDevfunc(pPciDev) &&
     2080    if (pciDevIsRequestedDevfunc(pPciDev) &&
    20812081        pBus->apDevices[iDev]          &&
    2082         PCIIsRequestedDevfunc(pBus->apDevices[iDev]))
     2082        pciDevIsRequestedDevfunc(pBus->apDevices[iDev]))
    20832083    {
    20842084        AssertReleaseMsgFailed(("Configuration error:'%s' and '%s' are both configured as device %d\n",
     
    21232123    pPciDev->Int.s.pfnConfigWrite   = ich9pciConfigWriteDev;
    21242124    pBus->apDevices[iDev]           = pPciDev;
    2125     if (PCIIsPci2PciBridge(pPciDev))
     2125    if (pciDevIsPci2PciBridge(pPciDev))
    21262126    {
    21272127        AssertMsg(pBus->cBridges < RT_ELEMENTS(pBus->apDevices), ("Number of bridges exceeds the number of possible devices on the bus\n"));
     
    21322132    }
    21332133
    2134     Log(("PCI: Registered device %d function %d (%#x) '%s'.\n",
    2135          iDev >> 3, iDev & 7, 0x80000000 | (iDev << 8), pszName));
     2134    Log(("PCI: Registered device %d function %d on bus %d (%#x) '%s'.\n",
     2135         iDev >> 3, iDev & 7, pBus->iBus, 0x80000000 | (iDev << 8), pszName));
    21362136
    21372137    return VINF_SUCCESS;
     
    21442144        pHlp->pfnPrintf(pHlp, "    ");
    21452145    }
     2146}
     2147static uint32_t ich9pciGetCfg(PCIDevice* aDev, int32_t iRegister, int cb)
     2148{
     2149    return aDev->Int.s.pfnConfigRead(aDev, iRegister, cb);
     2150}
     2151
     2152static uint8_t ich9pciGetByte(PCIDevice* aDev, int32_t iRegister)
     2153{
     2154    return (uint8_t)ich9pciGetCfg(aDev, iRegister, 1);
     2155}
     2156
     2157static uint16_t ich9pciGetWord(PCIDevice* aDev, int32_t iRegister)
     2158{
     2159    return (uint16_t)ich9pciGetCfg(aDev, iRegister, 2);
     2160}
     2161
     2162static uint32_t ich9pciGetDWord(PCIDevice* aDev, int32_t iRegister)
     2163{
     2164    return (uint32_t)ich9pciGetCfg(aDev, iRegister, 4);
    21462165}
    21472166
     
    21532172        if (pPciDev != NULL)
    21542173        {
    2155             if (PCIIsPassthrough(pPciDev))
    2156             {
    2157                 printIndent(pHlp, iIndent);
    2158                 /**
    2159                  * For passthrough devices MSI/MSI-X mostly reflects the way interrupts delivered to the guest,
    2160                  * as host driver handles real devices interrupts.
    2161                  */
    2162                 pHlp->pfnPrintf(pHlp, "%02x:%02x:%02x %s: %s%s - PASSTHROUGH\n",
    2163                                 pBus->iBus, (iDev >> 3) & 0xff, iDev & 0x7,
    2164                                 pPciDev->name,
    2165                                 PCIIsMsiCapable(pPciDev)  ? " MSI" : "",
    2166                                 PCIIsMsixCapable(pPciDev) ? " MSI-X" : ""
    2167                                 );
    2168                 continue;
    2169             }
    21702174            printIndent(pHlp, iIndent);
    2171             pHlp->pfnPrintf(pHlp, "%02x:%02x:%02x %s: %04x-%04x%s%s",
     2175
     2176            /**
     2177             * For passthrough devices MSI/MSI-X mostly reflects the way interrupts delivered to the guest,
     2178             * as host driver handles real devices interrupts.
     2179             */
     2180            pHlp->pfnPrintf(pHlp, "%02x:%02x:%02x %s%s: %04x-%04x%s%s",
    21722181                            pBus->iBus, (iDev >> 3) & 0xff, iDev & 0x7,
    21732182                            pPciDev->name,
    2174                             PCIDevGetVendorId(pPciDev), PCIDevGetDeviceId(pPciDev),
    2175                             PCIIsMsiCapable(pPciDev)  ? " MSI" : "",
    2176                             PCIIsMsixCapable(pPciDev) ? " MSI-X" : ""
     2183                            pciDevIsPassthrough(pPciDev) ? " (PASSTHROUGH)" : "",
     2184                            ich9pciGetWord(pPciDev, VBOX_PCI_VENDOR_ID), ich9pciGetWord(pPciDev, VBOX_PCI_DEVICE_ID),
     2185                            pciDevIsMsiCapable(pPciDev)  ? " MSI" : "",
     2186                            pciDevIsMsixCapable(pPciDev) ? " MSI-X" : ""
    21772187                            );
    2178             if (PCIDevGetInterruptPin(pPciDev) != 0)
     2188            if (!pciDevIsPassthrough(pPciDev) && PCIDevGetInterruptPin(pPciDev) != 0)
    21792189                pHlp->pfnPrintf(pHlp, " IRQ%d", PCIDevGetInterruptLine(pPciDev));
    21802190
    21812191            pHlp->pfnPrintf(pHlp, "\n");
    21822192
    2183             int iCmd = PCIDevGetCommand(pPciDev);
     2193            int iCmd = ich9pciGetWord(pPciDev, VBOX_PCI_COMMAND);
    21842194            if ((iCmd & (VBOX_PCI_COMMAND_IO | VBOX_PCI_COMMAND_MEMORY)) != 0)
    21852195            {
     
    21922202                        continue;
    21932203
    2194                     uint32_t u32Addr = ich9pciConfigReadDev(pPciDev, ich9pciGetRegionReg(iRegion), 4);
     2204                    uint32_t u32Addr = ich9pciGetDWord(pPciDev, ich9pciGetRegionReg(iRegion));
    21952205                    const char * szDesc;
    21962206
     
    22242234                    while (iPerLine-- > 0)
    22252235                    {
    2226                         pHlp->pfnPrintf(pHlp, "%02x ", pPciDev->config[iReg++]);
     2236                        pHlp->pfnPrintf(pHlp, "%02x ", ich9pciGetByte(pPciDev, iReg++));
    22272237                    }
    22282238                    pHlp->pfnPrintf(pHlp, "\n");
     
    25212531
    25222532    /* Bridge device reset handlers processed later */
    2523     if (!PCIIsPci2PciBridge(pDev))
     2533    if (!pciDevIsPci2PciBridge(pDev))
    25242534    {
    25252535        PCIDevSetByte(pDev, VBOX_PCI_CACHE_LINE_SIZE, 0x0);
     
    26672677
    26682678    /* Bridge-specific data */
    2669     PCISetPci2PciBridge(&pBus->aPciDev);
     2679    pciDevSetPci2PciBridge(&pBus->aPciDev);
    26702680    pBus->aPciDev.Int.s.pfnBridgeConfigRead  = ich9pcibridgeConfigRead;
    26712681    pBus->aPciDev.Int.s.pfnBridgeConfigWrite = ich9pcibridgeConfigWrite;
  • trunk/src/VBox/Devices/Bus/MsiCommon.cpp

    r35346 r36079  
    105105{
    106106    int32_t iOff = u32Address - pDev->Int.s.u8MsiCapOffset;
    107     Assert(iOff >= 0 && (PCIIsMsiCapable(pDev) && iOff < pDev->Int.s.u8MsiCapSize));
     107    Assert(iOff >= 0 && (pciDevIsMsiCapable(pDev) && iOff < pDev->Int.s.u8MsiCapSize));
    108108
    109109    Log2(("MsiPciConfigWrite: %d <- %x (%d)\n", iOff, val, len));
     
    190190    int32_t iOff = u32Address - pDev->Int.s.u8MsiCapOffset;
    191191
    192     Assert(iOff >= 0 && (PCIIsMsiCapable(pDev) && iOff < pDev->Int.s.u8MsiCapSize));
     192    Assert(iOff >= 0 && (pciDevIsMsiCapable(pDev) && iOff < pDev->Int.s.u8MsiCapSize));
    193193    uint32_t rv = 0;
    194194
     
    255255    *msiGetPendingBits(pDev) = 0;
    256256
    257     PCISetMsiCapable(pDev);
     257    pciDevSetMsiCapable(pDev);
    258258
    259259    return VINF_SUCCESS;
     
    263263bool     MsiIsEnabled(PPCIDEVICE pDev)
    264264{
    265     return PCIIsMsiCapable(pDev) && msiIsEnabled(pDev);
     265    return pciDevIsMsiCapable(pDev) && msiIsEnabled(pDev);
    266266}
    267267
  • trunk/src/VBox/Devices/Bus/MsixCommon.cpp

    r35346 r36079  
    210210    PCIDevSetDWord(pDev,  iCapOffset + VBOX_MSIX_PBA_BIROFFSET,   offPBA   | iBar);
    211211
    212     PCISetMsixCapable(pDev);
     212    pciDevSetMsixCapable(pDev);
    213213
    214214    return VINF_SUCCESS;
     
    218218bool     MsixIsEnabled(PPCIDEVICE pDev)
    219219{
    220     return PCIIsMsixCapable(pDev) && msixIsEnabled(pDev);
     220    return pciDevIsMsixCapable(pDev) && msixIsEnabled(pDev);
    221221}
    222222
     
    267267{
    268268    int32_t iOff = u32Address - pDev->Int.s.u8MsixCapOffset;
    269     Assert(iOff >= 0 && (PCIIsMsixCapable(pDev) && iOff < pDev->Int.s.u8MsixCapSize));
     269    Assert(iOff >= 0 && (pciDevIsMsixCapable(pDev) && iOff < pDev->Int.s.u8MsixCapSize));
    270270
    271271    Log2(("MsixPciConfigWrite: %d <- %x (%d)\n", iOff, val, len));
     
    312312    int32_t iOff = u32Address - pDev->Int.s.u8MsixCapOffset;
    313313
    314     Assert(iOff >= 0 && (PCIIsMsixCapable(pDev) && iOff < pDev->Int.s.u8MsixCapSize));
     314    Assert(iOff >= 0 && (pciDevIsMsixCapable(pDev) && iOff < pDev->Int.s.u8MsixCapSize));
    315315    uint32_t rv = 0;
    316316
  • trunk/src/VBox/Devices/Bus/PCIInternal.h

    r35738 r36079  
    125125    R3PTRTYPE(PFNPCICONFIGWRITE)    pfnConfigWrite;
    126126
    127     /** Flags of this PCI device, see PCIDEV_FLAG_XXX constants.
    128      *  @todo s/uFlags/fFlags/g */
    129     uint32_t                        uFlags;
     127    /** Flags of this PCI device, see PCIDEV_FLAG_XXX constants. */
     128    uint32_t                        fFlags;
    130129    /** Current state of the IRQ pin of the device. */
    131130    int32_t                         uIrqPinState;
  • trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp

    r34851 r36079  
    137137    GEN_CHECK_OFF(PCIDEVICE, Int.s.pfnConfigRead);
    138138    GEN_CHECK_OFF(PCIDEVICE, Int.s.pfnConfigWrite);
    139     GEN_CHECK_OFF(PCIDEVICE, Int.s.uFlags);
     139    GEN_CHECK_OFF(PCIDEVICE, Int.s.fFlags);
    140140    GEN_CHECK_OFF(PCIDEVICE, Int.s.uIrqPinState);
    141141    GEN_CHECK_OFF(PCIDEVICE, Int.s.pfnBridgeConfigRead);
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