[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH-alt 2/2] hvmloader: Make acpi_build_tables() return vm_gid_addr outside struct acpi_config
With that we can pass acpi_config as a const. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> --- 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(-) diff --git a/tools/firmware/hvmloader/acpi/build.c b/tools/firmware/hvmloader/acpi/build.c index 360dd1c..823f642 100644 --- a/tools/firmware/hvmloader/acpi/build.c +++ b/tools/firmware/hvmloader/acpi/build.c @@ -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; diff --git a/tools/firmware/hvmloader/acpi/libacpi.h b/tools/firmware/hvmloader/acpi/libacpi.h index de4470a..9176da6 100644 --- a/tools/firmware/hvmloader/acpi/libacpi.h +++ b/tools/firmware/hvmloader/acpi/libacpi.h @@ -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__ */ diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c index b2d3421..bbf7f3d 100644 --- a/tools/firmware/hvmloader/util.c +++ b/tools/firmware/hvmloader/util.c @@ -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); } /* -- 1.8.3.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |