Skip to contentSkip to conversation

efivars update for 2.6.1

PATCH Matt Tolentino 2 participants 2 messages Jan 15, 2004 EFI

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines

Big, isn't it?

Yes and no. It completely removes the existing efivars.c from arch/ia64/kernel and adds the updated one to drivers/efi (which is created by this patch). The rest is mostly just removing references to the /proc specific efi_dir reference.

Quoted 7 lines

I'd need confirmation from David M-T and if poss a quick review from Greg K-H.

Quoted 1 line

From a super-quick scan:

- Someone seems to have mangled the files with an editor which doesn't understand hard tabs.

Someone was me. ;-( The patch below should fix these...

Quoted 19 lines

- This function:

	> +static void __exit
	> +efivars_exit(void)
	> +{
	> +	struct list_head *pos, *n;
	> +
	> +        spin_lock(&efivars_lock);
	> +
	> +	list_for_each_safe(pos, n, &efivar_list)
	> +		efivar_unregister(get_efivar_entry(pos));
	> +
	> +	spin_unlock(&efivars_lock);
	> +
	> +	subsystem_unregister(&vars_subsys);
	> +	firmware_unregister(&efi_subsys);
	> +}
Quoted 2 lines

cannot call efivar_unregister() under spinlock - it does all sorts of illegal-under-spinlock things.

Thanks. I've updated the patch to use the lock immediately surrounding the list_del() in the release function, so as to avoid holding it when calling kobject_unregister().

matt

arch/i386/Kconfig +2 -0
diff -urN linux-2.6.1/arch/i386/Kconfig linux-2.6.1-efivars/arch/i386/Kconfig
@@ -808,6 +808,8 @@
 	anything about EFI).  However, even with this option, the resultant
 	kernel should continue to boot on existing non-EFI platforms.
 
+source "drivers/efi/Kconfig"
+
 config HAVE_DEC_LOCK
 	bool
 	depends on (SMP || PREEMPT) && X86_CMPXCHG
arch/i386/kernel/efi.c +2 -13
diff -urN linux-2.6.1/arch/i386/kernel/efi.c linux-2.6.1-efivars/arch/i386/kernel/efi.c
@@ -28,7 +28,7 @@
 #include <linux/spinlock.h>
 #include <linux/bootmem.h>
 #include <linux/ioport.h>
-#include <linux/proc_fs.h>
+#include <linux/module.h>
 #include <linux/efi.h>
 
 #include <asm/setup.h>
@@ -46,6 +46,7 @@
 extern efi_status_t asmlinkage efi_call_phys(void *, ...);
 
 struct efi efi;
+EXPORT_SYMBOL(efi);
 struct efi efi_phys __initdata;
 struct efi_memory_map memmap __initdata;
 
@@ -55,18 +56,6 @@
 extern void * boot_ioremap(unsigned long, unsigned long);
 
 /*
- * efi_dir is allocated here, but the directory isn't created
- * here, as proc_mkdir() doesn't work this early in the bootup
- * process.  Therefore, each module, like efivars, must test for
- *    if (!efi_dir) efi_dir = proc_mkdir("efi", NULL);
- * prior to creating their own entries under /proc/efi.
- */
-#ifdef CONFIG_PROC_FS
-struct proc_dir_entry *efi_dir;
-#endif
-
-
-/*
  * To make EFI call EFI runtime service in physical addressing mode we need
  * prelog/epilog before/after the invocation to disable interrupt, to
  * claim EFI runtime service handler exclusively and to duplicate a memory in
arch/ia64/Kconfig +1 -9
diff -urN linux-2.6.1/arch/ia64/Kconfig linux-2.6.1-efivars/arch/ia64/Kconfig
@@ -400,15 +400,7 @@
 	depends on !IA64_HP_SIM
 	default y
 
-config EFI_VARS
-	tristate "/proc/efi/vars support"
-	help
-	  If you say Y here, you are able to get EFI (Extensible Firmware
-	  Interface) variable information in /proc/efi/vars.  You may read,
-	  write, create, and destroy EFI variables through this interface.
-
-	  To use this option, you have to check that the "/proc file system
-	  support" (CONFIG_PROC_FS) is enabled, too.
+source "drivers/efi/Kconfig"
 
 config NR_CPUS
 	int "Maximum number of CPUs"
arch/ia64/kernel/efi.c +0 -20
diff -urN linux-2.6.1/arch/ia64/kernel/efi.c linux-2.6.1-efivars/arch/ia64/kernel/efi.c
@@ -23,7 +23,6 @@
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/time.h>
-#include <linux/proc_fs.h>
 #include <linux/efi.h>
 
 #include <asm/io.h>
@@ -39,17 +38,6 @@
 struct efi efi;
 static efi_runtime_services_t *runtime;
 
-/*
- * efi_dir is allocated here, but the directory isn't created
- * here, as proc_mkdir() doesn't work this early in the bootup
- * process.  Therefore, each module, like efivars, must test for
- *    if (!efi_dir)  efi_dir = proc_mkdir("efi", NULL);
- * prior to creating their own entries under /proc/efi.
- */
-#ifdef CONFIG_PROC_FS
-struct proc_dir_entry *efi_dir;
-#endif
-
 static unsigned long mem_limit = ~0UL;
 
 #define efi_call_virt(f, args...)	(*(f))(args)
@@ -748,11 +736,3 @@
 	}
 	return 0;
 }
-
-static void __exit
-efivars_exit (void)
-{
-#ifdef CONFIG_PROC_FS
- 	remove_proc_entry(efi_dir->name, NULL);
-#endif
-}
arch/ia64/kernel/efivars.c +0 -508

508 lines not on this page · raw message

arch/ia64/kernel/ia64_ksyms.c +0 -4
diff -urN linux-2.6.1/arch/ia64/kernel/ia64_ksyms.c linux-2.6.1-efivars/arch/ia64/kernel/ia64_ksyms.c
@@ -152,10 +152,6 @@
 extern struct efi efi;
 EXPORT_SYMBOL(efi);
 
-#include <linux/proc_fs.h>
-extern struct proc_dir_entry *efi_dir;
-EXPORT_SYMBOL(efi_dir);
-
 #include <asm/machvec.h>
 #ifdef CONFIG_IA64_GENERIC
 EXPORT_SYMBOL(ia64_mv);
arch/ia64/kernel/Makefile +0 -1
diff -urN linux-2.6.1/arch/ia64/kernel/Makefile linux-2.6.1-efivars/arch/ia64/kernel/Makefile
@@ -8,7 +8,6 @@
 	 irq_lsapic.o ivt.o machvec.o pal.o patch.o process.o perfmon.o ptrace.o sal.o		\
 	 salinfo.o semaphore.o setup.o signal.o sys_ia64.o time.o traps.o unaligned.o unwind.o
 
-obj-$(CONFIG_EFI_VARS)		+= efivars.o
 obj-$(CONFIG_IA64_BRL_EMU)	+= brl_emu.o
 obj-$(CONFIG_IA64_GENERIC)	+= acpi-ext.o
 obj-$(CONFIG_IA64_HP_ZX1)	+= acpi-ext.o
arch/ia64/mm/init.c +1 -0
diff -urN linux-2.6.1/arch/ia64/mm/init.c linux-2.6.1-efivars/arch/ia64/mm/init.c
@@ -18,6 +18,7 @@
 #include <linux/reboot.h>
 #include <linux/slab.h>
 #include <linux/swap.h>
+#include <linux/proc_fs.h>
 
 #include <asm/a.out.h>
 #include <asm/bitops.h>
drivers/efi/efivars.c +740 -0

740 lines not on this page · raw message

drivers/efi/Kconfig +18 -0
diff -urN linux-2.6.1/drivers/efi/Kconfig linux-2.6.1-efivars/drivers/efi/Kconfig
@@ -0,0 +1,18 @@
+#
+# EFI Driver Configuration
+#
+
+menu "EFI driver support"
+depends on EFI
+
+config EFI_VARS
+	tristate "EFI Variable Support via sysfs"
+	depends on EFI
+	default n
+	---help---
+	  If you say Y here, you are able to get EFI (Extensible Firmware
+	  Interface) variable information via sysfs.  You may read,
+	  write, create, and destroy EFI variables through this interface.
+
+
+endmenu
drivers/efi/Makefile +4 -0
diff -urN linux-2.6.1/drivers/efi/Makefile linux-2.6.1-efivars/drivers/efi/Makefile
@@ -0,0 +1,4 @@
+# EFI Variable Access
+
+obj-$(CONFIG_EFI_VARS)		+= efivars.o
+
drivers/Makefile +1 -0
diff -urN linux-2.6.1/drivers/Makefile linux-2.6.1-efivars/drivers/Makefile
@@ -49,3 +49,4 @@
 obj-$(CONFIG_MCA)		+= mca/
 obj-$(CONFIG_EISA)		+= eisa/
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
+obj-$(CONFIG_EFI)		+= efi/
include/linux/efi.h +1 -7
diff -urN linux-2.6.1/include/linux/efi.h linux-2.6.1-efivars/include/linux/efi.h
@@ -15,9 +15,9 @@
 #include <linux/string.h>
 #include <linux/time.h>
 #include <linux/types.h>
-#include <linux/proc_fs.h>
 #include <linux/rtc.h>
 #include <linux/ioport.h>
+#include <linux/kobject.h>
 
 #include <asm/page.h>
 #include <asm/system.h>
@@ -315,11 +315,5 @@
 #define EFI_VARIABLE_RUNTIME_ACCESS     0x0000000000000004
 
 
-/*
- * efi_dir is allocated in arch/ia64/kernel/efi.c.
- */
-#ifdef CONFIG_PROC_FS
-extern struct proc_dir_entry *efi_dir;
-#endif
 
 #endif /* _LINUX_EFI_H */
#1 lore raw

Well, how about adding the URL to the updated efibootmgr to the help-text for EFI_VARS?

	--david

+#
+# EFI Driver Configuration
+#
+
+menu "EFI driver support"
+depends on EFI
+
+config EFI_VARS
+ tristate "EFI Variable Support via sysfs"
+ depends on EFI
+ default n
+ ---help---

+	  If you say Y here, you are able to get EFI (Extensible Firmware
+	  Interface) variable information via sysfs.  You may read,
+	  write, create, and destroy EFI variables through this interface.

+
+
+endmenu