]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: /sys/firmware/efi missing during EFI boot
authorEric Snowberg <eric.snowberg@oracle.com>
Wed, 10 May 2017 14:50:11 +0000 (07:50 -0700)
committerShannon Nelson <shannon.nelson@oracle.com>
Wed, 31 May 2017 23:43:49 +0000 (16:43 -0700)
The newest version of OBP is capable of doing an EFI boot.  When Linux
is booted thru this EFI loader, the /sys/firmware/efi directory does
not exist.  Many userspace applications, such as GRUB, check whether
the dir /sys/firmware/efi exists, if it exists it means
the kernel has booted in EFI mode.

A new Open Firmware property called efi-booter has been added
to /chosen. This new property is only present when doing an
EFI boot.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by Thomas Tai <thomas.tai@oracle.com>

Orabug: 26037358
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/Kconfig
arch/sparc/kernel/setup_64.c
drivers/firmware/efi/efi.c

index d7e04608a4d5eb0e5c17278c85949c867215c0aa..33b47002d4ab77c50ee9cd9b4e32cab7ece151ac 100644 (file)
@@ -125,6 +125,10 @@ config AUDIT_ARCH
 config HAVE_SETUP_PER_CPU_AREA
        def_bool y if SPARC64
 
+config EFI
+       def_bool y if SPARC64
+       select UCS2_STRING
+
 config NEED_PER_CPU_EMBED_FIRST_CHUNK
        def_bool y if SPARC64
 
index 9e86df09a8e4a29556054117c2b97a1432a06d65..8e28a813cef2ae03b5b41b0834bf348c32c17200 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/start_kernel.h>
 #include <linux/bootmem.h>
 #include <linux/iommu-common.h>
+#include <linux/efi.h>
 
 #include <asm/io.h>
 #include <asm/processor.h>
@@ -662,6 +663,19 @@ void __init alloc_irqstack_bootmem(void)
        }
 }
 
+void __init sparc_efi_init(void)
+{
+#ifdef CONFIG_EFI
+       phandle node;
+
+       node = prom_finddevice("/chosen");
+       if (prom_getproplen(node, "efi-booter") > 0) {
+               set_bit(EFI_BOOT, &efi.flags);
+               set_bit(EFI_64BIT, &efi.flags);
+       }
+#endif
+}
+
 void __init setup_arch(char **cmdline_p)
 {
        /* Initialize PROM console and command line. */
@@ -717,6 +731,8 @@ void __init setup_arch(char **cmdline_p)
        }
 #endif
 
+       sparc_efi_init();
+
        /* Get boot processor trap_block[] setup.  */
        init_cur_cpu_trap(current_thread_info());
 
index 63226e9036a15a816ab62c110687e3ecc6b1c9e7..a859e576ed46c953cb7b4a70ae2a8dc0c6666007 100644 (file)
@@ -339,6 +339,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
        return 0;
 }
 
+#ifndef CONFIG_SPARC
 int __init efi_config_init(efi_config_table_type_t *arch_tables)
 {
        void *config_tables;
@@ -365,6 +366,7 @@ int __init efi_config_init(efi_config_table_type_t *arch_tables)
        early_memunmap(config_tables, efi.systab->nr_tables * sz);
        return ret;
 }
+#endif
 
 #ifdef CONFIG_EFI_VARS_MODULE
 static int __init efi_load_efivars(void)