From 9fb7eb30f2094a1f4568c603adf92fa270252482 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Mon, 24 May 2021 12:39:23 +0200 Subject: [PATCH 1/4] Uefi: Look for an ACPI2 RSDP first Only look for an ACPI v1 RSDP if no v2 RSDP was found. --- src/bin/uefi.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/bin/uefi.rs b/src/bin/uefi.rs index c2ecc4a3..989c7cd6 100644 --- a/src/bin/uefi.rs +++ b/src/bin/uefi.rs @@ -59,9 +59,12 @@ fn efi_main(image: Handle, st: SystemTable) -> Status { rsdp_addr: { use uefi::table::cfg; let mut config_entries = system_table.config_table().iter(); - config_entries - .find(|entry| matches!(entry.guid, cfg::ACPI_GUID | cfg::ACPI2_GUID)) - .map(|entry| PhysAddr::new(entry.address as u64)) + // look for an ACPI2 RSDP first + let acpi2_rsdp = config_entries.find(|entry| matches!(entry.guid, cfg::ACPI2_GUID)); + // if no ACPI2 RSDP is found, look for a ACPI RSDP + let rsdp = acpi2_rsdp + .or_else(|| config_entries.find(|entry| matches!(entry.guid, cfg::ACPI_GUID))); + rsdp.map(|entry| PhysAddr::new(entry.address as u64)); }, }; From 8e7925602df21d7927ba00eacab128ea4b69cf64 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Mon, 24 May 2021 12:41:38 +0200 Subject: [PATCH 2/4] Update changelog --- Changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.md b/Changelog.md index f3c2fdd2..f365b38a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,7 @@ # Unreleased +- Uefi: Look for an ACPI2 RSDP first ([#174](https://github.com/rust-osdev/bootloader/pull/174)) + # 0.10.5 – 2021-05-21 - Fix build on latest Rust nightlies by updating `uefi-rs` dependency ([#170](https://github.com/rust-osdev/bootloader/pull/170)) From 88704ccb4c9fb56582dc95e37bb03b1c13f8875b Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Mon, 24 May 2021 12:54:24 +0200 Subject: [PATCH 3/4] Apply review suggestion Co-authored-by: bjorn3 --- src/bin/uefi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/uefi.rs b/src/bin/uefi.rs index 989c7cd6..d00fd2f0 100644 --- a/src/bin/uefi.rs +++ b/src/bin/uefi.rs @@ -61,7 +61,7 @@ fn efi_main(image: Handle, st: SystemTable) -> Status { let mut config_entries = system_table.config_table().iter(); // look for an ACPI2 RSDP first let acpi2_rsdp = config_entries.find(|entry| matches!(entry.guid, cfg::ACPI2_GUID)); - // if no ACPI2 RSDP is found, look for a ACPI RSDP + // if no ACPI2 RSDP is found, look for a ACPI1 RSDP let rsdp = acpi2_rsdp .or_else(|| config_entries.find(|entry| matches!(entry.guid, cfg::ACPI_GUID))); rsdp.map(|entry| PhysAddr::new(entry.address as u64)); From a9f9fbe15ae97eef90ac0372ddb5b514049806f8 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Mon, 24 May 2021 12:55:20 +0200 Subject: [PATCH 4/4] Fix syntax --- src/bin/uefi.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/uefi.rs b/src/bin/uefi.rs index d00fd2f0..2a398383 100644 --- a/src/bin/uefi.rs +++ b/src/bin/uefi.rs @@ -64,7 +64,7 @@ fn efi_main(image: Handle, st: SystemTable) -> Status { // if no ACPI2 RSDP is found, look for a ACPI1 RSDP let rsdp = acpi2_rsdp .or_else(|| config_entries.find(|entry| matches!(entry.guid, cfg::ACPI_GUID))); - rsdp.map(|entry| PhysAddr::new(entry.address as u64)); + rsdp.map(|entry| PhysAddr::new(entry.address as u64)) }, };