mirror of https://github.com/xemu-project/xemu.git
acpi: create separate file for TCPA log
Create the TCPA log in a separate file rather than allocating ACPI table memory for it. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
9047579161
commit
42a5b30844
|
@ -249,6 +249,7 @@ static void acpi_get_pci_info(PcPciInfo *info)
|
||||||
|
|
||||||
#define ACPI_BUILD_TABLE_FILE "etc/acpi/tables"
|
#define ACPI_BUILD_TABLE_FILE "etc/acpi/tables"
|
||||||
#define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp"
|
#define ACPI_BUILD_RSDP_FILE "etc/acpi/rsdp"
|
||||||
|
#define ACPI_BUILD_TPMLOG_FILE "etc/tpm/log"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
build_header(GArray *linker, GArray *table_data,
|
build_header(GArray *linker, GArray *table_data,
|
||||||
|
@ -1214,27 +1215,28 @@ build_hpet(GArray *table_data, GArray *linker)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
build_tpm_tcpa(GArray *table_data, GArray *linker)
|
build_tpm_tcpa(GArray *table_data, GArray *linker, GArray *tcpalog)
|
||||||
{
|
{
|
||||||
Acpi20Tcpa *tcpa = acpi_data_push(table_data, sizeof *tcpa);
|
Acpi20Tcpa *tcpa = acpi_data_push(table_data, sizeof *tcpa);
|
||||||
/* the log area will come right after the TCPA table */
|
uint64_t log_area_start_address = acpi_data_len(tcpalog);
|
||||||
uint64_t log_area_start_address = acpi_data_len(table_data);
|
|
||||||
|
|
||||||
tcpa->platform_class = cpu_to_le16(TPM_TCPA_ACPI_CLASS_CLIENT);
|
tcpa->platform_class = cpu_to_le16(TPM_TCPA_ACPI_CLASS_CLIENT);
|
||||||
tcpa->log_area_minimum_length = cpu_to_le32(TPM_LOG_AREA_MINIMUM_SIZE);
|
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);
|
tcpa->log_area_start_address = cpu_to_le64(log_area_start_address);
|
||||||
|
|
||||||
|
bios_linker_loader_alloc(linker, ACPI_BUILD_TPMLOG_FILE, 1,
|
||||||
|
false /* high memory */);
|
||||||
|
|
||||||
/* log area start address to be filled by Guest linker */
|
/* log area start address to be filled by Guest linker */
|
||||||
bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE,
|
bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE,
|
||||||
ACPI_BUILD_TABLE_FILE,
|
ACPI_BUILD_TPMLOG_FILE,
|
||||||
table_data, &tcpa->log_area_start_address,
|
table_data, &tcpa->log_area_start_address,
|
||||||
sizeof(tcpa->log_area_start_address));
|
sizeof(tcpa->log_area_start_address));
|
||||||
|
|
||||||
build_header(linker, table_data,
|
build_header(linker, table_data,
|
||||||
(void *)tcpa, "TCPA", sizeof(*tcpa), 2);
|
(void *)tcpa, "TCPA", sizeof(*tcpa), 2);
|
||||||
|
|
||||||
/* now only get the log area and with that modify table_data */
|
acpi_data_push(tcpalog, TPM_LOG_AREA_MINIMUM_SIZE);
|
||||||
acpi_data_push(table_data, TPM_LOG_AREA_MINIMUM_SIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1485,6 +1487,7 @@ typedef
|
||||||
struct AcpiBuildTables {
|
struct AcpiBuildTables {
|
||||||
GArray *table_data;
|
GArray *table_data;
|
||||||
GArray *rsdp;
|
GArray *rsdp;
|
||||||
|
GArray *tcpalog;
|
||||||
GArray *linker;
|
GArray *linker;
|
||||||
} AcpiBuildTables;
|
} AcpiBuildTables;
|
||||||
|
|
||||||
|
@ -1492,6 +1495,7 @@ static inline void acpi_build_tables_init(AcpiBuildTables *tables)
|
||||||
{
|
{
|
||||||
tables->rsdp = g_array_new(false, true /* clear */, 1);
|
tables->rsdp = g_array_new(false, true /* clear */, 1);
|
||||||
tables->table_data = g_array_new(false, true /* clear */, 1);
|
tables->table_data = g_array_new(false, true /* clear */, 1);
|
||||||
|
tables->tcpalog = g_array_new(false, true /* clear */, 1);
|
||||||
tables->linker = bios_linker_loader_init();
|
tables->linker = bios_linker_loader_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1503,6 +1507,7 @@ static inline void acpi_build_tables_cleanup(AcpiBuildTables *tables, bool mfre)
|
||||||
}
|
}
|
||||||
g_array_free(tables->rsdp, mfre);
|
g_array_free(tables->rsdp, mfre);
|
||||||
g_array_free(tables->table_data, mfre);
|
g_array_free(tables->table_data, mfre);
|
||||||
|
g_array_free(tables->tcpalog, mfre);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
|
@ -1612,7 +1617,7 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
|
||||||
}
|
}
|
||||||
if (misc.has_tpm) {
|
if (misc.has_tpm) {
|
||||||
acpi_add_table(table_offsets, tables->table_data);
|
acpi_add_table(table_offsets, tables->table_data);
|
||||||
build_tpm_tcpa(tables->table_data, tables->linker);
|
build_tpm_tcpa(tables->table_data, tables->linker, tables->tcpalog);
|
||||||
|
|
||||||
acpi_add_table(table_offsets, tables->table_data);
|
acpi_add_table(table_offsets, tables->table_data);
|
||||||
build_tpm_ssdt(tables->table_data, tables->linker);
|
build_tpm_ssdt(tables->table_data, tables->linker);
|
||||||
|
@ -1778,6 +1783,9 @@ void acpi_setup(PcGuestInfo *guest_info)
|
||||||
|
|
||||||
acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader");
|
acpi_add_rom_blob(NULL, tables.linker, "etc/table-loader");
|
||||||
|
|
||||||
|
fw_cfg_add_file(guest_info->fw_cfg, ACPI_BUILD_TPMLOG_FILE,
|
||||||
|
tables.tcpalog->data, acpi_data_len(tables.tcpalog));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RSDP is small so it's easy to keep it immutable, no need to
|
* RSDP is small so it's easy to keep it immutable, no need to
|
||||||
* bother with ROM blobs.
|
* bother with ROM blobs.
|
||||||
|
|
Loading…
Reference in New Issue