Commit 8270dc79 authored by Andy Grover's avatar Andy Grover

Merge groveronline.com:/root/bk/linux-2.5

into groveronline.com:/root/bk/linux-acpi
parents 8c339122 5329365a
......@@ -159,12 +159,6 @@ acpi_ac_add_fs (
ACPI_FUNCTION_TRACE("acpi_ac_add_fs");
if (!acpi_ac_dir) {
acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
if (!acpi_ac_dir)
return_VALUE(-ENODEV);
}
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_ac_dir);
......@@ -194,9 +188,6 @@ acpi_ac_remove_fs (
{
ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
if (!acpi_ac_dir)
return_VALUE(-ENODEV);
if (acpi_device_dir(device))
remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
......@@ -330,6 +321,10 @@ acpi_ac_init (void)
ACPI_FUNCTION_TRACE("acpi_ac_init");
acpi_ac_dir = proc_mkdir(ACPI_AC_CLASS, acpi_root_dir);
if (!acpi_ac_dir)
return_VALUE(-ENODEV);
result = acpi_bus_register_driver(&acpi_ac_driver);
if (result < 0) {
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
......@@ -343,12 +338,10 @@ acpi_ac_init (void)
void __exit
acpi_ac_exit (void)
{
int result = 0;
ACPI_FUNCTION_TRACE("acpi_ac_exit");
result = acpi_bus_unregister_driver(&acpi_ac_driver);
if (!result)
acpi_bus_unregister_driver(&acpi_ac_driver);
remove_proc_entry(ACPI_AC_CLASS, acpi_root_dir);
return_VOID;
......
......@@ -615,12 +615,6 @@ acpi_battery_add_fs (
ACPI_FUNCTION_TRACE("acpi_battery_add_fs");
if (!acpi_battery_dir) {
acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
if (!acpi_battery_dir)
return_VALUE(-ENODEV);
}
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_battery_dir);
......@@ -675,9 +669,6 @@ acpi_battery_remove_fs (
{
ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
if (!acpi_battery_dir)
return_VALUE(-ENODEV);
if (acpi_device_dir(device))
remove_proc_entry(acpi_device_bid(device), acpi_battery_dir);
......@@ -812,6 +803,10 @@ acpi_battery_init (void)
ACPI_FUNCTION_TRACE("acpi_battery_init");
acpi_battery_dir = proc_mkdir(ACPI_BATTERY_CLASS, acpi_root_dir);
if (!acpi_battery_dir)
return_VALUE(-ENODEV);
result = acpi_bus_register_driver(&acpi_battery_driver);
if (result < 0) {
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
......@@ -825,12 +820,10 @@ acpi_battery_init (void)
static void __exit
acpi_battery_exit (void)
{
int result = 0;
ACPI_FUNCTION_TRACE("acpi_battery_exit");
result = acpi_bus_unregister_driver(&acpi_battery_driver);
if (!result)
acpi_bus_unregister_driver(&acpi_battery_driver);
remove_proc_entry(ACPI_BATTERY_CLASS, acpi_root_dir);
return_VOID;
......
......@@ -27,6 +27,7 @@
#include <linux/list.h>
#include <linux/sched.h>
#include <linux/pm.h>
#include <linux/device.h>
#include <linux/proc_fs.h>
#ifdef CONFIG_X86
#include <asm/mpspec.h>
......
......@@ -141,12 +141,6 @@ acpi_button_add_fs (
button = acpi_driver_data(device);
if (!acpi_button_dir) {
acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
if (!acpi_button_dir)
return_VALUE(-ENODEV);
}
switch (button->type) {
case ACPI_BUTTON_TYPE_POWER:
case ACPI_BUTTON_TYPE_POWERF:
......@@ -190,9 +184,6 @@ acpi_button_remove_fs (
{
ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
if (!acpi_button_dir)
return_VALUE(-ENODEV);
if (acpi_device_dir(device))
remove_proc_entry(acpi_device_bid(device), acpi_button_dir);
......@@ -446,9 +437,15 @@ acpi_button_init (void)
ACPI_FUNCTION_TRACE("acpi_button_init");
acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
if (!acpi_button_dir)
return_VALUE(-ENODEV);
result = acpi_bus_register_driver(&acpi_button_driver);
if (result < 0)
if (result < 0) {
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VALUE(-ENODEV);
}
return_VALUE(0);
}
......@@ -461,6 +458,8 @@ acpi_button_exit (void)
acpi_bus_unregister_driver(&acpi_button_driver);
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VOID;
}
......
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
* $Revision: 88 $
* $Revision: 89 $
*
*****************************************************************************/
......@@ -216,7 +216,7 @@ acpi_ds_begin_method_execution (
* interpreter if we block
*/
status = acpi_ex_system_wait_semaphore (obj_desc->method.semaphore,
WAIT_FOREVER);
ACPI_WAIT_FOREVER);
}
/*
......
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
* $Revision: 69 $
* $Revision: 70 $
*
*****************************************************************************/
......@@ -345,7 +345,7 @@ acpi_ds_result_push (
*
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Push an object onto the Walk_state result stack.
*
******************************************************************************/
......@@ -381,7 +381,7 @@ acpi_ds_result_stack_push (
*
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Pop an object off of the Walk_state result stack.
*
******************************************************************************/
......
......@@ -477,12 +477,6 @@ acpi_ec_add_fs (
ACPI_FUNCTION_TRACE("acpi_ec_add_fs");
if (!acpi_ec_dir) {
acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir);
if (!acpi_ec_dir)
return_VALUE(-ENODEV);
}
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_ec_dir);
......@@ -508,12 +502,6 @@ acpi_ec_remove_fs (
{
ACPI_FUNCTION_TRACE("acpi_ec_remove_fs");
if (!acpi_ec_dir)
return_VALUE(-ENODEV);
if (acpi_device_dir(device))
remove_proc_entry(acpi_device_bid(device), acpi_ec_dir);
return_VALUE(0);
}
......@@ -789,13 +777,24 @@ static int __init acpi_ec_init (void)
if (acpi_disabled)
return_VALUE(0);
acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir);
if (!acpi_ec_dir)
return_VALUE(-ENODEV);
/* Now register the driver for the EC */
result = acpi_bus_register_driver(&acpi_ec_driver);
if (result < 0) {
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
return_VALUE(-ENODEV);
}
return_VALUE(result);
}
subsys_initcall(acpi_ec_init);
/* EC driver currently not unloadable */
#if 0
static void __exit
acpi_ec_ecdt_exit (void)
{
......@@ -813,17 +812,15 @@ acpi_ec_ecdt_exit (void)
static void __exit
acpi_ec_exit (void)
{
int result = 0;
ACPI_FUNCTION_TRACE("acpi_ec_exit");
result = acpi_bus_unregister_driver(&acpi_ec_driver);
if (!result)
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
acpi_bus_unregister_driver(&acpi_ec_driver);
remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
acpi_ec_ecdt_exit();
return_VOID;
}
#endif /* 0 */
/******************************************************************************
*
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch
* $Revision: 95 $
* $Revision: 96 $
*
*****************************************************************************/
......@@ -503,9 +503,9 @@ acpi_ev_gpe_initialize (void)
ACPI_REPORT_INFO (("GPE Block%d defined as GPE%d to GPE%d\n",
(s32) gpe_block,
acpi_gbl_gpe_block_info[gpe_block].block_base_number,
acpi_gbl_gpe_block_info[gpe_block].block_base_number +
((acpi_gbl_gpe_block_info[gpe_block].register_count * 8) -1)));
(u32) acpi_gbl_gpe_block_info[gpe_block].block_base_number,
(u32) (acpi_gbl_gpe_block_info[gpe_block].block_base_number +
((acpi_gbl_gpe_block_info[gpe_block].register_count * 8) -1))));
}
}
......
/******************************************************************************
*
* Module Name: evmisc - Miscellaneous event manager support functions
* $Revision: 57 $
* $Revision: 58 $
*
*****************************************************************************/
......@@ -433,7 +433,7 @@ acpi_ev_init_global_lock_handler (void)
acpi_status
acpi_ev_acquire_global_lock (
u32 timeout)
u16 timeout)
{
acpi_status status = AE_OK;
u8 acquired = FALSE;
......
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
* $Revision: 131 $
* $Revision: 132 $
*
*****************************************************************************/
......@@ -612,7 +612,7 @@ acpi_remove_gpe_handler (
acpi_status
acpi_acquire_global_lock (
u32 timeout,
u16 timeout,
u32 *handle)
{
acpi_status status;
......
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 162 $
* $Revision: 163 $
*
*****************************************************************************/
......@@ -590,6 +590,7 @@ acpi_ex_dump_object_descriptor (
acpi_ex_out_integer ("Length", obj_desc->buffer.length);
acpi_ex_out_pointer ("Pointer", obj_desc->buffer.pointer);
ACPI_DUMP_BUFFER (obj_desc->buffer.pointer, obj_desc->buffer.length);
break;
......
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 112 $
* $Revision: 113 $
*
*****************************************************************************/
......@@ -27,6 +27,8 @@
#include "acpi.h"
#include "acdispat.h"
#include "acinterp.h"
#include "acevents.h"
#include "amlcode.h"
#define _COMPONENT ACPI_EXECUTER
......@@ -82,6 +84,45 @@ acpi_ex_read_data_from_field (
}
}
}
else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) {
/*
* This is an SMBus read. We must create a buffer to hold the data
* and directly access the region handler.
*/
buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!buffer_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Create the actual read buffer */
buffer_desc->buffer.pointer = ACPI_MEM_CALLOCATE (ACPI_SMBUS_BUFFER_SIZE);
if (!buffer_desc->buffer.pointer) {
acpi_ut_remove_reference (buffer_desc);
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Complete the buffer object initialization */
buffer_desc->common.flags = AOPOBJ_DATA_VALID;
buffer_desc->buffer.length = ACPI_SMBUS_BUFFER_SIZE;
buffer = buffer_desc->buffer.pointer;
/* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
/*
* Perform the read.
* Note: Smbus protocol value is passed in upper 16-bits of Function
*/
status = acpi_ex_access_region (obj_desc, 0,
(acpi_integer *) buffer_desc->buffer.pointer,
ACPI_READ | (obj_desc->field.attribute << 16));
acpi_ex_release_global_lock (locked);
goto exit;
}
/*
* Allocate a buffer for the contents of the field.
......@@ -138,17 +179,17 @@ acpi_ex_read_data_from_field (
obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.base_byte_offset));
/* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
/* Read from the field */
status = acpi_ex_extract_from_field (obj_desc, buffer, length);
/*
* Release global lock if we acquired it earlier
*/
acpi_ex_release_global_lock (locked);
exit:
if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (buffer_desc);
}
......@@ -176,7 +217,8 @@ acpi_ex_read_data_from_field (
acpi_status
acpi_ex_write_data_to_field (
acpi_operand_object *source_desc,
acpi_operand_object *obj_desc)
acpi_operand_object *obj_desc,
acpi_operand_object **result_desc)
{
acpi_status status;
u32 length;
......@@ -184,6 +226,7 @@ acpi_ex_write_data_to_field (
void *buffer;
void *new_buffer;
u8 locked;
acpi_operand_object *buffer_desc;
ACPI_FUNCTION_TRACE_PTR ("Ex_write_data_to_field", obj_desc);
......@@ -207,6 +250,64 @@ acpi_ex_write_data_to_field (
}
}
}
else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) {
/*
* This is an SMBus write. We will bypass the entire field mechanism
* and handoff the buffer directly to the handler.
*
* Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
*/
if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
ACPI_REPORT_ERROR (("SMBus write requires Buffer of length %X, found length %X\n",
ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
}
buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
if (!buffer_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Create the actual read buffer */
buffer_desc->buffer.pointer = ACPI_MEM_CALLOCATE (ACPI_SMBUS_BUFFER_SIZE);
if (!buffer_desc->buffer.pointer) {
acpi_ut_remove_reference (buffer_desc);
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Complete the buffer object initialization */
buffer_desc->common.flags = AOPOBJ_DATA_VALID;
buffer_desc->buffer.length = ACPI_SMBUS_BUFFER_SIZE;
buffer = buffer_desc->buffer.pointer;
ACPI_MEMCPY (buffer, source_desc->buffer.pointer, ACPI_SMBUS_BUFFER_SIZE);
/* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
/*
* Perform the write (returns status and perhaps data in the same buffer)
* Note: SMBus protocol type is passed in upper 16-bits of Function.
*/
status = acpi_ex_access_region (obj_desc, 0,
(acpi_integer *) buffer,
ACPI_WRITE | (obj_desc->field.attribute << 16));
acpi_ex_release_global_lock (locked);
*result_desc = buffer_desc;
return_ACPI_STATUS (status);
}
/*
* Get a pointer to the data to be written
......@@ -267,16 +368,13 @@ acpi_ex_write_data_to_field (
obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.base_byte_offset));
/* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
/*
* Write to the field
*/
status = acpi_ex_insert_into_field (obj_desc, buffer, length);
/* Write to the field */
/*
* Release global lock if we acquired it earlier
*/
status = acpi_ex_insert_into_field (obj_desc, buffer, length);
acpi_ex_release_global_lock (locked);
/* Free temporary buffer if we used one */
......
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
* $Revision: 89 $
* $Revision: 90 $
*
*****************************************************************************/
......@@ -64,6 +64,8 @@ acpi_ex_setup_region (
rgn_desc = obj_desc->common_field.region_obj;
/* We must have a valid region */
if (ACPI_GET_OBJECT_TYPE (rgn_desc) != ACPI_TYPE_REGION) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n",
ACPI_GET_OBJECT_TYPE (rgn_desc),
......@@ -83,6 +85,12 @@ acpi_ex_setup_region (
}
}
if (rgn_desc->region.space_id == ACPI_ADR_SPACE_SMBUS) {
/* SMBus has a non-linear address space */
return_ACPI_STATUS (AE_OK);
}
/*
* Validate the request. The entire request from the byte offset for a
* length of one field datum (access width) must fit within the region.
......@@ -127,8 +135,10 @@ acpi_ex_setup_region (
* PARAMETERS: *Obj_desc - Field to be read
* Field_datum_byte_offset - Byte offset of this datum within the
* parent field
* *Value - Where to store value (must be 32 bits)
* Read_write - Read or Write flag
* *Value - Where to store value (must at least
* the size of acpi_integer)
* Function - Read or Write flag plus other region-
* dependent flags
*
* RETURN: Status
*
......@@ -141,7 +151,7 @@ acpi_ex_access_region (
acpi_operand_object *obj_desc,
u32 field_datum_byte_offset,
acpi_integer *value,
u32 read_write)
u32 function)
{
acpi_status status;
acpi_operand_object *rgn_desc;
......@@ -151,6 +161,15 @@ acpi_ex_access_region (
ACPI_FUNCTION_TRACE ("Ex_access_region");
/*
* Ensure that the region operands are fully evaluated and verify
* the validity of the request
*/
status = acpi_ex_setup_region (obj_desc, field_datum_byte_offset);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
/*
* The physical address of this field datum is:
*
......@@ -163,7 +182,7 @@ acpi_ex_access_region (
+ obj_desc->common_field.base_byte_offset
+ field_datum_byte_offset;
if (read_write == ACPI_READ) {
if ((function & ACPI_IO_MASK) == ACPI_READ) {
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]"));
}
else {
......@@ -181,7 +200,7 @@ acpi_ex_access_region (
/* Invoke the appropriate Address_space/Op_region handler */
status = acpi_ev_address_space_dispatch (rgn_desc, read_write,
status = acpi_ev_address_space_dispatch (rgn_desc, function,
address, ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value);
if (ACPI_FAILURE (status)) {
......@@ -191,7 +210,6 @@ acpi_ex_access_region (
acpi_ut_get_region_name (rgn_desc->region.space_id),
rgn_desc->region.space_id));
}
else if (status == AE_NOT_EXIST) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Region %s(%X) has no handler\n",
......@@ -371,11 +389,6 @@ acpi_ex_field_datum_io (
* For simple Region_fields, we just directly access the owning
* Operation Region.
*/
status = acpi_ex_setup_region (obj_desc, field_datum_byte_offset);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
status = acpi_ex_access_region (obj_desc, field_datum_byte_offset, value,
read_write);
break;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
* $Revision: 144 $
* $Revision: 145 $
*
*****************************************************************************/
......@@ -389,6 +389,7 @@ acpi_ex_opcode_1A_1T_1R (
return_ACPI_STATUS (status);
}
if (!walk_state->result_obj) {
/*
* Normally, we would remove a reference on the Operand[0] parameter;
* But since it is being used as the internal return object
......@@ -397,6 +398,7 @@ acpi_ex_opcode_1A_1T_1R (
*/
walk_state->result_obj = operand[0];
walk_state->operands[0] = NULL; /* Prevent deletion */
}
return_ACPI_STATUS (status);
......@@ -461,7 +463,9 @@ acpi_ex_opcode_1A_1T_1R (
cleanup:
if (!walk_state->result_obj) {
walk_state->result_obj = return_desc;
}
/* Delete return object on error */
......
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
* $Revision: 113 $
* $Revision: 114 $
*
*****************************************************************************/
......@@ -490,8 +490,10 @@ acpi_ex_opcode_2A_1T_1R (
goto cleanup;
}
if (!walk_state->result_obj) {
walk_state->result_obj = return_desc;
}
}
cleanup:
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
* $Revision: 14 $
* $Revision: 15 $
*
*****************************************************************************/
......@@ -226,7 +226,9 @@ acpi_ex_opcode_3A_1T_1R (
/* Set the return object and exit */
if (!walk_state->result_obj) {
walk_state->result_obj = return_desc;
}
return_ACPI_STATUS (status);
}
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
* $Revision: 120 $
* $Revision: 121 $
*
*****************************************************************************/
......@@ -107,6 +107,7 @@ acpi_ex_decode_field_access (
break;
case AML_FIELD_ACCESS_BYTE:
case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
byte_alignment = 1;
bit_length = 8;
break;
......@@ -126,11 +127,6 @@ acpi_ex_decode_field_access (
bit_length = 64;
break;
case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 */
byte_alignment = 8;
bit_length = 8;
break;
default:
/* Invalid field access type */
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
* $Revision: 173 $
* $Revision: 174 $
*
*****************************************************************************/
......@@ -81,7 +81,7 @@ acpi_ex_store (
if (ACPI_GET_DESCRIPTOR_TYPE (dest_desc) == ACPI_DESC_TYPE_NAMED) {
/*
* Dest is a namespace node,
* Storing an object into a Name "container"
* Storing an object into a Named node.
*/
status = acpi_ex_store_object_to_node (source_desc,
(acpi_namespace_node *) dest_desc, walk_state);
......@@ -435,7 +435,7 @@ acpi_ex_store_object_to_node (
/*
* For fields, copy the source data to the target field.
*/
status = acpi_ex_write_data_to_field (source_desc, target_desc);
status = acpi_ex_write_data_to_field (source_desc, target_desc, &walk_state->result_obj);
break;
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exsystem - Interface to OS services
* $Revision: 73 $
* $Revision: 74 $
*
*****************************************************************************/
......@@ -51,7 +51,7 @@
acpi_status
acpi_ex_system_wait_semaphore (
acpi_handle semaphore,
u32 timeout)
u16 timeout)
{
acpi_status status;
acpi_status status2;
......@@ -201,12 +201,12 @@ acpi_ex_system_acquire_mutex (
* Support for the _GL_ Mutex object -- go get the global lock
*/
if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
status = acpi_ev_acquire_global_lock ((u32) time_desc->integer.value);
status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value);
return_ACPI_STATUS (status);
}
status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore,
(u32) time_desc->integer.value);
(u16) time_desc->integer.value);
return_ACPI_STATUS (status);
}
......@@ -312,7 +312,7 @@ acpi_ex_system_wait_event (
if (obj_desc) {
status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore,
(u32) time_desc->integer.value);
(u16) time_desc->integer.value);
}
return_ACPI_STATUS (status);
......
......@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
* $Revision: 105 $
* $Revision: 106 $
*
*****************************************************************************/
......@@ -189,7 +189,7 @@ acpi_ex_acquire_global_lock (
if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
/* We should attempt to get the lock, wait forever */
status = acpi_ev_acquire_global_lock (ACPI_UINT32_MAX);
status = acpi_ev_acquire_global_lock (ACPI_WAIT_FOREVER);
if (ACPI_SUCCESS (status)) {
locked = TRUE;
}
......
......@@ -151,12 +151,6 @@ acpi_fan_add_fs (
if (!device)
return_VALUE(-EINVAL);
if (!acpi_fan_dir) {
acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
if (!acpi_fan_dir)
return_VALUE(-ENODEV);
}
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_fan_dir);
......@@ -187,9 +181,6 @@ acpi_fan_remove_fs (
{
ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
if (!acpi_fan_dir)
return_VALUE(-ENODEV);
if (acpi_device_dir(device))
remove_proc_entry(acpi_device_bid(device), acpi_fan_dir);
......@@ -276,9 +267,15 @@ acpi_fan_init (void)
ACPI_FUNCTION_TRACE("acpi_fan_init");
acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
if (!acpi_fan_dir)
return_VALUE(-ENODEV);
result = acpi_bus_register_driver(&acpi_fan_driver);
if (result < 0)
if (result < 0) {
remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
return_VALUE(-ENODEV);
}
return_VALUE(0);
}
......@@ -287,12 +284,10 @@ acpi_fan_init (void)
void __exit
acpi_fan_exit (void)
{
int result = 0;
ACPI_FUNCTION_TRACE("acpi_fan_exit");
result = acpi_bus_unregister_driver(&acpi_fan_driver);
if (!result)
acpi_bus_unregister_driver(&acpi_fan_driver);
remove_proc_entry(ACPI_FAN_CLASS, acpi_root_dir);
return_VOID;
......
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 115 $
* $Revision: 117 $
*
*****************************************************************************/
......@@ -54,7 +54,7 @@
/* Version string */
#define ACPI_CA_VERSION 0x20021101
#define ACPI_CA_VERSION 0x20021111
/* Version of ACPI supported */
......@@ -166,6 +166,10 @@
#define ACPI_RSDP_CHECKSUM_LENGTH 20
#define ACPI_RSDP_XCHECKSUM_LENGTH 36
/* SMBus bidirectional buffer size */
#define ACPI_SMBUS_BUFFER_SIZE 34
/******************************************************************************
*
......
/******************************************************************************
*
* Name: acdisasm.h - AML disassembler
* $Revision: 4 $
* $Revision: 5 $
*
*****************************************************************************/
......@@ -239,6 +239,9 @@ void
acpi_dm_bit_list (
u16 mask);
void
acpi_dm_decode_attribute (
u8 attribute);
/*
* dmresrcl
......
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
* $Revision: 79 $
* $Revision: 80 $
*
*****************************************************************************/
......@@ -63,7 +63,7 @@ acpi_ev_is_notify_object (
acpi_status
acpi_ev_acquire_global_lock(
u32 timeout);
u16 timeout);
acpi_status
acpi_ev_release_global_lock(
......
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
* $Revision: 140 $
* $Revision: 142 $
*
*****************************************************************************/
......@@ -164,7 +164,8 @@ acpi_ex_read_data_from_field (
acpi_status
acpi_ex_write_data_to_field (
acpi_operand_object *source_desc,
acpi_operand_object *obj_desc);
acpi_operand_object *obj_desc,
acpi_operand_object **result_desc);
/*
* exmisc - ACPI AML (p-code) execution - specific opcodes
......@@ -377,7 +378,7 @@ acpi_ex_system_reset_event(
acpi_status
acpi_ex_system_wait_semaphore (
acpi_handle semaphore,
u32 timeout);
u16 timeout);
/*
......
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 178 $
* $Revision: 179 $
*
*****************************************************************************/
......@@ -27,7 +27,7 @@
#define __ACLOCAL_H__
#define WAIT_FOREVER ((u32) -1)
#define ACPI_WAIT_FOREVER 0xFFFF /* u16, as per ACPI spec */
typedef void* acpi_mutex;
typedef u32 ACPI_MUTEX_HANDLE;
......
......@@ -117,7 +117,7 @@ acpi_status
acpi_os_wait_semaphore (
acpi_handle handle,
u32 units,
u32 timeout);
u16 timeout);
acpi_status
acpi_os_signal_semaphore (
......
......@@ -281,7 +281,7 @@ acpi_install_gpe_handler (
acpi_status
acpi_acquire_global_lock (
u32 timeout,
u16 timeout,
u32 *handle);
acpi_status
......
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
* $Revision: 240 $
* $Revision: 241 $
*
*****************************************************************************/
......@@ -499,6 +499,7 @@ typedef u32 acpi_object_type;
*/
#define ACPI_READ 0
#define ACPI_WRITE 1
#define ACPI_IO_MASK 1
/*
......
......@@ -3,7 +3,7 @@
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
* $Revision: 70 $
* $Revision: 71 $
*
*****************************************************************************/
......@@ -462,7 +462,8 @@ typedef enum
AML_FIELD_ATTRIB_SMB_BYTE = 0x06,
AML_FIELD_ATTRIB_SMB_WORD = 0x08,
AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A,
AML_FIELD_ATTRIB_SMB_CALL = 0x0E
AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C,
AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
} AML_ACCESS_ATTRIBUTE;
......
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
* $Revision: 145 $
* $Revision: 146 $
*
*****************************************************************************/
......@@ -180,7 +180,7 @@ acpi_ns_dump_one_object (
/* Indent the object according to the level */
acpi_os_printf ("%2d%*s", level - 1, level * 2, " ");
acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " ");
/* Check the node type and name */
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
* $Revision: 84 $
* $Revision: 85 $
*
******************************************************************************/
......@@ -173,13 +173,13 @@ acpi_ns_attach_object (
*
* FUNCTION: Acpi_ns_detach_object
*
* PARAMETERS: Node - An object whose Value will be deleted
* PARAMETERS: Node - An node whose object will be detached
*
* RETURN: None.
*
* DESCRIPTION: Delete the Value associated with a namespace object. If the
* Value is an allocated object, it is freed. Otherwise, the
* field is simply cleared.
* DESCRIPTION: Detach/delete an object associated with a namespace node.
* if the object is an allocated object, it is freed.
* Otherwise, the field is simply cleared.
*
******************************************************************************/
......@@ -234,6 +234,8 @@ acpi_ns_detach_object (
* RETURN: Current value of the object field from the Node whose
* handle is passed
*
* DESCRIPTION: Obtain the object attached to a namespace node.
*
******************************************************************************/
acpi_operand_object *
......@@ -266,7 +268,9 @@ acpi_ns_get_attached_object (
* PARAMETERS: Node - Parent Node to be examined
*
* RETURN: Current value of the object field from the Node whose
* handle is passed
* handle is passed.
*
* DESCRIPTION: Obtain a secondary object associated with a namespace node.
*
******************************************************************************/
......@@ -292,11 +296,13 @@ acpi_ns_get_secondary_object (
*
* FUNCTION: Acpi_ns_attach_data
*
* PARAMETERS:
* PARAMETERS: Node - Namespace node
* Handler - Handler to be associated with the data
* Data - Data to be attached
*
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Low-level attach data. Create and attach a Data object.
*
******************************************************************************/
......@@ -311,7 +317,8 @@ acpi_ns_attach_data (
acpi_operand_object *data_desc;
/* */
/* We only allow one attachment per handler */
prev_obj_desc = NULL;
obj_desc = node->object;
while (obj_desc) {
......@@ -324,7 +331,6 @@ acpi_ns_attach_data (
obj_desc = obj_desc->common.next_object;
}
/* Create an internal object for the data */
data_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_DATA);
......@@ -335,7 +341,6 @@ acpi_ns_attach_data (
data_desc->data.handler = handler;
data_desc->data.pointer = data;
/* Install the data object */
if (prev_obj_desc) {
......@@ -353,11 +358,13 @@ acpi_ns_attach_data (
*
* FUNCTION: Acpi_ns_detach_data
*
* PARAMETERS:
* PARAMETERS: Node - Namespace node
* Handler - Handler associated with the data
*
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Low-level detach data. Delete the data node, but the caller
* is responsible for the actual data.
*
******************************************************************************/
......@@ -398,11 +405,14 @@ acpi_ns_detach_data (
*
* FUNCTION: Acpi_ns_get_attached_data
*
* PARAMETERS:
* PARAMETERS: Node - Namespace node
* Handler - Handler associated with the data
* Data - Where the data is returned
*
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Low level interface to obtain data previously associated with
* a namespace node.
*
******************************************************************************/
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
* $Revision: 115 $
* $Revision: 116 $
*
*****************************************************************************/
......@@ -45,7 +45,7 @@
*
* RETURN: None
*
* DESCRIPTION: Print warning message
* DESCRIPTION: Print warning message with full pathname
*
******************************************************************************/
......@@ -61,12 +61,16 @@ acpi_ns_report_error (
char *name;
/* Convert path to external format */
status = acpi_ns_externalize_name (ACPI_UINT32_MAX, internal_name, NULL, &name);
acpi_os_printf ("%8s-%04d: *** Error: Looking up ",
module_name, line_number);
if (name) {
/* Print target name */
if (ACPI_SUCCESS (status)) {
acpi_os_printf ("[%s]", name);
}
else {
......
......@@ -2,7 +2,7 @@
*
* Module Name: nsxfeval - Public interfaces to the ACPI subsystem
* ACPI Object evaluation interfaces
* $Revision: 3 $
* $Revision: 4 $
*
******************************************************************************/
......@@ -570,11 +570,13 @@ acpi_get_devices (
*
* FUNCTION: Acpi_attach_data
*
* PARAMETERS:
* PARAMETERS: Obj_handle - Namespace node
* Handler - Handler for this attachment
* Data - Pointer to data to be attached
*
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Attach arbitrary data and handler to a namespace node.
*
******************************************************************************/
......@@ -621,11 +623,12 @@ acpi_attach_data (
*
* FUNCTION: Acpi_detach_data
*
* PARAMETERS:
* PARAMETERS: Obj_handle - Namespace node handle
* Handler - Handler used in call to Acpi_attach_data
*
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Remove data that was previously attached to a node.
*
******************************************************************************/
......@@ -670,11 +673,13 @@ acpi_detach_data (
*
* FUNCTION: Acpi_get_data
*
* PARAMETERS:
* PARAMETERS: Obj_handle - Namespace node
* Handler - Handler used in call to Attach_data
* Data - Where the data is returned
*
* RETURN: Status
*
* DESCRIPTION:
* DESCRIPTION: Retrieve data that was previously attached to a namespace node.
*
******************************************************************************/
......
......@@ -702,7 +702,7 @@ acpi_status
acpi_os_wait_semaphore(
acpi_handle handle,
u32 units,
u32 timeout)
u16 timeout)
{
acpi_status status = AE_OK;
struct semaphore *sem = (struct semaphore*)handle;
......@@ -739,7 +739,7 @@ acpi_os_wait_semaphore(
* Wait Indefinitely:
* ------------------
*/
case WAIT_FOREVER:
case ACPI_WAIT_FOREVER:
ret = down_interruptible(sem);
if (ret < 0)
status = AE_ERROR;
......
......@@ -443,12 +443,6 @@ acpi_power_add_fs (
if (!device)
return_VALUE(-EINVAL);
if (!acpi_power_dir) {
acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir);
if (!acpi_power_dir)
return_VALUE(-ENODEV);
}
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_power_dir);
......@@ -478,9 +472,6 @@ acpi_power_remove_fs (
{
ACPI_FUNCTION_TRACE("acpi_power_remove_fs");
if (!acpi_power_dir)
return_VALUE(-ENODEV);
if (acpi_device_dir(device))
remove_proc_entry(acpi_device_bid(device), acpi_power_dir);
......@@ -591,6 +582,10 @@ static int __init acpi_power_init (void)
INIT_LIST_HEAD(&acpi_power_resource_list);
acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir);
if (!acpi_power_dir)
return_VALUE(-ENODEV);
result = acpi_bus_register_driver(&acpi_power_driver);
if (result < 0) {
remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir);
......
......@@ -2289,13 +2289,6 @@ acpi_processor_add_fs (
ACPI_FUNCTION_TRACE("acpi_processor_add_fs");
if (!acpi_processor_dir) {
acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS,
acpi_root_dir);
if (!acpi_processor_dir)
return_VALUE(-ENODEV);
}
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_processor_dir);
......@@ -2378,9 +2371,6 @@ acpi_processor_remove_fs (
{
ACPI_FUNCTION_TRACE("acpi_processor_remove_fs");
if (!acpi_processor_dir)
return_VALUE(-ENODEV);
if (acpi_device_dir(device))
remove_proc_entry(acpi_device_bid(device), acpi_processor_dir);
......@@ -2640,9 +2630,15 @@ acpi_processor_init (void)
memset(&processors, 0, sizeof(processors));
memset(&errata, 0, sizeof(errata));
acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
if (!acpi_processor_dir)
return_VALUE(-ENODEV);
result = acpi_bus_register_driver(&acpi_processor_driver);
if (result < 0)
if (result < 0) {
remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
return_VALUE(-ENODEV);
}
return_VALUE(0);
}
......@@ -2651,12 +2647,10 @@ acpi_processor_init (void)
static void __exit
acpi_processor_exit (void)
{
int result = 0;
ACPI_FUNCTION_TRACE("acpi_processor_exit");
result = acpi_bus_unregister_driver(&acpi_processor_driver);
if (!result)
acpi_bus_unregister_driver(&acpi_processor_driver);
remove_proc_entry(ACPI_PROCESSOR_CLASS, acpi_root_dir);
return_VOID;
......
......@@ -258,6 +258,8 @@ acpi_bus_driver_init (
return_VALUE(result);
}
device->driver = driver;
/*
* TBD - Configuration Management: Assign resources to device based
* upon possible configuration and currently allocated resources.
......
/******************************************************************************
*
* Module Name: tbconvrt - ACPI Table conversion utilities
* $Revision: 44 $
* $Revision: 45 $
*
*****************************************************************************/
......@@ -36,11 +36,13 @@
*
* FUNCTION: Acpi_tb_get_table_count
*
* PARAMETERS:
* PARAMETERS: RSDP - Pointer to the RSDP
* RSDT - Pointer to the RSDT/XSDT
*
* RETURN:
* RETURN: The number of tables pointed to by the RSDT or XSDT.
*
* DESCRIPTION: Calculate the number of tables
* DESCRIPTION: Calculate the number of tables. Automatically handles either
* an RSDT or XSDT.
*
******************************************************************************/
......@@ -80,9 +82,9 @@ acpi_tb_get_table_count (
*
* FUNCTION: Acpi_tb_convert_to_xsdt
*
* PARAMETERS:
* PARAMETERS: Table_info - Info about the RSDT
*
* RETURN:
* RETURN: Status
*
* DESCRIPTION: Convert an RSDT to an XSDT (internal common format)
*
......@@ -311,13 +313,11 @@ acpi_tb_convert_fadt2 (
*
* RETURN: Status
*
* DESCRIPTION:
* Converts a BIOS supplied ACPI 1.0 FADT to an intermediate
* DESCRIPTION: Converts a BIOS supplied ACPI 1.0 FADT to a local
* ACPI 2.0 FADT. If the BIOS supplied a 2.0 FADT then it is simply
* copied to the intermediate FADT. The ACPI CA software uses this
* intermediate FADT. Thus a significant amount of special #ifdef
* type codeing is saved. This intermediate FADT will need to be
* freed at some point.
* copied to the local FADT. The ACPI CA software uses this
* local FADT. Thus a significant amount of special #ifdef
* type codeing is saved.
*
******************************************************************************/
......
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
* $Revision: 64 $
* $Revision: 65 $
*
*****************************************************************************/
......@@ -302,7 +302,8 @@ acpi_find_root_pointer (
status = acpi_tb_find_rsdp (&table_info, flags);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found, %s Flags=%X\n",
acpi_format_exception (status), flags));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
......@@ -406,6 +407,8 @@ acpi_tb_find_rsdp (
status = acpi_os_map_memory ((u64) LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE,
(void **) &table_ptr);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
LO_RSDP_WINDOW_BASE, LO_RSDP_WINDOW_SIZE));
return_ACPI_STATUS (status);
}
......@@ -428,6 +431,8 @@ acpi_tb_find_rsdp (
status = acpi_os_map_memory ((u64) HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE,
(void **) &table_ptr);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %X for length %X\n",
HI_RSDP_WINDOW_BASE, HI_RSDP_WINDOW_SIZE));
return_ACPI_STATUS (status);
}
......
......@@ -1060,13 +1060,6 @@ acpi_thermal_add_fs (
ACPI_FUNCTION_TRACE("acpi_thermal_add_fs");
if (!acpi_thermal_dir) {
acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS,
acpi_root_dir);
if (!acpi_thermal_dir)
return_VALUE(-ENODEV);
}
if (!acpi_device_dir(device)) {
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
acpi_thermal_dir);
......@@ -1147,9 +1140,6 @@ acpi_thermal_remove_fs (
{
ACPI_FUNCTION_TRACE("acpi_thermal_remove_fs");
if (!acpi_thermal_dir)
return_VALUE(-ENODEV);
if (acpi_device_dir(device))
remove_proc_entry(acpi_device_bid(device), acpi_thermal_dir);
......@@ -1351,9 +1341,15 @@ acpi_thermal_init (void)
ACPI_FUNCTION_TRACE("acpi_thermal_init");
acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
if (!acpi_thermal_dir)
return_VALUE(-ENODEV);
result = acpi_bus_register_driver(&acpi_thermal_driver);
if (result < 0)
if (result < 0) {
remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
return_VALUE(-ENODEV);
}
return_VALUE(0);
}
......@@ -1362,12 +1358,10 @@ acpi_thermal_init (void)
static void __exit
acpi_thermal_exit (void)
{
int result = 0;
ACPI_FUNCTION_TRACE("acpi_thermal_exit");
result = acpi_bus_unregister_driver(&acpi_thermal_driver);
if (!result)
acpi_bus_unregister_driver(&acpi_thermal_driver);
remove_proc_entry(ACPI_THERMAL_CLASS, acpi_root_dir);
return_VOID;
......
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
* $Revision: 85 $
* $Revision: 86 $
*
******************************************************************************/
......@@ -685,7 +685,7 @@ acpi_ut_acquire_mutex (
this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
status = acpi_os_wait_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex,
1, WAIT_FOREVER);
1, ACPI_WAIT_FOREVER);
if (ACPI_SUCCESS (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
......
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