Use ACPI RSDP address from boot_params if provided by bootloader.

This commit is contained in:
Martin Whitaker 2020-12-11 15:14:11 +00:00
parent 1d2bf57403
commit bb667b600f
2 changed files with 13 additions and 7 deletions

View File

@ -86,15 +86,17 @@ typedef struct {
typedef struct {
screen_info_t screen_info;
uint8_t unused1[0x1c0 - 0x040];
uint8_t unused1[0x070 - 0x040];
uint64_t acpi_rsdp_addr;
uint8_t unused2[0x1c0 - 0x078];
efi_info_t efi_info;
uint8_t unused2[0x1e8 - 0x1e0];
uint8_t unused3[0x1e8 - 0x1e0];
uint8_t e820_entries;
uint8_t unused3[0x214 - 0x1e9];
uint8_t unused4[0x214 - 0x1e9];
uint32_t code32_start;
uint8_t unused4[0x2d0 - 0x218];
uint8_t unused5[0x2d0 - 0x218];
e820_entry_t e820_map[E820_MAP_SIZE];
uint8_t unused5[0xeec - 0xd00];
uint8_t unused6[0xeec - 0xd00];
} __attribute__((packed)) boot_params_t;
#endif /* BOOTPARAMS_H */

View File

@ -508,12 +508,16 @@ static bool find_cpus_in_rsdp(void)
// Search for the RSDP
rsdp_t *rp = NULL;
if (efi_info->loader_signature == EFI32_LOADER_SIGNATURE) {
if (boot_params->acpi_rsdp_addr != 0) {
// Validate it
rp = scan_for_rsdp(boot_params->acpi_rsdp_addr, 0x8);
}
if (rp == NULL && efi_info->loader_signature == EFI32_LOADER_SIGNATURE) {
uintptr_t system_table_addr = (uintptr_t)efi_info->sys_tab;
rp = find_rsdp_in_efi32_system_table((efi32_system_table_t *)system_table_addr);
}
#ifdef __x86_64__
if (efi_info->loader_signature == EFI64_LOADER_SIGNATURE) {
if (rp == NULL && efi_info->loader_signature == EFI64_LOADER_SIGNATURE) {
uintptr_t system_table_addr = (uintptr_t)efi_info->sys_tab_hi << 32 | (uintptr_t)efi_info->sys_tab;
rp = find_rsdp_in_efi64_system_table((efi64_system_table_t *)system_table_addr);
}