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

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



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1302013751 -3600
# Node ID 825d013970ad7cb68b0aa6749cc501e70e14a871
# Parent  3cd3a30c371ac37caf37cb19033ea44a51469f89
tools: hvmloader: pass SMBIOS location as a runtime parameter.

Instead of hardcoding in a header.

Reduces the number of files which will need to be multiply-compiled.

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

diff -r 3cd3a30c371a -r 825d013970ad tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Tue Apr 05 15:29:11 2011 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c      Tue Apr 05 15:29:11 2011 +0100
@@ -718,7 +718,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_MAXIMUM_SIZE);
 
     printf("Loading ROMBIOS ...\n");
     rombios_sz = sizeof(rombios);
diff -r 3cd3a30c371a -r 825d013970ad tools/firmware/hvmloader/smbios.c
--- a/tools/firmware/hvmloader/smbios.c Tue Apr 05 15:29:11 2011 +0100
+++ b/tools/firmware/hvmloader/smbios.c Tue Apr 05 15:29:11 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, unsigned 
long max)
 {
     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,
                               hvm_info->nr_vcpus, get_memsize(),
                               uuid, xen_version_str,
                               xen_major_version, xen_minor_version);
-    if ( len > SMBIOS_MAXIMUM_SIZE )
+    if ( len > max )
         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, (void *)scratch, len);
 
     return len;
 
diff -r 3cd3a30c371a -r 825d013970ad tools/firmware/hvmloader/util.h
--- a/tools/firmware/hvmloader/util.h   Tue Apr 05 15:29:11 2011 +0100
+++ b/tools/firmware/hvmloader/util.h   Tue Apr 05 15:29:11 2011 +0100
@@ -186,7 +186,8 @@ 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,
+                           unsigned long max);
 void smp_initialise(void);
 
 #ifndef NDEBUG

_______________________________________________
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®.