- Timestamp:
- Oct 25, 2016 3:01:40 PM (8 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r64414 r64415 99 99 typedef struct PCIGLOBALS 100 100 { 101 /** PCI bus which is attached to the host-to-PCI bridge. 102 * This must come first! */ 103 DEVPCIBUS PciBus; 104 105 /** R3 pointer to the device instance. */ 106 PPDMDEVINSR3 pDevInsR3; 107 /** R0 pointer to the device instance. */ 108 PPDMDEVINSR0 pDevInsR0; 109 /** RC pointer to the device instance. */ 110 PPDMDEVINSRC pDevInsRC; 111 112 /** I/O APIC usage flag */ 113 bool fUseIoApic; 114 /** Reserved for future config flags. */ 115 bool afFutureFlags[3]; 116 117 /** Value latched in Configuration Address Port (0CF8h) */ 118 uint32_t uConfigReg; 119 /** ACPI IRQ level */ 120 uint32_t acpi_irq_level; 121 /** ACPI PIC IRQ */ 122 int acpi_irq; 123 uint32_t u32Alignment; 124 125 /** I/O APIC irq levels */ 126 volatile uint32_t uaPciApicIrqLevels[PCI_APIC_IRQ_PINS]; 127 101 128 /** Irq levels for the four PCI Irqs. 102 * These count how many devices asserted the IRQ line. If greater 0 an IRQ is103 * sent to the guest. If it drops to 0 the IRQ is deasserted.129 * These count how many devices asserted the IRQ line. If greater 0 an IRQ 130 * is sent to the guest. If it drops to 0 the IRQ is deasserted. 104 131 */ 105 132 volatile uint32_t pci_irq_levels[PCI_IRQ_PINS]; 133 134 /** ISA bridge state. */ 135 PIIX3 PIIX3State; 106 136 107 137 #if 1 /* Will be moved into the BIOS "soon". */ … … 112 142 /** Actual bus number. */ 113 143 uint8_t uBus; 114 uint8_t uAlignment0[ 2];144 uint8_t uAlignment0[7]; 115 145 #endif 116 117 /** I/O APIC usage flag */118 bool fUseIoApic;119 /** I/O APIC irq levels */120 volatile uint32_t uaPciApicIrqLevels[PCI_APIC_IRQ_PINS];121 /** ACPI IRQ level */122 uint32_t acpi_irq_level;123 /** ACPI PIC IRQ */124 int acpi_irq;125 /** Value latched in Configuration Address Port (0CF8h) */126 uint32_t uConfigReg;127 128 /** R3 pointer to the device instance. */129 PPDMDEVINSR3 pDevInsR3;130 /** R0 pointer to the device instance. */131 PPDMDEVINSR0 pDevInsR0;132 /** RC pointer to the device instance. */133 PPDMDEVINSRC pDevInsRC;134 135 #if HC_ARCH_BITS == 64136 uint32_t Alignment0;137 #endif138 139 /** ISA bridge state. */140 PIIX3 PIIX3State;141 /** PCI bus which is attached to the host-to-PCI bridge. */142 DEVPCIBUS PciBus;143 146 144 147 } PCIGLOBALS; 145 148 /** Pointer to per VM data. */ 146 149 typedef PCIGLOBALS *PPCIGLOBALS; 150 147 151 148 152 … … 2002 2006 */ 2003 2007 PPCIGLOBALS pGlobals = PDMINS_2_DATA(pDevIns, PPCIGLOBALS); 2004 pGlobals->uPciBiosIo 2005 pGlobals->uPciBiosMmio 2008 pGlobals->uPciBiosIo = 0xc000; 2009 pGlobals->uPciBiosMmio = 0xf0000000; 2006 2010 memset((void *)&pGlobals->pci_irq_levels, 0, sizeof(pGlobals->pci_irq_levels)); 2007 pGlobals->fUseIoApic 2011 pGlobals->fUseIoApic = fUseIoApic; 2008 2012 memset((void *)&pGlobals->uaPciApicIrqLevels, 0, sizeof(pGlobals->uaPciApicIrqLevels)); 2009 2013 … … 2012 2016 pGlobals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2013 2017 2018 pGlobals->PciBus.fTypePiix3 = true; 2019 pGlobals->PciBus.fTypeIch9 = false; 2020 pGlobals->PciBus.fPureBridge = false; 2014 2021 pGlobals->PciBus.pDevInsR3 = pDevIns; 2015 2022 pGlobals->PciBus.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 2016 2023 pGlobals->PciBus.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2017 pGlobals->PciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) 2018 * RT_ELEMENTS(pGlobals->PciBus.apDevices)); 2024 pGlobals->PciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, 2025 sizeof(PPDMPCIDEV) 2026 * RT_ELEMENTS(pGlobals->PciBus.apDevices)); 2027 AssertLogRelReturn(pGlobals->PciBus.papBridgesR3, VERR_NO_MEMORY); 2028 2019 2029 2020 2030 PDMPCIBUSREG PciBusReg; … … 2364 2374 */ 2365 2375 PPCIBUS pBus = PDMINS_2_DATA(pDevIns, PPCIBUS); 2376 pBus->fTypePiix3 = true; 2377 pBus->fTypeIch9 = false; 2378 pBus->fPureBridge = true; 2366 2379 pBus->pDevInsR3 = pDevIns; 2367 2380 pBus->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 2368 2381 pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2369 2382 pBus->papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pBus->apDevices)); 2383 AssertLogRelReturn(pBus->papBridgesR3, VERR_NO_MEMORY); 2370 2384 2371 2385 PDMPCIBUSREG PciBusReg; -
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r64414 r64415 66 66 typedef struct 67 67 { 68 /** PCI bus which is attached to the host-to-PCI bridge. 69 * This must come first so we can share more code with the bridges! */ 70 DEVPCIBUS PciBus; 71 68 72 /** R3 pointer to the device instance. */ 69 73 PPDMDEVINSR3 pDevInsR3; … … 73 77 PPDMDEVINSRC pDevInsRC; 74 78 79 /** I/O APIC usage flag (always true of ICH9, see constructor). */ 80 bool fUseIoApic; 81 /** Reserved for future config flags. */ 82 bool afFutureFlags[3]; 83 /** Physical address of PCI config space MMIO region. */ 84 uint64_t u64PciConfigMMioAddress; 85 /** Length of PCI config space MMIO region. */ 86 uint64_t u64PciConfigMMioLength; 87 88 /** I/O APIC irq levels */ 89 volatile uint32_t uaPciApicIrqLevels[PCI_APIC_IRQ_PINS]; 75 90 /** Value latched in Configuration Address Port (0CF8h) */ 76 91 uint32_t uConfigReg; 77 92 78 /** I/O APIC irq levels */79 volatile uint32_t uaPciApicIrqLevels[PCI_APIC_IRQ_PINS];80 81 93 #if 1 /* Will be moved into the BIOS "soon". */ 94 /** Current bus number (?). */ 95 uint8_t uPciBiosBus; 96 uint8_t Alignment0[3]; 82 97 /** The next I/O port address which the PCI BIOS will use. */ 83 98 uint32_t uPciBiosIo; … … 86 101 /** The next 64-bit MMIO address which the PCI BIOS will use. */ 87 102 uint64_t uPciBiosMmio64; 88 /** Actual bus number. */89 uint8_t uBus;90 uint8_t Alignment0[7];91 103 #endif 92 /** Physical address of PCI config space MMIO region. */ 93 uint64_t u64PciConfigMMioAddress; 94 /** Length of PCI config space MMIO region. */ 95 uint64_t u64PciConfigMMioLength; 96 97 /** PCI bus which is attached to the host-to-PCI bridge. */ 98 DEVPCIBUS PciBus; 104 99 105 } ICH9PCIGLOBALS, *PICH9PCIGLOBALS; 100 106 … … 1688 1694 case 0x0604: 1689 1695 /* PCI-to-PCI bridge. */ 1690 AssertMsg(pGlobals->u Bus < 255, ("Too many bridges on the bus\n"));1696 AssertMsg(pGlobals->uPciBiosBus < 255, ("Too many bridges on the bus\n")); 1691 1697 ich9pciBiosInitBridge(pGlobals, uBus, uDevFn); 1692 1698 break; … … 1886 1892 ("Device is not a PCI bridge but on the list of PCI bridges\n")); 1887 1893 PICH9PCIBUS pChildBus = PDMINS_2_DATA(pBridge->Int.s.CTX_SUFF(pDevIns), PICH9PCIBUS); 1888 pGlobals->u Bus++;1889 ich9pciInitBridgeTopology(pGlobals, pChildBus, uBusSecondary, pGlobals->u Bus);1890 } 1891 PCIDevSetByte(pBridgeDev, VBOX_PCI_SUBORDINATE_BUS, pGlobals->u Bus);1894 pGlobals->uPciBiosBus++; 1895 ich9pciInitBridgeTopology(pGlobals, pChildBus, uBusSecondary, pGlobals->uPciBiosBus); 1896 } 1897 PCIDevSetByte(pBridgeDev, VBOX_PCI_SUBORDINATE_BUS, pGlobals->uPciBiosBus); 1892 1898 Log2(("ich9pciInitBridgeTopology: for bus %p: primary=%d secondary=%d subordinate=%d\n", 1893 1899 pBus, … … 1909 1915 * Set the start addresses. 1910 1916 */ 1917 pGlobals->uPciBiosBus = 0; 1911 1918 pGlobals->uPciBiosIo = 0xd000; 1912 1919 pGlobals->uPciBiosMmio = cbBelow4GB; 1913 1920 pGlobals->uPciBiosMmio64 = cbAbove4GB + _4G; 1914 pGlobals->uBus = 0;1915 1921 1916 1922 /* NB: Assume that if MMIO range is enabled, it is at the bottom of the memory hole. */ … … 2416 2422 N_("Configuration error: Failed to read \"McfgLength\"")); 2417 2423 2424 pGlobals->fUseIoApic = fUseIoApic; 2418 2425 pGlobals->pDevInsR3 = pDevIns; 2419 2426 pGlobals->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 2420 2427 pGlobals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2421 2428 2429 pGlobals->PciBus.fTypePiix3 = false; 2430 pGlobals->PciBus.fTypeIch9 = true; 2431 pGlobals->PciBus.fPureBridge = false; 2422 2432 pGlobals->PciBus.pDevInsR3 = pDevIns; 2423 2433 pGlobals->PciBus.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 2424 2434 pGlobals->PciBus.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2425 2435 pGlobals->PciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pGlobals->PciBus.apDevices)); 2436 AssertLogRelReturn(pGlobals->PciBus.papBridgesR3, VERR_NO_MEMORY); 2426 2437 2427 2438 /* … … 2679 2690 */ 2680 2691 PICH9PCIBUS pBus = PDMINS_2_DATA(pDevIns, PICH9PCIBUS); 2692 pBus->fTypePiix3 = false; 2693 pBus->fTypeIch9 = true; 2694 pBus->fPureBridge = true; 2681 2695 pBus->pDevInsR3 = pDevIns; 2682 2696 pBus->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 2683 2697 pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2684 2698 pBus->papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pBus->apDevices)); 2699 AssertLogRelReturn(pBus->papBridgesR3, VERR_NO_MEMORY); 2685 2700 2686 2701 PDMPCIBUSREG PciBusReg; -
trunk/src/VBox/Devices/Bus/DevPciInternal.h
r64414 r64415 36 36 /** Start device number - always zero (only for DevPCI source compat). */ 37 37 uint32_t iDevSearch; 38 /** Size alignemnt padding. */ 39 uint32_t u32Alignment0; 38 /** Set if PIIX3 type. */ 39 uint32_t fTypePiix3 : 1; 40 /** Set if ICH9 type. */ 41 uint32_t fTypeIch9: 1; 42 /** Set if this is a pure bridge, i.e. not part of DEVPCIGLOBALS struct. */ 43 uint32_t fPureBridge : 1; 44 uint32_t uUnused : 29; 40 45 41 46 /** R3 pointer to the device instance. */ -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r64414 r64415 219 219 GEN_CHECK_OFF(ICH9PCIGLOBALS, uaPciApicIrqLevels); 220 220 GEN_CHECK_OFF(ICH9PCIGLOBALS, uaPciApicIrqLevels[1]); 221 GEN_CHECK_OFF(ICH9PCIGLOBALS, uPciBiosBus); 221 222 GEN_CHECK_OFF(ICH9PCIGLOBALS, uPciBiosIo); 222 223 GEN_CHECK_OFF(ICH9PCIGLOBALS, uPciBiosMmio); 223 224 GEN_CHECK_OFF(ICH9PCIGLOBALS, uPciBiosMmio64); 224 GEN_CHECK_OFF(ICH9PCIGLOBALS, uBus);225 225 GEN_CHECK_OFF(ICH9PCIGLOBALS, u64PciConfigMMioAddress); 226 226 GEN_CHECK_OFF(ICH9PCIGLOBALS, u64PciConfigMMioLength);
Note:
See TracChangeset
for help on using the changeset viewer.