diff options
author | Marian Postevca <posteuca@mutex.one> | 2021-01-19 02:32:13 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2021-02-05 08:52:59 -0500 |
commit | 602b458201ffd6f261fb8ee16b5175d733d3ec32 (patch) | |
tree | 7cd70e99e8b445eea3f4dff35a2cc22f93937bc8 /hw/acpi/aml-build.c | |
parent | 99f84ac0512b7ce29089a63c392da706fac14cb1 (diff) |
acpi: Permit OEM ID and OEM table ID fields to be changed
Qemu's ACPI table generation sets the fields OEM ID and OEM table ID
to "BOCHS " and "BXPCxxxx" where "xxxx" is replaced by the ACPI
table name.
Some games like Red Dead Redemption 2 seem to check the ACPI OEM ID
and OEM table ID for the strings "BOCHS" and "BXPC" and if they are
found, the game crashes(this may be an intentional detection
mechanism to prevent playing the game in a virtualized environment).
This patch allows you to override these default values.
The feature can be used in this manner:
qemu -machine oem-id=ABCDEF,oem-table-id=GHIJKLMN
The oem-id string can be up to 6 bytes in size, and the
oem-table-id string can be up to 8 bytes in size. If the string are
smaller than their respective sizes they will be padded with space.
If either of these parameters is not set, the current default values
will be used for the one missing.
Note that the the OEM Table ID field will not be extended with the
name of the table, but will use either the default name or the user
provided one.
This does not affect the -acpitable option (for user-defined ACPI
tables), which has precedence over -machine option.
Signed-off-by: Marian Postevca <posteuca@mutex.one>
Message-Id: <20210119003216.17637-3-posteuca@mutex.one>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/acpi/aml-build.c')
-rw-r--r-- | hw/acpi/aml-build.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 7b6ebb0cc8..a2cd7a5830 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -30,6 +30,7 @@ #include "hw/pci/pci_host.h" #include "hw/pci/pci_bus.h" #include "hw/pci/pci_bridge.h" +#include "qemu/cutils.h" static GArray *build_alloc_array(void) { @@ -1674,21 +1675,12 @@ build_header(BIOSLinker *linker, GArray *table_data, h->length = cpu_to_le32(len); h->revision = rev; - if (oem_id) { - strncpy((char *)h->oem_id, oem_id, sizeof h->oem_id); - } else { - memcpy(h->oem_id, ACPI_BUILD_APPNAME6, 6); - } - - if (oem_table_id) { - strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id)); - } else { - memcpy(h->oem_table_id, ACPI_BUILD_APPNAME4, 4); - memcpy(h->oem_table_id + 4, sig, 4); - } + strpadcpy((char *)h->oem_id, sizeof h->oem_id, oem_id, ' '); + strpadcpy((char *)h->oem_table_id, sizeof h->oem_table_id, + oem_table_id, ' '); h->oem_revision = cpu_to_le32(1); - memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME4, 4); + memcpy(h->asl_compiler_id, ACPI_BUILD_APPNAME8, 4); h->asl_compiler_revision = cpu_to_le32(1); /* Checksum to be filled in by Guest linker */ bios_linker_loader_add_checksum(linker, ACPI_BUILD_TABLE_FILE, @@ -1871,7 +1863,8 @@ void build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base, * ACPI spec 5.2.17 System Locality Distance Information Table * (Revision 2.0 or later) */ -void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms) +void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms, + const char *oem_id, const char *oem_table_id) { int slit_start, i, j; slit_start = table_data->len; @@ -1892,7 +1885,7 @@ void build_slit(GArray *table_data, BIOSLinker *linker, MachineState *ms) build_header(linker, table_data, (void *)(table_data->data + slit_start), "SLIT", - table_data->len - slit_start, 1, NULL, NULL); + table_data->len - slit_start, 1, oem_id, oem_table_id); } /* build rev1/rev3/rev5.1 FADT */ @@ -2024,7 +2017,8 @@ build_hdr: * table 7: TCG Hardware Interface Description Table Format for TPM 2.0 * of TCG ACPI Specification, Family “1.2” and “2.0”, Version 1.2, Rev 8 */ -void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog) +void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog, + const char *oem_id, const char *oem_table_id) { uint8_t start_method_params[12] = {}; unsigned log_addr_offset, tpm2_start; @@ -2073,7 +2067,8 @@ void build_tpm2(GArray *table_data, BIOSLinker *linker, GArray *tcpalog) log_addr_offset, 8, ACPI_BUILD_TPMLOG_FILE, 0); build_header(linker, table_data, - tpm2_ptr, "TPM2", table_data->len - tpm2_start, 4, NULL, NULL); + tpm2_ptr, "TPM2", table_data->len - tpm2_start, 4, oem_id, + oem_table_id); } Aml *build_crs(PCIHostState *host, CrsRangeSet *range_set, uint32_t io_offset, |