Add debug trace for ACPI RSDP search results.

This commit is contained in:
Martin Whitaker 2020-12-11 16:15:42 +00:00
parent 8ad806bfcf
commit ec676ccab2
3 changed files with 22 additions and 0 deletions

View File

@ -191,6 +191,9 @@ static void global_init(void)
for (int i = 0; i < pm_map_size; i++) {
trace(0, "pm %0*x - %0*x", 2*sizeof(uintptr_t), pm_map[i].start, 2*sizeof(uintptr_t), pm_map[i].end);
}
if (rsdp_addr != 0) {
trace(0, "ACPI RSDP found in %s at %0*x", rsdp_source, 2*sizeof(uintptr_t), rsdp_addr);
}
start_barrier = smp_alloc_barrier(num_vcpus);
run_barrier = smp_alloc_barrier(num_vcpus);

View File

@ -252,6 +252,10 @@ static uintptr_t alloc_addr = 0;
int num_pcpus = 1; // There is always at least one CPU, the BSP
const char *rsdp_source = "";
uintptr_t rsdp_addr = 0;
//------------------------------------------------------------------------------
// Private Functions
//------------------------------------------------------------------------------
@ -511,15 +515,18 @@ static bool find_cpus_in_rsdp(void)
if (boot_params->acpi_rsdp_addr != 0) {
// Validate it
rp = scan_for_rsdp(boot_params->acpi_rsdp_addr, 0x8);
if (rp) rsdp_source = "boot parameters";
}
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);
if (rp) rsdp_source = "EFI32 system table";
}
#ifdef __x86_64__
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);
if (rp) rsdp_source = "EFI64 system table";
}
#endif
if (rp == NULL) {
@ -527,16 +534,19 @@ static bool find_cpus_in_rsdp(void)
uintptr_t address = *(uint16_t *)0x40E << 4;
if (address) {
rp = scan_for_rsdp(address, 0x400);
if (rp) rsdp_source = "BIOS EBDA";
}
}
if (rp == NULL) {
// Search the BIOS reserved area.
rp = scan_for_rsdp(0xE0000, 0x20000);
if (rp) rsdp_source = "BIOS reserved area";
}
if (rp == NULL) {
// RSDP not found, give up.
return false;
}
rsdp_addr = (uintptr_t)rp;
// Found the RSDP, now get either the RSDT or XSDT and scan it for a pointer to the MADT.
rsdt_header_t *rt;

View File

@ -36,6 +36,15 @@ typedef enum {
*/
extern int num_pcpus;
/*
* The search step that located the ACPI RSDP (for debug).
*/
extern const char *rsdp_source;
/*
* The address of the ACPI RSDP (for debug).
*/
extern uintptr_t rsdp_addr;
/*
* Initialises the SMP state and detects the number of physical CPUs.
*/