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 0f5f08b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2024-06-01
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
Expand Down
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 0f5f08b

Please sign in to comment.