Commit 5dfef799 authored by Andy Grover's avatar Andy Grover

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

into groveronline.com:/root/bk/linux-acpi
parents fe8e25c3 c5b0f11b
/******************************************************************************* /*******************************************************************************
* *
* Module Name: dsmthdat - control method arguments and local variables * Module Name: dsmthdat - control method arguments and local variables
* $Revision: 64 $ * $Revision: 66 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "acdispat.h" #include "acdispat.h"
#include "amlcode.h" #include "amlcode.h"
#include "acnamesp.h" #include "acnamesp.h"
#include "acinterp.h"
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
...@@ -274,6 +275,7 @@ acpi_ds_method_data_get_node ( ...@@ -274,6 +275,7 @@ acpi_ds_method_data_get_node (
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index. * DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index.
* Note: There is no "implicit conversion" for locals.
* *
******************************************************************************/ ******************************************************************************/
...@@ -286,11 +288,17 @@ acpi_ds_method_data_set_value ( ...@@ -286,11 +288,17 @@ acpi_ds_method_data_set_value (
{ {
acpi_status status; acpi_status status;
acpi_namespace_node *node; acpi_namespace_node *node;
acpi_operand_object *new_desc = object;
ACPI_FUNCTION_TRACE ("Ds_method_data_set_value"); ACPI_FUNCTION_TRACE ("Ds_method_data_set_value");
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"obj %p op %X, ref count = %d [%s]\n", object,
opcode, object->common.reference_count,
acpi_ut_get_type_name (object->common.type)));
/* Get the namespace node for the arg/local */ /* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node); status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
...@@ -298,14 +306,30 @@ acpi_ds_method_data_set_value ( ...@@ -298,14 +306,30 @@ acpi_ds_method_data_set_value (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
/*
* If the object has just been created and is not attached to anything,
* (the reference count is 1), then we can just store it directly into
* the arg/local. Otherwise, we must copy it.
*/
if (object->common.reference_count > 1) {
status = acpi_ut_copy_iobject_to_iobject (object, &new_desc, walk_state);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object Copied %p, new %p\n",
object, new_desc));
}
else {
/* Increment ref count so object can't be deleted while installed */ /* Increment ref count so object can't be deleted while installed */
acpi_ut_add_reference (object); acpi_ut_add_reference (new_desc);
}
/* Install the object into the stack entry */ /* Install the object */
node->object = object; node->object = new_desc;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (status);
} }
...@@ -560,7 +584,8 @@ acpi_ds_store_object_to_local ( ...@@ -560,7 +584,8 @@ acpi_ds_store_object_to_local (
current_obj_desc = acpi_ns_get_attached_object (node); current_obj_desc = acpi_ns_get_attached_object (node);
if (current_obj_desc == obj_desc) { if (current_obj_desc == obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n", obj_desc)); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n",
obj_desc));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
...@@ -609,16 +634,12 @@ acpi_ds_store_object_to_local ( ...@@ -609,16 +634,12 @@ acpi_ds_store_object_to_local (
"Arg (%p) is an Obj_ref(Node), storing in node %p\n", "Arg (%p) is an Obj_ref(Node), storing in node %p\n",
obj_desc, current_obj_desc)); obj_desc, current_obj_desc));
/* Detach an existing object from the referenced Node */
acpi_ns_detach_object (current_obj_desc->reference.object);
/* /*
* Store this object into the Node * Store this object to the Node
* (perform the indirect store) * (perform the indirect store)
*/ */
status = acpi_ns_attach_object (current_obj_desc->reference.object, status = acpi_ex_store_object_to_node (obj_desc,
obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc)); current_obj_desc->reference.object, walk_state);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evevent - Fixed and General Purpose Even handling and dispatch * Module Name: evevent - Fixed and General Purpose Even handling and dispatch
* $Revision: 96 $ * $Revision: 99 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -331,11 +331,8 @@ acpi_ev_gpe_initialize (void) ...@@ -331,11 +331,8 @@ acpi_ev_gpe_initialize (void)
* FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
* to be the same size." * to be the same size."
*/ */
acpi_gbl_gpe_block_info[0].address_space_id = acpi_gbl_FADT->Xgpe0_blk.address_space_id; acpi_gbl_gpe_block_info[0].register_count = 0;
acpi_gbl_gpe_block_info[1].address_space_id = acpi_gbl_FADT->Xgpe1_blk.address_space_id; acpi_gbl_gpe_block_info[1].register_count = 0;
acpi_gbl_gpe_block_info[0].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe0_blk.register_bit_width);
acpi_gbl_gpe_block_info[1].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe1_blk.register_bit_width);
acpi_gbl_gpe_block_info[0].block_address = &acpi_gbl_FADT->Xgpe0_blk; acpi_gbl_gpe_block_info[0].block_address = &acpi_gbl_FADT->Xgpe0_blk;
acpi_gbl_gpe_block_info[1].block_address = &acpi_gbl_FADT->Xgpe1_blk; acpi_gbl_gpe_block_info[1].block_address = &acpi_gbl_FADT->Xgpe1_blk;
...@@ -343,28 +340,25 @@ acpi_ev_gpe_initialize (void) ...@@ -343,28 +340,25 @@ acpi_ev_gpe_initialize (void)
acpi_gbl_gpe_block_info[0].block_base_number = 0; acpi_gbl_gpe_block_info[0].block_base_number = 0;
acpi_gbl_gpe_block_info[1].block_base_number = acpi_gbl_FADT->gpe1_base; acpi_gbl_gpe_block_info[1].block_base_number = acpi_gbl_FADT->gpe1_base;
/* Warn and exit if there are no GPE registers */
acpi_gbl_gpe_register_count = acpi_gbl_gpe_block_info[0].register_count +
acpi_gbl_gpe_block_info[1].register_count;
if (!acpi_gbl_gpe_register_count) {
ACPI_REPORT_WARNING (("There are no GPE blocks defined in the FADT\n"));
return_ACPI_STATUS (AE_OK);
}
/* /*
* Determine the maximum GPE number for this machine. * Determine the maximum GPE number for this machine.
* Note: both GPE0 and GPE1 are optional, and either can exist without * Note: both GPE0 and GPE1 are optional, and either can exist without
* the other * the other.
* If EITHER the register length OR the block address are zero, then that
* particular block is not supported.
*/ */
if (acpi_gbl_gpe_block_info[0].register_count) { if (acpi_gbl_FADT->Xgpe0_blk.register_bit_width && ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe0_blk.address)) {
/* GPE block 0 exists */ /* GPE block 0 exists (has length and address > 0) */
acpi_gbl_gpe_block_info[0].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe0_blk.register_bit_width);
acpi_gbl_gpe_number_max = ACPI_MUL_8 (acpi_gbl_gpe_block_info[0].register_count) - 1; acpi_gbl_gpe_number_max = ACPI_MUL_8 (acpi_gbl_gpe_block_info[0].register_count) - 1;
} }
if (acpi_gbl_gpe_block_info[1].register_count) { if (acpi_gbl_FADT->Xgpe1_blk.register_bit_width && ACPI_GET_ADDRESS (acpi_gbl_FADT->Xgpe1_blk.address)) {
/* GPE block 1 exists */ /* GPE block 1 exists (has length and address > 0) */
acpi_gbl_gpe_block_info[1].register_count = (u16) ACPI_DIV_16 (acpi_gbl_FADT->Xgpe1_blk.register_bit_width);
/* Check for GPE0/GPE1 overlap (if both banks exist) */ /* Check for GPE0/GPE1 overlap (if both banks exist) */
...@@ -385,6 +379,15 @@ acpi_ev_gpe_initialize (void) ...@@ -385,6 +379,15 @@ acpi_ev_gpe_initialize (void)
(ACPI_MUL_8 (acpi_gbl_gpe_block_info[1].register_count) - 1); (ACPI_MUL_8 (acpi_gbl_gpe_block_info[1].register_count) - 1);
} }
/* Warn and exit if there are no GPE registers */
acpi_gbl_gpe_register_count = acpi_gbl_gpe_block_info[0].register_count +
acpi_gbl_gpe_block_info[1].register_count;
if (!acpi_gbl_gpe_register_count) {
ACPI_REPORT_WARNING (("There are no GPE blocks defined in the FADT\n"));
return_ACPI_STATUS (AE_OK);
}
/* Check for Max GPE number out-of-range */ /* Check for Max GPE number out-of-range */
if (acpi_gbl_gpe_number_max > ACPI_GPE_MAX) { if (acpi_gbl_gpe_number_max > ACPI_GPE_MAX) {
...@@ -460,8 +463,8 @@ acpi_ev_gpe_initialize (void) ...@@ -460,8 +463,8 @@ acpi_ev_gpe_initialize (void)
+ i + i
+ acpi_gbl_gpe_block_info[gpe_block].register_count)); + acpi_gbl_gpe_block_info[gpe_block].register_count));
gpe_register_info->status_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].address_space_id; gpe_register_info->status_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].block_address->address_space_id;
gpe_register_info->enable_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].address_space_id; gpe_register_info->enable_address.address_space_id = acpi_gbl_gpe_block_info[gpe_block].block_address->address_space_id;
gpe_register_info->status_address.register_bit_width = 8; gpe_register_info->status_address.register_bit_width = 8;
gpe_register_info->enable_address.register_bit_width = 8; gpe_register_info->enable_address.register_bit_width = 8;
gpe_register_info->status_address.register_bit_offset = 8; gpe_register_info->status_address.register_bit_offset = 8;
...@@ -615,7 +618,7 @@ acpi_ev_save_method_info ( ...@@ -615,7 +618,7 @@ acpi_ev_save_method_info (
* for use during dispatch of this GPE. * for use during dispatch of this GPE.
*/ */
acpi_gbl_gpe_number_info [gpe_number_index].type = type; acpi_gbl_gpe_number_info [gpe_number_index].type = type;
acpi_gbl_gpe_number_info [gpe_number_index].method_handle = obj_handle; acpi_gbl_gpe_number_info [gpe_number_index].method_node = (acpi_namespace_node *) obj_handle;
/* /*
* Enable the GPE (SCIs should be disabled at this point) * Enable the GPE (SCIs should be disabled at this point)
...@@ -625,7 +628,7 @@ acpi_ev_save_method_info ( ...@@ -625,7 +628,7 @@ acpi_ev_save_method_info (
return (status); return (status);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %2.2X\n",
name, gpe_number)); name, gpe_number));
return (AE_OK); return (AE_OK);
} }
...@@ -805,15 +808,16 @@ acpi_ev_asynch_execute_gpe_method ( ...@@ -805,15 +808,16 @@ acpi_ev_asynch_execute_gpe_method (
return_VOID; return_VOID;
} }
if (gpe_info.method_handle) { if (gpe_info.method_node) {
/* /*
* Invoke the GPE Method (_Lxx, _Exx): * Invoke the GPE Method (_Lxx, _Exx):
* (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.) * (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.)
*/ */
status = acpi_ns_evaluate_by_handle (gpe_info.method_handle, NULL, NULL); status = acpi_ns_evaluate_by_handle (gpe_info.method_node, NULL, NULL);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("%s while evaluating GPE%X method\n", ACPI_REPORT_ERROR (("%s while evaluating method [%4.4s] for GPE[%2.2X]\n",
acpi_format_exception (status), gpe_number)); acpi_format_exception (status),
gpe_info.method_node->name.ascii, gpe_number));
} }
} }
...@@ -881,7 +885,7 @@ acpi_ev_gpe_dispatch ( ...@@ -881,7 +885,7 @@ acpi_ev_gpe_dispatch (
if (gpe_info->type & ACPI_EVENT_EDGE_TRIGGERED) { if (gpe_info->type & ACPI_EVENT_EDGE_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_number); status = acpi_hw_clear_gpe (gpe_number);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%X]\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
} }
...@@ -898,14 +902,14 @@ acpi_ev_gpe_dispatch ( ...@@ -898,14 +902,14 @@ acpi_ev_gpe_dispatch (
gpe_info->handler (gpe_info->context); gpe_info->handler (gpe_info->context);
} }
else if (gpe_info->method_handle) { else if (gpe_info->method_node) {
/* /*
* Disable GPE, so it doesn't keep firing before the method has a * Disable GPE, so it doesn't keep firing before the method has a
* chance to run. * chance to run.
*/ */
status = acpi_hw_disable_gpe (gpe_number); status = acpi_hw_disable_gpe (gpe_number);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%X]\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
...@@ -915,13 +919,13 @@ acpi_ev_gpe_dispatch ( ...@@ -915,13 +919,13 @@ acpi_ev_gpe_dispatch (
if (ACPI_FAILURE (acpi_os_queue_for_execution (OSD_PRIORITY_GPE, if (ACPI_FAILURE (acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
acpi_ev_asynch_execute_gpe_method, acpi_ev_asynch_execute_gpe_method,
ACPI_TO_POINTER (gpe_number)))) { ACPI_TO_POINTER (gpe_number)))) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%X], event is disabled\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to queue handler for GPE[%2.2X], event is disabled\n", gpe_number));
} }
} }
else { else {
/* No handler or method to run! */ /* No handler or method to run! */
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: No handler or method for GPE[%X], disabling event\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: No handler or method for GPE[%2.2X], disabling event\n", gpe_number));
/* /*
* Disable the GPE. The GPE will remain disabled until the ACPI * Disable the GPE. The GPE will remain disabled until the ACPI
...@@ -929,7 +933,7 @@ acpi_ev_gpe_dispatch ( ...@@ -929,7 +933,7 @@ acpi_ev_gpe_dispatch (
*/ */
status = acpi_hw_disable_gpe (gpe_number); status = acpi_hw_disable_gpe (gpe_number);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%X]\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to disable GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
} }
...@@ -940,7 +944,7 @@ acpi_ev_gpe_dispatch ( ...@@ -940,7 +944,7 @@ acpi_ev_gpe_dispatch (
if (gpe_info->type & ACPI_EVENT_LEVEL_TRIGGERED) { if (gpe_info->type & ACPI_EVENT_LEVEL_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_number); status = acpi_hw_clear_gpe (gpe_number);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%X]\n", gpe_number)); ACPI_REPORT_ERROR (("Acpi_ev_gpe_dispatch: Unable to clear GPE[%2.2X]\n", gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
} }
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: evrgnini- ACPI Address_space (Op_region) init * Module Name: evrgnini- ACPI Address_space (Op_region) init
* $Revision: 63 $ * $Revision: 64 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -269,6 +269,11 @@ acpi_ev_pci_config_region_setup ( ...@@ -269,6 +269,11 @@ acpi_ev_pci_config_region_setup (
pci_id->bus = ACPI_LOWORD (temp); pci_id->bus = ACPI_LOWORD (temp);
} }
/*
* Complete this device's Pci_id
*/
acpi_os_derive_pci_id (node, region_obj->region.node, &pci_id);
*region_context = pci_id; *region_context = pci_id;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
......
/****************************************************************************** /******************************************************************************
* *
* Name: acconfig.h - Global configuration constants * Name: acconfig.h - Global configuration constants
* $Revision: 118 $ * $Revision: 119 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
/* Version string */ /* Version string */
#define ACPI_CA_VERSION 0x20021115 #define ACPI_CA_VERSION 0x20021122
/* Version of ACPI supported */ /* Version of ACPI supported */
......
/****************************************************************************** /******************************************************************************
* *
* Name: aclocal.h - Internal data types used across the ACPI subsystem * Name: aclocal.h - Internal data types used across the ACPI subsystem
* $Revision: 179 $ * $Revision: 181 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -301,7 +301,6 @@ typedef struct ...@@ -301,7 +301,6 @@ typedef struct
typedef struct typedef struct
{ {
u8 address_space_id;
acpi_generic_address *block_address; acpi_generic_address *block_address;
u16 register_count; u16 register_count;
u8 block_base_number; u8 block_base_number;
...@@ -330,7 +329,7 @@ typedef struct ...@@ -330,7 +329,7 @@ typedef struct
typedef struct typedef struct
{ {
acpi_handle method_handle; /* Method handle for direct (fast) execution */ acpi_namespace_node *method_node; /* Method node for this GPE level */
acpi_gpe_handler handler; /* Address of handler, if any */ acpi_gpe_handler handler; /* Address of handler, if any */
void *context; /* Context to be passed to handler */ void *context; /* Context to be passed to handler */
u8 type; /* Level or Edge */ u8 type; /* Level or Edge */
......
...@@ -246,6 +246,14 @@ acpi_os_write_pci_configuration ( ...@@ -246,6 +246,14 @@ acpi_os_write_pci_configuration (
acpi_integer value, acpi_integer value,
u32 width); u32 width);
/*
* Interim function needed for PCI IRQ routing
*/
void
acpi_os_derive_pci_id(
acpi_handle rhandle,
acpi_handle chandle,
acpi_pci_id **pci_id);
/* /*
* Miscellaneous * Miscellaneous
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <asm/io.h> #include <asm/io.h>
#include "acpi_bus.h"
#include "acpi.h" #include "acpi.h"
#ifdef CONFIG_ACPI_EFI #ifdef CONFIG_ACPI_EFI
...@@ -483,6 +484,44 @@ acpi_os_write_pci_configuration ( ...@@ -483,6 +484,44 @@ acpi_os_write_pci_configuration (
return (result ? AE_ERROR : AE_OK); return (result ? AE_ERROR : AE_OK);
} }
/* TODO: Rewrite this code!!! */
void
acpi_os_derive_pci_id (
acpi_handle rhandle, /* upper bound */
acpi_handle chandle, /* current node */
acpi_pci_id **id)
{
acpi_handle handle;
acpi_pci_id *pci_id = *id;
acpi_status status;
unsigned long temp;
acpi_object_type type;
u8 tu8;
acpi_get_parent(chandle, &handle);
if (handle != rhandle) {
acpi_os_derive_pci_id(rhandle, handle, &pci_id);
status = acpi_get_type(handle, &type);
if ( (ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE) )
return;
status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &temp);
if (ACPI_SUCCESS(status)) {
pci_id->device = ACPI_HIWORD (ACPI_LODWORD (temp));
pci_id->function = ACPI_LOWORD (ACPI_LODWORD (temp));
/* any nicer way to get bus number of bridge ? */
status = acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8, 8);
if (ACPI_SUCCESS(status) && (tu8 & 0x7f) == 1) {
status = acpi_os_read_pci_configuration(pci_id, 0x19, &tu8, 8);
if (ACPI_SUCCESS(status))
pci_id->bus = tu8;
}
}
}
}
#else /*!CONFIG_ACPI_PCI*/ #else /*!CONFIG_ACPI_PCI*/
acpi_status acpi_status
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: psopcode - Parser/Interpreter opcode information table * Module Name: psopcode - Parser/Interpreter opcode information table
* $Revision: 73 $ * $Revision: 74 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -734,7 +734,7 @@ NATIVE_CHAR * ...@@ -734,7 +734,7 @@ NATIVE_CHAR *
acpi_ps_get_opcode_name ( acpi_ps_get_opcode_name (
u16 opcode) u16 opcode)
{ {
#ifdef ACPI_DISASSEMBLER #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
const acpi_opcode_info *op; const acpi_opcode_info *op;
......
/****************************************************************************** /******************************************************************************
* *
* Module Name: utcopy - Internal to external object translation utilities * Module Name: utcopy - Internal to external object translation utilities
* $Revision: 105 $ * $Revision: 106 $
* *
*****************************************************************************/ *****************************************************************************/
...@@ -419,7 +419,8 @@ acpi_ut_copy_esimple_to_isimple ( ...@@ -419,7 +419,8 @@ acpi_ut_copy_esimple_to_isimple (
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
internal_object->string.pointer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) external_object->string.length + 1); internal_object->string.pointer =
ACPI_MEM_CALLOCATE ((ACPI_SIZE) external_object->string.length + 1);
if (!internal_object->string.pointer) { if (!internal_object->string.pointer) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
...@@ -434,7 +435,8 @@ acpi_ut_copy_esimple_to_isimple ( ...@@ -434,7 +435,8 @@ acpi_ut_copy_esimple_to_isimple (
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
internal_object->buffer.pointer = ACPI_MEM_CALLOCATE (external_object->buffer.length); internal_object->buffer.pointer =
ACPI_MEM_CALLOCATE (external_object->buffer.length);
if (!internal_object->buffer.pointer) { if (!internal_object->buffer.pointer) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
...@@ -474,7 +476,7 @@ acpi_ut_copy_esimple_to_isimple ( ...@@ -474,7 +476,7 @@ acpi_ut_copy_esimple_to_isimple (
* *Buffer - Where the object is returned * *Buffer - Where the object is returned
* *Space_used - Where the length of the object is returned * *Space_used - Where the length of the object is returned
* *
* RETURN: Status - the status of the call * RETURN: Status
* *
* DESCRIPTION: This function is called to place a package object in a user * DESCRIPTION: This function is called to place a package object in a user
* buffer. A package object by definition contains other objects. * buffer. A package object by definition contains other objects.
...@@ -607,7 +609,8 @@ acpi_ut_copy_simple_object ( ...@@ -607,7 +609,8 @@ acpi_ut_copy_simple_object (
/* Copy the entire source object over the destination object*/ /* Copy the entire source object over the destination object*/
ACPI_MEMCPY ((char *) dest_desc, (char *) source_desc, sizeof (acpi_operand_object)); ACPI_MEMCPY ((char *) dest_desc, (char *) source_desc,
sizeof (acpi_operand_object));
/* Restore the saved fields */ /* Restore the saved fields */
...@@ -687,12 +690,16 @@ acpi_ut_copy_ielement_to_ielement ( ...@@ -687,12 +690,16 @@ acpi_ut_copy_ielement_to_ielement (
&state->pkg.dest_object->package.elements[this_index]; &state->pkg.dest_object->package.elements[this_index];
switch (object_type) { switch (object_type) {
case 0: case ACPI_COPY_TYPE_SIMPLE:
/* A null source object indicates a (legal) null package element */
if (source_object) {
/* /*
* This is a simple object, just copy it * This is a simple object, just copy it
*/ */
target_object = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (source_object)); target_object = acpi_ut_create_internal_object (
ACPI_GET_OBJECT_TYPE (source_object));
if (!target_object) { if (!target_object) {
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
...@@ -703,10 +710,16 @@ acpi_ut_copy_ielement_to_ielement ( ...@@ -703,10 +710,16 @@ acpi_ut_copy_ielement_to_ielement (
} }
*this_target_ptr = target_object; *this_target_ptr = target_object;
}
else {
/* Pass through a null element */
*this_target_ptr = NULL;
}
break; break;
case 1: case ACPI_COPY_TYPE_PACKAGE:
/* /*
* This object is a package - go down another nesting level * This object is a package - go down another nesting level
...@@ -720,6 +733,17 @@ acpi_ut_copy_ielement_to_ielement ( ...@@ -720,6 +733,17 @@ acpi_ut_copy_ielement_to_ielement (
target_object->package.count = source_object->package.count; target_object->package.count = source_object->package.count;
target_object->common.flags = source_object->common.flags; target_object->common.flags = source_object->common.flags;
/*
* Create the object array
*/
target_object->package.elements =
ACPI_MEM_CALLOCATE (((ACPI_SIZE) source_object->package.count + 1) *
sizeof (void *));
if (!target_object->package.elements) {
ACPI_MEM_FREE (target_object);
return (AE_NO_MEMORY);
}
/* /*
* Pass the new package object back to the package walk routine * Pass the new package object back to the package walk routine
*/ */
......
/******************************************************************************* /*******************************************************************************
* *
* Module Name: utmisc - common utility procedures * Module Name: utmisc - common utility procedures
* $Revision: 86 $ * $Revision: 87 $
* *
******************************************************************************/ ******************************************************************************/
...@@ -475,7 +475,6 @@ acpi_ut_strupr ( ...@@ -475,7 +475,6 @@ acpi_ut_strupr (
string++; string++;
} }
return (src_string); return (src_string);
} }
...@@ -575,7 +574,6 @@ acpi_ut_create_mutex ( ...@@ -575,7 +574,6 @@ acpi_ut_create_mutex (
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
if (!acpi_gbl_acpi_mutex_info[mutex_id].mutex) { if (!acpi_gbl_acpi_mutex_info[mutex_id].mutex) {
status = acpi_os_create_semaphore (1, 1, status = acpi_os_create_semaphore (1, 1,
&acpi_gbl_acpi_mutex_info[mutex_id].mutex); &acpi_gbl_acpi_mutex_info[mutex_id].mutex);
...@@ -613,7 +611,6 @@ acpi_ut_delete_mutex ( ...@@ -613,7 +611,6 @@ acpi_ut_delete_mutex (
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
status = acpi_os_delete_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex); status = acpi_os_delete_semaphore (acpi_gbl_acpi_mutex_info[mutex_id].mutex);
acpi_gbl_acpi_mutex_info[mutex_id].mutex = NULL; acpi_gbl_acpi_mutex_info[mutex_id].mutex = NULL;
...@@ -651,7 +648,6 @@ acpi_ut_acquire_mutex ( ...@@ -651,7 +648,6 @@ acpi_ut_acquire_mutex (
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
this_thread_id = acpi_os_get_thread_id (); this_thread_id = acpi_os_get_thread_id ();
/* /*
...@@ -679,7 +675,6 @@ acpi_ut_acquire_mutex ( ...@@ -679,7 +675,6 @@ acpi_ut_acquire_mutex (
} }
} }
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
"Thread %X attempting to acquire Mutex [%s]\n", "Thread %X attempting to acquire Mutex [%s]\n",
this_thread_id, acpi_ut_get_mutex_name (mutex_id))); this_thread_id, acpi_ut_get_mutex_name (mutex_id)));
...@@ -693,7 +688,6 @@ acpi_ut_acquire_mutex ( ...@@ -693,7 +688,6 @@ acpi_ut_acquire_mutex (
acpi_gbl_acpi_mutex_info[mutex_id].use_count++; acpi_gbl_acpi_mutex_info[mutex_id].use_count++;
acpi_gbl_acpi_mutex_info[mutex_id].owner_id = this_thread_id; acpi_gbl_acpi_mutex_info[mutex_id].owner_id = this_thread_id;
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n",
this_thread_id, acpi_ut_get_mutex_name (mutex_id), this_thread_id, acpi_ut_get_mutex_name (mutex_id),
...@@ -737,7 +731,6 @@ acpi_ut_release_mutex ( ...@@ -737,7 +731,6 @@ acpi_ut_release_mutex (
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
/* /*
* Mutex must be acquired in order to release it! * Mutex must be acquired in order to release it!
*/ */
...@@ -749,7 +742,6 @@ acpi_ut_release_mutex ( ...@@ -749,7 +742,6 @@ acpi_ut_release_mutex (
return (AE_NOT_ACQUIRED); return (AE_NOT_ACQUIRED);
} }
/* /*
* Deadlock prevention. Check if this thread owns any mutexes of value * Deadlock prevention. Check if this thread owns any mutexes of value
* greater than this one. If so, the thread has violated the mutex * greater than this one. If so, the thread has violated the mutex
...@@ -770,7 +762,6 @@ acpi_ut_release_mutex ( ...@@ -770,7 +762,6 @@ acpi_ut_release_mutex (
} }
} }
/* Mark unlocked FIRST */ /* Mark unlocked FIRST */
acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED; acpi_gbl_acpi_mutex_info[mutex_id].owner_id = ACPI_MUTEX_NOT_ACQUIRED;
...@@ -828,7 +819,6 @@ acpi_ut_create_update_state_and_push ( ...@@ -828,7 +819,6 @@ acpi_ut_create_update_state_and_push (
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
acpi_ut_push_generic_state (state_list, state); acpi_ut_push_generic_state (state_list, state);
return (AE_OK); return (AE_OK);
} }
...@@ -866,7 +856,6 @@ acpi_ut_create_pkg_state_and_push ( ...@@ -866,7 +856,6 @@ acpi_ut_create_pkg_state_and_push (
return (AE_NO_MEMORY); return (AE_NO_MEMORY);
} }
acpi_ut_push_generic_state (state_list, state); acpi_ut_push_generic_state (state_list, state);
return (AE_OK); return (AE_OK);
} }
...@@ -1129,7 +1118,6 @@ acpi_ut_create_control_state ( ...@@ -1129,7 +1118,6 @@ acpi_ut_create_control_state (
return_PTR (NULL); return_PTR (NULL);
} }
/* Init fields specific to the control struct */ /* Init fields specific to the control struct */
state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL;
...@@ -1224,6 +1212,8 @@ acpi_ut_walk_package_tree ( ...@@ -1224,6 +1212,8 @@ acpi_ut_walk_package_tree (
} }
while (state) { while (state) {
/* Get one element of the package */
this_index = state->pkg.index; this_index = state->pkg.index;
this_source_obj = (acpi_operand_object *) this_source_obj = (acpi_operand_object *)
state->pkg.source_object->package.elements[this_index]; state->pkg.source_object->package.elements[this_index];
...@@ -1324,6 +1314,7 @@ acpi_ut_generate_checksum ( ...@@ -1324,6 +1314,7 @@ acpi_ut_generate_checksum (
u32 i; u32 i;
signed char sum = 0; signed char sum = 0;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
sum = (signed char) (sum + buffer[i]); sum = (signed char) (sum + buffer[i]);
} }
......
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