WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] hvmloader: refactor BIOS info setup

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] hvmloader: refactor BIOS info setup
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Thu, 16 Jun 2011 11:12:15 +0100
Delivery-date: Thu, 16 Jun 2011 03:24:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1306943224 -3600
# Node ID 4f4970d2848df92f7584cf523c705963d172ee30
# Parent  26c6382ea52ab18410a62d59683e9f36bc239330
hvmloader: refactor BIOS info setup

Currently we have ->bios_high_setup, which is called relatively early
and returns a cookie which is passed to ->bios_info_setup which runs
towards the end and creates the BIOS info, incorporating the cookie
which (in the case of ROMBIOS) happens to be the BIOS's high load
address . This is rather ROMBIOS specific.

Refactor to have ->bios_info_setup which is called early and prepares
the bios_info, ->bios_relocate which does any necessary relocation
(updating the BIOS info as necessary) and ->bios_info_finish which
finalises the info (e.g.  by calculating the checksum).

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


diff -r 26c6382ea52a -r 4f4970d2848d tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h Wed Jun 01 16:46:28 2011 +0100
+++ b/tools/firmware/hvmloader/config.h Wed Jun 01 16:47:04 2011 +0100
@@ -20,8 +20,10 @@
     int load_roms;
     unsigned int optionrom_start, optionrom_end;
 
-    uint32_t (*bios_high_setup)(void);
-    void (*bios_info_setup)(uint32_t);
+    void (*bios_info_setup)(void);
+    void (*bios_info_finish)(void);
+
+    void (*bios_relocate)(void);
 
     void (*vm86_setup)(void);
     void (*e820_setup)(void);
diff -r 26c6382ea52a -r 4f4970d2848d tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Wed Jun 01 16:46:28 2011 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c      Wed Jun 01 16:47:04 2011 +0100
@@ -383,7 +383,6 @@
 
 int main(void)
 {
-    uint32_t highbios = 0;
     const struct bios_config *bios;
     int option_rom_sz = 0, vgabios_sz = 0, etherboot_sz = 0;
     uint32_t etherboot_phys_addr = 0, option_rom_phys_addr = 0;
@@ -409,6 +408,9 @@
 
     perform_tests();
 
+    if (bios->bios_info_setup)
+        bios->bios_info_setup();
+
     if (bios->create_smbios_tables) {
         printf("Writing SMBIOS tables ...\n");
         bios->create_smbios_tables();
@@ -418,8 +420,8 @@
     memcpy((void *)bios->bios_address, bios->image,
            bios->image_size);
 
-    if (bios->bios_high_setup)
-        highbios = bios->bios_high_setup();
+    if (bios->bios_relocate)
+        bios->bios_relocate();
 
     if ( bios->create_mp_tables &&
          ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode ) )
@@ -505,8 +507,8 @@
     if (bios->e820_setup)
         bios->e820_setup();
 
-    if (bios->bios_info_setup)
-        bios->bios_info_setup(highbios);
+    if (bios->bios_info_finish)
+        bios->bios_info_finish();
 
     xenbus_shutdown();
 
diff -r 26c6382ea52a -r 4f4970d2848d tools/firmware/hvmloader/rombios.c
--- a/tools/firmware/hvmloader/rombios.c        Wed Jun 01 16:46:28 2011 +0100
+++ b/tools/firmware/hvmloader/rombios.c        Wed Jun 01 16:47:04 2011 +0100
@@ -64,7 +64,7 @@
     dump_e820_table(E820, *E820_NR);
 }
 
-static void rombios_setup_bios_info(uint32_t bioshigh)
+static void rombios_setup_bios_info(void)
 {
     struct bios_info *bios_info;
 
@@ -74,11 +74,28 @@
     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->madt_csum_addr = madt_csum_addr;
+    bios_info->madt_lapic0_addr = madt_lapic0_addr;
+}
+
+static void rombios_relocate(void)
+{
+    uint32_t bioshigh;
+    struct bios_info *bios_info;
+
+    bioshigh = rombios_highbios_setup();
+
+    bios_info = (struct bios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
+    bios_info->bios32_entry = bioshigh;
+}
+
+static void rombios_finish_bios_info(void)
+{
+    struct bios_info *bios_info;
+
+    bios_info = (struct bios_info *)BIOS_INFO_PHYSICAL_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;
 }
 
 /*
@@ -158,8 +175,10 @@
     .optionrom_start = OPTIONROM_PHYSICAL_ADDRESS,
     .optionrom_end = OPTIONROM_PHYSICAL_END,
 
-    .bios_high_setup = rombios_highbios_setup,
     .bios_info_setup = rombios_setup_bios_info,
+    .bios_info_finish = rombios_finish_bios_info,
+
+    .bios_relocate = rombios_relocate,
 
     .vm86_setup = rombios_init_vm86_tss,
     .e820_setup = rombios_setup_e820,
diff -r 26c6382ea52a -r 4f4970d2848d tools/firmware/hvmloader/seabios.c
--- a/tools/firmware/hvmloader/seabios.c        Wed Jun 01 16:46:28 2011 +0100
+++ b/tools/firmware/hvmloader/seabios.c        Wed Jun 01 16:47:04 2011 +0100
@@ -44,6 +44,9 @@
     .optionrom_end = 0,
 
     .bios_info_setup = NULL,
+    .bios_info_finish = NULL,
+
+    .bios_relocate = NULL,
 
     .vm86_setup = NULL,
     .e820_setup = NULL,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] hvmloader: refactor BIOS info setup, Xen patchbot-unstable <=