ossaudio: port to the new audio backend api
[qemu/ar7.git] / tests / acpi-utils.h
blob0c86780689315d76a534f9dd524f72e0c0c74206
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_find_rsdp_address_uefi(QTestState *qts, uint64_t start,
50 uint64_t size);
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 */