From 056fc41bb13620754479fcc4f3b21dea863b154d Mon Sep 17 00:00:00 2001 From: Jianyong Wu Date: Wed, 5 Jul 2023 10:14:16 +0000 Subject: [PATCH] efi/fdt: don't expose fdt to kernel There is a check that if fdt is stub when ACPI table initialized in linux kernel [1]. So, if full fdt is given, fdt will be used instead of ACPI. It is aginst our primary goal to use UEFI. So, full fdt can't be given here. For simplicity, just neglict it here. Remember that this is just a workaround as we are required to pass a FDT to kernel/grub to meet Arm Base Boot Requirement 7.4.3 [2]. It can be improved by making a stub fdt and pass it through configuration table. Maybe later. Fixes: #261 Signed-off-by: Jianyong Wu [1] https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203 [2] https://developer.arm.com/documentation/den0044/latest --- src/efi/mod.rs | 3 ++- src/fat.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/efi/mod.rs b/src/efi/mod.rs index 607f96bf..44971ec1 100644 --- a/src/efi/mod.rs +++ b/src/efi/mod.rs @@ -614,7 +614,6 @@ pub extern "efiapi" fn install_configuration_table(guid: *mut Guid, table: *mut for entry in ct.iter_mut() { if entry.vendor_guid == unsafe { *guid } { - entry.vendor_table = table; if table.is_null() { entry.vendor_guid = INVALID_GUID; entry.vendor_table = null_mut(); @@ -1115,6 +1114,8 @@ pub fn efi_exec( let mut ct_index = 0; // Populate with FDT table if present + // To boot with ACPI, we can't offer full fdt. Simply, neglect it. See https://github.com/torvalds/linux/blob/d528014517f2b0531862c02865b9d4c908019dc4/arch/arm64/kernel/acpi.c#L203 + #[cfg(not(target_arch = "aarch64"))] if let Some(fdt_entry) = info.fdt_reservation() { ct[ct_index] = efi::ConfigurationTable { vendor_guid: Guid::from_fields( diff --git a/src/fat.rs b/src/fat.rs index 4799db58..0d4317b8 100644 --- a/src/fat.rs +++ b/src/fat.rs @@ -1196,6 +1196,6 @@ mod tests { assert_eq!(crate::common::ascii_strip(&s), ".."); let mut s = [0_u8; 12]; super::name_to_str("ABCDEFGHIJK", &mut s); - assert_eq!(crate::common::ascii_strip(&s), "ABCDEFGHIJK"); + assert_eq!(crate::common::ascii_strip(&s), "ABCDEFGH.IJK"); } }