[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200904072905.25332-3-clin@suse.com>
Date: Fri, 4 Sep 2020 15:29:01 +0800
From: Chester Lin <clin@...e.com>
To: ardb@...nel.org, catalin.marinas@....com, will@...nel.org,
zohar@...ux.ibm.com, dmitry.kasatkin@...il.com, corbet@....net,
mark.rutland@....com, vincenzo.frascino@....com,
samitolvanen@...gle.com, masahiroy@...nel.org, mingo@...nel.org
CC: linux-kernel@...r.kernel.org, linux-efi@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-integrity@...r.kernel.org, linux-doc@...r.kernel.org,
jlee@...e.com, clin@...e.com
Subject: [PATCH 2/6] efi/arm: a helper to parse secure boot param in fdt params
Add a helper to query the UEFI secureboot param from the chosen node in
FDT.
Signed-off-by: Chester Lin <clin@...e.com>
---
drivers/firmware/efi/fdtparams.c | 23 +++++++++++++++++++++++
include/linux/efi.h | 1 +
2 files changed, 24 insertions(+)
diff --git a/drivers/firmware/efi/fdtparams.c b/drivers/firmware/efi/fdtparams.c
index bb042ab7c2be..d58ec4119bcf 100644
--- a/drivers/firmware/efi/fdtparams.c
+++ b/drivers/firmware/efi/fdtparams.c
@@ -124,3 +124,26 @@ u64 __init efi_get_fdt_params(struct efi_memory_map_data *mm)
pr_info("UEFI not found.\n");
return 0;
}
+
+bool __init efi_secureboot_enabled_in_fdt(void)
+{
+ const void *fdt = initial_boot_params;
+ int node;
+ u32 secboot;
+
+
+ node = fdt_path_offset(fdt, "/chosen");
+
+ if (node < 0) {
+ pr_err("chosen node not found.\n");
+ return false;
+ }
+
+ if (!efi_get_fdt_prop(fdt, node, "linux,uefi-secure-boot",
+ "SECURE BOOT", &secboot, sizeof(secboot))) {
+ if (secboot)
+ return true;
+ }
+
+ return false;
+}
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 73db1ae04cef..315126b2f5e9 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -663,6 +663,7 @@ extern int efi_mem_reserve_persistent(phys_addr_t addr, u64 size);
extern void efi_initialize_iomem_resources(struct resource *code_resource,
struct resource *data_resource, struct resource *bss_resource);
extern u64 efi_get_fdt_params(struct efi_memory_map_data *data);
+extern bool __init efi_secureboot_enabled_in_fdt(void);
extern struct kobject *efi_kobj;
extern int efi_reboot_quirk_mode;
--
2.26.1
Powered by blists - more mailing lists