From bb667b600f9d223a0bb99edca546a633185f9d1b Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Fri, 11 Dec 2020 15:14:11 +0000 Subject: [PATCH] Use ACPI RSDP address from boot_params if provided by bootloader. --- boot/bootparams.h | 12 +++++++----- system/smp.c | 8 ++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/boot/bootparams.h b/boot/bootparams.h index ca16fe6..e20780b 100644 --- a/boot/bootparams.h +++ b/boot/bootparams.h @@ -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 */ diff --git a/system/smp.c b/system/smp.c index 247bcaf..34b2145 100644 --- a/system/smp.c +++ b/system/smp.c @@ -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); }