diff options
author | Thomas Huth | 2019-09-09 12:04:01 +0200 |
---|---|---|
committer | Thomas Huth | 2020-01-12 11:42:41 +0100 |
commit | 1e8a1fae7464ef79c9e50aa0f807d2c511be3c8e (patch) | |
tree | 80d1a4f0454b9a75c09461e69f969213350540ea /tests/qtest/acpi-utils.h | |
parent | tests/Makefile: Separate unit test dependencies from qtest dependencies (diff) | |
download | qemu-1e8a1fae7464ef79c9e50aa0f807d2c511be3c8e.tar.gz qemu-1e8a1fae7464ef79c9e50aa0f807d2c511be3c8e.tar.xz qemu-1e8a1fae7464ef79c9e50aa0f807d2c511be3c8e.zip |
test: Move qtests to a separate directory
The tests directory itself is pretty overcrowded, and it's hard to
see which test belongs to which test subsystem (unit, qtest, ...).
Let's move the qtests to a separate folder for more clarity.
Message-Id: <20191218103059.11729-6-thuth@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/qtest/acpi-utils.h')
-rw-r--r-- | tests/qtest/acpi-utils.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/qtest/acpi-utils.h b/tests/qtest/acpi-utils.h new file mode 100644 index 0000000000..0c86780689 --- /dev/null +++ b/tests/qtest/acpi-utils.h @@ -0,0 +1,56 @@ +/* + * Utilities for working with ACPI tables + * + * Copyright (c) 2013 Red Hat Inc. + * + * Authors: + * Michael S. Tsirkin <mst@redhat.com>, + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef TEST_ACPI_UTILS_H +#define TEST_ACPI_UTILS_H + +#include "libqtest.h" + +/* DSDT and SSDTs format */ +typedef struct { + uint8_t *aml; /* aml bytecode from guest */ + uint32_t aml_len; + gchar *aml_file; + gchar *asl; /* asl code generated from aml */ + gsize asl_len; + gchar *asl_file; + bool tmp_files_retain; /* do not delete the temp asl/aml */ +} AcpiSdtTable; + +#define ACPI_ASSERT_CMP(actual, expected) do { \ + char ACPI_ASSERT_CMP_str[5] = {}; \ + memcpy(ACPI_ASSERT_CMP_str, &actual, 4); \ + g_assert_cmpstr(ACPI_ASSERT_CMP_str, ==, expected); \ +} while (0) + +#define ACPI_ASSERT_CMP64(actual, expected) do { \ + char ACPI_ASSERT_CMP_str[9] = {}; \ + memcpy(ACPI_ASSERT_CMP_str, &actual, 8); \ + g_assert_cmpstr(ACPI_ASSERT_CMP_str, ==, expected); \ +} while (0) + + +#define ACPI_FOREACH_RSDT_ENTRY(table, table_len, entry_ptr, entry_size) \ + for (entry_ptr = table + 36 /* 1st Entry */; \ + entry_ptr < table + table_len; \ + entry_ptr += entry_size) + +uint8_t acpi_calc_checksum(const uint8_t *data, int len); +uint32_t acpi_find_rsdp_address(QTestState *qts); +uint64_t acpi_find_rsdp_address_uefi(QTestState *qts, uint64_t start, + uint64_t size); +void acpi_fetch_rsdp_table(QTestState *qts, uint64_t addr, uint8_t *rsdp_table); +void acpi_fetch_table(QTestState *qts, uint8_t **aml, uint32_t *aml_len, + const uint8_t *addr_ptr, int addr_size, const char *sig, + bool verify_checksum); + +#endif /* TEST_ACPI_UTILS_H */ |