aboutsummaryrefslogtreecommitdiffstats
path: root/tools/firmware
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2011-06-03 17:22:51 +0100
committerIan Campbell <ian.campbell@citrix.com>2011-06-03 17:22:51 +0100
commitd22b23ec117a585c1ace3c9f1ac28ebb59dda306 (patch)
tree24b396e7e0084796a4c033aa50abbad5e2220a66 /tools/firmware
parent967ea77fcba73f8712b22329ce257153378720a3 (diff)
downloadxen-d22b23ec117a585c1ace3c9f1ac28ebb59dda306.tar.gz
xen-d22b23ec117a585c1ace3c9f1ac28ebb59dda306.tar.bz2
xen-d22b23ec117a585c1ace3c9f1ac28ebb59dda306.zip
hvmloader: reinstate datastructure shared with DSDT in SeaBIOS case.
I mistakenly thought that the "struct bios_info" was a ROMBIOS specific data structure and so caused it to be populated only in the ROMBIOS case. However it turns out that the majority of the struct's fields are actually referenced from the ACPI DSDT and hence are needed for SeaBIOS too. While in principal it might have been possible to continue to mix ROMBIOS and ACPI bits in this datastructure this is, evidently, confusing but also leads to header file dependencies from ROMBIOS->hvmloader which I had been hoping to avoid so as to head-off future accidental re-entanglement of ROMBIOS and hvmloader. So instead I have split the ACPI parts into a new "struct acpi_info" which is defined entirely within the acpi building code in hvmloader and which comes with a big comment pointing to the DSDT interaction. This new ACPI info is placed at 0x9F000 which is available under both ROMBIOS and SeaBIOS. This address is in a reserved region of the E820 and is just above the ROMBIOS stack. The resulting "struct rombios_info" is hardly worthy of its own structure but keep it anyway. Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/firmware')
-rw-r--r--tools/firmware/hvmloader/acpi/acpi2_0.h1
-rw-r--r--tools/firmware/hvmloader/acpi/build.c42
-rw-r--r--tools/firmware/hvmloader/acpi/dsdt.asl4
-rw-r--r--tools/firmware/hvmloader/config.h1
-rw-r--r--tools/firmware/hvmloader/rombios.c31
-rw-r--r--tools/firmware/rombios/config.h13
6 files changed, 46 insertions, 46 deletions
diff --git a/tools/firmware/hvmloader/acpi/acpi2_0.h b/tools/firmware/hvmloader/acpi/acpi2_0.h
index 19f3cc339d..324cd43e38 100644
--- a/tools/firmware/hvmloader/acpi/acpi2_0.h
+++ b/tools/firmware/hvmloader/acpi/acpi2_0.h
@@ -378,7 +378,6 @@ struct acpi_20_madt_intsrcovr {
#pragma pack ()
void acpi_build_tables(unsigned int physical);
-extern uint32_t madt_csum_addr, madt_lapic0_addr;
#endif /* _ACPI_2_0_H_ */
diff --git a/tools/firmware/hvmloader/acpi/build.c b/tools/firmware/hvmloader/acpi/build.c
index a9c1e52785..5e3198420b 100644
--- a/tools/firmware/hvmloader/acpi/build.c
+++ b/tools/firmware/hvmloader/acpi/build.c
@@ -25,9 +25,6 @@
#define align16(sz) (((sz) + 15) & ~15)
#define fixed_strcpy(d, s) strncpy((d), (s), sizeof(d))
-/* MADT parameters for filling in bios_info structure for DSDT. */
-uint32_t madt_csum_addr, madt_lapic0_addr;
-
extern struct acpi_20_rsdp Rsdp;
extern struct acpi_20_rsdt Rsdt;
extern struct acpi_20_xsdt Xsdt;
@@ -35,6 +32,21 @@ extern struct acpi_20_fadt Fadt;
extern struct acpi_20_facs Facs;
/*
+ * Located at ACPI_INFO_PHYSICAL_ADDRESS.
+ *
+ * This must match the Field("BIOS"....) definition in the DSDT.
+ */
+struct acpi_info {
+ uint8_t com1_present:1; /* 0[0] - System has COM1? */
+ uint8_t com2_present:1; /* 0[1] - System has COM2? */
+ uint8_t lpt1_present:1; /* 0[2] - System has LPT1? */
+ uint8_t hpet_present:1; /* 0[3] - System has HPET? */
+ uint32_t pci_min, pci_len; /* 4, 8 - PCI I/O hole boundaries */
+ uint32_t madt_csum_addr; /* 12 - Address of MADT checksum */
+ uint32_t madt_lapic0_addr; /* 16 - Address of first MADT LAPIC struct */
+};
+
+/*
* Alternative DSDTs we get linked against. A cover-all DSDT for up to the
* implementation-defined maximum number of VCPUs, and an alternative for use
* when a guest can only have up to 15 VCPUs.
@@ -68,7 +80,7 @@ static uint8_t battery_port_exists(void)
return (inb(0x88) == 0x1F);
}
-static struct acpi_20_madt *construct_madt(void)
+static struct acpi_20_madt *construct_madt(struct acpi_info *info)
{
struct acpi_20_madt *madt;
struct acpi_20_madt_intsrcovr *intsrcovr;
@@ -132,7 +144,7 @@ static struct acpi_20_madt *construct_madt(void)
io_apic->ioapic_addr = IOAPIC_BASE_ADDRESS;
lapic = (struct acpi_20_madt_lapic *)(io_apic + 1);
- madt_lapic0_addr = (uint32_t)lapic;
+ info->madt_lapic0_addr = (uint32_t)lapic;
for ( i = 0; i < nr_processor_objects; i++ )
{
memset(lapic, 0, sizeof(*lapic));
@@ -150,7 +162,7 @@ static struct acpi_20_madt *construct_madt(void)
madt->header.length = (unsigned char *)lapic - (unsigned char *)madt;
set_checksum(madt, offsetof(struct acpi_header, checksum),
madt->header.length);
- madt_csum_addr = (uint32_t)&madt->header.checksum;
+ info->madt_csum_addr = (uint32_t)&madt->header.checksum;
return madt;
}
@@ -179,7 +191,8 @@ static struct acpi_20_hpet *construct_hpet(void)
return hpet;
}
-static int construct_secondary_tables(unsigned long *table_ptrs)
+static int construct_secondary_tables(unsigned long *table_ptrs,
+ struct acpi_info *info)
{
int nr_tables = 0;
struct acpi_20_madt *madt;
@@ -193,7 +206,7 @@ static int construct_secondary_tables(unsigned long *table_ptrs)
/* MADT. */
if ( (hvm_info->nr_vcpus > 1) || hvm_info->apic_mode )
{
- madt = construct_madt();
+ madt = construct_madt(info);
if (!madt) return -1;
table_ptrs[nr_tables++] = (unsigned long)madt;
}
@@ -253,6 +266,7 @@ static int construct_secondary_tables(unsigned long *table_ptrs)
void acpi_build_tables(unsigned int physical)
{
+ struct acpi_info *acpi_info = (struct acpi_info *)ACPI_INFO_PHYSICAL_ADDRESS;
struct acpi_20_rsdp *rsdp;
struct acpi_20_rsdt *rsdt;
struct acpi_20_xsdt *xsdt;
@@ -316,7 +330,7 @@ void acpi_build_tables(unsigned int physical)
offsetof(struct acpi_header, checksum),
sizeof(struct acpi_20_fadt));
- nr_secondaries = construct_secondary_tables(secondary_tables);
+ nr_secondaries = construct_secondary_tables(secondary_tables, acpi_info);
if ( nr_secondaries < 0 )
goto oom;
@@ -347,7 +361,7 @@ void acpi_build_tables(unsigned int physical)
rsdt->header.length);
/*
- * Fill in low-memory data structures: bios_info_table and RSDP.
+ * Fill in low-memory data structures: acpi_info and RSDP.
*/
rsdp = (struct acpi_20_rsdp *)physical;
@@ -361,6 +375,14 @@ void acpi_build_tables(unsigned int physical)
offsetof(struct acpi_20_rsdp, extended_checksum),
sizeof(struct acpi_20_rsdp));
+ memset(acpi_info, 0, sizeof(*acpi_info));
+ acpi_info->com1_present = uart_exists(0x3f8);
+ acpi_info->com2_present = uart_exists(0x2f8);
+ acpi_info->lpt1_present = lpt_exists(0x378);
+ acpi_info->hpet_present = hpet_exists(ACPI_HPET_ADDRESS);
+ acpi_info->pci_min = pci_mem_start;
+ acpi_info->pci_len = pci_mem_end - pci_mem_start;
+
return;
oom:
diff --git a/tools/firmware/hvmloader/acpi/dsdt.asl b/tools/firmware/hvmloader/acpi/dsdt.asl
index ea8e324ddb..1bcee86151 100644
--- a/tools/firmware/hvmloader/acpi/dsdt.asl
+++ b/tools/firmware/hvmloader/acpi/dsdt.asl
@@ -61,8 +61,8 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
Scope (\_SB)
{
- /* BIOS_INFO_PHYSICAL_ADDRESS == 0xEA000 */
- OperationRegion(BIOS, SystemMemory, 0xEA000, 24)
+ /* ACPI_INFO_PHYSICAL_ADDRESS == 0x9F000 */
+ OperationRegion(BIOS, SystemMemory, 0x9F000, 24)
Field(BIOS, ByteAcc, NoLock, Preserve) {
UAR1, 1,
UAR2, 1,
diff --git a/tools/firmware/hvmloader/config.h b/tools/firmware/hvmloader/config.h
index 6b3d35a987..d916442ce3 100644
--- a/tools/firmware/hvmloader/config.h
+++ b/tools/firmware/hvmloader/config.h
@@ -62,6 +62,7 @@ extern unsigned long pci_mem_start, pci_mem_end;
/* Memory map. */
#define SCRATCH_PHYSICAL_ADDRESS 0x00010000
#define HYPERCALL_PHYSICAL_ADDRESS 0x00080000
+#define ACPI_INFO_PHYSICAL_ADDRESS 0x0009F000
#define VGABIOS_PHYSICAL_ADDRESS 0x000C0000
#define HVMLOADER_PHYSICAL_ADDRESS 0x00100000
diff --git a/tools/firmware/hvmloader/rombios.c b/tools/firmware/hvmloader/rombios.c
index 1ebe995af9..137167386d 100644
--- a/tools/firmware/hvmloader/rombios.c
+++ b/tools/firmware/hvmloader/rombios.c
@@ -67,36 +67,21 @@ static void rombios_setup_e820(void)
static void rombios_setup_bios_info(void)
{
- struct bios_info *bios_info;
-
- bios_info = (struct bios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
- memset(bios_info, 0, sizeof(*bios_info));
- bios_info->com1_present = uart_exists(0x3f8);
- bios_info->com2_present = uart_exists(0x2f8);
- bios_info->lpt1_present = lpt_exists(0x378);
- bios_info->hpet_present = hpet_exists(ACPI_HPET_ADDRESS);
- bios_info->madt_csum_addr = madt_csum_addr;
- bios_info->madt_lapic0_addr = madt_lapic0_addr;
+ struct rombios_info *info;
+
+ info = (struct rombios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
+ memset(info, 0, sizeof(*info));
}
static void rombios_relocate(void)
{
uint32_t bioshigh;
- struct bios_info *bios_info;
+ struct rombios_info *info;
bioshigh = rombios_highbios_setup();
- bios_info = (struct bios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
- bios_info->bios32_entry = bioshigh;
-}
-
-static void rombios_finish_bios_info(void)
-{
- struct bios_info *bios_info;
-
- bios_info = (struct bios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
- bios_info->pci_min = pci_mem_start;
- bios_info->pci_len = pci_mem_end - pci_mem_start;
+ info = (struct rombios_info *)BIOS_INFO_PHYSICAL_ADDRESS;
+ info->bios32_entry = bioshigh;
}
/*
@@ -177,7 +162,7 @@ struct bios_config rombios_config = {
.optionrom_end = OPTIONROM_PHYSICAL_END,
.bios_info_setup = rombios_setup_bios_info,
- .bios_info_finish = rombios_finish_bios_info,
+ .bios_info_finish = NULL,
.bios_relocate = rombios_relocate,
diff --git a/tools/firmware/rombios/config.h b/tools/firmware/rombios/config.h
index cac815172e..da3cbad9a5 100644
--- a/tools/firmware/rombios/config.h
+++ b/tools/firmware/rombios/config.h
@@ -27,17 +27,10 @@
#define PFFLAG_ROM_LOCK 1 /* Sets whether ROM memory area is RW or RO */
/* Located at BIOS_INFO_PHYSICAL_ADDRESS. */
-struct bios_info {
- uint8_t com1_present:1; /* 0[0] - System has COM1? */
- uint8_t com2_present:1; /* 0[1] - System has COM2? */
- uint8_t lpt1_present:1; /* 0[2] - System has LPT1? */
- uint8_t hpet_present:1; /* 0[3] - System has HPET? */
- uint32_t pci_min, pci_len; /* 4, 8 - PCI I/O hole boundaries */
- uint32_t madt_csum_addr; /* 12 - Address of MADT checksum */
- uint32_t madt_lapic0_addr; /* 16 - Address of first MADT LAPIC struct */
- uint32_t bios32_entry; /* 20 - Entry point for 32-bit BIOS */
+struct rombios_info {
+ uint32_t bios32_entry; /* 0 - Entry point for 32-bit BIOS */
};
-#define BIOSINFO_OFF_bios32_entry 20
+#define BIOSINFO_OFF_bios32_entry 0
#endif