2 * Utilities for working with ACPI tables
4 * Copyright (c) 2013 Red Hat Inc.
7 * Michael S. Tsirkin <mst@redhat.com>,
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
13 #ifndef TEST_ACPI_UTILS_H
14 #define TEST_ACPI_UTILS_H
18 /* DSDT and SSDTs format */
20 uint8_t *aml
; /* aml bytecode from guest */
23 gchar
*asl
; /* asl code generated from aml */
26 bool tmp_files_retain
; /* do not delete the temp asl/aml */
29 #define ACPI_ASSERT_CMP(actual, expected) do { \
30 char ACPI_ASSERT_CMP_str[5] = {}; \
31 memcpy(ACPI_ASSERT_CMP_str, &actual, 4); \
32 g_assert_cmpstr(ACPI_ASSERT_CMP_str, ==, expected); \
35 #define ACPI_ASSERT_CMP64(actual, expected) do { \
36 char ACPI_ASSERT_CMP_str[9] = {}; \
37 memcpy(ACPI_ASSERT_CMP_str, &actual, 8); \
38 g_assert_cmpstr(ACPI_ASSERT_CMP_str, ==, expected); \
42 #define ACPI_FOREACH_RSDT_ENTRY(table, table_len, entry_ptr, entry_size) \
43 for (entry_ptr = table + 36 /* 1st Entry */; \
44 entry_ptr < table + table_len; \
45 entry_ptr += entry_size)
47 uint8_t acpi_calc_checksum(const uint8_t *data
, int len
);
48 uint32_t acpi_find_rsdp_address(QTestState
*qts
);
49 uint64_t acpi_find_rsdp_address_uefi(QTestState
*qts
, uint64_t start
,
51 void acpi_fetch_rsdp_table(QTestState
*qts
, uint64_t addr
, uint8_t *rsdp_table
);
52 void acpi_fetch_table(QTestState
*qts
, uint8_t **aml
, uint32_t *aml_len
,
53 const uint8_t *addr_ptr
, int addr_size
, const char *sig
,
54 bool verify_checksum
);
56 #endif /* TEST_ACPI_UTILS_H */