New in version 4: - updated https://github.com/gsomlo/edk2 - Fixed style issues pointed out by Jordan; - Added some extra slots for PCI_INTERRUPT_LINE register initialization, as well as comments describing the more "well-known" slots as per Gerd's recommendation (patch 6/6).
Re. 6/6, I would really like to figure out if there's a way to either have the existing pci bus enumeration code (called via gBS->ConnectController) build some sort of device list I could later use in PciAcpiInitialization, or re-scan the pci bus and build such a structure and re-implement the functionality from SeaBIOS pci_bios_init_devices(). I still really want this patch set applied, don't get me wrong :) And I may still be too much of an edk2 n00b to pull off porting pci_bios_init_devices(). But it sure would be nice and elegant to have it done like that... Thanks much, Gabriel > New in version 3: > > - patches 6 and 7 from earlier v2 now merged into a single PCI/ACPI > initialization patch; PIIX4 initialization of PCI_INTERRUPT_LINE > register re-added (in cleaned up form) as per Paolo's recommendation, > with a "FIXME" comment stating we should look for a way to initialize > present devices programmatically rather than hard-code "typical" > devices we expect to see configured by QEMU > > - cloned edk2 with these patches on top available on github > https://github.com/gsomlo/edk2 > >> This series removes hard-coded assumptions about the presence of a PIIX4 >> chipset, and dynamically probes for the presence of either PIIX4 or Q35. >> >> Patches 1-6 are candidates for upstream right now (modulo any feedback, >> of course). Patch 7, however, is just an RFC at this point, and I'm >> hoping there's a standard mechanism already present in edk2 and/or OvmfPkg >> to accomplish what I'm doing there for the general case. >> >> >> Patch 1/7 adds macros for probing the host bridge device ID, as well as >> accessing ACPI power management devices and registers. >> >> Patch 2/7 uses these macros to initialize ACPI power management during PEI >> >> Patch 3/7 has PEI write a dynamic PCD containing the detected hostbridge >> device ID, for use during later stages (e.g. dxe_driver, etc) >> >> Patch 4/7 splits AcpiTimerLib into three instances: 1. BaseRom, which >> contains no global variables and queries ACPI pmbase each time it >> reads the timer tick counter; 2. Base, which stores the timer tick >> counter address in a global after directly reading the host bridge DID >> from its constructor; and 3. Dxe, same as Base, but uses PCD written >> by PEI for host bridge DID. >> >> Patch 5/7 reads the host bridge type PCD set by PEI to initialize the >> legacy interrupt device number. NOTE: I have not actually tested this >> patch. >> >> Patch 6/7 uses host bridge type PCD to initialize LNK IRQ routing, and >> cleans up a few stale and non-functional bits of PIIX4 pci device >> initialization. >> >> Patch 7/7 is a proof of concept or RFC, and not meant to be applied >> upstream in its current form. It replicates the side effects of >> SeaBIOS pci_bios_init_devices() assuming the *default* set of PCI >> devices included with the QEMU Q35 machine type. >> I'm looking for ideas and advice on how I could take advantage of >> OVMF's existing PCI bus enumeration logic, or how/where I could >> enumerate the PCI bus on my own to essentially port pci_bios_init_devices() >> from SeaBIOS, which configures the PCI_INTERRUPT_LINE (0x3c) registers >> based on the contents of each device's PCI_INTERRUPT_PIN (0x3d) register. Gabriel L. Somlo (6): OvmfPkg: Factor out platform detection (q35 vs. piix4) OvmfPkg: PlatformPei: Platform specific ACPI power management setup OvmfPkg: Add PCD for Host Bridge dev. ID (PcdOvmfHostBridgePciDevId) OvmfPkg: AcpiTimerLib: Split into multiple phase-specific instances OvmfPkg: CsmSupportLib: Set/use platform specific legacy interrupt device OvmfPkg: PlatformBdsLib: Platform dependent PCI/IRQ initialization OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf | 3 + OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c | 27 +++- OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h | 6 +- OvmfPkg/Include/OvmfPlatforms.h | 49 +++++++ OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.c | 147 +-------------------- OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.h | 29 ++++ OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf | 44 ------ OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c | 97 ++++++++++++++ OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf | 37 ++++++ OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c | 128 ++++++++++++++++++ .../Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf | 39 ++++++ OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c | 98 ++++++++++++++ OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf | 40 ++++++ OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c | 121 ++++++++++------- OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h | 2 + OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf | 1 + OvmfPkg/OvmfPkg.dec | 1 + OvmfPkg/OvmfPkgIa32.dsc | 21 ++- OvmfPkg/OvmfPkgIa32X64.dsc | 21 ++- OvmfPkg/OvmfPkgX64.dsc | 21 ++- OvmfPkg/PlatformPei/Platform.c | 43 ++++-- OvmfPkg/PlatformPei/PlatformPei.inf | 1 + 22 files changed, 690 insertions(+), 286 deletions(-) create mode 100644 OvmfPkg/Include/OvmfPlatforms.h create mode 100644 OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.h delete mode 100644 OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.inf create mode 100644 OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c create mode 100644 OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.inf create mode 100644 OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c create mode 100644 OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.inf create mode 100644 OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c create mode 100644 OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf -- 1.9.3 ------------------------------------------------------------------------------ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel