- Timestamp:
- Oct 25, 2016 4:10:37 PM (8 years ago)
- Location:
- trunk/src/VBox/Devices/Bus
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r64420 r64423 3 3 * DevPCI - PCI BUS Device. 4 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! 5 * @remarks New code shall be added to DevPciIch9.cpp as that will become 6 * the common PCI bus code soon. Don't fix code in both DevPCI.cpp 7 * and DevPciIch9.cpp when it's possible to just make the latter 8 * version common. Common code uses the 'devpci' prefix, is 9 * prototyped in DevPciInternal.h, and is defined in DevPciIch9.cpp. 13 10 */ 14 11 … … 1821 1818 /* -=-=-=-=-=- PDMDEVREG -=-=-=-=-=- */ 1822 1819 1823 /**1824 * @interface_method_impl{PDMDEVREG,pfnRelocate}1825 */1826 static DECLCALLBACK(void) pciR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)1827 {1828 PDEVPCIROOT pGlobals = PDMINS_2_DATA(pDevIns, PDEVPCIROOT);1829 PDEVPCIBUS pBus = &pGlobals->PciBus;1830 pGlobals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);1831 1832 pBus->pPciHlpRC = pBus->pPciHlpR3->pfnGetRCHelpers(pDevIns);1833 pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);1834 1835 /* Relocate RC pointers for the attached pci devices. */1836 for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)1837 {1838 if (pBus->apDevices[i])1839 pBus->apDevices[i]->Int.s.pBusRC += offDelta;1840 }1841 }1842 1843 1820 1844 1821 /** … … 2041 2018 NULL, 2042 2019 /* pfnRelocate */ 2043 pciR3Relocate,2020 devpciR3RootRelocate, 2044 2021 /* pfnMemSetup */ 2045 2022 NULL, … … 2212 2189 2213 2190 /** 2214 * @interface_method_impl{PDMDEVREG,pfnRelocate}2215 */2216 static DECLCALLBACK(void) pcibridgeR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)2217 {2218 PDEVPCIBUS pBus = PDMINS_2_DATA(pDevIns, PDEVPCIBUS);2219 pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);2220 2221 /* Relocate RC pointers for the attached pci devices. */2222 for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)2223 {2224 if (pBus->apDevices[i])2225 pBus->apDevices[i]->Int.s.pBusRC += offDelta;2226 }2227 }2228 2229 2230 /**2231 2191 * @interface_method_impl{PDMDEVREG,pfnConstruct} 2232 2192 */ … … 2376 2336 NULL, 2377 2337 /* pfnRelocate */ 2378 pcibridgeR3Relocate,2338 devpciR3BusRelocate, 2379 2339 /* pfnMemSetup */ 2380 2340 NULL, -
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r64421 r64423 3 3 * DevPCI - ICH9 southbridge PCI bus emulation device. 4 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. 5 * @remarks We'll be slowly promoting the code in this file to common PCI bus 6 * code. Function without 'static' and using 'devpci' as prefix is 7 * also used by DevPCI.cpp and have a prototype in DevPciInternal.h. 11 8 * 12 * When moving code, always prefer the ICH9 version (this file)! 9 * For the time being the DevPciMerge1.cpp.h file will remain separate, 10 * due to 5.1. We can merge it into this one later in the dev cycle. 13 11 */ 14 12 … … 2554 2552 } 2555 2553 2556 static void ich9pciRelocateDevice(PPDMPCIDEV pDev, RTGCINTPTR offDelta)2557 {2558 if (pDev)2559 {2560 pDev->Int.s.pBusRC += offDelta;2561 if (pDev->Int.s.pMsixPageRC)2562 pDev->Int.s.pMsixPageRC += offDelta;2563 }2564 }2565 2554 2566 2555 /** 2567 * @copydoc FNPDMDEVRELOCATE 2568 */ 2569 static DECLCALLBACK(void) ich9pciRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 2570 { 2571 PDEVPCIROOT pGlobals = PDMINS_2_DATA(pDevIns, PDEVPCIROOT); 2572 PDEVPCIBUS pBus = &pGlobals->PciBus; 2573 pGlobals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2574 2556 * @interface_method_impl{PDMDEVREG,pfnRelocate} 2557 */ 2558 DECLCALLBACK(void) devpciR3BusRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 2559 { 2560 PDEVPCIBUS pBus = PDMINS_2_DATA(pDevIns, PDEVPCIBUS); 2561 2562 pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2575 2563 pBus->pPciHlpRC = pBus->pPciHlpR3->pfnGetRCHelpers(pDevIns); 2576 pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);2577 2564 2578 2565 /* Relocate RC pointers for the attached pci devices. */ 2579 2566 for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++) 2580 ich9pciRelocateDevice(pBus->apDevices[i], offDelta); 2581 2582 } 2567 { 2568 PPDMPCIDEV pDev = pBus->apDevices[i]; 2569 if (pDev) 2570 { 2571 pDev->Int.s.pBusRC += offDelta; 2572 if (pDev->Int.s.pMsixPageRC) 2573 pDev->Int.s.pMsixPageRC += offDelta; 2574 } 2575 } 2576 } 2577 2578 2579 /** 2580 * @interface_method_impl{PDMDEVREG,pfnRelocate} 2581 */ 2582 DECLCALLBACK(void) devpciR3RootRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 2583 { 2584 PDEVPCIROOT pGlobals = PDMINS_2_DATA(pDevIns, PDEVPCIROOT); 2585 pGlobals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2586 2587 AssertCompileMemberOffset(DEVPCIROOT, PciBus, 0); 2588 devpciR3BusRelocate(pDevIns, offDelta); 2589 } 2590 2583 2591 2584 2592 /** … … 2729 2737 2730 2738 2731 /**2732 * @copydoc FNPDMDEVRELOCATE2733 */2734 static DECLCALLBACK(void) ich9pcibridgeRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)2735 {2736 PDEVPCIBUS pBus = PDMINS_2_DATA(pDevIns, PDEVPCIBUS);2737 pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);2738 2739 /* Relocate RC pointers for the attached pci devices. */2740 for (uint32_t i = 0; i < RT_ELEMENTS(pBus->apDevices); i++)2741 ich9pciRelocateDevice(pBus->apDevices[i], offDelta);2742 }2743 2739 2744 2740 /** … … 2770 2766 NULL, 2771 2767 /* pfnRelocate */ 2772 ich9pciRelocate,2768 devpciR3RootRelocate, 2773 2769 /* pfnMemSetup */ 2774 2770 NULL, … … 2826 2822 NULL, 2827 2823 /* pfnRelocate */ 2828 ich9pcibridgeRelocate,2824 devpciR3BusRelocate, 2829 2825 /* pfnMemSetup */ 2830 2826 NULL, -
trunk/src/VBox/Devices/Bus/DevPciInternal.h
r64420 r64423 181 181 182 182 183 DECLCALLBACK(void) devpciR3RootRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta); 184 DECLCALLBACK(void) devpciR3BusRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta); 185 183 186 #endif 184 187 -
trunk/src/VBox/Devices/Bus/DevPciMerge1.cpp.h
r64420 r64423 1 1 /* $Id$ */ 2 2 /** @file 3 * DevPci - Common code that is included by bothDevPci and DevPciIch9.4 * 5 * @note All the code in this file is written by us!6 * @note No #ifdefs, use instant data booleans/flags/whatever. Goal is to7 * completely merge these files!3 * DevPci - Early attempt at common code for DevPci and DevPciIch9. 4 * 5 * @note Don't add more, add code to DevPciIch9.cpp instead. 6 * @note We'll keep this file like this for a little while longer 7 * because of 5.1. 8 8 */ 9 9
Note:
See TracChangeset
for help on using the changeset viewer.