diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2013-02-13 19:35:12 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2013-02-13 19:35:12 -0500 |
commit | a2a86e2954d646131b1c04c9c7649fded81b9dc7 (patch) | |
tree | aeece913f5a512f37a37da8dd69dfed1ed59007f | |
parent | b840ba996d9f90a213335ea18c9d620391b745d6 (diff) | |
download | seabios-a2a86e2954d646131b1c04c9c7649fded81b9dc7.tar.gz |
Group QEMU platform setup together and move to paravirt.c.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/coreboot.c | 13 | ||||
-rw-r--r-- | src/mtrr.c | 3 | ||||
-rw-r--r-- | src/paravirt.c | 29 | ||||
-rw-r--r-- | src/paravirt.h | 4 | ||||
-rw-r--r-- | src/pciinit.c | 6 | ||||
-rw-r--r-- | src/post.c | 29 | ||||
-rw-r--r-- | src/smm.c | 3 | ||||
-rw-r--r-- | src/util.h | 2 |
8 files changed, 49 insertions, 40 deletions
diff --git a/src/coreboot.c b/src/coreboot.c index c0c6653d..0d448347 100644 --- a/src/coreboot.c +++ b/src/coreboot.c @@ -13,6 +13,8 @@ #include "disk.h" // MAXDESCSIZE #include "config.h" // CONFIG_* #include "acpi.h" // find_pmtimer +#include "pci.h" // pci_probe_devices + /**************************************************************** * Memory map @@ -125,6 +127,9 @@ const char *CBvendor = "", *CBpart = ""; void coreboot_preinit(void) { + if (!CONFIG_COREBOOT) + return; + dprintf(3, "Attempting to find coreboot table\n"); // Find coreboot table. @@ -204,10 +209,14 @@ scan_tables(u32 start, u32 size) } void -coreboot_biostable_setup(void) +coreboot_platform_setup(void) { + if (!CONFIG_COREBOOT) + return; + pci_probe_devices(); + struct cb_memory *cbm = CBMemTable; - if (! CONFIG_COREBOOT || !cbm) + if (!cbm) return; dprintf(3, "Relocating coreboot bios tables\n"); @@ -6,7 +6,6 @@ #include "util.h" // dprintf #include "config.h" // CONFIG_* -#include "paravirt.h" // runningOnXen #include "pci.h" // pcimem_start #define MSR_MTRRcap 0x000000fe @@ -34,7 +33,7 @@ void mtrr_setup(void) { - if (!CONFIG_MTRR_INIT || runningOnXen()) + if (!CONFIG_MTRR_INIT) return; u32 eax, ebx, ecx, edx, cpuid_features; diff --git a/src/paravirt.c b/src/paravirt.c index aa4a4216..f76b47f3 100644 --- a/src/paravirt.c +++ b/src/paravirt.c @@ -19,6 +19,7 @@ #include "acpi.h" // acpi_setup #include "mptable.h" // mptable_setup #include "pci.h" // create_pirtable +#include "xen.h" // xen_biostable_setup /* This CPUID returns the signature 'KVMKVMKVM' in ebx, ecx, and edx. It * should be used to determine that a VM is running under KVM. @@ -45,11 +46,16 @@ static void kvm_preinit(void) } void -qemu_ramsize_preinit(void) +qemu_preinit(void) { if (!CONFIG_QEMU) return; + if (runningOnXen()) { + xen_ramsize_preinit(); + return; + } + PlatformRunningOn = PF_QEMU; kvm_preinit(); @@ -77,8 +83,27 @@ qemu_ramsize_preinit(void) } void -qemu_biostable_setup(void) +qemu_platform_setup(void) { + if (!CONFIG_QEMU) + return; + + if (runningOnXen()) { + pci_probe_devices(); + xen_hypercall_setup(); + xen_biostable_setup(); + return; + } + + // Initialize pci + pci_setup(); + smm_setup(); + + // Initialize mtrr and smp + mtrr_setup(); + smp_setup(); + + // Create bios tables pirtable_setup(); mptable_setup(); smbios_setup(); diff --git a/src/paravirt.h b/src/paravirt.h index 44382733..96b35ba7 100644 --- a/src/paravirt.h +++ b/src/paravirt.h @@ -23,8 +23,8 @@ static inline int runningOnKVM(void) { return CONFIG_QEMU && GET_GLOBAL(PlatformRunningOn) & PF_KVM; } -void qemu_ramsize_preinit(void); -void qemu_biostable_setup(void); +void qemu_preinit(void); +void qemu_platform_setup(void); void qemu_cfg_init(void); #endif diff --git a/src/pciinit.c b/src/pciinit.c index 1d34653b..d757ab63 100644 --- a/src/pciinit.c +++ b/src/pciinit.c @@ -11,7 +11,6 @@ #include "pci_regs.h" // PCI_COMMAND #include "ioport.h" // PORT_ATA1_CMD_BASE #include "config.h" // CONFIG_* -#include "paravirt.h" // runningOnXen #include "memmap.h" // add_e820 #include "dev-q35.h" @@ -734,11 +733,8 @@ static void pci_bios_map_devices(struct pci_bus *busses) void pci_setup(void) { - if (!CONFIG_QEMU || runningOnXen()) { - // PCI setup already done by coreboot or Xen - just do probe. - pci_probe_devices(); + if (!CONFIG_QEMU) return; - } dprintf(3, "pci setup\n"); @@ -159,24 +159,9 @@ platform_hardware_setup(void) mathcp_setup(); timer_setup(); - // Initialize pci - pci_setup(); - smm_setup(); - - // Initialize mtrr and smp - mtrr_setup(); - smp_setup(); - - // Setup Xen hypercalls - xen_hypercall_setup(); - - // Setup external BIOS interface tables - if (CONFIG_COREBOOT) - coreboot_biostable_setup(); - else if (runningOnXen()) - xen_biostable_setup(); - else - qemu_biostable_setup(); + // Platform specific setup + qemu_platform_setup(); + coreboot_platform_setup(); } void @@ -314,12 +299,8 @@ void VISIBLE32INIT dopost(void) { // Detect ram and setup internal malloc. - if (CONFIG_COREBOOT) - coreboot_preinit(); - else if (runningOnXen()) - xen_ramsize_preinit(); - else - qemu_ramsize_preinit(); + qemu_preinit(); + coreboot_preinit(); malloc_preinit(); // Relocate initialization code and call maininit(). @@ -10,7 +10,6 @@ #include "config.h" // CONFIG_* #include "ioport.h" // outb #include "pci_ids.h" // PCI_VENDOR_ID_INTEL -#include "paravirt.h" // runningOnXen #include "dev-q35.h" ASM32FLAT( @@ -184,7 +183,7 @@ static const struct pci_device_id smm_init_tbl[] = { void smm_setup(void) { - if (!CONFIG_USE_SMM || runningOnXen()) + if (!CONFIG_USE_SMM) return; dprintf(3, "init smm\n"); @@ -327,7 +327,7 @@ int apic_id_is_present(u8 apic_id); extern const char *CBvendor, *CBpart; struct cbfs_file; void cbfs_run_payload(struct cbfs_file *file); -void coreboot_biostable_setup(void); +void coreboot_platform_setup(void); void cbfs_payload_setup(void); void coreboot_preinit(void); void coreboot_cbfs_init(void); |