# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1217340658 -3600
# Node ID a538185695edbd22b74338afd0683607baa93dd8
# Parent b0ee5e8613e9b9ee2d331cfa045d68353ceafb45
hvmloader: Load ACPI tables outside BIOS area, so they are writable by
OSPM (particularly the S3 firmware_waking_vector).
TODO: rombios must enter protected mode to fetch the vector on S3 resume.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
tools/firmware/hvmloader/acpi/acpi2_0.h | 2 -
tools/firmware/hvmloader/acpi/build.c | 41 ++++++++++++++++++++++++++++----
tools/firmware/hvmloader/hvmloader.c | 9 +------
tools/firmware/hvmloader/util.h | 2 +
4 files changed, 42 insertions(+), 12 deletions(-)
diff -r b0ee5e8613e9 -r a538185695ed tools/firmware/hvmloader/acpi/acpi2_0.h
--- a/tools/firmware/hvmloader/acpi/acpi2_0.h Tue Jul 29 13:27:29 2008 +0100
+++ b/tools/firmware/hvmloader/acpi/acpi2_0.h Tue Jul 29 15:10:58 2008 +0100
@@ -381,7 +381,7 @@ struct acpi_20_madt_intsrcovr {
#pragma pack ()
-int acpi_build_tables(uint8_t *);
+void acpi_build_tables(void);
#endif /* _ACPI_2_0_H_ */
diff -r b0ee5e8613e9 -r a538185695ed tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c Tue Jul 29 13:27:29 2008 +0100
+++ b/tools/firmware/hvmloader/acpi/build.c Tue Jul 29 15:10:58 2008 +0100
@@ -248,8 +248,7 @@ static int construct_secondary_tables(ui
return align16(offset);
}
-/* Copy all the ACPI table to buffer. */
-int acpi_build_tables(uint8_t *buf)
+static void __acpi_build_tables(uint8_t *buf, int *low_sz, int *high_sz)
{
struct acpi_20_rsdp *rsdp;
struct acpi_20_rsdt *rsdt;
@@ -261,7 +260,9 @@ int acpi_build_tables(uint8_t *buf)
unsigned long secondary_tables[16];
int offset = 0, i;
- offset += construct_bios_info_table(&buf[offset]);
+ /*
+ * Fill in high-memory data structures, starting at @buf.
+ */
facs = (struct acpi_20_facs *)&buf[offset];
memcpy(facs, &Facs, sizeof(struct acpi_20_facs));
@@ -325,7 +326,18 @@ int acpi_build_tables(uint8_t *buf)
offsetof(struct acpi_header, checksum),
rsdt->header.length);
+ *high_sz = offset;
+
+ /*
+ * Fill in low-memory data structures: bios_info_table and RSDP.
+ */
+
+ buf = (uint8_t *)ACPI_PHYSICAL_ADDRESS;
+ offset = 0;
+
+ offset += construct_bios_info_table(&buf[offset]);
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;
@@ -337,7 +349,28 @@ int acpi_build_tables(uint8_t *buf)
offsetof(struct acpi_20_rsdp, extended_checksum),
sizeof(struct acpi_20_rsdp));
- return offset;
+ *low_sz = offset;
+}
+
+void acpi_build_tables(void)
+{
+ 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);
+ memset(buf, 0, high_sz);
+
+ /* Allocate data area and set up ACPI tables there. */
+ buf = (uint8_t *)e820_malloc(high_sz);
+ __acpi_build_tables(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,
+ (unsigned long)buf, (unsigned long)buf + high_sz - 1);
}
/*
diff -r b0ee5e8613e9 -r a538185695ed tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c Tue Jul 29 13:27:29 2008 +0100
+++ b/tools/firmware/hvmloader/hvmloader.c Tue Jul 29 15:10:58 2008 +0100
@@ -449,7 +449,7 @@ static void init_xen_platform_io_base(vo
int main(void)
{
- int acpi_sz = 0, vgabios_sz = 0, etherboot_sz = 0, rombios_sz, smbios_sz;
+ int vgabios_sz = 0, etherboot_sz = 0, rombios_sz, smbios_sz;
int extboot_sz = 0;
printf("HVM Loader\n");
@@ -508,8 +508,7 @@ int main(void)
if ( get_acpi_enabled() )
{
printf("Loading ACPI ...\n");
- acpi_sz = acpi_build_tables((uint8_t *)ACPI_PHYSICAL_ADDRESS);
- ASSERT((ACPI_PHYSICAL_ADDRESS + acpi_sz) <= 0xF0000);
+ acpi_build_tables();
}
cmos_write_memory_size();
@@ -531,10 +530,6 @@ int main(void)
printf(" %05x-%05x: SMBIOS tables\n",
SMBIOS_PHYSICAL_ADDRESS,
SMBIOS_PHYSICAL_ADDRESS + smbios_sz - 1);
- if ( acpi_sz )
- printf(" %05x-%05x: ACPI tables\n",
- ACPI_PHYSICAL_ADDRESS,
- ACPI_PHYSICAL_ADDRESS + acpi_sz - 1);
if ( rombios_sz )
printf(" %05x-%05x: Main BIOS\n",
ROMBIOS_PHYSICAL_ADDRESS,
diff -r b0ee5e8613e9 -r a538185695ed tools/firmware/hvmloader/util.h
--- a/tools/firmware/hvmloader/util.h Tue Jul 29 13:27:29 2008 +0100
+++ b/tools/firmware/hvmloader/util.h Tue Jul 29 15:10:58 2008 +0100
@@ -145,4 +145,6 @@ void smp_initialise(void);
#define isdigit(c) ((c) >= '0' && (c) <= '9')
+extern char _start[], _end[];
+
#endif /* __HVMLOADER_UTIL_H__ */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|