hvmloader: setup APICs in a common function again.
authorIan Campbell <ian.campbell@citrix.com>
Wed, 1 Jun 2011 15:43:29 +0000 (16:43 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 1 Jun 2011 15:43:29 +0000 (16:43 +0100)
Previous refactoring was premature.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
tools/firmware/hvmloader/config.h
tools/firmware/hvmloader/hvmloader.c
tools/firmware/hvmloader/rombios.c
tools/firmware/hvmloader/seabios.c

index d48bef5e2f1bf7fd327c31fd915d774ee98b6f03..44b664229fdeede366bfff9a376198669acc7a70 100644 (file)
@@ -26,7 +26,6 @@ struct bios_config {
     /* ACPI tables */
     unsigned int acpi_start;
 
-    void (*apic_setup)(void);
     void (*smp_setup)(void);
 
     uint32_t (*bios_high_setup)(void);
index d1c4939c16f7ed1aa4135a66353dfaa9f173a959..baa2f3927f1624520e58ee5c82b4ecf99a99b55f 100644 (file)
@@ -25,6 +25,7 @@
 #include "config.h"
 #include "pci_regs.h"
 #include "option_rom.h"
+#include "apic_regs.h"
 #include <xen/version.h>
 #include <xen/hvm/params.h>
 
@@ -332,6 +333,21 @@ static void cmos_write_memory_size(void)
     cmos_outb(0x35, (uint8_t)( alt_mem >> 8));
 }
 
+static void apic_setup(void)
+{
+    /* Set the IOAPIC ID to the static value used in the MP/ACPI tables. */
+    ioapic_write(0x00, IOAPIC_ID);
+
+    /* NMIs are delivered direct to the BSP. */
+    lapic_write(APIC_SPIV, APIC_SPIV_APIC_ENABLED | 0xFF);
+    lapic_write(APIC_LVT0, (APIC_MODE_EXTINT << 8) | APIC_LVT_MASKED);
+    lapic_write(APIC_LVT1, APIC_MODE_NMI << 8);
+
+    /* 8259A ExtInts are delivered through IOAPIC pin 0 (Virtual Wire Mode). */
+    ioapic_write(0x10, APIC_DM_EXTINT);
+    ioapic_write(0x11, SET_APIC_ID(LAPIC_ID(0)));
+}
+
 struct bios_info {
     const char *key;
     const struct bios_config *bios;
@@ -384,8 +400,7 @@ int main(void)
 
     printf("CPU speed is %u MHz\n", get_cpu_mhz());
 
-    if (bios->apic_setup)
-        bios->apic_setup();
+    apic_setup();
     pci_setup();
 
     if (bios->smp_setup)
index a8d755e474ab2375266e61866b3b6b65753a34a7..40b3134125c10ad2e1f78862c7458abcc98b7e0c 100644 (file)
@@ -25,7 +25,6 @@
 #include "../rombios/config.h"
 
 #include "acpi/acpi2_0.h"
-#include "apic_regs.h"
 #include "pci_regs.h"
 #include "util.h"
 #include "hypercall.h"
@@ -82,21 +81,6 @@ static void rombios_setup_bios_info(uint32_t bioshigh)
     bios_info->bios32_entry = bioshigh;
 }
 
-static void rombios_apic_setup(void)
-{
-    /* Set the IOAPIC ID to the static value used in the MP/ACPI tables. */
-    ioapic_write(0x00, IOAPIC_ID);
-
-    /* NMIs are delivered direct to the BSP. */
-    lapic_write(APIC_SPIV, APIC_SPIV_APIC_ENABLED | 0xFF);
-    lapic_write(APIC_LVT0, (APIC_MODE_EXTINT << 8) | APIC_LVT_MASKED);
-    lapic_write(APIC_LVT1, APIC_MODE_NMI << 8);
-
-    /* 8259A ExtInts are delivered through IOAPIC pin 0 (Virtual Wire Mode). */
-    ioapic_write(0x10, APIC_DM_EXTINT);
-    ioapic_write(0x11, SET_APIC_ID(LAPIC_ID(0)));
-}
-
 /*
  * find_mp_table_start - searchs through BIOS memory for '___HVMMP' signature
  *
@@ -167,7 +151,6 @@ struct bios_config rombios_config =  {
 
     .acpi_start = ACPI_PHYSICAL_ADDRESS,
 
-    .apic_setup = rombios_apic_setup,
     .smp_setup = smp_initialise,
 
     .bios_high_setup = rombios_highbios_setup,
index 8603136f271b60294f3c7782a68d9a39b2661138..1bad44f192a53a9ff7ff8c5823466dbafcd74dba 100644 (file)
@@ -50,7 +50,6 @@ struct bios_config seabios_config = {
 
     .bios_info_setup = NULL,
 
-    .apic_setup = NULL,
     .smp_setup = NULL,
 
     .vm86_setup = NULL,