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 14 of 19] tools: hvmloader: Refactor VM86 and E820 setup into struct bios_config
Date: Tue, 12 Apr 2011 12:29:13 +0100	[thread overview]
Message-ID: <31e9da762b1ebd22b5ed.1302607753@localhost.localdomain> (raw)
In-Reply-To: <patchbomb.1302607739@localhost.localdomain>

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1302602711 -3600
# Node ID 31e9da762b1ebd22b5ed68d3a15ea56f4a41d63c
# Parent  99d1e52175a3d7770ab0cfe286133cf84954cf8d
tools: hvmloader: Refactor VM86 and E820 setup into struct bios_config

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

diff -r 99d1e52175a3 -r 31e9da762b1e tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h	Tue Apr 12 10:56:46 2011 +0100
+++ b/tools/firmware/hvmloader/config.h	Tue Apr 12 11:05:11 2011 +0100
@@ -31,6 +31,9 @@ struct bios_config {
 
     uint32_t (*bios_high_setup)(void);
     void (*bios_info_setup)(uint32_t);
+
+    void (*vm86_setup)(void);
+    void (*e820_setup)(void);
 };
 
 extern struct bios_config rombios_config;
@@ -62,9 +65,6 @@ extern unsigned long pci_mem_start, pci_
 #define ROMBIOS_MAXOFFSET      0x0000FFFF
 #define ROMBIOS_END            (ROMBIOS_BEGIN + ROMBIOS_SIZE)
 
-#include "e820.h"
-#include "../rombios/config.h"
-
 #define SCRATCH_PHYSICAL_ADDRESS      0x00010000
 #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
 
diff -r 99d1e52175a3 -r 31e9da762b1e tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c	Tue Apr 12 10:56:46 2011 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c	Tue Apr 12 11:05:11 2011 +0100
@@ -338,24 +338,6 @@ static void cmos_write_memory_size(void)
     cmos_outb(0x35, (uint8_t)( alt_mem >> 8));
 }
 
-/*
- * Set up an empty TSS area for virtual 8086 mode to use. 
- * The only important thing is that it musn't have any bits set 
- * in the interrupt redirection bitmap, so all zeros will do.
- */
-static void init_vm86_tss(void)
-{
-    void *tss;
-    struct xen_hvm_param p;
-
-    tss = mem_alloc(128, 128);
-    memset(tss, 0, 128);
-    p.domid = DOMID_SELF;
-    p.index = HVM_PARAM_VM86_TSS;
-    p.value = virt_to_phys(tss);
-    hypercall_hvm_op(HVMOP_set_param, &p);
-    printf("vm86 TSS at %08lx\n", virt_to_phys(tss));
-}
 
 static const struct bios_config *detect_bios(void)
 {
@@ -454,7 +436,8 @@ int main(void)
         hypercall_hvm_op(HVMOP_set_param, &p);
     }
 
-    init_vm86_tss();
+    if (bios->vm86_setup)
+        bios->vm86_setup();
 
     cmos_write_memory_size();
 
@@ -479,8 +462,8 @@ int main(void)
            bios->bios_address,
            bios->bios_address + bios->image_size - 1);
 
-    *E820_NR = build_e820_table(E820);
-    dump_e820_table(E820, *E820_NR);
+    if (bios->e820_setup)
+        bios->e820_setup();
 
     if (bios->bios_info_setup)
         bios->bios_info_setup(highbios);
diff -r 99d1e52175a3 -r 31e9da762b1e tools/firmware/hvmloader/rombios.c
--- a/tools/firmware/hvmloader/rombios.c	Tue Apr 12 10:56:46 2011 +0100
+++ b/tools/firmware/hvmloader/rombios.c	Tue Apr 12 11:05:11 2011 +0100
@@ -30,12 +30,38 @@
 #include "util.h"
 #include "hypercall.h"
 
+#include <xen/hvm/params.h>
 #include <xen/hvm/ioreq.h>
 #include <xen/memory.h>
 
 #define ROM_INCLUDE_ROMBIOS
 #include "roms.inc"
 
+/*
+ * Set up an empty TSS area for virtual 8086 mode to use. 
+ * The only important thing is that it musn't have any bits set 
+ * in the interrupt redirection bitmap, so all zeros will do.
+ */
+static void rombios_init_vm86_tss(void)
+{
+    void *tss;
+    struct xen_hvm_param p;
+
+    tss = mem_alloc(128, 128);
+    memset(tss, 0, 128);
+    p.domid = DOMID_SELF;
+    p.index = HVM_PARAM_VM86_TSS;
+    p.value = virt_to_phys(tss);
+    hypercall_hvm_op(HVMOP_set_param, &p);
+    printf("vm86 TSS at %08lx\n", virt_to_phys(tss));
+}
+
+static void rombios_setup_e820(void)
+{
+    *E820_NR = build_e820_table(E820);
+    dump_e820_table(E820, *E820_NR);
+}
+
 static void rombios_setup_bios_info(uint32_t bioshigh)
 {
     struct bios_info *bios_info;
@@ -301,6 +327,9 @@ struct bios_config rombios_config =  {
 
     .bios_high_setup = rombios_highbios_setup,
     .bios_info_setup = rombios_setup_bios_info,
+
+    .vm86_setup = rombios_init_vm86_tss,
+    .e820_setup = rombios_setup_e820,
 };
 
 /*

  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 ` [PATCH 13 of 19] tools: hvmloader: refactor highbios and bios_info " Ian Campbell
2011-04-12 11:29 ` Ian Campbell [this message]
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=31e9da762b1ebd22b5ed.1302607753@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).