[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 04 of 19] tools: hvmloader: pass SMBIOS location as a runtime parameter



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1302599695 -3600
# Node ID 73653e949dbef093ddd72fa527e00aa3fea854c4
# Parent  b29f772657190d609c4f5df250f1ec1c9e87a972
tools: hvmloader: pass SMBIOS location as a runtime parameter.

Instead of hardcoding in a header.

Reduces the cross talk between ROMBIOS and hvmloader.

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

diff -r b29f77265719 -r 73653e949dbe tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Tue Apr 12 10:00:30 2011 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c      Tue Apr 12 10:14:55 2011 +0100
@@ -599,7 +599,9 @@ int main(void)
     perform_tests();
 
     printf("Writing SMBIOS tables ...\n");
-    smbios_sz = hvm_write_smbios_tables();
+    smbios_sz = hvm_write_smbios_tables(SCRATCH_PHYSICAL_ADDRESS,
+                                        SMBIOS_PHYSICAL_ADDRESS,
+                                        SMBIOS_PHYSICAL_END);
 
     printf("Loading ROMBIOS ...\n");
     rombios_sz = sizeof(rombios);
diff -r b29f77265719 -r 73653e949dbe tools/firmware/hvmloader/smbios.c
--- a/tools/firmware/hvmloader/smbios.c Tue Apr 12 10:00:30 2011 +0100
+++ b/tools/firmware/hvmloader/smbios.c Tue Apr 12 10:14:55 2011 +0100
@@ -28,7 +28,7 @@
 #include "hypercall.h"
 
 static int
-write_smbios_tables(void *start,
+write_smbios_tables(void *start, unsigned long phys,
                     uint32_t vcpus, uint64_t memsize,
                     uint8_t uuid[16], char *xen_version,
                     uint32_t xen_major_version, uint32_t xen_minor_version);
@@ -85,7 +85,7 @@ get_cpu_manufacturer(char *buf, int len)
 }
 
 static int
-write_smbios_tables(void *start,
+write_smbios_tables(void *start, unsigned long phys,
                     uint32_t vcpus, uint64_t memsize,
                     uint8_t uuid[16], char *xen_version,
                     uint32_t xen_major_version, uint32_t xen_minor_version)
@@ -136,7 +136,7 @@ write_smbios_tables(void *start,
     smbios_entry_point_init(
         start, max_struct_size,
         (p - (char *)start) - sizeof(struct smbios_entry_point),
-        SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
+        phys + sizeof(struct smbios_entry_point),
         nr_structs);
 
     return ((char *)p - (char *)start);
@@ -162,7 +162,7 @@ get_memsize(void)
 }
 
 int
-hvm_write_smbios_tables(void)
+hvm_write_smbios_tables(unsigned long scratch, unsigned long smbios_start, 
unsigned long smbios_end)
 {
     xen_domain_handle_t uuid;
     uint16_t xen_major_version, xen_minor_version;
@@ -222,15 +222,14 @@ hvm_write_smbios_tables(void)
     xen_version_str[sizeof(xen_version_str)-1] = '\0';
 
     /* SCRATCH_PHYSICAL_ADDRESS is a safe large memory area for scratch. */
-    len = write_smbios_tables((void *)SCRATCH_PHYSICAL_ADDRESS,
+    len = write_smbios_tables((void *)scratch, smbios_start,
                               hvm_info->nr_vcpus, get_memsize(),
                               uuid, xen_version_str,
                               xen_major_version, xen_minor_version);
-    if ( len > SMBIOS_MAXIMUM_SIZE )
+    if ( smbios_start + len > smbios_end )
         goto error_out;
     /* Okay, not too large: copy out of scratch to final location. */
-    memcpy((void *)SMBIOS_PHYSICAL_ADDRESS,
-           (void *)SCRATCH_PHYSICAL_ADDRESS, len);
+    memcpy((void *)smbios_start, (void *)scratch, len);
 
     return len;
 
diff -r b29f77265719 -r 73653e949dbe tools/firmware/hvmloader/util.h
--- a/tools/firmware/hvmloader/util.h   Tue Apr 12 10:00:30 2011 +0100
+++ b/tools/firmware/hvmloader/util.h   Tue Apr 12 10:14:55 2011 +0100
@@ -186,7 +186,9 @@ uint32_t highbios_setup(void);
 /* Miscellaneous. */
 void cacheattr_init(void);
 void create_mp_tables(void);
-int hvm_write_smbios_tables(void);
+int hvm_write_smbios_tables(unsigned long scratch,
+                           unsigned long smbios_start,
+                           unsigned long smbios_end);
 void smp_initialise(void);
 
 #include "e820.h"
diff -r b29f77265719 -r 73653e949dbe tools/firmware/rombios/config.h
--- a/tools/firmware/rombios/config.h   Tue Apr 12 10:00:30 2011 +0100
+++ b/tools/firmware/rombios/config.h   Tue Apr 12 10:14:55 2011 +0100
@@ -11,7 +11,8 @@
 #define ACPI_PHYSICAL_ADDRESS         0x000EA020
 #define E820_PHYSICAL_ADDRESS         0x000EA100
 #define SMBIOS_PHYSICAL_ADDRESS       0x000EB000
-#define SMBIOS_MAXIMUM_SIZE           0x00005000
+#define SMBIOS_PHYSICAL_END           0x000F0000
+
 #define ROMBIOS_PHYSICAL_ADDRESS      0x000F0000
 
 /* Offsets from E820_PHYSICAL_ADDRESS. */

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.