aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-01-11 16:43:33 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-11 22:04:51 -0500
commite99286744599a66195de4cd975d7ef4d643c2789 (patch)
treed231b075c9bdb0bd7fa48d0eb00551a529e4586a
parentb347d25fbc4616f4f37895e9afbe25b2bbc7e11f (diff)
[PATCH] x86_64: Generalize DMI and enable for x86-64
Some people need it now on 64bit so reuse the i386 code for x86-64. This will be also useful for future bug workarounds. It is a bit simplified there because there is no need to do it very early on x86-64. This means it doesn't need early ioremap et.al. We run it as a core initcall right now. I hope it's not needed for early setup. I added a general CONFIG_DMI symbol in case IA64 or someone else wants to reuse the code later too. Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/i386/Kconfig4
-rw-r--r--arch/i386/kernel/dmi_scan.c16
-rw-r--r--arch/i386/kernel/setup.c2
-rw-r--r--arch/x86_64/Kconfig4
-rw-r--r--arch/x86_64/kernel/Makefile5
-rw-r--r--arch/x86_64/kernel/setup.c9
-rw-r--r--include/asm-i386/io.h5
-rw-r--r--include/asm-x86_64/io.h5
-rw-r--r--include/linux/dmi.h5
9 files changed, 44 insertions, 11 deletions
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 815878ebd30f..81ae9627701d 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -41,6 +41,10 @@ config ARCH_MAY_HAVE_PC_FDC
41 bool 41 bool
42 default y 42 default y
43 43
44config DMI
45 bool
46 default y
47
44source "init/Kconfig" 48source "init/Kconfig"
45 49
46menu "Processor type and features" 50menu "Processor type and features"
diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c
index 58516e2ac172..6a93d75db431 100644
--- a/arch/i386/kernel/dmi_scan.c
+++ b/arch/i386/kernel/dmi_scan.c
@@ -4,7 +4,7 @@
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/dmi.h> 5#include <linux/dmi.h>
6#include <linux/bootmem.h> 6#include <linux/bootmem.h>
7 7#include <linux/slab.h>
8 8
9static char * __init dmi_string(struct dmi_header *dm, u8 s) 9static char * __init dmi_string(struct dmi_header *dm, u8 s)
10{ 10{
@@ -19,7 +19,7 @@ static char * __init dmi_string(struct dmi_header *dm, u8 s)
19 } 19 }
20 20
21 if (*bp != 0) { 21 if (*bp != 0) {
22 str = alloc_bootmem(strlen(bp) + 1); 22 str = dmi_alloc(strlen(bp) + 1);
23 if (str != NULL) 23 if (str != NULL)
24 strcpy(str, bp); 24 strcpy(str, bp);
25 else 25 else
@@ -40,7 +40,7 @@ static int __init dmi_table(u32 base, int len, int num,
40 u8 *buf, *data; 40 u8 *buf, *data;
41 int i = 0; 41 int i = 0;
42 42
43 buf = bt_ioremap(base, len); 43 buf = dmi_ioremap(base, len);
44 if (buf == NULL) 44 if (buf == NULL)
45 return -1; 45 return -1;
46 46
@@ -65,7 +65,7 @@ static int __init dmi_table(u32 base, int len, int num,
65 data += 2; 65 data += 2;
66 i++; 66 i++;
67 } 67 }
68 bt_iounmap(buf, len); 68 dmi_iounmap(buf, len);
69 return 0; 69 return 0;
70} 70}
71 71
@@ -112,7 +112,7 @@ static void __init dmi_save_devices(struct dmi_header *dm)
112 if ((*d & 0x80) == 0) 112 if ((*d & 0x80) == 0)
113 continue; 113 continue;
114 114
115 dev = alloc_bootmem(sizeof(*dev)); 115 dev = dmi_alloc(sizeof(*dev));
116 if (!dev) { 116 if (!dev) {
117 printk(KERN_ERR "dmi_save_devices: out of memory.\n"); 117 printk(KERN_ERR "dmi_save_devices: out of memory.\n");
118 break; 118 break;
@@ -131,7 +131,7 @@ static void __init dmi_save_ipmi_device(struct dmi_header *dm)
131 struct dmi_device *dev; 131 struct dmi_device *dev;
132 void * data; 132 void * data;
133 133
134 data = alloc_bootmem(dm->length); 134 data = dmi_alloc(dm->length);
135 if (data == NULL) { 135 if (data == NULL) {
136 printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); 136 printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
137 return; 137 return;
@@ -139,7 +139,7 @@ static void __init dmi_save_ipmi_device(struct dmi_header *dm)
139 139
140 memcpy(data, dm, dm->length); 140 memcpy(data, dm, dm->length);
141 141
142 dev = alloc_bootmem(sizeof(*dev)); 142 dev = dmi_alloc(sizeof(*dev));
143 if (!dev) { 143 if (!dev) {
144 printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); 144 printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
145 return; 145 return;
@@ -221,7 +221,7 @@ void __init dmi_scan_machine(void)
221 } 221 }
222 } 222 }
223 223
224out: printk(KERN_INFO "DMI not present.\n"); 224out: printk(KERN_INFO "DMI not present or invalid.\n");
225} 225}
226 226
227 227
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index f685637a100d..a720f743ea6e 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -45,6 +45,7 @@
45#include <linux/nodemask.h> 45#include <linux/nodemask.h>
46#include <linux/kexec.h> 46#include <linux/kexec.h>
47#include <linux/crash_dump.h> 47#include <linux/crash_dump.h>
48#include <linux/dmi.h>
48 49
49#include <video/edid.h> 50#include <video/edid.h>
50 51
@@ -146,7 +147,6 @@ EXPORT_SYMBOL(ist_info);
146struct e820map e820; 147struct e820map e820;
147 148
148extern void early_cpu_init(void); 149extern void early_cpu_init(void);
149extern void dmi_scan_machine(void);
150extern void generic_apic_probe(char *); 150extern void generic_apic_probe(char *);
151extern int root_mountflags; 151extern int root_mountflags;
152 152
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 348b4a0d0d6f..150e1ac0bfed 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -69,6 +69,10 @@ config ARCH_MAY_HAVE_PC_FDC
69 bool 69 bool
70 default y 70 default y
71 71
72config DMI
73 bool
74 default y
75
72source "init/Kconfig" 76source "init/Kconfig"
73 77
74 78
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index 12bc54005e2f..4601fdafb7cb 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -7,7 +7,8 @@ EXTRA_AFLAGS := -traditional
7obj-y := process.o signal.o entry.o traps.o irq.o \ 7obj-y := process.o signal.o entry.o traps.o irq.o \
8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \ 8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \
9 x8664_ksyms.o i387.o syscall.o vsyscall.o \ 9 x8664_ksyms.o i387.o syscall.o vsyscall.o \
10 setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o 10 setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \
11 dmi_scan.o
11 12
12obj-$(CONFIG_X86_MCE) += mce.o 13obj-$(CONFIG_X86_MCE) += mce.o
13obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o 14obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o
@@ -47,3 +48,5 @@ intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o
47quirks-y += ../../i386/kernel/quirks.o 48quirks-y += ../../i386/kernel/quirks.o
48i8237-y += ../../i386/kernel/i8237.o 49i8237-y += ../../i386/kernel/i8237.o
49msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o 50msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o
51dmi_scan-y += ../../i386/kernel/dmi_scan.o
52
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 33e77ec8da22..6810690d6045 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -44,6 +44,7 @@
44#include <linux/mmzone.h> 44#include <linux/mmzone.h>
45#include <linux/kexec.h> 45#include <linux/kexec.h>
46#include <linux/cpufreq.h> 46#include <linux/cpufreq.h>
47#include <linux/dmi.h>
47 48
48#include <asm/mtrr.h> 49#include <asm/mtrr.h>
49#include <asm/uaccess.h> 50#include <asm/uaccess.h>
@@ -1392,3 +1393,11 @@ struct seq_operations cpuinfo_op = {
1392 .stop = c_stop, 1393 .stop = c_stop,
1393 .show = show_cpuinfo, 1394 .show = show_cpuinfo,
1394}; 1395};
1396
1397static int __init run_dmi_scan(void)
1398{
1399 dmi_scan_machine();
1400 return 0;
1401}
1402core_initcall(run_dmi_scan);
1403
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index 7babb97a02eb..03233c2ab820 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -131,6 +131,11 @@ extern void iounmap(volatile void __iomem *addr);
131extern void *bt_ioremap(unsigned long offset, unsigned long size); 131extern void *bt_ioremap(unsigned long offset, unsigned long size);
132extern void bt_iounmap(void *addr, unsigned long size); 132extern void bt_iounmap(void *addr, unsigned long size);
133 133
134/* Use early IO mappings for DMI because it's initialized early */
135#define dmi_ioremap bt_ioremap
136#define dmi_iounmap bt_iounmap
137#define dmi_alloc alloc_bootmem
138
134/* 139/*
135 * ISA I/O bus memory addresses are 1:1 with the physical address. 140 * ISA I/O bus memory addresses are 1:1 with the physical address.
136 */ 141 */
diff --git a/include/asm-x86_64/io.h b/include/asm-x86_64/io.h
index 52ff269fe054..9dac18db8291 100644
--- a/include/asm-x86_64/io.h
+++ b/include/asm-x86_64/io.h
@@ -143,6 +143,11 @@ static inline void __iomem * ioremap (unsigned long offset, unsigned long size)
143extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size); 143extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
144extern void iounmap(volatile void __iomem *addr); 144extern void iounmap(volatile void __iomem *addr);
145 145
146/* Use normal IO mappings for DMI */
147#define dmi_ioremap ioremap
148#define dmi_iounmap(x,l) iounmap(x)
149#define dmi_alloc(l) kmalloc(l, GFP_ATOMIC)
150
146/* 151/*
147 * ISA I/O bus memory addresses are 1:1 with the physical address. 152 * ISA I/O bus memory addresses are 1:1 with the physical address.
148 */ 153 */
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 05f4132622fc..2e6bbe014157 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -2,6 +2,7 @@
2#define __DMI_H__ 2#define __DMI_H__
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/config.h>
5 6
6enum dmi_field { 7enum dmi_field {
7 DMI_NONE, 8 DMI_NONE,
@@ -60,12 +61,14 @@ struct dmi_device {
60 void *device_data; /* Type specific data */ 61 void *device_data; /* Type specific data */
61}; 62};
62 63
63#if defined(CONFIG_X86_32) 64#ifdef CONFIG_DMI
64 65
65extern int dmi_check_system(struct dmi_system_id *list); 66extern int dmi_check_system(struct dmi_system_id *list);
66extern char * dmi_get_system_info(int field); 67extern char * dmi_get_system_info(int field);
67extern struct dmi_device * dmi_find_device(int type, const char *name, 68extern struct dmi_device * dmi_find_device(int type, const char *name,
68 struct dmi_device *from); 69 struct dmi_device *from);
70extern void dmi_scan_machine(void);
71
69#else 72#else
70 73
71static inline int dmi_check_system(struct dmi_system_id *list) { return 0; } 74static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }