virtio-net: make VirtIOFeature usable for other virtio devices
[qemu/ar7.git] / tests / acpi-utils.h
blobef388bbf120b111fc7e988f2642206a1396eefee
1 /*
2 * Utilities for working with ACPI tables
4 * Copyright (c) 2013 Red Hat Inc.
6 * Authors:
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
16 #include "libqtest.h"
18 /* DSDT and SSDTs format */
19 typedef struct {
20 uint8_t *aml; /* aml bytecode from guest */
21 uint32_t aml_len;
22 gchar *aml_file;
23 gchar *asl; /* asl code generated from aml */
24 gsize asl_len;
25 gchar *asl_file;
26 bool tmp_files_retain; /* do not delete the temp asl/aml */
27 } AcpiSdtTable;
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); \
33 } while (0)
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); \
39 } while (0)
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_get_xsdt_address(uint8_t *rsdp_table);
50 void acpi_parse_rsdp_table(QTestState *qts, uint32_t addr, uint8_t *rsdp_table);
51 void acpi_fetch_table(QTestState *qts, uint8_t **aml, uint32_t *aml_len,
52 const uint8_t *addr_ptr, const char *sig,
53 bool verify_checksum);
55 #endif /* TEST_ACPI_UTILS_H */