Skip to contentSkip to conversation

New SMBIOS driver for x86 and ia64.

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

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

RFC PATCH 2/35 New SMBIOS driver for x86 and ia64.

This, along with the System Firmware (sysfw) interface replaces the existing DMI code in the kernel.

This subsystem provides functionality for individual drivers to access the SMBIOS structures for their own use, smbios_walk(), as well as some helper functions for some kernel modules.

---
 Documentation/ABI/obsolete/sysfs-dmi   |   40 ++
 Documentation/ABI/testing/sysfw-smbios |   36 ++
 arch/ia64/Kconfig                      |    5 +
 arch/ia64/include/asm/smbios.h         |   12 +
 arch/x86/Kconfig                       |   10 +
 arch/x86/include/asm/smbios.h          |   19 +
 drivers/firmware/Kconfig               |   20 +
 drivers/firmware/Makefile              |    2 +
 drivers/firmware/smbios-sysfs.c        |  700 ++++++++++++++++++++++++++++++++
 drivers/firmware/smbios.c              |  687 +++++++++++++++++++++++++++++++
 include/linux/smbios.h                 |  243 +++++++++++
 11 files changed, 1774 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/obsolete/sysfs-dmi
 create mode 100644 Documentation/ABI/testing/sysfw-smbios
 create mode 100644 arch/ia64/include/asm/smbios.h
 create mode 100644 arch/x86/include/asm/smbios.h
 create mode 100644 drivers/firmware/smbios-sysfs.c
 create mode 100644 drivers/firmware/smbios.c
 create mode 100644 include/linux/smbios.h
Documentation/ABI/obsolete/sysfs-dmi new file +40 -0
new file mode 100644
index 0000000..143aebc
@@ -0,0 +1,40 @@
+What:		/sys/class/dmi
+Date:		May 1 2011
+KernelVersion:	2.6.39
+Contact:	Prarit Bhargava <[email protected]>
+Description:
+		The dmi class is exported if CONFIG_SMBIOS_DMI_COMPAT is
+		set.
+
+		The DMI code currently exposes several values via sysfs.
+		These values are:
+
+		bios_date: The datestamp of the BIOS.
+		bios_vendor: The company that wrote the BIOS.
+		bios_version: The version of the BIOS.
+		board_asset_tag: A unique identifier for the system
+				 motherboard.
+		board_name: The name of the type of motherboard.
+		board_serial: The serial number of the motherboard.
+		board_vendor: The company that designed the motherboard.
+		board_version: The version of the motherboard.
+		chassis_asset_tag: A unique identifier for the chassis.
+		chassis_serial: The serial number of the chassis.
+		chassis_type: The type of chassis.
+		chassis_vendor: The company that designed the chassis.
+		chassis_version: The version of the chassis.
+		product_name: The name of the system as determined by the
+			      OEM.
+		product_serial: The serial number of the system.
+		product_uuid: A unique UUID for the system.
+		product_version: The version number of the system.
+		sys_vendor: The OEM company for the system.
+
+		In addition to these the standard class files are exposed
+		for DMI (uvent, power, subsystem) as well as a modalias
+		file.
+
+		The dmi class is deprecated and should not be used by new
+		code.  Existing code should be migrated to use
+		/sys/class/smbios/* which exposes the same data.
+		The dmi class link will be removed in December of 2012.
Documentation/ABI/testing/sysfw-smbios new file +36 -0
new file mode 100644
index 0000000..2a8758b
@@ -0,0 +1,36 @@
+What:		/sys/class/dmi
+Date:		May 1 2011
+KernelVersion:	2.6.39
+Contact:	Prarit Bhargava <[email protected]>
+Description:
+		The dmi class is exported if CONFIG_SMBIOS is set.
+
+		The SMBIOS code currently exposes several values via sysfs
+		primarily for use by module handling code.
+
+		These values are:
+
+		bios_date: The datestamp of the BIOS.
+		bios_vendor: The company that wrote the BIOS.
+		bios_version: The version of the BIOS.
+		board_asset_tag: A unique identifier for the system
+				 motherboard.
+		board_name: The name of the type of motherboard.
+		board_serial: The serial number of the motherboard.
+		board_vendor: The company that designed the motherboard.
+		board_version: The version of the motherboard.
+		chassis_asset_tag: A unique identifier for the chassis.
+		chassis_serial: The serial number of the chassis.
+		chassis_type: The type of chassis.
+		chassis_vendor: The company that designed the chassis.
+		chassis_version: The version of the chassis.
+		product_name: The name of the system as determined by the
+			      OEM.
+		product_serial: The serial number of the system.
+		product_uuid: A unique UUID for the system.
+		product_version: The version number of the system.
+		sys_vendor: The OEM company for the system.
+
+		In addition to these the standard class files are exposed
+		for SMBIOS (uvent, power, subsystem) as well as a modalias
+		file.
arch/ia64/Kconfig +5 -0
index 38280ef..ac14d3c 100644
@@ -93,6 +93,11 @@ config DMI
 	bool
 	default y
 
+config SMBIOS
+	bool
+	default y
+	depends on SYSTEM_FIRMWARE
+
 config EFI
 	bool
 	default y
arch/ia64/include/asm/smbios.h new file +12 -0
new file mode 100644
index 0000000..19c0019
@@ -0,0 +1,12 @@
+#ifndef _ASM_SMBIOS_H
+#define _ASM_SMBIOS_H 1
+
+#include <linux/slab.h>
+#include <asm/io.h>
+
+/* Use normal IO mappings for SMBIOS */
+#define smbios_ioremap ioremap
+#define smbios_iounmap(x, l) iounmap(x)
+#define smbios_alloc(l) kmalloc(l, GFP_ATOMIC)
+
+#endif
arch/x86/Kconfig +10 -0
index da34972..e7cdde8 100644
@@ -635,6 +635,16 @@ config DMI
 	  affected by entries in the DMI blacklist. Required by PNP
 	  BIOS code.
 
+config SMBIOS
+	depends on SYSTEM_FIRMWARE
+	bool "Enable SMBIOS scanning" if EXPERT
+	default y
+	---help---
+	  Enabled scanning of SMBIOS to identify machine quirks. Say Y
+	  here unless you have verified that your setup is not
+	  affected by entries in the SMBIOS blacklist. Required by PNP
+	  BIOS code.
+
 config GART_IOMMU
 	bool "GART IOMMU support" if EXPERT
 	default y
arch/x86/include/asm/smbios.h new file +19 -0
new file mode 100644
index 0000000..767270b
@@ -0,0 +1,19 @@
+#ifndef _ASM_X86_SMBIOS_H
+#define _ASM_X86_SMBIOS_H
+
+#include <linux/compiler.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+#include <asm/setup.h>
+
+static __always_inline __init void *smbios_alloc(unsigned len)
+{
+	return extend_brk(len, sizeof(int));
+}
+
+/* Use early IO mappings for SMBIOS because it's initialized early */
+#define smbios_ioremap early_ioremap
+#define smbios_iounmap early_iounmap
+
+#endif /* _ASM_X86_SMBIOS_H */
drivers/firmware/Kconfig +20 -0
index 79a1b9d..23066d8 100644
@@ -182,6 +182,26 @@ config SYSTEM_FIRMWARE_DMI_COMPAT
 	  should not be used in new user space software.  Please see
 	  Documentation/ABI for details.
 
+config SYSTEM_FIRMWARE_DMI_COMPAT
+	bool "Export dmi compatibility class in sysfs"
+	depends on SMBIOSID
+	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.
+
+config SMBIOS_SYSFS
+	tristate "SMBIOS table support in sysfs"
+	depends on SYSFS && SMBIOS
+	help
+	  Say Y or M here to enable the exporting of the raw SMBIOS table
+	  data via sysfs.  This is useful for consuming the data without
+	  requiring any access to /dev/mem at all.  Tables are found
+	  under /sys/firmware/smbios when this option is enabled and
+	  loaded.
+
 source "drivers/firmware/google/Kconfig"
 
 endmenu
drivers/firmware/Makefile +2 -0
index 41bc64a..5c9d81f 100644
@@ -16,3 +16,5 @@ obj-$(CONFIG_SIGMA)		+= sigma.o
 obj-$(CONFIG_GOOGLE_FIRMWARE)	+= google/
 obj-$(CONFIG_SYSTEM_FIRMWARE)	+= sysfw.o
 obj-$(CONFIG_SYSTEM_FIRMWARE_SYSFS)	+= sysfw-sysfs.o
+obj-$(CONFIG_SMBIOS)		+= smbios.o
+obj-$(CONFIG_SMBIOS_SYSFS)	+= smbios-sysfs.o
drivers/firmware/smbios-sysfs.c new file +700 -0

700 lines not on this page · raw message

drivers/firmware/smbios.c new file +687 -0

687 lines not on this page · raw message

include/linux/smbios.h new file +243 -0

243 lines not on this page · raw message

Signature · 1 line
1.7.5.1