Changeset 81035 in vbox
- Timestamp:
- Sep 26, 2019 8:22:35 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 133638
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmpcidevint.h
r81031 r81035 194 194 195 195 /** Pointer to bus specific data. (R3 ptr) */ 196 R3PTRTYPE(const void *) p PciBusPtrR3;196 R3PTRTYPE(const void *) pvPciBusPtrR3; 197 197 /** I/O regions. */ 198 198 PCIIOREGION aIORegions[VBOX_PCI_NUM_REGIONS]; -
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r81034 r81035 151 151 int iIrqPinBridge = ((pPciDev->uDevFn >> 3) + iIrq) & 3; 152 152 uint64_t bmSeen[256/64] = { 0, 0, 0, 0 }; 153 ASMBitSet(bmSeen, RT_MIN(pPciDevBus->Int.s.idxPdmBus, 255));153 ASMBitSet(bmSeen, pPciDevBus->Int.s.idxPdmBus); AssertCompile(sizeof(pPciDevBus->Int.s.idxPdmBus) == 1); 154 154 155 155 /* Walk the chain until we reach the host bus. */ … … 2458 2458 { 2459 2459 uint32_t uValue; 2460 if (uAddress + cb <= 256)2460 if (uAddress + cb <= RT_MIN(pPciDev->cbConfig, sizeof(pPciDev->abConfig))) 2461 2461 { 2462 2462 switch (cb) … … 2491 2491 else 2492 2492 { 2493 if (uAddress + cb < _4K) 2494 LogRel(("PCI: %8s/%u: Read from extended register %d fallen back to generic code\n", 2495 pPciDev->pszNameR3, pPciDev->Int.s.CTX_SUFF(pDevIns)->iInstance, uAddress)); 2496 else 2497 AssertFailed(); 2493 AssertMsgFailed(("Read after end of PCI config space: %#x LB %u\n", uAddress, cb)); 2498 2494 uValue = 0; 2499 2495 } … … 2824 2820 VBOXSTRICTRC rcStrict = VINF_SUCCESS; 2825 2821 2826 if (uAddress + cb <= 256)2822 if (uAddress + cb <= RT_MIN(pPciDev->cbConfig, sizeof(pPciDev->abConfig))) 2827 2823 { 2828 2824 /* … … 2905 2901 break; 2906 2902 } 2907 elseif (uAddress < VBOX_PCI_BASE_ADDRESS_2 || uAddress > VBOX_PCI_BASE_ADDRESS_5+3)2903 if (uAddress < VBOX_PCI_BASE_ADDRESS_2 || uAddress > VBOX_PCI_BASE_ADDRESS_5+3) 2908 2904 { 2909 2905 /* PCI bridges have only BAR0, BAR1 and ROM */ … … 2913 2909 break; 2914 2910 } 2915 elseif ( uAddress == VBOX_PCI_IO_BASE2916 2917 2918 2919 2920 2911 if ( uAddress == VBOX_PCI_IO_BASE 2912 || uAddress == VBOX_PCI_IO_LIMIT 2913 || uAddress == VBOX_PCI_MEMORY_BASE 2914 || uAddress == VBOX_PCI_MEMORY_LIMIT 2915 || uAddress == VBOX_PCI_PREF_MEMORY_BASE 2916 || uAddress == VBOX_PCI_PREF_MEMORY_LIMIT) 2921 2917 { 2922 2918 /* All bridge address decoders have the low 4 bits … … 2948 2944 } 2949 2945 } 2950 else if (uAddress + cb <= _4K)2951 LogRel(("PCI: %8s/%u: Write to extended register %d fallen back to generic code\n",2952 pPciDev->pszNameR3, pPciDev->Int.s.CTX_SUFF(pDevIns)->iInstance, uAddress));2953 2946 else 2954 AssertMsgFailed(("Write after end of PCI config space \n"));2947 AssertMsgFailed(("Write after end of PCI config space: %#x LB %u\n", uAddress, cb)); 2955 2948 2956 2949 return rcStrict; … … 3624 3617 pBus->fPureBridge = true; 3625 3618 pBusCC->pDevInsR3 = pDevIns; 3626 /** @todo r=klaus figure out how to extend this to allow PCIe config space3627 * extension, which increases the config space from 256 bytes to 4K.3628 * bird: What does this allocation have to do with PCIe config space?!? */3629 3619 pBus->papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pBus->apDevices)); 3630 3620 AssertLogRelReturn(pBus->papBridgesR3, VERR_NO_MEMORY); -
trunk/src/VBox/Devices/Bus/MsixCommon.cpp
r81031 r81035 120 120 PDMBOTHCBDECL(int) msixR3MMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb) 121 121 { 122 LogFlowFunc(("\n"));123 124 uint32_t off = (uint32_t)(GCPhysAddr & 0xffff);125 122 PPDMPCIDEV pPciDev = (PPDMPCIDEV)pvUser; 123 uint32_t off = (uint32_t)(GCPhysAddr & 0xffff); 124 LogFlowFunc(("GCPhysAddr=%RGp cb=%d\n", GCPhysAddr, cb)); 126 125 127 126 /// @todo qword accesses? 128 127 RT_NOREF(pDevIns); 129 AssertMsgReturn(cb == 4, 130 ("MSI-X must be accessed with 4-byte reads"), 131 VERR_INTERNAL_ERROR); 132 AssertMsgReturn(off + cb <= pPciDev->Int.s.cbMsixRegion, 133 ("Out of bounds access for the MSI-X region\n"), 134 VINF_IOM_MMIO_UNUSED_FF); 135 136 *(uint32_t *)pv = *(uint32_t *)msixGetPageOffset(pPciDev, off); 128 AssertMsgReturn(cb == 4, ("MSI-X must be accessed with 4-byte reads\n"), VERR_INTERNAL_ERROR); 129 AssertMsgReturn(off + cb <= pPciDev->Int.s.cbMsixRegion, ("Out of bounds access for the MSI-X region\n"), VINF_IOM_MMIO_UNUSED_FF); 130 *(uint32_t *)pv = *(uint32_t *)&pPciDev->abMsixState[off]; 131 137 132 return VINF_SUCCESS; 138 133 } … … 140 135 PDMBOTHCBDECL(int) msixR3MMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void const *pv, unsigned cb) 141 136 { 142 LogFlowFunc(("\n"));143 144 137 PPDMPCIDEV pPciDev = (PPDMPCIDEV)pvUser; 145 uint32_t off = (uint32_t)(GCPhysAddr & 0xffff); 138 uint32_t off = (uint32_t)(GCPhysAddr & 0xffff); 139 LogFlowFunc(("GCPhysAddr=%RGp cb=%d\n", GCPhysAddr, cb)); 146 140 147 141 /// @todo qword accesses? 148 AssertMsgReturn(cb == 4, 149 ("MSI-X must be accessed with 4-byte reads"), 150 VERR_INTERNAL_ERROR); 151 AssertMsgReturn(off + cb <= pPciDev->Int.s.offMsixPba, 152 ("Trying to write to PBA\n"), VINF_SUCCESS); 153 154 *(uint32_t *)msixGetPageOffset(pPciDev, off) = *(uint32_t *)pv; 155 156 msixR3CheckPendingVector(pDevIns, (PCPDMPCIHLP)pPciDev->Int.s.pPciBusPtrR3, pPciDev, off / VBOX_MSIX_ENTRY_SIZE); 142 AssertMsgReturn(cb == 4, ("MSI-X must be accessed with 4-byte reads\n"), VERR_INTERNAL_ERROR); 143 AssertMsgReturn(off + cb <= pPciDev->Int.s.offMsixPba, ("Trying to write to PBA\n"), VINF_SUCCESS); 144 *(uint32_t *)&pPciDev->abMsixState[off] = *(uint32_t *)pv; 145 146 /* (See MsixR3Init the setting up of pvPciBusPtrR3.) */ 147 msixR3CheckPendingVector(pDevIns, (PCPDMPCIHLP)pPciDev->Int.s.pvPciBusPtrR3, pPciDev, off / VBOX_MSIX_ENTRY_SIZE); 157 148 return VINF_SUCCESS; 158 149 } … … 167 158 NOREF(iRegion); NOREF(enmType); 168 159 169 int rc = PDMDevHlpMMIORegister(pDevIns, GCPhysAddress, cb, pPciDev, 170 IOMMMIO_FLAGS_READ_PASSTHRU | IOMMMIO_FLAGS_WRITE_PASSTHRU, 171 msixR3MMIOWrite, msixR3MMIORead, "MSI-X tables"); 172 173 if (RT_FAILURE(rc)) 174 return rc; 175 176 return VINF_SUCCESS; 160 return PDMDevHlpMMIORegister(pDevIns, GCPhysAddress, cb, pPciDev, 161 IOMMMIO_FLAGS_READ_PASSTHRU | IOMMMIO_FLAGS_WRITE_PASSTHRU, 162 msixR3MMIOWrite, msixR3MMIORead, "MSI-X tables"); 177 163 } 178 164 … … 228 214 229 215 /* R3 PCI helper */ 230 pDev->Int.s.p PciBusPtrR3= pPciHlp;216 pDev->Int.s.pvPciBusPtrR3 = pPciHlp; 231 217 232 218 PCIDevSetByte(pDev, iCapOffset + 0, VBOX_PCI_CAP_ID_MSIX);
Note:
See TracChangeset
for help on using the changeset viewer.