Changeset 36079 in vbox
- Timestamp:
- Feb 24, 2011 5:10:31 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/pci.h
r35738 r36079 547 547 DECLINLINE(uint8_t) PCIDevGetByte(PPCIDEVICE pPciDev, uint32_t uOffset) 548 548 { 549 #ifdef PCIDEVICEINT_DECLARED 550 Assert((pPciDev->Int.s.fFlags & PCIDEV_FLAG_PASSTHROUGH) == 0); 551 #endif 549 552 return pPciDev->config[uOffset]; 550 553 } … … 557 560 DECLINLINE(uint16_t) PCIDevGetWord(PPCIDEVICE pPciDev, uint32_t uOffset) 558 561 { 562 #ifdef PCIDEVICEINT_DECLARED 563 Assert((pPciDev->Int.s.fFlags & PCIDEV_FLAG_PASSTHROUGH) == 0); 564 #endif 559 565 uint16_t u16Value = *(uint16_t*)&pPciDev->config[uOffset]; 560 566 return RT_H2LE_U16(u16Value); … … 568 574 DECLINLINE(uint32_t) PCIDevGetDWord(PPCIDEVICE pPciDev, uint32_t uOffset) 569 575 { 576 #ifdef PCIDEVICEINT_DECLARED 577 Assert((pPciDev->Int.s.fFlags & PCIDEV_FLAG_PASSTHROUGH) == 0); 578 #endif 570 579 uint32_t u32Value = *(uint32_t*)&pPciDev->config[uOffset]; 571 580 return RT_H2LE_U32(u32Value); … … 579 588 DECLINLINE(uint64_t) PCIDevGetQWord(PPCIDEVICE pPciDev, uint32_t uOffset) 580 589 { 590 #ifdef PCIDEVICEINT_DECLARED 591 Assert((pPciDev->Int.s.fFlags & PCIDEV_FLAG_PASSTHROUGH) == 0); 592 #endif 581 593 uint64_t u64Value = *(uint64_t*)&pPciDev->config[uOffset]; 582 594 return RT_H2LE_U64(u64Value); … … 920 932 921 933 #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; 934 DECLINLINE(void) pciDevSetRequestedDevfunc(PPCIDEVICE pDev) 935 { 936 pDev->Int.s.fFlags |= PCIDEV_FLAG_REQUESTED_DEVFUNC; 937 } 938 939 DECLINLINE(void) pciDevClearRequestedDevfunc(PPCIDEVICE pDev) 940 { 941 pDev->Int.s.fFlags &= ~PCIDEV_FLAG_REQUESTED_DEVFUNC; 942 } 943 944 DECLINLINE(bool) pciDevIsRequestedDevfunc(PPCIDEVICE pDev) 945 { 946 return (pDev->Int.s.fFlags & PCIDEV_FLAG_REQUESTED_DEVFUNC) != 0; 947 } 948 949 DECLINLINE(void) pciDevSetPci2PciBridge(PPCIDEVICE pDev) 950 { 951 pDev->Int.s.fFlags |= PCIDEV_FLAG_PCI_TO_PCI_BRIDGE; 952 } 953 954 DECLINLINE(bool) pciDevIsPci2PciBridge(PPCIDEVICE pDev) 955 { 956 return (pDev->Int.s.fFlags & PCIDEV_FLAG_PCI_TO_PCI_BRIDGE) != 0; 957 } 958 959 DECLINLINE(void) pciDevSetPciExpress(PPCIDEVICE pDev) 960 { 961 pDev->Int.s.fFlags |= PCIDEV_FLAG_PCI_EXPRESS_DEVICE; 962 } 963 964 DECLINLINE(bool) pciDevIsPciExpress(PPCIDEVICE pDev) 965 { 966 return (pDev->Int.s.fFlags & PCIDEV_FLAG_PCI_EXPRESS_DEVICE) != 0; 967 } 968 969 DECLINLINE(void) pciDevSetMsiCapable(PPCIDEVICE pDev) 970 { 971 pDev->Int.s.fFlags |= PCIDEV_FLAG_MSI_CAPABLE; 972 } 973 974 DECLINLINE(void) pciDevClearMsiCapable(PPCIDEVICE pDev) 975 { 976 pDev->Int.s.fFlags &= ~PCIDEV_FLAG_MSI_CAPABLE; 977 } 978 979 DECLINLINE(bool) pciDevIsMsiCapable(PPCIDEVICE pDev) 980 { 981 return (pDev->Int.s.fFlags & PCIDEV_FLAG_MSI_CAPABLE) != 0; 982 } 983 984 DECLINLINE(void) pciDevSetMsixCapable(PPCIDEVICE pDev) 985 { 986 pDev->Int.s.fFlags |= PCIDEV_FLAG_MSIX_CAPABLE; 987 } 988 989 DECLINLINE(void) pciDevClearMsixCapable(PPCIDEVICE pDev) 990 { 991 pDev->Int.s.fFlags &= ~PCIDEV_FLAG_MSIX_CAPABLE; 992 } 993 994 DECLINLINE(bool) pciDevIsMsixCapable(PPCIDEVICE pDev) 995 { 996 return (pDev->Int.s.fFlags & PCIDEV_FLAG_MSIX_CAPABLE) != 0; 997 } 998 999 DECLINLINE(void) pciDevSetPassthrough(PPCIDEVICE pDev) 1000 { 1001 pDev->Int.s.fFlags |= PCIDEV_FLAG_PASSTHROUGH; 1002 } 1003 1004 DECLINLINE(void) pciDevClearPassthrough(PPCIDEVICE pDev) 1005 { 1006 pDev->Int.s.fFlags &= ~PCIDEV_FLAG_PASSTHROUGH; 1007 } 1008 1009 DECLINLINE(bool) pciDevIsPassthrough(PPCIDEVICE pDev) 1010 { 1011 return (pDev->Int.s.fFlags & PCIDEV_FLAG_PASSTHROUGH) != 0; 1006 1012 } 1007 1013 -
trunk/include/VBox/rawpci.h
r36055 r36079 87 87 uint64_t iRegionSize; 88 88 RTR3PTR pvAddressR3; 89 RTR0PTR pvAddressR0; 89 RTR0PTR pvAddressR0; 90 90 } PCIRAWREQUNMAPREGION; 91 91 … … 126 126 { 127 127 /* in */ 128 RT GCPHYSAddress;128 RTR0PTR Address; 129 129 PCIRAWMEMLOC Value; 130 130 } PCIRAWREQMMIOWRITE; … … 134 134 { 135 135 /* in */ 136 RT GCPHYSAddress;136 RTR0PTR Address; 137 137 /* inout (Value.cb is in) */ 138 138 PCIRAWMEMLOC Value; … … 296 296 RTHCPHYS RegionStart, 297 297 uint64_t u64RegionSize, 298 RTR0PTR *pRegionBase ));298 RTR0PTR *pRegionBaseR0)); 299 299 300 300 /** -
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r35753 r36079 773 773 */ 774 774 PPCIDEVICE pBridgeTemp = pBus->papBridgesR3[iBridge]; 775 AssertMsg(pBridgeTemp && PCIIsPci2PciBridge(pBridgeTemp),775 AssertMsg(pBridgeTemp && pciDevIsPci2PciBridge(pBridgeTemp), 776 776 ("Device is not a PCI bridge but on the list of PCI bridges\n")); 777 777 … … 1721 1721 } 1722 1722 } 1723 PCIClearRequestedDevfunc(pPciDev);1723 pciDevClearRequestedDevfunc(pPciDev); 1724 1724 } 1725 1725 else … … 1742 1742 AssertReleaseMsg(!(iDev % 8), ("PCI Configuration Conflict! iDev=%d pszName=%s clashes with %s\n", 1743 1743 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]))) 1752 1752 { 1753 1753 AssertReleaseMsgFailed(("Configuration error:'%s' and '%s' are both configured as device %d\n", … … 1786 1786 } 1787 1787 } /* if conflict */ 1788 PCISetRequestedDevfunc(pPciDev);1788 pciDevSetRequestedDevfunc(pPciDev); 1789 1789 } 1790 1790 … … 1798 1798 pPciDev->Int.s.pfnConfigWrite = pci_default_write_config; 1799 1799 pBus->devices[iDev] = pPciDev; 1800 if ( PCIIsPci2PciBridge(pPciDev))1800 if (pciDevIsPci2PciBridge(pPciDev)) 1801 1801 { 1802 1802 AssertMsg(pBus->cBridges < RT_ELEMENTS(pBus->devices), ("Number of bridges exceeds the number of possible devices on the bus\n")); … … 2111 2111 2112 2112 pBus->PciDev.pDevIns = pDevIns; 2113 PCISetRequestedDevfunc(&pBus->PciDev);2113 pciDevSetRequestedDevfunc(&pBus->PciDev); 2114 2114 pciRegisterInternal(pBus, 0, &pBus->PciDev, "i440FX"); 2115 2115 … … 2122 2122 2123 2123 pGlobals->PIIX3State.dev.pDevIns = pDevIns; 2124 PCISetRequestedDevfunc(&pGlobals->PIIX3State.dev);2124 pciDevSetRequestedDevfunc(&pGlobals->PIIX3State.dev); 2125 2125 pciRegisterInternal(pBus, 8, &pGlobals->PIIX3State.dev, "PIIX3"); 2126 2126 piix3_reset(&pGlobals->PIIX3State); … … 2496 2496 2497 2497 /* Bridge-specific data */ 2498 PCISetPci2PciBridge(&pBus->PciDev);2498 pciDevSetPci2PciBridge(&pBus->PciDev); 2499 2499 pBus->PciDev.Int.s.pfnBridgeConfigRead = pcibridgeConfigRead; 2500 2500 pBus->PciDev.Int.s.pfnBridgeConfigWrite = pcibridgeConfigWrite; -
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r35753 r36079 698 698 */ 699 699 PPCIDEVICE pBridgeTemp = pBus->papBridgesR3[iBridge]; 700 AssertMsg(pBridgeTemp && PCIIsPci2PciBridge(pBridgeTemp),700 AssertMsg(pBridgeTemp && pciDevIsPci2PciBridge(pBridgeTemp), 701 701 ("Device is not a PCI bridge but on the list of PCI bridges\n")); 702 702 … … 949 949 static DECLCALLBACK(int) ich9pciGenericSaveExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM) 950 950 { 951 Assert(! PCIIsPassthrough(pPciDev));951 Assert(!pciDevIsPassthrough(pPciDev)); 952 952 return SSMR3PutMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config)); 953 953 } … … 969 969 970 970 /* Device flags */ 971 int rc = SSMR3PutU32(pSSM, pDev->Int.s. uFlags);971 int rc = SSMR3PutU32(pSSM, pDev->Int.s.fFlags); 972 972 if (RT_FAILURE(rc)) 973 973 return rc; … … 1202 1202 */ 1203 1203 uint8_t const fBridge = fIsBridge ? 2 : 1; 1204 Assert(! PCIIsPassthrough(pDev));1204 Assert(!pciDevIsPassthrough(pDev)); 1205 1205 uint8_t *pbDstConfig = &pDev->config[0]; 1206 1206 … … 1339 1339 1340 1340 /* get the data */ 1341 DevTmp.Int.s. uFlags = 0;1341 DevTmp.Int.s.fFlags = 0; 1342 1342 DevTmp.Int.s.u8MsiCapOffset = 0; 1343 1343 DevTmp.Int.s.u8MsiCapSize = 0; … … 1347 1347 SSMR3GetMem(pSSM, DevTmp.config, sizeof(DevTmp.config)); 1348 1348 1349 rc = SSMR3GetU32(pSSM, &DevTmp.Int.s. uFlags);1349 rc = SSMR3GetU32(pSSM, &DevTmp.Int.s.fFlags); 1350 1350 if (RT_FAILURE(rc)) 1351 1351 goto out; … … 1398 1398 1399 1399 /* commit the loaded device config. */ 1400 Assert(! PCIIsPassthrough(pDev));1400 Assert(!pciDevIsPassthrough(pDev)); 1401 1401 pciR3CommonRestoreConfig(pDev, &DevTmp.config[0], false ); /** @todo fix bridge fun! */ 1402 1402 … … 1430 1430 static DECLCALLBACK(int) ich9pciGenericLoadExec(PPDMDEVINS pDevIns, PPCIDEVICE pPciDev, PSSMHANDLE pSSM) 1431 1431 { 1432 Assert(! PCIIsPassthrough(pPciDev));1432 Assert(!pciDevIsPassthrough(pPciDev)); 1433 1433 return SSMR3GetMem(pSSM, &pPciDev->config[0], sizeof(pPciDev->config)); 1434 1434 } … … 1758 1758 AssertMsgReturn(u32Address + len <= 256, ("Read after end of PCI config space\n"), 1759 1759 0); 1760 if ( PCIIsMsiCapable(aDev)1760 if ( pciDevIsMsiCapable(aDev) 1761 1761 && (u32Address >= aDev->Int.s.u8MsiCapOffset) 1762 1762 && (u32Address < aDev->Int.s.u8MsiCapOffset + aDev->Int.s.u8MsiCapSize) … … 1766 1766 } 1767 1767 1768 if ( PCIIsMsixCapable(aDev)1768 if ( pciDevIsMsixCapable(aDev) 1769 1769 && (u32Address >= aDev->Int.s.u8MsixCapOffset) 1770 1770 && (u32Address < aDev->Int.s.u8MsixCapOffset + aDev->Int.s.u8MsixCapSize) … … 1839 1839 AssertMsgReturnVoid(u32Address + len <= 256, ("Write after end of PCI config space\n")); 1840 1840 1841 if ( PCIIsMsiCapable(aDev)1841 if ( pciDevIsMsiCapable(aDev) 1842 1842 && (u32Address >= aDev->Int.s.u8MsiCapOffset) 1843 1843 && (u32Address < aDev->Int.s.u8MsiCapOffset + aDev->Int.s.u8MsiCapSize) … … 1850 1850 } 1851 1851 1852 if ( PCIIsMsixCapable(aDev)1852 if ( pciDevIsMsixCapable(aDev) 1853 1853 && (u32Address >= aDev->Int.s.u8MsixCapOffset) 1854 1854 && (u32Address < aDev->Int.s.u8MsixCapOffset + aDev->Int.s.u8MsixCapSize) … … 2006 2006 if (!strcmp(pszName, PciSlotAssignments[i].pszName)) 2007 2007 { 2008 PCISetRequestedDevfunc(pPciDev);2008 pciDevSetRequestedDevfunc(pPciDev); 2009 2009 aPosition->iDeviceFunc = 2010 2010 (PciSlotAssignments[i].iSlot << 3) + PciSlotAssignments[i].iFunction; … … 2031 2031 && !pBus->apDevices[iPos + 7]) 2032 2032 { 2033 PCIClearRequestedDevfunc(pPciDev);2033 pciDevClearRequestedDevfunc(pPciDev); 2034 2034 aPosition->iDeviceFunc = iPos; 2035 2035 return true; … … 2044 2044 PCIDevice** aSlot = &pBus->apDevices[iSlot << 3]; 2045 2045 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])) 2054 2054 ; 2055 2055 } … … 2078 2078 * its current habitant, if it wasn't hard assigned too. 2079 2079 */ 2080 if ( PCIIsRequestedDevfunc(pPciDev) &&2080 if (pciDevIsRequestedDevfunc(pPciDev) && 2081 2081 pBus->apDevices[iDev] && 2082 PCIIsRequestedDevfunc(pBus->apDevices[iDev]))2082 pciDevIsRequestedDevfunc(pBus->apDevices[iDev])) 2083 2083 { 2084 2084 AssertReleaseMsgFailed(("Configuration error:'%s' and '%s' are both configured as device %d\n", … … 2123 2123 pPciDev->Int.s.pfnConfigWrite = ich9pciConfigWriteDev; 2124 2124 pBus->apDevices[iDev] = pPciDev; 2125 if ( PCIIsPci2PciBridge(pPciDev))2125 if (pciDevIsPci2PciBridge(pPciDev)) 2126 2126 { 2127 2127 AssertMsg(pBus->cBridges < RT_ELEMENTS(pBus->apDevices), ("Number of bridges exceeds the number of possible devices on the bus\n")); … … 2132 2132 } 2133 2133 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)); 2136 2136 2137 2137 return VINF_SUCCESS; … … 2144 2144 pHlp->pfnPrintf(pHlp, " "); 2145 2145 } 2146 } 2147 static uint32_t ich9pciGetCfg(PCIDevice* aDev, int32_t iRegister, int cb) 2148 { 2149 return aDev->Int.s.pfnConfigRead(aDev, iRegister, cb); 2150 } 2151 2152 static uint8_t ich9pciGetByte(PCIDevice* aDev, int32_t iRegister) 2153 { 2154 return (uint8_t)ich9pciGetCfg(aDev, iRegister, 1); 2155 } 2156 2157 static uint16_t ich9pciGetWord(PCIDevice* aDev, int32_t iRegister) 2158 { 2159 return (uint16_t)ich9pciGetCfg(aDev, iRegister, 2); 2160 } 2161 2162 static uint32_t ich9pciGetDWord(PCIDevice* aDev, int32_t iRegister) 2163 { 2164 return (uint32_t)ich9pciGetCfg(aDev, iRegister, 4); 2146 2165 } 2147 2166 … … 2153 2172 if (pPciDev != NULL) 2154 2173 { 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 }2170 2174 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", 2172 2181 pBus->iBus, (iDev >> 3) & 0xff, iDev & 0x7, 2173 2182 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" : "" 2177 2187 ); 2178 if ( PCIDevGetInterruptPin(pPciDev) != 0)2188 if (!pciDevIsPassthrough(pPciDev) && PCIDevGetInterruptPin(pPciDev) != 0) 2179 2189 pHlp->pfnPrintf(pHlp, " IRQ%d", PCIDevGetInterruptLine(pPciDev)); 2180 2190 2181 2191 pHlp->pfnPrintf(pHlp, "\n"); 2182 2192 2183 int iCmd = PCIDevGetCommand(pPciDev);2193 int iCmd = ich9pciGetWord(pPciDev, VBOX_PCI_COMMAND); 2184 2194 if ((iCmd & (VBOX_PCI_COMMAND_IO | VBOX_PCI_COMMAND_MEMORY)) != 0) 2185 2195 { … … 2192 2202 continue; 2193 2203 2194 uint32_t u32Addr = ich9pci ConfigReadDev(pPciDev, ich9pciGetRegionReg(iRegion), 4);2204 uint32_t u32Addr = ich9pciGetDWord(pPciDev, ich9pciGetRegionReg(iRegion)); 2195 2205 const char * szDesc; 2196 2206 … … 2224 2234 while (iPerLine-- > 0) 2225 2235 { 2226 pHlp->pfnPrintf(pHlp, "%02x ", pPciDev->config[iReg++]);2236 pHlp->pfnPrintf(pHlp, "%02x ", ich9pciGetByte(pPciDev, iReg++)); 2227 2237 } 2228 2238 pHlp->pfnPrintf(pHlp, "\n"); … … 2521 2531 2522 2532 /* Bridge device reset handlers processed later */ 2523 if (! PCIIsPci2PciBridge(pDev))2533 if (!pciDevIsPci2PciBridge(pDev)) 2524 2534 { 2525 2535 PCIDevSetByte(pDev, VBOX_PCI_CACHE_LINE_SIZE, 0x0); … … 2667 2677 2668 2678 /* Bridge-specific data */ 2669 PCISetPci2PciBridge(&pBus->aPciDev);2679 pciDevSetPci2PciBridge(&pBus->aPciDev); 2670 2680 pBus->aPciDev.Int.s.pfnBridgeConfigRead = ich9pcibridgeConfigRead; 2671 2681 pBus->aPciDev.Int.s.pfnBridgeConfigWrite = ich9pcibridgeConfigWrite; -
trunk/src/VBox/Devices/Bus/MsiCommon.cpp
r35346 r36079 105 105 { 106 106 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)); 108 108 109 109 Log2(("MsiPciConfigWrite: %d <- %x (%d)\n", iOff, val, len)); … … 190 190 int32_t iOff = u32Address - pDev->Int.s.u8MsiCapOffset; 191 191 192 Assert(iOff >= 0 && ( PCIIsMsiCapable(pDev) && iOff < pDev->Int.s.u8MsiCapSize));192 Assert(iOff >= 0 && (pciDevIsMsiCapable(pDev) && iOff < pDev->Int.s.u8MsiCapSize)); 193 193 uint32_t rv = 0; 194 194 … … 255 255 *msiGetPendingBits(pDev) = 0; 256 256 257 PCISetMsiCapable(pDev);257 pciDevSetMsiCapable(pDev); 258 258 259 259 return VINF_SUCCESS; … … 263 263 bool MsiIsEnabled(PPCIDEVICE pDev) 264 264 { 265 return PCIIsMsiCapable(pDev) && msiIsEnabled(pDev);265 return pciDevIsMsiCapable(pDev) && msiIsEnabled(pDev); 266 266 } 267 267 -
trunk/src/VBox/Devices/Bus/MsixCommon.cpp
r35346 r36079 210 210 PCIDevSetDWord(pDev, iCapOffset + VBOX_MSIX_PBA_BIROFFSET, offPBA | iBar); 211 211 212 PCISetMsixCapable(pDev);212 pciDevSetMsixCapable(pDev); 213 213 214 214 return VINF_SUCCESS; … … 218 218 bool MsixIsEnabled(PPCIDEVICE pDev) 219 219 { 220 return PCIIsMsixCapable(pDev) && msixIsEnabled(pDev);220 return pciDevIsMsixCapable(pDev) && msixIsEnabled(pDev); 221 221 } 222 222 … … 267 267 { 268 268 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)); 270 270 271 271 Log2(("MsixPciConfigWrite: %d <- %x (%d)\n", iOff, val, len)); … … 312 312 int32_t iOff = u32Address - pDev->Int.s.u8MsixCapOffset; 313 313 314 Assert(iOff >= 0 && ( PCIIsMsixCapable(pDev) && iOff < pDev->Int.s.u8MsixCapSize));314 Assert(iOff >= 0 && (pciDevIsMsixCapable(pDev) && iOff < pDev->Int.s.u8MsixCapSize)); 315 315 uint32_t rv = 0; 316 316 -
trunk/src/VBox/Devices/Bus/PCIInternal.h
r35738 r36079 125 125 R3PTRTYPE(PFNPCICONFIGWRITE) pfnConfigWrite; 126 126 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; 130 129 /** Current state of the IRQ pin of the device. */ 131 130 int32_t uIrqPinState; -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r34851 r36079 137 137 GEN_CHECK_OFF(PCIDEVICE, Int.s.pfnConfigRead); 138 138 GEN_CHECK_OFF(PCIDEVICE, Int.s.pfnConfigWrite); 139 GEN_CHECK_OFF(PCIDEVICE, Int.s. uFlags);139 GEN_CHECK_OFF(PCIDEVICE, Int.s.fFlags); 140 140 GEN_CHECK_OFF(PCIDEVICE, Int.s.uIrqPinState); 141 141 GEN_CHECK_OFF(PCIDEVICE, Int.s.pfnBridgeConfigRead);
Note:
See TracChangeset
for help on using the changeset viewer.