Commit 2a5cc977 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-acpi.bkbits.net/linux-acpi

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 72785ef7 3469e901
......@@ -1590,6 +1590,12 @@ L: linux-tr@linuxtr.net
W: http://www.linuxtr.net
S: Maintained
TOSHIBA ACPI EXTRAS DRIVER
P: John Belmonte
M: toshiba_acpi@memebeam.org
W: http://memebeam.org/toys/ToshibaAcpiDriver
S: Maintained
TOSHIBA SMM DRIVER
P: Jonathan Buzzard
M: jonathan@buzzard.org.uk
......
......@@ -1051,8 +1051,6 @@ void __init mp_config_acpi_legacy_irqs (void)
return;
}
#endif /*CONFIG_X86_IO_APIC*/
#ifdef CONFIG_ACPI_PCI
void __init mp_parse_prt (void)
......@@ -1120,4 +1118,6 @@ void __init mp_parse_prt (void)
#endif /*CONFIG_ACPI_PCI*/
#endif /*CONFIG_X86_IO_APIC*/
#endif /*CONFIG_ACPI_BOOT*/
......@@ -91,3 +91,25 @@ CONFIG_ACPI_DEBUG
of verbosity. Saying Y enables these statements. This will increase
your kernel size by around 50K.
CONFIG_ACPI_TOSHIBA
This driver adds support for access to certain system settings
on "legacy free" Toshiba laptops. These laptops can be recognized by
their lack of a BIOS setup menu and APM support.
On these machines, all system configuration is handled through the
ACPI. This driver is required for access to controls not covered
by the general ACPI drivers, such as LCD brightness, video output,
etc.
This driver differs from the non-ACPI Toshiba laptop driver (located
under "Processor type and features") in several aspects.
Configuration is accessed by reading and writing text files in the
/proc tree instead of by program interface to /dev. Furthermore, no
power management functions are exposed, as those are handled by the
general ACPI drivers.
More information about this driver is available at
<http://memebeam.org/toys/ToshibaAcpiDriver>.
If you have a legacy free Toshiba laptop (such as the Libretto L1
series), say Y.
......@@ -31,6 +31,7 @@ if [ "$CONFIG_X86" = "y" ]; then
tristate ' Fan' CONFIG_ACPI_FAN
tristate ' Processor' CONFIG_ACPI_PROCESSOR
dep_tristate ' Thermal Zone' CONFIG_ACPI_THERMAL $CONFIG_ACPI_PROCESSOR
tristate ' Toshiba Laptop Extras' CONFIG_ACPI_TOSHIBA
bool ' Debug Statements' CONFIG_ACPI_DEBUG
fi
fi
......
......@@ -43,5 +43,6 @@ obj-$(CONFIG_ACPI_POWER) += power.o
obj-$(CONFIG_ACPI_PROCESSOR) += processor.o
obj-$(CONFIG_ACPI_THERMAL) += thermal.o
obj-$(CONFIG_ACPI_SYSTEM) += system.o
obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
include $(TOPDIR)/Rules.make
/*
* acpi_bus.h - ACPI Bus Driver ($Revision: 21 $)
* acpi_bus.h - ACPI Bus Driver ($Revision: 22 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -46,7 +46,6 @@ struct acpi_handle_list {
/* acpi_utils.h */
acpi_status acpi_extract_package (acpi_object *, acpi_buffer *, acpi_buffer *);
acpi_status acpi_evaluate (acpi_handle, acpi_string, acpi_object_list *, acpi_buffer *);
acpi_status acpi_evaluate_integer (acpi_handle, acpi_string, acpi_object_list *, unsigned long *);
acpi_status acpi_evaluate_reference (acpi_handle, acpi_string, acpi_object_list *, struct acpi_handle_list *);
......
/*
* acpi_drivers.h ($Revision: 30 $)
* acpi_drivers.h ($Revision: 31 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -124,6 +124,7 @@
#ifdef CONFIG_ACPI_EC
int acpi_ec_ecdt_probe (void);
int acpi_ec_init (void);
void acpi_ec_exit (void);
......
/*
* acpi_ksyms.c - ACPI Kernel Symbols ($Revision: 15 $)
* acpi_ksyms.c - ACPI Kernel Symbols ($Revision: 16 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -102,7 +102,6 @@ EXPORT_SYMBOL(acpi_os_wait_semaphore);
/* ACPI Utilities (acpi_utils.c) */
EXPORT_SYMBOL(acpi_extract_package);
EXPORT_SYMBOL(acpi_evaluate);
EXPORT_SYMBOL(acpi_evaluate_integer);
EXPORT_SYMBOL(acpi_evaluate_reference);
......
/*
* acpi_battery.c - ACPI Battery Driver ($Revision: 35 $)
* acpi_battery.c - ACPI Battery Driver ($Revision: 36 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -251,7 +251,7 @@ acpi_battery_set_alarm (
arg0.integer.value = alarm;
status = acpi_evaluate(battery->handle, "_BTP", &arg_list, NULL);
status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL);
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
......
/*
* acpi_bus.c - ACPI Bus Driver ($Revision: 77 $)
* acpi_bus.c - ACPI Bus Driver ($Revision: 79 $)
*
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
*
......@@ -1052,13 +1052,19 @@ acpi_bus_match (
break;
}
if (!cid[0])
if (!cid[0]) {
acpi_os_free(buffer.pointer);
return -ENOENT;
}
if (strstr(driver->ids, cid))
if (strstr(driver->ids, cid)) {
acpi_os_free(buffer.pointer);
return 0;
}
acpi_os_free(buffer.pointer);
}
return -ENOENT;
}
......@@ -1802,7 +1808,7 @@ acpi_bus_scan_fixed (
int result = 0;
struct acpi_device *device = NULL;
ACPI_FUNCTION_TRACE("acpi_bus_scan");
ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed");
if (!root)
return_VALUE(-ENODEV);
......@@ -1929,115 +1935,98 @@ acpi_bus_init (void)
int result = 0;
acpi_status status = AE_OK;
acpi_buffer buffer = {sizeof(acpi_fadt), &acpi_fadt};
int progress = 0;
ACPI_FUNCTION_TRACE("acpi_bus_init");
/*
* [0] Initailize the ACPI Core Subsystem.
*/
status = acpi_initialize_subsystem();
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to initialize the ACPI Interpreter\n");
result = -ENODEV;
goto end;
goto error0;
}
progress++;
/*
* [1] Load the ACPI tables.
*/
status = acpi_load_tables();
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to load the System Description Tables\n");
result = -ENODEV;
goto end;
goto error0;
}
progress++;
/*
* [2] Check the blacklist
*/
if (acpi_blacklisted()) {
result = -ENODEV;
goto end;
goto error1;
}
progress++;
/*
* [3] Get a separate copy of the FADT for use by other drivers.
* Get a separate copy of the FADT for use by other drivers.
*/
status = acpi_get_table(ACPI_TABLE_FADT, 1, &buffer);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to get the FADT\n");
result = -ENODEV;
goto end;
goto error1;
}
progress++;
status = acpi_enable_subsystem(ACPI_FULL_INITIALIZATION);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to start the ACPI Interpreter\n");
goto error1;
}
#ifdef CONFIG_ACPI_EC
/*
* [4] Enable the ACPI Core Subsystem.
* ACPI 2.0 requires the EC driver to be loaded and work before
* the EC device is found in the namespace. This is accomplished
* by looking for the ECDT table, and getting the EC parameters out
* of that.
*/
status = acpi_enable_subsystem(ACPI_FULL_INITIALIZATION);
result = acpi_ec_ecdt_probe();
if (result) {
goto error1;
}
#endif
status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to start the ACPI Interpreter\n");
result = -ENODEV;
goto end;
printk(KERN_ERR PREFIX "Unable to initialize ACPI objects\n");
goto error1;
}
printk(KERN_INFO PREFIX "Interpreter enabled\n");
progress++;
/*
* [5] Get the system interrupt model and evaluate \_PIC.
* Get the system interrupt model and evaluate \_PIC.
*/
result = acpi_bus_init_irq();
if (result)
goto end;
progress++;
goto error1;
/*
* [6] Register for all standard device notifications.
* Register the for all standard device notifications.
*/
status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, &acpi_bus_notify, NULL);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to register for device notifications\n");
result = -ENODEV;
goto end;
goto error1;
}
progress++;
/*
* [7] Create the root device.
* Create the root device in the bus's device tree
*/
result = acpi_bus_add(&acpi_root, NULL, ACPI_ROOT_OBJECT,
ACPI_BUS_TYPE_SYSTEM);
if (result)
goto end;
progress++;
goto error2;
/*
* [8] Create the root file system.
* Create the top ACPI proc directory
*/
acpi_device_dir(acpi_root) = proc_mkdir(ACPI_BUS_FILE_ROOT, NULL);
if (!acpi_root) {
result = -ENODEV;
goto end;
goto error3;
}
acpi_root_dir = acpi_device_dir(acpi_root);
progress++;
/*
* [9] Install drivers required for proper enumeration of the
* Install drivers required for proper enumeration of the
* ACPI namespace.
*/
acpi_system_init(); /* ACPI System */
......@@ -2049,41 +2038,30 @@ acpi_bus_init (void)
acpi_pci_link_init(); /* ACPI PCI Interrupt Link */
acpi_pci_root_init(); /* ACPI PCI Root Bridge */
#endif
progress++;
/*
* [10] Enumerate devices in the ACPI namespace.
* Enumerate devices in the ACPI namespace.
*/
result = acpi_bus_scan_fixed(acpi_root);
if (result)
goto end;
goto error4;
result = acpi_bus_scan(acpi_root);
if (result)
goto end;
end:
/*
* Clean up if anything went awry.
*/
if (result) {
switch (progress) {
case 10:
case 9: remove_proc_entry("ACPI", NULL);
case 8: acpi_bus_remove(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
case 7: acpi_remove_notify_handler(ACPI_ROOT_OBJECT,
ACPI_SYSTEM_NOTIFY, &acpi_bus_notify);
case 6:
case 5:
case 4:
case 3:
case 2: acpi_terminate();
case 1:
case 0:
default: return_VALUE(-ENODEV);
}
}
goto error4;
return_VALUE(0);
/* Mimic structured exception handling */
error4:
remove_proc_entry("ACPI", NULL);
error3:
acpi_bus_remove(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
error2:
acpi_remove_notify_handler(ACPI_ROOT_OBJECT,
ACPI_SYSTEM_NOTIFY, &acpi_bus_notify);
error1:
acpi_terminate();
error0:
return_VALUE(-ENODEV);
}
......
/*******************************************************************************
*
* Module Name: dbdisasm - parser op tree display routines
* $Revision: 66 $
* $Revision: 67 $
*
******************************************************************************/
......@@ -674,7 +674,8 @@ acpi_db_display_opcode (
(walk_state) &&
(walk_state->results) &&
(walk_state->results->results.num_results)) {
acpi_db_decode_internal_object (walk_state->results->results.obj_desc [walk_state->results->results.num_results-1]);
acpi_db_decode_internal_object (
walk_state->results->results.obj_desc [walk_state->results->results.num_results-1]);
}
#endif
break;
......
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
* $Revision: 75 $
* $Revision: 76 $
*
******************************************************************************/
......@@ -300,6 +300,11 @@ acpi_db_decode_internal_object (
return;
}
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
acpi_os_printf ("%p", obj_desc);
return;
}
acpi_os_printf (" %s", acpi_ut_get_object_type_name (obj_desc));
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
......@@ -336,12 +341,45 @@ acpi_db_decode_internal_object (
default:
/* No additional display for other types */
acpi_os_printf ("%p", obj_desc);
break;
}
}
/*******************************************************************************
*
* FUNCTION: Acpi_db_decode_node
*
* PARAMETERS: Node - Object to be displayed
*
* RETURN: None
*
* DESCRIPTION: Short display of a namespace node
*
******************************************************************************/
void
acpi_db_decode_node (
acpi_namespace_node *node)
{
acpi_os_printf ("<Node> Name %4.4s Type-%s",
node->name.ascii, acpi_ut_get_type_name (node->type));
if (node->flags & ANOBJ_METHOD_ARG) {
acpi_os_printf (" [Method Arg]");
}
if (node->flags & ANOBJ_METHOD_LOCAL) {
acpi_os_printf (" [Method Local]");
}
acpi_db_decode_internal_object (acpi_ns_get_attached_object (node));
}
/*******************************************************************************
*
* FUNCTION: Acpi_db_display_internal_object
......@@ -381,16 +419,7 @@ acpi_db_display_internal_object (
case ACPI_DESC_TYPE_NAMED:
acpi_os_printf ("<Node> Name %4.4s Type-%s",
((acpi_namespace_node *)obj_desc)->name.ascii,
acpi_ut_get_type_name (((acpi_namespace_node *) obj_desc)->type));
if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_ARG) {
acpi_os_printf (" [Method Arg]");
}
if (((acpi_namespace_node *) obj_desc)->flags & ANOBJ_METHOD_LOCAL) {
acpi_os_printf (" [Method Local]");
}
acpi_db_decode_node ((acpi_namespace_node *) obj_desc);
break;
......@@ -406,8 +435,10 @@ acpi_db_display_internal_object (
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case INTERNAL_TYPE_REFERENCE:
switch (obj_desc->reference.opcode) {
case AML_LOCAL_OP:
acpi_os_printf ("[Local%d] ", obj_desc->reference.offset);
if (walk_state) {
obj_desc = walk_state->local_variables[obj_desc->reference.offset].object;
......@@ -416,7 +447,9 @@ acpi_db_display_internal_object (
}
break;
case AML_ARG_OP:
acpi_os_printf ("[Arg%d] ", obj_desc->reference.offset);
if (walk_state) {
obj_desc = walk_state->arguments[obj_desc->reference.offset].object;
......@@ -425,24 +458,51 @@ acpi_db_display_internal_object (
}
break;
case AML_DEBUG_OP:
acpi_os_printf ("[Debug] ");
break;
case AML_INDEX_OP:
acpi_os_printf ("[Index] ");
acpi_db_decode_internal_object (obj_desc->reference.object);
break;
case AML_REF_OF_OP:
acpi_os_printf ("[Reference] ");
/* Reference can be to a Node or an Operand object */
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc->reference.object)) {
case ACPI_DESC_TYPE_NAMED:
acpi_db_decode_node (obj_desc->reference.object);
break;
case ACPI_DESC_TYPE_OPERAND:
acpi_db_decode_internal_object (obj_desc->reference.object);
break;
default:
break;
}
break;
default:
acpi_os_printf ("Unknown Reference opcode %X\n",
obj_desc->reference.opcode);
break;
}
break;
default:
acpi_os_printf ("<Obj> ");
acpi_os_printf (" ");
acpi_db_decode_internal_object (obj_desc);
......
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
* $Revision: 41 $
* $Revision: 42 $
*
******************************************************************************/
......@@ -223,6 +223,9 @@ acpi_db_execute (
acpi_gbl_db_method_info.args = args;
acpi_gbl_db_method_info.flags = flags;
return_obj.pointer = NULL;
return_obj.length = ACPI_ALLOCATE_BUFFER;
acpi_db_execute_setup (&acpi_gbl_db_method_info);
status = acpi_db_execute_method (&acpi_gbl_db_method_info, &return_obj);
......@@ -260,6 +263,10 @@ acpi_db_execute (
acpi_gbl_db_method_info.pathname, return_obj.pointer, return_obj.length);
acpi_db_dump_object (return_obj.pointer, 1);
}
else {
acpi_os_printf ("No return object from execution of %s\n",
acpi_gbl_db_method_info.pathname);
}
}
acpi_db_set_output_destination (ACPI_DB_CONSOLE_OUTPUT);
......
......@@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 63 $
* $Revision: 64 $
*
******************************************************************************/
......@@ -279,9 +279,13 @@ ae_local_load_table (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Install the new table into the local data structures */
table_info.pointer = table_ptr;
status = acpi_tb_recognize_table (&table_info, ACPI_TABLE_SECONDARY);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Install the new table into the local data structures */
status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
......
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 86 $
* $Revision: 87 $
*
*****************************************************************************/
......@@ -290,7 +290,7 @@ acpi_ds_call_control_method (
/* Create and init a Root Node */
op = acpi_ps_alloc_op (AML_SCOPE_OP);
op = acpi_ps_create_scope_op ();
if (!op) {
status = AE_NO_MEMORY;
goto cleanup;
......
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
* $Revision: 103 $
* $Revision: 104 $
*
*****************************************************************************/
......@@ -368,6 +368,8 @@ acpi_ds_init_object_from_op (
obj_desc->reference.opcode = AML_LOCAL_OP;
obj_desc->reference.offset = opcode - AML_LOCAL_OP;
acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset,
walk_state, (acpi_namespace_node **) &obj_desc->reference.object);
break;
......
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 66 $
* $Revision: 67 $
*
*****************************************************************************/
......@@ -448,12 +448,6 @@ acpi_ds_load2_end_op (
if (op->common.aml_opcode == AML_SCOPE_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Ending scope Op=%p State=%p\n", op, walk_state));
if (op->named.name == ACPI_UINT16_MAX) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n",
op, walk_state));
return (AE_OK);
}
}
......
/*
* acpi_ec.c - ACPI Embedded Controller Driver ($Revision: 31 $)
* acpi_ec.c - ACPI Embedded Controller Driver ($Revision: 35 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -76,13 +76,18 @@ static struct acpi_driver acpi_ec_driver = {
struct acpi_ec {
acpi_handle handle;
unsigned long gpe_bit;
unsigned long status_port;
unsigned long command_port;
unsigned long data_port;
acpi_generic_address status_addr;
acpi_generic_address command_addr;
acpi_generic_address data_addr;
unsigned long global_lock;
spinlock_t lock;
};
/* If we find an EC via the ECDT, we need to keep a ptr to its context */
static struct acpi_ec *ec_ecdt;
/* compare this against UIDs in properly enumerated ECs to determine if we
have a dupe */
static unsigned long ecdt_uid = 0xFFFFFFFF;
/* --------------------------------------------------------------------------
Transaction Management
......@@ -93,7 +98,7 @@ acpi_ec_wait (
struct acpi_ec *ec,
u8 event)
{
u8 acpi_ec_status = 0;
u32 acpi_ec_status = 0;
u32 i = ACPI_EC_UDELAY_COUNT;
if (!ec)
......@@ -103,7 +108,7 @@ acpi_ec_wait (
switch (event) {
case ACPI_EC_EVENT_OBF:
do {
acpi_ec_status = inb(ec->status_port);
acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr, 0);
if (acpi_ec_status & ACPI_EC_FLAG_OBF)
return 0;
udelay(ACPI_EC_UDELAY);
......@@ -111,7 +116,7 @@ acpi_ec_wait (
break;
case ACPI_EC_EVENT_IBE:
do {
acpi_ec_status = inb(ec->status_port);
acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr, 0);
if (!(acpi_ec_status & ACPI_EC_FLAG_IBF))
return 0;
udelay(ACPI_EC_UDELAY);
......@@ -151,17 +156,18 @@ acpi_ec_read (
spin_lock_irqsave(&ec->lock, flags);
outb(ACPI_EC_COMMAND_READ, ec->command_port);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr, 0);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result)
goto end;
outb(address, ec->data_port);
acpi_hw_low_level_write(8, address, &ec->data_addr, 0);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (result)
goto end;
*data = inb(ec->data_port);
acpi_hw_low_level_read(8, (u32*) data, &ec->data_addr, 0);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",
*data, address));
......@@ -200,17 +206,17 @@ acpi_ec_write (
spin_lock_irqsave(&ec->lock, flags);
outb(ACPI_EC_COMMAND_WRITE, ec->command_port);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr, 0);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result)
goto end;
outb(address, ec->data_port);
acpi_hw_low_level_write(8, address, &ec->data_addr, 0);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result)
goto end;
outb(data, ec->data_port);
acpi_hw_low_level_write(8, data, &ec->data_addr, 0);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result)
goto end;
......@@ -256,15 +262,14 @@ acpi_ec_query (
* Note that successful completion of the query causes the ACPI_EC_SCI
* bit to be cleared (and thus clearing the interrupt source).
*/
spin_lock_irqsave(&ec->lock, flags);
outb(ACPI_EC_COMMAND_QUERY, ec->command_port);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr, 0);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (result)
goto end;
*data = inb(ec->data_port);
acpi_hw_low_level_read(8, (u32*) data, &ec->data_addr, 0);
if (!*data)
result = -ENODATA;
......@@ -309,7 +314,7 @@ acpi_ec_gpe_query (
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name));
acpi_evaluate(query_data->handle, object_name, NULL, NULL);
acpi_evaluate_object(query_data->handle, object_name, NULL, NULL);
kfree(query_data);
......@@ -331,7 +336,7 @@ acpi_ec_gpe_handler (
return;
spin_lock_irqsave(&ec->lock, flags);
value = inb(ec->command_port);
acpi_hw_low_level_read(8, (u32*) &value, &ec->command_addr, 0);
spin_unlock_irqrestore(&ec->lock, flags);
/* TBD: Implement asynch events!
......@@ -340,7 +345,6 @@ acpi_ec_gpe_handler (
* treat EC-SCIs as level (versus EDGE!) triggered, preventing
* a purely interrupt-driven approach (grumble, grumble).
*/
if (!(value & ACPI_EC_FLAG_SCI))
return;
......@@ -459,7 +463,7 @@ acpi_ec_read_info (
p += sprintf(p, "gpe bit: 0x%02x\n",
(u32) ec->gpe_bit);
p += sprintf(p, "ports: 0x%02x, 0x%02x\n",
(u32) ec->status_port, (u32) ec->data_port);
(u32) ec->status_addr.address, (u32) ec->data_addr.address);
p += sprintf(p, "use global lock: %s\n",
ec->global_lock?"yes":"no");
......@@ -535,6 +539,7 @@ acpi_ec_add (
int result = 0;
acpi_status status = AE_OK;
struct acpi_ec *ec = NULL;
unsigned long uid;
ACPI_FUNCTION_TRACE("acpi_ec_add");
......@@ -555,6 +560,14 @@ acpi_ec_add (
/* Use the global lock for all EC transactions? */
acpi_evaluate_integer(ec->handle, "_GLK", NULL, &ec->global_lock);
/* If our UID matches ecdt_uid, we already found this EC via the
ECDT. Abort. */
acpi_evaluate_integer(ec->handle, "_UID", NULL, &uid);
if (ecdt_uid == uid) {
result = -ENODEV;
goto end;
}
/* Get GPE bit assignment (EC events). */
status = acpi_evaluate_integer(ec->handle, "_GPE", NULL, &ec->gpe_bit);
if (ACPI_FAILURE(status)) {
......@@ -623,9 +636,8 @@ acpi_ec_start (
return_VALUE(-EINVAL);
/*
* Get I/O port addresses
* Get I/O port addresses. Convert to GAS format.
*/
status = acpi_get_current_resources(ec->handle, &buffer);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses"));
......@@ -638,7 +650,10 @@ acpi_ec_start (
result = -ENODEV;
goto end;
}
ec->data_port = resource->data.io.min_base_address;
ec->data_addr.address_space_id = ACPI_ADR_SPACE_SYSTEM_IO;
ec->data_addr.register_bit_width = 8;
ec->data_addr.register_bit_offset = 0;
ec->data_addr.address = resource->data.io.min_base_address;
resource = ACPI_NEXT_RESOURCE(resource);
if (!resource || (resource->id != ACPI_RSTYPE_IO)) {
......@@ -646,30 +661,36 @@ acpi_ec_start (
result = -ENODEV;
goto end;
}
ec->command_port = ec->status_port = resource->data.io.min_base_address;
ec->command_addr.address_space_id = ACPI_ADR_SPACE_SYSTEM_IO;
ec->command_addr.register_bit_width = 8;
ec->command_addr.register_bit_offset = 0;
ec->command_addr.address = resource->data.io.min_base_address;
ec->status_addr = ec->command_addr;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n",
(u32) ec->gpe_bit, (u32) ec->command_port, (u32) ec->data_port));
(u32) ec->gpe_bit, (u32) ec->command_addr.address,
(u32) ec->data_addr.address));
/*
* Install GPE handler
*/
status = acpi_install_gpe_handler(ec->gpe_bit,
ACPI_EVENT_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec);
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
if (ACPI_FAILURE(status)) {
result = -ENODEV;
goto end;
}
status = acpi_install_address_space_handler (ec->handle,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler,
&acpi_ec_space_setup, ec);
if (ACPI_FAILURE(status)) {
acpi_remove_address_space_handler(ec->handle,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
return_VALUE(-ENODEV);
acpi_remove_gpe_handler(ec->gpe_bit, &acpi_ec_gpe_handler);
result = -ENODEV;
goto end;
}
end:
kfree(buffer.pointer);
acpi_os_free(buffer.pointer);
return_VALUE(result);
}
......@@ -703,6 +724,64 @@ acpi_ec_stop (
}
int __init
acpi_ec_ecdt_probe (void)
{
acpi_status status;
struct acpi_table_ecdt *ecdt_ptr;
status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING,
(acpi_table_header **) &ecdt_ptr);
if (ACPI_SUCCESS(status)) {
printk(KERN_INFO PREFIX "Found ECDT\n");
/*
* TODO: When the new driver model allows it, simply tell the
* EC driver it has a new device via that, instead if this.
*/
ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);
if (!ec_ecdt)
return -ENOMEM;
memset(ec_ecdt, 0, sizeof(struct acpi_ec));
ec_ecdt->command_addr = ecdt_ptr->ec_control;
ec_ecdt->status_addr = ecdt_ptr->ec_control;
ec_ecdt->data_addr = ecdt_ptr->ec_data;
ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit;
ec_ecdt->lock = SPIN_LOCK_UNLOCKED;
/* use the GL just to be safe */
ec_ecdt->global_lock = TRUE;
ecdt_uid = ecdt_ptr->uid;
/*
* Install GPE handler
*/
status = acpi_install_gpe_handler(ec_ecdt->gpe_bit,
ACPI_EVENT_EDGE_TRIGGERED, &acpi_ec_gpe_handler,
ec_ecdt);
if (ACPI_FAILURE(status)) {
goto error;
}
status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler,
&acpi_ec_space_setup, ec_ecdt);
if (ACPI_FAILURE(status)) {
acpi_remove_gpe_handler(ec_ecdt->gpe_bit,
&acpi_ec_gpe_handler);
goto error;
}
}
return 0;
error:
kfree(ec_ecdt);
return -ENODEV;
}
int __init
acpi_ec_init (void)
{
......@@ -719,6 +798,19 @@ acpi_ec_init (void)
return_VALUE(0);
}
void __exit
acpi_ec_ecdt_exit (void)
{
if (!ec_ecdt)
return;
acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
acpi_remove_gpe_handler(ec_ecdt->gpe_bit, &acpi_ec_gpe_handler);
kfree(ec_ecdt);
}
void __exit
acpi_ec_exit (void)
......@@ -731,5 +823,8 @@ acpi_ec_exit (void)
if (!result)
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
acpi_ec_ecdt_exit();
return_VOID;
}
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
* $Revision: 66 $
* $Revision: 67 $
*
*****************************************************************************/
......@@ -138,6 +138,7 @@ acpi_ex_load_table_op (
ACPI_FUNCTION_TRACE ("Ex_load_table_op");
#if 0
/*
* Make sure that the signature does not match one of the tables that
* is already loaded.
......@@ -148,6 +149,7 @@ acpi_ex_load_table_op (
return_ACPI_STATUS (AE_ALREADY_EXISTS);
}
#endif
/* Find the ACPI table */
......
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 155 $
* $Revision: 156 $
*
*****************************************************************************/
......@@ -121,6 +121,13 @@ acpi_ex_dump_operand (
break;
case AML_REF_OF_OP:
acpi_os_printf ("Reference: (Ref_of) %p\n",
obj_desc->reference.object);
break;
case AML_ARG_OP:
acpi_os_printf ("Reference: Arg%d",
......@@ -157,10 +164,12 @@ acpi_ex_dump_operand (
case AML_INT_NAMEPATH_OP:
acpi_os_printf ("Reference.Node->Name %X\n",
obj_desc->reference.node->name.integer);
break;
default:
/* unknown opcode */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
* $Revision: 106 $
* $Revision: 107 $
*
*****************************************************************************/
......@@ -41,6 +41,7 @@
*
* PARAMETERS: Obj_desc - Create a reference to this object
* Return_desc - Where to store the reference
* Walk_state - Current state
*
* RETURN: Status
*
......@@ -55,65 +56,75 @@ acpi_ex_get_object_reference (
acpi_operand_object **return_desc,
acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
acpi_operand_object *reference_obj;
acpi_operand_object *referenced_obj;
ACPI_FUNCTION_TRACE_PTR ("Ex_get_object_reference", obj_desc);
*return_desc = NULL;
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
case ACPI_DESC_TYPE_OPERAND:
if (ACPI_GET_OBJECT_TYPE (obj_desc) != INTERNAL_TYPE_REFERENCE) {
*return_desc = NULL;
status = AE_TYPE;
goto cleanup;
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
/*
* Not a Name -- an indirect name pointer would have
* been converted to a direct name pointer in Acpi_ex_resolve_operands
* Must be a reference to a Local or Arg
*/
switch (obj_desc->reference.opcode) {
case AML_LOCAL_OP:
case AML_ARG_OP:
status = acpi_ds_method_data_get_node (obj_desc->reference.opcode,
obj_desc->reference.offset, walk_state,
ACPI_CAST_INDIRECT_PTR (acpi_namespace_node, return_desc));
/* The referenced object is the pseudo-node for the local/arg */
referenced_obj = obj_desc->reference.object;
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(Internal) Unknown Ref subtype %02x\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference subtype %X\n",
obj_desc->reference.opcode));
*return_desc = NULL;
status = AE_AML_INTERNAL;
goto cleanup;
return_ACPI_STATUS (AE_AML_INTERNAL);
}
break;
case ACPI_DESC_TYPE_NAMED:
/* Must be a named object; Just return the Node */
*return_desc = obj_desc;
/*
* A named reference that has already been resolved to a Node
*/
referenced_obj = obj_desc;
break;
default:
*return_desc = NULL;
status = AE_TYPE;
break;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type %X in %p\n",
ACPI_GET_DESCRIPTOR_TYPE (obj_desc), obj_desc));
return_ACPI_STATUS (AE_TYPE);
}
cleanup:
/* Create a new reference object */
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p Ref=%p\n", obj_desc, *return_desc));
return_ACPI_STATUS (status);
reference_obj = acpi_ut_create_internal_object (INTERNAL_TYPE_REFERENCE);
if (!reference_obj) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
reference_obj->reference.opcode = AML_REF_OF_OP;
reference_obj->reference.object = referenced_obj;
*return_desc = reference_obj;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n",
obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
return_ACPI_STATUS (AE_OK);
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 139 $
* $Revision: 140 $
*
*****************************************************************************/
......@@ -355,7 +355,7 @@ acpi_ex_opcode_1A_1T_1R (
goto cleanup;
}
/* Get the object reference and store it */
/* Get the object reference, store it, and remove our reference */
status = acpi_ex_get_object_reference (operand[0], &return_desc2, walk_state);
if (ACPI_FAILURE (status)) {
......@@ -363,6 +363,7 @@ acpi_ex_opcode_1A_1T_1R (
}
status = acpi_ex_store (return_desc2, operand[1], walk_state);
acpi_ut_remove_reference (return_desc2);
/* The object exists in the namespace, return TRUE */
......@@ -733,6 +734,15 @@ acpi_ex_opcode_1A_0T_1R (
operand[0] = temp_desc;
break;
case AML_REF_OF_OP:
/* Get the object to which the reference refers */
temp_desc = operand[0]->reference.object;
acpi_ut_remove_reference (operand[0]);
operand[0] = temp_desc;
break;
default:
/* Must be an Index op - handled below */
......
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 108 $
* $Revision: 109 $
*
*****************************************************************************/
......@@ -359,7 +359,8 @@ acpi_ex_opcode_2A_1T_1R (
/* Object to be indexed is a Package */
if (index >= operand[0]->package.count) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond package end\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value (%X) beyond package end (%X)\n",
index, operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT;
goto cleanup;
}
......@@ -401,7 +402,8 @@ acpi_ex_opcode_2A_1T_1R (
/* Object to be indexed is a Buffer */
if (index >= operand[0]->buffer.length) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value beyond end of buffer\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index value (%X) beyond end of buffer (%X)\n",
index, operand[0]->buffer.length));
status = AE_AML_BUFFER_LIMIT;
goto cleanup;
}
......@@ -522,7 +524,8 @@ acpi_ex_opcode_2A_0T_1R (
default:
ACPI_REPORT_ERROR (("Acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
ACPI_REPORT_ERROR (("Acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n",
walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
* $Revision: 56 $
* $Revision: 57 $
*
*****************************************************************************/
......@@ -219,7 +219,7 @@ acpi_ex_resolve_node_to_value (
/* No named references are allowed here */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported reference opcode %X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X\n",
source_desc->reference.opcode));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
* $Revision: 114 $
* $Revision: 115 $
*
*****************************************************************************/
......@@ -227,9 +227,11 @@ acpi_ex_resolve_object_to_value (
break;
case AML_REF_OF_OP:
case AML_DEBUG_OP:
/* Just leave the object as-is */
break;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
* $Revision: 53 $
* $Revision: 54 $
*
*****************************************************************************/
......@@ -204,6 +204,7 @@ acpi_ex_resolve_operands (
case AML_DEBUG_OP:
case AML_NAME_OP:
case AML_INDEX_OP:
case AML_REF_OF_OP:
case AML_ARG_OP:
case AML_LOCAL_OP:
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
* $Revision: 167 $
* $Revision: 168 $
*
*****************************************************************************/
......@@ -130,6 +130,7 @@ acpi_ex_store (
*/
switch (ref_desc->reference.opcode) {
case AML_NAME_OP:
case AML_REF_OF_OP:
/* Storing an object into a Name "container" */
......
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 104 $
* $Revision: 105 $
*
*****************************************************************************/
......@@ -54,7 +54,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20020611
#define ACPI_CA_VERSION 0x20020702
/* Version of ACPI supported */
......
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
* $Revision: 61 $
* $Revision: 62 $
*
*****************************************************************************/
......@@ -212,6 +212,10 @@ void
acpi_db_decode_internal_object (
acpi_operand_object *obj_desc);
void
acpi_db_decode_node (
acpi_namespace_node *node);
u32
acpi_db_block_type (
acpi_parse_object *op);
......
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
* $Revision: 125 $
* $Revision: 126 $
*
*****************************************************************************/
......@@ -72,6 +72,7 @@ extern u32 acpi_gbl_nesting_level;
*
*/
ACPI_EXTERN u32 acpi_gbl_table_flags;
ACPI_EXTERN u32 acpi_gbl_rsdt_table_count;
ACPI_EXTERN RSDP_DESCRIPTOR *acpi_gbl_RSDP;
ACPI_EXTERN xsdt_descriptor *acpi_gbl_XSDT;
ACPI_EXTERN FADT_DESCRIPTOR *acpi_gbl_FADT;
......
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 167 $
* $Revision: 168 $
*
*****************************************************************************/
......@@ -33,10 +33,6 @@ typedef void* acpi_mutex;
typedef u32 ACPI_MUTEX_HANDLE;
#define ACPI_MEMORY_MODE 0x01
#define ACPI_LOGICAL_ADDRESSING 0x00
#define ACPI_PHYSICAL_ADDRESSING 0x01
/* Total number of aml opcodes defined */
#define AML_NUM_OPCODES 0x7E
......
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
* $Revision: 59 $
* $Revision: 60 $
*
*****************************************************************************/
......@@ -266,6 +266,10 @@ acpi_ps_delete_completed_op (
/* psutils - parser utilities */
acpi_parse_object *
acpi_ps_create_scope_op (
void);
void
acpi_ps_init_op (
acpi_parse_object *op,
......
......@@ -43,6 +43,10 @@ acpi_status
acpi_enable_subsystem (
u32 flags);
acpi_status
acpi_initialize_objects (
u32 flags);
acpi_status
acpi_terminate (
void);
......
/******************************************************************************
*
* Name: actables.h - ACPI table management
* $Revision: 41 $
* $Revision: 42 $
*
*****************************************************************************/
......@@ -43,8 +43,7 @@ acpi_tb_handle_to_object (
acpi_status
acpi_tb_convert_to_xsdt (
acpi_table_desc *table_info,
u32 *number_of_tables);
acpi_table_desc *table_info);
acpi_status
acpi_tb_convert_table_fadt (
......@@ -63,13 +62,31 @@ acpi_tb_get_table_count (
* tbget - Table "get" routines
*/
void
acpi_tb_table_override (
acpi_status
acpi_tb_get_table (
ACPI_POINTER *address,
acpi_table_desc *table_info);
acpi_status
acpi_tb_get_table_with_override (
acpi_tb_get_table_header (
ACPI_POINTER *address,
acpi_table_header *return_header);
acpi_status
acpi_tb_get_table_body (
ACPI_POINTER *address,
acpi_table_header *header,
acpi_table_desc *table_info);
acpi_status
acpi_tb_get_this_table (
ACPI_POINTER *address,
acpi_table_header *header,
acpi_table_desc *table_info);
acpi_status
acpi_tb_table_override (
acpi_table_header *header,
acpi_table_desc *table_info);
acpi_status
......@@ -78,11 +95,6 @@ acpi_tb_get_table_ptr (
u32 instance,
acpi_table_header **table_ptr_loc);
acpi_status
acpi_tb_get_table (
ACPI_POINTER *address,
acpi_table_desc *table_info);
acpi_status
acpi_tb_verify_rsdp (
ACPI_POINTER *address);
......@@ -96,20 +108,19 @@ acpi_tb_validate_rsdt (
acpi_table_header *table_ptr);
acpi_status
acpi_tb_get_table_pointer (
ACPI_POINTER *address,
u32 flags,
ACPI_SIZE *size,
acpi_table_header **table_ptr);
/*
* tbgetall - Get all firmware ACPI tables
*/
acpi_tb_get_required_tables (
void);
acpi_status
acpi_tb_get_all_tables (
u32 number_of_tables);
acpi_tb_get_primary_table (
ACPI_POINTER *address,
acpi_table_desc *table_info);
acpi_status
acpi_tb_get_secondary_table (
ACPI_POINTER *address,
acpi_string signature,
acpi_table_desc *table_info);
/*
* tbinstall - Table installation
......@@ -122,11 +133,13 @@ acpi_tb_install_table (
acpi_status
acpi_tb_match_signature (
NATIVE_CHAR *signature,
acpi_table_desc *table_info);
acpi_table_desc *table_info,
u8 search_type);
acpi_status
acpi_tb_recognize_table (
acpi_table_desc *table_info);
acpi_table_desc *table_info,
u8 search_type);
acpi_status
acpi_tb_init_table_descriptor (
......@@ -165,7 +178,7 @@ acpi_tb_free_acpi_tables_of_type (
acpi_status
acpi_tb_get_table_rsdt (
u32 *number_of_tables);
void);
u8 *
acpi_tb_scan_memory_for_rsdp (
......@@ -189,12 +202,6 @@ acpi_tb_find_table (
NATIVE_CHAR *oem_table_id,
acpi_table_header **table_ptr);
acpi_status
acpi_tb_map_acpi_table (
ACPI_PHYSICAL_ADDRESS physical_address,
ACPI_SIZE *size,
acpi_table_header **logical_address);
acpi_status
acpi_tb_verify_table_checksum (
acpi_table_header *table_header);
......
/******************************************************************************
*
* Name: actbl.h - Table data structures defined in ACPI specification
* $Revision: 52 $
* $Revision: 53 $
*
*****************************************************************************/
......@@ -185,9 +185,15 @@ typedef struct /* Smart Battery Description Table */
/* Definitions for the Flags bitfield member of ACPI_TABLE_SUPPORT */
#define ACPI_TABLE_SINGLE 0
#define ACPI_TABLE_MULTIPLE 1
#define ACPI_TABLE_EXECUTABLE 2
#define ACPI_TABLE_SINGLE 0x00
#define ACPI_TABLE_MULTIPLE 0x01
#define ACPI_TABLE_EXECUTABLE 0x02
#define ACPI_TABLE_ROOT 0x00
#define ACPI_TABLE_PRIMARY 0x10
#define ACPI_TABLE_SECONDARY 0x20
#define ACPI_TABLE_OTHER 0x30
#define ACPI_TABLE_TYPE_MASK 0x30
/* Data about each known table type */
......
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 237 $
* $Revision: 238 $
*
*****************************************************************************/
......@@ -209,8 +209,18 @@ typedef struct acpi_pointer
/* Pointer_types for above */
#define ACPI_LOGICAL_POINTER 0x01
#define ACPI_PHYSICAL_POINTER 0x02
#define ACPI_PHYSICAL_POINTER 0x01
#define ACPI_LOGICAL_POINTER 0x02
/* Processor mode */
#define ACPI_PHYSICAL_ADDRESSING 0x04
#define ACPI_LOGICAL_ADDRESSING 0x08
#define ACPI_MEMORY_MODE 0x0C
#define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
/*
......
This diff is collapsed.
/******************************************************************************
*
* Name: aclinux.h - OS specific defines, etc.
* $Revision: 25 $
* $Revision: 26 $
*
*****************************************************************************/
......
......@@ -2,7 +2,7 @@
*
* Module Name: nseval - Object evaluation interfaces -- includes control
* method lookup and execution.
* $Revision: 116 $
* $Revision: 117 $
*
******************************************************************************/
......@@ -485,7 +485,8 @@ acpi_ns_get_object_value (
if (ACPI_SUCCESS (status)) {
status = AE_CTRL_RETURN_VALUE;
*return_obj_desc = ACPI_CAST_PTR (acpi_operand_object, resolved_node);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning obj %p\n", resolved_node));
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
*return_obj_desc, acpi_ut_get_object_type_name (*return_obj_desc)));
}
}
......
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
* $Revision: 55 $
* $Revision: 56 $
*
*****************************************************************************/
......@@ -115,12 +115,11 @@ acpi_ns_one_complete_parse (
/* Create and init a Root Node */
parse_root = acpi_ps_alloc_op (AML_SCOPE_OP);
parse_root = acpi_ps_create_scope_op ();
if (!parse_root) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
parse_root->named.name = ACPI_ROOT_NAME;
/* Create and initialize a new walk state */
......
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
* $Revision: 77 $
* $Revision: 78 $
*
******************************************************************************/
......@@ -179,7 +179,7 @@ acpi_ns_get_pathname_length (
size = 0;
next_node = node;
while (next_node != acpi_gbl_root_node) {
while (next_node && (next_node != acpi_gbl_root_node)) {
size += PATH_SEGMENT_LENGTH;
next_node = acpi_ns_get_parent_node (next_node);
}
......
/*
* acpi_osl.c - OS-dependent functions ($Revision: 78 $)
* acpi_osl.c - OS-dependent functions ($Revision: 83 $)
*
* Copyright (C) 2000 Andrew Henroid
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
......@@ -42,7 +42,7 @@
u64 efi_mem_attributes (u64 phys_addr);
#endif
#ifdef _IA64
#ifdef CONFIG_IA64
#include <asm/hw_irq.h>
#include <asm/delay.h>
#endif
......@@ -176,7 +176,7 @@ acpi_status
acpi_os_map_memory(ACPI_PHYSICAL_ADDRESS phys, ACPI_SIZE size, void **virt)
{
#ifdef CONFIG_ACPI_EFI
if (EFI_MEMORY_UC & efi_mem_attributes(phys)) {
if (!(EFI_MEMORY_WB & efi_mem_attributes(phys))) {
*virt = ioremap(phys, size);
} else {
*virt = phys_to_virt(phys);
......@@ -234,9 +234,9 @@ acpi_irq(int irq, void *dev_id, struct pt_regs *regs)
acpi_status
acpi_os_install_interrupt_handler(u32 irq, OSD_HANDLER handler, void *context)
{
#ifdef _IA64
irq = isa_irq_to_vector(irq);
#endif /*_IA64*/
#ifdef CONFIG_IA64
irq = gsi_to_vector(irq);
#endif
acpi_irq_irq = irq;
acpi_irq_handler = handler;
acpi_irq_context = context;
......@@ -252,9 +252,9 @@ acpi_status
acpi_os_remove_interrupt_handler(u32 irq, OSD_HANDLER handler)
{
if (acpi_irq_handler) {
#ifdef _IA64
irq = isa_irq_to_vector(irq);
#endif /*_IA64*/
#ifdef CONFIG_IA64
irq = gsi_to_vector(irq);
#endif
free_irq(irq, acpi_irq);
acpi_irq_handler = NULL;
}
......@@ -349,12 +349,13 @@ acpi_os_read_memory(
#ifdef CONFIG_ACPI_EFI
int iomem = 0;
if (EFI_MEMORY_UC & efi_mem_attributes(phys_addr)) {
if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) {
virt_addr = phys_to_virt(phys_addr);
}
else {
iomem = 1;
virt_addr = ioremap(phys_addr, width);
}
else
virt_addr = phys_to_virt(phys_addr);
#else
virt_addr = phys_to_virt(phys_addr);
#endif
......@@ -394,12 +395,13 @@ acpi_os_write_memory(
#ifdef CONFIG_ACPI_EFI
int iomem = 0;
if (EFI_MEMORY_UC & efi_mem_attributes(phys_addr)) {
if (EFI_MEMORY_WB & efi_mem_attributes(phys_addr)) {
virt_addr = phys_to_virt(phys_addr);
}
else {
iomem = 1;
virt_addr = ioremap(phys_addr,width);
virt_addr = ioremap(phys_addr, width);
}
else
virt_addr = phys_to_virt(phys_addr);
#else
virt_addr = phys_to_virt(phys_addr);
#endif
......@@ -627,31 +629,35 @@ acpi_os_queue_for_execution(
case OSD_PRIORITY_GPE:
{
static struct tq_struct task;
/*
* Allocate/initialize DPC structure. Note that this memory will be
* freed by the callee.
* freed by the callee. The kernel handles the tq_struct list in a
* way that allows us to also free its memory inside the callee.
* Because we may want to schedule several tasks with different
* parameters we can't use the approach some kernel code uses of
* having a static tq_struct.
* We can save time and code by allocating the DPC and tq_structs
* from the same memory.
*/
dpc = kmalloc(sizeof(ACPI_OS_DPC), GFP_ATOMIC);
struct tq_struct *task;
dpc = kmalloc(sizeof(ACPI_OS_DPC)+sizeof(struct tq_struct), GFP_ATOMIC);
if (!dpc)
return_ACPI_STATUS (AE_NO_MEMORY);
dpc->function = function;
dpc->context = context;
memset(&task, 0, sizeof(struct tq_struct));
task.routine = acpi_os_schedule_exec;
task.data = (void*)dpc;
task = (void *)(dpc+1);
INIT_TQUEUE(task, acpi_os_schedule_exec, (void*)dpc);
if (schedule_task(&task) < 0) {
if (schedule_task(task) < 0) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to schedule_task() failed.\n"));
kfree(dpc);
status = AE_ERROR;
}
}
break;
default:
/*
* Allocate/initialize DPC structure. Note that this memory will be
......
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
* $Revision: 127 $
* $Revision: 128 $
*
*****************************************************************************/
......@@ -581,6 +581,10 @@ acpi_ps_parse_loop (
pre_op.common.value.arg = NULL;
pre_op.common.aml_opcode = walk_state->opcode;
/*
* Get and append arguments until we find the node that contains
* the name (the type ARGP_NAME).
*/
while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME) {
arg = acpi_ps_get_next_arg (parser_state,
GET_CURRENT_ARG_TYPE (walk_state->arg_types),
......
/******************************************************************************
*
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
* $Revision: 51 $
* $Revision: 52 $
*
*****************************************************************************/
......@@ -27,11 +27,42 @@
#include "acpi.h"
#include "acparser.h"
#include "amlcode.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psutils")
/*******************************************************************************
*
* FUNCTION: Acpi_ps_create_scope_op
*
* PARAMETERS: None
*
* RETURN: Scope_op
*
* DESCRIPTION: Create a Scope and associated namepath op with the root name
*
******************************************************************************/
acpi_parse_object *
acpi_ps_create_scope_op (
void)
{
acpi_parse_object *scope_op;
scope_op = acpi_ps_alloc_op (AML_SCOPE_OP);
if (!scope_op) {
return (NULL);
}
scope_op->named.name = ACPI_ROOT_NAME;
return (scope_op);
}
/*******************************************************************************
*
* FUNCTION: Acpi_ps_init_op
......
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
* $Revision: 64 $
* $Revision: 65 $
*
*****************************************************************************/
......@@ -108,7 +108,7 @@ acpi_psx_execute (
/* Create and init a Root Node */
op = acpi_ps_alloc_op (AML_SCOPE_OP);
op = acpi_ps_create_scope_op ();
if (!op) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
......@@ -149,7 +149,7 @@ acpi_psx_execute (
/* Create and init a Root Node */
op = acpi_ps_alloc_op (AML_SCOPE_OP);
op = acpi_ps_create_scope_op ();
if (!op) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
......
/*
* pci_irq.c - ACPI PCI Interrupt Routing ($Revision: 7 $)
* pci_irq.c - ACPI PCI Interrupt Routing ($Revision: 10 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -250,8 +250,13 @@ acpi_pci_irq_lookup (
return_VALUE(0);
}
if (!entry->irq && entry->link.handle)
if (!entry->irq && entry->link.handle) {
entry->irq = acpi_pci_link_get_irq(entry->link.handle, entry->link.index);
if (!entry->irq) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n"));
return_VALUE(0);
}
}
else if (!entry->irq) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid static routing entry (IRQ 0)\n"));
return_VALUE(0);
......@@ -323,7 +328,7 @@ acpi_pci_irq_enable (
/*
* First we check the PCI IRQ routing table (PRT) for an IRQ. PRT
* values override any BIOS-assinged IRQs set during boot.
* values override any BIOS-assigned IRQs set during boot.
*/
irq = acpi_pci_irq_lookup(0, dev->bus->number, PCI_SLOT(dev->devfn), pin);
......@@ -334,14 +339,19 @@ acpi_pci_irq_enable (
if (!irq)
irq = acpi_pci_irq_derive(dev, pin);
if (irq)
dev->irq = irq;
if (!dev->irq) {
printk(KERN_WARNING PREFIX "No IRQ known for interrupt pin %c of device %s\n", ('A' + pin), dev->slot_name);
return_VALUE(0);
/*
* No IRQ known to the ACPI subsystem - maybe the BIOS /
* driver reported one, then use it. Exit in any case.
*/
if (!irq) {
printk(KERN_WARNING PREFIX "No IRQ known for interrupt pin %c of device %s", ('A' + pin), dev->slot_name);
if (dev->irq)
printk(" - using IRQ %d\n", dev->irq);
return_VALUE(dev->irq);
}
dev->irq = irq;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device %s using IRQ %d\n", dev->slot_name, dev->irq));
/*
......
/*
* pci_link.c - ACPI PCI Interrupt Link Device Driver ($Revision: 31 $)
* pci_link.c - ACPI PCI Interrupt Link Device Driver ($Revision: 33 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -110,6 +110,10 @@ acpi_pci_link_get_possible (
resource = (acpi_resource *) buffer.pointer;
/* skip past dependent function resource (if present) */
if (resource->id == ACPI_RSTYPE_START_DPF)
resource = ACPI_NEXT_RESOURCE(resource);
switch (resource->id) {
case ACPI_RSTYPE_IRQ:
{
......@@ -160,7 +164,7 @@ acpi_pci_link_get_possible (
"Found %d possible IRQs\n", link->irq.possible_count));
end:
kfree(buffer.pointer);
acpi_os_free(buffer.pointer);
return_VALUE(result);
}
......@@ -255,7 +259,7 @@ acpi_pci_link_get_current (
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Link at IRQ %d \n", link->irq.active));
end:
kfree(buffer.pointer);
acpi_os_free(buffer.pointer);
return_VALUE(result);
}
......@@ -393,7 +397,7 @@ acpi_pci_link_check (void)
if (link->irq.active)
acpi_irq_penalty[link->irq.active] += 100;
else {
else if (link->irq.possible_count) {
int penalty = 100 / link->irq.possible_count;
for (i=0; i<link->irq.possible_count; i++) {
if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ)
......@@ -410,7 +414,7 @@ acpi_pci_link_check (void)
int i = 0;
link = list_entry(node, struct acpi_pci_link, node);
if (!link) {
if (!link || !link->irq.possible_count) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n"));
continue;
}
......@@ -436,7 +440,7 @@ acpi_pci_link_check (void)
printk(PREFIX "%s [%s] enabled at IRQ %d\n",
acpi_device_name(link->device),
acpi_device_bid(link->device), irq);
acpi_device_bid(link->device), link->irq.active);
}
return_VALUE(0);
......
/*
* pci_root.c - ACPI PCI Root Bridge Driver ($Revision: 38 $)
* pci_root.c - ACPI PCI Root Bridge Driver ($Revision: 39 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -154,7 +154,7 @@ acpi_pci_evaluate_crs (
root->mem_tra = acpi_pci_root_bus_tra ((acpi_resource *)
buffer.pointer, ACPI_MEMORY_RANGE);
kfree(buffer.pointer);
acpi_os_free(buffer.pointer);
return_VALUE(0);
}
......
/*
* acpi_power.c - ACPI Bus Power Management ($Revision: 37 $)
* acpi_power.c - ACPI Bus Power Management ($Revision: 38 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -186,7 +186,7 @@ acpi_power_on (
return_VALUE(0);
}
status = acpi_evaluate(resource->handle, "_ON", NULL, NULL);
status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL);
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
......@@ -240,7 +240,7 @@ acpi_power_off (
return_VALUE(0);
}
status = acpi_evaluate(resource->handle, "_OFF", NULL, NULL);
status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL);
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
......
/*
* acpi_processor.c - ACPI Processor Driver ($Revision: 66 $)
* acpi_processor.c - ACPI Processor Driver ($Revision: 69 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -616,8 +616,15 @@ acpi_processor_set_power_policy (
* Set the default C1 promotion and C2 demotion policies, where we
* promote from C1 to C2 after several (10) successive C1 transitions,
* as we cannot (currently) measure the time spent in C1. Demote from
* C2 to C1 after experiencing several (4) 'shorts' (time spent in C2
* is less than the C2 transtion latency).
* C2 to C1 anytime we experience a 'short' (time spent in C2 is less
* than the C2 transtion latency). Note the simplifying assumption
* that the 'cost' of a transition is amortized when we sleep for at
* least as long as the transition's latency (thus the total transition
* time is two times the latency).
*
* TBD: Measure C1 sleep times by instrumenting the core IRQ handler.
* TBD: Demote to default C-State after long periods of activity.
* TBD: Investigate policy's use of CPU utilization -vs- sleep duration.
*/
if (pr->power.states[ACPI_STATE_C2].valid) {
pr->power.states[ACPI_STATE_C1].promotion.threshold.count = 10;
......@@ -625,7 +632,7 @@ acpi_processor_set_power_policy (
pr->power.states[ACPI_STATE_C2].latency_ticks;
pr->power.states[ACPI_STATE_C1].promotion.state = ACPI_STATE_C2;
pr->power.states[ACPI_STATE_C2].demotion.threshold.count = 4;
pr->power.states[ACPI_STATE_C2].demotion.threshold.count = 1;
pr->power.states[ACPI_STATE_C2].demotion.threshold.ticks =
pr->power.states[ACPI_STATE_C2].latency_ticks;
pr->power.states[ACPI_STATE_C2].demotion.state = ACPI_STATE_C1;
......@@ -929,7 +936,7 @@ acpi_processor_get_performance_control (
pr->performance.status_register));
end:
kfree(buffer.pointer);
acpi_os_free(buffer.pointer);
return_VALUE(result);
}
......@@ -1006,7 +1013,7 @@ acpi_processor_get_performance_states (
}
end:
kfree(buffer.pointer);
acpi_os_free(buffer.pointer);
return_VALUE(result);
}
......@@ -2059,11 +2066,8 @@ acpi_processor_get_info (
if (!pr)
return_VALUE(-EINVAL);
#ifdef CONFIG_SMP
/* FIXME: What should this be? -- RR */
if (num_online_cpus() > 1)
errata.smp = num_online_cpus();
#endif
errata.smp = TRUE;
acpi_processor_errata(pr);
......
/*******************************************************************************
*
* Module Name: rscreate - Create resource lists/tables
* $Revision: 57 $
* $Revision: 58 $
*
******************************************************************************/
......@@ -39,7 +39,6 @@
*
* PARAMETERS: Byte_stream_buffer - Pointer to the resource byte stream
* Output_buffer - Pointer to the user's buffer
* Output_buffer_length - Pointer to the size of Output_buffer
*
* RETURN: Status - AE_OK if okay, else a valid acpi_status code
* If Output_buffer is not large enough, Output_buffer_length
......@@ -116,7 +115,6 @@ acpi_rs_create_resource_list (
* PARAMETERS: Package_object - Pointer to an acpi_operand_object
* package
* Output_buffer - Pointer to the user's buffer
* Output_buffer_length - Size of Output_buffer
*
* RETURN: Status AE_OK if okay, else a valid acpi_status code.
* If the Output_buffer is too small, the error will be
......
/*******************************************************************************
*
* Module Name: rsio - IO and DMA resource descriptors
* $Revision: 20 $
* $Revision: 21 $
*
******************************************************************************/
......@@ -410,6 +410,7 @@ acpi_rs_dma_resource (
if (i == 0) {
/* Zero channels is invalid! */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found Zero DMA channels in resource list\n"));
return_ACPI_STATUS (AE_BAD_DATA);
}
output_struct->data.dma.number_of_channels = i;
......@@ -432,6 +433,7 @@ acpi_rs_dma_resource (
output_struct->data.dma.transfer = temp8 & 0x03;
if (0x03 == output_struct->data.dma.transfer) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n"));
return_ACPI_STATUS (AE_BAD_DATA);
}
......
/*******************************************************************************
*
* Module Name: rsirq - IRQ resource descriptors
* $Revision: 28 $
* $Revision: 29 $
*
******************************************************************************/
......@@ -99,6 +99,7 @@ acpi_rs_irq_resource (
if (i == 0) {
/* Zero interrupts is invalid! */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found Zero interrupt levels in resource list\n"));
return_ACPI_STATUS (AE_BAD_DATA);
}
output_struct->data.irq.number_of_interrupts = i;
......@@ -133,6 +134,7 @@ acpi_rs_irq_resource (
* are allowed (ACPI spec v1.0b ection 6.4.2.1),
* so an error will occur if we reach this point
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid interrupt polarity/trigger in resource list\n"));
return_ACPI_STATUS (AE_BAD_DATA);
}
}
......
/*******************************************************************************
*
* Module Name: rslist - Linked list utilities
* $Revision: 30 $
* $Revision: 31 $
*
******************************************************************************/
......@@ -471,6 +471,8 @@ acpi_rs_list_to_byte_stream (
* If we get here, everything is out of sync,
* so exit with an error
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n",
linked_list->id));
status = AE_BAD_DATA;
break;
......
/*
* acpi_system.c - ACPI System Driver ($Revision: 57 $)
* acpi_system.c - ACPI System Driver ($Revision: 60 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -24,7 +24,6 @@
*/
#define ACPI_C
#define HAVE_NEW_DEVICE_MODEL
#include <linux/config.h>
#include <linux/kernel.h>
......@@ -126,7 +125,7 @@ acpi_system_restore_state (
/* wait for power to come back */
mdelay(10);
#ifdef HAVE_NEW_DEVICE_MODEL
/* turn all the devices back on */
device_resume(RESUME_POWER_ON);
......@@ -135,11 +134,8 @@ acpi_system_restore_state (
/* restore device context */
device_resume(RESUME_RESTORE_STATE);
#else
#error Resume cant work without driver model
#endif
if ((state == ACPI_STATE_S1) && (dmi_broken & BROKEN_INIT_AFTER_S1)) {
if (dmi_broken & BROKEN_INIT_AFTER_S1) {
printk("Broken toshiba laptop -> kicking interrupts\n");
init_8259A(0);
}
......@@ -166,7 +162,6 @@ acpi_system_save_state(
{
int error = 0;
#ifdef HAVE_NEW_DEVICE_MODEL
/* Send notification to devices that they will be suspended.
* If any device or driver cannot make the transition, either up
* or down, we'll get an error back.
......@@ -174,10 +169,9 @@ acpi_system_save_state(
error = device_suspend(state, SUSPEND_NOTIFY);
if (error)
return AE_ERROR;
#endif
if (state < ACPI_STATE_S5) {
#ifdef HAVE_NEW_DEVICE_MODEL
/* Tell devices to stop I/O and actually save their state.
* It is theoretically possible that something could fail,
* so handle that gracefully..
......@@ -190,7 +184,6 @@ acpi_system_save_state(
device_resume(RESUME_RESTORE_STATE);
return error;
}
#endif
/* flush caches */
ACPI_FLUSH_CPU_CACHE();
......@@ -202,15 +195,13 @@ acpi_system_save_state(
if (!error && (state == ACPI_STATE_S4))
error = acpi_save_state_disk();
#ifdef HAVE_NEW_DEVICE_MODEL
if (error) {
device_resume(RESUME_RESTORE_STATE);
return error;
}
#endif
}
}
#ifdef HAVE_NEW_DEVICE_MODEL
/* disable interrupts
* Note that acpi_suspend -- our caller -- will do this once we return.
* But, we want it done early, so we don't get any suprises during
......@@ -233,7 +224,7 @@ acpi_system_save_state(
*/
if (error && state != ACPI_STATE_S5)
acpi_system_restore_state(state);
#endif
return error ? AE_ERROR : AE_OK;
}
......@@ -515,12 +506,12 @@ acpi_system_read_dsdt (
if (size > count)
size = count;
if (copy_to_user(buffer, data, size)) {
kfree(dsdt.pointer);
acpi_os_free(dsdt.pointer);
return_VALUE(-EFAULT);
}
}
kfree(dsdt.pointer);
acpi_os_free(dsdt.pointer);
*ppos += size;
......@@ -558,12 +549,12 @@ acpi_system_read_fadt (
if (size > count)
size = count;
if (copy_to_user(buffer, data, size)) {
kfree(fadt.pointer);
acpi_os_free(fadt.pointer);
return_VALUE(-EFAULT);
}
}
kfree(fadt.pointer);
acpi_os_free(fadt.pointer);
*ppos += size;
......
/******************************************************************************
*
* Module Name: tbconvrt - ACPI Table conversion utilities
* $Revision: 41 $
* $Revision: 42 $
*
*****************************************************************************/
......@@ -90,8 +90,7 @@ acpi_tb_get_table_count (
acpi_status
acpi_tb_convert_to_xsdt (
acpi_table_desc *table_info,
u32 *number_of_tables)
acpi_table_desc *table_info)
{
ACPI_SIZE table_size;
u32 i;
......@@ -101,13 +100,10 @@ acpi_tb_convert_to_xsdt (
ACPI_FUNCTION_ENTRY ();
/* Get the number of tables defined in the RSDT or XSDT */
*number_of_tables = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info->pointer);
/* Compute size of the converted XSDT */
table_size = ((ACPI_SIZE) *number_of_tables * sizeof (u64)) + sizeof (acpi_table_header);
table_size = ((ACPI_SIZE) acpi_gbl_rsdt_table_count * sizeof (u64)) +
sizeof (acpi_table_header);
/* Allocate an XSDT */
......@@ -123,7 +119,7 @@ acpi_tb_convert_to_xsdt (
/* Copy the table pointers */
for (i = 0; i < *number_of_tables; i++) {
for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
if (acpi_gbl_RSDP->revision < 2) {
ACPI_STORE_ADDRESS (new_table->table_offset_entry[i],
((RSDT_DESCRIPTOR_REV1 *) table_info->pointer)->table_offset_entry[i]);
......
This diff is collapsed.
/******************************************************************************
*
* Module Name: tbgetall - Get all required ACPI tables
* $Revision: 1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2002, R. Byron Moore
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "acpi.h"
#include "actables.h"
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbgetall")
/*******************************************************************************
*
* FUNCTION: Acpi_tb_get_primary_table
*
* PARAMETERS: Address - Physical address of table to retrieve
* *Table_info - Where the table info is returned
*
* RETURN: Status
*
* DESCRIPTION: Maps the physical address of table into a logical address
*
******************************************************************************/
acpi_status
acpi_tb_get_primary_table (
ACPI_POINTER *address,
acpi_table_desc *table_info)
{
acpi_status status;
acpi_table_header header;
ACPI_FUNCTION_TRACE ("Tb_get_primary_table");
/* Ignore a NULL address in the RSDT */
if (!address->pointer.value) {
return_ACPI_STATUS (AE_OK);
}
/*
* Get the header in order to get signature and table size
*/
status = acpi_tb_get_table_header (address, &header);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Clear the Table_info */
ACPI_MEMSET (table_info, 0, sizeof (acpi_table_desc));
/*
* Check the table signature and make sure it is recognized.
* Also checks the header checksum
*/
table_info->pointer = &header;
status = acpi_tb_recognize_table (table_info, ACPI_TABLE_PRIMARY);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Get the entire table */
status = acpi_tb_get_table_body (address, &header, table_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Install the table */
status = acpi_tb_install_table (table_info);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_tb_get_secondary_table
*
* PARAMETERS: Address - Physical address of table to retrieve
* *Table_info - Where the table info is returned
*
* RETURN: Status
*
* DESCRIPTION: Maps the physical address of table into a logical address
*
******************************************************************************/
acpi_status
acpi_tb_get_secondary_table (
ACPI_POINTER *address,
acpi_string signature,
acpi_table_desc *table_info)
{
acpi_status status;
acpi_table_header header;
ACPI_FUNCTION_TRACE_STR ("Tb_get_secondary_table", signature);
/* Get the header in order to match the signature */
status = acpi_tb_get_table_header (address, &header);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Signature must match request */
if (ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) {
ACPI_REPORT_ERROR (("Incorrect table signature - wanted [%s] found [%4.4s]\n",
signature, header.signature));
return_ACPI_STATUS (AE_BAD_SIGNATURE);
}
/*
* Check the table signature and make sure it is recognized.
* Also checks the header checksum
*/
table_info->pointer = &header;
status = acpi_tb_recognize_table (table_info, ACPI_TABLE_SECONDARY);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Get the entire table */
status = acpi_tb_get_table_body (address, &header, table_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Install the table */
status = acpi_tb_install_table (table_info);
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_tb_get_required_tables
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Load and validate tables other than the RSDT. The RSDT must
* already be loaded and validated.
*
* Get the minimum set of ACPI tables, namely:
*
* 1) FADT (via RSDT in loop below)
* 2) FACS (via FADT)
* 3) DSDT (via FADT)
*
******************************************************************************/
acpi_status
acpi_tb_get_required_tables (
void)
{
acpi_status status = AE_OK;
u32 i;
acpi_table_desc table_info;
ACPI_POINTER address;
ACPI_FUNCTION_TRACE ("Tb_get_required_tables");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%d ACPI tables in RSDT\n",
acpi_gbl_rsdt_table_count));
address.pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING;
/*
* Loop through all table pointers found in RSDT.
* This will NOT include the FACS and DSDT - we must get
* them after the loop.
*
* The only tables we are interested in getting here is the FADT and
* any SSDTs.
*/
for (i = 0; i < acpi_gbl_rsdt_table_count; i++) {
/* Get the table addresss from the common internal XSDT */
address.pointer.value = ACPI_GET_ADDRESS (acpi_gbl_XSDT->table_offset_entry[i]);
/*
* Get the tables needed by this subsystem (FADT and any SSDTs).
* NOTE: All other tables are completely ignored at this time.
*/
acpi_tb_get_primary_table (&address, &table_info);
}
/* We must have a FADT to continue */
if (!acpi_gbl_FADT) {
ACPI_REPORT_ERROR (("No FADT present in RSDT/XSDT\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
/*
* Convert the FADT to a common format. This allows earlier revisions of the
* table to coexist with newer versions, using common access code.
*/
status = acpi_tb_convert_table_fadt ();
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not convert FADT to internal common format\n"));
return_ACPI_STATUS (status);
}
/*
* Get the FACS (Pointed to by the FADT)
*/
address.pointer.value = ACPI_GET_ADDRESS (acpi_gbl_FADT->Xfirmware_ctrl);
status = acpi_tb_get_secondary_table (&address, FACS_SIG, &table_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not get/install the FACS, %s\n",
acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
/*
* Create the common FACS pointer table
* (Contains pointers to the original table)
*/
status = acpi_tb_build_common_facs (&table_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/*
* Get/install the DSDT (Pointed to by the FADT)
*/
address.pointer.value = ACPI_GET_ADDRESS (acpi_gbl_FADT->Xdsdt);
status = acpi_tb_get_secondary_table (&address, DSDT_SIG, &table_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not get/install the DSDT\n"));
return_ACPI_STATUS (status);
}
/* Set Integer Width (32/64) based upon DSDT revision */
acpi_ut_set_integer_width (acpi_gbl_DSDT->revision);
/* Dump the entire DSDT */
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
"Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n",
acpi_gbl_DSDT->length, acpi_gbl_DSDT->length, acpi_gbl_integer_bit_width));
ACPI_DUMP_BUFFER ((u8 *) acpi_gbl_DSDT, acpi_gbl_DSDT->length);
/* Always delete the RSDP mapping, we are done with it */
acpi_tb_delete_acpi_table (ACPI_TABLE_RSDP);
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
* $Revision: 61 $
* $Revision: 62 $
*
*****************************************************************************/
......@@ -49,7 +49,8 @@
acpi_status
acpi_tb_match_signature (
NATIVE_CHAR *signature,
acpi_table_desc *table_info)
acpi_table_desc *table_info,
u8 search_type)
{
NATIVE_UINT i;
......@@ -61,6 +62,10 @@ acpi_tb_match_signature (
* Search for a signature match among the known table types
*/
for (i = 0; i < NUM_ACPI_TABLES; i++) {
if ((acpi_gbl_acpi_table_data[i].flags & ACPI_TABLE_TYPE_MASK) != search_type) {
continue;
}
if (!ACPI_STRNCMP (signature, acpi_gbl_acpi_table_data[i].signature,
acpi_gbl_acpi_table_data[i].sig_length)) {
/* Found a signature match, return index if requested */
......@@ -69,13 +74,18 @@ acpi_tb_match_signature (
table_info->type = (u8) i;
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Signature match %4.4s\n",
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Table [%4.4s] matched and is a required ACPI table\n",
(char *) acpi_gbl_acpi_table_data[i].signature));
return_ACPI_STATUS (AE_OK);
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Table [%4.4s] is not a required ACPI table - ignored\n",
(char *) signature));
return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED);
}
......@@ -84,7 +94,7 @@ acpi_tb_match_signature (
*
* FUNCTION: Acpi_tb_install_table
*
* PARAMETERS: Table_info - Return value from Acpi_tb_get_table
* PARAMETERS: Table_info - Return value from Acpi_tb_get_table_body
*
* RETURN: Status
*
......@@ -103,25 +113,22 @@ acpi_tb_install_table (
ACPI_FUNCTION_TRACE ("Tb_install_table");
/*
* Check the table signature and make sure it is recognized
* Also checks the header checksum
*/
status = acpi_tb_recognize_table (table_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Lock tables while installing */
status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n",
table_info->pointer->signature, acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
/* Install the table into the global data structure */
status = acpi_tb_init_table_descriptor (table_info->type, table_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not install ACPI table [%s], %s\n",
table_info->pointer->signature, acpi_format_exception (status)));
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
acpi_gbl_acpi_table_data[table_info->type].name, table_info->pointer));
......@@ -135,7 +142,7 @@ acpi_tb_install_table (
*
* FUNCTION: Acpi_tb_recognize_table
*
* PARAMETERS: Table_info - Return value from Acpi_tb_get_table
* PARAMETERS: Table_info - Return value from Acpi_tb_get_table_body
*
* RETURN: Status
*
......@@ -153,7 +160,8 @@ acpi_tb_install_table (
acpi_status
acpi_tb_recognize_table (
acpi_table_desc *table_info)
acpi_table_desc *table_info,
u8 search_type)
{
acpi_table_header *table_header;
acpi_status status;
......@@ -177,7 +185,7 @@ acpi_tb_recognize_table (
* This can be any one of many valid ACPI tables, it just isn't one of
* the tables that is consumed by the core subsystem
*/
status = acpi_tb_match_signature (table_header->signature, table_info);
status = acpi_tb_match_signature (table_header->signature, table_info, search_type);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......@@ -191,22 +199,6 @@ acpi_tb_recognize_table (
table_info->length = (ACPI_SIZE) table_header->length;
/*
* Validate checksum for _most_ tables,
* even the ones whose signature we don't recognize
*/
if (table_info->type != ACPI_TABLE_FACS) {
status = acpi_tb_verify_table_checksum (table_header);
#if (!ACPI_CHECKSUM_ABORT)
if (ACPI_FAILURE (status)) {
/* Ignore the error if configuration says so */
status = AE_OK;
}
#endif
}
return_ACPI_STATUS (status);
}
......
/******************************************************************************
*
* Module Name: tbrsdt - ACPI RSDT table utilities
* $Revision: 1 $
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2002, R. Byron Moore
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "acpi.h"
#include "actables.h"
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbrsdt")
/*******************************************************************************
*
* FUNCTION: Acpi_tb_verify_rsdp
*
* PARAMETERS: Address - RSDP (Pointer to RSDT)
*
* RETURN: Status
*
* DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table)
*
******************************************************************************/
acpi_status
acpi_tb_verify_rsdp (
ACPI_POINTER *address)
{
acpi_table_desc table_info;
acpi_status status;
RSDP_DESCRIPTOR *rsdp;
ACPI_FUNCTION_TRACE ("Tb_verify_rsdp");
switch (address->pointer_type) {
case ACPI_LOGICAL_POINTER:
rsdp = address->pointer.logical;
break;
case ACPI_PHYSICAL_POINTER:
/*
* Obtain access to the RSDP structure
*/
status = acpi_os_map_memory (address->pointer.physical, sizeof (RSDP_DESCRIPTOR),
(void **) &rsdp);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/*
* The signature and checksum must both be correct
*/
if (ACPI_STRNCMP ((NATIVE_CHAR *) rsdp, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
/* Nope, BAD Signature */
status = AE_BAD_SIGNATURE;
goto cleanup;
}
/* Check the standard checksum */
if (acpi_tb_checksum (rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
status = AE_BAD_CHECKSUM;
goto cleanup;
}
/* Check extended checksum if table version >= 2 */
if (rsdp->revision >= 2) {
if (acpi_tb_checksum (rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0) {
status = AE_BAD_CHECKSUM;
goto cleanup;
}
}
/* The RSDP supplied is OK */
table_info.pointer = ACPI_CAST_PTR (acpi_table_header, rsdp);
table_info.length = sizeof (RSDP_DESCRIPTOR);
table_info.allocation = ACPI_MEM_MAPPED;
table_info.base_pointer = rsdp;
/* Save the table pointers and allocation info */
status = acpi_tb_init_table_descriptor (ACPI_TABLE_RSDP, &table_info);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
/* Save the RSDP in a global for easy access */
acpi_gbl_RSDP = ACPI_CAST_PTR (RSDP_DESCRIPTOR, table_info.pointer);
return_ACPI_STATUS (status);
/* Error exit */
cleanup:
if (acpi_gbl_table_flags & ACPI_PHYSICAL_POINTER) {
acpi_os_unmap_memory (rsdp, sizeof (RSDP_DESCRIPTOR));
}
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_tb_get_rsdt_address
*
* PARAMETERS: None
*
* RETURN: RSDT physical address
*
* DESCRIPTION: Extract the address of the RSDT or XSDT, depending on the
* version of the RSDP
*
******************************************************************************/
void
acpi_tb_get_rsdt_address (
ACPI_POINTER *out_address)
{
ACPI_FUNCTION_ENTRY ();
out_address->pointer_type = acpi_gbl_table_flags | ACPI_LOGICAL_ADDRESSING;
/*
* For RSDP revision 0 or 1, we use the RSDT.
* For RSDP revision 2 (and above), we use the XSDT
*/
if (acpi_gbl_RSDP->revision < 2) {
out_address->pointer.value = acpi_gbl_RSDP->rsdt_physical_address;
}
else {
out_address->pointer.value = ACPI_GET_ADDRESS (acpi_gbl_RSDP->xsdt_physical_address);
}
}
/*******************************************************************************
*
* FUNCTION: Acpi_tb_validate_rsdt
*
* PARAMETERS: Table_ptr - Addressable pointer to the RSDT.
*
* RETURN: Status
*
* DESCRIPTION: Validate signature for the RSDT or XSDT
*
******************************************************************************/
acpi_status
acpi_tb_validate_rsdt (
acpi_table_header *table_ptr)
{
int no_match;
ACPI_FUNCTION_NAME ("Tb_validate_rsdt");
/*
* For RSDP revision 0 or 1, we use the RSDT.
* For RSDP revision 2 and above, we use the XSDT
*/
if (acpi_gbl_RSDP->revision < 2) {
no_match = ACPI_STRNCMP ((char *) table_ptr, RSDT_SIG,
sizeof (RSDT_SIG) -1);
}
else {
no_match = ACPI_STRNCMP ((char *) table_ptr, XSDT_SIG,
sizeof (XSDT_SIG) -1);
}
if (no_match) {
/* Invalid RSDT or XSDT signature */
ACPI_REPORT_ERROR (("Invalid signature where RSDP indicates RSDT/XSDT should be located\n"));
ACPI_DUMP_BUFFER (acpi_gbl_RSDP, 20);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR,
"RSDT/XSDT signature at %X (%p) is invalid\n",
acpi_gbl_RSDP->rsdt_physical_address,
(void *) (NATIVE_UINT) acpi_gbl_RSDP->rsdt_physical_address));
return (AE_BAD_SIGNATURE);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: Acpi_tb_get_table_rsdt
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Load and validate the RSDP (ptr) and RSDT (table)
*
******************************************************************************/
acpi_status
acpi_tb_get_table_rsdt (
void)
{
acpi_table_desc table_info;
acpi_status status;
ACPI_POINTER address;
ACPI_FUNCTION_TRACE ("Tb_get_table_rsdt");
/* Get the RSDT/XSDT via the RSDP */
acpi_tb_get_rsdt_address (&address);
status = acpi_tb_get_table (&address, &table_info);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT/XSDT, %s\n",
acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"RSDP located at %p, points to RSDT physical=%8.8X%8.8X \n",
acpi_gbl_RSDP,
ACPI_HIDWORD (address.pointer.value),
ACPI_LODWORD (address.pointer.value)));
/* Check the RSDT or XSDT signature */
status = acpi_tb_validate_rsdt (table_info.pointer);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/*
* Valid RSDT signature, verify the checksum. If it fails, just
* print a warning and ignore it.
*/
status = acpi_tb_verify_table_checksum (table_info.pointer);
/* Get the number of tables defined in the RSDT or XSDT */
acpi_gbl_rsdt_table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, table_info.pointer);
/* Convert and/or copy to an XSDT structure */
status = acpi_tb_convert_to_xsdt (&table_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/* Save the table pointers and allocation info */
status = acpi_tb_init_table_descriptor (ACPI_TABLE_XSDT, &table_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
acpi_gbl_XSDT = (xsdt_descriptor *) table_info.pointer;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "XSDT located at %p\n", acpi_gbl_XSDT));
return_ACPI_STATUS (status);
}
/******************************************************************************
*
* Module Name: tbutils - Table manipulation utilities
* $Revision: 54 $
* $Revision: 55 $
*
*****************************************************************************/
......@@ -121,7 +121,8 @@ acpi_tb_validate_table_header (
"Table signature at %p [%p] has invalid characters\n",
table_header, &signature));
ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", (char *) &signature));
ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n",
(char *) &signature));
ACPI_DUMP_BUFFER (table_header, sizeof (acpi_table_header));
return (AE_BAD_SIGNATURE);
}
......@@ -133,7 +134,8 @@ acpi_tb_validate_table_header (
"Invalid length in table header %p name %4.4s\n",
table_header, (char *) &signature));
ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", table_header->length));
ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n",
table_header->length));
ACPI_DUMP_BUFFER (table_header, sizeof (acpi_table_header));
return (AE_BAD_HEADER);
}
......@@ -142,91 +144,6 @@ acpi_tb_validate_table_header (
}
/*******************************************************************************
*
* FUNCTION: Acpi_tb_map_acpi_table
*
* PARAMETERS: Physical_address - Physical address of table to map
* *Size - Size of the table. If zero, the size
* from the table header is used.
* Actual size is returned here.
* **Logical_address - Logical address of mapped table
*
* RETURN: Logical address of the mapped table.
*
* DESCRIPTION: Maps the physical address of table into a logical address
*
******************************************************************************/
acpi_status
acpi_tb_map_acpi_table (
ACPI_PHYSICAL_ADDRESS physical_address,
ACPI_SIZE *size,
acpi_table_header **logical_address)
{
acpi_table_header *table;
ACPI_SIZE table_size = *size;
acpi_status status = AE_OK;
ACPI_FUNCTION_NAME ("Tb_map_acpi_table");
/* If size is zero, look at the table header to get the actual size */
if ((*size) == 0) {
/* Get the table header so we can extract the table length */
status = acpi_os_map_memory (physical_address, sizeof (acpi_table_header),
(void **) &table);
if (ACPI_FAILURE (status)) {
return (status);
}
/* Extract the full table length before we delete the mapping */
table_size = (ACPI_SIZE) table->length;
#if 0
/* We don't want to validate the header here. */
/*
* Validate the header and delete the mapping.
* We will create a mapping for the full table below.
*/
status = acpi_tb_validate_table_header (table);
#endif
/* Always unmap the memory for the header */
acpi_os_unmap_memory (table, sizeof (acpi_table_header));
#if 0
/* Exit if header invalid */
if (ACPI_FAILURE (status)) {
return (status);
}
#endif
}
/* Map the physical memory for the correct length */
status = acpi_os_map_memory (physical_address, table_size,
(void **) &table);
if (ACPI_FAILURE (status)) {
return (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Mapped memory for ACPI table, length=%d(%X) at %p\n",
table_size, table_size, table));
*size = table_size;
*logical_address = table;
return (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_tb_verify_table_checksum
......
......@@ -2,7 +2,7 @@
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
* $Revision: 57 $
* $Revision: 58 $
*
*****************************************************************************/
......@@ -52,7 +52,6 @@ acpi_load_tables (void)
{
ACPI_POINTER rsdp_address;
acpi_status status;
u32 number_of_tables = 0;
ACPI_FUNCTION_TRACE ("Acpi_load_tables");
......@@ -81,16 +80,16 @@ acpi_load_tables (void)
/* Get the RSDT via the RSDP */
status = acpi_tb_get_table_rsdt (&number_of_tables);
status = acpi_tb_get_table_rsdt ();
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_load_tables: Could not load RSDT: %s\n",
acpi_format_exception (status)));
goto error_exit;
}
/* Now get the rest of the tables */
/* Now get the tables needed by this subsystem (FADT, DSDT, etc.) */
status = acpi_tb_get_all_tables (number_of_tables);
status = acpi_tb_get_required_tables ();
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_load_tables: Error getting required tables (DSDT/FADT/FACS): %s\n",
acpi_format_exception (status)));
......@@ -154,10 +153,10 @@ acpi_load_table (
/* Copy the table to a local buffer */
address.pointer_type = ACPI_LOGICAL_POINTER;
address.pointer_type = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
address.pointer.logical = table_ptr;
status = acpi_tb_get_table (&address, &table_info);
status = acpi_tb_get_table_body (&address, table_ptr, &table_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......@@ -166,7 +165,7 @@ acpi_load_table (
status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
/* Free table allocated by Acpi_tb_get_table */
/* Free table allocated by Acpi_tb_get_table_body */
acpi_tb_delete_single_table (&table_info);
return_ACPI_STATUS (status);
......
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
* $Revision: 63 $
* $Revision: 64 $
*
*****************************************************************************/
......@@ -63,9 +63,9 @@ acpi_tb_find_table (
/* Validate string lengths */
if ((ACPI_STRLEN (signature) > 4) ||
(ACPI_STRLEN (oem_id) > 6) ||
(ACPI_STRLEN (oem_table_id) > 8)) {
if ((ACPI_STRLEN (signature) > ACPI_NAME_SIZE) ||
(ACPI_STRLEN (oem_id) > sizeof (table->oem_id)) ||
(ACPI_STRLEN (oem_table_id) > sizeof (table->oem_table_id))) {
return_ACPI_STATUS (AE_AML_STRING_LIMIT);
}
......@@ -96,7 +96,7 @@ acpi_tb_find_table (
* PARAMETERS: Signature - Any ACPI table signature
* Instance - the non zero instance of the table, allows
* support for multiple tables of the same type
* Flags - 0: Physical/Virtual support
* Flags - Physical/Virtual support
* Ret_buffer - pointer to a structure containing a buffer to
* receive the table
*
......@@ -120,11 +120,10 @@ acpi_get_firmware_table (
{
ACPI_POINTER rsdp_address;
ACPI_POINTER address;
acpi_table_header *rsdt_ptr = NULL;
acpi_table_header *table_ptr;
acpi_status status;
ACPI_SIZE rsdt_size = 0;
ACPI_SIZE table_size;
acpi_table_header header;
acpi_table_desc table_info;
acpi_table_desc rsdt_info;
u32 table_count;
u32 i;
u32 j;
......@@ -147,6 +146,8 @@ acpi_get_firmware_table (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
rsdt_info.pointer = NULL;
if (!acpi_gbl_RSDP) {
/* Get the RSDP */
......@@ -175,15 +176,13 @@ acpi_get_firmware_table (
if (ACPI_STRNCMP ((NATIVE_CHAR *) acpi_gbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0) {
/* Nope, BAD Signature */
status = AE_BAD_SIGNATURE;
goto cleanup;
return_ACPI_STATUS (AE_BAD_SIGNATURE);
}
if (acpi_tb_checksum (acpi_gbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0) {
/* Nope, BAD Checksum */
status = AE_BAD_CHECKSUM;
goto cleanup;
return_ACPI_STATUS (AE_BAD_CHECKSUM);
}
}
......@@ -197,63 +196,65 @@ acpi_get_firmware_table (
ACPI_HIDWORD (address.pointer.value),
ACPI_LODWORD (address.pointer.value)));
status = acpi_tb_get_table_pointer (&address, flags, &rsdt_size, &rsdt_ptr);
/* Insert Processor_mode flags */
address.pointer_type |= flags;
status = acpi_tb_get_table (&address, &rsdt_info);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_tb_validate_rsdt (rsdt_ptr);
status = acpi_tb_validate_rsdt (rsdt_info.pointer);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
/* Get the number of table pointers within the RSDT */
table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, rsdt_ptr);
table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, rsdt_info.pointer);
address.pointer_type = acpi_gbl_table_flags | flags;
/*
* Search the RSDT/XSDT for the correct instance of the
* requested table
*/
for (i = 0, j = 0; i < table_count; i++) {
/* Get the next table pointer */
/* Get the next table pointer, handle RSDT vs. XSDT */
address.pointer_type = acpi_gbl_table_flags;
if (acpi_gbl_RSDP->revision < 2) {
address.pointer.value = ((RSDT_DESCRIPTOR *) rsdt_ptr)->table_offset_entry[i];
address.pointer.value = ((RSDT_DESCRIPTOR *) rsdt_info.pointer)->table_offset_entry[i];
}
else {
address.pointer.value = ACPI_GET_ADDRESS (
((xsdt_descriptor *) rsdt_ptr)->table_offset_entry[i]);
((xsdt_descriptor *) rsdt_info.pointer)->table_offset_entry[i]);
}
/* Get addressibility if necessary */
/* Get the table header */
status = acpi_tb_get_table_pointer (&address, flags, &table_size, &table_ptr);
status = acpi_tb_get_table_header (&address, &header);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
/* Compare table signatures and table instance */
if (!ACPI_STRNCMP ((char *) table_ptr, signature, ACPI_STRLEN (signature))) {
if (!ACPI_STRNCMP (header.signature, signature, ACPI_NAME_SIZE)) {
/* An instance of the table was found */
j++;
if (j >= instance) {
/* Found the correct instance */
/* Found the correct instance, get the entire table */
*table_pointer = table_ptr;
status = acpi_tb_get_table_body (&address, &header, &table_info);
if (ACPI_FAILURE (status)) {
goto cleanup;
}
}
/* Delete table mapping if using virtual addressing */
if ((table_size) &&
((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)) {
acpi_os_unmap_memory (table_ptr, table_size);
*table_pointer = table_info.pointer;
goto cleanup;
}
}
}
......@@ -263,9 +264,7 @@ acpi_get_firmware_table (
cleanup:
if (rsdt_size) {
acpi_os_unmap_memory (rsdt_ptr, rsdt_size);
}
acpi_os_unmap_memory (rsdt_info.pointer, (ACPI_SIZE) rsdt_info.pointer->length);
return_ACPI_STATUS (status);
}
......
/*
* acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 39 $)
* acpi_thermal.c - ACPI Thermal Zone Driver ($Revision: 40 $)
*
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
......@@ -231,7 +231,7 @@ acpi_thermal_set_cooling_mode (
arg0.integer.value = mode;
status = acpi_evaluate(handle, NULL, &arg_list, NULL);
status = acpi_evaluate_object(handle, NULL, &arg_list, NULL);
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
......
This diff is collapsed.
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
* $Revision: 101 $
* $Revision: 103 $
*
*****************************************************************************/
......@@ -286,19 +286,21 @@ acpi_ut_copy_ipackage_to_epackage (
/*
* Free space begins right after the first package
*/
info.length = 0;
info.length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
info.object_space = 0;
info.num_packages = 1;
info.free_space = buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
external_object->type = ACPI_GET_OBJECT_TYPE (internal_object);
external_object->package.count = internal_object->package.count;
external_object->package.elements = ACPI_CAST_PTR (acpi_object, info.free_space);
/*
* Build an array of ACPI_OBJECTS in the buffer
* Leave room for an array of ACPI_OBJECTS in the buffer
* and move the free space past it
*/
info.length += (ACPI_SIZE) external_object->package.count *
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
info.free_space += external_object->package.count *
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (acpi_object));
......@@ -517,7 +519,6 @@ acpi_ut_copy_epackage_to_ipackage (
external_object->package.count = internal_object->package.count;
external_object->package.elements = (acpi_object *)free_space;
/*
* Build an array of ACPI_OBJECTS in the buffer
* and move the free space past it
......
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
* $Revision: 163 $
* $Revision: 164 $
*
*****************************************************************************/
......@@ -286,15 +286,15 @@ acpi_table_desc acpi_gbl_acpi_tables[NUM_ACPI_TABLES];
ACPI_TABLE_SUPPORT acpi_gbl_acpi_table_data[NUM_ACPI_TABLES] =
{
/*********** Name, Signature, Global typed pointer Signature size, How many allowed?, Contains valid AML? */
/* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE},
/* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void **) &acpi_gbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE},
/* FADT 2 */ {FADT_SIG, FADT_SIG, (void **) &acpi_gbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE},
/* FACS 3 */ {FACS_SIG, FACS_SIG, (void **) &acpi_gbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE},
/* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
/* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
/* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE},
/*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
/* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
/* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void **) &acpi_gbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE},
/* FADT 2 */ {FADT_SIG, FADT_SIG, (void **) &acpi_gbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE},
/* FACS 3 */ {FACS_SIG, FACS_SIG, (void **) &acpi_gbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE},
/* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
/* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
/* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
};
......
/******************************************************************************
*
* Module Name: utxface - External interfaces for "global" ACPI functions
* $Revision: 96 $
* $Revision: 97 $
*
*****************************************************************************/
......@@ -192,6 +192,31 @@ acpi_enable_subsystem (
}
}
return_ACPI_STATUS (status);
}
/*******************************************************************************
*
* FUNCTION: Acpi_initialize_objects
*
* PARAMETERS: Flags - Init/enable Options
*
* RETURN: Status
*
* DESCRIPTION: Completes namespace initialization by initializing device
* objects and executing AML code for Regions, buffers, etc.
*
******************************************************************************/
acpi_status
acpi_initialize_objects (
u32 flags)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE ("Acpi_initialize_objects");
/*
* Initialize all device objects in the namespace
* This runs the _STA and _INI methods.
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment