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

[Xen-devel] [PATCH 03 of 11] tools: hvmloader: pass ACPI_PHYSICAL_ADDRESS as a runtime parameter



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1302013751 -3600
# Node ID 3cd3a30c371ac37caf37cb19033ea44a51469f89
# Parent  13625a078b2a757662c5d89737cefab11247e270
tools: hvmloader: pass ACPI_PHYSICAL_ADDRESS 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 13625a078b2a -r 3cd3a30c371a tools/firmware/hvmloader/acpi/acpi2_0.h
--- a/tools/firmware/hvmloader/acpi/acpi2_0.h   Tue Apr 05 15:29:11 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/acpi2_0.h   Tue Apr 05 15:29:11 2011 +0100
@@ -382,7 +382,10 @@ struct acpi_20_madt_intsrcovr {
 
 #pragma pack ()
 
-void acpi_build_tables(void);
+struct acpi_parameters {
+    unsigned long phys;
+};
+void acpi_build_tables(const struct acpi_parameters *params);
 extern uint32_t madt_csum_addr, madt_lapic0_addr;
 
 #endif /* _ACPI_2_0_H_ */
diff -r 13625a078b2a -r 3cd3a30c371a tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c     Tue Apr 05 15:29:11 2011 +0100
+++ b/tools/firmware/hvmloader/acpi/build.c     Tue Apr 05 15:29:11 2011 +0100
@@ -242,7 +242,9 @@ static int construct_secondary_tables(ui
     return align16(offset);
 }
 
-static void __acpi_build_tables(uint8_t *buf, int *low_sz, int *high_sz)
+static void __acpi_build_tables(const struct acpi_parameters *params,
+                                uint8_t *buf,
+                                int *low_sz, int *high_sz)
 {
     struct acpi_20_rsdp *rsdp;
     struct acpi_20_rsdt *rsdt;
@@ -335,11 +337,11 @@ static void __acpi_build_tables(uint8_t 
     /*
      * Fill in low-memory data structures: bios_info_table and RSDP.
      */
-
-    buf = (uint8_t *)ACPI_PHYSICAL_ADDRESS;
+    buf = (uint8_t *)params->phys;
     offset = 0;
 
     rsdp = (struct acpi_20_rsdp *)&buf[offset];
+
     memcpy(rsdp, &Rsdp, sizeof(struct acpi_20_rsdp));
     offset += align16(sizeof(struct acpi_20_rsdp));
     rsdp->rsdt_address = (unsigned long)rsdt;
@@ -354,24 +356,23 @@ static void __acpi_build_tables(uint8_t 
     *low_sz = offset;
 }
 
-void acpi_build_tables(void)
+void acpi_build_tables(const struct acpi_parameters *params)
 {
     int high_sz, low_sz;
     uint8_t *buf;
 
     /* Find out size of high-memory ACPI data area. */
     buf = (uint8_t *)&_end;
-    __acpi_build_tables(buf, &low_sz, &high_sz);
+    __acpi_build_tables(params, buf, &low_sz, &high_sz);
     memset(buf, 0, high_sz);
 
     /* Allocate data area and set up ACPI tables there. */
     buf = mem_alloc(high_sz, 0);
-    __acpi_build_tables(buf, &low_sz, &high_sz);
+    __acpi_build_tables(params, buf, &low_sz, &high_sz);
 
     printf(" - Lo data: %08lx-%08lx\n"
            " - Hi data: %08lx-%08lx\n",
-           (unsigned long)ACPI_PHYSICAL_ADDRESS,
-           (unsigned long)ACPI_PHYSICAL_ADDRESS + low_sz - 1,
+           params->phys, params->phys + low_sz - 1,
            (unsigned long)buf, (unsigned long)buf + high_sz - 1);
 }
 
diff -r 13625a078b2a -r 3cd3a30c371a 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
@@ -769,9 +769,12 @@ int main(void)
             .index = HVM_PARAM_ACPI_IOPORTS_LOCATION,
             .value = 1,
         };
+        struct acpi_parameters acpi_params = {
+            .phys = ACPI_PHYSICAL_ADDRESS,
+        };
 
         printf("Loading ACPI ...\n");
-        acpi_build_tables();
+        acpi_build_tables(&acpi_params);
         hypercall_hvm_op(HVMOP_set_param, &p);
     }
 

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