From c36b13a6c29cf8f51a1b6f3ad8b8050e42879649 Mon Sep 17 00:00:00 2001 From: Fabian Ruhland Date: Fri, 2 Aug 2024 21:07:27 +0200 Subject: [PATCH] Dirty fix for multiple ACPIv2 tags occurring on real hardware --- towboot/src/boot/config_tables.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/towboot/src/boot/config_tables.rs b/towboot/src/boot/config_tables.rs index f16517d..2461a29 100644 --- a/towboot/src/boot/config_tables.rs +++ b/towboot/src/boot/config_tables.rs @@ -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( @@ -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; + } + } } }