lkml.org 
[lkml]   [2020]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 2/6] efi/arm: a helper to parse secure boot param in fdt params
    Date
    Add a helper to query the UEFI secureboot param from the chosen node in
    FDT.

    Signed-off-by: Chester Lin <clin@suse.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
    \
     
     \ /
      Last update: 2020-09-04 09:30    [W:2.521 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site