|
35 | 35 | #include <logmsg.h>
|
36 | 36 | #include <acrn_common.h>
|
37 | 37 | #include <util.h>
|
| 38 | +#include <e820.h> |
38 | 39 |
|
39 | 40 | static struct acpi_table_rsdp *acpi_rsdp;
|
40 | 41 |
|
41 |
| -static struct acpi_table_rsdp *found_rsdp(char *base, int32_t length) |
| 42 | +static struct acpi_table_rsdp *found_rsdp(char *base, uint64_t length) |
42 | 43 | {
|
43 | 44 | struct acpi_table_rsdp *rsdp, *ret = NULL;
|
44 |
| - int32_t ofs; |
| 45 | + uint64_t ofs; |
45 | 46 |
|
46 | 47 | /* search on 16-byte boundaries */
|
47 |
| - for (ofs = 0; ofs < length; ofs += 16) { |
| 48 | + for (ofs = 0UL; ofs < length; ofs += 16UL) { |
48 | 49 | rsdp = (struct acpi_table_rsdp *)(base + ofs);
|
49 | 50 |
|
50 | 51 | /* compare signature, validate checksum */
|
@@ -76,11 +77,27 @@ static struct acpi_table_rsdp *get_rsdp(void)
|
76 | 77 | /* EBDA is addressed by the 16 bit pointer at 0x40E */
|
77 | 78 | addr = (uint16_t *)hpa2hva(0x40eUL);
|
78 | 79 |
|
79 |
| - rsdp = found_rsdp((char *)hpa2hva((uint64_t)(*addr) << 4U), 0x400); |
| 80 | + rsdp = found_rsdp((char *)hpa2hva((uint64_t)(*addr) << 4U), 0x400UL); |
80 | 81 | }
|
81 | 82 | if (rsdp == NULL) {
|
82 | 83 | /* Check the upper memory BIOS space, 0xe0000 - 0xfffff. */
|
83 |
| - rsdp = found_rsdp((char *)hpa2hva(0xe0000UL), 0x20000); |
| 84 | + rsdp = found_rsdp((char *)hpa2hva(0xe0000UL), 0x20000UL); |
| 85 | + } |
| 86 | + |
| 87 | + if (rsdp == NULL) { |
| 88 | + /* Check ACPI RECLAIM region, there might be multiple ACPI reclaimable regions. */ |
| 89 | + uint32_t i; |
| 90 | + const struct e820_entry *entry = get_e820_entry(); |
| 91 | + uint32_t entries_count = get_e820_entries_count(); |
| 92 | + |
| 93 | + for (i = 0U; i < entries_count; i++) { |
| 94 | + if (entry[i].type == E820_TYPE_ACPI_RECLAIM) { |
| 95 | + rsdp = found_rsdp((char *)hpa2hva(entry[i].baseaddr), entry[i].length); |
| 96 | + if (rsdp != NULL) { |
| 97 | + break; |
| 98 | + } |
| 99 | + } |
| 100 | + } |
84 | 101 | }
|
85 | 102 |
|
86 | 103 | if (rsdp == NULL) {
|
|
0 commit comments