Skip to contentSkip to conversation

System Firmware Interface

RFC PATCH In review Prarit Bhargava 1 participant 1 message May 31, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/35 System Firmware Interface

This patch introduces a general System Firmware interface to the kernel, called sysfw.

Inlcluded in this interface is the ability to search a standard set of fields, sysfw_lookup(). The fields are currently based upon the x86 and ia64 SMBIOS fields but exapandable to fields that other arches may introduce. Also included is the ability to search and match against those fields, and run a callback function against the matches, sysfw_callback().

Modify module code to use sysfw instead of old DMI interface.

---
 drivers/firmware/Kconfig        |   25 ++++
 drivers/firmware/Makefile       |    3 +-
 drivers/firmware/sysfw-sysfs.c  |  266 +++++++++++++++++++++++++++++++++++++++
 drivers/firmware/sysfw.c        |  163 ++++++++++++++++++++++++
 include/linux/mod_devicetable.h |   62 +++++++++
 include/linux/sysfw.h           |  111 ++++++++++++++++
 init/main.c                     |    3 +
 scripts/mod/file2alias.c        |   52 ++++----
 8 files changed, 658 insertions(+), 27 deletions(-)
 create mode 100644 drivers/firmware/sysfw-sysfs.c
 create mode 100644 drivers/firmware/sysfw.c
 create mode 100644 include/linux/sysfw.h
drivers/firmware/Kconfig +25 -0
index efba163..79a1b9d 100644
@@ -157,6 +157,31 @@ config SIGMA
 	  If unsure, say N here.  Drivers that need these helpers will select
 	  this option automatically.
 
+config SYSTEM_FIRMWARE
+	bool "System Firmware Interface"
+	default y
+	help
+	  Enables common System Firmware Interface to export system firmware
+	  (SMBIOS, DMI, etc.) information to kernel and userspace.
+
+config SYSTEM_FIRMWARE_SYSFS
+	bool "Export System Firmware identification via sysfs to userspace"
+	depends on SYSTEM_FIRMWARE
+	help
+	  Say Y here if you want to query system identification information
+	  from userspace through /sys/class/sysfw/id/ or if you want
+	  system firmware (sysfw) based module auto-loading.
+
+config SYSTEM_FIRMWARE_DMI_COMPAT
+	bool "Export dmi compatibility class in sysfs"
+	depends on SYSTEM_FIRMWARE
+	default y
+	help
+	  This exposes /sys/class/dmi/* as a pointer to the sysfw class for
+	  old software.  This is purely a backwards compatability feature and
+	  should not be used in new user space software.  Please see
+	  Documentation/ABI for details.
+
 source "drivers/firmware/google/Kconfig"
 
 endmenu
drivers/firmware/Makefile +2 -1
index 47338c9..41bc64a 100644
@@ -13,5 +13,6 @@ obj-$(CONFIG_ISCSI_IBFT_FIND)	+= iscsi_ibft_find.o
 obj-$(CONFIG_ISCSI_IBFT)	+= iscsi_ibft.o
 obj-$(CONFIG_FIRMWARE_MEMMAP)	+= memmap.o
 obj-$(CONFIG_SIGMA)		+= sigma.o
-
 obj-$(CONFIG_GOOGLE_FIRMWARE)	+= google/
+obj-$(CONFIG_SYSTEM_FIRMWARE)	+= sysfw.o
+obj-$(CONFIG_SYSTEM_FIRMWARE_SYSFS)	+= sysfw-sysfs.o
drivers/firmware/sysfw-sysfs.c new file +266 -0

266 lines not on this page · raw message

drivers/firmware/sysfw.c new file +163 -0

163 lines not on this page · raw message

include/linux/mod_devicetable.h +62 -0

68 lines not on this page · raw message

include/linux/sysfw.h new file +111 -0

111 lines not on this page · raw message

init/main.c +3 -0
index cafba67..68e1136 100644
@@ -68,6 +68,7 @@
 #include <linux/shmem_fs.h>
 #include <linux/slab.h>
 #include <linux/perf_event.h>
+#include <linux/sysfw.h>
 
 #include <asm/io.h>
 #include <asm/bugs.h>
@@ -553,6 +554,8 @@ asmlinkage void __init start_kernel(void)
 
 	kmem_cache_init_late();
 
+	sysfw_init_late();
+
 	/*
 	 * HACK ALERT! This is early. We're enabling the console before
 	 * we've done PCI setups etc, and console_init() must be aware of
scripts/mod/file2alias.c +26 -26

82 lines not on this page · raw message

Signature · 1 line
1.7.5.1