Changeset 41697 in vbox
- Timestamp:
- Jun 14, 2012 9:44:06 AM (13 years ago)
- Location:
- trunk/src/VBox/Devices/Bus
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r40907 r41697 2000 2000 } 2001 2001 2002 static void printIndent(PCDBGFINFOHLP pHlp, int iIndent) 2003 { 2004 for (int i = 0; i < iIndent; i++) 2005 { 2006 pHlp->pfnPrintf(pHlp, " "); 2007 } 2008 } 2009 2010 static void pciBusInfo(PPCIBUS pBus, PCDBGFINFOHLP pHlp, int iIndent, bool fRegisters) 2011 { 2012 for (uint32_t iDev = 0; iDev < RT_ELEMENTS(pBus->devices); iDev++) 2013 { 2014 PPCIDEVICE pPciDev = pBus->devices[iDev]; 2015 if (pPciDev != NULL) 2016 { 2017 printIndent(pHlp, iIndent); 2018 2019 /* 2020 * For passthrough devices MSI/MSI-X mostly reflects the way interrupts delivered to the guest, 2021 * as host driver handles real devices interrupts. 2022 */ 2023 pHlp->pfnPrintf(pHlp, "%02x:%02x:%02x %s%s: %04x-%04x%s%s", 2024 pBus->iBus, (iDev >> 3) & 0xff, iDev & 0x7, 2025 pPciDev->name, 2026 pciDevIsPassthrough(pPciDev) ? " (PASSTHROUGH)" : "", 2027 PCIDevGetWord(pPciDev, VBOX_PCI_VENDOR_ID), PCIDevGetWord(pPciDev, VBOX_PCI_DEVICE_ID), 2028 pciDevIsMsiCapable(pPciDev) ? " MSI" : "", 2029 pciDevIsMsixCapable(pPciDev) ? " MSI-X" : "" 2030 ); 2031 if (PCIDevGetByte(pPciDev, VBOX_PCI_INTERRUPT_PIN) != 0) 2032 pHlp->pfnPrintf(pHlp, " IRQ%d", PCIDevGetByte(pPciDev, VBOX_PCI_INTERRUPT_LINE)); 2033 2034 pHlp->pfnPrintf(pHlp, "\n"); 2035 2036 uint16_t iCmd = PCIDevGetWord(pPciDev, VBOX_PCI_COMMAND); 2037 if ((iCmd & (VBOX_PCI_COMMAND_IO | VBOX_PCI_COMMAND_MEMORY)) != 0) 2038 { 2039 for (int iRegion = 0; iRegion < PCI_NUM_REGIONS; iRegion++) 2040 { 2041 PCIIORegion* pRegion = &pPciDev->Int.s.aIORegions[iRegion]; 2042 uint64_t iRegionSize = pRegion->size; 2043 2044 if (iRegionSize == 0) 2045 continue; 2046 2047 uint32_t u32Addr = PCIDevGetDWord(pPciDev, PCIDevGetRegionReg(iRegion)); 2048 const char * pszDesc; 2049 char szDescBuf[128]; 2050 2051 bool f64Bit = !!(pRegion->type & PCI_ADDRESS_SPACE_BAR64); 2052 if (pRegion->type & PCI_ADDRESS_SPACE_IO) 2053 { 2054 pszDesc = "IO"; 2055 u32Addr &= ~0x3; 2056 } 2057 else 2058 { 2059 RTStrPrintf(szDescBuf, sizeof(szDescBuf), "MMIO%s%s", 2060 f64Bit ? "64" : "32", 2061 (pRegion->type & PCI_ADDRESS_SPACE_MEM_PREFETCH) ? " PREFETCH" : ""); 2062 pszDesc = szDescBuf; 2063 u32Addr &= ~0xf; 2064 } 2065 2066 printIndent(pHlp, iIndent + 2); 2067 pHlp->pfnPrintf(pHlp, "%s region #%d: %x..%x\n", 2068 pszDesc, iRegion, u32Addr, u32Addr+iRegionSize); 2069 if (f64Bit) 2070 iRegion++; 2071 } 2072 } 2073 2074 printIndent(pHlp, iIndent + 2); 2075 uint16_t iStatus = PCIDevGetWord(pPciDev, VBOX_PCI_STATUS); 2076 pHlp->pfnPrintf(pHlp, "Command: %.*Rhxs, Status: %.*Rhxs\n", 2077 sizeof(uint16_t), &iCmd, sizeof(uint16_t), &iStatus); 2078 printIndent(pHlp, iIndent + 2); 2079 pHlp->pfnPrintf(pHlp, "Bus master: %s\n", 2080 iCmd & VBOX_PCI_COMMAND_MASTER ? "Yes" : "No"); 2081 2082 if (fRegisters) 2083 { 2084 printIndent(pHlp, iIndent + 2); 2085 pHlp->pfnPrintf(pHlp, "PCI registers:\n"); 2086 for (int iReg = 0; iReg < 0x100; ) 2087 { 2088 int iPerLine = 0x10; 2089 Assert (0x100 % iPerLine == 0); 2090 printIndent(pHlp, iIndent + 3); 2091 2092 while (iPerLine-- > 0) 2093 { 2094 pHlp->pfnPrintf(pHlp, "%02x ", PCIDevGetByte(pPciDev, iReg++)); 2095 } 2096 pHlp->pfnPrintf(pHlp, "\n"); 2097 } 2098 } 2099 } 2100 } 2101 2102 if (pBus->cBridges > 0) 2103 { 2104 printIndent(pHlp, iIndent); 2105 pHlp->pfnPrintf(pHlp, "Registered %d bridges, subordinate buses info follows\n", pBus->cBridges); 2106 for (uint32_t iBridge = 0; iBridge < pBus->cBridges; iBridge++) 2107 { 2108 PPCIBUS pBusSub = PDMINS_2_DATA(pBus->papBridgesR3[iBridge]->pDevIns, PPCIBUS); 2109 pciBusInfo(pBusSub, pHlp, iIndent + 1, fRegisters); 2110 } 2111 } 2112 } 2113 2114 /** 2115 * Info handler, device version. 2116 * 2117 * @param pDevIns Device instance which registered the info. 2118 * @param pHlp Callback functions for doing output. 2119 * @param pszArgs Argument string. Optional and specific to the handler. 2120 */ 2121 static DECLCALLBACK(void) pciInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 2122 { 2123 PPCIBUS pBus = DEVINS_2_PCIBUS(pDevIns); 2124 2125 if (pszArgs == NULL || !strcmp(pszArgs, "basic")) 2126 { 2127 pciBusInfo(pBus, pHlp, 0, false); 2128 } 2129 else if (!strcmp(pszArgs, "verbose")) 2130 { 2131 pciBusInfo(pBus, pHlp, 0, true); 2132 } 2133 else 2134 { 2135 pHlp->pfnPrintf(pHlp, "Invalid argument. Recognized arguments are 'basic', 'verbose'.\n"); 2136 } 2137 } 2138 2002 2139 /** 2003 2140 * @copydoc FNPDMDEVRELOCATE … … 2176 2313 if (RT_FAILURE(rc)) 2177 2314 return rc; 2315 2316 PDMDevHlpDBGFInfoRegister(pDevIns, "pci", "Display PCI bus status. Recognizes 'basic' or 'verbose' " 2317 "as arguments, defaults to 'basic'.", pciInfo); 2178 2318 2179 2319 PDMDevHlpDBGFInfoRegister(pDevIns, "pciirq", "Display PCI IRQ routing state. (no arguments)", pciIrqInfo); -
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r40907 r41697 2270 2270 pHlp->pfnPrintf(pHlp, "\n"); 2271 2271 2272 int iCmd = ich9pciGetWord(pPciDev, VBOX_PCI_COMMAND);2272 uint16_t iCmd = ich9pciGetWord(pPciDev, VBOX_PCI_COMMAND); 2273 2273 if ((iCmd & (VBOX_PCI_COMMAND_IO | VBOX_PCI_COMMAND_MEMORY)) != 0) 2274 2274 { … … 2276 2276 { 2277 2277 PCIIORegion* pRegion = &pPciDev->Int.s.aIORegions[iRegion]; 2278 int32_t iRegionSize = pRegion->size;2278 uint64_t iRegionSize = pRegion->size; 2279 2279 2280 2280 if (iRegionSize == 0) … … 2301 2301 2302 2302 printIndent(pHlp, iIndent + 2); 2303 pHlp->pfnPrintf(pHlp, " 2303 pHlp->pfnPrintf(pHlp, "%s region #%d: %x..%x\n", 2304 2304 pszDesc, iRegion, u32Addr, u32Addr+iRegionSize); 2305 2305 if (f64Bit) … … 2308 2308 } 2309 2309 2310 printIndent(pHlp, iIndent + 2); 2311 uint16_t iStatus = ich9pciGetWord(pPciDev, VBOX_PCI_STATUS); 2312 pHlp->pfnPrintf(pHlp, "Command: %.*Rhxs, Status: %.*Rhxs\n", 2313 sizeof(uint16_t), &iCmd, sizeof(uint16_t), &iStatus); 2314 printIndent(pHlp, iIndent + 2); 2315 pHlp->pfnPrintf(pHlp, "Bus master: %s\n", 2316 iCmd & VBOX_PCI_COMMAND_MASTER ? "Yes" : "No"); 2317 2310 2318 if (fRegisters) 2311 2319 { 2312 2320 printIndent(pHlp, iIndent + 2); 2313 pHlp->pfnPrintf(pHlp, " 2321 pHlp->pfnPrintf(pHlp, "PCI registers:\n"); 2314 2322 for (int iReg = 0; iReg < 0x100; ) 2315 2323 {
Note:
See TracChangeset
for help on using the changeset viewer.