xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH 13 of 19] tools: hvmloader: refactor highbios and bios_info setup into struct bios_config
Date: Tue, 12 Apr 2011 12:29:12 +0100	[thread overview]
Message-ID: <99d1e52175a3d7770ab0.1302607752@localhost.localdomain> (raw)
In-Reply-To: <patchbomb.1302607739@localhost.localdomain>

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1302602206 -3600
# Node ID 99d1e52175a3d7770ab0cfe286133cf84954cf8d
# Parent  f153a0d91b9f7cc9fe9d84bf7d97ac6371793b03
tools: hvmloader: refactor highbios and bios_info setup into struct bios_config

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

diff -r f153a0d91b9f -r 99d1e52175a3 tools/firmware/hvmloader/32bitbios_support.c
--- a/tools/firmware/hvmloader/32bitbios_support.c	Tue Apr 12 10:54:21 2011 +0100
+++ b/tools/firmware/hvmloader/32bitbios_support.c	Tue Apr 12 10:56:46 2011 +0100
@@ -144,7 +144,7 @@ static uint32_t relocate_32bitbios(char 
     return (uint32_t)highbiosarea;
 }
 
-uint32_t highbios_setup(void)
+uint32_t rombios_highbios_setup(void)
 {
     return relocate_32bitbios((char *)highbios_array, sizeof(highbios_array));
 }
diff -r f153a0d91b9f -r 99d1e52175a3 tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h	Tue Apr 12 10:54:21 2011 +0100
+++ b/tools/firmware/hvmloader/config.h	Tue Apr 12 10:56:46 2011 +0100
@@ -28,6 +28,9 @@ struct bios_config {
     void (*apic_setup)(void);
     void (*pci_setup)(void);
     void (*smp_setup)(void);
+
+    uint32_t (*bios_high_setup)(void);
+    void (*bios_info_setup)(uint32_t);
 };
 
 extern struct bios_config rombios_config;
diff -r f153a0d91b9f -r 99d1e52175a3 tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c	Tue Apr 12 10:54:21 2011 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c	Tue Apr 12 10:56:46 2011 +0100
@@ -364,10 +364,10 @@ static const struct bios_config *detect_
 
 int main(void)
 {
+    uint32_t highbios = 0;
     const struct bios_config *bios;
     int option_rom_sz = 0, vgabios_sz = 0, etherboot_sz = 0, smbios_sz = 0;
-    uint32_t etherboot_phys_addr, option_rom_phys_addr, bios32_addr;
-    struct bios_info *bios_info;
+    uint32_t etherboot_phys_addr, option_rom_phys_addr;
 
     printf("HVM Loader\n");
 
@@ -400,7 +400,9 @@ int main(void)
     printf("Loading %s ...\n", bios->name);
     memcpy((void *)bios->bios_address, bios->image,
            bios->image_size);
-    bios32_addr = highbios_setup();
+
+    if (bios->bios_high_setup)
+        highbios = bios->bios_high_setup();
 
     if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
         create_mp_tables();
@@ -480,17 +482,8 @@ int main(void)
     *E820_NR = build_e820_table(E820);
     dump_e820_table(E820, *E820_NR);
 
-    bios_info = (struct bios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
-    memset(bios_info, 0, sizeof(*bios_info));
-    bios_info->com1_present = uart_exists(0x3f8);
-    bios_info->com2_present = uart_exists(0x2f8);
-    bios_info->lpt1_present = lpt_exists(0x378);
-    bios_info->hpet_present = hpet_exists(ACPI_HPET_ADDRESS);
-    bios_info->pci_min = pci_mem_start;
-    bios_info->pci_len = pci_mem_end - pci_mem_start;
-    bios_info->madt_csum_addr = madt_csum_addr;
-    bios_info->madt_lapic0_addr = madt_lapic0_addr;
-    bios_info->bios32_entry = bios32_addr;
+    if (bios->bios_info_setup)
+        bios->bios_info_setup(highbios);
 
     xenbus_shutdown();
 
diff -r f153a0d91b9f -r 99d1e52175a3 tools/firmware/hvmloader/rombios.c
--- a/tools/firmware/hvmloader/rombios.c	Tue Apr 12 10:54:21 2011 +0100
+++ b/tools/firmware/hvmloader/rombios.c	Tue Apr 12 10:56:46 2011 +0100
@@ -24,6 +24,7 @@
 
 #include "../rombios/config.h"
 
+#include "acpi/acpi2_0.h"
 #include "apic_regs.h"
 #include "pci_regs.h"
 #include "util.h"
@@ -35,6 +36,23 @@
 #define ROM_INCLUDE_ROMBIOS
 #include "roms.inc"
 
+static void rombios_setup_bios_info(uint32_t bioshigh)
+{
+    struct bios_info *bios_info;
+
+    bios_info = (struct bios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
+    memset(bios_info, 0, sizeof(*bios_info));
+    bios_info->com1_present = uart_exists(0x3f8);
+    bios_info->com2_present = uart_exists(0x2f8);
+    bios_info->lpt1_present = lpt_exists(0x378);
+    bios_info->hpet_present = hpet_exists(ACPI_HPET_ADDRESS);
+    bios_info->pci_min = pci_mem_start;
+    bios_info->pci_len = pci_mem_end - pci_mem_start;
+    bios_info->madt_csum_addr = madt_csum_addr;
+    bios_info->madt_lapic0_addr = madt_lapic0_addr;
+    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. */
@@ -280,6 +298,9 @@ struct bios_config rombios_config =  {
     .apic_setup = rombios_apic_setup,
     .pci_setup = rombios_pci_setup,
     .smp_setup = smp_initialise,
+
+    .bios_high_setup = rombios_highbios_setup,
+    .bios_info_setup = rombios_setup_bios_info,
 };
 
 /*
diff -r f153a0d91b9f -r 99d1e52175a3 tools/firmware/hvmloader/util.h
--- a/tools/firmware/hvmloader/util.h	Tue Apr 12 10:54:21 2011 +0100
+++ b/tools/firmware/hvmloader/util.h	Tue Apr 12 10:56:46 2011 +0100
@@ -181,7 +181,7 @@ void xenbus_shutdown(void);
 char *xenstore_read(char *path);
 
 /* Prepare the 32bit BIOS */
-uint32_t highbios_setup(void);
+uint32_t rombios_highbios_setup(void);
 
 /* Miscellaneous. */
 void cacheattr_init(void);

  parent reply	other threads:[~2011-04-12 11:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12 11:28 [PATCH 00 of 19] tools: SeaBIOS integration Ian Campbell
2011-04-12 11:29 ` [PATCH 01 of 19] tools: hvmloader: move ROMBIOS configuration into tools/firmware/rombios/ Ian Campbell
2011-04-12 11:29 ` [PATCH 02 of 19] tools: hvmloader: split e820 support into its own code module Ian Campbell
2011-04-12 11:29 ` [PATCH 03 of 19] tools: hvmloader: pass ACPI_PHYSICAL_ADDRESS as a runtime parameter Ian Campbell
2011-04-12 11:29 ` [PATCH 04 of 19] tools: hvmloader: pass SMBIOS location " Ian Campbell
2011-04-12 11:29 ` [PATCH 05 of 19] tools: hvmloader: pass option ROM end address around as a parameter Ian Campbell
2011-04-12 11:29 ` [PATCH 06 of 19] tools: hvmloader: split scratch and hypercall addressing from ROMBIOS low heap Ian Campbell
2011-04-12 11:29 ` [PATCH 07 of 19] tools: hvmloader: refactor Makefile to move ROM filenames into variables Ian Campbell
2011-04-12 11:29 ` [PATCH 08 of 19] tools: hvmloader: remove rombios_sz, just use sizeof(rombios) Ian Campbell
2011-04-12 11:29 ` [PATCH 09 of 19] tools: hvmloader: rename roms.h to roms.inc Ian Campbell
2011-04-12 11:29 ` [PATCH 10 of 19] tools: hvmloader: Define $(OBJS) directly instead of via $(SRCS) Ian Campbell
2011-04-12 11:29 ` [PATCH 11 of 19] tools: hvmloader: add bios_config data structure Ian Campbell
2011-04-12 11:29 ` [PATCH 12 of 19] tools: hvmloader: Refactor APIC, PCI and SMP setup into struct bios_config Ian Campbell
2011-04-12 11:29 ` Ian Campbell [this message]
2011-04-12 11:29 ` [PATCH 14 of 19] tools: hvmloader: Refactor VM86 and E820 " Ian Campbell
2011-04-12 11:29 ` [PATCH 15 of 19] tools: hvmloader: Refactor ACPI table " Ian Campbell
2011-04-12 11:29 ` [PATCH 16 of 19] tools: hvmloader: Refactor MP " Ian Campbell
2011-04-12 11:29 ` [PATCH 17 of 19] tools: libxl: hide selection of device-model, hvmloader and BIOS by default Ian Campbell
2011-04-14 18:09   ` Ian Jackson
2011-04-15  7:53     ` Ian Campbell
2011-04-12 11:29 ` [PATCH 18 of 19] tools: hvmloader: select BIOS through xenstore Ian Campbell
2011-04-12 11:29 ` [PATCH 19 of 19] tools: support SeaBIOS. Use by default when upstream qemu is configured Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99d1e52175a3d7770ab0.1302607752@localhost.localdomain \
    --to=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).