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-devel

[Xen-devel] [PATCH 01 of 15] hvmloader: allow per-BIOS decision on loadi

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 01 of 15] hvmloader: allow per-BIOS decision on loading option ROMS
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Wed, 1 Jun 2011 10:39:56 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Wed, 01 Jun 2011 02:43:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1306921195@xxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1306921195@xxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1306916275 -3600
# Node ID 253a38db096bdc72b4e266ed103643210a739d93
# Parent  cdc873250db270f1d7593eb7381cc308aa5c517f
hvmloader: allow per-BIOS decision on loading option ROMS

SeaBIOS has functionality to load ROMs from the PCI device directly,
it makes sense to use this when it is available.

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

diff -r cdc873250db2 -r 253a38db096b tools/firmware/hvmloader/config-seabios.h
--- a/tools/firmware/hvmloader/config-seabios.h Tue May 31 17:31:28 2011 +0100
+++ b/tools/firmware/hvmloader/config-seabios.h Wed Jun 01 09:17:55 2011 +0100
@@ -1,9 +1,6 @@
 #ifndef __HVMLOADER_CONFIG_SEABIOS_H__
 #define __HVMLOADER_CONFIG_SEABIOS_H__
 
-#define OPTIONROM_PHYSICAL_ADDRESS  0x000C8000
-#define OPTIONROM_PHYSICAL_END      0x000E0000
-
 #define SEABIOS_PHYSICAL_ADDRESS    0x000E0000
 
 #endif /* __HVMLOADER_CONFIG_SEABIOS_H__ */
diff -r cdc873250db2 -r 253a38db096b tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h Tue May 31 17:31:28 2011 +0100
+++ b/tools/firmware/hvmloader/config.h Wed Jun 01 09:17:55 2011 +0100
@@ -19,7 +19,8 @@ struct bios_config {
     /* SMBIOS */
     unsigned int smbios_start, smbios_end;
 
-    /* Option ROMs */
+    /* ROMS */
+    int load_roms;
     unsigned int optionrom_start, optionrom_end;
 
     /* ACPI tables */
diff -r cdc873250db2 -r 253a38db096b tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Tue May 31 17:31:28 2011 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c      Wed Jun 01 09:17:55 2011 +0100
@@ -373,7 +373,7 @@ 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;
+    uint32_t etherboot_phys_addr = 0, option_rom_phys_addr = 0;
 
     /* Initialise hypercall stubs with RET, rendering them no-ops. */
     memset((void *)HYPERCALL_PHYSICAL_ADDRESS, 0xc3 /* RET */, PAGE_SIZE);
@@ -417,40 +417,43 @@ int main(void)
          ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode ) )
         bios->create_mp_tables();
 
-    switch ( virtual_vga )
+    if ( bios->load_roms )
     {
-    case VGA_cirrus:
-        printf("Loading Cirrus VGABIOS ...\n");
-        memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
-               vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
-        vgabios_sz = round_option_rom(sizeof(vgabios_cirrusvga));
-        break;
-    case VGA_std:
-        printf("Loading Standard VGABIOS ...\n");
-        memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
-               vgabios_stdvga, sizeof(vgabios_stdvga));
-        vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
-        break;
-    case VGA_pt:
-        printf("Loading VGABIOS of passthroughed gfx ...\n");
-        vgabios_sz =
-            round_option_rom((*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 512);
-        break;
-    default:
-        printf("No emulated VGA adaptor ...\n");
-        break;
+        switch ( virtual_vga )
+        {
+        case VGA_cirrus:
+            printf("Loading Cirrus VGABIOS ...\n");
+            memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+                   vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
+            vgabios_sz = round_option_rom(sizeof(vgabios_cirrusvga));
+            break;
+        case VGA_std:
+            printf("Loading Standard VGABIOS ...\n");
+            memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
+                   vgabios_stdvga, sizeof(vgabios_stdvga));
+            vgabios_sz = round_option_rom(sizeof(vgabios_stdvga));
+            break;
+        case VGA_pt:
+            printf("Loading VGABIOS of passthroughed gfx ...\n");
+            vgabios_sz =
+                round_option_rom((*(uint8_t *)(VGABIOS_PHYSICAL_ADDRESS+2)) * 
512);
+            break;
+        default:
+            printf("No emulated VGA adaptor ...\n");
+            break;
+        }
+
+        etherboot_phys_addr = VGABIOS_PHYSICAL_ADDRESS + vgabios_sz;
+        if ( etherboot_phys_addr < bios->optionrom_start )
+            etherboot_phys_addr = bios->optionrom_start;
+        etherboot_sz = scan_etherboot_nic(bios->optionrom_end,
+                                          etherboot_phys_addr);
+
+        option_rom_phys_addr = etherboot_phys_addr + etherboot_sz;
+        option_rom_sz = pci_load_option_roms(bios->optionrom_end,
+                                             option_rom_phys_addr);
     }
 
-    etherboot_phys_addr = VGABIOS_PHYSICAL_ADDRESS + vgabios_sz;
-    if ( etherboot_phys_addr < bios->optionrom_start )
-        etherboot_phys_addr = bios->optionrom_start;
-    etherboot_sz = scan_etherboot_nic(bios->optionrom_end,
-                                      etherboot_phys_addr);
-
-    option_rom_phys_addr = etherboot_phys_addr + etherboot_sz;
-    option_rom_sz = pci_load_option_roms(bios->optionrom_end,
-                                         option_rom_phys_addr);
-
     if ( hvm_info->acpi_enabled )
     {
         struct xen_hvm_param p = {
diff -r cdc873250db2 -r 253a38db096b tools/firmware/hvmloader/rombios.c
--- a/tools/firmware/hvmloader/rombios.c        Tue May 31 17:31:28 2011 +0100
+++ b/tools/firmware/hvmloader/rombios.c        Wed Jun 01 09:17:55 2011 +0100
@@ -372,6 +372,8 @@ struct bios_config rombios_config =  {
     .smbios_start = SMBIOS_PHYSICAL_ADDRESS,
     .smbios_end = SMBIOS_PHYSICAL_END,
 
+    .load_roms = 1,
+
     .optionrom_start = OPTIONROM_PHYSICAL_ADDRESS,
     .optionrom_end = OPTIONROM_PHYSICAL_END,
 
diff -r cdc873250db2 -r 253a38db096b tools/firmware/hvmloader/seabios.c
--- a/tools/firmware/hvmloader/seabios.c        Tue May 31 17:31:28 2011 +0100
+++ b/tools/firmware/hvmloader/seabios.c        Wed Jun 01 09:17:55 2011 +0100
@@ -46,8 +46,10 @@ struct bios_config seabios_config = {
     .smbios_start = 0,
     .smbios_end = 0,
 
-    .optionrom_start = OPTIONROM_PHYSICAL_ADDRESS,
-    .optionrom_end = OPTIONROM_PHYSICAL_END,
+    .load_roms = 0,
+
+    .optionrom_start = 0,
+    .optionrom_end = 0,
 
     .acpi_start = 0,
 

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