Skip to contentSkip to conversation

[PATCH} SMBIOS support

PATCH Corey Minyard 3 participants 6 messages Apr 27, 2002 – Apr 28, 2002

lore
Share & tools
lore
#0 lore raw

The following patch adds support for reading the SMBIOS table (which contains system management information). It's required for IPMI and has useful information in it. But anyway, since I did the work, I thought I would post this.

It's relative to 2.5.9, but it should apply pretty cleanly to most other kernels.

-Corey

arch/i386/kernel/pci-pc.c renamed from arch/i386/kernel/pci-pc.c.smbios +8 -0
@@ -1293,6 +1293,10 @@
 	return;
 }
 
+#ifdef CONFIG_SMBIOS
+extern void smbios_init(void);
+#endif
+
 void __init pcibios_init(void)
 {
 	int quad;
@@ -1322,6 +1326,10 @@
 
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
+
+#ifdef CONFIG_SMBIOS
+	smbios_init();
+#endif
 
 #ifdef CONFIG_PCI_BIOS
 	if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))
arch/i386/kernel/smbios.c renamed from arch/i386/kernel/smbios.c.smbios +228 -0

228 lines not on this page · raw message

arch/i386/kernel/Makefile renamed from arch/i386/kernel/Makefile.smbios +3 -0
@@ -30,6 +30,9 @@
 obj-y			+= pci-pc.o pci-irq.o
 endif
 endif
+ifdef CONFIG_SMBIOS
+obj-y			+= smbios.o
+endif
 
 obj-$(CONFIG_MCA)		+= mca.o
 obj-$(CONFIG_MTRR)		+= mtrr.o
arch/i386/config.in renamed from arch/i386/config.in.smbios +1 -0
@@ -236,6 +236,7 @@
          define_bool CONFIG_PCI_DIRECT y
       fi
    fi
+   bool 'SMBIOS support' CONFIG_SMBIOS
 fi
 
 source drivers/pci/Config.in
arch/i386/Config.help renamed from arch/i386/Config.help.smbios +5 -0
@@ -936,3 +936,8 @@
 CONFIG_DEBUG_OBSOLETE
   Say Y here if you want to reduce the chances of the tree compiling,
   and are prepared to dig into driver internals to fix compile errors.
+
+CONFIG_SMBIOS
+  Look for the SM BIOS configuration tables in memory, and if they are
+  there record information about them.  Other things like IPMI use
+  these tables and require this to be set.
include/linux/smbios.h renamed from include/linux/smbios.h.smbios +59 -0

59 lines not on this page · raw message

#1 lore raw

On Fri, Apr 26, 2002 at 10:00:50PM -0500, Corey Minyard wrote:

Hi Corey,

Quoted 14 lines
arch/i386/kernel/pci-pc.c renamed from arch/i386/kernel/pci-pc.c.smbios +4 -0
@@ -1293,6 +1293,10 @@
 	return;
 }
 
+#ifdef CONFIG_SMBIOS
+extern void smbios_init(void);
+#endif
+
 void __init pcibios_init(void)
 {
 	int quad;

arch/i386/kernel/pci-pc.c line 1335

Quoted 10 lines
arch/i386/kernel/pci-pc.c renamed from arch/i386/kernel/pci-pc.c.smbios +4 -0
@@ -1322,6 +1326,10 @@
 
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
+
+#ifdef CONFIG_SMBIOS
+	smbios_init();
+#endif
 
 #ifdef CONFIG_PCI_BIOS
 	if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))

Any reason for initialising it there instead of using a subsys_initcall from smbios.c ?

Quoted 1 line

+void __init hexdump (u8 *data, int len)

Something this generic sounding should be static.

arch/i386/kernel/pci-pc.c

Quoted 1 line
arch/i386/kernel/pci-pc.c renamed from arch/i386/kernel/pci-pc.c.smbios +1 -0
+	char str[80];

Worth adding a if (len>80) return here in case of crap biosen? Or am I overly paranoid?

Dave.

Signature · 2 lines
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs
#2 lore raw
In reply to Corey Minyard
Quoted 26 lines · Dave Jones

On Fri, Apr 26, 2002 at 10:00:50PM -0500, Corey Minyard wrote:

Hi Corey,

Quoted 22 lines
arch/i386/kernel/pci-pc.c renamed from arch/i386/kernel/pci-pc.c.smbios +8 -0
@@ -1293,6 +1293,10 @@
 	return;
 }
 
+#ifdef CONFIG_SMBIOS
+extern void smbios_init(void);
+#endif
+
 void __init pcibios_init(void)
 {
 	int quad;
@@ -1322,6 +1326,10 @@
 
 	pcibios_fixup_irqs();
 	pcibios_resource_survey();
+
+#ifdef CONFIG_SMBIOS
+	smbios_init();
+#endif
 
Quoted 6 lines

arch/i386/kernel/pci-pc.c line 1335

Quoted 2 lines
arch/i386/kernel/pci-pc.c renamed from arch/i386/kernel/pci-pc.c.smbios +0 -0
 #ifdef CONFIG_PCI_BIOS
 	if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))

Any reason for initialising it there instead of using a subsys_initcall from smbios.c ?

Can you control other orders within the subsystem? Other things that come later in this subsystem might need it. Actually, it might be needed before this, I've moved it to before the PCI initialization, since this contains interrupt information and possible PCI information.

Quoted 6 lines
Quoted 3 lines

+void __init hexdump (u8 *data, int len)

Something this generic sounding should be static.

It's actually supposed to be in a #ifdef DEBUG, and it should be static, too.

Quoted 7 lines

arch/i386/kernel/pci-pc.c

Quoted 3 lines
arch/i386/kernel/pci-pc.c renamed from arch/i386/kernel/pci-pc.c.smbios +1 -0
+	char str[80];

Worth adding a if (len>80) return here in case of crap biosen? Or am I overly paranoid?

It's printing 16 hex characters every time, so it doesn't matter. And it's only debug code, anyway.

I've attached another patch.

-Corey

arch/i386/kernel/pci-pc.c renamed from arch/i386/kernel/pci-pc.c.smbios +8 -0
@@ -1293,9 +1293,17 @@
 	return;
 }
 
+#ifdef CONFIG_SMBIOS
+extern void smbios_init(void);
+#endif
+
 void __init pcibios_init(void)
 {
 	int quad;
+
+#ifdef CONFIG_SMBIOS
+	smbios_init();
+#endif
 
 	if (!pci_root_ops)
 		pcibios_config_init();
arch/i386/kernel/smbios.c renamed from arch/i386/kernel/smbios.c.smbios +231 -0

231 lines not on this page · raw message

arch/i386/kernel/Makefile renamed from arch/i386/kernel/Makefile.smbios +3 -0
@@ -30,6 +30,9 @@
 obj-y			+= pci-pc.o pci-irq.o
 endif
 endif
+ifdef CONFIG_SMBIOS
+obj-y			+= smbios.o
+endif
 
 obj-$(CONFIG_MCA)		+= mca.o
 obj-$(CONFIG_MTRR)		+= mtrr.o
arch/i386/config.in renamed from arch/i386/config.in.smbios +1 -0
@@ -236,6 +236,7 @@
          define_bool CONFIG_PCI_DIRECT y
       fi
    fi
+   bool 'SMBIOS support' CONFIG_SMBIOS
 fi
 
 source drivers/pci/Config.in
arch/i386/Config.help renamed from arch/i386/Config.help.smbios +5 -0
@@ -936,3 +936,8 @@
 CONFIG_DEBUG_OBSOLETE
   Say Y here if you want to reduce the chances of the tree compiling,
   and are prepared to dig into driver internals to fix compile errors.
+
+CONFIG_SMBIOS
+  Look for the SM BIOS configuration tables in memory, and if they are
+  there record information about them.  Other things like IPMI use
+  these tables and require this to be set.
include/linux/smbios.h renamed from include/linux/smbios.h.smbios +59 -0

59 lines not on this page · raw message

#3 lore raw
In reply to Corey Minyard
Quoted 3 lines · Corey Minyard
Quoted 2 lines

Any reason for initialising it there instead of using a subsys_initcall from smbios.c ?

Can you control other orders within the subsystem?

Use different types of _initcall. See include/linux/init.h

Quoted 4 lines

Other things that come later in this subsystem might need it Actually, it might be needed before this, I've moved it to before the PCI initialization,
since this contains interrupt information and possible PCI information.

Ok, I overlooked the relationship of PCI to SMBIOS.
As pci is initialised with subsys_initcall, you could initialise earlier by using core_initcall.

Quoted 5 lines
Quoted 3 lines

arch/i386/kernel/smbios.c line 161

Quoted 1 line
arch/i386/kernel/smbios.c renamed from arch/i386/kernel/smbios.c.smbios +1 -0
+	char str[80];

Worth adding a if (len>80) return here in case of crap biosen? Or am I overly paranoid?

It's printing 16 hex characters every time, so it doesn't matter. And it's only debug code, anyway.

Ok.

Dave.

Signature · 2 lines
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs
#4 lore raw
In reply to Corey Minyard
Quoted 4 lines

The following patch adds support for reading the SMBIOS table (which contains system management information). It's required for IPMI and has useful information in it. But anyway, since I did the work, I thought I would post this.

We already have DMI table parsing code in 2.4 and 2.5. Its been there for a very long time. Please use that instead

Alan

#5 lore raw
Quoted 9 lines · Alan Cox
Quoted 2 lines

The following patch adds support for reading the SMBIOS table (which contains system management information). It's required for IPMI and has useful information in it. But anyway, since I did the work, I thought I would post this.

We already have DMI table parsing code in 2.4 and 2.5. Its been there for a very long time. Please use that instead

Alan

Ah, now I see. All the documentation I had referenced SMBIOS and didn't say much about DMI, so I searched around everywhere for SMBIOS, not for DMI.

Thanks,

-Corey