]> xenbits.xensource.com Git - seabios.git/commitdiff
Group QEMU platform setup together and move to paravirt.c.
authorKevin O'Connor <kevin@koconnor.net>
Thu, 14 Feb 2013 00:35:12 +0000 (19:35 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 14 Feb 2013 00:35:12 +0000 (19:35 -0500)
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/coreboot.c
src/mtrr.c
src/paravirt.c
src/paravirt.h
src/pciinit.c
src/post.c
src/smm.c
src/util.h

index c0c6653d1dfce994c5aebb10d63bc33447766908..0d4483478ec97e2f8bc3d07d75153389cab2b6fc 100644 (file)
@@ -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");
index 0575b14a30eb9913d388f18331d8a26228f46c86..56f85f9be404cd9232dc4ea9e3c10d18c4b8eec1 100644 (file)
@@ -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;
index aa4a42166993af0298ecc083bba68ebc1cfcddb1..f76b47f3264147494c3d027fc2108b19714d9a77 100644 (file)
@@ -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();
index 44382733f698e1afbb95d6a48c3592b349a065f1..96b35ba76084387529b78b5de04de7fac009b60f 100644 (file)
@@ -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
index 1d34653be27b89b8d6de79fa3e0609c529ae69bf..d757ab63de46d6413e7c504c52ac2150c43f5dc5 100644 (file)
@@ -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");
 
index 3af36382875419b0f94f3bb53a9b94e850acacd9..f2eded970ec07be61203de67745f0de52c00e79c 100644 (file)
@@ -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().
index 412829605c7efa8c0f584d56db31d74a79986f1a..490a62600e4d08199c08bcd39b731a992124d98c 100644 (file)
--- a/src/smm.c
+++ b/src/smm.c
@@ -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");
index 0659d2471afe3474136a2dcbd14e14fa76b2147d..8875d958090a0652bc36adcf4001fb6d450c9367 100644 (file)
@@ -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);