Changeset 36079 in vbox for trunk/src/VBox/Devices/Bus
- Timestamp:
- Feb 24, 2011 5:10:31 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 70201
- Location:
- trunk/src/VBox/Devices/Bus
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.