2 * driver.c - ACPI driver
4 * Copyright (C) 2000 Andrew Henroid
5 * Copyright (C) 2001 Andrew Grover
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 * David Woodhouse <dwmw2@redhat.com> 2000-12-6
24 * - Fix interruptible_sleep_on() races
25 * Andrew Grover <andrew.grover@intel.com> 2001-2-28
27 * Peter Breuer <ptb@it.uc3m.es> 2001-5-20
28 * - parse boot time params.
31 #include <linux/config.h>
32 #include <linux/module.h>
33 #include <linux/init.h>
34 #include <linux/kernel.h>
35 #include <linux/types.h>
36 #include <linux/slab.h>
37 #include <linux/proc_fs.h>
38 #include <linux/sysctl.h>
40 #include <linux/acpi.h>
41 #include <asm/uaccess.h>
45 #define _COMPONENT OS_DEPENDENT
46 MODULE_NAME ("driver")
48 FADT_DESCRIPTOR acpi_fadt;
50 static int acpi_disabled = 0;
52 enum acpi_blacklist_predicates
57 greater_than_or_equal,
60 struct acpi_blacklist_item
65 enum acpi_blacklist_predicates oem_revision_predicate;
69 * Currently, this blacklists based on items in the FADT. We may want to
70 * expand this to using other ACPI tables in the future, too.
72 static struct acpi_blacklist_item acpi_blacklist[] __initdata =
74 {"TOSHIB", "750 ", 0x970814, less_than_or_equal}, /* Portege 7020, BIOS 8.10 */
79 acpi_blacklisted(FADT_DESCRIPTOR *fadt)
83 while (acpi_blacklist[i].oem_id[0] != '\0')
85 if (strncmp(acpi_blacklist[i].oem_id, fadt->header.oem_id, 6)) {
90 if (strncmp(acpi_blacklist[i].oem_table_id, fadt->header.oem_table_id, 8)) {
95 if (acpi_blacklist[i].oem_revision_predicate == all_versions)
98 if (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
99 && fadt->header.oem_revision <= acpi_blacklist[i].oem_revision)
102 if (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
103 && fadt->header.oem_revision >= acpi_blacklist[i].oem_revision)
106 if (acpi_blacklist[i].oem_revision_predicate == equal
107 && fadt->header.oem_revision == acpi_blacklist[i].oem_revision)
117 * Start the interpreter
123 acpi_system_info sys_info;
125 if (PM_IS_ACTIVE()) {
126 printk(KERN_NOTICE "ACPI: APM is already active, exiting\n");
131 printk(KERN_NOTICE "ACPI: disabled by cmdline, exiting\n");
135 if (!ACPI_SUCCESS(acpi_initialize_subsystem())) {
136 printk(KERN_ERR "ACPI: Driver initialization failed\n");
140 /* from this point on, on error we must call acpi_terminate() */
141 if (!ACPI_SUCCESS(acpi_load_tables())) {
142 printk(KERN_ERR "ACPI: System description table load failed\n");
147 /* get a separate copy of the FADT for use by other drivers */
148 memset(&acpi_fadt, 0, sizeof(acpi_fadt));
149 buffer.pointer = &acpi_fadt;
150 buffer.length = sizeof(acpi_fadt);
152 if (!ACPI_SUCCESS(acpi_get_table(ACPI_TABLE_FADT, 1, &buffer))) {
153 printk(KERN_ERR "ACPI: Could not get FADT\n");
158 if (acpi_blacklisted(&acpi_fadt)) {
159 printk(KERN_ERR "ACPI: On blacklist -- BIOS not fully ACPI compliant\n");
164 buffer.length = sizeof(sys_info);
165 buffer.pointer = &sys_info;
167 if (!ACPI_SUCCESS (acpi_get_system_info(&buffer))) {
168 printk(KERN_ERR "ACPI: Could not get system info\n");
173 printk(KERN_INFO "ACPI: Core Subsystem version [%x]\n", sys_info.acpi_ca_version);
175 if (!ACPI_SUCCESS(acpi_enable_subsystem(ACPI_FULL_INITIALIZATION))) {
176 printk(KERN_ERR "ACPI: Subsystem enable failed\n");
181 printk(KERN_INFO "ACPI: Subsystem enabled\n");
189 * Terminate the interpreter
198 printk(KERN_ERR "ACPI: Subsystem disabled\n");
201 module_init(acpi_init);
202 module_exit(acpi_exit);
205 static int __init acpi_setup(char *str) {
206 while (str && *str) {
207 if (strncmp(str, "off", 3) == 0)
209 str = strchr(str, ',');
211 str += strspn(str, ", \t");
216 __setup("acpi=", acpi_setup);