aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dispatcher/dsobject.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-02-02 01:06:15 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-02 01:06:15 -0500
commit59ed2f59e4ea6a32f9591e378da7935f713a7000 (patch)
treea1276a611dbb1bc44685ef8af363e99603e60047 /drivers/acpi/dispatcher/dsobject.c
parent9ad11ab48b1ad618bf47076e9e579f267f5306c2 (diff)
parentb8e4d89357fc434618a59c1047cac72641191805 (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
Diffstat (limited to 'drivers/acpi/dispatcher/dsobject.c')
-rw-r--r--drivers/acpi/dispatcher/dsobject.c106
1 files changed, 64 insertions, 42 deletions
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c
index 8ac0cd93adb..8b21f0f9e51 100644
--- a/drivers/acpi/dispatcher/dsobject.c
+++ b/drivers/acpi/dispatcher/dsobject.c
@@ -5,7 +5,7 @@
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore 8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -51,6 +51,7 @@
51#define _COMPONENT ACPI_DISPATCHER 51#define _COMPONENT ACPI_DISPATCHER
52ACPI_MODULE_NAME("dsobject") 52ACPI_MODULE_NAME("dsobject")
53 53
54/* Local prototypes */
54static acpi_status 55static acpi_status
55acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, 56acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
56 union acpi_parse_object *op, 57 union acpi_parse_object *op,
@@ -85,7 +86,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
85 *obj_desc_ptr = NULL; 86 *obj_desc_ptr = NULL;
86 if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { 87 if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
87 /* 88 /*
88 * This is an named object reference. If this name was 89 * This is a named object reference. If this name was
89 * previously looked up in the namespace, it was stored in this op. 90 * previously looked up in the namespace, it was stored in this op.
90 * Otherwise, go ahead and look it up now 91 * Otherwise, go ahead and look it up now
91 */ 92 */
@@ -96,18 +97,48 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
96 ACPI_IMODE_EXECUTE, 97 ACPI_IMODE_EXECUTE,
97 ACPI_NS_SEARCH_PARENT | 98 ACPI_NS_SEARCH_PARENT |
98 ACPI_NS_DONT_OPEN_SCOPE, NULL, 99 ACPI_NS_DONT_OPEN_SCOPE, NULL,
99 (struct acpi_namespace_node **) 100 ACPI_CAST_INDIRECT_PTR(struct
100 &(op->common.node)); 101 acpi_namespace_node,
101 102 &(op->
103 common.
104 node)));
102 if (ACPI_FAILURE(status)) { 105 if (ACPI_FAILURE(status)) {
103 ACPI_REPORT_NSERROR(op->common.value.string, 106 /* Check if we are resolving a named reference within a package */
104 status); 107
108 if ((status == AE_NOT_FOUND)
109 && (acpi_gbl_enable_interpreter_slack)
110 &&
111 ((op->common.parent->common.aml_opcode ==
112 AML_PACKAGE_OP)
113 || (op->common.parent->common.aml_opcode ==
114 AML_VAR_PACKAGE_OP))) {
115 /*
116 * We didn't find the target and we are populating elements
117 * of a package - ignore if slack enabled. Some ASL code
118 * contains dangling invalid references in packages and
119 * expects that no exception will be issued. Leave the
120 * element as a null element. It cannot be used, but it
121 * can be overwritten by subsequent ASL code - this is
122 * typically the case.
123 */
124 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
125 "Ignoring unresolved reference in package [%4.4s]\n",
126 walk_state->
127 scope_info->scope.
128 node->name.ascii));
129
130 return_ACPI_STATUS(AE_OK);
131 } else {
132 ACPI_ERROR_NAMESPACE(op->common.value.
133 string, status);
134 }
135
105 return_ACPI_STATUS(status); 136 return_ACPI_STATUS(status);
106 } 137 }
107 } 138 }
108 } 139 }
109 140
110 /* Create and init the internal ACPI object */ 141 /* Create and init a new internal ACPI object */
111 142
112 obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info 143 obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info
113 (op->common.aml_opcode))-> 144 (op->common.aml_opcode))->
@@ -157,13 +188,13 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
157 188
158 ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); 189 ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj");
159 190
191 /*
192 * If we are evaluating a Named buffer object "Name (xxxx, Buffer)".
193 * The buffer object already exists (from the NS node), otherwise it must
194 * be created.
195 */
160 obj_desc = *obj_desc_ptr; 196 obj_desc = *obj_desc_ptr;
161 if (obj_desc) { 197 if (!obj_desc) {
162 /*
163 * We are evaluating a Named buffer object "Name (xxxx, Buffer)".
164 * The buffer object already exists (from the NS node)
165 */
166 } else {
167 /* Create a new buffer object */ 198 /* Create a new buffer object */
168 199
169 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); 200 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
@@ -183,10 +214,9 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
183 byte_list = arg->named.next; 214 byte_list = arg->named.next;
184 if (byte_list) { 215 if (byte_list) {
185 if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) { 216 if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
186 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 217 ACPI_ERROR((AE_INFO,
187 "Expecting bytelist, got AML opcode %X in op %p\n", 218 "Expecting bytelist, got AML opcode %X in op %p",
188 byte_list->common.aml_opcode, 219 byte_list->common.aml_opcode, byte_list));
189 byte_list));
190 220
191 acpi_ut_remove_reference(obj_desc); 221 acpi_ut_remove_reference(obj_desc);
192 return (AE_TYPE); 222 return (AE_TYPE);
@@ -259,7 +289,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
259 union acpi_operand_object *obj_desc = NULL; 289 union acpi_operand_object *obj_desc = NULL;
260 u32 package_list_length; 290 u32 package_list_length;
261 acpi_status status = AE_OK; 291 acpi_status status = AE_OK;
262 u32 i; 292 acpi_native_uint i;
263 293
264 ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); 294 ACPI_FUNCTION_TRACE("ds_build_internal_package_obj");
265 295
@@ -271,13 +301,12 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
271 parent = parent->common.parent; 301 parent = parent->common.parent;
272 } 302 }
273 303
304 /*
305 * If we are evaluating a Named package object "Name (xxxx, Package)",
306 * the package object already exists, otherwise it must be created.
307 */
274 obj_desc = *obj_desc_ptr; 308 obj_desc = *obj_desc_ptr;
275 if (obj_desc) { 309 if (!obj_desc) {
276 /*
277 * We are evaluating a Named package object "Name (xxxx, Package)".
278 * Get the existing package object from the NS node
279 */
280 } else {
281 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); 310 obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
282 *obj_desc_ptr = obj_desc; 311 *obj_desc_ptr = obj_desc;
283 if (!obj_desc) { 312 if (!obj_desc) {
@@ -291,11 +320,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
291 320
292 /* Count the number of items in the package list */ 321 /* Count the number of items in the package list */
293 322
294 package_list_length = 0;
295 arg = op->common.value.arg; 323 arg = op->common.value.arg;
296 arg = arg->common.next; 324 arg = arg->common.next;
297 while (arg) { 325 for (package_list_length = 0; arg; package_list_length++) {
298 package_list_length++;
299 arg = arg->common.next; 326 arg = arg->common.next;
300 } 327 }
301 328
@@ -322,12 +349,11 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
322 } 349 }
323 350
324 /* 351 /*
325 * Now init the elements of the package 352 * Initialize all elements of the package
326 */ 353 */
327 i = 0;
328 arg = op->common.value.arg; 354 arg = op->common.value.arg;
329 arg = arg->common.next; 355 arg = arg->common.next;
330 while (arg) { 356 for (i = 0; arg; i++) {
331 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { 357 if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
332 /* Object (package or buffer) is already built */ 358 /* Object (package or buffer) is already built */
333 359
@@ -340,8 +366,6 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
340 package. 366 package.
341 elements[i]); 367 elements[i]);
342 } 368 }
343
344 i++;
345 arg = arg->common.next; 369 arg = arg->common.next;
346 } 370 }
347 371
@@ -518,9 +542,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
518 542
519 default: 543 default:
520 544
521 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 545 ACPI_ERROR((AE_INFO,
522 "Unknown constant opcode %X\n", 546 "Unknown constant opcode %X",
523 opcode)); 547 opcode));
524 status = AE_AML_OPERAND_TYPE; 548 status = AE_AML_OPERAND_TYPE;
525 break; 549 break;
526 } 550 }
@@ -535,9 +559,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
535 break; 559 break;
536 560
537 default: 561 default:
538 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 562 ACPI_ERROR((AE_INFO, "Unknown Integer type %X",
539 "Unknown Integer type %X\n", 563 op_info->type));
540 op_info->type));
541 status = AE_AML_OPERAND_TYPE; 564 status = AE_AML_OPERAND_TYPE;
542 break; 565 break;
543 } 566 }
@@ -615,9 +638,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
615 638
616 default: 639 default:
617 640
618 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 641 ACPI_ERROR((AE_INFO, "Unimplemented data type: %X",
619 "Unimplemented data type: %X\n", 642 ACPI_GET_OBJECT_TYPE(obj_desc)));
620 ACPI_GET_OBJECT_TYPE(obj_desc)));
621 643
622 status = AE_AML_OPERAND_TYPE; 644 status = AE_AML_OPERAND_TYPE;
623 break; 645 break;