Skip to content

Commit

Permalink
Dirty fix for multiple ACPIv2 tags occurring on real hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
fruhland committed Aug 2, 2024
1 parent d545ad8 commit c36b13a
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions towboot/src/boot/config_tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ 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(
Expand Down Expand Up @@ -49,12 +51,17 @@ fn handle_acpi(table: &ConfigTableEntry, info_builder: &mut InfoBuilder) {
rsdp.revision(), rsdp.rsdt_address(),
);
} else {
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(),
);
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;
}
}
}
}

Expand Down

0 comments on commit c36b13a

Please sign in to comment.