|
From: Andy P. <at...@us...> - 2002-04-09 14:08:27
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/acpi
In directory usw-pr-cvs1:/tmp/cvs-serv13840/acpi
Modified Files:
Makefile acpi_ksyms.c driver.c os.c
Added Files:
Config.in
Removed Files:
cmbatt.c cpu.c driver.h ec.c ec.h ksyms.c power.c sys.c
table.c
Log Message:
synch 2.4.15 commit 17
--- NEW FILE ---
#
# ACPI configuration
#
#mainmenu_option next_comment
#comment 'ACPI Configuration'
dep_bool ' ACPI Debug Statements' CONFIG_ACPI_DEBUG $CONFIG_ACPI
dep_tristate ' ACPI Bus Manager' CONFIG_ACPI_BUSMGR $CONFIG_ACPI
dep_tristate ' System' CONFIG_ACPI_SYS $CONFIG_ACPI_BUSMGR $CONFIG_ACPI
dep_tristate ' Processor' CONFIG_ACPI_CPU $CONFIG_ACPI_BUSMGR $CONFIG_ACPI
dep_tristate ' Button' CONFIG_ACPI_BUTTON $CONFIG_ACPI_BUSMGR $CONFIG_ACPI
dep_tristate ' AC Adapter' CONFIG_ACPI_AC $CONFIG_ACPI_BUSMGR $CONFIG_ACPI
dep_tristate ' Embedded Controller' CONFIG_ACPI_EC $CONFIG_ACPI_BUSMGR $CONFIG_ACPI
dep_tristate ' Control Method Battery' CONFIG_ACPI_CMBATT $CONFIG_ACPI_BUSMGR $CONFIG_ACPI $CONFIG_ACPI_EC
dep_tristate ' Thermal' CONFIG_ACPI_THERMAL $CONFIG_ACPI_BUSMGR $CONFIG_ACPI $CONFIG_ACPI_EC
#endmenu
Index: Makefile
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acpi/Makefile,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- Makefile 25 Feb 2001 23:15:15 -0000 1.1.1.2
+++ Makefile 9 Apr 2002 14:05:42 -0000 1.2
@@ -1,13 +1,14 @@
#
# Makefile for the Linux ACPI interpreter
-#
+#
O_TARGET := acpi.o
export-objs := acpi_ksyms.o
export ACPI_CFLAGS
-ACPI_CFLAGS := -D_LINUX
+
+ACPI_CFLAGS := -D_LINUX -I$(CURDIR)/include
#
# CONFIG_ACPI_KERNEL_CONFIG is currently only IA64
@@ -16,33 +17,38 @@
ACPI_CFLAGS += -DCONFIG_ACPI_KERNEL_CONFIG_ONLY
endif
-EXTRA_CFLAGS += -I./include
-
-EXTRA_CFLAGS += $(ACPI_CFLAGS)
+acpi-subdirs := utilities dispatcher events hardware \
+ executer namespace parser resources tables
-# genksyms only reads $(CFLAGS), it should really read $(EXTRA_CFLAGS) as well.
-# Without EXTRA_CFLAGS the gcc pass for genksyms fails, resulting in an empty
-# include/linux/modules/acpi_ksyms.ver. Changing genkyms to use EXTRA_CFLAGS
-# will hit everything, too risky in 2.4.0-prerelease. Bandaid by tweaking
-# CFLAGS only for .ver targets. Review after 2.4.0 release. KAO
+ifdef CONFIG_ACPI_DEBUG
+ ACPI_CFLAGS += -DACPI_DEBUG -Wno-unused
+endif
-$(MODINCL)/%.ver: CFLAGS := -I./include $(CFLAGS)
+ifdef CONFIG_ACPI_DEBUGGER
+ ACPI_CFLAGS += -DENABLE_DEBUGGER
+ acpi-subdirs += debugger
+endif
-acpi-subdirs := common dispatcher events hardware \
- interpreter namespace parser resources tables
+EXTRA_CFLAGS += $(ACPI_CFLAGS)
-subdir-$(CONFIG_ACPI) += $(acpi-subdirs)
+mod-subdirs := ospm
-obj-$(CONFIG_ACPI) := $(patsubst %,%.o,$(acpi-subdirs))
-obj-$(CONFIG_ACPI) += os.o acpi_ksyms.o
+subdir-$(CONFIG_ACPI) += $(acpi-subdirs)
+subdir-$(CONFIG_ACPI_BUSMGR) += ospm
+obj-$(CONFIG_ACPI) += driver.o os.o acpi_ksyms.o
+obj-$(CONFIG_ACPI) += $(foreach dir,$(acpi-subdirs),$(dir)/$(dir).o)
ifdef CONFIG_ACPI_KERNEL_CONFIG
- obj-$(CONFIG_ACPI) += acpiconf.o osconf.o
-else
- obj-$(CONFIG_ACPI) += driver.o cmbatt.o cpu.o ec.o acpi_ksyms.o sys.o table.o power.o
+ obj-$(CONFIG_ACPI) += acpiconf.o osconf.o
endif
-include $(TOPDIR)/Rules.make
+ifeq ($(CONFIG_ACPI_BUSMGR),y)
+ obj-y += ospm/ospm.o
+endif
-clean:
- $(RM) *.o */*.o
+# commented out until we distribute it -ASG
+#ifeq ($(CONFIG_KDB),y)
+# obj-m += kdb/kdbm_acpi.o
+#endif
+
+include $(TOPDIR)/Rules.make
Index: acpi_ksyms.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acpi/acpi_ksyms.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- acpi_ksyms.c 25 Feb 2001 23:15:15 -0000 1.1.1.1
+++ acpi_ksyms.c 9 Apr 2002 14:05:42 -0000 1.2
@@ -18,6 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
@@ -27,6 +28,7 @@
#include "acdebug.h"
extern int acpi_in_debugger;
+extern FADT_DESCRIPTOR acpi_fadt;
#define _COMPONENT OS_DEPENDENT
MODULE_NAME ("symbols")
@@ -36,28 +38,27 @@
EXPORT_SYMBOL(acpi_db_user_commands);
#endif
+#ifdef ACPI_DEBUG
+EXPORT_SYMBOL(acpi_ut_debug_print_raw);
+EXPORT_SYMBOL(acpi_ut_debug_print);
+EXPORT_SYMBOL(acpi_ut_status_exit);
+EXPORT_SYMBOL(acpi_ut_exit);
+EXPORT_SYMBOL(acpi_ut_trace);
+#endif
+
+EXPORT_SYMBOL(acpi_gbl_FADT);
+
EXPORT_SYMBOL(acpi_os_free);
-EXPORT_SYMBOL(acpi_os_breakpoint);
EXPORT_SYMBOL(acpi_os_printf);
EXPORT_SYMBOL(acpi_os_callocate);
EXPORT_SYMBOL(acpi_os_sleep);
-EXPORT_SYMBOL(acpi_os_sleep_usec);
-EXPORT_SYMBOL(acpi_os_in8);
-EXPORT_SYMBOL(acpi_os_out8);
+EXPORT_SYMBOL(acpi_os_stall);
EXPORT_SYMBOL(acpi_os_queue_for_execution);
EXPORT_SYMBOL(acpi_dbg_layer);
EXPORT_SYMBOL(acpi_dbg_level);
-EXPORT_SYMBOL(function_exit);
-EXPORT_SYMBOL(function_trace);
-EXPORT_SYMBOL(function_status_exit);
-EXPORT_SYMBOL(function_value_exit);
-EXPORT_SYMBOL(debug_print_raw);
-EXPORT_SYMBOL(debug_print_prefix);
-
-EXPORT_SYMBOL(acpi_cm_strncmp);
-EXPORT_SYMBOL(acpi_cm_memcpy);
-EXPORT_SYMBOL(acpi_cm_memset);
+
+EXPORT_SYMBOL(acpi_format_exception);
EXPORT_SYMBOL(acpi_get_handle);
EXPORT_SYMBOL(acpi_get_parent);
@@ -66,6 +67,7 @@
EXPORT_SYMBOL(acpi_get_object_info);
EXPORT_SYMBOL(acpi_get_next_object);
EXPORT_SYMBOL(acpi_evaluate_object);
+EXPORT_SYMBOL(acpi_get_table);
EXPORT_SYMBOL(acpi_install_notify_handler);
EXPORT_SYMBOL(acpi_remove_notify_handler);
@@ -73,6 +75,11 @@
EXPORT_SYMBOL(acpi_remove_gpe_handler);
EXPORT_SYMBOL(acpi_install_address_space_handler);
EXPORT_SYMBOL(acpi_remove_address_space_handler);
+EXPORT_SYMBOL(acpi_install_fixed_event_handler);
+EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
+
+EXPORT_SYMBOL(acpi_acquire_global_lock);
+EXPORT_SYMBOL(acpi_release_global_lock);
EXPORT_SYMBOL(acpi_get_current_resources);
EXPORT_SYMBOL(acpi_get_possible_resources);
@@ -81,3 +88,28 @@
EXPORT_SYMBOL(acpi_enable_event);
EXPORT_SYMBOL(acpi_disable_event);
EXPORT_SYMBOL(acpi_clear_event);
+
+EXPORT_SYMBOL(acpi_get_timer_duration);
+EXPORT_SYMBOL(acpi_get_timer);
+
+EXPORT_SYMBOL(acpi_os_signal_semaphore);
+EXPORT_SYMBOL(acpi_os_create_semaphore);
+EXPORT_SYMBOL(acpi_os_delete_semaphore);
+EXPORT_SYMBOL(acpi_os_wait_semaphore);
+
+EXPORT_SYMBOL(acpi_os_read_port);
+EXPORT_SYMBOL(acpi_os_write_port);
+
+EXPORT_SYMBOL(acpi_fadt);
+EXPORT_SYMBOL(acpi_hw_register_bit_access);
+EXPORT_SYMBOL(acpi_hw_obtain_sleep_type_register_data);
+EXPORT_SYMBOL(acpi_enter_sleep_state);
+EXPORT_SYMBOL(acpi_get_system_info);
+EXPORT_SYMBOL(acpi_leave_sleep_state);
+/*EXPORT_SYMBOL(acpi_save_state_mem);*/
+/*EXPORT_SYMBOL(acpi_save_state_disk);*/
+EXPORT_SYMBOL(acpi_hw_register_read);
+EXPORT_SYMBOL(acpi_set_firmware_waking_vector);
+EXPORT_SYMBOL(acpi_subsystem_status);
+
+EXPORT_SYMBOL(acpi_os_signal);
Index: driver.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acpi/driver.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- driver.c 25 Feb 2001 23:15:15 -0000 1.1.1.2
+++ driver.c 9 Apr 2002 14:05:42 -0000 1.2
@@ -2,6 +2,7 @@
* driver.c - ACPI driver
*
* Copyright (C) 2000 Andrew Henroid
+ * Copyright (C) 2001 Andrew Grover
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,6 +22,10 @@
* Changes
* David Woodhouse <dw...@re...> 2000-12-6
* - Fix interruptible_sleep_on() races
+ * Andrew Grover <and...@in...> 2001-2-28
+ * - Major revamping
+ * Peter Breuer <pt...@it...> 2001-5-20
+ * - parse boot time params.
*/
#include <linux/config.h>
@@ -35,431 +40,123 @@
#include <linux/acpi.h>
#include <asm/uaccess.h>
#include "acpi.h"
-#include "driver.h"
-
-#ifdef CONFIG_ACPI_KERNEL_CONFIG
-#include <asm/efi.h>
-#define ACPI_CAN_USE_EFI_STRUCT
-#endif
#define _COMPONENT OS_DEPENDENT
MODULE_NAME ("driver")
-struct acpi_run_entry
-{
- void (*callback)(void*);
- void *context;
- struct tq_struct task;
-};
-
-static spinlock_t acpi_event_lock = SPIN_LOCK_UNLOCKED;
-static volatile u32 acpi_event_status = 0;
-static volatile acpi_sstate_t acpi_event_state = ACPI_STATE_S0;
-static DECLARE_WAIT_QUEUE_HEAD(acpi_event_wait);
-
-static volatile int acpi_thread_pid = -1;
-
-static int acpi_start = 1;
-
-/************************************************/
-/* DECLARE_TASK_QUEUE is defined in */
-/* /usr/src/linux/include/linux/tqueue.h */
-/* So, acpi_thread_run is a pointer to a */
-/* tq_struct structure,defined in the same file.*/
-/************************************************/
-static DECLARE_TASK_QUEUE(acpi_thread_run);
+FADT_DESCRIPTOR acpi_fadt;
-static DECLARE_WAIT_QUEUE_HEAD(acpi_thread_wait);
+static int acpi_disabled = 0;
-static struct ctl_table_header *acpi_sysctl = NULL;
-
-/*
- * Examine/modify value
- */
-static int
-acpi_do_ulong(ctl_table * ctl,
- int write,
- struct file *file,
- void *buffer,
- size_t * len)
+enum acpi_blacklist_predicates
{
- char str[2 * sizeof(unsigned long) + 4], *strend;
- unsigned long val;
- int size;
-
- if (!write) {
- if (file->f_pos) {
- *len = 0;
- return 0;
- }
-
- val = *(unsigned long *) ctl->data;
- size = sprintf(str, "0x%08lx\n", val);
- if (*len >= size) {
- copy_to_user(buffer, str, size);
- *len = size;
- }
- else
- *len = 0;
- }
- else {
- size = sizeof(str) - 1;
- if (size > *len)
- size = *len;
- copy_from_user(str, buffer, size);
- str[size] = '\0';
- val = simple_strtoul(str, &strend, 0);
- if (strend == str)
- return -EINVAL;
- *(unsigned long *) ctl->data = val;
- }
-
- file->f_pos += *len;
- return 0;
-}
+ all_versions,
+ less_than_or_equal,
+ equal,
+ greater_than_or_equal,
+};
-static int
-acpi_do_pm_timer(ctl_table * ctl,
- int write,
- struct file *file,
- void *buffer,
- size_t * len)
+struct acpi_blacklist_item
{
- int size;
- u32 val = 0;
-
- char str[12];
-
- if (file->f_pos) {
- *len = 0;
- return 0;
- }
-
- val = acpi_read_pm_timer();
-
- size = sprintf(str, "0x%08x\n", val);
- if (*len >= size) {
- copy_to_user(buffer, str, size);
- *len = size;
- }
- else
- *len = 0;
-
- file->f_pos += *len;
-
- return 0;
-}
+ char oem_id[7];
+ char oem_table_id[9];
+ u32 oem_revision;
+ enum acpi_blacklist_predicates oem_revision_predicate;
+};
/*
- * Handle ACPI event
+ * Currently, this blacklists based on items in the FADT. We may want to
+ * expand this to using other ACPI tables in the future, too.
*/
-static u32
-acpi_event(void *context)
+static struct acpi_blacklist_item acpi_blacklist[] __initdata =
{
- unsigned long flags;
- int event = (int)(long)context;
- int mask = 0;
-
- switch (event) {
- case ACPI_EVENT_POWER_BUTTON:
- mask = ACPI_PWRBTN;
- break;
- case ACPI_EVENT_SLEEP_BUTTON:
- mask = ACPI_SLPBTN;
- break;
- default:
- return AE_ERROR;
- }
-
- if (mask) {
- // notify process waiting on /dev/acpi
- spin_lock_irqsave(&acpi_event_lock, flags);
- acpi_event_status |= mask;
- spin_unlock_irqrestore(&acpi_event_lock, flags);
- acpi_event_state = acpi_sleep_state;
- wake_up_interruptible(&acpi_event_wait);
- }
-
- return AE_OK;
-}
+ {"TOSHIB", "750 ", 0x970814, less_than_or_equal}, /* Portege 7020, BIOS 8.10 */
+ {""}
+};
-/*
- * Wait for next event
- */
-static int
-acpi_do_event(ctl_table * ctl,
- int write,
- struct file *file,
- void *buffer,
- size_t * len)
+int
+acpi_blacklisted(FADT_DESCRIPTOR *fadt)
{
- u32 event_status = 0;
- acpi_sstate_t event_state = 0;
- char str[27];
- int size;
-
- if (write)
- return -EPERM;
- if (*len < sizeof(str)) {
- *len = 0;
- return 0;
- }
-
- while (!event_status) {
- unsigned long flags;
- DECLARE_WAITQUEUE(wait, current);
-
- set_current_state(TASK_INTERRUPTIBLE);
- add_wait_queue(&acpi_event_wait, &wait);
-
- // we need an atomic exchange here
- spin_lock_irqsave(&acpi_event_lock, flags);
- event_status = acpi_event_status;
- acpi_event_status = 0;
- spin_unlock_irqrestore(&acpi_event_lock, flags);
- event_state = acpi_event_state;
-
- if (!event_status)
- schedule();
+ int i = 0;
- remove_wait_queue(&acpi_event_wait, &wait);
- set_current_state(TASK_RUNNING);
-
- if (signal_pending(current))
- return -ERESTARTSYS;
- }
-
- size = sprintf(str,
- "0x%08x 0x%08x 0x%01x\n",
- event_status,
- 0,
- event_state);
- copy_to_user(buffer, str, size);
- *len = size;
- file->f_pos += size;
-
- return 0;
-}
+ while (acpi_blacklist[i].oem_id[0] != '\0')
+ {
+ if (strncmp(acpi_blacklist[i].oem_id, fadt->header.oem_id, 6)) {
+ i++;
+ continue;
+ }
-/*
- * Enter system sleep state
- */
-/*static int
-acpi_do_sleep(ctl_table * ctl,
- int write,
- struct file *file,
- void *buffer,
- size_t * len)
-{
- if (!write) {
- if (file->f_pos) {
- *len = 0;
- return 0;
+ if (strncmp(acpi_blacklist[i].oem_table_id, fadt->header.oem_table_id, 8)) {
+ i++;
+ continue;
}
- }
- else {
- int status = acpi_enter_sx(ACPI_STATE_S1);
- if (status)
- return status;
- }
- file->f_pos += *len;
- return 0;
-}*/
+ if (acpi_blacklist[i].oem_revision_predicate == all_versions)
+ return TRUE;
-/*
- * Output important ACPI tables to proc
- */
-static int
-acpi_do_table(ctl_table * ctl,
- int write,
- struct file *file,
- void *buffer,
- size_t * len)
-{
- u32 table_type;
- size_t size;
- ACPI_BUFFER buf;
- u8* data;
-
- table_type = (u32) ctl->data;
- size = 0;
- buf.length = 0;
- buf.pointer = NULL;
-
- /* determine what buffer size we will need */
- if (acpi_get_table(table_type, 1, &buf) != AE_BUFFER_OVERFLOW) {
- *len = 0;
- return 0;
- }
+ if (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
+ && fadt->header.oem_revision <= acpi_blacklist[i].oem_revision)
+ return TRUE;
- buf.pointer = kmalloc(buf.length, GFP_KERNEL);
- if (!buf.pointer) {
- return -ENOMEM;
- }
+ if (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
+ && fadt->header.oem_revision >= acpi_blacklist[i].oem_revision)
+ return TRUE;
- /* get the table for real */
- if (!ACPI_SUCCESS(acpi_get_table(table_type, 1, &buf))) {
- kfree(buf.pointer);
- *len = 0;
- return 0;
- }
+ if (acpi_blacklist[i].oem_revision_predicate == equal
+ && fadt->header.oem_revision == acpi_blacklist[i].oem_revision)
+ return TRUE;
- if (file->f_pos < buf.length) {
- data = buf.pointer + file->f_pos;
- size = buf.length - file->f_pos;
- if (size > *len)
- size = *len;
- if (copy_to_user(buffer, data, size))
- return -EFAULT;
+ i++;
}
- kfree(buf.pointer);
-
- *len = size;
- file->f_pos += size;
- return 0;
-}
-
-/********************************************************************/
-/* R U N Q U E U E D C A L L B A C K */
-/* */
-/* The "callback" function address that was tramped through via */
-/* "acpi_run" below is finally called and executed. If we trace all */
-/* this down, the function is acpi_ev_asynch_execute_gpe_method, in */
-/* evevent.c The only other function that is ever queued is */
-/* acpi_ev_global_lock_thread in evmisc.c. */
-/********************************************************************/
-static void
-acpi_run_exec(void *context)
-{
- struct acpi_run_entry *entry
- = (struct acpi_run_entry*) context;
- (*entry->callback)(entry->context);
- kfree(entry);
+ return FALSE;
}
/*
- * Queue for execution by the ACPI thread
+ * Start the interpreter
*/
int
-acpi_run(void (*callback)(void*), void *context)
-{
- struct acpi_run_entry *entry;
-
- entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
- if (!entry)
- return -1;
-
- memset(entry, 0, sizeof(entry));
- entry->callback = callback;
- entry->context = context;
- entry->task.routine = acpi_run_exec;
- entry->task.data = entry;
-
- queue_task(&entry->task, &acpi_thread_run);
-
- if (waitqueue_active(&acpi_thread_wait))
- wake_up(&acpi_thread_wait);
-
- return 0;
-}
-
-static struct ctl_table acpi_table[] =
+acpi_init(void)
{
- {ACPI_P_LVL2_LAT, "c2_exit_latency",
- &acpi_c2_exit_latency, sizeof(acpi_c2_exit_latency),
- 0644, NULL, &acpi_do_ulong},
-
- {ACPI_ENTER_LVL2_LAT, "c2_enter_latency",
- &acpi_c2_enter_latency, sizeof(acpi_c2_enter_latency),
- 0644, NULL, &acpi_do_ulong},
-
- {ACPI_P_LVL3_LAT, "c3_exit_latency",
- &acpi_c3_exit_latency, sizeof(acpi_c3_exit_latency),
- 0644, NULL, &acpi_do_ulong},
-
- {ACPI_ENTER_LVL3_LAT, "c3_enter_latency",
- &acpi_c3_enter_latency, sizeof(acpi_c3_enter_latency),
- 0644, NULL, &acpi_do_ulong},
-
- {ACPI_C1_COUNT, "c1_count",
- &acpi_c1_count, sizeof(acpi_c1_count),
- 0644, NULL, &acpi_do_ulong},
-
- {ACPI_C2_COUNT, "c2_count",
- &acpi_c2_count, sizeof(acpi_c2_count),
- 0644, NULL, &acpi_do_ulong},
-
- {ACPI_C3_COUNT, "c3_count",
- &acpi_c3_count, sizeof(acpi_c3_count),
- 0644, NULL, &acpi_do_ulong},
-
-
-/* until it actually works */
-/* {ACPI_SLEEP, "sleep", NULL, 0, 0600, NULL, &acpi_do_sleep},*/
-
- {ACPI_EVENT, "event", NULL, 0, 0400, NULL, &acpi_do_event},
-
- {ACPI_FADT, "fadt", (void *) ACPI_TABLE_FADT, sizeof(int),
- 0444, NULL, &acpi_do_table},
-
- {ACPI_DSDT, "dsdt", (void *) ACPI_TABLE_DSDT, sizeof(int),
- 0444, NULL, &acpi_do_table},
-
- {ACPI_FACS, "facs", (void *) ACPI_TABLE_FACS, sizeof(int),
- 0444, NULL, &acpi_do_table},
-
- {ACPI_XSDT, "xsdt", (void *) ACPI_TABLE_XSDT, sizeof(int),
- 0444, NULL, &acpi_do_table},
-
- {ACPI_PMTIMER, "pm_timer", NULL, 0, 0444, NULL, &acpi_do_pm_timer},
-
- {0}
-};
+ acpi_buffer buffer;
+ acpi_system_info sys_info;
-static struct ctl_table acpi_dir_table[] =
-{
- {CTL_ACPI, "acpi", NULL, 0, 0555, acpi_table},
- {0}
-};
+ if (PM_IS_ACTIVE()) {
+ printk(KERN_NOTICE "ACPI: APM is already active, exiting\n");
+ return -ENODEV;
+ }
-/*
- * Initialize and run interpreter within a kernel thread
- */
-static int
-acpi_thread(void *context)
-{
- ACPI_PHYSICAL_ADDRESS rsdp_phys;
- ACPI_BUFFER buffer;
- ACPI_SYSTEM_INFO sys_info;
-
- /*
- * initialize
- */
- daemonize();
- strcpy(current->comm, "kacpid");
+ if (acpi_disabled) {
+ printk(KERN_NOTICE "ACPI: disabled by cmdline, exiting\n");
+ return -ENODEV;
+ }
if (!ACPI_SUCCESS(acpi_initialize_subsystem())) {
printk(KERN_ERR "ACPI: Driver initialization failed\n");
return -ENODEV;
}
-#ifndef ACPI_CAN_USE_EFI_STRUCT
- if (!ACPI_SUCCESS(acpi_find_root_pointer(&rsdp_phys))) {
- printk(KERN_ERR "ACPI: System description tables not found\n");
+ /* from this point on, on error we must call acpi_terminate() */
+ if (!ACPI_SUCCESS(acpi_load_tables())) {
+ printk(KERN_ERR "ACPI: System description table load failed\n");
+ acpi_terminate();
return -ENODEV;
}
-#else
- rsdp_phys = efi.acpi;
-#endif
-
- if (!ACPI_SUCCESS(acpi_find_and_load_tables(rsdp_phys)))
+
+ /* get a separate copy of the FADT for use by other drivers */
+ memset(&acpi_fadt, 0, sizeof(acpi_fadt));
+ buffer.pointer = &acpi_fadt;
+ buffer.length = sizeof(acpi_fadt);
+
+ if (!ACPI_SUCCESS(acpi_get_table(ACPI_TABLE_FADT, 1, &buffer))) {
+ printk(KERN_ERR "ACPI: Could not get FADT\n");
+ acpi_terminate();
return -ENODEV;
+ }
- if (PM_IS_ACTIVE()) {
- printk(KERN_NOTICE "ACPI: APM is already active, exiting\n");
+ if (acpi_blacklisted(&acpi_fadt)) {
+ printk(KERN_ERR "ACPI: On blacklist -- BIOS not fully ACPI compliant\n");
acpi_terminate();
return -ENODEV;
}
@@ -481,129 +178,37 @@
return -ENODEV;
}
- printk(KERN_ERR "ACPI: Subsystem enabled\n");
+ printk(KERN_INFO "ACPI: Subsystem enabled\n");
pm_active = 1;
- acpi_cpu_init();
- acpi_sys_init();
- acpi_ec_init();
- acpi_power_init();
-
- /*
- * Non-intuitive: 0 means pwr and sleep are implemented using the fixed
- * feature model, so we install handlers. 1 means a control method
- * implementation, or none at all, so do nothing. See ACPI spec.
- */
- if (acpi_fadt.pwr_button == 0) {
- if (!ACPI_SUCCESS(acpi_install_fixed_event_handler(
- ACPI_EVENT_POWER_BUTTON,
- acpi_event,
- (void *) ACPI_EVENT_POWER_BUTTON))) {
- printk(KERN_ERR "ACPI: power button enable failed\n");
- }
- }
-
- if (acpi_fadt.sleep_button == 0) {
- if (!ACPI_SUCCESS(acpi_install_fixed_event_handler(
- ACPI_EVENT_SLEEP_BUTTON,
- acpi_event,
- (void *) ACPI_EVENT_SLEEP_BUTTON))) {
- printk(KERN_ERR "ACPI: sleep button enable failed\n");
- }
- }
-
- acpi_sysctl = register_sysctl_table(acpi_dir_table, 1);
-
- /*
- * run
- */
- for (;;) {
- DECLARE_WAITQUEUE(wait, current);
-
- set_current_state(TASK_INTERRUPTIBLE);
- add_wait_queue(&acpi_thread_wait, &wait);
-
- if (list_empty(&acpi_thread_run))
- schedule();
-
- remove_wait_queue(&acpi_thread_wait, &wait);
- set_current_state(TASK_RUNNING);
-
- if (signal_pending(current))
- break;
-
- run_task_queue(&acpi_thread_run);
- }
-
- /*
- * terminate
- */
- unregister_sysctl_table(acpi_sysctl);
-
- /* do not terminate, because we need acpi in order to shut down */
- /*acpi_terminate();*/
-
- acpi_thread_pid = -1;
-
return 0;
}
/*
- * Start the interpreter
- */
-int __init
-acpi_init(void)
-{
- if (acpi_start) {
- acpi_thread_pid = kernel_thread(acpi_thread,
- NULL,
- (CLONE_FS | CLONE_FILES
- | CLONE_SIGHAND | SIGCHLD));
- }
- else {
- printk(KERN_INFO "ACPI: Disabled\n");
- }
-
- return ((acpi_thread_pid >= 0) ? 0:-ENODEV);
-}
-
-/*
* Terminate the interpreter
*/
-void __exit
+void
acpi_exit(void)
{
- int count;
+ acpi_terminate();
- if (!kill_proc(acpi_thread_pid, SIGTERM, 1)) {
- // wait until thread terminates (at most 5 seconds)
- count = 5 * HZ;
- while (acpi_thread_pid >= 0 && --count) {
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(1);
- }
- }
-
- pm_idle = NULL;
- pm_power_off = NULL;
pm_active = 0;
+
+ printk(KERN_ERR "ACPI: Subsystem disabled\n");
}
module_init(acpi_init);
module_exit(acpi_exit);
#ifndef MODULE
-static int __init acpi_setup(char *str)
-{
- while ((str != NULL) && (*str != '\0')) {
- if (strncmp(str, "no-idle", 7) == 0)
- acpi_use_idle = 0;
- if (strncmp(str, "off", 3) == 0)
- acpi_start = 0;
- str = strchr(str, ',');
- if (str != NULL)
- str += strspn(str, ", \t");
+static int __init acpi_setup(char *str) {
+ while (str && *str) {
+ if (strncmp(str, "off", 3) == 0)
+ acpi_disabled = 1;
+ str = strchr(str, ',');
+ if (str)
+ str += strspn(str, ", \t");
}
return 1;
}
Index: os.c
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/acpi/os.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- os.c 25 Feb 2001 23:15:15 -0000 1.1.1.2
+++ os.c 9 Apr 2002 14:05:42 -0000 1.2
@@ -1,7 +1,15 @@
+/******************************************************************************
+ *
+ * Module Name: os.c - Linux OSL functions
+ * $Revision$
+ *
+ *****************************************************************************/
+
/*
* os.c - OS-dependent functions
*
* Copyright (C) 2000 Andrew Henroid
[...987 lines suppressed...]
+ {
+ char *bp_info = (char*) info;
+
+ printk(KERN_ERR "ACPI breakpoint: %s\n", bp_info);
+ }
+ default:
+ break;
+ }
+
+ return AE_OK;
+}
+
+acpi_status
+acpi_os_breakpoint(NATIVE_CHAR *msg)
+{
+ acpi_os_printf("breakpoint: %s", msg);
+
+ return AE_OK;
+}
+
--- cmbatt.c DELETED ---
--- cpu.c DELETED ---
--- driver.h DELETED ---
--- ec.c DELETED ---
--- ec.h DELETED ---
--- ksyms.c DELETED ---
--- power.c DELETED ---
--- sys.c DELETED ---
--- table.c DELETED ---
|