ACPI blacklisting: move year blacklist into acpi/blacklist.c
Hi!
This moves year-based blacklisting to blacklist.c, where it belongs AFAICS. It also adds some externs to include/linux/acpi.h, but I believe *way* more externs are needed. Please apply,
Pavel
usr/src/linux/arch/i386/kernel/dmi_scan.c renamed from usr/src/tmp/linux/arch/i386/kernel/dmi_scan.c +2 -16
@@ -997,24 +998,10 @@int i;#ifdef CONFIG_ACPI_BOOT -#define ACPI_BLACKLIST_CUTOFF_YEAR 2001 -if (dmi_ident[DMI_BIOS_DATE ]) {char *s =strrchr (dmi_ident[DMI_BIOS_DATE ],'/' ); -if (s) { -int year, disable =0 ; - s++; - year =simple_strtoul (s,NULL ,0 ); -if (year >=1000 ) - disable = year <ACPI_BLACKLIST_CUTOFF_YEAR ; -else if (year <1 || (year >90 && year <=99 )) - disable =1 ; -if (disable && !acpi_force) { -printk (KERN_NOTICE "ACPI disabled because your bios is from %s and too old\n" , s); -printk (KERN_NOTICE "You can enable it with acpi=force\n" ); - acpi_disabled =1 ; - } - } +if (s && !acpi_force) +acpi_bios_year (s+1 ); }#endif
usr/src/linux/drivers/acpi/blacklist.c renamed from usr/src/tmp/linux/drivers/acpi/blacklist.c +21 -0
@@ -83,6 +83,27 @@ {""} }; +#define ACPI_BLACKLIST_CUTOFF_YEAR 2001 + +/* +* Notice: this is called from dmi_scan.c, which contains second (!) blacklist +*/ +void __init +acpi_bios_year (char *s) +{ +int year, disable =0 ; + + year =simple_strtoul (s,NULL ,0 ); +if (year >=1000 ) + disable = year <ACPI_BLACKLIST_CUTOFF_YEAR ; +else if (year <1 || (year >90 && year <=99 )) + disable =1 ; +if (disable) { +printk (KERN_NOTICE "ACPI disabled because your bios is from %s and too old\n" , s); +printk (KERN_NOTICE "You can enable it with acpi=force\n" ); + acpi_disabled =1 ; + } +}int __init acpi_blacklisted (void )
usr/src/linux/include/linux/acpi.h renamed from usr/src/tmp/linux/include/linux/acpi.h +8 -7
@@ -403,8 +403,8 @@struct pci_dev ; -int acpi_pci_irq_enable (struct pci_dev *dev); -int acpi_pci_irq_init (void ); +extern int acpi_pci_irq_enable (struct pci_dev *dev); +extern int acpi_pci_irq_init (void );struct acpi_pci_driver {struct acpi_pci_driver *next;
@@ -412,21 +412,22 @@ void (*remove)(acpi_handle handle); }; -int acpi_pci_register_driver (struct acpi_pci_driver *driver); -void acpi_pci_unregister_driver (struct acpi_pci_driver *driver); +extern int acpi_pci_register_driver (struct acpi_pci_driver *driver); +extern void acpi_pci_unregister_driver (struct acpi_pci_driver *driver);#endif /*CONFIG_ACPI_PCI*/ #ifdef CONFIG_ACPI_EC -int ec_read (u8 addr,u8 *val); -int ec_write (u8 addr,u8 val); +extern int ec_read (u8 addr,u8 *val); +extern int ec_write (u8 addr,u8 val);#endif /*CONFIG_ACPI_EC*/ #ifdef CONFIG_ACPI -int acpi_blacklisted (void ); +extern int acpi_blacklisted (void ); +extern void acpi_bios_year (char *s);#else
Signature · 2 lines
When do you have a heart between your knees? [Johanka's followup: and *two* hearts?]
usr/src/linux/include/linux/acpi.h line 407
Quoted 13 lines · Pavel Machek
AFAICS. It also adds some externs to
include/linux/acpi.h, but I believe *way* more externs are needed. Please apply,usr/src/linux/include/linux/acpi.h renamed from usr/src/tmp/linux/include/linux/acpi.h +2
-2@@ -403,8 +403,8 @@struct pci_dev ; -int acpi_pci_irq_enable (struct pci_dev *dev); -int acpi_pci_irq_init (void ); +extern int acpi_pci_irq_enable (struct pci_dev *dev); +extern int acpi_pci_irq_init (void );
Why do they need to be externs? The comp.lang.c FAQ suggests they don't have to be.
http://www.eskimo.com/~scs/C-faq/q1.11.html
Signature · 3 lines
"It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies. Do you think I want to have an academic debate on this subject?" -- Robert Fisk
Hi!
Quoted 17 lines
usr/src/linux/include/linux/acpi.h line 407
Quoted 13 lines
AFAICS. It also adds some externs to
include/linux/acpi.h, but I believe *way* more externs are needed. Please apply,usr/src/linux/include/linux/acpi.h renamed from usr/src/tmp/linux/include/linux/acpi.h +2
-2@@ -403,8 +403,8 @@struct pci_dev ; -int acpi_pci_irq_enable (struct pci_dev *dev); -int acpi_pci_irq_init (void ); +extern int acpi_pci_irq_enable (struct pci_dev *dev); +extern int acpi_pci_irq_init (void );Why do they need to be externs? The
comp.lang.cFAQ suggests they don't have to be.
Quoted 1 line
Well, they don't *have* to be there, but as FAQ says, it is stylistics hint.
Pavel
Signature · 8 lines
Horseback riding is like software... ...vgf orggre jura vgf serr. ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
Quoted 7 lines · Pavel Machek
Quoted 4 lines
Why do they need to be externs? The
comp.lang.cFAQ suggests they don't have to be.Well, they don't *have* to be there, but as FAQ says, it is stylistics hint.
I think "being in a .h file" is a sufficient hint ;-)
Signature · 9 lines
"It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies. Do you think I want to have an academic debate on this subject?" -- Robert Fisk ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
Re: dmi_check_blacklist()
Something like MATCH(DMI_BOARD_NAME, "P2B-DS") boils down to a strstr(a,
b) -- probably something that can be fooled by substring, say "PB2-D"...
But more to the point, there is no way to compare before/after dates, say BEFORE(DMI_BIOS_DATE, "1/3/2002")
This is needed to blacklist things like the Toshiba Tecra 8100 which supplies a DMI date, but no other useful version info.
If we such a date comparison function, we could also use it to make the year-compare code below somewhat cleaner.
Re: externs
looks like using externs in the function protos in include/linux is common practice, so acpi.h should probably do it too -- even if it is just for consistent style.
Re: diffs
I couldn't get patch to digest this format w/o manual intervention --- /usr/src/tmp/linux/arch/...
+++ /usr/src/linux/arch/...
and had to edit it into
--- a/arch/...
+++ b/arch/...
for patch -Np1
Re: acpi_bios_year() definition
note that CONFIG_ACPI_BOOT may be defined when CONFIG_ACPI is not. Ie. in the case where just the ACPI boot code is used to enumerate LAPICs, say for HT, but ACPI_INTERPRETER is not even built in.
In this case, blacklist.c is not built into the kernel, but dmi_scan.c always is.
thanks,
-Len
Quoted 108 lines · Pavel Machek
Hi!
This moves year-based blacklisting to
blacklist.c, where it belongs AFAICS. It also adds some externs toinclude/linux/acpi.h, but I believe *way* more externs are needed. Please apply,Pavel
usr/src/linux/arch/i386/kernel/dmi_scan.c renamed from usr/src/tmp/linux/arch/i386/kernel/dmi_scan.c +2
-16@@ -997,24 +998,10 @@int i;#ifdef CONFIG_ACPI_BOOT -#define ACPI_BLACKLIST_CUTOFF_YEAR 2001 -if (dmi_ident[DMI_BIOS_DATE ]) {char *s =strrchr (dmi_ident[DMI_BIOS_DATE ],'/' ); -if (s) { -int year, disable =0 ; - s++; - year =simple_strtoul (s,NULL ,0 ); -if (year >=1000 ) - disable = year <ACPI_BLACKLIST_CUTOFF_YEAR ; -else if (year <1 || (year >90 && year <=99 )) - disable =1 ; -if (disable && !acpi_force) { -printk (KERN_NOTICE "ACPI disabled because your bios is from %s and too old\n" , s); -printk (KERN_NOTICE "You can enable it with acpi=force\n" ); - acpi_disabled =1 ; - } - } +if (s && !acpi_force) +acpi_bios_year (s+1 ); }#endif usr/src/linux/drivers/acpi/blacklist.c renamed from usr/src/tmp/linux/drivers/acpi/blacklist.c +21
-0@@ -83,6 +83,27 @@ {""} }; +#define ACPI_BLACKLIST_CUTOFF_YEAR 2001 + +/* +* Notice: this is called from dmi_scan.c, which contains second (!) blacklist +*/ +void __init +acpi_bios_year (char *s) +{ +int year, disable =0 ; + + year =simple_strtoul (s,NULL ,0 ); +if (year >=1000 ) + disable = year <ACPI_BLACKLIST_CUTOFF_YEAR ; +else if (year <1 || (year >90 && year <=99 )) + disable =1 ; +if (disable) { +printk (KERN_NOTICE "ACPI disabled because your bios is from %s and too old\n" , s); +printk (KERN_NOTICE "You can enable it with acpi=force\n" ); + acpi_disabled =1 ; + } +}int __init acpi_blacklisted (void )usr/src/linux/include/linux/acpi.h renamed from usr/src/tmp/linux/include/linux/acpi.h +8
-7@@ -403,8 +403,8 @@struct pci_dev ; -int acpi_pci_irq_enable (struct pci_dev *dev); -int acpi_pci_irq_init (void ); +extern int acpi_pci_irq_enable (struct pci_dev *dev); +extern int acpi_pci_irq_init (void );struct acpi_pci_driver {struct acpi_pci_driver *next;@@ -412,21 +412,22 @@ void (*remove)(acpi_handle handle); }; -int acpi_pci_register_driver (struct acpi_pci_driver *driver); -void acpi_pci_unregister_driver (struct acpi_pci_driver *driver); +extern int acpi_pci_register_driver (struct acpi_pci_driver *driver); +extern void acpi_pci_unregister_driver (struct acpi_pci_driver *driver);#endif /*CONFIG_ACPI_PCI*/ #ifdef CONFIG_ACPI_EC -int ec_read (u8 addr,u8 *val); -int ec_write (u8 addr,u8 val); +extern int ec_read (u8 addr,u8 *val); +extern int ec_write (u8 addr,u8 val);#endif /*CONFIG_ACPI_EC*/ #ifdef CONFIG_ACPI -int acpi_blacklisted (void ); +extern int acpi_blacklisted (void ); +extern void acpi_bios_year (char *s);#else
Hi!
Quoted 5 lines
Re:
dmi_check_blacklist()Something like
MATCH(DMI_BOARD_NAME, "P2B-DS")boils down to a strstr(a,
b) -- probably something that can be fooled by substring, say "PB2-D"...
Quoted 8 lines
But more to the point, there is no way to compare before/after dates, say
BEFORE(DMI_BIOS_DATE, "1/3/2002")This is needed to blacklist things like the Toshiba Tecra 8100 which supplies a DMI date, but no other useful version info.
If we such a date comparison function, we could also use it to make the year-compare code below somewhat cleaner.
Well, my main problem is with having two blacklists at diferent places.
Quoted 4 lines
Re: externs
looks like using externs in the function protos ininclude/linuxis common practice, soacpi.hshould probably do it too -- even if it is just for consistent style.
Do you want me to submit patch or will you add externs?
Quoted 11 lines
Re: diffs
I couldn't get patch to digest this format w/o manual interventionusr/src/linux/arch/... renamed from usr/src/tmp/linux/arch/... +0
-0and had to edit it into
arch/... +0
-0for patch -Np1
Sorry. (I fixed generating script).
Quoted 7 lines
Re:
acpi_bios_year()definition
note thatCONFIG_ACPI_BOOTmay be defined whenCONFIG_ACPIis not. Ie. in the case where just the ACPI boot code is used to enumerate LAPICs, say for HT, butACPI_INTERPRETERis not even built in.In this case,
blacklist.cis not built into the kernel, butdmi_scan.calways is.
Okay, in such case is it feasible to move blacklist.c functionality into dmi_scan.c? i386 blacklist is probably useless for ia64, anyway... And 2 places seem like bad idea.
Pavel
Signature · 2 lines
When do you have a heart between your knees? [Johanka's followup: and *two* hearts?]