リビジョン | f2f616cea44018c8280795f40ce66b04a164dfa8 (tree) |
---|---|
日時 | 2019-05-21 07:40:02 |
作者 | Igor Mammedov <imammedo@redh...> |
コミッター | Michael S. Tsirkin |
tests: acpi: make RSDT test routine handle XSDT
If RSDP revision is more than 0 fetch table pointed by XSDT
and fallback to legacy RSDT table otherwise.
While at it drop unused acpi_get_xsdt_address().
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1556808723-226478-4-git-send-email-imammedo@redhat.com>
Reviewed-by: Wei Yang <richardw.yang@linux.intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
@@ -51,18 +51,6 @@ uint32_t acpi_find_rsdp_address(QTestState *qts) | ||
51 | 51 | return off; |
52 | 52 | } |
53 | 53 | |
54 | -uint64_t acpi_get_xsdt_address(uint8_t *rsdp_table) | |
55 | -{ | |
56 | - uint64_t xsdt_physical_address; | |
57 | - uint8_t revision = rsdp_table[15 /* Revision offset */]; | |
58 | - | |
59 | - /* We must have revision 2 if we're looking for an XSDT pointer */ | |
60 | - g_assert(revision == 2); | |
61 | - | |
62 | - memcpy(&xsdt_physical_address, &rsdp_table[24 /* XsdtAddress offset */], 8); | |
63 | - return le64_to_cpu(xsdt_physical_address); | |
64 | -} | |
65 | - | |
66 | 54 | void acpi_fetch_rsdp_table(QTestState *qts, uint32_t addr, uint8_t *rsdp_table) |
67 | 55 | { |
68 | 56 | uint8_t revision; |
@@ -46,7 +46,6 @@ typedef struct { | ||
46 | 46 | |
47 | 47 | uint8_t acpi_calc_checksum(const uint8_t *data, int len); |
48 | 48 | uint32_t acpi_find_rsdp_address(QTestState *qts); |
49 | -uint64_t acpi_get_xsdt_address(uint8_t *rsdp_table); | |
50 | 49 | void acpi_fetch_rsdp_table(QTestState *qts, uint32_t addr, uint8_t *rsdp_table); |
51 | 50 | void acpi_fetch_table(QTestState *qts, uint8_t **aml, uint32_t *aml_len, |
52 | 51 | const uint8_t *addr_ptr, int addr_size, const char *sig, |
@@ -107,21 +107,29 @@ static void test_acpi_rsdp_table(test_data *data) | ||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | -static void test_acpi_rsdt_table(test_data *data) | |
110 | +static void test_acpi_rxsdt_table(test_data *data) | |
111 | 111 | { |
112 | + const char *sig = "RSDT"; | |
112 | 113 | AcpiSdtTable rsdt = {}; |
114 | + int entry_size = 4; | |
115 | + int addr_off = 16 /* RsdtAddress */; | |
113 | 116 | uint8_t *ent; |
114 | 117 | |
115 | - /* read RSDT table */ | |
118 | + if (data->rsdp_table[15 /* Revision offset */] != 0) { | |
119 | + addr_off = 24 /* XsdtAddress */; | |
120 | + entry_size = 8; | |
121 | + sig = "XSDT"; | |
122 | + } | |
123 | + /* read [RX]SDT table */ | |
116 | 124 | acpi_fetch_table(data->qts, &rsdt.aml, &rsdt.aml_len, |
117 | - &data->rsdp_table[16 /* RsdtAddress */], 4, "RSDT", true); | |
125 | + &data->rsdp_table[addr_off], entry_size, sig, true); | |
118 | 126 | |
119 | 127 | /* Load all tables and add to test list directly RSDT referenced tables */ |
120 | - ACPI_FOREACH_RSDT_ENTRY(rsdt.aml, rsdt.aml_len, ent, 4 /* Entry size */) { | |
128 | + ACPI_FOREACH_RSDT_ENTRY(rsdt.aml, rsdt.aml_len, ent, entry_size) { | |
121 | 129 | AcpiSdtTable ssdt_table = {}; |
122 | 130 | |
123 | 131 | acpi_fetch_table(data->qts, &ssdt_table.aml, &ssdt_table.aml_len, ent, |
124 | - 4, NULL, true); | |
132 | + entry_size, NULL, true); | |
125 | 133 | /* Add table to ASL test tables list */ |
126 | 134 | g_array_append_val(data->tables, ssdt_table); |
127 | 135 | } |
@@ -521,7 +529,7 @@ static void test_acpi_one(const char *params, test_data *data) | ||
521 | 529 | data->tables = g_array_new(false, true, sizeof(AcpiSdtTable)); |
522 | 530 | test_acpi_rsdp_address(data); |
523 | 531 | test_acpi_rsdp_table(data); |
524 | - test_acpi_rsdt_table(data); | |
532 | + test_acpi_rxsdt_table(data); | |
525 | 533 | test_acpi_fadt_table(data); |
526 | 534 | |
527 | 535 | if (iasl) { |