@@ -288,7 +288,7 @@ static struct acpi_20_slit *construct_slit(void)
static int construct_passthrough_tables(unsigned long *table_ptrs,
int nr_tables,
- struct acpi_config *config)
+ const struct acpi_config *config)
{
unsigned long pt_addr;
struct acpi_header *header;
@@ -323,7 +323,7 @@ static int construct_passthrough_tables(unsigned long *table_ptrs,
}
static int construct_secondary_tables(unsigned long *table_ptrs,
- struct acpi_config *config,
+ const struct acpi_config *config,
struct acpi_info *info)
{
int nr_tables = 0;
@@ -450,8 +450,9 @@ static int construct_secondary_tables(unsigned long *table_ptrs,
*
* Return 0 if memory failure, != 0 if success
*/
-static int new_vm_gid(struct acpi_config *config,
- struct acpi_info *info)
+static int new_vm_gid(const struct acpi_config *config,
+ struct acpi_info *info,
+ unsigned long *vm_gid_addr)
{
uint64_t *buf;
@@ -469,12 +470,12 @@ static int new_vm_gid(struct acpi_config *config,
/* set the address into ACPI table and also pass it back to the caller */
info->vm_gid_addr = virt_to_phys(buf);
- config->vm_gid_addr = info->vm_gid_addr;
+ *vm_gid_addr = info->vm_gid_addr;
return 1;
}
-void acpi_build_tables(const struct acpi_config *config)
+void acpi_build_tables(const struct acpi_config *config, struct acpi_data *d)
{
struct acpi_info *acpi_info;
struct acpi_20_rsdp *rsdp;
@@ -606,7 +607,7 @@ void acpi_build_tables(const struct acpi_config *config)
offsetof(struct acpi_20_rsdp, extended_checksum),
sizeof(struct acpi_20_rsdp));
- if ( !new_vm_gid(config, acpi_info) )
+ if ( !new_vm_gid(config, acpi_info, &d->vm_gid_addr) )
goto oom;
return;
@@ -42,7 +42,6 @@ struct acpi_config {
uint32_t table_flags;
uint64_t vm_gid[2];
- unsigned long vm_gid_addr; /* OUT parameter */
struct {
uint32_t addr;
@@ -60,7 +59,12 @@ struct acpi_config {
unsigned int rsdp;
};
-void acpi_build_tables(const struct acpi_config *config);
+/* ACPI builder returns data in this structure */
+struct acpi_data {
+ unsigned long vm_gid_addr;
+};
+
+void acpi_build_tables(const struct acpi_config *config, struct acpi_data *d);
#endif /* __LIBACPI_H__ */
@@ -869,6 +869,7 @@ void hvmloader_acpi_build_tables(struct acpi_config *config,
unsigned int physical)
{
const char *s;
+ struct acpi_data d;
/* Allocate and initialise the acpi info area. */
mem_hole_populate_ram(ACPI_INFO_PHYSICAL_ADDRESS >> PAGE_SHIFT, 1);
@@ -921,9 +922,9 @@ void hvmloader_acpi_build_tables(struct acpi_config *config,
config->rsdp = physical;
config->infop = ACPI_INFO_PHYSICAL_ADDRESS;
- acpi_build_tables(config);
+ acpi_build_tables(config, &d);
- hvm_param_set(HVM_PARAM_VM_GENERATION_ID_ADDR, config->vm_gid_addr);
+ hvm_param_set(HVM_PARAM_VM_GENERATION_ID_ADDR, d.vm_gid_addr);
}
/*
With that we can pass acpi_config as a const. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> --- This is an alternative to patch 2. Only compile-tested. tools/firmware/hvmloader/acpi/build.c | 15 ++++++++------- tools/firmware/hvmloader/acpi/libacpi.h | 8 ++++++-- tools/firmware/hvmloader/util.c | 5 +++-- 3 files changed, 17 insertions(+), 11 deletions(-)