This patch 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. Any comments and feedback much appreciated! Thanks, Gabriel Gabriel L. Somlo (7): 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 specific PCI IRQ routing initialization OvmfPkg: RFC: Initialize interrupt line register for default Q35 pci device set 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 | 130 +-------------------- 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 | 102 ++++++++-------- 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 + 21 files changed, 643 insertions(+), 268 deletions(-) create mode 100644 OvmfPkg/Include/OvmfPlatforms.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 [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
