Skip to content

Commit

Permalink
config_tables: Let ACPI tag type depend on config table entry type in…
Browse files Browse the repository at this point in the history
…stead of RSDP revision
  • Loading branch information
fruhland committed Oct 11, 2024
1 parent e31632c commit 92a2a60
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions towboot/src/boot/config_tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ use uefi::table::cfg::{
SMBIOS3_GUID,
};

static mut RSDP_V2_SET: bool = false;

/// Go through all of the configuration tables.
/// Some of them are interesting for Multiboot2.
pub(super) fn parse_for_multiboot(info_builder: &mut InfoBuilder) {
Expand Down Expand Up @@ -50,23 +48,28 @@ fn handle_acpi(table: &ConfigTableEntry, info_builder: &mut InfoBuilder) {
warn!("the RSDP is invalid");
return;
}
if rsdp.revision() == 0 {
info_builder.set_rsdp_v1(
rsdp.signature(), rsdp.checksum(),
rsdp.oem_id().as_bytes()[0..6].try_into().unwrap(),
rsdp.revision(), rsdp.rsdt_address(),
);
} else {
unsafe {
if !RSDP_V2_SET {
info_builder.set_rsdp_v2(
rsdp.signature(), rsdp.checksum(),
rsdp.oem_id().as_bytes()[0..6].try_into().unwrap(),
rsdp.revision(), rsdp.rsdt_address(), rsdp.length(),
rsdp.xsdt_address(), rsdp.ext_checksum(),
);
RSDP_V2_SET = true;

match table.guid {

Check failure on line 52 in towboot/src/boot/config_tables.rs

View workflow job for this annotation

GitHub Actions / test

non-exhaustive patterns: `uefi::Guid { time_low: 0_u32..=2288576624_u32, .. }`, `uefi::Guid { time_low: 2288576626_u32..=3952946479_u32, .. }` and `uefi::Guid { time_low: 3952946481_u32..=u32::MAX, .. }` not covered
ACPI_GUID => {
if rsdp.revision() != 0 {
warn!("expected RSDP version 0, but got {}", rsdp.revision());
}
info_builder.set_rsdp_v1(
rsdp.signature(), rsdp.checksum(),
rsdp.oem_id().as_bytes()[0..6].try_into().unwrap(),
rsdp.revision(), rsdp.rsdt_address(),
);
}
ACPI2_GUID => {
if rsdp.revision() == 0 {
warn!("expected RSDP version > 0, but got {}", rsdp.revision());
}
info_builder.set_rsdp_v2(
rsdp.signature(), rsdp.checksum(),
rsdp.oem_id().as_bytes()[0..6].try_into().unwrap(),
rsdp.revision(), rsdp.rsdt_address(), rsdp.length(),
rsdp.xsdt_address(), rsdp.ext_checksum(),
);
}
}
}
Expand Down

0 comments on commit 92a2a60

Please sign in to comment.