• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisionf2f616cea44018c8280795f40ce66b04a164dfa8 (tree)
Time2019-05-21 07:40:02
AuthorIgor Mammedov <imammedo@redh...>
CommiterMichael S. Tsirkin

Log Message

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>

Change Summary

Incremental Difference

--- a/tests/acpi-utils.c
+++ b/tests/acpi-utils.c
@@ -51,18 +51,6 @@ uint32_t acpi_find_rsdp_address(QTestState *qts)
5151 return off;
5252 }
5353
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-
6654 void acpi_fetch_rsdp_table(QTestState *qts, uint32_t addr, uint8_t *rsdp_table)
6755 {
6856 uint8_t revision;
--- a/tests/acpi-utils.h
+++ b/tests/acpi-utils.h
@@ -46,7 +46,6 @@ typedef struct {
4646
4747 uint8_t acpi_calc_checksum(const uint8_t *data, int len);
4848 uint32_t acpi_find_rsdp_address(QTestState *qts);
49-uint64_t acpi_get_xsdt_address(uint8_t *rsdp_table);
5049 void acpi_fetch_rsdp_table(QTestState *qts, uint32_t addr, uint8_t *rsdp_table);
5150 void acpi_fetch_table(QTestState *qts, uint8_t **aml, uint32_t *aml_len,
5251 const uint8_t *addr_ptr, int addr_size, const char *sig,
--- a/tests/bios-tables-test.c
+++ b/tests/bios-tables-test.c
@@ -107,21 +107,29 @@ static void test_acpi_rsdp_table(test_data *data)
107107 }
108108 }
109109
110-static void test_acpi_rsdt_table(test_data *data)
110+static void test_acpi_rxsdt_table(test_data *data)
111111 {
112+ const char *sig = "RSDT";
112113 AcpiSdtTable rsdt = {};
114+ int entry_size = 4;
115+ int addr_off = 16 /* RsdtAddress */;
113116 uint8_t *ent;
114117
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 */
116124 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);
118126
119127 /* 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) {
121129 AcpiSdtTable ssdt_table = {};
122130
123131 acpi_fetch_table(data->qts, &ssdt_table.aml, &ssdt_table.aml_len, ent,
124- 4, NULL, true);
132+ entry_size, NULL, true);
125133 /* Add table to ASL test tables list */
126134 g_array_append_val(data->tables, ssdt_table);
127135 }
@@ -521,7 +529,7 @@ static void test_acpi_one(const char *params, test_data *data)
521529 data->tables = g_array_new(false, true, sizeof(AcpiSdtTable));
522530 test_acpi_rsdp_address(data);
523531 test_acpi_rsdp_table(data);
524- test_acpi_rsdt_table(data);
532+ test_acpi_rxsdt_table(data);
525533 test_acpi_fadt_table(data);
526534
527535 if (iasl) {