Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uefi: Look for an ACPI2 RSDP first #174

Merged
merged 4 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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))
Expand Down
9 changes: 6 additions & 3 deletions src/bin/uefi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ fn efi_main(image: Handle, st: SystemTable<Boot>) -> 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 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))
},
};

Expand Down