more debug output
[linux-2.4.git] / arch / i386 / kernel / dmi_scan.c
1 #include <linux/config.h>
2 #include <linux/types.h>
3 #include <linux/kernel.h>
4 #include <linux/string.h>
5 #include <linux/init.h>
6 #include <linux/apm_bios.h>
7 #include <linux/slab.h>
8 #include <asm/acpi.h>
9 #include <asm/io.h>
10 #include <linux/pm.h>
11 #include <asm/keyboard.h>
12 #include <asm/system.h>
13 #include <linux/bootmem.h>
14
15 #include "pci-i386.h"
16
17 unsigned long dmi_broken;
18 int is_sony_vaio_laptop;
19
20 struct dmi_header
21 {
22         u8      type;
23         u8      length;
24         u16     handle;
25 };
26
27 #ifdef DMI_DEBUG
28 #define dmi_printk(x) printk x
29 #else
30 #define dmi_printk(x)
31 #endif
32
33 static char * __init dmi_string(struct dmi_header *dm, u8 s)
34 {
35         u8 *bp=(u8 *)dm;
36         bp+=dm->length;
37         if(!s)
38                 return "";
39         s--;
40         while(s>0 && *bp)
41         {
42                 bp+=strlen(bp);
43                 bp++;
44                 s--;
45         }
46         return bp;
47 }
48
49 /*
50  *      We have to be cautious here. We have seen BIOSes with DMI pointers
51  *      pointing to completely the wrong place for example
52  */
53  
54 static int __init dmi_table(u32 base, int len, int num, void (*decode)(struct dmi_header *))
55 {
56         u8 *buf;
57         struct dmi_header *dm;
58         u8 *data;
59         int i=0;
60                 
61         buf = bt_ioremap(base, len);
62         if(buf==NULL)
63                 return -1;
64
65         data = buf;
66
67         /*
68          *      Stop when we see all the items the table claimed to have
69          *      OR we run off the end of the table (also happens)
70          */
71  
72         while(i<num && data-buf+sizeof(struct dmi_header)<=len)
73         {
74                 dm=(struct dmi_header *)data;
75                 /*
76                  *  We want to know the total length (formated area and strings)
77                  *  before decoding to make sure we won't run off the table in
78                  *  dmi_decode or dmi_string
79                  */
80                 data+=dm->length;
81                 while(data-buf<len-1 && (data[0] || data[1]))
82                         data++;
83                 if(data-buf<len-1)
84                         decode(dm);
85                 data+=2;
86                 i++;
87         }
88         bt_iounmap(buf, len);
89         return 0;
90 }
91
92
93 inline static int __init dmi_checksum(u8 *buf)
94 {
95         u8 sum=0;
96         int a;
97         
98         for(a=0; a<15; a++)
99                 sum+=buf[a];
100         return (sum==0);
101 }
102
103 static int __init dmi_iterate(void (*decode)(struct dmi_header *))
104 {
105         u8 buf[15];
106         u32 fp=0xF0000;
107
108         while( fp < 0xFFFFF)
109         {
110                 isa_memcpy_fromio(buf, fp, 15);
111                 if(memcmp(buf, "_DMI_", 5)==0 && dmi_checksum(buf))
112                 {
113                         u16 num=buf[13]<<8|buf[12];
114                         u16 len=buf[7]<<8|buf[6];
115                         u32 base=buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8];
116
117                         /*
118                          * DMI version 0.0 means that the real version is taken from
119                          * the SMBIOS version, which we don't know at this point.
120                          */
121                         if(buf[14]!=0)
122                                 dmi_printk((KERN_INFO "DMI %d.%d present.\n",
123                                         buf[14]>>4, buf[14]&0x0F));
124                         else
125                                 dmi_printk((KERN_INFO "DMI present.\n"));
126                         dmi_printk((KERN_INFO "%d structures occupying %d bytes.\n",
127                                 num, len));
128                         dmi_printk((KERN_INFO "DMI table at 0x%08X.\n",
129                                 base));
130                         if(dmi_table(base,len, num, decode)==0)
131                                 return 0;
132                 }
133                 fp+=16;
134         }
135         return -1;
136 }
137
138
139 enum
140 {
141         DMI_BIOS_VENDOR,
142         DMI_BIOS_VERSION,
143         DMI_BIOS_DATE,
144         DMI_SYS_VENDOR,
145         DMI_PRODUCT_NAME,
146         DMI_PRODUCT_VERSION,
147         DMI_BOARD_VENDOR,
148         DMI_BOARD_NAME,
149         DMI_BOARD_VERSION,
150         DMI_STRING_MAX
151 };
152
153 static char *dmi_ident[DMI_STRING_MAX];
154
155 /*
156  *      Save a DMI string
157  */
158  
159 static void __init dmi_save_ident(struct dmi_header *dm, int slot, int string)
160 {
161         char *d = (char*)dm;
162         char *p = dmi_string(dm, d[string]);
163         if(p==NULL || *p == 0)
164                 return;
165         if (dmi_ident[slot])
166                 return;
167         dmi_ident[slot] = alloc_bootmem(strlen(p)+1);
168         if(dmi_ident[slot])
169                 strcpy(dmi_ident[slot], p);
170         else
171                 printk(KERN_ERR "dmi_save_ident: out of memory.\n");
172 }
173
174 /*
175  *      DMI callbacks for problem boards
176  */
177
178 struct dmi_strmatch
179 {
180         u8 slot;
181         char *substr;
182 };
183
184 #define NONE    255
185
186 struct dmi_blacklist
187 {
188         int (*callback)(struct dmi_blacklist *);
189         char *ident;
190         struct dmi_strmatch matches[4];
191 };
192
193 #define NO_MATCH        { NONE, NULL}
194 #define MATCH(a,b)      { a, b }
195
196 /*
197  *      We have problems with IDE DMA on some platforms. In paticular the
198  *      KT7 series. On these it seems the newer BIOS has fixed them. The
199  *      rule needs to be improved to match specific BIOS revisions with
200  *      corruption problems
201  
202 static __init int disable_ide_dma(struct dmi_blacklist *d)
203 {
204 #ifdef CONFIG_BLK_DEV_IDE
205         extern int noautodma;
206         if(noautodma == 0)
207         {
208                 noautodma = 1;
209                 printk(KERN_INFO "%s series board detected. Disabling IDE DMA.\n", d->ident);
210         }
211 #endif  
212         return 0;
213 }
214  */ 
215
216 /* 
217  * Reboot options and system auto-detection code provided by
218  * Dell Computer Corporation so their systems "just work". :-)
219  */
220
221 /* 
222  * Some machines require the "reboot=b"  commandline option, this quirk makes that automatic.
223  */
224 static __init int set_bios_reboot(struct dmi_blacklist *d)
225 {
226         extern int reboot_thru_bios;
227         if (reboot_thru_bios == 0)
228         {
229                 reboot_thru_bios = 1;
230                 printk(KERN_INFO "%s series board detected. Selecting BIOS-method for reboots.\n", d->ident);
231         }
232         return 0;
233 }
234
235 /*
236  * Some machines require the "reboot=s"  commandline option, this quirk makes that automatic.
237  */
238 static __init int set_smp_reboot(struct dmi_blacklist *d)
239 {
240 #ifdef CONFIG_SMP
241         extern int reboot_smp;
242         if (reboot_smp == 0)
243         {
244                 reboot_smp = 1;
245                 printk(KERN_INFO "%s series board detected. Selecting SMP-method for reboots.\n", d->ident);
246         }
247 #endif
248         return 0;
249 }
250
251 /*
252  * Some machines require the "reboot=b,s"  commandline option, this quirk makes that automatic.
253  */
254 static __init int set_smp_bios_reboot(struct dmi_blacklist *d)
255 {
256         set_smp_reboot(d);
257         set_bios_reboot(d);
258         return 0;
259 }
260
261 /*
262  * Some bioses have a broken protected mode poweroff and need to use realmode
263  */
264
265 static __init int set_realmode_power_off(struct dmi_blacklist *d)
266 {
267        if (apm_info.realmode_power_off == 0)
268        {
269                apm_info.realmode_power_off = 1;
270                printk(KERN_INFO "%s bios detected. Using realmode poweroff only.\n", d->ident);
271        }
272        return 0;
273 }
274
275
276 /* 
277  * Some laptops require interrupts to be enabled during APM calls 
278  */
279
280 static __init int set_apm_ints(struct dmi_blacklist *d)
281 {
282         if (apm_info.allow_ints == 0)
283         {
284                 apm_info.allow_ints = 1;
285                 printk(KERN_INFO "%s machine detected. Enabling interrupts during APM calls.\n", d->ident);
286         }
287         return 0;
288 }
289
290 /* 
291  * Some APM bioses corrupt memory or just plain do not work
292  */
293
294 static __init int apm_is_horked(struct dmi_blacklist *d)
295 {
296         if (apm_info.disabled == 0)
297         {
298                 apm_info.disabled = 1;
299                 printk(KERN_INFO "%s machine detected. Disabling APM.\n", d->ident);
300         }
301         return 0;
302 }
303
304 static __init int apm_is_horked_d850md(struct dmi_blacklist *d)
305 {
306         if (apm_info.disabled == 0)
307         {
308                 apm_info.disabled = 1;
309                 printk(KERN_ERR "%s machine detected. Disabling APM.\n", d->ident);
310                 printk(KERN_ERR "This bug is fixed in bios P15 which is available for \n");
311                 printk(KERN_ERR "download from support.intel.com \n");
312         }
313         return 0;
314 }
315
316 /* 
317  * Some APM bioses hang on APM idle calls
318  */
319
320 static __init int apm_likes_to_melt(struct dmi_blacklist *d)
321 {
322         if (apm_info.forbid_idle == 0)
323         {
324                 apm_info.forbid_idle = 1;
325                 printk(KERN_INFO "%s machine detected. Disabling APM idle calls.\n", d->ident);
326         }
327         return 0;
328 }
329
330 /*
331  *  Check for clue free BIOS implementations who use
332  *  the following QA technique
333  *
334  *      [ Write BIOS Code ]<------
335  *               |                ^
336  *      < Does it Compile >----N--
337  *               |Y               ^
338  *      < Does it Boot Win98 >-N--
339  *               |Y
340  *           [Ship It]
341  *
342  *      Phoenix A04  08/24/2000 is known bad (Dell Inspiron 5000e)
343  *      Phoenix A07  09/29/2000 is known good (Dell Inspiron 5000)
344  */
345
346 static __init int broken_apm_power(struct dmi_blacklist *d)
347 {
348         apm_info.get_power_status_broken = 1;
349         printk(KERN_WARNING "BIOS strings suggest APM bugs, disabling power status reporting.\n");
350         return 0;
351 }               
352
353 /*
354  * Check for a Sony Vaio system
355  *
356  * On a Sony system we want to enable the use of the sonypi
357  * driver for Sony-specific goodies like the camera and jogdial.
358  * We also want to avoid using certain functions of the PnP BIOS.
359  */
360
361 static __init int sony_vaio_laptop(struct dmi_blacklist *d)
362 {
363         if (is_sony_vaio_laptop == 0)
364         {
365                 is_sony_vaio_laptop = 1;
366                 printk(KERN_INFO "%s laptop detected.\n", d->ident);
367         }
368         return 0;
369 }
370
371 /*
372  * This bios swaps the APM minute reporting bytes over (Many sony laptops
373  * have this problem).
374  */
375  
376 static __init int swab_apm_power_in_minutes(struct dmi_blacklist *d)
377 {
378         apm_info.get_power_status_swabinminutes = 1;
379         printk(KERN_WARNING "BIOS strings suggest APM reports battery life in minutes and wrong byte order.\n");
380         return 0;
381 }
382
383 /*
384  * ASUS K7V-RM has broken ACPI table defining sleep modes
385  */
386
387 static __init int broken_acpi_Sx(struct dmi_blacklist *d)
388 {
389         printk(KERN_WARNING "Detected ASUS mainboard with broken ACPI sleep table\n");
390         dmi_broken |= BROKEN_ACPI_Sx;
391         return 0;
392 }
393
394 /*
395  * Toshiba fails to preserve interrupts over S1
396  */
397
398 static __init int init_ints_after_s1(struct dmi_blacklist *d)
399 {
400         printk(KERN_WARNING "Toshiba with broken S1 detected.\n");
401         dmi_broken |= BROKEN_INIT_AFTER_S1;
402         return 0;
403 }
404
405 /*
406  * Some Bioses enable the PS/2 mouse (touchpad) at resume, even if it
407  * was disabled before the suspend. Linux gets terribly confused by that.
408  */
409
410 typedef void (pm_kbd_func) (void);
411
412 static __init int broken_ps2_resume(struct dmi_blacklist *d)
413 {
414 #if defined(CONFIG_VT) && !defined(CONFIG_DUMMY_KEYB)
415         if (pm_kbd_request_override == NULL)
416         {
417                 pm_kbd_request_override = pckbd_pm_resume;
418                 printk(KERN_INFO "%s machine detected. Mousepad Resume Bug workaround enabled.\n", d->ident);
419         }
420 #endif
421         return 0;
422 }
423
424 /*
425  * Work around broken HP Pavilion Notebooks which assign USB to
426  * IRQ 9 even though it is actually wired to IRQ 11
427  */
428 static __init int fix_broken_hp_bios_irq9(struct dmi_blacklist *d)
429 {
430 #ifdef CONFIG_PCI
431         extern int broken_hp_bios_irq9;
432         if (broken_hp_bios_irq9 == 0)
433         {
434                 broken_hp_bios_irq9 = 1;
435                 printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", d->ident);
436         }
437 #endif
438         return 0;
439 }
440
441 /*
442  * Work around broken Acer TravelMate 360 Notebooks which assign Cardbus to
443  * IRQ 11 even though it is actually wired to IRQ 10
444  */
445 static __init int fix_acer_tm360_irqrouting(struct dmi_blacklist *d)
446 {
447 #ifdef CONFIG_PCI
448         extern int acer_tm360_irqrouting;
449         if (acer_tm360_irqrouting == 0) {
450                 acer_tm360_irqrouting = 1;
451                 printk(KERN_INFO "%s detected - fixing broken IRQ routing\n", d->ident);
452         }
453 #endif
454         return 0;
455 }
456
457 /*
458  *      Exploding PnPBIOS. Don't yet know if its the BIOS or us for
459  *      some entries
460  */
461
462 static __init int exploding_pnp_bios(struct dmi_blacklist *d)
463 {
464         printk(KERN_WARNING "%s detected. Disabling PnPBIOS\n", d->ident);
465         dmi_broken |= BROKEN_PNP_BIOS;
466         return 0;
467 }
468
469 /*
470  *      Simple "print if true" callback
471  */
472  
473 static __init int print_if_true(struct dmi_blacklist *d)
474 {
475         printk("%s\n", d->ident);
476         return 0;
477 }
478
479
480 #ifdef  CONFIG_ACPI_BOOT
481 extern int acpi_force;
482
483 static __init __attribute__((unused)) int dmi_disable_acpi(struct dmi_blacklist *d) 
484
485         if (!acpi_force) { 
486                 printk(KERN_NOTICE "%s detected: acpi off\n",d->ident); 
487                 disable_acpi();
488         } else { 
489                 printk(KERN_NOTICE 
490                        "Warning: DMI blacklist says broken, but acpi forced\n"); 
491         }
492         return 0;
493
494
495
496 /*
497  * Limit ACPI to CPU enumeration for HT
498  */
499 static __init __attribute__((unused)) int force_acpi_ht(struct dmi_blacklist *d) 
500
501         if (!acpi_force) { 
502                 printk(KERN_NOTICE "%s detected: force use of acpi=ht\n", d->ident); 
503                 disable_acpi();
504                 acpi_ht = 1; 
505         } else { 
506                 printk(KERN_NOTICE 
507                        "Warning: acpi=force overrules DMI blacklist: acpi=ht\n"); 
508         }
509         return 0;
510
511 #endif  /* CONFIG_ACPI_BOOT */
512
513 #ifdef  CONFIG_ACPI_PCI
514 static __init int disable_acpi_pci(struct dmi_blacklist *d) 
515
516         printk(KERN_NOTICE "%s detected: force use of pci=noacpi\n", d->ident);
517         acpi_noirq_set();
518         return 0;
519
520 #endif  /* CONFIG_ACPI_PCI */
521
522 /*
523  *      Process the DMI blacklists
524  */
525  
526
527 /*
528  *      This will be expanded over time to force things like the APM 
529  *      interrupt mask settings according to the laptop
530  */
531  
532 static __initdata struct dmi_blacklist dmi_blacklist[]={
533 #if 0
534         { disable_ide_dma, "KT7", {     /* Overbroad right now - kill DMA on problem KT7 boards */
535                         MATCH(DMI_PRODUCT_NAME, "KT7-RAID"),
536                         NO_MATCH, NO_MATCH, NO_MATCH
537                         } },
538         { disable_ide_dma, "Dell Inspiron 8100", {      /* Kill DMA on Dell Inspiron 8100 laptops */
539                         MATCH(DMI_PRODUCT_NAME, "Inspiron 8100"),
540                         MATCH(DMI_SYS_VENDOR,"Dell Computer Corporation"), NO_MATCH, NO_MATCH
541                         } },
542
543 #endif                  
544         /* Dell Laptop hall of shame */
545         { broken_ps2_resume, "Dell Latitude C600", {    /* Handle problems with APM on the C600 */
546                         MATCH(DMI_SYS_VENDOR, "Dell"),
547                         MATCH(DMI_PRODUCT_NAME, "Latitude C600"),
548                         NO_MATCH, NO_MATCH
549                         } },
550         { apm_is_horked, "Dell Inspiron 2500", { /* APM crashes */
551                         MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
552                         MATCH(DMI_PRODUCT_NAME, "Inspiron 2500"),
553                         MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
554                         MATCH(DMI_BIOS_VERSION,"A11")
555                         } },
556         { apm_is_horked, "Dell Dimension 4100", { /* APM crashes */
557                         MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
558                         MATCH(DMI_PRODUCT_NAME, "XPS-Z"),
559                         MATCH(DMI_BIOS_VENDOR,"Intel Corp."),
560                         MATCH(DMI_BIOS_VERSION,"A11")
561                         } },
562         { set_apm_ints, "Dell Inspiron", {      /* Allow interrupts during suspend on Dell Inspiron laptops*/
563                         MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
564                         MATCH(DMI_PRODUCT_NAME, "Inspiron 4000"),
565                         NO_MATCH, NO_MATCH
566                         } },
567         { set_apm_ints, "Dell Latitude", {      /* Allow interrupts during suspend on Dell Latitude laptops*/
568                         MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
569                         MATCH(DMI_PRODUCT_NAME, "Latitude C510"),
570                         NO_MATCH, NO_MATCH
571                         } },
572         { broken_apm_power, "Dell Inspiron 5000e", {    /* Handle problems with APM on Inspiron 5000e */
573                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
574                         MATCH(DMI_BIOS_VERSION, "A04"),
575                         MATCH(DMI_BIOS_DATE, "08/24/2000"), NO_MATCH
576                         } },
577
578         /* other items */       
579         { broken_apm_power, "Dell Inspiron 2500", {     /* Handle problems with APM on Inspiron 2500 */
580                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
581                         MATCH(DMI_BIOS_VERSION, "A12"),
582                         MATCH(DMI_BIOS_DATE, "02/04/2002"), NO_MATCH
583                         } },
584         { set_realmode_power_off, "Award Software v4.60 PGMA", {        /* broken PM poweroff bios */
585                         MATCH(DMI_BIOS_VENDOR, "Award Software International, Inc."),
586                         MATCH(DMI_BIOS_VERSION, "4.60 PGMA"),
587                         MATCH(DMI_BIOS_DATE, "134526184"), NO_MATCH
588                         } },
589         { set_smp_bios_reboot, "Dell PowerEdge 1300", { /* Handle problems with rebooting on Dell 1300's */
590                         MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
591                         MATCH(DMI_PRODUCT_NAME, "PowerEdge 1300/"),
592                         NO_MATCH, NO_MATCH
593                         } },
594         { set_bios_reboot, "Dell PowerEdge 300", {      /* Handle problems with rebooting on Dell 1300's */
595                         MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
596                         MATCH(DMI_PRODUCT_NAME, "PowerEdge 300/"),
597                         NO_MATCH, NO_MATCH
598                         } },
599         { set_bios_reboot, "Dell PowerEdge 2400", {  /* Handle problems with rebooting on Dell 2400's */
600                         MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
601                         MATCH(DMI_PRODUCT_NAME, "PowerEdge 2400"),
602                         NO_MATCH, NO_MATCH
603                         } },
604         { set_apm_ints, "Compaq 12XL125", {     /* Allow interrupts during suspend on Compaq Laptops*/
605                         MATCH(DMI_SYS_VENDOR, "Compaq"),
606                         MATCH(DMI_PRODUCT_NAME, "Compaq PC"),
607                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
608                         MATCH(DMI_BIOS_VERSION,"4.06")
609                         } },
610         { set_apm_ints, "ASUSTeK", {   /* Allow interrupts during APM or the clock goes slow */
611                         MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
612                         MATCH(DMI_PRODUCT_NAME, "L8400K series Notebook PC"),
613                         NO_MATCH, NO_MATCH
614                         } },                                    
615         { apm_is_horked, "ABIT KX7-333[R]", { /* APM blows on shutdown */
616                         MATCH(DMI_BOARD_VENDOR, "ABIT"),
617                         MATCH(DMI_BOARD_NAME, "VT8367-8233A (KX7-333[R])"),
618                         NO_MATCH, NO_MATCH,
619                         } },
620         { apm_is_horked, "Trigem Delhi3", { /* APM crashes */
621                         MATCH(DMI_SYS_VENDOR, "TriGem Computer, Inc"),
622                         MATCH(DMI_PRODUCT_NAME, "Delhi3"),
623                         NO_MATCH, NO_MATCH,
624                         } },
625         { apm_is_horked, "Fujitsu-Siemens", { /* APM crashes */
626                         MATCH(DMI_BIOS_VENDOR, "hoenix/FUJITSU SIEMENS"),
627                         MATCH(DMI_BIOS_VERSION, "Version1.01"),
628                         NO_MATCH, NO_MATCH,
629                         } },
630         { apm_is_horked_d850md, "Intel D850MD", { /* APM crashes */
631                         MATCH(DMI_BIOS_VENDOR, "Intel Corp."),
632                         MATCH(DMI_BIOS_VERSION, "MV85010A.86A.0016.P07.0201251536"),
633                         NO_MATCH, NO_MATCH,
634                         } },
635         { apm_is_horked, "Intel D810EMO", { /* APM crashes */
636                         MATCH(DMI_BIOS_VENDOR, "Intel Corp."),
637                         MATCH(DMI_BIOS_VERSION, "MO81010A.86A.0008.P04.0004170800"),
638                         NO_MATCH, NO_MATCH,
639                         } },
640         { apm_is_horked, "Dell XPS-Z", { /* APM crashes */
641                         MATCH(DMI_BIOS_VENDOR, "Intel Corp."),
642                         MATCH(DMI_BIOS_VERSION, "A11"),
643                         MATCH(DMI_PRODUCT_NAME, "XPS-Z"),
644                         NO_MATCH,
645                         } },
646         { apm_is_horked, "Sharp PC-PJ/AX", { /* APM crashes */
647                         MATCH(DMI_SYS_VENDOR, "SHARP"),
648                         MATCH(DMI_PRODUCT_NAME, "PC-PJ/AX"),
649                         MATCH(DMI_BIOS_VENDOR,"SystemSoft"),
650                         MATCH(DMI_BIOS_VERSION,"Version R2.08")
651                         } },
652         { apm_is_horked, "Dell Inspiron 2500", { /* APM crashes */
653                         MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
654                         MATCH(DMI_PRODUCT_NAME, "Inspiron 2500"),
655                         MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
656                         MATCH(DMI_BIOS_VERSION,"A11")
657                         } },
658         { apm_likes_to_melt, "Jabil AMD", { /* APM idle hangs */
659                         MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
660                         MATCH(DMI_BIOS_VERSION, "0AASNP06"),
661                         NO_MATCH, NO_MATCH,
662                         } },
663         { apm_likes_to_melt, "AMI Bios", { /* APM idle hangs */
664                         MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
665                         MATCH(DMI_BIOS_VERSION, "0AASNP05"), 
666                         NO_MATCH, NO_MATCH,
667                         } },
668         { apm_likes_to_melt, "Dell Inspiron 7500", { /* APM idle hangs */
669                         MATCH(DMI_SYS_VENDOR, "Dell Computer Corporation"),
670                         MATCH(DMI_PRODUCT_NAME,  "Inspiron 7500"), 
671                         NO_MATCH, NO_MATCH,
672                         } },
673
674         { sony_vaio_laptop, "Sony Vaio", { /* This is a Sony Vaio laptop */
675                         MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
676                         MATCH(DMI_PRODUCT_NAME, "PCG-"),
677                         NO_MATCH, NO_MATCH,
678                         } },
679         { swab_apm_power_in_minutes, "Sony VAIO", { /* Handle problems with APM on Sony Vaio PCG-N505X(DE) */
680                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
681                         MATCH(DMI_BIOS_VERSION, "R0206H"),
682                         MATCH(DMI_BIOS_DATE, "08/23/99"), NO_MATCH
683         } },
684
685         { swab_apm_power_in_minutes, "Sony VAIO", { /* Handle problems with APM on Sony Vaio PCG-N505VX */
686                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
687                         MATCH(DMI_BIOS_VERSION, "W2K06H0"),
688                         MATCH(DMI_BIOS_DATE, "02/03/00"), NO_MATCH
689                         } },
690                         
691         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-XG29 */
692                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
693                         MATCH(DMI_BIOS_VERSION, "R0117A0"),
694                         MATCH(DMI_BIOS_DATE, "04/25/00"), NO_MATCH
695                         } },
696
697         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-Z600NE */
698                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
699                         MATCH(DMI_BIOS_VERSION, "R0121Z1"),
700                         MATCH(DMI_BIOS_DATE, "05/11/00"), NO_MATCH
701                         } },
702
703         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-Z600NE */
704                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
705                         MATCH(DMI_BIOS_VERSION, "WME01Z1"),
706                         MATCH(DMI_BIOS_DATE, "08/11/00"), NO_MATCH
707                         } },
708
709         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-Z600LEK(DE) */
710                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
711                         MATCH(DMI_BIOS_VERSION, "R0206Z3"),
712                         MATCH(DMI_BIOS_DATE, "12/25/00"), NO_MATCH
713                         } },
714
715         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-Z505LS */
716                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
717                         MATCH(DMI_BIOS_VERSION, "R0203D0"),
718                         MATCH(DMI_BIOS_DATE, "05/12/00"), NO_MATCH
719                         } },
720
721         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-Z505LS */
722                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
723                         MATCH(DMI_BIOS_VERSION, "R0203Z3"),
724                         MATCH(DMI_BIOS_DATE, "08/25/00"), NO_MATCH
725                         } },
726         
727         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-Z505LS (with updated BIOS) */
728                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
729                         MATCH(DMI_BIOS_VERSION, "R0209Z3"),
730                         MATCH(DMI_BIOS_DATE, "05/12/01"), NO_MATCH
731                         } },
732         
733         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-Z505LS (with updated BIOS) */
734                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
735                         MATCH(DMI_BIOS_VERSION, "WXP01Z3"),
736                         MATCH(DMI_BIOS_DATE, "10/26/01"), NO_MATCH
737                         } },
738         
739         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-F104K */
740                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
741                         MATCH(DMI_BIOS_VERSION, "R0204K2"),
742                         MATCH(DMI_BIOS_DATE, "08/28/00"), NO_MATCH
743                         } },
744         
745         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-C1VN/C1VE */
746                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
747                         MATCH(DMI_BIOS_VERSION, "R0208P1"),
748                         MATCH(DMI_BIOS_DATE, "11/09/00"), NO_MATCH
749                         } },
750         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-C1VE */
751                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
752                         MATCH(DMI_BIOS_VERSION, "R0204P1"),
753                         MATCH(DMI_BIOS_DATE, "09/12/00"), NO_MATCH
754                         } },
755                         
756         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-Z600RE */
757                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
758                         MATCH(DMI_BIOS_VERSION, "R0116Z1"),
759                         NO_MATCH, NO_MATCH
760                         } },
761         
762         { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-Z600RE */
763                         MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
764                         MATCH(DMI_BIOS_VERSION, "RK116Z1"),
765                         NO_MATCH, NO_MATCH
766                         } },
767
768         { exploding_pnp_bios, "Higraded P14H", {        /* BIOSPnP problem */
769                         MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
770                         MATCH(DMI_BIOS_VERSION, "07.00T"),
771                         MATCH(DMI_SYS_VENDOR, "Higraded"),
772                         MATCH(DMI_PRODUCT_NAME, "P14H")
773                         } },
774
775         { init_ints_after_s1, "Toshiba Satellite 4030cdt", { /* Reinitialization of 8259 is needed after S1 resume */
776                         MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
777                         NO_MATCH, NO_MATCH, NO_MATCH
778                         } },
779
780         { broken_acpi_Sx, "ASUS K7V-RM", {              /* Bad ACPI Sx table */
781                         MATCH(DMI_BIOS_VERSION,"ASUS K7V-RM ACPI BIOS Revision 1003A"),
782                         MATCH(DMI_BOARD_NAME, "<K7V-RM>"),
783                         NO_MATCH, NO_MATCH
784                         } },
785                         
786         { print_if_true, KERN_WARNING "IBM T23 - BIOS 1.03b+ and controller firmware 1.02+ may be needed for Linux APM.", {
787                         MATCH(DMI_SYS_VENDOR, "IBM"),
788                         MATCH(DMI_BIOS_VERSION, "1AET38WW (1.01b)"),
789                         NO_MATCH, NO_MATCH
790                         } },
791          
792         { fix_broken_hp_bios_irq9, "HP Pavilion N5400 Series Laptop", {
793                         MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
794                         MATCH(DMI_BIOS_VERSION, "GE.M1.03"),
795                         MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook Model GE"),
796                         MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736")
797                         } },
798
799         { fix_acer_tm360_irqrouting, "Acer TravelMate 36x Laptop", {
800                         MATCH(DMI_SYS_VENDOR, "Acer"),
801                         MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
802                         NO_MATCH, NO_MATCH
803                         } },
804  
805         /*
806          *      Generic per vendor APM settings
807          */
808          
809         { set_apm_ints, "IBM", {        /* Allow interrupts during suspend on IBM laptops */
810                         MATCH(DMI_SYS_VENDOR, "IBM"),
811                         NO_MATCH, NO_MATCH, NO_MATCH
812                         } },
813
814 #ifdef  CONFIG_ACPI_BOOT
815         /*
816          * If your system is blacklisted here, but you find that acpi=force
817          * works for you, please contact acpi-devel@sourceforge.net
818          */
819
820         /*
821          *      Boxes that need ACPI disabled
822          */
823
824         { dmi_disable_acpi, "IBM Thinkpad", {
825                         MATCH(DMI_BOARD_VENDOR, "IBM"),
826                         MATCH(DMI_BOARD_NAME, "2629H1G"),
827                         NO_MATCH, NO_MATCH }},
828
829         /*
830          *      Boxes that need acpi=ht 
831          */
832
833         { force_acpi_ht, "FSC Primergy T850", {
834                         MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
835                         MATCH(DMI_PRODUCT_NAME, "PRIMERGY T850"),
836                         NO_MATCH, NO_MATCH }},
837
838         { force_acpi_ht, "DELL GX240", {
839                         MATCH(DMI_BOARD_VENDOR, "Dell Computer Corporation"),
840                         MATCH(DMI_BOARD_NAME, "OptiPlex GX240"),
841                         NO_MATCH, NO_MATCH }},
842
843         { force_acpi_ht, "HP VISUALIZE NT Workstation", {
844                         MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
845                         MATCH(DMI_PRODUCT_NAME, "HP VISUALIZE NT Workstation"),
846                         NO_MATCH, NO_MATCH }},
847
848         { force_acpi_ht, "Compaq ProLiant DL380 G2", {
849                         MATCH(DMI_SYS_VENDOR, "Compaq"),
850                         MATCH(DMI_PRODUCT_NAME, "ProLiant DL380 G2"),
851                         NO_MATCH, NO_MATCH }},
852
853         { force_acpi_ht, "Compaq ProLiant ML530 G2", {
854                         MATCH(DMI_SYS_VENDOR, "Compaq"),
855                         MATCH(DMI_PRODUCT_NAME, "ProLiant ML530 G2"),
856                         NO_MATCH, NO_MATCH }},
857
858         { force_acpi_ht, "Compaq ProLiant ML350 G3", {
859                         MATCH(DMI_SYS_VENDOR, "Compaq"),
860                         MATCH(DMI_PRODUCT_NAME, "ProLiant ML350 G3"),
861                         NO_MATCH, NO_MATCH }},
862
863         { force_acpi_ht, "Compaq Workstation W8000", {
864                         MATCH(DMI_SYS_VENDOR, "Compaq"),
865                         MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
866                         NO_MATCH, NO_MATCH }},
867
868         { force_acpi_ht, "ASUS P4B266", {
869                         MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
870                         MATCH(DMI_BOARD_NAME, "P4B266"),
871                         NO_MATCH, NO_MATCH }},
872
873         { force_acpi_ht, "ASUS P2B-DS", {
874                         MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
875                         MATCH(DMI_BOARD_NAME, "P2B-DS"),
876                         NO_MATCH, NO_MATCH }},
877
878         { force_acpi_ht, "ASUS CUR-DLS", {
879                         MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
880                         MATCH(DMI_BOARD_NAME, "CUR-DLS"),
881                         NO_MATCH, NO_MATCH }},
882
883         { force_acpi_ht, "ABIT i440BX-W83977", {
884                         MATCH(DMI_BOARD_VENDOR, "ABIT <http://www.abit.com>"),
885                         MATCH(DMI_BOARD_NAME, "i440BX-W83977 (BP6)"),
886                         NO_MATCH, NO_MATCH }},
887
888         { force_acpi_ht, "IBM Bladecenter", {
889                         MATCH(DMI_BOARD_VENDOR, "IBM"),
890                         MATCH(DMI_BOARD_NAME, "IBM eServer BladeCenter HS20"),
891                         NO_MATCH, NO_MATCH }},
892
893         { force_acpi_ht, "IBM eServer xSeries 360", {
894                         MATCH(DMI_BOARD_VENDOR, "IBM"),
895                         MATCH(DMI_BOARD_NAME, "eServer xSeries 360"),
896                         NO_MATCH, NO_MATCH }},
897
898         { force_acpi_ht, "IBM eserver xSeries 330", {
899                         MATCH(DMI_BOARD_VENDOR, "IBM"),
900                         MATCH(DMI_BOARD_NAME, "eserver xSeries 330"),
901                         NO_MATCH, NO_MATCH }},
902
903         { force_acpi_ht, "IBM eserver xSeries 440", {
904                         MATCH(DMI_BOARD_VENDOR, "IBM"),
905                         MATCH(DMI_PRODUCT_NAME, "eserver xSeries 440"),
906                         NO_MATCH, NO_MATCH }},
907
908 #endif  /* CONFIG_ACPI_BOOT */
909 #ifdef  CONFIG_ACPI_PCI
910         /*
911          *      Boxes that need ACPI PCI IRQ routing disabled
912          */
913
914         { disable_acpi_pci, "ASUS A7V", {
915                         MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
916                         MATCH(DMI_BOARD_NAME, "<A7V>"),
917                         /* newer BIOS, Revision 1011, does work */
918                         MATCH(DMI_BIOS_VERSION, "ASUS A7V ACPI BIOS Revision 1007"),
919                         NO_MATCH }},
920
921         { disable_acpi_pci, "Acer TravelMate 36x Laptop", {
922                         MATCH(DMI_SYS_VENDOR, "Acer"),
923                         MATCH(DMI_PRODUCT_NAME, "TravelMate 360"),
924                         NO_MATCH, NO_MATCH
925                         } },
926  
927 #endif  /* CONFIG_ACPI_PCI */
928
929         { NULL, }
930 };
931         
932         
933 /*
934  *      Walk the blacklist table running matching functions until someone 
935  *      returns 1 or we hit the end.
936  */
937  
938
939 static __init void dmi_check_blacklist(void)
940 {
941         struct dmi_blacklist *d;
942         int i;
943                 
944 #ifdef  CONFIG_ACPI_BOOT
945 #define ACPI_BLACKLIST_CUTOFF_YEAR      2001
946
947         if (dmi_ident[DMI_BIOS_DATE]) { 
948                 char *s = strrchr(dmi_ident[DMI_BIOS_DATE], '/'); 
949                 if (s) { 
950                         int year, disable = 0;
951                         s++; 
952                         year = simple_strtoul(s,NULL,0); 
953                         if (year >= 1000) 
954                                 disable = year < ACPI_BLACKLIST_CUTOFF_YEAR; 
955                         else if (year < 1 || (year > 90 && year <= 99))
956                                 disable = 1; 
957                         if (disable && !acpi_force) { 
958                                 printk(KERN_NOTICE "ACPI disabled because your bios is from %s and too old\n", s);
959                                 printk(KERN_NOTICE "You can enable it with acpi=force\n");
960                                 disable_acpi();
961                         } 
962                 }
963         }
964 #endif
965
966         d=&dmi_blacklist[0];
967         while(d->callback)
968         {
969                 for(i=0;i<4;i++)
970                 {
971                         int s = d->matches[i].slot;
972                         if(s==NONE)
973                                 continue;
974                         if(dmi_ident[s] && strstr(dmi_ident[s], d->matches[i].substr))
975                                 continue;
976                         /* No match */
977                         goto fail;
978                 }
979                 if(d->callback(d))
980                         return;
981 fail:                   
982                 d++;
983         }
984 }
985
986         
987
988 /*
989  *      Process a DMI table entry. Right now all we care about are the BIOS
990  *      and machine entries. For 2.5 we should pull the smbus controller info
991  *      out of here.
992  */
993
994 static void __init dmi_decode(struct dmi_header *dm)
995 {
996 #ifdef  DMI_DEBUG
997         u8 *data = (u8 *)dm;
998 #endif
999         switch(dm->type)
1000         {
1001                 case  0:
1002                         dmi_printk(("BIOS Vendor: %s\n",
1003                                 dmi_string(dm, data[4])));
1004                         dmi_save_ident(dm, DMI_BIOS_VENDOR, 4);
1005                         dmi_printk(("BIOS Version: %s\n", 
1006                                 dmi_string(dm, data[5])));
1007                         dmi_save_ident(dm, DMI_BIOS_VERSION, 5);
1008                         dmi_printk(("BIOS Release: %s\n",
1009                                 dmi_string(dm, data[8])));
1010                         dmi_save_ident(dm, DMI_BIOS_DATE, 8);
1011                         break;
1012                 case 1:
1013                         dmi_printk(("System Vendor: %s\n",
1014                                 dmi_string(dm, data[4])));
1015                         dmi_save_ident(dm, DMI_SYS_VENDOR, 4);
1016                         dmi_printk(("Product Name: %s\n",
1017                                 dmi_string(dm, data[5])));
1018                         dmi_save_ident(dm, DMI_PRODUCT_NAME, 5);
1019                         dmi_printk(("Version: %s\n",
1020                                 dmi_string(dm, data[6])));
1021                         dmi_save_ident(dm, DMI_PRODUCT_VERSION, 6);
1022                         dmi_printk(("Serial Number: %s\n",
1023                                 dmi_string(dm, data[7])));
1024                         break;
1025                 case 2:
1026                         dmi_printk(("Board Vendor: %s\n",
1027                                 dmi_string(dm, data[4])));
1028                         dmi_save_ident(dm, DMI_BOARD_VENDOR, 4);
1029                         dmi_printk(("Board Name: %s\n",
1030                                 dmi_string(dm, data[5])));
1031                         dmi_save_ident(dm, DMI_BOARD_NAME, 5);
1032                         dmi_printk(("Board Version: %s\n",
1033                                 dmi_string(dm, data[6])));
1034                         dmi_save_ident(dm, DMI_BOARD_VERSION, 6);
1035                         break;
1036         }
1037 }
1038
1039 void __init dmi_scan_machine(void)
1040 {
1041         int err = dmi_iterate(dmi_decode);
1042         if(err == 0)
1043                 dmi_check_blacklist();
1044         else
1045                 printk(KERN_INFO "DMI not present.\n");
1046 }
1047