summaryrefslogtreecommitdiff
path: root/tests/acpi-utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/acpi-utils.h')
-rw-r--r--tests/acpi-utils.h57
1 files changed, 25 insertions, 32 deletions
diff --git a/tests/acpi-utils.h b/tests/acpi-utils.h
index ac52abd0dd..791bd5410e 100644
--- a/tests/acpi-utils.h
+++ b/tests/acpi-utils.h
@@ -28,34 +28,34 @@ typedef struct {
bool tmp_files_retain; /* do not delete the temp asl/aml */
} AcpiSdtTable;
-#define ACPI_READ_FIELD(field, addr) \
- do { \
- memread(addr, &field, sizeof(field)); \
- addr += sizeof(field); \
+#define ACPI_READ_FIELD(qts, field, addr) \
+ do { \
+ qtest_memread(qts, addr, &field, sizeof(field)); \
+ addr += sizeof(field); \
} while (0)
-#define ACPI_READ_ARRAY_PTR(arr, length, addr) \
- do { \
- int idx; \
- for (idx = 0; idx < length; ++idx) { \
- ACPI_READ_FIELD(arr[idx], addr); \
- } \
+#define ACPI_READ_ARRAY_PTR(qts, arr, length, addr) \
+ do { \
+ int idx; \
+ for (idx = 0; idx < length; ++idx) { \
+ ACPI_READ_FIELD(qts, arr[idx], addr); \
+ } \
} while (0)
-#define ACPI_READ_ARRAY(arr, addr) \
- ACPI_READ_ARRAY_PTR(arr, sizeof(arr) / sizeof(arr[0]), addr)
+#define ACPI_READ_ARRAY(qts, arr, addr) \
+ ACPI_READ_ARRAY_PTR(qts, arr, sizeof(arr) / sizeof(arr[0]), addr)
-#define ACPI_READ_TABLE_HEADER(table, addr) \
+#define ACPI_READ_TABLE_HEADER(qts, table, addr) \
do { \
- ACPI_READ_FIELD((table)->signature, addr); \
- ACPI_READ_FIELD((table)->length, addr); \
- ACPI_READ_FIELD((table)->revision, addr); \
- ACPI_READ_FIELD((table)->checksum, addr); \
- ACPI_READ_ARRAY((table)->oem_id, addr); \
- ACPI_READ_ARRAY((table)->oem_table_id, addr); \
- ACPI_READ_FIELD((table)->oem_revision, addr); \
- ACPI_READ_ARRAY((table)->asl_compiler_id, addr); \
- ACPI_READ_FIELD((table)->asl_compiler_revision, addr); \
+ ACPI_READ_FIELD(qts, (table)->signature, addr); \
+ ACPI_READ_FIELD(qts, (table)->length, addr); \
+ ACPI_READ_FIELD(qts, (table)->revision, addr); \
+ ACPI_READ_FIELD(qts, (table)->checksum, addr); \
+ ACPI_READ_ARRAY(qts, (table)->oem_id, addr); \
+ ACPI_READ_ARRAY(qts, (table)->oem_table_id, addr); \
+ ACPI_READ_FIELD(qts, (table)->oem_revision, addr); \
+ ACPI_READ_ARRAY(qts, (table)->asl_compiler_id, addr); \
+ ACPI_READ_FIELD(qts, (table)->asl_compiler_revision, addr); \
} while (0)
#define ACPI_ASSERT_CMP(actual, expected) do { \
@@ -70,18 +70,11 @@ typedef struct {
g_assert_cmpstr(ACPI_ASSERT_CMP_str, ==, expected); \
} while (0)
-#define ACPI_READ_GENERIC_ADDRESS(field, addr) \
- do { \
- ACPI_READ_FIELD((field).space_id, addr); \
- ACPI_READ_FIELD((field).bit_width, addr); \
- ACPI_READ_FIELD((field).bit_offset, addr); \
- ACPI_READ_FIELD((field).access_width, addr); \
- ACPI_READ_FIELD((field).address, addr); \
- } while (0)
uint8_t acpi_calc_checksum(const uint8_t *data, int len);
-uint32_t acpi_find_rsdp_address(void);
-void acpi_parse_rsdp_table(uint32_t addr, AcpiRsdpDescriptor *rsdp_table);
+uint32_t acpi_find_rsdp_address(QTestState *qts);
+void acpi_parse_rsdp_table(QTestState *qts, uint32_t addr,
+ AcpiRsdpDescriptor *rsdp_table);
#endif /* TEST_ACPI_UTILS_H */