On 07/30/2014 07:34 AM, Michael S. Tsirkin wrote:
Improve readability, no functional changes.
There's a subtle problem -- I am fixing this for v3.
Signed-off-by: Michael S. Tsirkin <m...@redhat.com> --- hw/i386/acpi-build.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 66cde2b..6ae3a9e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1209,17 +1209,13 @@ build_hpet(GArray *table_data, GArray *linker) static void build_tpm_tcpa(GArray *table_data, GArray *linker) { - Acpi20Tcpa *tcpa; - uint32_t log_area_minimum_length = TPM_LOG_AREA_MINIMUM_SIZE; - uint64_t log_area_start_address; - size_t len = log_area_minimum_length + sizeof(*tcpa); + Acpi20Tcpa *tcpa = acpi_data_push(table_data, sizeof *tcpa); + uint64_t log_area_start_address = acpi_data_len(table_data); - log_area_start_address = table_data->len + sizeof(*tcpa); - - tcpa = acpi_data_push(table_data, len); + acpi_data_push(table_data, TPM_LOG_AREA_MINIMUM_SIZE);
This 2nd acpi_data_push manipulates table_data and the BIOS linker loader function further below now operates with this new table_data offsets etc. We have to move this acpi_data_push all the way to the end and then it works.
tcpa->platform_class = cpu_to_le16(TPM_TCPA_ACPI_CLASS_CLIENT); - tcpa->log_area_minimum_length = cpu_to_le32(log_area_minimum_length); + tcpa->log_area_minimum_length = cpu_to_le32(TPM_LOG_AREA_MINIMUM_SIZE); tcpa->log_area_start_address = cpu_to_le64(log_area_start_address); /* LASA address to be filled by Guest linker */