aboutsummaryrefslogtreecommitdiff
path: root/tests/acpi-utils.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2017-09-11 12:20:08 -0500
committerThomas Huth <thuth@redhat.com>2018-12-17 15:36:39 +0100
commit273e3d92cfa26ae07a72657b75b4b76105a0fbc4 (patch)
tree8d0c2fda69cbd7116c38d75ff337fefc70f63114 /tests/acpi-utils.c
parent24c01ffa9d356eed4530e31f7ef93844b6599502 (diff)
downloadqemu-273e3d92cfa26ae07a72657b75b4b76105a0fbc4.zip
qemu-273e3d92cfa26ae07a72657b75b4b76105a0fbc4.tar.gz
qemu-273e3d92cfa26ae07a72657b75b4b76105a0fbc4.tar.bz2
tests/acpi-utils: Drop dependence on global_qtest
As a general rule, we prefer avoiding implicit global state because it makes code harder to safely copy and paste without thinking about the global state. Adjust the helper code to use explicit state instead, and update all callers. bios-tables-test no longer depends on global_qtest, now that it passes explicit state through the testsuite data; an assert proves this fact (although we will get rid of it later, once global_qtest is gone). Signed-off-by: Eric Blake <eblake@redhat.com> Acked-by: Igor Mammedov <imammedo@redhat.com> Tested-by: Igor Mammedov <imammedo@redhat.com> [thuth: adapted patch to current master branch] Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/acpi-utils.c')
-rw-r--r--tests/acpi-utils.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/acpi-utils.c b/tests/acpi-utils.c
index 41dc1ea..6dc8ca1 100644
--- a/tests/acpi-utils.c
+++ b/tests/acpi-utils.c
@@ -32,7 +32,7 @@ uint8_t acpi_calc_checksum(const uint8_t *data, int len)
return sum;
}
-uint32_t acpi_find_rsdp_address(void)
+uint32_t acpi_find_rsdp_address(QTestState *qts)
{
uint32_t off;
@@ -42,7 +42,7 @@ uint32_t acpi_find_rsdp_address(void)
int i;
for (i = 0; i < sizeof sig - 1; ++i) {
- sig[i] = readb(off + i);
+ sig[i] = qtest_readb(qts, off + i);
}
if (!memcmp(sig, "RSD PTR ", sizeof sig)) {
@@ -52,14 +52,15 @@ uint32_t acpi_find_rsdp_address(void)
return off;
}
-void acpi_parse_rsdp_table(uint32_t addr, AcpiRsdpDescriptor *rsdp_table)
+void acpi_parse_rsdp_table(QTestState *qts, uint32_t addr,
+ AcpiRsdpDescriptor *rsdp_table)
{
- ACPI_READ_FIELD(rsdp_table->signature, addr);
+ ACPI_READ_FIELD(qts, rsdp_table->signature, addr);
ACPI_ASSERT_CMP64(rsdp_table->signature, "RSD PTR ");
- ACPI_READ_FIELD(rsdp_table->checksum, addr);
- ACPI_READ_ARRAY(rsdp_table->oem_id, addr);
- ACPI_READ_FIELD(rsdp_table->revision, addr);
- ACPI_READ_FIELD(rsdp_table->rsdt_physical_address, addr);
- ACPI_READ_FIELD(rsdp_table->length, addr);
+ ACPI_READ_FIELD(qts, rsdp_table->checksum, addr);
+ ACPI_READ_ARRAY(qts, rsdp_table->oem_id, addr);
+ ACPI_READ_FIELD(qts, rsdp_table->revision, addr);
+ ACPI_READ_FIELD(qts, rsdp_table->rsdt_physical_address, addr);
+ ACPI_READ_FIELD(qts, rsdp_table->length, addr);
}