Changeset 64414 in vbox
- Timestamp:
- Oct 25, 2016 2:12:19 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 111529
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmpcidevint.h
r64395 r64414 82 82 83 83 /* Forward declaration */ 84 struct PCIBus;84 struct DEVPCIBUS; 85 85 86 86 enum { … … 119 119 PPDMDEVINSR3 pDevInsR3; 120 120 /** Pointer to the next PDM device associate with the PDM device. (R3 ptr) */ 121 R3PTRTYPE(PPDMPCIDEV) pNextR3;121 R3PTRTYPE(PPDMPCIDEV) pNextR3; 122 122 /** Pointer to the internal PDM PCI bus for the device. (R3 ptr) */ 123 123 R3PTRTYPE(struct PDMPCIBUS *) pPdmBusR3; … … 126 126 PPDMDEVINSR0 pDevInsR0; 127 127 /** Pointer to the next PDM device associate with the PDM device. (R0 ptr) */ 128 R0PTRTYPE(PPDMPCIDEV) pNextR0;128 R0PTRTYPE(PPDMPCIDEV) pNextR0; 129 129 /** Pointer to the internal PDM PCI bus for the device. (R0 ptr) */ 130 130 R0PTRTYPE(struct PDMPCIBUS *) pPdmBusR0; … … 133 133 PPDMDEVINSRC pDevInsRC; 134 134 /** Pointer to the next PDM device associate with the PDM device. (RC ptr) */ 135 RCPTRTYPE(PPDMPCIDEV) pNextRC;135 RCPTRTYPE(PPDMPCIDEV) pNextRC; 136 136 /** Pointer to the internal PDM PCI bus for the device. (RC ptr) */ 137 137 RCPTRTYPE(struct PDMPCIBUS *) pPdmBusRC; … … 153 153 */ 154 154 /** Pointer to the PCI bus of the device. (R3 ptr) */ 155 R3PTRTYPE(struct PCIBus *)pBusR3;155 R3PTRTYPE(struct DEVPCIBUS *) pBusR3; 156 156 /** Page used for MSI-X state. (R3 ptr) */ 157 157 R3PTRTYPE(void *) pMsixPageR3; … … 168 168 169 169 /** Pointer to the PCI bus of the device. (R0 ptr) */ 170 R0PTRTYPE(struct PCIBus *)pBusR0;170 R0PTRTYPE(struct DEVPCIBUS *) pBusR0; 171 171 /** Page used for MSI-X state. (R0 ptr) */ 172 172 R0PTRTYPE(void *) pMsixPageR0; 173 173 174 174 /** Pointer to the PCI bus of the device. (RC ptr) */ 175 RCPTRTYPE(struct PCIBus *)pBusRC;175 RCPTRTYPE(struct DEVPCIBUS *) pBusRC; 176 176 /** Page used for MSI-X state. (RC ptr) */ 177 177 RCPTRTYPE(void *) pMsixPageRC; -
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r64393 r64414 2 2 /** @file 3 3 * DevPCI - PCI BUS Device. 4 * 5 * @remarks New code is currently added to DevPciMerge1.cpp.h, the goal is 6 * to end up with a large common code base for the two PCI bus 7 * implementations. The merge file will soon be compiled separately 8 * and not included, so it shall not be used as a template with 9 * \#ifdefs for different PCI bus configs, but rather use config 10 * flags in the structures to select paths & feature sets. 11 * 12 * When moving code, always prefer the ICH9 version, not this! 4 13 */ 5 14 … … 56 65 #include "PciInline.h" 57 66 #include "VBoxDD.h" 67 #include "DevPciInternal.h" 58 68 59 69 … … 61 71 * Structures and Typedefs * 62 72 *********************************************************************************************************************************/ 73 typedef DEVPCIBUS PCIBUS; 74 typedef PDEVPCIBUS PPCIBUS; 75 76 63 77 /** 64 78 * PIIX3 ISA Bridge state. … … 70 84 } PIIX3State, PIIX3, *PPIIX3; 71 85 72 /**73 * PCI Bus instance.74 */75 typedef struct PCIBus76 {77 /** Bus number. */78 int32_t iBus;79 /** Start device number. */80 uint32_t iDevSearch;81 /** Number of bridges attached to the bus. */82 uint32_t cBridges;83 84 uint32_t Alignment0;85 86 union87 {88 /** Array of PCI devices. */89 R3PTRTYPE(PPDMPCIDEV) apDevices[256];90 /** @deprecated */91 R3PTRTYPE(PPDMPCIDEV) devices[256];92 };93 /** Array of bridges attached to the bus. */94 R3PTRTYPE(PPDMPCIDEV *) papBridgesR3;95 96 /** R3 pointer to the device instance. */97 PPDMDEVINSR3 pDevInsR3;98 /** Pointer to the PCI R3 helpers. */99 PCPDMPCIHLPR3 pPciHlpR3;100 101 /** R0 pointer to the device instance. */102 PPDMDEVINSR0 pDevInsR0;103 /** Pointer to the PCI R0 helpers. */104 PCPDMPCIHLPR0 pPciHlpR0;105 106 /** RC pointer to the device instance. */107 PPDMDEVINSRC pDevInsRC;108 /** Pointer to the PCI RC helpers. */109 PCPDMPCIHLPRC pPciHlpRC;110 111 /** The PCI device for the PCI bridge. */112 PDMPCIDEV PciDev;113 114 } PCIBUS;115 /** Pointer to a PCIBUS instance. */116 typedef PCIBUS *PPCIBUS;117 typedef PCIBUS PCIBus;118 119 86 /** @def PCI_IRQ_PINS 120 87 * Number of pins for interrupts (PIRQ#0...PIRQ#3) … … 133 100 { 134 101 /** Irq levels for the four PCI Irqs. 135 * These count how many devices asserted 136 * the IRQ line. If greater 0 an IRQ is sent to the guest. 137 * If it drops to 0 the IRQ is deasserted. 102 * These count how many devices asserted the IRQ line. If greater 0 an IRQ is 103 * sent to the guest. If it drops to 0 the IRQ is deasserted. 138 104 */ 139 105 volatile uint32_t pci_irq_levels[PCI_IRQ_PINS]; 140 106 141 #if 1 /* Will be moved into the BIOS soon. */107 #if 1 /* Will be moved into the BIOS "soon". */ 142 108 /** The next I/O port address which the PCI BIOS will use. */ 143 uint32_t pci_bios_io_addr;109 uint32_t uPciBiosIo; 144 110 /** The next MMIO address which the PCI BIOS will use. */ 145 uint32_t pci_bios_mem_addr;111 uint32_t uPciBiosMmio; 146 112 /** Actual bus number. */ 147 113 uint8_t uBus; 114 uint8_t uAlignment0[2]; 148 115 #endif 149 116 … … 151 118 bool fUseIoApic; 152 119 /** I/O APIC irq levels */ 153 volatile uint32_t pci_apic_irq_levels[PCI_APIC_IRQ_PINS];120 volatile uint32_t uaPciApicIrqLevels[PCI_APIC_IRQ_PINS]; 154 121 /** ACPI IRQ level */ 155 122 uint32_t acpi_irq_level; 156 123 /** ACPI PIC IRQ */ 157 124 int acpi_irq; 158 /** Config register.*/125 /** Value latched in Configuration Address Port (0CF8h) */ 159 126 uint32_t uConfigReg; 160 127 … … 173 140 PIIX3 PIIX3State; 174 141 /** PCI bus which is attached to the host-to-PCI bridge. */ 175 PCIBUSPciBus;142 DEVPCIBUS PciBus; 176 143 177 144 } PCIGLOBALS; … … 188 155 /** Converts a PCI bus device instance pointer to a PCIGLOBALS pointer. */ 189 156 #define DEVINS_2_PCIGLOBALS(pDevIns) ((PPCIGLOBALS)(PDMINS_2_DATA(pDevIns, PPCIGLOBALS))) 190 /** Converts a PCI bus device instance pointer to a PCIBUS pointer. */157 /** Converts a PCI bus device instance pointer to a DEVPCIBUS pointer. */ 191 158 #define DEVINS_2_PCIBUS(pDevIns) ((PPCIBUS)(&PDMINS_2_DATA(pDevIns, PPCIGLOBALS)->PciBus)) 192 159 … … 529 496 else 530 497 { 531 R3PTRTYPE(PDMPCIDEV *) pci_dev = pGlobals->PciBus. devices[iDevice];498 R3PTRTYPE(PDMPCIDEV *) pci_dev = pGlobals->PciBus.apDevices[iDevice]; 532 499 if (pci_dev) 533 500 { … … 576 543 else 577 544 { 578 R3PTRTYPE(PDMPCIDEV *) pci_dev = pGlobals->PciBus. devices[iDevice];545 R3PTRTYPE(PDMPCIDEV *) pci_dev = pGlobals->PciBus.apDevices[iDevice]; 579 546 if (pci_dev) 580 547 { … … 612 579 static inline int get_pci_irq_apic_level(PPCIGLOBALS pGlobals, int irq_num) 613 580 { 614 return (pGlobals-> pci_apic_irq_levels[irq_num] != 0);581 return (pGlobals->uaPciApicIrqLevels[irq_num] != 0); 615 582 } 616 583 … … 626 593 627 594 if ((iLevel & PDM_IRQ_LEVEL_HIGH) == PDM_IRQ_LEVEL_HIGH) 628 ASMAtomicIncU32(&pGlobals-> pci_apic_irq_levels[irq_num]);595 ASMAtomicIncU32(&pGlobals->uaPciApicIrqLevels[irq_num]); 629 596 else if ((iLevel & PDM_IRQ_LEVEL_HIGH) == PDM_IRQ_LEVEL_LOW) 630 ASMAtomicDecU32(&pGlobals-> pci_apic_irq_levels[irq_num]);597 ASMAtomicDecU32(&pGlobals->uaPciApicIrqLevels[irq_num]); 631 598 632 599 apic_irq = irq_num + 0x10; … … 637 604 638 605 if ((iLevel & PDM_IRQ_LEVEL_FLIP_FLOP) == PDM_IRQ_LEVEL_FLIP_FLOP) { 639 ASMAtomicDecU32(&pGlobals-> pci_apic_irq_levels[irq_num]);606 ASMAtomicDecU32(&pGlobals->uaPciApicIrqLevels[irq_num]); 640 607 pPciDev->Int.s.uIrqPinState = PDM_IRQ_LEVEL_LOW; 641 608 apic_level = get_pci_irq_apic_level(pGlobals, irq_num); … … 998 965 * through the bridge but we want to be compliant to the spec. 999 966 */ 1000 if ((pGlobals-> pci_bios_io_addr% 4096) != 0)1001 pGlobals-> pci_bios_io_addr = RT_ALIGN_32(pGlobals->pci_bios_io_addr, 4*1024);1002 Log(("%s: Aligned I/O start address. New address %#x\n", __FUNCTION__, pGlobals-> pci_bios_io_addr));1003 pci_config_writeb(pGlobals, uBus, uDevFn, VBOX_PCI_IO_BASE, (pGlobals-> pci_bios_io_addr>> 8) & 0xf0);967 if ((pGlobals->uPciBiosIo % 4096) != 0) 968 pGlobals->uPciBiosIo = RT_ALIGN_32(pGlobals->uPciBiosIo, 4*1024); 969 Log(("%s: Aligned I/O start address. New address %#x\n", __FUNCTION__, pGlobals->uPciBiosIo)); 970 pci_config_writeb(pGlobals, uBus, uDevFn, VBOX_PCI_IO_BASE, (pGlobals->uPciBiosIo >> 8) & 0xf0); 1004 971 1005 972 /* The MMIO range for the bridge must be aligned to a 1MB boundary. */ 1006 if ((pGlobals-> pci_bios_mem_addr% (1024 * 1024)) != 0)1007 pGlobals-> pci_bios_mem_addr = RT_ALIGN_32(pGlobals->pci_bios_mem_addr, 1024*1024);1008 Log(("%s: Aligned MMIO start address. New address %#x\n", __FUNCTION__, pGlobals-> pci_bios_mem_addr));1009 pci_config_writew(pGlobals, uBus, uDevFn, VBOX_PCI_MEMORY_BASE, (pGlobals-> pci_bios_mem_addr>> 16) & UINT32_C(0xffff0));973 if ((pGlobals->uPciBiosMmio % (1024 * 1024)) != 0) 974 pGlobals->uPciBiosMmio = RT_ALIGN_32(pGlobals->uPciBiosMmio, 1024*1024); 975 Log(("%s: Aligned MMIO start address. New address %#x\n", __FUNCTION__, pGlobals->uPciBiosMmio)); 976 pci_config_writew(pGlobals, uBus, uDevFn, VBOX_PCI_MEMORY_BASE, (pGlobals->uPciBiosMmio >> 16) & UINT32_C(0xffff0)); 1010 977 1011 978 /* Save values to compare later to. */ 1012 uint32_t u32IoAddressBase = pGlobals-> pci_bios_io_addr;1013 uint32_t u32MMIOAddressBase = pGlobals-> pci_bios_mem_addr;979 uint32_t u32IoAddressBase = pGlobals->uPciBiosIo; 980 uint32_t u32MMIOAddressBase = pGlobals->uPciBiosMmio; 1014 981 1015 982 /* Init devices behind the bridge and possibly other bridges as well. */ … … 1026 993 * interface. Again this doesn't really matter here but we want to be compliant to the spec. 1027 994 */ 1028 if ((u32IoAddressBase != pGlobals-> pci_bios_io_addr) && ((pGlobals->pci_bios_io_addr% 4096) != 0))995 if ((u32IoAddressBase != pGlobals->uPciBiosIo) && ((pGlobals->uPciBiosIo % 4096) != 0)) 1029 996 { 1030 997 /* The upper boundary must be one byte less than a 4KB boundary. */ 1031 pGlobals-> pci_bios_io_addr = RT_ALIGN_32(pGlobals->pci_bios_io_addr, 4*1024);998 pGlobals->uPciBiosIo = RT_ALIGN_32(pGlobals->uPciBiosIo, 4*1024); 1032 999 } 1033 pci_config_writeb(pGlobals, uBus, uDevFn, VBOX_PCI_IO_LIMIT, ((pGlobals-> pci_bios_io_addr>> 8) & 0xf0) - 1);1000 pci_config_writeb(pGlobals, uBus, uDevFn, VBOX_PCI_IO_LIMIT, ((pGlobals->uPciBiosIo >> 8) & 0xf0) - 1); 1034 1001 1035 1002 /* Same with the MMIO limit register but with 1MB boundary here. */ 1036 if ((u32MMIOAddressBase != pGlobals-> pci_bios_mem_addr) && ((pGlobals->pci_bios_mem_addr% (1024 * 1024)) != 0))1003 if ((u32MMIOAddressBase != pGlobals->uPciBiosMmio) && ((pGlobals->uPciBiosMmio % (1024 * 1024)) != 0)) 1037 1004 { 1038 1005 /* The upper boundary must be one byte less than a 1MB boundary. */ 1039 pGlobals-> pci_bios_mem_addr = RT_ALIGN_32(pGlobals->pci_bios_mem_addr, 1024*1024);1006 pGlobals->uPciBiosMmio = RT_ALIGN_32(pGlobals->uPciBiosMmio, 1024*1024); 1040 1007 } 1041 pci_config_writew(pGlobals, uBus, uDevFn, VBOX_PCI_MEMORY_LIMIT, ((pGlobals-> pci_bios_mem_addr>> 16) & UINT32_C(0xfff0)) - 1);1008 pci_config_writew(pGlobals, uBus, uDevFn, VBOX_PCI_MEMORY_LIMIT, ((pGlobals->uPciBiosMmio >> 16) & UINT32_C(0xfff0)) - 1); 1042 1009 1043 1010 /* … … 1093 1060 { 1094 1061 if (fIsPio) 1095 paddr = &pGlobals-> pci_bios_io_addr;1062 paddr = &pGlobals->uPciBiosIo; 1096 1063 else 1097 paddr = &pGlobals-> pci_bios_mem_addr;1064 paddr = &pGlobals->uPciBiosMmio; 1098 1065 uint32_t uNew = *paddr; 1099 1066 uNew = (uNew + u32Size - 1) & ~(u32Size - 1); … … 1249 1216 * as a possible file #2 contains external code if there's any left. 1250 1217 */ 1251 typedef PPCIBUS PPCIMERGEDBUS;1252 1218 # define pciR3UnmergedConfigReadDev pci_default_read_config 1253 1219 # define pciR3UnmergedConfigWriteDev pci_default_write_config … … 1269 1235 * Iterate thru all the devices. 1270 1236 */ 1271 for (uint32_t i = 0; i < RT_ELEMENTS(pBus-> devices); i++)1272 { 1273 PPDMPCIDEV pDev = pBus-> devices[i];1237 for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++) 1238 { 1239 PPDMPCIDEV pDev = pBus->apDevices[i]; 1274 1240 if (pDev) 1275 1241 { … … 1306 1272 SSMR3PutU32(pSSM, pThis->pci_irq_levels[i]); 1307 1273 for (i = 0; i < PCI_APIC_IRQ_PINS; i++) 1308 SSMR3PutU32(pSSM, pThis-> pci_apic_irq_levels[i]);1274 SSMR3PutU32(pSSM, pThis->uaPciApicIrqLevels[i]); 1309 1275 1310 1276 SSMR3PutU32(pSSM, pThis->acpi_irq_level); … … 1511 1477 * LogRels in pciR3CommonRestoreConfig. 1512 1478 */ 1513 for (i = 0; i < RT_ELEMENTS(pBus-> devices); i++)1514 { 1515 PPDMPCIDEV pDev = pBus-> devices[i];1479 for (i = 0; i < RT_ELEMENTS(pBus->apDevices); i++) 1480 { 1481 PPDMPCIDEV pDev = pBus->apDevices[i]; 1516 1482 if (pDev) 1517 1483 { … … 1537 1503 if (u32 == (uint32_t)~0) 1538 1504 break; 1539 if ( u32 >= RT_ELEMENTS(pBus-> devices)1505 if ( u32 >= RT_ELEMENTS(pBus->apDevices) 1540 1506 || u32 < i) 1541 1507 { … … 1547 1513 for (; i < u32; i++) 1548 1514 { 1549 if (pBus-> devices[i])1515 if (pBus->apDevices[i]) 1550 1516 { 1551 LogRel(("PCI: New device in slot %#x, %s (vendor=%#06x device=%#06x)\n", i, pBus-> devices[i]->pszNameR3,1552 PCIDevGetVendorId(pBus-> devices[i]), PCIDevGetDeviceId(pBus->devices[i])));1517 LogRel(("PCI: New device in slot %#x, %s (vendor=%#06x device=%#06x)\n", i, pBus->apDevices[i]->pszNameR3, 1518 PCIDevGetVendorId(pBus->apDevices[i]), PCIDevGetDeviceId(pBus->apDevices[i]))); 1553 1519 if (SSMR3HandleGetAfter(pSSM) != SSMAFTER_DEBUG_IT) 1554 1520 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("New device in slot %#x, %s (vendor=%#06x device=%#06x)"), 1555 i, pBus-> devices[i]->pszNameR3, PCIDevGetVendorId(pBus->devices[i]), PCIDevGetDeviceId(pBus->devices[i]));1521 i, pBus->apDevices[i]->pszNameR3, PCIDevGetVendorId(pBus->apDevices[i]), PCIDevGetDeviceId(pBus->apDevices[i])); 1556 1522 } 1557 1523 } … … 1576 1542 1577 1543 /* check that it's still around. */ 1578 pDev = pBus-> devices[i];1544 pDev = pBus->apDevices[i]; 1579 1545 if (!pDev) 1580 1546 { … … 1633 1599 SSMR3GetU32(pSSM, (uint32_t *)&pThis->pci_irq_levels[i]); 1634 1600 for (uint8_t i = 0; i < PCI_APIC_IRQ_PINS; i++) 1635 SSMR3GetU32(pSSM, (uint32_t *)&pThis-> pci_apic_irq_levels[i]);1601 SSMR3GetU32(pSSM, (uint32_t *)&pThis->uaPciApicIrqLevels[i]); 1636 1602 1637 1603 SSMR3GetU32(pSSM, &pThis->acpi_irq_level); … … 1736 1702 * Set the start addresses. 1737 1703 */ 1738 pGlobals-> pci_bios_io_addr= 0xd000;1739 pGlobals-> pci_bios_mem_addr= UINT32_C(0xf0000000);1704 pGlobals->uPciBiosIo = 0xd000; 1705 pGlobals->uPciBiosMmio = UINT32_C(0xf0000000); 1740 1706 pGlobals->uBus = 0; 1741 1707 … … 1814 1780 for (int i = 0; i < PCI_APIC_IRQ_PINS; ++i) 1815 1781 { 1816 pHlp->pfnPrintf(pHlp, " IRQ%02d: %u\n", 0x10 + i, pGlobals-> pci_apic_irq_levels[i]);1782 pHlp->pfnPrintf(pHlp, " IRQ%02d: %u\n", 0x10 + i, pGlobals->uaPciApicIrqLevels[i]); 1817 1783 } 1818 1784 } … … 1841 1807 static void pciR3BusInfo(PPCIBUS pBus, PCDBGFINFOHLP pHlp, int iIndent, bool fRegisters) 1842 1808 { 1843 for (uint32_t iDev = 0; iDev < RT_ELEMENTS(pBus-> devices); iDev++)1844 { 1845 PPDMPCIDEV pPciDev = pBus-> devices[iDev];1809 for (uint32_t iDev = 0; iDev < RT_ELEMENTS(pBus->apDevices); iDev++) 1810 { 1811 PPDMPCIDEV pPciDev = pBus->apDevices[iDev]; 1846 1812 if (pPciDev != NULL) 1847 1813 { … … 1978 1944 1979 1945 /* Relocate RC pointers for the attached pci devices. */ 1980 for (uint32_t i = 0; i < RT_ELEMENTS(pBus-> devices); i++)1981 { 1982 if (pBus-> devices[i])1983 pBus-> devices[i]->Int.s.pBusRC += offDelta;1946 for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++) 1947 { 1948 if (pBus->apDevices[i]) 1949 pBus->apDevices[i]->Int.s.pBusRC += offDelta; 1984 1950 } 1985 1951 } … … 2036 2002 */ 2037 2003 PPCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS); 2038 pGlobals-> pci_bios_io_addr= 0xc000;2039 pGlobals-> pci_bios_mem_addr= 0xf0000000;2004 pGlobals->uPciBiosIo = 0xc000; 2005 pGlobals->uPciBiosMmio = 0xf0000000; 2040 2006 memset((void *)&pGlobals->pci_irq_levels, 0, sizeof(pGlobals->pci_irq_levels)); 2041 2007 pGlobals->fUseIoApic = fUseIoApic; 2042 memset((void *)&pGlobals-> pci_apic_irq_levels, 0, sizeof(pGlobals->pci_apic_irq_levels));2008 memset((void *)&pGlobals->uaPciApicIrqLevels, 0, sizeof(pGlobals->uaPciApicIrqLevels)); 2043 2009 2044 2010 pGlobals->pDevInsR3 = pDevIns; … … 2050 2016 pGlobals->PciBus.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2051 2017 pGlobals->PciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) 2052 * RT_ELEMENTS(pGlobals->PciBus. devices));2018 * RT_ELEMENTS(pGlobals->PciBus.apDevices)); 2053 2019 2054 2020 PDMPCIBUSREG PciBusReg; … … 2268 2234 { 2269 2235 /* This is the target bus, pass the write to the device. */ 2270 PPDMPCIDEV pPciDev = pBus-> devices[iDevice];2236 PPDMPCIDEV pPciDev = pBus->apDevices[iDevice]; 2271 2237 if (pPciDev) 2272 2238 { … … 2301 2267 { 2302 2268 /* This is the target bus, pass the read to the device. */ 2303 PPDMPCIDEV pPciDev = pBus-> devices[iDevice];2269 PPDMPCIDEV pPciDev = pBus->apDevices[iDevice]; 2304 2270 if (pPciDev) 2305 2271 { … … 2358 2324 2359 2325 /* Relocate RC pointers for the attached pci devices. */ 2360 for (uint32_t i = 0; i < RT_ELEMENTS(pBus-> devices); i++)2361 { 2362 if (pBus-> devices[i])2363 pBus-> devices[i]->Int.s.pBusRC += offDelta;2326 for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++) 2327 { 2328 if (pBus->apDevices[i]) 2329 pBus->apDevices[i]->Int.s.pBusRC += offDelta; 2364 2330 } 2365 2331 } … … 2401 2367 pBus->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 2402 2368 pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2403 pBus->papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pBus-> devices));2369 pBus->papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pBus->apDevices)); 2404 2370 2405 2371 PDMPCIBUSREG PciBusReg; … … 2504 2470 ~0U, 2505 2471 /* cbInstance */ 2506 sizeof( PCIBUS),2472 sizeof(DEVPCIBUS), 2507 2473 /* pfnConstruct */ 2508 2474 pcibridgeR3Construct, -
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r64393 r64414 3 3 * DevPCI - ICH9 southbridge PCI bus emulation device. 4 4 * 5 * @note bird: I've cleaned up DevPCI.cpp to some extent, this file has not 6 * be cleaned up and because of pending code merge. 5 * @remarks New code is currently added to DevPciMerge1.cpp.h, the goal is 6 * to end up with a large common code base for the two PCI bus 7 * implementations. The merge file will soon be compiled separately 8 * and not included, so it shall not be used as a template with 9 * \#ifdefs for different PCI bus configs, but rather use config 10 * flags in the structures to select paths & feature sets. 11 * 12 * When moving code, always prefer the ICH9 version (this file)! 7 13 */ 8 14 … … 24 30 *********************************************************************************************************************************/ 25 31 #define LOG_GROUP LOG_GROUP_DEV_PCI 26 #define PCIBus ICH9PCIBus /**< HACK ALERT! Real ugly type hack! */27 32 #define PDMPCIDEV_INCLUDE_PRIVATE /* Hack to get pdmpcidevint.h included at the right point. */ 28 33 #include <VBox/vmm/pdmpcidev.h> … … 41 46 #include "VBoxDD.h" 42 47 #include "MsiCommon.h" 48 #include "DevPciInternal.h" 43 49 44 50 … … 46 52 * Structures and Typedefs * 47 53 *********************************************************************************************************************************/ 48 /** 49 * PCI Bus instance. 50 */ 51 typedef struct ICH9PCIBus 52 { 53 /** Bus number. */ 54 int32_t iBus; 55 /** Number of bridges attached to the bus. */ 56 uint32_t cBridges; 57 58 /** Array of PCI devices. We assume 32 slots, each with 8 functions. */ 59 R3PTRTYPE(PPDMPCIDEV) apDevices[256]; 60 /** Array of bridges attached to the bus. */ 61 R3PTRTYPE(PPDMPCIDEV *) papBridgesR3; 62 63 /** R3 pointer to the device instance. */ 64 PPDMDEVINSR3 pDevInsR3; 65 /** Pointer to the PCI R3 helpers. */ 66 PCPDMPCIHLPR3 pPciHlpR3; 67 68 /** R0 pointer to the device instance. */ 69 PPDMDEVINSR0 pDevInsR0; 70 /** Pointer to the PCI R0 helpers. */ 71 PCPDMPCIHLPR0 pPciHlpR0; 72 73 /** RC pointer to the device instance. */ 74 PPDMDEVINSRC pDevInsRC; 75 /** Pointer to the PCI RC helpers. */ 76 PCPDMPCIHLPRC pPciHlpRC; 77 78 /** The PCI device for the PCI bridge. */ 79 PDMPCIDEV aPciDev; 80 81 /** Start device number - always zero (only for DevPCI source compat). */ 82 uint32_t iDevSearch; 83 /** Size alignemnt padding. */ 84 uint32_t u32Alignment; 85 } ICH9PCIBUS, *PICH9PCIBUS; 54 typedef DEVPCIBUS ICH9PCIBUS; 55 typedef PDEVPCIBUS PICH9PCIBUS; 86 56 87 57 … … 109 79 volatile uint32_t uaPciApicIrqLevels[PCI_APIC_IRQ_PINS]; 110 80 111 #if 1 /* Will be moved into the BIOS soon. */81 #if 1 /* Will be moved into the BIOS "soon". */ 112 82 /** The next I/O port address which the PCI BIOS will use. */ 113 83 uint32_t uPciBiosIo; … … 126 96 127 97 /** PCI bus which is attached to the host-to-PCI bridge. */ 128 ICH9PCIBUS aPciBus;98 DEVPCIBUS PciBus; 129 99 } ICH9PCIGLOBALS, *PICH9PCIGLOBALS; 130 100 … … 159 129 #define DEVINS_2_PCIGLOBALS(pDevIns) ((PICH9PCIGLOBALS)(PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS))) 160 130 /** Converts a device instance pointer to a PCIBUS pointer. */ 161 #define DEVINS_2_PCIBUS(pDevIns) ((PICH9PCIBUS)(&PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS)-> aPciBus))131 #define DEVINS_2_PCIBUS(pDevIns) ((PICH9PCIBUS)(&PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS)->PciBus)) 162 132 /** Converts a pointer to a PCI root bus instance to a PCIGLOBALS pointer. */ 163 #define PCIROOTBUS_2_PCIGLOBALS(pPciBus) ( (PICH9PCIGLOBALS)((uintptr_t)(pPciBus) - RT_OFFSETOF(ICH9PCIGLOBALS, aPciBus)) )133 #define PCIROOTBUS_2_PCIGLOBALS(pPciBus) ( (PICH9PCIGLOBALS)((uintptr_t)(pPciBus) - RT_OFFSETOF(ICH9PCIGLOBALS, PciBus)) ) 164 134 165 135 /** @def PCI_LOCK … … 228 198 do 229 199 { 230 uDevFnBridge = pBus-> aPciDev.uDevFn;200 uDevFnBridge = pBus->PciDev.uDevFn; 231 201 iIrqPinBridge = ((pPciDevBus->uDevFn >> 3) + iIrqPinBridge) & 3; 232 202 233 203 /* Get the parent. */ 234 pBus = pBus-> aPciDev.Int.s.CTX_SUFF(pBus);235 pPciDevBus = &pBus-> aPciDev;204 pBus = pBus->PciDev.Int.s.CTX_SUFF(pBus); 205 pPciDevBus = &pBus->PciDev; 236 206 } while (pBus->iBus != 0); 237 207 … … 327 297 if (pAddr->iBus != 0) /* forward to subordinate bus */ 328 298 { 329 if (pGlobals-> aPciBus.cBridges)299 if (pGlobals->PciBus.cBridges) 330 300 { 331 301 #ifdef IN_RING3 /** @todo do lookup in R0/RC too! */ 332 PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pGlobals-> aPciBus, pAddr->iBus);302 PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pGlobals->PciBus, pAddr->iBus); 333 303 if (pBridgeDevice) 334 304 { … … 344 314 else /* forward to directly connected device */ 345 315 { 346 R3PTRTYPE(PDMPCIDEV *) pPciDev = pGlobals-> aPciBus.apDevices[pAddr->iDeviceFunc];316 R3PTRTYPE(PDMPCIDEV *) pPciDev = pGlobals->PciBus.apDevices[pAddr->iDeviceFunc]; 347 317 if (pPciDev) 348 318 { … … 440 410 if (pPciAddr->iBus != 0) /* forward to subordinate bus */ 441 411 { 442 if (pGlobals-> aPciBus.cBridges)412 if (pGlobals->PciBus.cBridges) 443 413 { 444 414 #ifdef IN_RING3 /** @todo do lookup in R0/RC too! */ 445 PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pGlobals-> aPciBus, pPciAddr->iBus);415 PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pGlobals->PciBus, pPciAddr->iBus); 446 416 if (pBridgeDevice) 447 417 { … … 461 431 else /* forward to directly connected device */ 462 432 { 463 R3PTRTYPE(PDMPCIDEV *) pPciDev = pGlobals-> aPciBus.apDevices[pPciAddr->iDeviceFunc];433 R3PTRTYPE(PDMPCIDEV *) pPciDev = pGlobals->PciBus.apDevices[pPciAddr->iDeviceFunc]; 464 434 if (pPciDev) 465 435 { … … 631 601 Assert(!MsixIsEnabled(pPciDev)); /* Not allowed -- see note above. */ 632 602 LogFlowFunc(("PCI Dev %p : MSI\n", pPciDev)); 633 PPDMDEVINS pDevIns = pGlobals-> aPciBus.CTX_SUFF(pDevIns);634 MsiNotify(pDevIns, pGlobals-> aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);603 PPDMDEVINS pDevIns = pGlobals->PciBus.CTX_SUFF(pDevIns); 604 MsiNotify(pDevIns, pGlobals->PciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc); 635 605 return; 636 606 } … … 639 609 { 640 610 LogFlowFunc(("PCI Dev %p : MSI-X\n", pPciDev)); 641 PPDMDEVINS pDevIns = pGlobals-> aPciBus.CTX_SUFF(pDevIns);642 MsixNotify(pDevIns, pGlobals-> aPciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);611 PPDMDEVINS pDevIns = pGlobals->PciBus.CTX_SUFF(pDevIns); 612 MsixNotify(pDevIns, pGlobals->PciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc); 643 613 return; 644 614 } 645 615 646 PICH9PCIBUS pBus = &pGlobals-> aPciBus;616 PICH9PCIBUS pBus = &pGlobals->PciBus; 647 617 const bool fIsAcpiDevice = PCIDevGetDeviceId(pPciDev) == 0x7113; 648 618 … … 784 754 * as a possible file #2 contains external code if there's any left. 785 755 */ 786 typedef PICH9PCIBUS PPCIMERGEDBUS;787 756 # define pciR3UnmergedConfigReadDev ich9pciConfigReadDev 788 757 # define pciR3UnmergedConfigWriteDev ich9pciConfigWriteDev … … 1121 1090 SSMR3PutU32(pSSM, UINT32_MAX); /* separator */ 1122 1091 1123 return ich9pciR3CommonSaveExec(&pThis-> aPciBus, pSSM);1092 return ich9pciR3CommonSaveExec(&pThis->PciBus, pSSM); 1124 1093 } 1125 1094 … … 1139 1108 1140 1109 /* If the current bus is not the target bus search for the bus which contains the device. */ 1141 if (iBus != PCIDevGetByte(&pBus-> aPciDev, VBOX_PCI_SECONDARY_BUS))1110 if (iBus != PCIDevGetByte(&pBus->PciDev, VBOX_PCI_SECONDARY_BUS)) 1142 1111 { 1143 1112 PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(pBus, iBus); … … 1169 1138 1170 1139 /* If the current bus is not the target bus search for the bus which contains the device. */ 1171 if (iBus != PCIDevGetByte(&pBus-> aPciDev, VBOX_PCI_SECONDARY_BUS))1140 if (iBus != PCIDevGetByte(&pBus->PciDev, VBOX_PCI_SECONDARY_BUS)) 1172 1141 { 1173 1142 PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(pBus, iBus); … … 1516 1485 { 1517 1486 PICH9PCIGLOBALS pThis = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 1518 PICH9PCIBUS pBus = &pThis-> aPciBus;1487 PICH9PCIBUS pBus = &pThis->PciBus; 1519 1488 uint32_t u32; 1520 1489 int rc; … … 1855 1824 { 1856 1825 /* Find bus this device attached to. */ 1857 PICH9PCIBUS pBus = &pGlobals-> aPciBus;1826 PICH9PCIBUS pBus = &pGlobals->PciBus; 1858 1827 while (1) 1859 1828 { … … 1878 1847 { 1879 1848 /* Get the pin the device would assert on the bridge. */ 1880 iPin = ((pBus-> aPciDev.uDevFn >> 3) + iPin) & 3;1881 pBus = pBus-> aPciDev.Int.s.pBusR3;1849 iPin = ((pBus->PciDev.uDevFn >> 3) + iPin) & 3; 1850 pBus = pBus->PciDev.Int.s.pBusR3; 1882 1851 }; 1883 1852 } … … 1902 1871 unsigned uBusSecondary) 1903 1872 { 1904 PPDMPCIDEV pBridgeDev = &pBus-> aPciDev;1873 PPDMPCIDEV pBridgeDev = &pBus->PciDev; 1905 1874 1906 1875 /* Set only if we are not on the root bus, it has no primary bus attached. */ … … 1956 1925 * Assign bridge topology, for further routing to work. 1957 1926 */ 1958 PICH9PCIBUS pBus = &pGlobals-> aPciBus;1927 PICH9PCIBUS pBus = &pGlobals->PciBus; 1959 1928 ich9pciInitBridgeTopology(pGlobals, pBus, 0, 0); 1960 1929 … … 2431 2400 */ 2432 2401 PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 2433 PICH9PCIBUS pBus = &pGlobals-> aPciBus;2402 PICH9PCIBUS pBus = &pGlobals->PciBus; 2434 2403 /* Zero out everything */ 2435 2404 memset(pGlobals, 0, sizeof(*pGlobals)); … … 2451 2420 pGlobals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2452 2421 2453 pGlobals-> aPciBus.pDevInsR3 = pDevIns;2454 pGlobals-> aPciBus.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);2455 pGlobals-> aPciBus.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);2456 pGlobals-> aPciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pGlobals->aPciBus.apDevices));2422 pGlobals->PciBus.pDevInsR3 = pDevIns; 2423 pGlobals->PciBus.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 2424 pGlobals->PciBus.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2425 pGlobals->PciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pGlobals->PciBus.apDevices)); 2457 2426 2458 2427 /* … … 2491 2460 #if 0 2492 2461 /* Host bridge device */ 2493 PCIDevSetVendorId( &pBus-> aPciDev, 0x8086); /* Intel */2494 PCIDevSetDeviceId( &pBus-> aPciDev, 0x29e0); /* Desktop */2495 PCIDevSetRevisionId(&pBus-> aPciDev, 0x01); /* rev. 01 */2496 PCIDevSetClassBase( &pBus-> aPciDev, 0x06); /* bridge */2497 PCIDevSetClassSub( &pBus-> aPciDev, 0x00); /* Host/PCI bridge */2498 PCIDevSetClassProg( &pBus-> aPciDev, 0x00); /* Host/PCI bridge */2499 PCIDevSetHeaderType(&pBus-> aPciDev, 0x00); /* bridge */2500 PCIDevSetWord(&pBus-> aPciDev, VBOX_PCI_SEC_STATUS, 0x0280); /* secondary status */2501 2502 pBus-> aPciDev.pDevIns = pDevIns;2462 PCIDevSetVendorId( &pBus->PciDev, 0x8086); /* Intel */ 2463 PCIDevSetDeviceId( &pBus->PciDev, 0x29e0); /* Desktop */ 2464 PCIDevSetRevisionId(&pBus->PciDev, 0x01); /* rev. 01 */ 2465 PCIDevSetClassBase( &pBus->PciDev, 0x06); /* bridge */ 2466 PCIDevSetClassSub( &pBus->PciDev, 0x00); /* Host/PCI bridge */ 2467 PCIDevSetClassProg( &pBus->PciDev, 0x00); /* Host/PCI bridge */ 2468 PCIDevSetHeaderType(&pBus->PciDev, 0x00); /* bridge */ 2469 PCIDevSetWord(&pBus->PciDev, VBOX_PCI_SEC_STATUS, 0x0280); /* secondary status */ 2470 2471 pBus->PciDev.pDevIns = pDevIns; 2503 2472 /* We register Host<->PCI controller on the bus */ 2504 ich9pciRegisterInternal(pBus, 0, &pBus-> aPciDev, "dram");2473 ich9pciRegisterInternal(pBus, 0, &pBus->PciDev, "dram"); 2505 2474 #endif 2506 2475 … … 2630 2599 { 2631 2600 PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 2632 PICH9PCIBUS pBus = &pGlobals-> aPciBus;2601 PICH9PCIBUS pBus = &pGlobals->PciBus; 2633 2602 2634 2603 /* PCI-specific reset for each device. */ … … 2664 2633 { 2665 2634 PICH9PCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PICH9PCIGLOBALS); 2666 PICH9PCIBUS pBus = &pGlobals-> aPciBus;2635 PICH9PCIBUS pBus = &pGlobals->PciBus; 2667 2636 pGlobals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2668 2637 … … 2744 2713 * Fill in PCI configs and add them to the bus. 2745 2714 */ 2746 PCIDevSetVendorId( &pBus-> aPciDev, 0x8086); /* Intel */2747 PCIDevSetDeviceId( &pBus-> aPciDev, 0x2448); /* 82801 Mobile PCI bridge. */2748 PCIDevSetRevisionId(&pBus-> aPciDev, 0xf2);2749 PCIDevSetClassSub( &pBus-> aPciDev, 0x04); /* pci2pci */2750 PCIDevSetClassBase( &pBus-> aPciDev, 0x06); /* PCI_bridge */2751 PCIDevSetClassProg( &pBus-> aPciDev, 0x01); /* Supports subtractive decoding. */2752 PCIDevSetHeaderType(&pBus-> aPciDev, 0x01); /* Single function device which adheres to the PCI-to-PCI bridge spec. */2753 PCIDevSetCommand( &pBus-> aPciDev, 0x00);2754 PCIDevSetStatus( &pBus-> aPciDev, 0x20); /* 66MHz Capable. */2755 PCIDevSetInterruptLine(&pBus-> aPciDev, 0x00); /* This device does not assert interrupts. */2715 PCIDevSetVendorId( &pBus->PciDev, 0x8086); /* Intel */ 2716 PCIDevSetDeviceId( &pBus->PciDev, 0x2448); /* 82801 Mobile PCI bridge. */ 2717 PCIDevSetRevisionId(&pBus->PciDev, 0xf2); 2718 PCIDevSetClassSub( &pBus->PciDev, 0x04); /* pci2pci */ 2719 PCIDevSetClassBase( &pBus->PciDev, 0x06); /* PCI_bridge */ 2720 PCIDevSetClassProg( &pBus->PciDev, 0x01); /* Supports subtractive decoding. */ 2721 PCIDevSetHeaderType(&pBus->PciDev, 0x01); /* Single function device which adheres to the PCI-to-PCI bridge spec. */ 2722 PCIDevSetCommand( &pBus->PciDev, 0x00); 2723 PCIDevSetStatus( &pBus->PciDev, 0x20); /* 66MHz Capable. */ 2724 PCIDevSetInterruptLine(&pBus->PciDev, 0x00); /* This device does not assert interrupts. */ 2756 2725 2757 2726 /* … … 2759 2728 * devices attached to the bus is unaffected. 2760 2729 */ 2761 PCIDevSetInterruptPin (&pBus-> aPciDev, 0x00);2730 PCIDevSetInterruptPin (&pBus->PciDev, 0x00); 2762 2731 2763 2732 /* 2764 2733 * Register this PCI bridge. The called function will take care on which bus we will get registered. 2765 2734 */ 2766 rc = PDMDevHlpPCIRegisterEx(pDevIns, &pBus-> aPciDev, PDMPCIDEVREG_CFG_PRIMARY, PDMPCIDEVREG_F_PCI_BRIDGE,2735 rc = PDMDevHlpPCIRegisterEx(pDevIns, &pBus->PciDev, PDMPCIDEVREG_CFG_PRIMARY, PDMPCIDEVREG_F_PCI_BRIDGE, 2767 2736 PDMPCIDEVREG_DEV_NO_FIRST_UNUSED, PDMPCIDEVREG_FUN_NO_FIRST_UNUSED, "ich9pcibridge"); 2768 2737 if (RT_FAILURE(rc)) 2769 2738 return rc; 2770 pBus-> aPciDev.Int.s.pfnBridgeConfigRead = ich9pcibridgeConfigRead;2771 pBus-> aPciDev.Int.s.pfnBridgeConfigWrite = ich9pcibridgeConfigWrite;2739 pBus->PciDev.Int.s.pfnBridgeConfigRead = ich9pcibridgeConfigRead; 2740 pBus->PciDev.Int.s.pfnBridgeConfigWrite = ich9pcibridgeConfigWrite; 2772 2741 2773 2742 /* … … 2806 2775 2807 2776 /* Reset config space to default values. */ 2808 PCIDevSetByte(&pBus-> aPciDev, VBOX_PCI_PRIMARY_BUS, 0);2809 PCIDevSetByte(&pBus-> aPciDev, VBOX_PCI_SECONDARY_BUS, 0);2810 PCIDevSetByte(&pBus-> aPciDev, VBOX_PCI_SUBORDINATE_BUS, 0);2777 PCIDevSetByte(&pBus->PciDev, VBOX_PCI_PRIMARY_BUS, 0); 2778 PCIDevSetByte(&pBus->PciDev, VBOX_PCI_SECONDARY_BUS, 0); 2779 PCIDevSetByte(&pBus->PciDev, VBOX_PCI_SUBORDINATE_BUS, 0); 2811 2780 2812 2781 /* PCI-specific reset for each device. */ … … 2910 2879 ~0U, 2911 2880 /* cbInstance */ 2912 sizeof( ICH9PCIBUS),2881 sizeof(DEVPCIBUS), 2913 2882 /* pfnConstruct */ 2914 2883 ich9pcibridgeConstruct, -
trunk/src/VBox/Devices/Bus/DevPciMerge1.cpp.h
r64375 r64414 28 28 * @remarks Caller enters the PDM critical section. 29 29 */ 30 static uint8_t pciR3MergedFindUnusedDeviceNo(P PCIMERGEDBUS pBus)30 static uint8_t pciR3MergedFindUnusedDeviceNo(PDEVPCIBUS pBus) 31 31 { 32 32 for (uint8_t uPciDevNo = pBus->iDevSearch >> VBOX_PCI_DEVFN_DEV_SHIFT; uPciDevNo < VBOX_PCI_MAX_DEVICES; uPciDevNo++) … … 64 64 * @remarks Caller enters the PDM critical section. 65 65 */ 66 static int pciR3MergedRegisterDeviceOnBus(P PCIMERGEDBUS pBus, PPDMPCIDEV pPciDev, uint32_t fFlags,66 static int pciR3MergedRegisterDeviceOnBus(PDEVPCIBUS pBus, PPDMPCIDEV pPciDev, uint32_t fFlags, 67 67 uint8_t uPciDevNo, uint8_t uPciFunNo, const char *pszName, 68 68 PFNPCICONFIGREAD pfnConfigRead, PFNPCICONFIGWRITE pfnConfigWrite) … … 221 221 uint8_t uPciDevNo, uint8_t uPciFunNo, const char *pszName) 222 222 { 223 P PCIMERGEDBUS pBus = DEVINS_2_PCIBUS(pDevIns);223 PDEVPCIBUS pBus = DEVINS_2_PCIBUS(pDevIns); 224 224 return pciR3MergedRegisterDeviceOnBus(pBus, pPciDev, fFlags, uPciDevNo, uPciFunNo, pszName, 225 225 pciR3UnmergedConfigReadDev, pciR3UnmergedConfigWriteDev); … … 233 233 uint8_t uPciDevNo, uint8_t uPciFunNo, const char *pszName) 234 234 { 235 P PCIMERGEDBUS pBus = PDMINS_2_DATA(pDevIns, PPCIMERGEDBUS);235 PDEVPCIBUS pBus = PDMINS_2_DATA(pDevIns, PDEVPCIBUS); 236 236 return pciR3MergedRegisterDeviceOnBus(pBus, pPciDev, fFlags, uPciDevNo, uPciFunNo, pszName, 237 237 pciR3UnmergedConfigReadDev, pciR3UnmergedConfigWriteDev); -
trunk/src/VBox/Devices/testcase/tstDeviceStructSize.cpp
r64387 r64414 361 361 # endif 362 362 #endif 363 CHECK_MEMBER_ALIGNMENT(PCIBUS, devices, 16); 364 CHECK_MEMBER_ALIGNMENT(PCIBUS, devices, 16); 363 CHECK_MEMBER_ALIGNMENT(DEVPCIBUS, apDevices, 64); 365 364 CHECK_MEMBER_ALIGNMENT(PCIGLOBALS, pci_irq_levels, 16); 366 365 CHECK_MEMBER_ALIGNMENT(PCNETSTATE, u64LastPoll, 8); -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r64409 r64414 36 36 #define VBOX_DEVICE_STRUCT_TESTCASE 37 37 #define VBOX_WITH_HGCM /* grumble */ 38 #undef LOG_GROUP 39 #include "../Bus/DevPciInternal.h" 38 40 #undef LOG_GROUP 39 41 #include "../Bus/DevPCI.cpp" /* must be first! */ … … 147 149 GEN_CHECK_OFF(PDMDEVINS, achInstanceData); 148 150 149 /* DevPCI.cpp*/151 /* PDMPCIDEV */ 150 152 GEN_CHECK_SIZE(PDMPCIDEV); 151 153 GEN_CHECK_SIZE(PDMPCIDEVINT); 152 GEN_CHECK_SIZE(PCIIOREGION); 154 GEN_CHECK_SIZE(PCIIOREGION); /** @todo fix name of PCIIOREGION */ 153 155 GEN_CHECK_OFF(PDMPCIDEV, abConfig); 154 156 GEN_CHECK_OFF(PDMPCIDEV, uDevFn); … … 173 175 GEN_CHECK_OFF(PDMPCIDEV, Int.s.pfnBridgeConfigWrite); 174 176 GEN_CHECK_PADDING(PDMPCIDEV, Int, 8); 177 178 /* DevPciInternal.h */ 179 GEN_CHECK_SIZE(DEVPCIBUS); 180 GEN_CHECK_OFF(DEVPCIBUS, iBus); 181 GEN_CHECK_OFF(DEVPCIBUS, iDevSearch); 182 GEN_CHECK_OFF(DEVPCIBUS, cBridges); 183 GEN_CHECK_OFF(DEVPCIBUS, apDevices); 184 GEN_CHECK_OFF(DEVPCIBUS, apDevices[1]); 185 GEN_CHECK_OFF(DEVPCIBUS, pDevInsR3); 186 GEN_CHECK_OFF(DEVPCIBUS, pPciHlpR3); 187 GEN_CHECK_OFF(DEVPCIBUS, papBridgesR3); 188 GEN_CHECK_OFF(DEVPCIBUS, pDevInsR0); 189 GEN_CHECK_OFF(DEVPCIBUS, pPciHlpR0); 190 GEN_CHECK_OFF(DEVPCIBUS, pDevInsRC); 191 GEN_CHECK_OFF(DEVPCIBUS, pPciHlpRC); 192 GEN_CHECK_OFF(DEVPCIBUS, PciDev); 193 194 /* DevPCI.cpp */ 175 195 GEN_CHECK_SIZE(PIIX3State); 176 GEN_CHECK_SIZE(PCIBUS);177 GEN_CHECK_OFF(PCIBUS, iBus);178 GEN_CHECK_OFF(PCIBUS, iDevSearch);179 GEN_CHECK_OFF(PCIBUS, cBridges);180 GEN_CHECK_OFF(PCIBUS, devices);181 GEN_CHECK_OFF(PCIBUS, devices[1]);182 GEN_CHECK_OFF(PCIBUS, pDevInsR3);183 GEN_CHECK_OFF(PCIBUS, pPciHlpR3);184 GEN_CHECK_OFF(PCIBUS, papBridgesR3);185 GEN_CHECK_OFF(PCIBUS, pDevInsR0);186 GEN_CHECK_OFF(PCIBUS, pPciHlpR0);187 GEN_CHECK_OFF(PCIBUS, pDevInsRC);188 GEN_CHECK_OFF(PCIBUS, pPciHlpRC);189 GEN_CHECK_OFF(PCIBUS, PciDev);190 196 GEN_CHECK_SIZE(PCIGLOBALS); 191 GEN_CHECK_OFF(PCIGLOBALS, pci_bios_io_addr);192 GEN_CHECK_OFF(PCIGLOBALS, pci_bios_mem_addr);197 GEN_CHECK_OFF(PCIGLOBALS, uPciBiosIo); 198 GEN_CHECK_OFF(PCIGLOBALS, uPciBiosMmio); 193 199 GEN_CHECK_OFF(PCIGLOBALS, pci_irq_levels); 194 200 GEN_CHECK_OFF(PCIGLOBALS, pci_irq_levels[1]); 195 201 GEN_CHECK_OFF(PCIGLOBALS, fUseIoApic); 196 GEN_CHECK_OFF(PCIGLOBALS, pci_apic_irq_levels);197 GEN_CHECK_OFF(PCIGLOBALS, pci_apic_irq_levels[1]);202 GEN_CHECK_OFF(PCIGLOBALS, uaPciApicIrqLevels); 203 GEN_CHECK_OFF(PCIGLOBALS, uaPciApicIrqLevels[1]); 198 204 GEN_CHECK_OFF(PCIGLOBALS, acpi_irq_level); 199 205 GEN_CHECK_OFF(PCIGLOBALS, acpi_irq); … … 206 212 207 213 /* DevPciIch9.cpp */ 208 GEN_CHECK_SIZE(ICH9PCIBUS);209 GEN_CHECK_OFF(ICH9PCIBUS, iBus);210 GEN_CHECK_OFF(ICH9PCIBUS, cBridges);211 GEN_CHECK_OFF(ICH9PCIBUS, apDevices);212 GEN_CHECK_OFF(ICH9PCIBUS, apDevices[1]);213 GEN_CHECK_OFF(ICH9PCIBUS, pDevInsR3);214 GEN_CHECK_OFF(ICH9PCIBUS, pPciHlpR3);215 GEN_CHECK_OFF(ICH9PCIBUS, papBridgesR3);216 GEN_CHECK_OFF(ICH9PCIBUS, pDevInsR0);217 GEN_CHECK_OFF(ICH9PCIBUS, pPciHlpR0);218 GEN_CHECK_OFF(ICH9PCIBUS, pDevInsRC);219 GEN_CHECK_OFF(ICH9PCIBUS, pPciHlpRC);220 GEN_CHECK_OFF(ICH9PCIBUS, aPciDev);221 214 GEN_CHECK_SIZE(ICH9PCIGLOBALS); 222 215 GEN_CHECK_OFF(ICH9PCIGLOBALS, pDevInsR3); … … 232 225 GEN_CHECK_OFF(ICH9PCIGLOBALS, u64PciConfigMMioAddress); 233 226 GEN_CHECK_OFF(ICH9PCIGLOBALS, u64PciConfigMMioLength); 234 GEN_CHECK_OFF(ICH9PCIGLOBALS, aPciBus);227 GEN_CHECK_OFF(ICH9PCIGLOBALS, PciBus); 235 228 236 229 /* EFI/DevSMC.cpp */
Note:
See TracChangeset
for help on using the changeset viewer.