[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 13/44] tests: smbios: fetch whole table in one step i
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 13/44] tests: smbios: fetch whole table in one step instead of reading it step by step |
Date: |
Mon, 14 Jan 2019 20:36:02 -0500 |
From: Igor Mammedov <address@hidden>
replace a bunch of ACPI_READ_ARRAY/ACPI_READ_FIELD macro, that read
SMBIOS table field by field with one memread() to fetch whole table
at once and drop no longer used ACPI_READ_ARRAY/ACPI_READ_FIELD macro.
Signed-off-by: Igor Mammedov <address@hidden>
Acked-by: Thomas Huth <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
tests/acpi-utils.h | 17 -----------------
tests/bios-tables-test.c | 15 +--------------
2 files changed, 1 insertion(+), 31 deletions(-)
diff --git a/tests/acpi-utils.h b/tests/acpi-utils.h
index 1aa00db2b6..cb7183e057 100644
--- a/tests/acpi-utils.h
+++ b/tests/acpi-utils.h
@@ -30,23 +30,6 @@ typedef struct {
bool tmp_files_retain; /* do not delete the temp asl/aml */
} AcpiSdtTable;
-#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(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(qts, arr, addr) \
- ACPI_READ_ARRAY_PTR(qts, arr, sizeof(arr) / sizeof(arr[0]), addr)
-
#define ACPI_ASSERT_CMP(actual, expected) do { \
char ACPI_ASSERT_CMP_str[5] = {}; \
memcpy(ACPI_ASSERT_CMP_str, &actual, 4); \
diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c
index 8fdd1c173a..dcd6be8bbd 100644
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -406,32 +406,19 @@ static bool smbios_ep_table_ok(test_data *data)
struct smbios_21_entry_point *ep_table = &data->smbios_ep_table;
uint32_t addr = data->smbios_ep_addr;
- ACPI_READ_ARRAY(data->qts, ep_table->anchor_string, addr);
+ qtest_memread(data->qts, addr, ep_table, sizeof(*ep_table));
if (memcmp(ep_table->anchor_string, "_SM_", 4)) {
return false;
}
- ACPI_READ_FIELD(data->qts, ep_table->checksum, addr);
- ACPI_READ_FIELD(data->qts, ep_table->length, addr);
- ACPI_READ_FIELD(data->qts, ep_table->smbios_major_version, addr);
- ACPI_READ_FIELD(data->qts, ep_table->smbios_minor_version, addr);
- ACPI_READ_FIELD(data->qts, ep_table->max_structure_size, addr);
- ACPI_READ_FIELD(data->qts, ep_table->entry_point_revision, addr);
- ACPI_READ_ARRAY(data->qts, ep_table->formatted_area, addr);
- ACPI_READ_ARRAY(data->qts, ep_table->intermediate_anchor_string, addr);
if (memcmp(ep_table->intermediate_anchor_string, "_DMI_", 5)) {
return false;
}
- ACPI_READ_FIELD(data->qts, ep_table->intermediate_checksum, addr);
- ACPI_READ_FIELD(data->qts, ep_table->structure_table_length, addr);
if (ep_table->structure_table_length == 0) {
return false;
}
- ACPI_READ_FIELD(data->qts, ep_table->structure_table_address, addr);
- ACPI_READ_FIELD(data->qts, ep_table->number_of_structures, addr);
if (ep_table->number_of_structures == 0) {
return false;
}
- ACPI_READ_FIELD(data->qts, ep_table->smbios_bcd_revision, addr);
if (acpi_calc_checksum((uint8_t *)ep_table, sizeof *ep_table) ||
acpi_calc_checksum((uint8_t *)ep_table + 0x10,
sizeof *ep_table - 0x10)) {
--
MST
- [Qemu-devel] [PULL 20/44] virtio: split virtio input bits from virtio-pci, (continued)
- [Qemu-devel] [PULL 20/44] virtio: split virtio input bits from virtio-pci, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 19/44] virtio: split virtio input host bits from virtio-pci, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 18/44] virtio: split vhost vsock bits from virtio-pci, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 22/44] virtio: split virtio balloon bits from virtio-pci, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 30/44] virtio: split virtio serial bits from virtio-pci, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 28/44] virtio: split virtio blk bits from virtio-pci, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 27/44] virtio: split virtio scsi bits from virtio-pci, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 15/44] tests: acpi: use AcpiSdtTable::aml instead of AcpiSdtTable::header::signature, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 16/44] virtio-net: support RSC v4/v6 tcp traffic for Windows HCK, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 21/44] virtio: split virtio rng bits from virtio-pci, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 13/44] tests: smbios: fetch whole table in one step instead of reading it step by step,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 10/44] tests: acpi: simplify rsdt handling, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 06/44] vhost-user: fix ioeventfd_enabled, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 07/44] util: check the return value of fcntl in qemu_set_{block, nonblock}, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 08/44] tests: acpi: use AcpiSdtTable::aml in consistent way, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 17/44] virtio-net: changed VIRTIO_NET_F_RSC_EXT to be 61, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 23/44] virtio: split virtio 9p bits from virtio-pci, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 14/44] tests: acpi: squash sanitize_fadt_ptrs() into test_acpi_fadt_table(), Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 12/44] tests: acpi: reuse fetch_table() in vmgenid-test, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 09/44] tests: acpi: make sure FADT is fetched only once, Michael S. Tsirkin, 2019/01/14
- [Qemu-devel] [PULL 01/44] pci/pcie: stop plug/unplug if the slot is locked, Michael S. Tsirkin, 2019/01/14