diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 14:52:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 14:52:52 -0400 |
commit | 08acd4f8af42affd8cbed81cc1b69fa12ddb213f (patch) | |
tree | 988d15db6233b20db6a500cd5f590c6d2041462d /drivers/acpi | |
parent | ccf2779544eecfcc5447e2028d1029b6d4ff7bb6 (diff) | |
parent | 008238b54ac2350babf195084ecedbcf7851a202 (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (179 commits)
ACPI: Fix acpi_processor_idle and idle= boot parameters interaction
acpi: fix section mismatch warning in pnpacpi
intel_menlo: fix build warning
ACPI: Cleanup: Remove unneeded, multiple local dummy variables
ACPI: video - fix permissions on some proc entries
ACPI: video - properly handle errors when registering proc elements
ACPI: video - do not store invalid entries in attached_array list
ACPI: re-name acpi_pm_ops to acpi_suspend_ops
ACER_WMI/ASUS_LAPTOP: fix build bug
thinkpad_acpi: fix possible NULL pointer dereference if kstrdup failed
ACPI: check a return value correctly in acpi_power_get_context()
#if 0 acpi/bay.c:eject_removable_drive()
eeepc-laptop: add hwmon fan control
eeepc-laptop: add backlight
eeepc-laptop: add base driver
ACPI: thinkpad-acpi: bump up version to 0.20
ACPI: thinkpad-acpi: fix selects in Kconfig
ACPI: thinkpad-acpi: use a private workqueue
ACPI: thinkpad-acpi: fluff really minor fix
ACPI: thinkpad-acpi: use uppercase for "LED" on user documentation
...
Fixed conflicts in drivers/acpi/video.c and drivers/misc/intel_menlow.c
manually.
Diffstat (limited to 'drivers/acpi')
121 files changed, 2580 insertions, 1626 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index b4f5e8542829..c52fca833268 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -140,6 +140,7 @@ config ACPI_VIDEO | |||
140 | tristate "Video" | 140 | tristate "Video" |
141 | depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL | 141 | depends on X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL |
142 | depends on INPUT | 142 | depends on INPUT |
143 | select THERMAL | ||
143 | help | 144 | help |
144 | This driver implement the ACPI Extensions For Display Adapters | 145 | This driver implement the ACPI Extensions For Display Adapters |
145 | for integrated graphics devices on motherboard, as specified in | 146 | for integrated graphics devices on motherboard, as specified in |
@@ -151,6 +152,7 @@ config ACPI_VIDEO | |||
151 | 152 | ||
152 | config ACPI_FAN | 153 | config ACPI_FAN |
153 | tristate "Fan" | 154 | tristate "Fan" |
155 | select THERMAL | ||
154 | default y | 156 | default y |
155 | help | 157 | help |
156 | This driver adds support for ACPI fan devices, allowing user-mode | 158 | This driver adds support for ACPI fan devices, allowing user-mode |
@@ -172,6 +174,7 @@ config ACPI_BAY | |||
172 | 174 | ||
173 | config ACPI_PROCESSOR | 175 | config ACPI_PROCESSOR |
174 | tristate "Processor" | 176 | tristate "Processor" |
177 | select THERMAL | ||
175 | default y | 178 | default y |
176 | help | 179 | help |
177 | This driver installs ACPI as the idle handler for Linux, and uses | 180 | This driver installs ACPI as the idle handler for Linux, and uses |
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c index 1fa86811b8ee..d2fc94161848 100644 --- a/drivers/acpi/bay.c +++ b/drivers/acpi/bay.c | |||
@@ -201,6 +201,7 @@ static int is_ejectable_bay(acpi_handle handle) | |||
201 | return 0; | 201 | return 0; |
202 | } | 202 | } |
203 | 203 | ||
204 | #if 0 | ||
204 | /** | 205 | /** |
205 | * eject_removable_drive - try to eject this drive | 206 | * eject_removable_drive - try to eject this drive |
206 | * @dev : the device structure of the drive | 207 | * @dev : the device structure of the drive |
@@ -225,6 +226,7 @@ int eject_removable_drive(struct device *dev) | |||
225 | return 0; | 226 | return 0; |
226 | } | 227 | } |
227 | EXPORT_SYMBOL_GPL(eject_removable_drive); | 228 | EXPORT_SYMBOL_GPL(eject_removable_drive); |
229 | #endif /* 0 */ | ||
228 | 230 | ||
229 | static int acpi_bay_add_fs(struct bay *bay) | 231 | static int acpi_bay_add_fs(struct bay *bay) |
230 | { | 232 | { |
diff --git a/drivers/acpi/dispatcher/dsfield.c b/drivers/acpi/dispatcher/dsfield.c index f049639bac35..c78078315be9 100644 --- a/drivers/acpi/dispatcher/dsfield.c +++ b/drivers/acpi/dispatcher/dsfield.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -89,12 +89,16 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, | |||
89 | 89 | ||
90 | ACPI_FUNCTION_TRACE(ds_create_buffer_field); | 90 | ACPI_FUNCTION_TRACE(ds_create_buffer_field); |
91 | 91 | ||
92 | /* Get the name_string argument */ | 92 | /* |
93 | 93 | * Get the name_string argument (name of the new buffer_field) | |
94 | */ | ||
94 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { | 95 | if (op->common.aml_opcode == AML_CREATE_FIELD_OP) { |
96 | |||
97 | /* For create_field, name is the 4th argument */ | ||
98 | |||
95 | arg = acpi_ps_get_arg(op, 3); | 99 | arg = acpi_ps_get_arg(op, 3); |
96 | } else { | 100 | } else { |
97 | /* Create Bit/Byte/Word/Dword field */ | 101 | /* For all other create_xXXField operators, name is the 3rd argument */ |
98 | 102 | ||
99 | arg = acpi_ps_get_arg(op, 2); | 103 | arg = acpi_ps_get_arg(op, 2); |
100 | } | 104 | } |
@@ -107,26 +111,30 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, | |||
107 | node = walk_state->deferred_node; | 111 | node = walk_state->deferred_node; |
108 | status = AE_OK; | 112 | status = AE_OK; |
109 | } else { | 113 | } else { |
110 | /* | 114 | /* Execute flag should always be set when this function is entered */ |
111 | * During the load phase, we want to enter the name of the field into | 115 | |
112 | * the namespace. During the execute phase (when we evaluate the size | 116 | if (!(walk_state->parse_flags & ACPI_PARSE_EXECUTE)) { |
113 | * operand), we want to lookup the name | 117 | return_ACPI_STATUS(AE_AML_INTERNAL); |
114 | */ | ||
115 | if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) { | ||
116 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE; | ||
117 | } else { | ||
118 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | | ||
119 | ACPI_NS_ERROR_IF_FOUND; | ||
120 | } | 118 | } |
121 | 119 | ||
122 | /* | 120 | /* Creating new namespace node, should not already exist */ |
123 | * Enter the name_string into the namespace | 121 | |
124 | */ | 122 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | |
123 | ACPI_NS_ERROR_IF_FOUND; | ||
124 | |||
125 | /* Mark node temporary if we are executing a method */ | ||
126 | |||
127 | if (walk_state->method_node) { | ||
128 | flags |= ACPI_NS_TEMPORARY; | ||
129 | } | ||
130 | |||
131 | /* Enter the name_string into the namespace */ | ||
132 | |||
125 | status = | 133 | status = |
126 | acpi_ns_lookup(walk_state->scope_info, | 134 | acpi_ns_lookup(walk_state->scope_info, |
127 | arg->common.value.string, ACPI_TYPE_ANY, | 135 | arg->common.value.string, ACPI_TYPE_ANY, |
128 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, | 136 | ACPI_IMODE_LOAD_PASS1, flags, walk_state, |
129 | &(node)); | 137 | &node); |
130 | if (ACPI_FAILURE(status)) { | 138 | if (ACPI_FAILURE(status)) { |
131 | ACPI_ERROR_NAMESPACE(arg->common.value.string, status); | 139 | ACPI_ERROR_NAMESPACE(arg->common.value.string, status); |
132 | return_ACPI_STATUS(status); | 140 | return_ACPI_STATUS(status); |
@@ -136,13 +144,13 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, | |||
136 | /* | 144 | /* |
137 | * We could put the returned object (Node) on the object stack for later, | 145 | * We could put the returned object (Node) on the object stack for later, |
138 | * but for now, we will put it in the "op" object that the parser uses, | 146 | * but for now, we will put it in the "op" object that the parser uses, |
139 | * so we can get it again at the end of this scope | 147 | * so we can get it again at the end of this scope. |
140 | */ | 148 | */ |
141 | op->common.node = node; | 149 | op->common.node = node; |
142 | 150 | ||
143 | /* | 151 | /* |
144 | * If there is no object attached to the node, this node was just created | 152 | * If there is no object attached to the node, this node was just created |
145 | * and we need to create the field object. Otherwise, this was a lookup | 153 | * and we need to create the field object. Otherwise, this was a lookup |
146 | * of an existing node and we don't want to create the field object again. | 154 | * of an existing node and we don't want to create the field object again. |
147 | */ | 155 | */ |
148 | obj_desc = acpi_ns_get_attached_object(node); | 156 | obj_desc = acpi_ns_get_attached_object(node); |
@@ -164,9 +172,8 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, | |||
164 | } | 172 | } |
165 | 173 | ||
166 | /* | 174 | /* |
167 | * Remember location in AML stream of the field unit | 175 | * Remember location in AML stream of the field unit opcode and operands -- |
168 | * opcode and operands -- since the buffer and index | 176 | * since the buffer and index operands must be evaluated. |
169 | * operands must be evaluated. | ||
170 | */ | 177 | */ |
171 | second_desc = obj_desc->common.next_object; | 178 | second_desc = obj_desc->common.next_object; |
172 | second_desc->extra.aml_start = op->named.data; | 179 | second_desc->extra.aml_start = op->named.data; |
@@ -261,7 +268,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
261 | 268 | ||
262 | case AML_INT_NAMEDFIELD_OP: | 269 | case AML_INT_NAMEDFIELD_OP: |
263 | 270 | ||
264 | /* Lookup the name */ | 271 | /* Lookup the name, it should already exist */ |
265 | 272 | ||
266 | status = acpi_ns_lookup(walk_state->scope_info, | 273 | status = acpi_ns_lookup(walk_state->scope_info, |
267 | (char *)&arg->named.name, | 274 | (char *)&arg->named.name, |
@@ -272,20 +279,23 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
272 | if (ACPI_FAILURE(status)) { | 279 | if (ACPI_FAILURE(status)) { |
273 | ACPI_ERROR_NAMESPACE((char *)&arg->named.name, | 280 | ACPI_ERROR_NAMESPACE((char *)&arg->named.name, |
274 | status); | 281 | status); |
275 | if (status != AE_ALREADY_EXISTS) { | 282 | return_ACPI_STATUS(status); |
276 | return_ACPI_STATUS(status); | ||
277 | } | ||
278 | |||
279 | /* Already exists, ignore error */ | ||
280 | } else { | 283 | } else { |
281 | arg->common.node = info->field_node; | 284 | arg->common.node = info->field_node; |
282 | info->field_bit_length = arg->common.value.size; | 285 | info->field_bit_length = arg->common.value.size; |
283 | 286 | ||
284 | /* Create and initialize an object for the new Field Node */ | 287 | /* |
285 | 288 | * If there is no object attached to the node, this node was | |
286 | status = acpi_ex_prep_field_value(info); | 289 | * just created and we need to create the field object. |
287 | if (ACPI_FAILURE(status)) { | 290 | * Otherwise, this was a lookup of an existing node and we |
288 | return_ACPI_STATUS(status); | 291 | * don't want to create the field object again. |
292 | */ | ||
293 | if (!acpi_ns_get_attached_object | ||
294 | (info->field_node)) { | ||
295 | status = acpi_ex_prep_field_value(info); | ||
296 | if (ACPI_FAILURE(status)) { | ||
297 | return_ACPI_STATUS(status); | ||
298 | } | ||
289 | } | 299 | } |
290 | } | 300 | } |
291 | 301 | ||
@@ -399,9 +409,27 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
399 | union acpi_parse_object *arg = NULL; | 409 | union acpi_parse_object *arg = NULL; |
400 | struct acpi_namespace_node *node; | 410 | struct acpi_namespace_node *node; |
401 | u8 type = 0; | 411 | u8 type = 0; |
412 | u32 flags; | ||
402 | 413 | ||
403 | ACPI_FUNCTION_TRACE_PTR(ds_init_field_objects, op); | 414 | ACPI_FUNCTION_TRACE_PTR(ds_init_field_objects, op); |
404 | 415 | ||
416 | /* Execute flag should always be set when this function is entered */ | ||
417 | |||
418 | if (!(walk_state->parse_flags & ACPI_PARSE_EXECUTE)) { | ||
419 | if (walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP) { | ||
420 | |||
421 | /* bank_field Op is deferred, just return OK */ | ||
422 | |||
423 | return_ACPI_STATUS(AE_OK); | ||
424 | } | ||
425 | |||
426 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
427 | } | ||
428 | |||
429 | /* | ||
430 | * Get the field_list argument for this opcode. This is the start of the | ||
431 | * list of field elements. | ||
432 | */ | ||
405 | switch (walk_state->opcode) { | 433 | switch (walk_state->opcode) { |
406 | case AML_FIELD_OP: | 434 | case AML_FIELD_OP: |
407 | arg = acpi_ps_get_arg(op, 2); | 435 | arg = acpi_ps_get_arg(op, 2); |
@@ -422,20 +450,33 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
422 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 450 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
423 | } | 451 | } |
424 | 452 | ||
453 | if (!arg) { | ||
454 | return_ACPI_STATUS(AE_AML_NO_OPERAND); | ||
455 | } | ||
456 | |||
457 | /* Creating new namespace node(s), should not already exist */ | ||
458 | |||
459 | flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | | ||
460 | ACPI_NS_ERROR_IF_FOUND; | ||
461 | |||
462 | /* Mark node(s) temporary if we are executing a method */ | ||
463 | |||
464 | if (walk_state->method_node) { | ||
465 | flags |= ACPI_NS_TEMPORARY; | ||
466 | } | ||
467 | |||
425 | /* | 468 | /* |
426 | * Walk the list of entries in the field_list | 469 | * Walk the list of entries in the field_list |
427 | */ | 470 | */ |
428 | while (arg) { | 471 | while (arg) { |
429 | 472 | /* | |
430 | /* Ignore OFFSET and ACCESSAS terms here */ | 473 | * Ignore OFFSET and ACCESSAS terms here; we are only interested in the |
431 | 474 | * field names in order to enter them into the namespace. | |
475 | */ | ||
432 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { | 476 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { |
433 | status = acpi_ns_lookup(walk_state->scope_info, | 477 | status = acpi_ns_lookup(walk_state->scope_info, |
434 | (char *)&arg->named.name, | 478 | (char *)&arg->named.name, type, |
435 | type, ACPI_IMODE_LOAD_PASS1, | 479 | ACPI_IMODE_LOAD_PASS1, flags, |
436 | ACPI_NS_NO_UPSEARCH | | ||
437 | ACPI_NS_DONT_OPEN_SCOPE | | ||
438 | ACPI_NS_ERROR_IF_FOUND, | ||
439 | walk_state, &node); | 480 | walk_state, &node); |
440 | if (ACPI_FAILURE(status)) { | 481 | if (ACPI_FAILURE(status)) { |
441 | ACPI_ERROR_NAMESPACE((char *)&arg->named.name, | 482 | ACPI_ERROR_NAMESPACE((char *)&arg->named.name, |
@@ -452,7 +493,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
452 | arg->common.node = node; | 493 | arg->common.node = node; |
453 | } | 494 | } |
454 | 495 | ||
455 | /* Move to next field in the list */ | 496 | /* Get the next field element in the list */ |
456 | 497 | ||
457 | arg = arg->common.next; | 498 | arg = arg->common.next; |
458 | } | 499 | } |
@@ -466,7 +507,7 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
466 | * | 507 | * |
467 | * PARAMETERS: Op - Op containing the Field definition and args | 508 | * PARAMETERS: Op - Op containing the Field definition and args |
468 | * region_node - Object for the containing Operation Region | 509 | * region_node - Object for the containing Operation Region |
469 | * ` walk_state - Current method state | 510 | * walk_state - Current method state |
470 | * | 511 | * |
471 | * RETURN: Status | 512 | * RETURN: Status |
472 | * | 513 | * |
@@ -513,36 +554,13 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, | |||
513 | return_ACPI_STATUS(status); | 554 | return_ACPI_STATUS(status); |
514 | } | 555 | } |
515 | 556 | ||
516 | /* Third arg is the bank_value */ | 557 | /* |
517 | 558 | * Third arg is the bank_value | |
518 | /* TBD: This arg is a term_arg, not a constant, and must be evaluated */ | 559 | * This arg is a term_arg, not a constant |
519 | 560 | * It will be evaluated later, by acpi_ds_eval_bank_field_operands | |
561 | */ | ||
520 | arg = arg->common.next; | 562 | arg = arg->common.next; |
521 | 563 | ||
522 | /* Currently, only the following constants are supported */ | ||
523 | |||
524 | switch (arg->common.aml_opcode) { | ||
525 | case AML_ZERO_OP: | ||
526 | info.bank_value = 0; | ||
527 | break; | ||
528 | |||
529 | case AML_ONE_OP: | ||
530 | info.bank_value = 1; | ||
531 | break; | ||
532 | |||
533 | case AML_BYTE_OP: | ||
534 | case AML_WORD_OP: | ||
535 | case AML_DWORD_OP: | ||
536 | case AML_QWORD_OP: | ||
537 | info.bank_value = (u32) arg->common.value.integer; | ||
538 | break; | ||
539 | |||
540 | default: | ||
541 | info.bank_value = 0; | ||
542 | ACPI_ERROR((AE_INFO, | ||
543 | "Non-constant BankValue for BankField is not implemented")); | ||
544 | } | ||
545 | |||
546 | /* Fourth arg is the field flags */ | 564 | /* Fourth arg is the field flags */ |
547 | 565 | ||
548 | arg = arg->common.next; | 566 | arg = arg->common.next; |
@@ -553,8 +571,17 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, | |||
553 | info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD; | 571 | info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD; |
554 | info.region_node = region_node; | 572 | info.region_node = region_node; |
555 | 573 | ||
556 | status = acpi_ds_get_field_names(&info, walk_state, arg->common.next); | 574 | /* |
575 | * Use Info.data_register_node to store bank_field Op | ||
576 | * It's safe because data_register_node will never be used when create bank field | ||
577 | * We store aml_start and aml_length in the bank_field Op for late evaluation | ||
578 | * Used in acpi_ex_prep_field_value(Info) | ||
579 | * | ||
580 | * TBD: Or, should we add a field in struct acpi_create_field_info, like "void *ParentOp"? | ||
581 | */ | ||
582 | info.data_register_node = (struct acpi_namespace_node *)op; | ||
557 | 583 | ||
584 | status = acpi_ds_get_field_names(&info, walk_state, arg->common.next); | ||
558 | return_ACPI_STATUS(status); | 585 | return_ACPI_STATUS(status); |
559 | } | 586 | } |
560 | 587 | ||
diff --git a/drivers/acpi/dispatcher/dsinit.c b/drivers/acpi/dispatcher/dsinit.c index af923c388520..610b1ee102b0 100644 --- a/drivers/acpi/dispatcher/dsinit.c +++ b/drivers/acpi/dispatcher/dsinit.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 1cbe61905824..e48a3ea03117 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -42,7 +42,6 @@ | |||
42 | */ | 42 | */ |
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/acparser.h> | ||
46 | #include <acpi/amlcode.h> | 45 | #include <acpi/amlcode.h> |
47 | #include <acpi/acdispat.h> | 46 | #include <acpi/acdispat.h> |
48 | #include <acpi/acinterp.h> | 47 | #include <acpi/acinterp.h> |
@@ -102,7 +101,7 @@ acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state) | |||
102 | walk_state->opcode, | 101 | walk_state->opcode, |
103 | walk_state->aml_offset, | 102 | walk_state->aml_offset, |
104 | NULL); | 103 | NULL); |
105 | (void)acpi_ex_enter_interpreter(); | 104 | acpi_ex_enter_interpreter(); |
106 | } | 105 | } |
107 | #ifdef ACPI_DISASSEMBLER | 106 | #ifdef ACPI_DISASSEMBLER |
108 | if (ACPI_FAILURE(status)) { | 107 | if (ACPI_FAILURE(status)) { |
@@ -232,9 +231,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
232 | * recursive call. | 231 | * recursive call. |
233 | */ | 232 | */ |
234 | if (!walk_state || | 233 | if (!walk_state || |
235 | !obj_desc->method.mutex->mutex.owner_thread || | 234 | !obj_desc->method.mutex->mutex.thread_id || |
236 | (walk_state->thread != | 235 | (walk_state->thread->thread_id != |
237 | obj_desc->method.mutex->mutex.owner_thread)) { | 236 | obj_desc->method.mutex->mutex.thread_id)) { |
238 | /* | 237 | /* |
239 | * Acquire the method mutex. This releases the interpreter if we | 238 | * Acquire the method mutex. This releases the interpreter if we |
240 | * block (and reacquires it before it returns) | 239 | * block (and reacquires it before it returns) |
@@ -254,8 +253,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
254 | original_sync_level = | 253 | original_sync_level = |
255 | walk_state->thread->current_sync_level; | 254 | walk_state->thread->current_sync_level; |
256 | 255 | ||
257 | obj_desc->method.mutex->mutex.owner_thread = | 256 | obj_desc->method.mutex->mutex.thread_id = |
258 | walk_state->thread; | 257 | walk_state->thread->thread_id; |
259 | walk_state->thread->current_sync_level = | 258 | walk_state->thread->current_sync_level = |
260 | obj_desc->method.sync_level; | 259 | obj_desc->method.sync_level; |
261 | } else { | 260 | } else { |
@@ -535,8 +534,6 @@ void | |||
535 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | 534 | acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, |
536 | struct acpi_walk_state *walk_state) | 535 | struct acpi_walk_state *walk_state) |
537 | { | 536 | { |
538 | struct acpi_namespace_node *method_node; | ||
539 | acpi_status status; | ||
540 | 537 | ||
541 | ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); | 538 | ACPI_FUNCTION_TRACE_PTR(ds_terminate_control_method, walk_state); |
542 | 539 | ||
@@ -551,34 +548,26 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
551 | /* Delete all arguments and locals */ | 548 | /* Delete all arguments and locals */ |
552 | 549 | ||
553 | acpi_ds_method_data_delete_all(walk_state); | 550 | acpi_ds_method_data_delete_all(walk_state); |
554 | } | ||
555 | 551 | ||
556 | /* | 552 | /* |
557 | * If method is serialized, release the mutex and restore the | 553 | * If method is serialized, release the mutex and restore the |
558 | * current sync level for this thread | 554 | * current sync level for this thread |
559 | */ | 555 | */ |
560 | if (method_desc->method.mutex) { | 556 | if (method_desc->method.mutex) { |
561 | 557 | ||
562 | /* Acquisition Depth handles recursive calls */ | 558 | /* Acquisition Depth handles recursive calls */ |
563 | 559 | ||
564 | method_desc->method.mutex->mutex.acquisition_depth--; | 560 | method_desc->method.mutex->mutex.acquisition_depth--; |
565 | if (!method_desc->method.mutex->mutex.acquisition_depth) { | 561 | if (!method_desc->method.mutex->mutex.acquisition_depth) { |
566 | walk_state->thread->current_sync_level = | 562 | walk_state->thread->current_sync_level = |
567 | method_desc->method.mutex->mutex. | 563 | method_desc->method.mutex->mutex. |
568 | original_sync_level; | 564 | original_sync_level; |
569 | 565 | ||
570 | acpi_os_release_mutex(method_desc->method.mutex->mutex. | 566 | acpi_os_release_mutex(method_desc->method. |
571 | os_mutex); | 567 | mutex->mutex.os_mutex); |
572 | method_desc->method.mutex->mutex.owner_thread = NULL; | 568 | method_desc->method.mutex->mutex.thread_id = 0; |
569 | } | ||
573 | } | 570 | } |
574 | } | ||
575 | |||
576 | if (walk_state) { | ||
577 | /* | ||
578 | * Delete any objects created by this method during execution. | ||
579 | * The method Node is stored in the walk state | ||
580 | */ | ||
581 | method_node = walk_state->method_node; | ||
582 | 571 | ||
583 | /* | 572 | /* |
584 | * Delete any namespace objects created anywhere within | 573 | * Delete any namespace objects created anywhere within |
@@ -620,7 +609,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
620 | */ | 609 | */ |
621 | if ((method_desc->method.method_flags & AML_METHOD_SERIALIZED) | 610 | if ((method_desc->method.method_flags & AML_METHOD_SERIALIZED) |
622 | && (!method_desc->method.mutex)) { | 611 | && (!method_desc->method.mutex)) { |
623 | status = acpi_ds_create_method_mutex(method_desc); | 612 | (void)acpi_ds_create_method_mutex(method_desc); |
624 | } | 613 | } |
625 | 614 | ||
626 | /* No more threads, we can free the owner_id */ | 615 | /* No more threads, we can free the owner_id */ |
diff --git a/drivers/acpi/dispatcher/dsmthdat.c b/drivers/acpi/dispatcher/dsmthdat.c index ba4626e06a5e..13c43eac35db 100644 --- a/drivers/acpi/dispatcher/dsmthdat.c +++ b/drivers/acpi/dispatcher/dsmthdat.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/dispatcher/dsobject.c b/drivers/acpi/dispatcher/dsobject.c index 954ac8ce958a..1022e38994c2 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 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -157,7 +157,9 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
157 | * will remain as named references. This behavior is not described | 157 | * will remain as named references. This behavior is not described |
158 | * in the ACPI spec, but it appears to be an oversight. | 158 | * in the ACPI spec, but it appears to be an oversight. |
159 | */ | 159 | */ |
160 | obj_desc = (union acpi_operand_object *)op->common.node; | 160 | obj_desc = |
161 | ACPI_CAST_PTR(union acpi_operand_object, | ||
162 | op->common.node); | ||
161 | 163 | ||
162 | status = | 164 | status = |
163 | acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR | 165 | acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR |
@@ -172,7 +174,19 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
172 | switch (op->common.node->type) { | 174 | switch (op->common.node->type) { |
173 | /* | 175 | /* |
174 | * For these types, we need the actual node, not the subobject. | 176 | * For these types, we need the actual node, not the subobject. |
175 | * However, the subobject got an extra reference count above. | 177 | * However, the subobject did not get an extra reference count above. |
178 | * | ||
179 | * TBD: should ex_resolve_node_to_value be changed to fix this? | ||
180 | */ | ||
181 | case ACPI_TYPE_DEVICE: | ||
182 | case ACPI_TYPE_THERMAL: | ||
183 | |||
184 | acpi_ut_add_reference(op->common.node->object); | ||
185 | |||
186 | /*lint -fallthrough */ | ||
187 | /* | ||
188 | * For these types, we need the actual node, not the subobject. | ||
189 | * The subobject got an extra reference count in ex_resolve_node_to_value. | ||
176 | */ | 190 | */ |
177 | case ACPI_TYPE_MUTEX: | 191 | case ACPI_TYPE_MUTEX: |
178 | case ACPI_TYPE_METHOD: | 192 | case ACPI_TYPE_METHOD: |
@@ -180,25 +194,15 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
180 | case ACPI_TYPE_PROCESSOR: | 194 | case ACPI_TYPE_PROCESSOR: |
181 | case ACPI_TYPE_EVENT: | 195 | case ACPI_TYPE_EVENT: |
182 | case ACPI_TYPE_REGION: | 196 | case ACPI_TYPE_REGION: |
183 | case ACPI_TYPE_DEVICE: | ||
184 | case ACPI_TYPE_THERMAL: | ||
185 | 197 | ||
186 | obj_desc = | 198 | /* We will create a reference object for these types below */ |
187 | (union acpi_operand_object *)op->common. | ||
188 | node; | ||
189 | break; | 199 | break; |
190 | 200 | ||
191 | default: | 201 | default: |
192 | break; | 202 | /* |
193 | } | 203 | * All other types - the node was resolved to an actual |
194 | 204 | * object, we are done. | |
195 | /* | 205 | */ |
196 | * If above resolved to an operand object, we are done. Otherwise, | ||
197 | * we have a NS node, we must create the package entry as a named | ||
198 | * reference. | ||
199 | */ | ||
200 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != | ||
201 | ACPI_DESC_TYPE_NAMED) { | ||
202 | goto exit; | 206 | goto exit; |
203 | } | 207 | } |
204 | } | 208 | } |
@@ -223,7 +227,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, | |||
223 | 227 | ||
224 | exit: | 228 | exit: |
225 | *obj_desc_ptr = obj_desc; | 229 | *obj_desc_ptr = obj_desc; |
226 | return_ACPI_STATUS(AE_OK); | 230 | return_ACPI_STATUS(status); |
227 | } | 231 | } |
228 | 232 | ||
229 | /******************************************************************************* | 233 | /******************************************************************************* |
@@ -369,7 +373,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
369 | union acpi_parse_object *parent; | 373 | union acpi_parse_object *parent; |
370 | union acpi_operand_object *obj_desc = NULL; | 374 | union acpi_operand_object *obj_desc = NULL; |
371 | acpi_status status = AE_OK; | 375 | acpi_status status = AE_OK; |
372 | acpi_native_uint i; | 376 | unsigned i; |
377 | u16 index; | ||
378 | u16 reference_count; | ||
373 | 379 | ||
374 | ACPI_FUNCTION_TRACE(ds_build_internal_package_obj); | 380 | ACPI_FUNCTION_TRACE(ds_build_internal_package_obj); |
375 | 381 | ||
@@ -447,13 +453,60 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, | |||
447 | package. | 453 | package. |
448 | elements[i]); | 454 | elements[i]); |
449 | } | 455 | } |
456 | |||
457 | if (*obj_desc_ptr) { | ||
458 | |||
459 | /* Existing package, get existing reference count */ | ||
460 | |||
461 | reference_count = | ||
462 | (*obj_desc_ptr)->common.reference_count; | ||
463 | if (reference_count > 1) { | ||
464 | |||
465 | /* Make new element ref count match original ref count */ | ||
466 | |||
467 | for (index = 0; index < (reference_count - 1); | ||
468 | index++) { | ||
469 | acpi_ut_add_reference((obj_desc-> | ||
470 | package. | ||
471 | elements[i])); | ||
472 | } | ||
473 | } | ||
474 | } | ||
475 | |||
450 | arg = arg->common.next; | 476 | arg = arg->common.next; |
451 | } | 477 | } |
452 | 478 | ||
453 | if (!arg) { | 479 | /* Check for match between num_elements and actual length of package_list */ |
480 | |||
481 | if (arg) { | ||
482 | /* | ||
483 | * num_elements was exhausted, but there are remaining elements in the | ||
484 | * package_list. | ||
485 | * | ||
486 | * Note: technically, this is an error, from ACPI spec: "It is an error | ||
487 | * for NumElements to be less than the number of elements in the | ||
488 | * PackageList". However, for now, we just print an error message and | ||
489 | * no exception is returned. | ||
490 | */ | ||
491 | while (arg) { | ||
492 | |||
493 | /* Find out how many elements there really are */ | ||
494 | |||
495 | i++; | ||
496 | arg = arg->common.next; | ||
497 | } | ||
498 | |||
499 | ACPI_ERROR((AE_INFO, | ||
500 | "Package List length (%X) larger than NumElements count (%X), truncated\n", | ||
501 | i, element_count)); | ||
502 | } else if (i < element_count) { | ||
503 | /* | ||
504 | * Arg list (elements) was exhausted, but we did not reach num_elements count. | ||
505 | * Note: this is not an error, the package is padded out with NULLs. | ||
506 | */ | ||
454 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 507 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
455 | "Package List length larger than NumElements count (%X), truncated\n", | 508 | "Package List length (%X) smaller than NumElements count (%X), padded with null elements\n", |
456 | element_count)); | 509 | i, element_count)); |
457 | } | 510 | } |
458 | 511 | ||
459 | obj_desc->package.flags |= AOPOBJ_DATA_VALID; | 512 | obj_desc->package.flags |= AOPOBJ_DATA_VALID; |
@@ -721,6 +774,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state, | |||
721 | /* Node was saved in Op */ | 774 | /* Node was saved in Op */ |
722 | 775 | ||
723 | obj_desc->reference.node = op->common.node; | 776 | obj_desc->reference.node = op->common.node; |
777 | obj_desc->reference.object = | ||
778 | op->common.node->object; | ||
724 | } | 779 | } |
725 | 780 | ||
726 | obj_desc->reference.opcode = opcode; | 781 | obj_desc->reference.opcode = opcode; |
diff --git a/drivers/acpi/dispatcher/dsopcode.c b/drivers/acpi/dispatcher/dsopcode.c index f501e083aac7..a818e0ddb996 100644 --- a/drivers/acpi/dispatcher/dsopcode.c +++ b/drivers/acpi/dispatcher/dsopcode.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -49,6 +49,7 @@ | |||
49 | #include <acpi/acinterp.h> | 49 | #include <acpi/acinterp.h> |
50 | #include <acpi/acnamesp.h> | 50 | #include <acpi/acnamesp.h> |
51 | #include <acpi/acevents.h> | 51 | #include <acpi/acevents.h> |
52 | #include <acpi/actables.h> | ||
52 | 53 | ||
53 | #define _COMPONENT ACPI_DISPATCHER | 54 | #define _COMPONENT ACPI_DISPATCHER |
54 | ACPI_MODULE_NAME("dsopcode") | 55 | ACPI_MODULE_NAME("dsopcode") |
@@ -219,6 +220,50 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | |||
219 | 220 | ||
220 | /******************************************************************************* | 221 | /******************************************************************************* |
221 | * | 222 | * |
223 | * FUNCTION: acpi_ds_get_bank_field_arguments | ||
224 | * | ||
225 | * PARAMETERS: obj_desc - A valid bank_field object | ||
226 | * | ||
227 | * RETURN: Status. | ||
228 | * | ||
229 | * DESCRIPTION: Get bank_field bank_value. This implements the late | ||
230 | * evaluation of these field attributes. | ||
231 | * | ||
232 | ******************************************************************************/ | ||
233 | |||
234 | acpi_status | ||
235 | acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc) | ||
236 | { | ||
237 | union acpi_operand_object *extra_desc; | ||
238 | struct acpi_namespace_node *node; | ||
239 | acpi_status status; | ||
240 | |||
241 | ACPI_FUNCTION_TRACE_PTR(ds_get_bank_field_arguments, obj_desc); | ||
242 | |||
243 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | ||
244 | return_ACPI_STATUS(AE_OK); | ||
245 | } | ||
246 | |||
247 | /* Get the AML pointer (method object) and bank_field node */ | ||
248 | |||
249 | extra_desc = acpi_ns_get_secondary_object(obj_desc); | ||
250 | node = obj_desc->bank_field.node; | ||
251 | |||
252 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | ||
253 | (ACPI_TYPE_LOCAL_BANK_FIELD, node, NULL)); | ||
254 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", | ||
255 | acpi_ut_get_node_name(node))); | ||
256 | |||
257 | /* Execute the AML code for the term_arg arguments */ | ||
258 | |||
259 | status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), | ||
260 | extra_desc->extra.aml_length, | ||
261 | extra_desc->extra.aml_start); | ||
262 | return_ACPI_STATUS(status); | ||
263 | } | ||
264 | |||
265 | /******************************************************************************* | ||
266 | * | ||
222 | * FUNCTION: acpi_ds_get_buffer_arguments | 267 | * FUNCTION: acpi_ds_get_buffer_arguments |
223 | * | 268 | * |
224 | * PARAMETERS: obj_desc - A valid Buffer object | 269 | * PARAMETERS: obj_desc - A valid Buffer object |
@@ -770,7 +815,109 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
770 | 815 | ||
771 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", | 816 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", |
772 | obj_desc, | 817 | obj_desc, |
773 | ACPI_FORMAT_UINT64(obj_desc->region.address), | 818 | ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), |
819 | obj_desc->region.length)); | ||
820 | |||
821 | /* Now the address and length are valid for this opregion */ | ||
822 | |||
823 | obj_desc->region.flags |= AOPOBJ_DATA_VALID; | ||
824 | |||
825 | return_ACPI_STATUS(status); | ||
826 | } | ||
827 | |||
828 | /******************************************************************************* | ||
829 | * | ||
830 | * FUNCTION: acpi_ds_eval_table_region_operands | ||
831 | * | ||
832 | * PARAMETERS: walk_state - Current walk | ||
833 | * Op - A valid region Op object | ||
834 | * | ||
835 | * RETURN: Status | ||
836 | * | ||
837 | * DESCRIPTION: Get region address and length | ||
838 | * Called from acpi_ds_exec_end_op during data_table_region parse tree walk | ||
839 | * | ||
840 | ******************************************************************************/ | ||
841 | |||
842 | acpi_status | ||
843 | acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, | ||
844 | union acpi_parse_object *op) | ||
845 | { | ||
846 | acpi_status status; | ||
847 | union acpi_operand_object *obj_desc; | ||
848 | union acpi_operand_object **operand; | ||
849 | struct acpi_namespace_node *node; | ||
850 | union acpi_parse_object *next_op; | ||
851 | acpi_native_uint table_index; | ||
852 | struct acpi_table_header *table; | ||
853 | |||
854 | ACPI_FUNCTION_TRACE_PTR(ds_eval_table_region_operands, op); | ||
855 | |||
856 | /* | ||
857 | * This is where we evaluate the signature_string and oem_iDString | ||
858 | * and oem_table_iDString of the data_table_region declaration | ||
859 | */ | ||
860 | node = op->common.node; | ||
861 | |||
862 | /* next_op points to signature_string op */ | ||
863 | |||
864 | next_op = op->common.value.arg; | ||
865 | |||
866 | /* | ||
867 | * Evaluate/create the signature_string and oem_iDString | ||
868 | * and oem_table_iDString operands | ||
869 | */ | ||
870 | status = acpi_ds_create_operands(walk_state, next_op); | ||
871 | if (ACPI_FAILURE(status)) { | ||
872 | return_ACPI_STATUS(status); | ||
873 | } | ||
874 | |||
875 | /* | ||
876 | * Resolve the signature_string and oem_iDString | ||
877 | * and oem_table_iDString operands | ||
878 | */ | ||
879 | status = acpi_ex_resolve_operands(op->common.aml_opcode, | ||
880 | ACPI_WALK_OPERANDS, walk_state); | ||
881 | if (ACPI_FAILURE(status)) { | ||
882 | return_ACPI_STATUS(status); | ||
883 | } | ||
884 | |||
885 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | ||
886 | acpi_ps_get_opcode_name(op->common.aml_opcode), | ||
887 | 1, "after AcpiExResolveOperands"); | ||
888 | |||
889 | operand = &walk_state->operands[0]; | ||
890 | |||
891 | /* Find the ACPI table */ | ||
892 | |||
893 | status = acpi_tb_find_table(operand[0]->string.pointer, | ||
894 | operand[1]->string.pointer, | ||
895 | operand[2]->string.pointer, &table_index); | ||
896 | if (ACPI_FAILURE(status)) { | ||
897 | return_ACPI_STATUS(status); | ||
898 | } | ||
899 | |||
900 | acpi_ut_remove_reference(operand[0]); | ||
901 | acpi_ut_remove_reference(operand[1]); | ||
902 | acpi_ut_remove_reference(operand[2]); | ||
903 | |||
904 | status = acpi_get_table_by_index(table_index, &table); | ||
905 | if (ACPI_FAILURE(status)) { | ||
906 | return_ACPI_STATUS(status); | ||
907 | } | ||
908 | |||
909 | obj_desc = acpi_ns_get_attached_object(node); | ||
910 | if (!obj_desc) { | ||
911 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
912 | } | ||
913 | |||
914 | obj_desc->region.address = | ||
915 | (acpi_physical_address) ACPI_TO_INTEGER(table); | ||
916 | obj_desc->region.length = table->length; | ||
917 | |||
918 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n", | ||
919 | obj_desc, | ||
920 | ACPI_FORMAT_NATIVE_UINT(obj_desc->region.address), | ||
774 | obj_desc->region.length)); | 921 | obj_desc->region.length)); |
775 | 922 | ||
776 | /* Now the address and length are valid for this opregion */ | 923 | /* Now the address and length are valid for this opregion */ |
@@ -808,6 +955,12 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, | |||
808 | 955 | ||
809 | /* The first operand (for all of these data objects) is the length */ | 956 | /* The first operand (for all of these data objects) is the length */ |
810 | 957 | ||
958 | /* | ||
959 | * Set proper index into operand stack for acpi_ds_obj_stack_push | ||
960 | * invoked inside acpi_ds_create_operand. | ||
961 | */ | ||
962 | walk_state->operand_index = walk_state->num_operands; | ||
963 | |||
811 | status = acpi_ds_create_operand(walk_state, op->common.value.arg, 1); | 964 | status = acpi_ds_create_operand(walk_state, op->common.value.arg, 1); |
812 | if (ACPI_FAILURE(status)) { | 965 | if (ACPI_FAILURE(status)) { |
813 | return_ACPI_STATUS(status); | 966 | return_ACPI_STATUS(status); |
@@ -878,6 +1031,106 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state, | |||
878 | 1031 | ||
879 | /******************************************************************************* | 1032 | /******************************************************************************* |
880 | * | 1033 | * |
1034 | * FUNCTION: acpi_ds_eval_bank_field_operands | ||
1035 | * | ||
1036 | * PARAMETERS: walk_state - Current walk | ||
1037 | * Op - A valid bank_field Op object | ||
1038 | * | ||
1039 | * RETURN: Status | ||
1040 | * | ||
1041 | * DESCRIPTION: Get bank_field bank_value | ||
1042 | * Called from acpi_ds_exec_end_op during bank_field parse tree walk | ||
1043 | * | ||
1044 | ******************************************************************************/ | ||
1045 | |||
1046 | acpi_status | ||
1047 | acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state, | ||
1048 | union acpi_parse_object *op) | ||
1049 | { | ||
1050 | acpi_status status; | ||
1051 | union acpi_operand_object *obj_desc; | ||
1052 | union acpi_operand_object *operand_desc; | ||
1053 | struct acpi_namespace_node *node; | ||
1054 | union acpi_parse_object *next_op; | ||
1055 | union acpi_parse_object *arg; | ||
1056 | |||
1057 | ACPI_FUNCTION_TRACE_PTR(ds_eval_bank_field_operands, op); | ||
1058 | |||
1059 | /* | ||
1060 | * This is where we evaluate the bank_value field of the | ||
1061 | * bank_field declaration | ||
1062 | */ | ||
1063 | |||
1064 | /* next_op points to the op that holds the Region */ | ||
1065 | |||
1066 | next_op = op->common.value.arg; | ||
1067 | |||
1068 | /* next_op points to the op that holds the Bank Register */ | ||
1069 | |||
1070 | next_op = next_op->common.next; | ||
1071 | |||
1072 | /* next_op points to the op that holds the Bank Value */ | ||
1073 | |||
1074 | next_op = next_op->common.next; | ||
1075 | |||
1076 | /* | ||
1077 | * Set proper index into operand stack for acpi_ds_obj_stack_push | ||
1078 | * invoked inside acpi_ds_create_operand. | ||
1079 | * | ||
1080 | * We use walk_state->Operands[0] to store the evaluated bank_value | ||
1081 | */ | ||
1082 | walk_state->operand_index = 0; | ||
1083 | |||
1084 | status = acpi_ds_create_operand(walk_state, next_op, 0); | ||
1085 | if (ACPI_FAILURE(status)) { | ||
1086 | return_ACPI_STATUS(status); | ||
1087 | } | ||
1088 | |||
1089 | status = acpi_ex_resolve_to_value(&walk_state->operands[0], walk_state); | ||
1090 | if (ACPI_FAILURE(status)) { | ||
1091 | return_ACPI_STATUS(status); | ||
1092 | } | ||
1093 | |||
1094 | ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, | ||
1095 | acpi_ps_get_opcode_name(op->common.aml_opcode), | ||
1096 | 1, "after AcpiExResolveOperands"); | ||
1097 | |||
1098 | /* | ||
1099 | * Get the bank_value operand and save it | ||
1100 | * (at Top of stack) | ||
1101 | */ | ||
1102 | operand_desc = walk_state->operands[0]; | ||
1103 | |||
1104 | /* Arg points to the start Bank Field */ | ||
1105 | |||
1106 | arg = acpi_ps_get_arg(op, 4); | ||
1107 | while (arg) { | ||
1108 | |||
1109 | /* Ignore OFFSET and ACCESSAS terms here */ | ||
1110 | |||
1111 | if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) { | ||
1112 | node = arg->common.node; | ||
1113 | |||
1114 | obj_desc = acpi_ns_get_attached_object(node); | ||
1115 | if (!obj_desc) { | ||
1116 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
1117 | } | ||
1118 | |||
1119 | obj_desc->bank_field.value = | ||
1120 | (u32) operand_desc->integer.value; | ||
1121 | } | ||
1122 | |||
1123 | /* Move to next field in the list */ | ||
1124 | |||
1125 | arg = arg->common.next; | ||
1126 | } | ||
1127 | |||
1128 | acpi_ut_remove_reference(operand_desc); | ||
1129 | return_ACPI_STATUS(status); | ||
1130 | } | ||
1131 | |||
1132 | /******************************************************************************* | ||
1133 | * | ||
881 | * FUNCTION: acpi_ds_exec_begin_control_op | 1134 | * FUNCTION: acpi_ds_exec_begin_control_op |
882 | * | 1135 | * |
883 | * PARAMETERS: walk_list - The list that owns the walk stack | 1136 | * PARAMETERS: walk_list - The list that owns the walk stack |
@@ -1070,8 +1323,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | |||
1070 | * is set to anything other than zero! | 1323 | * is set to anything other than zero! |
1071 | */ | 1324 | */ |
1072 | walk_state->return_desc = walk_state->operands[0]; | 1325 | walk_state->return_desc = walk_state->operands[0]; |
1073 | } else if ((walk_state->results) && | 1326 | } else if (walk_state->result_count) { |
1074 | (walk_state->results->results.num_results > 0)) { | ||
1075 | 1327 | ||
1076 | /* Since we have a real Return(), delete any implicit return */ | 1328 | /* Since we have a real Return(), delete any implicit return */ |
1077 | 1329 | ||
diff --git a/drivers/acpi/dispatcher/dsutils.c b/drivers/acpi/dispatcher/dsutils.c index 71503c036f7c..b398982f0d8b 100644 --- a/drivers/acpi/dispatcher/dsutils.c +++ b/drivers/acpi/dispatcher/dsutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -278,7 +278,9 @@ acpi_ds_is_result_used(union acpi_parse_object * op, | |||
278 | AML_VAR_PACKAGE_OP) | 278 | AML_VAR_PACKAGE_OP) |
279 | || (op->common.parent->common.aml_opcode == AML_BUFFER_OP) | 279 | || (op->common.parent->common.aml_opcode == AML_BUFFER_OP) |
280 | || (op->common.parent->common.aml_opcode == | 280 | || (op->common.parent->common.aml_opcode == |
281 | AML_INT_EVAL_SUBTREE_OP)) { | 281 | AML_INT_EVAL_SUBTREE_OP) |
282 | || (op->common.parent->common.aml_opcode == | ||
283 | AML_BANK_FIELD_OP)) { | ||
282 | /* | 284 | /* |
283 | * These opcodes allow term_arg(s) as operands and therefore | 285 | * These opcodes allow term_arg(s) as operands and therefore |
284 | * the operands can be method calls. The result is used. | 286 | * the operands can be method calls. The result is used. |
@@ -472,7 +474,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
472 | /* A valid name must be looked up in the namespace */ | 474 | /* A valid name must be looked up in the namespace */ |
473 | 475 | ||
474 | if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) && | 476 | if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) && |
475 | (arg->common.value.string)) { | 477 | (arg->common.value.string) && |
478 | !(arg->common.flags & ACPI_PARSEOP_IN_STACK)) { | ||
476 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", | 479 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", |
477 | arg)); | 480 | arg)); |
478 | 481 | ||
@@ -595,7 +598,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
595 | } else { | 598 | } else { |
596 | /* Check for null name case */ | 599 | /* Check for null name case */ |
597 | 600 | ||
598 | if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) { | 601 | if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) && |
602 | !(arg->common.flags & ACPI_PARSEOP_IN_STACK)) { | ||
599 | /* | 603 | /* |
600 | * If the name is null, this means that this is an | 604 | * If the name is null, this means that this is an |
601 | * optional result parameter that was not specified | 605 | * optional result parameter that was not specified |
@@ -617,7 +621,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
617 | return_ACPI_STATUS(AE_NOT_IMPLEMENTED); | 621 | return_ACPI_STATUS(AE_NOT_IMPLEMENTED); |
618 | } | 622 | } |
619 | 623 | ||
620 | if (op_info->flags & AML_HAS_RETVAL) { | 624 | if ((op_info->flags & AML_HAS_RETVAL) |
625 | || (arg->common.flags & ACPI_PARSEOP_IN_STACK)) { | ||
621 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 626 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, |
622 | "Argument previously created, already stacked\n")); | 627 | "Argument previously created, already stacked\n")); |
623 | 628 | ||
@@ -630,9 +635,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, | |||
630 | * Use value that was already previously returned | 635 | * Use value that was already previously returned |
631 | * by the evaluation of this argument | 636 | * by the evaluation of this argument |
632 | */ | 637 | */ |
633 | status = | 638 | status = acpi_ds_result_pop(&obj_desc, walk_state); |
634 | acpi_ds_result_pop_from_bottom(&obj_desc, | ||
635 | walk_state); | ||
636 | if (ACPI_FAILURE(status)) { | 639 | if (ACPI_FAILURE(status)) { |
637 | /* | 640 | /* |
638 | * Only error is underflow, and this indicates | 641 | * Only error is underflow, and this indicates |
@@ -698,27 +701,52 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, | |||
698 | { | 701 | { |
699 | acpi_status status = AE_OK; | 702 | acpi_status status = AE_OK; |
700 | union acpi_parse_object *arg; | 703 | union acpi_parse_object *arg; |
704 | union acpi_parse_object *arguments[ACPI_OBJ_NUM_OPERANDS]; | ||
701 | u32 arg_count = 0; | 705 | u32 arg_count = 0; |
706 | u32 index = walk_state->num_operands; | ||
707 | u32 i; | ||
702 | 708 | ||
703 | ACPI_FUNCTION_TRACE_PTR(ds_create_operands, first_arg); | 709 | ACPI_FUNCTION_TRACE_PTR(ds_create_operands, first_arg); |
704 | 710 | ||
705 | /* For all arguments in the list... */ | 711 | /* Get all arguments in the list */ |
706 | 712 | ||
707 | arg = first_arg; | 713 | arg = first_arg; |
708 | while (arg) { | 714 | while (arg) { |
709 | status = acpi_ds_create_operand(walk_state, arg, arg_count); | 715 | if (index >= ACPI_OBJ_NUM_OPERANDS) { |
710 | if (ACPI_FAILURE(status)) { | 716 | return_ACPI_STATUS(AE_BAD_DATA); |
711 | goto cleanup; | ||
712 | } | 717 | } |
713 | 718 | ||
714 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | 719 | arguments[index] = arg; |
715 | "Arg #%d (%p) done, Arg1=%p\n", arg_count, | 720 | walk_state->operands[index] = NULL; |
716 | arg, first_arg)); | ||
717 | 721 | ||
718 | /* Move on to next argument, if any */ | 722 | /* Move on to next argument, if any */ |
719 | 723 | ||
720 | arg = arg->common.next; | 724 | arg = arg->common.next; |
721 | arg_count++; | 725 | arg_count++; |
726 | index++; | ||
727 | } | ||
728 | |||
729 | index--; | ||
730 | |||
731 | /* It is the appropriate order to get objects from the Result stack */ | ||
732 | |||
733 | for (i = 0; i < arg_count; i++) { | ||
734 | arg = arguments[index]; | ||
735 | |||
736 | /* Force the filling of the operand stack in inverse order */ | ||
737 | |||
738 | walk_state->operand_index = (u8) index; | ||
739 | |||
740 | status = acpi_ds_create_operand(walk_state, arg, index); | ||
741 | if (ACPI_FAILURE(status)) { | ||
742 | goto cleanup; | ||
743 | } | ||
744 | |||
745 | index--; | ||
746 | |||
747 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
748 | "Arg #%d (%p) done, Arg1=%p\n", index, arg, | ||
749 | first_arg)); | ||
722 | } | 750 | } |
723 | 751 | ||
724 | return_ACPI_STATUS(status); | 752 | return_ACPI_STATUS(status); |
@@ -729,9 +757,112 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, | |||
729 | * pop everything off of the operand stack and delete those | 757 | * pop everything off of the operand stack and delete those |
730 | * objects | 758 | * objects |
731 | */ | 759 | */ |
732 | (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); | 760 | acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); |
761 | |||
762 | ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %d", index)); | ||
763 | return_ACPI_STATUS(status); | ||
764 | } | ||
765 | |||
766 | /***************************************************************************** | ||
767 | * | ||
768 | * FUNCTION: acpi_ds_evaluate_name_path | ||
769 | * | ||
770 | * PARAMETERS: walk_state - Current state of the parse tree walk, | ||
771 | * the opcode of current operation should be | ||
772 | * AML_INT_NAMEPATH_OP | ||
773 | * | ||
774 | * RETURN: Status | ||
775 | * | ||
776 | * DESCRIPTION: Translate the -name_path- parse tree object to the equivalent | ||
777 | * interpreter object, convert it to value, if needed, duplicate | ||
778 | * it, if needed, and push it onto the current result stack. | ||
779 | * | ||
780 | ****************************************************************************/ | ||
781 | |||
782 | acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state) | ||
783 | { | ||
784 | acpi_status status = AE_OK; | ||
785 | union acpi_parse_object *op = walk_state->op; | ||
786 | union acpi_operand_object **operand = &walk_state->operands[0]; | ||
787 | union acpi_operand_object *new_obj_desc; | ||
788 | u8 type; | ||
789 | |||
790 | ACPI_FUNCTION_TRACE_PTR(ds_evaluate_name_path, walk_state); | ||
791 | |||
792 | if (!op->common.parent) { | ||
793 | |||
794 | /* This happens after certain exception processing */ | ||
795 | |||
796 | goto exit; | ||
797 | } | ||
798 | |||
799 | if ((op->common.parent->common.aml_opcode == AML_PACKAGE_OP) || | ||
800 | (op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP) || | ||
801 | (op->common.parent->common.aml_opcode == AML_REF_OF_OP)) { | ||
802 | |||
803 | /* TBD: Should we specify this feature as a bit of op_info->Flags of these opcodes? */ | ||
804 | |||
805 | goto exit; | ||
806 | } | ||
807 | |||
808 | status = acpi_ds_create_operand(walk_state, op, 0); | ||
809 | if (ACPI_FAILURE(status)) { | ||
810 | goto exit; | ||
811 | } | ||
812 | |||
813 | if (op->common.flags & ACPI_PARSEOP_TARGET) { | ||
814 | new_obj_desc = *operand; | ||
815 | goto push_result; | ||
816 | } | ||
817 | |||
818 | type = ACPI_GET_OBJECT_TYPE(*operand); | ||
819 | |||
820 | status = acpi_ex_resolve_to_value(operand, walk_state); | ||
821 | if (ACPI_FAILURE(status)) { | ||
822 | goto exit; | ||
823 | } | ||
824 | |||
825 | if (type == ACPI_TYPE_INTEGER) { | ||
826 | |||
827 | /* It was incremented by acpi_ex_resolve_to_value */ | ||
828 | |||
829 | acpi_ut_remove_reference(*operand); | ||
830 | |||
831 | status = | ||
832 | acpi_ut_copy_iobject_to_iobject(*operand, &new_obj_desc, | ||
833 | walk_state); | ||
834 | if (ACPI_FAILURE(status)) { | ||
835 | goto exit; | ||
836 | } | ||
837 | } else { | ||
838 | /* | ||
839 | * The object either was anew created or is | ||
840 | * a Namespace node - don't decrement it. | ||
841 | */ | ||
842 | new_obj_desc = *operand; | ||
843 | } | ||
844 | |||
845 | /* Cleanup for name-path operand */ | ||
846 | |||
847 | status = acpi_ds_obj_stack_pop(1, walk_state); | ||
848 | if (ACPI_FAILURE(status)) { | ||
849 | walk_state->result_obj = new_obj_desc; | ||
850 | goto exit; | ||
851 | } | ||
852 | |||
853 | push_result: | ||
854 | |||
855 | walk_state->result_obj = new_obj_desc; | ||
856 | |||
857 | status = acpi_ds_result_push(walk_state->result_obj, walk_state); | ||
858 | if (ACPI_SUCCESS(status)) { | ||
859 | |||
860 | /* Force to take it from stack */ | ||
861 | |||
862 | op->common.flags |= ACPI_PARSEOP_IN_STACK; | ||
863 | } | ||
864 | |||
865 | exit: | ||
733 | 866 | ||
734 | ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %d", | ||
735 | (arg_count + 1))); | ||
736 | return_ACPI_STATUS(status); | 867 | return_ACPI_STATUS(status); |
737 | } | 868 | } |
diff --git a/drivers/acpi/dispatcher/dswexec.c b/drivers/acpi/dispatcher/dswexec.c index 69693fa07224..b246b9657ead 100644 --- a/drivers/acpi/dispatcher/dswexec.c +++ b/drivers/acpi/dispatcher/dswexec.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -285,11 +285,6 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
285 | switch (opcode_class) { | 285 | switch (opcode_class) { |
286 | case AML_CLASS_CONTROL: | 286 | case AML_CLASS_CONTROL: |
287 | 287 | ||
288 | status = acpi_ds_result_stack_push(walk_state); | ||
289 | if (ACPI_FAILURE(status)) { | ||
290 | goto error_exit; | ||
291 | } | ||
292 | |||
293 | status = acpi_ds_exec_begin_control_op(walk_state, op); | 288 | status = acpi_ds_exec_begin_control_op(walk_state, op); |
294 | break; | 289 | break; |
295 | 290 | ||
@@ -305,20 +300,11 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, | |||
305 | status = acpi_ds_load2_begin_op(walk_state, NULL); | 300 | status = acpi_ds_load2_begin_op(walk_state, NULL); |
306 | } | 301 | } |
307 | 302 | ||
308 | if (op->common.aml_opcode == AML_REGION_OP) { | ||
309 | status = acpi_ds_result_stack_push(walk_state); | ||
310 | } | ||
311 | break; | 303 | break; |
312 | 304 | ||
313 | case AML_CLASS_EXECUTE: | 305 | case AML_CLASS_EXECUTE: |
314 | case AML_CLASS_CREATE: | 306 | case AML_CLASS_CREATE: |
315 | /* | 307 | |
316 | * Most operators with arguments (except create_xxx_field operators) | ||
317 | * Start a new result/operand state | ||
318 | */ | ||
319 | if (walk_state->op_info->object_type != ACPI_TYPE_BUFFER_FIELD) { | ||
320 | status = acpi_ds_result_stack_push(walk_state); | ||
321 | } | ||
322 | break; | 308 | break; |
323 | 309 | ||
324 | default: | 310 | default: |
@@ -374,6 +360,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
374 | /* Init the walk state */ | 360 | /* Init the walk state */ |
375 | 361 | ||
376 | walk_state->num_operands = 0; | 362 | walk_state->num_operands = 0; |
363 | walk_state->operand_index = 0; | ||
377 | walk_state->return_desc = NULL; | 364 | walk_state->return_desc = NULL; |
378 | walk_state->result_obj = NULL; | 365 | walk_state->result_obj = NULL; |
379 | 366 | ||
@@ -388,10 +375,17 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
388 | /* Decode the Opcode Class */ | 375 | /* Decode the Opcode Class */ |
389 | 376 | ||
390 | switch (op_class) { | 377 | switch (op_class) { |
391 | case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */ | 378 | case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */ |
379 | |||
380 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { | ||
381 | status = acpi_ds_evaluate_name_path(walk_state); | ||
382 | if (ACPI_FAILURE(status)) { | ||
383 | goto cleanup; | ||
384 | } | ||
385 | } | ||
392 | break; | 386 | break; |
393 | 387 | ||
394 | case AML_CLASS_EXECUTE: /* most operators with arguments */ | 388 | case AML_CLASS_EXECUTE: /* Most operators with arguments */ |
395 | 389 | ||
396 | /* Build resolved operand stack */ | 390 | /* Build resolved operand stack */ |
397 | 391 | ||
@@ -400,13 +394,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
400 | goto cleanup; | 394 | goto cleanup; |
401 | } | 395 | } |
402 | 396 | ||
403 | /* Done with this result state (Now that operand stack is built) */ | ||
404 | |||
405 | status = acpi_ds_result_stack_pop(walk_state); | ||
406 | if (ACPI_FAILURE(status)) { | ||
407 | goto cleanup; | ||
408 | } | ||
409 | |||
410 | /* | 397 | /* |
411 | * All opcodes require operand resolution, with the only exceptions | 398 | * All opcodes require operand resolution, with the only exceptions |
412 | * being the object_type and size_of operators. | 399 | * being the object_type and size_of operators. |
@@ -487,16 +474,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
487 | 474 | ||
488 | status = acpi_ds_exec_end_control_op(walk_state, op); | 475 | status = acpi_ds_exec_end_control_op(walk_state, op); |
489 | 476 | ||
490 | /* Make sure to properly pop the result stack */ | ||
491 | |||
492 | if (ACPI_SUCCESS(status)) { | ||
493 | status = acpi_ds_result_stack_pop(walk_state); | ||
494 | } else if (status == AE_CTRL_PENDING) { | ||
495 | status = acpi_ds_result_stack_pop(walk_state); | ||
496 | if (ACPI_SUCCESS(status)) { | ||
497 | status = AE_CTRL_PENDING; | ||
498 | } | ||
499 | } | ||
500 | break; | 477 | break; |
501 | 478 | ||
502 | case AML_TYPE_METHOD_CALL: | 479 | case AML_TYPE_METHOD_CALL: |
@@ -516,7 +493,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
516 | 493 | ||
517 | op->common.node = | 494 | op->common.node = |
518 | (struct acpi_namespace_node *)op->asl.value. | 495 | (struct acpi_namespace_node *)op->asl.value. |
519 | arg->asl.node->object; | 496 | arg->asl.node; |
520 | acpi_ut_add_reference(op->asl.value.arg->asl. | 497 | acpi_ut_add_reference(op->asl.value.arg->asl. |
521 | node->object); | 498 | node->object); |
522 | return_ACPI_STATUS(AE_OK); | 499 | return_ACPI_STATUS(AE_OK); |
@@ -632,13 +609,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
632 | break; | 609 | break; |
633 | } | 610 | } |
634 | 611 | ||
635 | /* Done with result state (Now that operand stack is built) */ | ||
636 | |||
637 | status = acpi_ds_result_stack_pop(walk_state); | ||
638 | if (ACPI_FAILURE(status)) { | ||
639 | goto cleanup; | ||
640 | } | ||
641 | |||
642 | /* | 612 | /* |
643 | * If a result object was returned from above, push it on the | 613 | * If a result object was returned from above, push it on the |
644 | * current result stack | 614 | * current result stack |
@@ -671,8 +641,28 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) | |||
671 | if (ACPI_FAILURE(status)) { | 641 | if (ACPI_FAILURE(status)) { |
672 | break; | 642 | break; |
673 | } | 643 | } |
644 | } else if (op->common.aml_opcode == AML_DATA_REGION_OP) { | ||
645 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
646 | "Executing DataTableRegion Strings Op=%p\n", | ||
647 | op)); | ||
648 | |||
649 | status = | ||
650 | acpi_ds_eval_table_region_operands | ||
651 | (walk_state, op); | ||
652 | if (ACPI_FAILURE(status)) { | ||
653 | break; | ||
654 | } | ||
655 | } else if (op->common.aml_opcode == AML_BANK_FIELD_OP) { | ||
656 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
657 | "Executing BankField Op=%p\n", | ||
658 | op)); | ||
674 | 659 | ||
675 | status = acpi_ds_result_stack_pop(walk_state); | 660 | status = |
661 | acpi_ds_eval_bank_field_operands(walk_state, | ||
662 | op); | ||
663 | if (ACPI_FAILURE(status)) { | ||
664 | break; | ||
665 | } | ||
676 | } | 666 | } |
677 | break; | 667 | break; |
678 | 668 | ||
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c index 8ab9d1b29a4c..dff7a3e445a8 100644 --- a/drivers/acpi/dispatcher/dswload.c +++ b/drivers/acpi/dispatcher/dswload.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -443,6 +443,15 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
443 | if (ACPI_FAILURE(status)) { | 443 | if (ACPI_FAILURE(status)) { |
444 | return_ACPI_STATUS(status); | 444 | return_ACPI_STATUS(status); |
445 | } | 445 | } |
446 | } else if (op->common.aml_opcode == AML_DATA_REGION_OP) { | ||
447 | status = | ||
448 | acpi_ex_create_region(op->named.data, | ||
449 | op->named.length, | ||
450 | REGION_DATA_TABLE, | ||
451 | walk_state); | ||
452 | if (ACPI_FAILURE(status)) { | ||
453 | return_ACPI_STATUS(status); | ||
454 | } | ||
446 | } | 455 | } |
447 | } | 456 | } |
448 | #endif | 457 | #endif |
@@ -767,6 +776,12 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | |||
767 | acpi_ns_lookup(walk_state->scope_info, buffer_ptr, | 776 | acpi_ns_lookup(walk_state->scope_info, buffer_ptr, |
768 | object_type, ACPI_IMODE_LOAD_PASS2, flags, | 777 | object_type, ACPI_IMODE_LOAD_PASS2, flags, |
769 | walk_state, &node); | 778 | walk_state, &node); |
779 | |||
780 | if (ACPI_SUCCESS(status) && (flags & ACPI_NS_TEMPORARY)) { | ||
781 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
782 | "***New Node [%4.4s] %p is temporary\n", | ||
783 | acpi_ut_get_node_name(node), node)); | ||
784 | } | ||
770 | break; | 785 | break; |
771 | } | 786 | } |
772 | 787 | ||
@@ -823,6 +838,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
823 | struct acpi_namespace_node *new_node; | 838 | struct acpi_namespace_node *new_node; |
824 | #ifndef ACPI_NO_METHOD_EXECUTION | 839 | #ifndef ACPI_NO_METHOD_EXECUTION |
825 | u32 i; | 840 | u32 i; |
841 | u8 region_space; | ||
826 | #endif | 842 | #endif |
827 | 843 | ||
828 | ACPI_FUNCTION_TRACE(ds_load2_end_op); | 844 | ACPI_FUNCTION_TRACE(ds_load2_end_op); |
@@ -1003,11 +1019,6 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1003 | status = acpi_ex_create_event(walk_state); | 1019 | status = acpi_ex_create_event(walk_state); |
1004 | break; | 1020 | break; |
1005 | 1021 | ||
1006 | case AML_DATA_REGION_OP: | ||
1007 | |||
1008 | status = acpi_ex_create_table_region(walk_state); | ||
1009 | break; | ||
1010 | |||
1011 | case AML_ALIAS_OP: | 1022 | case AML_ALIAS_OP: |
1012 | 1023 | ||
1013 | status = acpi_ex_create_alias(walk_state); | 1024 | status = acpi_ex_create_alias(walk_state); |
@@ -1035,6 +1046,15 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1035 | switch (op->common.aml_opcode) { | 1046 | switch (op->common.aml_opcode) { |
1036 | #ifndef ACPI_NO_METHOD_EXECUTION | 1047 | #ifndef ACPI_NO_METHOD_EXECUTION |
1037 | case AML_REGION_OP: | 1048 | case AML_REGION_OP: |
1049 | case AML_DATA_REGION_OP: | ||
1050 | |||
1051 | if (op->common.aml_opcode == AML_REGION_OP) { | ||
1052 | region_space = (acpi_adr_space_type) | ||
1053 | ((op->common.value.arg)->common.value. | ||
1054 | integer); | ||
1055 | } else { | ||
1056 | region_space = REGION_DATA_TABLE; | ||
1057 | } | ||
1038 | 1058 | ||
1039 | /* | 1059 | /* |
1040 | * If we are executing a method, initialize the region | 1060 | * If we are executing a method, initialize the region |
@@ -1043,10 +1063,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | |||
1043 | status = | 1063 | status = |
1044 | acpi_ex_create_region(op->named.data, | 1064 | acpi_ex_create_region(op->named.data, |
1045 | op->named.length, | 1065 | op->named.length, |
1046 | (acpi_adr_space_type) | 1066 | region_space, |
1047 | ((op->common.value. | ||
1048 | arg)->common.value. | ||
1049 | integer), | ||
1050 | walk_state); | 1067 | walk_state); |
1051 | if (ACPI_FAILURE(status)) { | 1068 | if (ACPI_FAILURE(status)) { |
1052 | return (status); | 1069 | return (status); |
diff --git a/drivers/acpi/dispatcher/dswscope.c b/drivers/acpi/dispatcher/dswscope.c index 3927c495e4bf..9e6073265873 100644 --- a/drivers/acpi/dispatcher/dswscope.c +++ b/drivers/acpi/dispatcher/dswscope.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index 5afcdd9c7449..1386ced332ec 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -49,85 +49,9 @@ | |||
49 | #define _COMPONENT ACPI_DISPATCHER | 49 | #define _COMPONENT ACPI_DISPATCHER |
50 | ACPI_MODULE_NAME("dswstate") | 50 | ACPI_MODULE_NAME("dswstate") |
51 | 51 | ||
52 | /* Local prototypes */ | 52 | /* Local prototypes */ |
53 | #ifdef ACPI_OBSOLETE_FUNCTIONS | 53 | static acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *ws); |
54 | acpi_status | 54 | static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *ws); |
55 | acpi_ds_result_insert(void *object, | ||
56 | u32 index, struct acpi_walk_state *walk_state); | ||
57 | |||
58 | acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state *walk_state); | ||
59 | |||
60 | acpi_status | ||
61 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, | ||
62 | struct acpi_walk_state *walk_state); | ||
63 | |||
64 | void *acpi_ds_obj_stack_get_value(u32 index, | ||
65 | struct acpi_walk_state *walk_state); | ||
66 | #endif | ||
67 | |||
68 | #ifdef ACPI_FUTURE_USAGE | ||
69 | /******************************************************************************* | ||
70 | * | ||
71 | * FUNCTION: acpi_ds_result_remove | ||
72 | * | ||
73 | * PARAMETERS: Object - Where to return the popped object | ||
74 | * Index - Where to extract the object | ||
75 | * walk_state - Current Walk state | ||
76 | * | ||
77 | * RETURN: Status | ||
78 | * | ||
79 | * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In | ||
80 | * other words, this is a FIFO. | ||
81 | * | ||
82 | ******************************************************************************/ | ||
83 | |||
84 | acpi_status | ||
85 | acpi_ds_result_remove(union acpi_operand_object **object, | ||
86 | u32 index, struct acpi_walk_state *walk_state) | ||
87 | { | ||
88 | union acpi_generic_state *state; | ||
89 | |||
90 | ACPI_FUNCTION_NAME(ds_result_remove); | ||
91 | |||
92 | state = walk_state->results; | ||
93 | if (!state) { | ||
94 | ACPI_ERROR((AE_INFO, "No result object pushed! State=%p", | ||
95 | walk_state)); | ||
96 | return (AE_NOT_EXIST); | ||
97 | } | ||
98 | |||
99 | if (index >= ACPI_OBJ_MAX_OPERAND) { | ||
100 | ACPI_ERROR((AE_INFO, | ||
101 | "Index out of range: %X State=%p Num=%X", | ||
102 | index, walk_state, state->results.num_results)); | ||
103 | } | ||
104 | |||
105 | /* Check for a valid result object */ | ||
106 | |||
107 | if (!state->results.obj_desc[index]) { | ||
108 | ACPI_ERROR((AE_INFO, | ||
109 | "Null operand! State=%p #Ops=%X, Index=%X", | ||
110 | walk_state, state->results.num_results, index)); | ||
111 | return (AE_AML_NO_RETURN_VALUE); | ||
112 | } | ||
113 | |||
114 | /* Remove the object */ | ||
115 | |||
116 | state->results.num_results--; | ||
117 | |||
118 | *object = state->results.obj_desc[index]; | ||
119 | state->results.obj_desc[index] = NULL; | ||
120 | |||
121 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
122 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", | ||
123 | *object, | ||
124 | (*object) ? acpi_ut_get_object_type_name(*object) : | ||
125 | "NULL", index, walk_state, | ||
126 | state->results.num_results)); | ||
127 | |||
128 | return (AE_OK); | ||
129 | } | ||
130 | #endif /* ACPI_FUTURE_USAGE */ | ||
131 | 55 | ||
132 | /******************************************************************************* | 56 | /******************************************************************************* |
133 | * | 57 | * |
@@ -138,122 +62,67 @@ acpi_ds_result_remove(union acpi_operand_object **object, | |||
138 | * | 62 | * |
139 | * RETURN: Status | 63 | * RETURN: Status |
140 | * | 64 | * |
141 | * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In | 65 | * DESCRIPTION: Pop an object off the top of this walk's result stack |
142 | * other words, this is a FIFO. | ||
143 | * | 66 | * |
144 | ******************************************************************************/ | 67 | ******************************************************************************/ |
145 | 68 | ||
146 | acpi_status | 69 | acpi_status |
147 | acpi_ds_result_pop(union acpi_operand_object ** object, | 70 | acpi_ds_result_pop(union acpi_operand_object **object, |
148 | struct acpi_walk_state * walk_state) | 71 | struct acpi_walk_state *walk_state) |
149 | { | 72 | { |
150 | acpi_native_uint index; | 73 | acpi_native_uint index; |
151 | union acpi_generic_state *state; | 74 | union acpi_generic_state *state; |
75 | acpi_status status; | ||
152 | 76 | ||
153 | ACPI_FUNCTION_NAME(ds_result_pop); | 77 | ACPI_FUNCTION_NAME(ds_result_pop); |
154 | 78 | ||
155 | state = walk_state->results; | 79 | state = walk_state->results; |
156 | if (!state) { | ||
157 | return (AE_OK); | ||
158 | } | ||
159 | |||
160 | if (!state->results.num_results) { | ||
161 | ACPI_ERROR((AE_INFO, "Result stack is empty! State=%p", | ||
162 | walk_state)); | ||
163 | return (AE_AML_NO_RETURN_VALUE); | ||
164 | } | ||
165 | 80 | ||
166 | /* Remove top element */ | 81 | /* Incorrect state of result stack */ |
167 | 82 | ||
168 | state->results.num_results--; | 83 | if (state && !walk_state->result_count) { |
169 | 84 | ACPI_ERROR((AE_INFO, "No results on result stack")); | |
170 | for (index = ACPI_OBJ_NUM_OPERANDS; index; index--) { | 85 | return (AE_AML_INTERNAL); |
171 | |||
172 | /* Check for a valid result object */ | ||
173 | |||
174 | if (state->results.obj_desc[index - 1]) { | ||
175 | *object = state->results.obj_desc[index - 1]; | ||
176 | state->results.obj_desc[index - 1] = NULL; | ||
177 | |||
178 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
179 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", | ||
180 | *object, | ||
181 | (*object) ? | ||
182 | acpi_ut_get_object_type_name(*object) | ||
183 | : "NULL", (u32) index - 1, walk_state, | ||
184 | state->results.num_results)); | ||
185 | |||
186 | return (AE_OK); | ||
187 | } | ||
188 | } | 86 | } |
189 | 87 | ||
190 | ACPI_ERROR((AE_INFO, "No result objects! State=%p", walk_state)); | 88 | if (!state && walk_state->result_count) { |
191 | return (AE_AML_NO_RETURN_VALUE); | 89 | ACPI_ERROR((AE_INFO, "No result state for result stack")); |
192 | } | 90 | return (AE_AML_INTERNAL); |
193 | 91 | } | |
194 | /******************************************************************************* | ||
195 | * | ||
196 | * FUNCTION: acpi_ds_result_pop_from_bottom | ||
197 | * | ||
198 | * PARAMETERS: Object - Where to return the popped object | ||
199 | * walk_state - Current Walk state | ||
200 | * | ||
201 | * RETURN: Status | ||
202 | * | ||
203 | * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In | ||
204 | * other words, this is a FIFO. | ||
205 | * | ||
206 | ******************************************************************************/ | ||
207 | |||
208 | acpi_status | ||
209 | acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object, | ||
210 | struct acpi_walk_state * walk_state) | ||
211 | { | ||
212 | acpi_native_uint index; | ||
213 | union acpi_generic_state *state; | ||
214 | 92 | ||
215 | ACPI_FUNCTION_NAME(ds_result_pop_from_bottom); | 93 | /* Empty result stack */ |
216 | 94 | ||
217 | state = walk_state->results; | ||
218 | if (!state) { | 95 | if (!state) { |
219 | ACPI_ERROR((AE_INFO, | 96 | ACPI_ERROR((AE_INFO, "Result stack is empty! State=%p", |
220 | "No result object pushed! State=%p", walk_state)); | ||
221 | return (AE_NOT_EXIST); | ||
222 | } | ||
223 | |||
224 | if (!state->results.num_results) { | ||
225 | ACPI_ERROR((AE_INFO, "No result objects! State=%p", | ||
226 | walk_state)); | 97 | walk_state)); |
227 | return (AE_AML_NO_RETURN_VALUE); | 98 | return (AE_AML_NO_RETURN_VALUE); |
228 | } | 99 | } |
229 | 100 | ||
230 | /* Remove Bottom element */ | 101 | /* Return object of the top element and clean that top element result stack */ |
231 | |||
232 | *object = state->results.obj_desc[0]; | ||
233 | |||
234 | /* Push entire stack down one element */ | ||
235 | |||
236 | for (index = 0; index < state->results.num_results; index++) { | ||
237 | state->results.obj_desc[index] = | ||
238 | state->results.obj_desc[index + 1]; | ||
239 | } | ||
240 | 102 | ||
241 | state->results.num_results--; | 103 | walk_state->result_count--; |
242 | 104 | index = walk_state->result_count % ACPI_RESULTS_FRAME_OBJ_NUM; | |
243 | /* Check for a valid result object */ | ||
244 | 105 | ||
106 | *object = state->results.obj_desc[index]; | ||
245 | if (!*object) { | 107 | if (!*object) { |
246 | ACPI_ERROR((AE_INFO, | 108 | ACPI_ERROR((AE_INFO, |
247 | "Null operand! State=%p #Ops=%X Index=%X", | 109 | "No result objects on result stack, State=%p", |
248 | walk_state, state->results.num_results, | 110 | walk_state)); |
249 | (u32) index)); | ||
250 | return (AE_AML_NO_RETURN_VALUE); | 111 | return (AE_AML_NO_RETURN_VALUE); |
251 | } | 112 | } |
252 | 113 | ||
253 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n", | 114 | state->results.obj_desc[index] = NULL; |
254 | *object, | 115 | if (index == 0) { |
255 | (*object) ? acpi_ut_get_object_type_name(*object) : | 116 | status = acpi_ds_result_stack_pop(walk_state); |
256 | "NULL", state, walk_state)); | 117 | if (ACPI_FAILURE(status)) { |
118 | return (status); | ||
119 | } | ||
120 | } | ||
121 | |||
122 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
123 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", *object, | ||
124 | acpi_ut_get_object_type_name(*object), | ||
125 | (u32) index, walk_state, walk_state->result_count)); | ||
257 | 126 | ||
258 | return (AE_OK); | 127 | return (AE_OK); |
259 | } | 128 | } |
@@ -276,39 +145,56 @@ acpi_ds_result_push(union acpi_operand_object * object, | |||
276 | struct acpi_walk_state * walk_state) | 145 | struct acpi_walk_state * walk_state) |
277 | { | 146 | { |
278 | union acpi_generic_state *state; | 147 | union acpi_generic_state *state; |
148 | acpi_status status; | ||
149 | acpi_native_uint index; | ||
279 | 150 | ||
280 | ACPI_FUNCTION_NAME(ds_result_push); | 151 | ACPI_FUNCTION_NAME(ds_result_push); |
281 | 152 | ||
153 | if (walk_state->result_count > walk_state->result_size) { | ||
154 | ACPI_ERROR((AE_INFO, "Result stack is full")); | ||
155 | return (AE_AML_INTERNAL); | ||
156 | } else if (walk_state->result_count == walk_state->result_size) { | ||
157 | |||
158 | /* Extend the result stack */ | ||
159 | |||
160 | status = acpi_ds_result_stack_push(walk_state); | ||
161 | if (ACPI_FAILURE(status)) { | ||
162 | ACPI_ERROR((AE_INFO, | ||
163 | "Failed to extend the result stack")); | ||
164 | return (status); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | if (!(walk_state->result_count < walk_state->result_size)) { | ||
169 | ACPI_ERROR((AE_INFO, "No free elements in result stack")); | ||
170 | return (AE_AML_INTERNAL); | ||
171 | } | ||
172 | |||
282 | state = walk_state->results; | 173 | state = walk_state->results; |
283 | if (!state) { | 174 | if (!state) { |
284 | ACPI_ERROR((AE_INFO, "No result stack frame during push")); | 175 | ACPI_ERROR((AE_INFO, "No result stack frame during push")); |
285 | return (AE_AML_INTERNAL); | 176 | return (AE_AML_INTERNAL); |
286 | } | 177 | } |
287 | 178 | ||
288 | if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) { | ||
289 | ACPI_ERROR((AE_INFO, | ||
290 | "Result stack overflow: Obj=%p State=%p Num=%X", | ||
291 | object, walk_state, state->results.num_results)); | ||
292 | return (AE_STACK_OVERFLOW); | ||
293 | } | ||
294 | |||
295 | if (!object) { | 179 | if (!object) { |
296 | ACPI_ERROR((AE_INFO, | 180 | ACPI_ERROR((AE_INFO, |
297 | "Null Object! Obj=%p State=%p Num=%X", | 181 | "Null Object! Obj=%p State=%p Num=%X", |
298 | object, walk_state, state->results.num_results)); | 182 | object, walk_state, walk_state->result_count)); |
299 | return (AE_BAD_PARAMETER); | 183 | return (AE_BAD_PARAMETER); |
300 | } | 184 | } |
301 | 185 | ||
302 | state->results.obj_desc[state->results.num_results] = object; | 186 | /* Assign the address of object to the top free element of result stack */ |
303 | state->results.num_results++; | 187 | |
188 | index = walk_state->result_count % ACPI_RESULTS_FRAME_OBJ_NUM; | ||
189 | state->results.obj_desc[index] = object; | ||
190 | walk_state->result_count++; | ||
304 | 191 | ||
305 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | 192 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", |
306 | object, | 193 | object, |
307 | object ? | ||
308 | acpi_ut_get_object_type_name((union | 194 | acpi_ut_get_object_type_name((union |
309 | acpi_operand_object *) | 195 | acpi_operand_object *) |
310 | object) : "NULL", | 196 | object), walk_state, |
311 | walk_state, state->results.num_results, | 197 | walk_state->result_count, |
312 | walk_state->current_result)); | 198 | walk_state->current_result)); |
313 | 199 | ||
314 | return (AE_OK); | 200 | return (AE_OK); |
@@ -322,16 +208,25 @@ acpi_ds_result_push(union acpi_operand_object * object, | |||
322 | * | 208 | * |
323 | * RETURN: Status | 209 | * RETURN: Status |
324 | * | 210 | * |
325 | * DESCRIPTION: Push an object onto the walk_state result stack. | 211 | * DESCRIPTION: Push an object onto the walk_state result stack |
326 | * | 212 | * |
327 | ******************************************************************************/ | 213 | ******************************************************************************/ |
328 | 214 | ||
329 | acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) | 215 | static acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *walk_state) |
330 | { | 216 | { |
331 | union acpi_generic_state *state; | 217 | union acpi_generic_state *state; |
332 | 218 | ||
333 | ACPI_FUNCTION_NAME(ds_result_stack_push); | 219 | ACPI_FUNCTION_NAME(ds_result_stack_push); |
334 | 220 | ||
221 | /* Check for stack overflow */ | ||
222 | |||
223 | if (((u32) walk_state->result_size + ACPI_RESULTS_FRAME_OBJ_NUM) > | ||
224 | ACPI_RESULTS_OBJ_NUM_MAX) { | ||
225 | ACPI_ERROR((AE_INFO, "Result stack overflow: State=%p Num=%X", | ||
226 | walk_state, walk_state->result_size)); | ||
227 | return (AE_STACK_OVERFLOW); | ||
228 | } | ||
229 | |||
335 | state = acpi_ut_create_generic_state(); | 230 | state = acpi_ut_create_generic_state(); |
336 | if (!state) { | 231 | if (!state) { |
337 | return (AE_NO_MEMORY); | 232 | return (AE_NO_MEMORY); |
@@ -340,6 +235,10 @@ acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) | |||
340 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT; | 235 | state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT; |
341 | acpi_ut_push_generic_state(&walk_state->results, state); | 236 | acpi_ut_push_generic_state(&walk_state->results, state); |
342 | 237 | ||
238 | /* Increase the length of the result stack by the length of frame */ | ||
239 | |||
240 | walk_state->result_size += ACPI_RESULTS_FRAME_OBJ_NUM; | ||
241 | |||
343 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", | 242 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n", |
344 | state, walk_state)); | 243 | state, walk_state)); |
345 | 244 | ||
@@ -354,11 +253,11 @@ acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state) | |||
354 | * | 253 | * |
355 | * RETURN: Status | 254 | * RETURN: Status |
356 | * | 255 | * |
357 | * DESCRIPTION: Pop an object off of the walk_state result stack. | 256 | * DESCRIPTION: Pop an object off of the walk_state result stack |
358 | * | 257 | * |
359 | ******************************************************************************/ | 258 | ******************************************************************************/ |
360 | 259 | ||
361 | acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | 260 | static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state) |
362 | { | 261 | { |
363 | union acpi_generic_state *state; | 262 | union acpi_generic_state *state; |
364 | 263 | ||
@@ -367,18 +266,27 @@ acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state) | |||
367 | /* Check for stack underflow */ | 266 | /* Check for stack underflow */ |
368 | 267 | ||
369 | if (walk_state->results == NULL) { | 268 | if (walk_state->results == NULL) { |
370 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Underflow - State=%p\n", | 269 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
270 | "Result stack underflow - State=%p\n", | ||
371 | walk_state)); | 271 | walk_state)); |
372 | return (AE_AML_NO_OPERAND); | 272 | return (AE_AML_NO_OPERAND); |
373 | } | 273 | } |
374 | 274 | ||
275 | if (walk_state->result_size < ACPI_RESULTS_FRAME_OBJ_NUM) { | ||
276 | ACPI_ERROR((AE_INFO, "Insufficient result stack size")); | ||
277 | return (AE_AML_INTERNAL); | ||
278 | } | ||
279 | |||
375 | state = acpi_ut_pop_generic_state(&walk_state->results); | 280 | state = acpi_ut_pop_generic_state(&walk_state->results); |
281 | acpi_ut_delete_generic_state(state); | ||
282 | |||
283 | /* Decrease the length of result stack by the length of frame */ | ||
284 | |||
285 | walk_state->result_size -= ACPI_RESULTS_FRAME_OBJ_NUM; | ||
376 | 286 | ||
377 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 287 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
378 | "Result=%p RemainingResults=%X State=%p\n", | 288 | "Result=%p RemainingResults=%X State=%p\n", |
379 | state, state->results.num_results, walk_state)); | 289 | state, walk_state->result_count, walk_state)); |
380 | |||
381 | acpi_ut_delete_generic_state(state); | ||
382 | 290 | ||
383 | return (AE_OK); | 291 | return (AE_OK); |
384 | } | 292 | } |
@@ -412,9 +320,13 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state) | |||
412 | 320 | ||
413 | /* Put the object onto the stack */ | 321 | /* Put the object onto the stack */ |
414 | 322 | ||
415 | walk_state->operands[walk_state->num_operands] = object; | 323 | walk_state->operands[walk_state->operand_index] = object; |
416 | walk_state->num_operands++; | 324 | walk_state->num_operands++; |
417 | 325 | ||
326 | /* For the usual order of filling the operand stack */ | ||
327 | |||
328 | walk_state->operand_index++; | ||
329 | |||
418 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | 330 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", |
419 | object, | 331 | object, |
420 | acpi_ut_get_object_type_name((union | 332 | acpi_ut_get_object_type_name((union |
@@ -484,43 +396,36 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state) | |||
484 | * | 396 | * |
485 | ******************************************************************************/ | 397 | ******************************************************************************/ |
486 | 398 | ||
487 | acpi_status | 399 | void |
488 | acpi_ds_obj_stack_pop_and_delete(u32 pop_count, | 400 | acpi_ds_obj_stack_pop_and_delete(u32 pop_count, |
489 | struct acpi_walk_state * walk_state) | 401 | struct acpi_walk_state *walk_state) |
490 | { | 402 | { |
491 | u32 i; | 403 | acpi_native_int i; |
492 | union acpi_operand_object *obj_desc; | 404 | union acpi_operand_object *obj_desc; |
493 | 405 | ||
494 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete); | 406 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete); |
495 | 407 | ||
496 | for (i = 0; i < pop_count; i++) { | 408 | if (pop_count == 0) { |
497 | 409 | return; | |
498 | /* Check for stack underflow */ | 410 | } |
499 | 411 | ||
412 | for (i = (acpi_native_int) (pop_count - 1); i >= 0; i--) { | ||
500 | if (walk_state->num_operands == 0) { | 413 | if (walk_state->num_operands == 0) { |
501 | ACPI_ERROR((AE_INFO, | 414 | return; |
502 | "Object stack underflow! Count=%X State=%p #Ops=%X", | ||
503 | pop_count, walk_state, | ||
504 | walk_state->num_operands)); | ||
505 | return (AE_STACK_UNDERFLOW); | ||
506 | } | 415 | } |
507 | 416 | ||
508 | /* Pop the stack and delete an object if present in this stack entry */ | 417 | /* Pop the stack and delete an object if present in this stack entry */ |
509 | 418 | ||
510 | walk_state->num_operands--; | 419 | walk_state->num_operands--; |
511 | obj_desc = walk_state->operands[walk_state->num_operands]; | 420 | obj_desc = walk_state->operands[i]; |
512 | if (obj_desc) { | 421 | if (obj_desc) { |
513 | acpi_ut_remove_reference(walk_state-> | 422 | acpi_ut_remove_reference(walk_state->operands[i]); |
514 | operands[walk_state-> | 423 | walk_state->operands[i] = NULL; |
515 | num_operands]); | ||
516 | walk_state->operands[walk_state->num_operands] = NULL; | ||
517 | } | 424 | } |
518 | } | 425 | } |
519 | 426 | ||
520 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", | 427 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n", |
521 | pop_count, walk_state, walk_state->num_operands)); | 428 | pop_count, walk_state, walk_state->num_operands)); |
522 | |||
523 | return (AE_OK); | ||
524 | } | 429 | } |
525 | 430 | ||
526 | /******************************************************************************* | 431 | /******************************************************************************* |
@@ -560,7 +465,7 @@ struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state | |||
560 | * | 465 | * |
561 | * RETURN: None | 466 | * RETURN: None |
562 | * | 467 | * |
563 | * DESCRIPTION: Place the Thread state at the head of the state list. | 468 | * DESCRIPTION: Place the Thread state at the head of the state list |
564 | * | 469 | * |
565 | ******************************************************************************/ | 470 | ******************************************************************************/ |
566 | 471 | ||
@@ -636,7 +541,6 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union | |||
636 | *thread) | 541 | *thread) |
637 | { | 542 | { |
638 | struct acpi_walk_state *walk_state; | 543 | struct acpi_walk_state *walk_state; |
639 | acpi_status status; | ||
640 | 544 | ||
641 | ACPI_FUNCTION_TRACE(ds_create_walk_state); | 545 | ACPI_FUNCTION_TRACE(ds_create_walk_state); |
642 | 546 | ||
@@ -659,14 +563,6 @@ struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union | |||
659 | acpi_ds_method_data_init(walk_state); | 563 | acpi_ds_method_data_init(walk_state); |
660 | #endif | 564 | #endif |
661 | 565 | ||
662 | /* Create an initial result stack entry */ | ||
663 | |||
664 | status = acpi_ds_result_stack_push(walk_state); | ||
665 | if (ACPI_FAILURE(status)) { | ||
666 | ACPI_FREE(walk_state); | ||
667 | return_PTR(NULL); | ||
668 | } | ||
669 | |||
670 | /* Put the new state at the head of the walk list */ | 566 | /* Put the new state at the head of the walk list */ |
671 | 567 | ||
672 | if (thread) { | 568 | if (thread) { |
@@ -860,190 +756,3 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state) | |||
860 | ACPI_FREE(walk_state); | 756 | ACPI_FREE(walk_state); |
861 | return_VOID; | 757 | return_VOID; |
862 | } | 758 | } |
863 | |||
864 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
865 | /******************************************************************************* | ||
866 | * | ||
867 | * FUNCTION: acpi_ds_result_insert | ||
868 | * | ||
869 | * PARAMETERS: Object - Object to push | ||
870 | * Index - Where to insert the object | ||
871 | * walk_state - Current Walk state | ||
872 | * | ||
873 | * RETURN: Status | ||
874 | * | ||
875 | * DESCRIPTION: Insert an object onto this walk's result stack | ||
876 | * | ||
877 | ******************************************************************************/ | ||
878 | |||
879 | acpi_status | ||
880 | acpi_ds_result_insert(void *object, | ||
881 | u32 index, struct acpi_walk_state *walk_state) | ||
882 | { | ||
883 | union acpi_generic_state *state; | ||
884 | |||
885 | ACPI_FUNCTION_NAME(ds_result_insert); | ||
886 | |||
887 | state = walk_state->results; | ||
888 | if (!state) { | ||
889 | ACPI_ERROR((AE_INFO, "No result object pushed! State=%p", | ||
890 | walk_state)); | ||
891 | return (AE_NOT_EXIST); | ||
892 | } | ||
893 | |||
894 | if (index >= ACPI_OBJ_NUM_OPERANDS) { | ||
895 | ACPI_ERROR((AE_INFO, | ||
896 | "Index out of range: %X Obj=%p State=%p Num=%X", | ||
897 | index, object, walk_state, | ||
898 | state->results.num_results)); | ||
899 | return (AE_BAD_PARAMETER); | ||
900 | } | ||
901 | |||
902 | if (!object) { | ||
903 | ACPI_ERROR((AE_INFO, | ||
904 | "Null Object! Index=%X Obj=%p State=%p Num=%X", | ||
905 | index, object, walk_state, | ||
906 | state->results.num_results)); | ||
907 | return (AE_BAD_PARAMETER); | ||
908 | } | ||
909 | |||
910 | state->results.obj_desc[index] = object; | ||
911 | state->results.num_results++; | ||
912 | |||
913 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | ||
914 | "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | ||
915 | object, | ||
916 | object ? | ||
917 | acpi_ut_get_object_type_name((union | ||
918 | acpi_operand_object *) | ||
919 | object) : "NULL", | ||
920 | walk_state, state->results.num_results, | ||
921 | walk_state->current_result)); | ||
922 | |||
923 | return (AE_OK); | ||
924 | } | ||
925 | |||
926 | /******************************************************************************* | ||
927 | * | ||
928 | * FUNCTION: acpi_ds_obj_stack_delete_all | ||
929 | * | ||
930 | * PARAMETERS: walk_state - Current Walk state | ||
931 | * | ||
932 | * RETURN: Status | ||
933 | * | ||
934 | * DESCRIPTION: Clear the object stack by deleting all objects that are on it. | ||
935 | * Should be used with great care, if at all! | ||
936 | * | ||
937 | ******************************************************************************/ | ||
938 | |||
939 | acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state) | ||
940 | { | ||
941 | u32 i; | ||
942 | |||
943 | ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_delete_all, walk_state); | ||
944 | |||
945 | /* The stack size is configurable, but fixed */ | ||
946 | |||
947 | for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { | ||
948 | if (walk_state->operands[i]) { | ||
949 | acpi_ut_remove_reference(walk_state->operands[i]); | ||
950 | walk_state->operands[i] = NULL; | ||
951 | } | ||
952 | } | ||
953 | |||
954 | return_ACPI_STATUS(AE_OK); | ||
955 | } | ||
956 | |||
957 | /******************************************************************************* | ||
958 | * | ||
959 | * FUNCTION: acpi_ds_obj_stack_pop_object | ||
960 | * | ||
961 | * PARAMETERS: Object - Where to return the popped object | ||
962 | * walk_state - Current Walk state | ||
963 | * | ||
964 | * RETURN: Status | ||
965 | * | ||
966 | * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT | ||
967 | * deleted by this routine. | ||
968 | * | ||
969 | ******************************************************************************/ | ||
970 | |||
971 | acpi_status | ||
972 | acpi_ds_obj_stack_pop_object(union acpi_operand_object **object, | ||
973 | struct acpi_walk_state *walk_state) | ||
974 | { | ||
975 | ACPI_FUNCTION_NAME(ds_obj_stack_pop_object); | ||
976 | |||
977 | /* Check for stack underflow */ | ||
978 | |||
979 | if (walk_state->num_operands == 0) { | ||
980 | ACPI_ERROR((AE_INFO, | ||
981 | "Missing operand/stack empty! State=%p #Ops=%X", | ||
982 | walk_state, walk_state->num_operands)); | ||
983 | *object = NULL; | ||
984 | return (AE_AML_NO_OPERAND); | ||
985 | } | ||
986 | |||
987 | /* Pop the stack */ | ||
988 | |||
989 | walk_state->num_operands--; | ||
990 | |||
991 | /* Check for a valid operand */ | ||
992 | |||
993 | if (!walk_state->operands[walk_state->num_operands]) { | ||
994 | ACPI_ERROR((AE_INFO, | ||
995 | "Null operand! State=%p #Ops=%X", | ||
996 | walk_state, walk_state->num_operands)); | ||
997 | *object = NULL; | ||
998 | return (AE_AML_NO_OPERAND); | ||
999 | } | ||
1000 | |||
1001 | /* Get operand and set stack entry to null */ | ||
1002 | |||
1003 | *object = walk_state->operands[walk_state->num_operands]; | ||
1004 | walk_state->operands[walk_state->num_operands] = NULL; | ||
1005 | |||
1006 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | ||
1007 | *object, acpi_ut_get_object_type_name(*object), | ||
1008 | walk_state, walk_state->num_operands)); | ||
1009 | |||
1010 | return (AE_OK); | ||
1011 | } | ||
1012 | |||
1013 | /******************************************************************************* | ||
1014 | * | ||
1015 | * FUNCTION: acpi_ds_obj_stack_get_value | ||
1016 | * | ||
1017 | * PARAMETERS: Index - Stack index whose value is desired. Based | ||
1018 | * on the top of the stack (index=0 == top) | ||
1019 | * walk_state - Current Walk state | ||
1020 | * | ||
1021 | * RETURN: Pointer to the requested operand | ||
1022 | * | ||
1023 | * DESCRIPTION: Retrieve an object from this walk's operand stack. Index must | ||
1024 | * be within the range of the current stack pointer. | ||
1025 | * | ||
1026 | ******************************************************************************/ | ||
1027 | |||
1028 | void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state) | ||
1029 | { | ||
1030 | |||
1031 | ACPI_FUNCTION_TRACE_PTR(ds_obj_stack_get_value, walk_state); | ||
1032 | |||
1033 | /* Can't do it if the stack is empty */ | ||
1034 | |||
1035 | if (walk_state->num_operands == 0) { | ||
1036 | return_PTR(NULL); | ||
1037 | } | ||
1038 | |||
1039 | /* or if the index is past the top of the stack */ | ||
1040 | |||
1041 | if (index > (walk_state->num_operands - (u32) 1)) { | ||
1042 | return_PTR(NULL); | ||
1043 | } | ||
1044 | |||
1045 | return_PTR(walk_state-> | ||
1046 | operands[(acpi_native_uint) (walk_state->num_operands - 1) - | ||
1047 | index]); | ||
1048 | } | ||
1049 | #endif | ||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index e3f04b272f3f..0924992187e8 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -73,38 +73,14 @@ enum ec_event { | |||
73 | 73 | ||
74 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ | 74 | #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */ |
75 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 75 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
76 | #define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */ | ||
76 | 77 | ||
77 | enum { | 78 | enum { |
78 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ | 79 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ |
79 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ | 80 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
80 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ | 81 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ |
81 | EC_FLAGS_NO_ADDRESS_GPE, /* Expect GPE only for non-address event */ | 82 | EC_FLAGS_NO_GPE, /* Don't use GPE mode */ |
82 | EC_FLAGS_ADDRESS, /* Address is being written */ | 83 | EC_FLAGS_RESCHEDULE_POLL /* Re-schedule poll */ |
83 | EC_FLAGS_NO_WDATA_GPE, /* Don't expect WDATA GPE event */ | ||
84 | EC_FLAGS_WDATA, /* Data is being written */ | ||
85 | EC_FLAGS_NO_OBF1_GPE, /* Don't expect GPE before read */ | ||
86 | }; | ||
87 | |||
88 | static int acpi_ec_remove(struct acpi_device *device, int type); | ||
89 | static int acpi_ec_start(struct acpi_device *device); | ||
90 | static int acpi_ec_stop(struct acpi_device *device, int type); | ||
91 | static int acpi_ec_add(struct acpi_device *device); | ||
92 | |||
93 | static const struct acpi_device_id ec_device_ids[] = { | ||
94 | {"PNP0C09", 0}, | ||
95 | {"", 0}, | ||
96 | }; | ||
97 | |||
98 | static struct acpi_driver acpi_ec_driver = { | ||
99 | .name = "ec", | ||
100 | .class = ACPI_EC_CLASS, | ||
101 | .ids = ec_device_ids, | ||
102 | .ops = { | ||
103 | .add = acpi_ec_add, | ||
104 | .remove = acpi_ec_remove, | ||
105 | .start = acpi_ec_start, | ||
106 | .stop = acpi_ec_stop, | ||
107 | }, | ||
108 | }; | 84 | }; |
109 | 85 | ||
110 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | 86 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ |
@@ -129,6 +105,8 @@ static struct acpi_ec { | |||
129 | struct mutex lock; | 105 | struct mutex lock; |
130 | wait_queue_head_t wait; | 106 | wait_queue_head_t wait; |
131 | struct list_head list; | 107 | struct list_head list; |
108 | struct delayed_work work; | ||
109 | atomic_t irq_count; | ||
132 | u8 handlers_installed; | 110 | u8 handlers_installed; |
133 | } *boot_ec, *first_ec; | 111 | } *boot_ec, *first_ec; |
134 | 112 | ||
@@ -177,65 +155,52 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) | |||
177 | return 0; | 155 | return 0; |
178 | } | 156 | } |
179 | 157 | ||
180 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) | 158 | static void ec_schedule_ec_poll(struct acpi_ec *ec) |
181 | { | 159 | { |
182 | int ret = 0; | 160 | if (test_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags)) |
161 | schedule_delayed_work(&ec->work, | ||
162 | msecs_to_jiffies(ACPI_EC_DELAY)); | ||
163 | } | ||
183 | 164 | ||
184 | if (unlikely(event == ACPI_EC_EVENT_OBF_1 && | 165 | static void ec_switch_to_poll_mode(struct acpi_ec *ec) |
185 | test_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags))) | 166 | { |
186 | force_poll = 1; | 167 | set_bit(EC_FLAGS_NO_GPE, &ec->flags); |
187 | if (unlikely(test_bit(EC_FLAGS_ADDRESS, &ec->flags) && | 168 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
188 | test_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags))) | 169 | acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); |
189 | force_poll = 1; | 170 | set_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags); |
190 | if (unlikely(test_bit(EC_FLAGS_WDATA, &ec->flags) && | 171 | } |
191 | test_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags))) | 172 | |
192 | force_poll = 1; | 173 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) |
174 | { | ||
175 | atomic_set(&ec->irq_count, 0); | ||
193 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && | 176 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && |
194 | likely(!force_poll)) { | 177 | likely(!force_poll)) { |
195 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), | 178 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), |
196 | msecs_to_jiffies(ACPI_EC_DELAY))) | 179 | msecs_to_jiffies(ACPI_EC_DELAY))) |
197 | goto end; | 180 | return 0; |
198 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 181 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
199 | if (acpi_ec_check_status(ec, event)) { | 182 | if (acpi_ec_check_status(ec, event)) { |
200 | if (event == ACPI_EC_EVENT_OBF_1) { | 183 | /* missing GPEs, switch back to poll mode */ |
201 | /* miss OBF_1 GPE, don't expect it */ | 184 | if (printk_ratelimit()) |
202 | pr_info(PREFIX "missing OBF confirmation, " | 185 | pr_info(PREFIX "missing confirmations, " |
203 | "don't expect it any longer.\n"); | ||
204 | set_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags); | ||
205 | } else if (test_bit(EC_FLAGS_ADDRESS, &ec->flags)) { | ||
206 | /* miss address GPE, don't expect it anymore */ | ||
207 | pr_info(PREFIX "missing address confirmation, " | ||
208 | "don't expect it any longer.\n"); | ||
209 | set_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags); | ||
210 | } else if (test_bit(EC_FLAGS_WDATA, &ec->flags)) { | ||
211 | /* miss write data GPE, don't expect it */ | ||
212 | pr_info(PREFIX "missing write data confirmation, " | ||
213 | "don't expect it any longer.\n"); | ||
214 | set_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags); | ||
215 | } else { | ||
216 | /* missing GPEs, switch back to poll mode */ | ||
217 | if (printk_ratelimit()) | ||
218 | pr_info(PREFIX "missing confirmations, " | ||
219 | "switch off interrupt mode.\n"); | 186 | "switch off interrupt mode.\n"); |
220 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 187 | ec_switch_to_poll_mode(ec); |
221 | } | 188 | ec_schedule_ec_poll(ec); |
222 | goto end; | 189 | return 0; |
223 | } | 190 | } |
224 | } else { | 191 | } else { |
225 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 192 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
226 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 193 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
227 | while (time_before(jiffies, delay)) { | 194 | while (time_before(jiffies, delay)) { |
228 | if (acpi_ec_check_status(ec, event)) | 195 | if (acpi_ec_check_status(ec, event)) |
229 | goto end; | 196 | return 0; |
197 | udelay(ACPI_EC_UDELAY); | ||
230 | } | 198 | } |
231 | } | 199 | } |
232 | pr_err(PREFIX "acpi_ec_wait timeout," | 200 | pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n", |
233 | " status = %d, expect_event = %d\n", | 201 | acpi_ec_read_status(ec), |
234 | acpi_ec_read_status(ec), event); | 202 | (event == ACPI_EC_EVENT_OBF_1) ? "\"b0=1\"" : "\"b1=0\""); |
235 | ret = -ETIME; | 203 | return -ETIME; |
236 | end: | ||
237 | clear_bit(EC_FLAGS_ADDRESS, &ec->flags); | ||
238 | return ret; | ||
239 | } | 204 | } |
240 | 205 | ||
241 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | 206 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, |
@@ -245,8 +210,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
245 | { | 210 | { |
246 | int result = 0; | 211 | int result = 0; |
247 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 212 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
248 | acpi_ec_write_cmd(ec, command); | ||
249 | pr_debug(PREFIX "transaction start\n"); | 213 | pr_debug(PREFIX "transaction start\n"); |
214 | acpi_ec_write_cmd(ec, command); | ||
250 | for (; wdata_len > 0; --wdata_len) { | 215 | for (; wdata_len > 0; --wdata_len) { |
251 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); | 216 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); |
252 | if (result) { | 217 | if (result) { |
@@ -254,15 +219,11 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
254 | "write_cmd timeout, command = %d\n", command); | 219 | "write_cmd timeout, command = %d\n", command); |
255 | goto end; | 220 | goto end; |
256 | } | 221 | } |
257 | /* mark the address byte written to EC */ | ||
258 | if (rdata_len + wdata_len > 1) | ||
259 | set_bit(EC_FLAGS_ADDRESS, &ec->flags); | ||
260 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 222 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
261 | acpi_ec_write_data(ec, *(wdata++)); | 223 | acpi_ec_write_data(ec, *(wdata++)); |
262 | } | 224 | } |
263 | 225 | ||
264 | if (!rdata_len) { | 226 | if (!rdata_len) { |
265 | set_bit(EC_FLAGS_WDATA, &ec->flags); | ||
266 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); | 227 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); |
267 | if (result) { | 228 | if (result) { |
268 | pr_err(PREFIX | 229 | pr_err(PREFIX |
@@ -527,47 +488,51 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
527 | { | 488 | { |
528 | acpi_status status = AE_OK; | 489 | acpi_status status = AE_OK; |
529 | struct acpi_ec *ec = data; | 490 | struct acpi_ec *ec = data; |
491 | u8 state = acpi_ec_read_status(ec); | ||
530 | 492 | ||
531 | pr_debug(PREFIX "~~~> interrupt\n"); | 493 | pr_debug(PREFIX "~~~> interrupt\n"); |
494 | atomic_inc(&ec->irq_count); | ||
495 | if (atomic_read(&ec->irq_count) > 5) { | ||
496 | pr_err(PREFIX "GPE storm detected, disabling EC GPE\n"); | ||
497 | ec_switch_to_poll_mode(ec); | ||
498 | goto end; | ||
499 | } | ||
532 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 500 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
533 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) | 501 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) |
534 | wake_up(&ec->wait); | 502 | wake_up(&ec->wait); |
535 | 503 | ||
536 | if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) { | 504 | if (state & ACPI_EC_FLAG_SCI) { |
537 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) | 505 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) |
538 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, | 506 | status = acpi_os_execute(OSL_EC_BURST_HANDLER, |
539 | acpi_ec_gpe_query, ec); | 507 | acpi_ec_gpe_query, ec); |
540 | } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) { | 508 | } else if (!test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && |
509 | !test_bit(EC_FLAGS_NO_GPE, &ec->flags) && | ||
510 | in_interrupt()) { | ||
541 | /* this is non-query, must be confirmation */ | 511 | /* this is non-query, must be confirmation */ |
542 | if (printk_ratelimit()) | 512 | if (printk_ratelimit()) |
543 | pr_info(PREFIX "non-query interrupt received," | 513 | pr_info(PREFIX "non-query interrupt received," |
544 | " switching to interrupt mode\n"); | 514 | " switching to interrupt mode\n"); |
545 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 515 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
516 | clear_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags); | ||
546 | } | 517 | } |
547 | 518 | end: | |
519 | ec_schedule_ec_poll(ec); | ||
548 | return ACPI_SUCCESS(status) ? | 520 | return ACPI_SUCCESS(status) ? |
549 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | 521 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; |
550 | } | 522 | } |
551 | 523 | ||
524 | static void do_ec_poll(struct work_struct *work) | ||
525 | { | ||
526 | struct acpi_ec *ec = container_of(work, struct acpi_ec, work.work); | ||
527 | atomic_set(&ec->irq_count, 0); | ||
528 | (void)acpi_ec_gpe_handler(ec); | ||
529 | } | ||
530 | |||
552 | /* -------------------------------------------------------------------------- | 531 | /* -------------------------------------------------------------------------- |
553 | Address Space Management | 532 | Address Space Management |
554 | -------------------------------------------------------------------------- */ | 533 | -------------------------------------------------------------------------- */ |
555 | 534 | ||
556 | static acpi_status | 535 | static acpi_status |
557 | acpi_ec_space_setup(acpi_handle region_handle, | ||
558 | u32 function, void *handler_context, void **return_context) | ||
559 | { | ||
560 | /* | ||
561 | * The EC object is in the handler context and is needed | ||
562 | * when calling the acpi_ec_space_handler. | ||
563 | */ | ||
564 | *return_context = (function != ACPI_REGION_DEACTIVATE) ? | ||
565 | handler_context : NULL; | ||
566 | |||
567 | return AE_OK; | ||
568 | } | ||
569 | |||
570 | static acpi_status | ||
571 | acpi_ec_space_handler(u32 function, acpi_physical_address address, | 536 | acpi_ec_space_handler(u32 function, acpi_physical_address address, |
572 | u32 bits, acpi_integer *value, | 537 | u32 bits, acpi_integer *value, |
573 | void *handler_context, void *region_context) | 538 | void *handler_context, void *region_context) |
@@ -704,6 +669,8 @@ static struct acpi_ec *make_acpi_ec(void) | |||
704 | mutex_init(&ec->lock); | 669 | mutex_init(&ec->lock); |
705 | init_waitqueue_head(&ec->wait); | 670 | init_waitqueue_head(&ec->wait); |
706 | INIT_LIST_HEAD(&ec->list); | 671 | INIT_LIST_HEAD(&ec->list); |
672 | INIT_DELAYED_WORK_DEFERRABLE(&ec->work, do_ec_poll); | ||
673 | atomic_set(&ec->irq_count, 0); | ||
707 | return ec; | 674 | return ec; |
708 | } | 675 | } |
709 | 676 | ||
@@ -736,17 +703,21 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) | |||
736 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe); | 703 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe); |
737 | if (ACPI_FAILURE(status)) | 704 | if (ACPI_FAILURE(status)) |
738 | return status; | 705 | return status; |
739 | /* Find and register all query methods */ | ||
740 | acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1, | ||
741 | acpi_ec_register_query_methods, ec, NULL); | ||
742 | /* Use the global lock for all EC transactions? */ | 706 | /* Use the global lock for all EC transactions? */ |
743 | acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); | 707 | acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); |
744 | ec->handle = handle; | 708 | ec->handle = handle; |
745 | return AE_CTRL_TERMINATE; | 709 | return AE_CTRL_TERMINATE; |
746 | } | 710 | } |
747 | 711 | ||
712 | static void ec_poll_stop(struct acpi_ec *ec) | ||
713 | { | ||
714 | clear_bit(EC_FLAGS_RESCHEDULE_POLL, &ec->flags); | ||
715 | cancel_delayed_work(&ec->work); | ||
716 | } | ||
717 | |||
748 | static void ec_remove_handlers(struct acpi_ec *ec) | 718 | static void ec_remove_handlers(struct acpi_ec *ec) |
749 | { | 719 | { |
720 | ec_poll_stop(ec); | ||
750 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, | 721 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, |
751 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) | 722 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) |
752 | pr_err(PREFIX "failed to remove space handler\n"); | 723 | pr_err(PREFIX "failed to remove space handler\n"); |
@@ -766,31 +737,28 @@ static int acpi_ec_add(struct acpi_device *device) | |||
766 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 737 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
767 | 738 | ||
768 | /* Check for boot EC */ | 739 | /* Check for boot EC */ |
769 | if (boot_ec) { | 740 | if (boot_ec && |
770 | if (boot_ec->handle == device->handle) { | 741 | (boot_ec->handle == device->handle || |
771 | /* Pre-loaded EC from DSDT, just move pointer */ | 742 | boot_ec->handle == ACPI_ROOT_OBJECT)) { |
772 | ec = boot_ec; | 743 | ec = boot_ec; |
773 | boot_ec = NULL; | 744 | boot_ec = NULL; |
774 | goto end; | 745 | } else { |
775 | } else if (boot_ec->handle == ACPI_ROOT_OBJECT) { | 746 | ec = make_acpi_ec(); |
776 | /* ECDT-based EC, time to shut it down */ | 747 | if (!ec) |
777 | ec_remove_handlers(boot_ec); | 748 | return -ENOMEM; |
778 | kfree(boot_ec); | 749 | if (ec_parse_device(device->handle, 0, ec, NULL) != |
779 | first_ec = boot_ec = NULL; | 750 | AE_CTRL_TERMINATE) { |
751 | kfree(ec); | ||
752 | return -EINVAL; | ||
780 | } | 753 | } |
781 | } | 754 | } |
782 | 755 | ||
783 | ec = make_acpi_ec(); | ||
784 | if (!ec) | ||
785 | return -ENOMEM; | ||
786 | |||
787 | if (ec_parse_device(device->handle, 0, ec, NULL) != | ||
788 | AE_CTRL_TERMINATE) { | ||
789 | kfree(ec); | ||
790 | return -EINVAL; | ||
791 | } | ||
792 | ec->handle = device->handle; | 756 | ec->handle = device->handle; |
793 | end: | 757 | |
758 | /* Find and register all query methods */ | ||
759 | acpi_walk_namespace(ACPI_TYPE_METHOD, ec->handle, 1, | ||
760 | acpi_ec_register_query_methods, ec, NULL); | ||
761 | |||
794 | if (!first_ec) | 762 | if (!first_ec) |
795 | first_ec = ec; | 763 | first_ec = ec; |
796 | acpi_driver_data(device) = ec; | 764 | acpi_driver_data(device) = ec; |
@@ -865,7 +833,7 @@ static int ec_install_handlers(struct acpi_ec *ec) | |||
865 | status = acpi_install_address_space_handler(ec->handle, | 833 | status = acpi_install_address_space_handler(ec->handle, |
866 | ACPI_ADR_SPACE_EC, | 834 | ACPI_ADR_SPACE_EC, |
867 | &acpi_ec_space_handler, | 835 | &acpi_ec_space_handler, |
868 | &acpi_ec_space_setup, ec); | 836 | NULL, ec); |
869 | if (ACPI_FAILURE(status)) { | 837 | if (ACPI_FAILURE(status)) { |
870 | acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); | 838 | acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler); |
871 | return -ENODEV; | 839 | return -ENODEV; |
@@ -892,6 +860,7 @@ static int acpi_ec_start(struct acpi_device *device) | |||
892 | 860 | ||
893 | /* EC is fully operational, allow queries */ | 861 | /* EC is fully operational, allow queries */ |
894 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 862 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
863 | ec_schedule_ec_poll(ec); | ||
895 | return ret; | 864 | return ret; |
896 | } | 865 | } |
897 | 866 | ||
@@ -919,6 +888,11 @@ int __init acpi_boot_ec_enable(void) | |||
919 | return -EFAULT; | 888 | return -EFAULT; |
920 | } | 889 | } |
921 | 890 | ||
891 | static const struct acpi_device_id ec_device_ids[] = { | ||
892 | {"PNP0C09", 0}, | ||
893 | {"", 0}, | ||
894 | }; | ||
895 | |||
922 | int __init acpi_ec_ecdt_probe(void) | 896 | int __init acpi_ec_ecdt_probe(void) |
923 | { | 897 | { |
924 | int ret; | 898 | int ret; |
@@ -939,6 +913,7 @@ int __init acpi_ec_ecdt_probe(void) | |||
939 | boot_ec->data_addr = ecdt_ptr->data.address; | 913 | boot_ec->data_addr = ecdt_ptr->data.address; |
940 | boot_ec->gpe = ecdt_ptr->gpe; | 914 | boot_ec->gpe = ecdt_ptr->gpe; |
941 | boot_ec->handle = ACPI_ROOT_OBJECT; | 915 | boot_ec->handle = ACPI_ROOT_OBJECT; |
916 | acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); | ||
942 | } else { | 917 | } else { |
943 | /* This workaround is needed only on some broken machines, | 918 | /* This workaround is needed only on some broken machines, |
944 | * which require early EC, but fail to provide ECDT */ | 919 | * which require early EC, but fail to provide ECDT */ |
@@ -968,6 +943,39 @@ int __init acpi_ec_ecdt_probe(void) | |||
968 | return -ENODEV; | 943 | return -ENODEV; |
969 | } | 944 | } |
970 | 945 | ||
946 | static int acpi_ec_suspend(struct acpi_device *device, pm_message_t state) | ||
947 | { | ||
948 | struct acpi_ec *ec = acpi_driver_data(device); | ||
949 | /* Stop using GPE */ | ||
950 | set_bit(EC_FLAGS_NO_GPE, &ec->flags); | ||
951 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | ||
952 | acpi_disable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | ||
953 | return 0; | ||
954 | } | ||
955 | |||
956 | static int acpi_ec_resume(struct acpi_device *device) | ||
957 | { | ||
958 | struct acpi_ec *ec = acpi_driver_data(device); | ||
959 | /* Enable use of GPE back */ | ||
960 | clear_bit(EC_FLAGS_NO_GPE, &ec->flags); | ||
961 | acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); | ||
962 | return 0; | ||
963 | } | ||
964 | |||
965 | static struct acpi_driver acpi_ec_driver = { | ||
966 | .name = "ec", | ||
967 | .class = ACPI_EC_CLASS, | ||
968 | .ids = ec_device_ids, | ||
969 | .ops = { | ||
970 | .add = acpi_ec_add, | ||
971 | .remove = acpi_ec_remove, | ||
972 | .start = acpi_ec_start, | ||
973 | .stop = acpi_ec_stop, | ||
974 | .suspend = acpi_ec_suspend, | ||
975 | .resume = acpi_ec_resume, | ||
976 | }, | ||
977 | }; | ||
978 | |||
971 | static int __init acpi_ec_init(void) | 979 | static int __init acpi_ec_init(void) |
972 | { | 980 | { |
973 | int result = 0; | 981 | int result = 0; |
diff --git a/drivers/acpi/events/evevent.c b/drivers/acpi/events/evevent.c index 3048801a37b5..5d30e5be1b1c 100644 --- a/drivers/acpi/events/evevent.c +++ b/drivers/acpi/events/evevent.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/events/evgpe.c b/drivers/acpi/events/evgpe.c index 0dadd2adc800..5354be44f876 100644 --- a/drivers/acpi/events/evgpe.c +++ b/drivers/acpi/events/evgpe.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -248,10 +248,6 @@ acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
248 | 248 | ||
249 | ACPI_FUNCTION_TRACE(ev_disable_gpe); | 249 | ACPI_FUNCTION_TRACE(ev_disable_gpe); |
250 | 250 | ||
251 | if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) { | ||
252 | return_ACPI_STATUS(AE_OK); | ||
253 | } | ||
254 | |||
255 | /* Make sure HW enable masks are updated */ | 251 | /* Make sure HW enable masks are updated */ |
256 | 252 | ||
257 | status = | 253 | status = |
diff --git a/drivers/acpi/events/evgpeblk.c b/drivers/acpi/events/evgpeblk.c index 361ebe6c4a6f..e6c4d4c49e79 100644 --- a/drivers/acpi/events/evgpeblk.c +++ b/drivers/acpi/events/evgpeblk.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/events/evmisc.c b/drivers/acpi/events/evmisc.c index 21cb749d0c75..2113e58e2221 100644 --- a/drivers/acpi/events/evmisc.c +++ b/drivers/acpi/events/evmisc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -49,22 +49,7 @@ | |||
49 | #define _COMPONENT ACPI_EVENTS | 49 | #define _COMPONENT ACPI_EVENTS |
50 | ACPI_MODULE_NAME("evmisc") | 50 | ACPI_MODULE_NAME("evmisc") |
51 | 51 | ||
52 | /* Names for Notify() values, used for debug output */ | ||
53 | #ifdef ACPI_DEBUG_OUTPUT | ||
54 | static const char *acpi_notify_value_names[] = { | ||
55 | "Bus Check", | ||
56 | "Device Check", | ||
57 | "Device Wake", | ||
58 | "Eject Request", | ||
59 | "Device Check Light", | ||
60 | "Frequency Mismatch", | ||
61 | "Bus Mode Mismatch", | ||
62 | "Power Fault" | ||
63 | }; | ||
64 | #endif | ||
65 | |||
66 | /* Pointer to FACS needed for the Global Lock */ | 52 | /* Pointer to FACS needed for the Global Lock */ |
67 | |||
68 | static struct acpi_table_facs *facs = NULL; | 53 | static struct acpi_table_facs *facs = NULL; |
69 | 54 | ||
70 | /* Local prototypes */ | 55 | /* Local prototypes */ |
@@ -94,7 +79,6 @@ u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node) | |||
94 | switch (node->type) { | 79 | switch (node->type) { |
95 | case ACPI_TYPE_DEVICE: | 80 | case ACPI_TYPE_DEVICE: |
96 | case ACPI_TYPE_PROCESSOR: | 81 | case ACPI_TYPE_PROCESSOR: |
97 | case ACPI_TYPE_POWER: | ||
98 | case ACPI_TYPE_THERMAL: | 82 | case ACPI_TYPE_THERMAL: |
99 | /* | 83 | /* |
100 | * These are the ONLY objects that can receive ACPI notifications | 84 | * These are the ONLY objects that can receive ACPI notifications |
@@ -139,17 +123,9 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
139 | * initiate soft-off or sleep operation? | 123 | * initiate soft-off or sleep operation? |
140 | */ | 124 | */ |
141 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 125 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
142 | "Dispatching Notify(%X) on node %p\n", notify_value, | 126 | "Dispatching Notify on [%4.4s] Node %p Value 0x%2.2X (%s)\n", |
143 | node)); | 127 | acpi_ut_get_node_name(node), node, notify_value, |
144 | 128 | acpi_ut_get_notify_name(notify_value))); | |
145 | if (notify_value <= 7) { | ||
146 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n", | ||
147 | acpi_notify_value_names[notify_value])); | ||
148 | } else { | ||
149 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
150 | "Notify value: 0x%2.2X **Device Specific**\n", | ||
151 | notify_value)); | ||
152 | } | ||
153 | 129 | ||
154 | /* Get the notify object attached to the NS Node */ | 130 | /* Get the notify object attached to the NS Node */ |
155 | 131 | ||
@@ -159,10 +135,12 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
159 | /* We have the notify object, Get the right handler */ | 135 | /* We have the notify object, Get the right handler */ |
160 | 136 | ||
161 | switch (node->type) { | 137 | switch (node->type) { |
138 | |||
139 | /* Notify allowed only on these types */ | ||
140 | |||
162 | case ACPI_TYPE_DEVICE: | 141 | case ACPI_TYPE_DEVICE: |
163 | case ACPI_TYPE_THERMAL: | 142 | case ACPI_TYPE_THERMAL: |
164 | case ACPI_TYPE_PROCESSOR: | 143 | case ACPI_TYPE_PROCESSOR: |
165 | case ACPI_TYPE_POWER: | ||
166 | 144 | ||
167 | if (notify_value <= ACPI_MAX_SYS_NOTIFY) { | 145 | if (notify_value <= ACPI_MAX_SYS_NOTIFY) { |
168 | handler_obj = | 146 | handler_obj = |
@@ -179,8 +157,13 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
179 | } | 157 | } |
180 | } | 158 | } |
181 | 159 | ||
182 | /* If there is any handler to run, schedule the dispatcher */ | 160 | /* |
183 | 161 | * If there is any handler to run, schedule the dispatcher. | |
162 | * Check for: | ||
163 | * 1) Global system notify handler | ||
164 | * 2) Global device notify handler | ||
165 | * 3) Per-device notify handler | ||
166 | */ | ||
184 | if ((acpi_gbl_system_notify.handler | 167 | if ((acpi_gbl_system_notify.handler |
185 | && (notify_value <= ACPI_MAX_SYS_NOTIFY)) | 168 | && (notify_value <= ACPI_MAX_SYS_NOTIFY)) |
186 | || (acpi_gbl_device_notify.handler | 169 | || (acpi_gbl_device_notify.handler |
@@ -190,6 +173,13 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
190 | return (AE_NO_MEMORY); | 173 | return (AE_NO_MEMORY); |
191 | } | 174 | } |
192 | 175 | ||
176 | if (!handler_obj) { | ||
177 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
178 | "Executing system notify handler for Notify (%4.4s, %X) node %p\n", | ||
179 | acpi_ut_get_node_name(node), | ||
180 | notify_value, node)); | ||
181 | } | ||
182 | |||
193 | notify_info->common.descriptor_type = | 183 | notify_info->common.descriptor_type = |
194 | ACPI_DESC_TYPE_STATE_NOTIFY; | 184 | ACPI_DESC_TYPE_STATE_NOTIFY; |
195 | notify_info->notify.node = node; | 185 | notify_info->notify.node = node; |
@@ -202,15 +192,12 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, | |||
202 | if (ACPI_FAILURE(status)) { | 192 | if (ACPI_FAILURE(status)) { |
203 | acpi_ut_delete_generic_state(notify_info); | 193 | acpi_ut_delete_generic_state(notify_info); |
204 | } | 194 | } |
205 | } | 195 | } else { |
206 | |||
207 | if (!handler_obj) { | ||
208 | /* | 196 | /* |
209 | * There is no per-device notify handler for this device. | 197 | * There is no notify handler (per-device or system) for this device. |
210 | * This may or may not be a problem. | ||
211 | */ | 198 | */ |
212 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 199 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
213 | "No notify handler for Notify(%4.4s, %X) node %p\n", | 200 | "No notify handler for Notify (%4.4s, %X) node %p\n", |
214 | acpi_ut_get_node_name(node), notify_value, | 201 | acpi_ut_get_node_name(node), notify_value, |
215 | node)); | 202 | node)); |
216 | } | 203 | } |
@@ -349,9 +336,10 @@ acpi_status acpi_ev_init_global_lock_handler(void) | |||
349 | 336 | ||
350 | ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); | 337 | ACPI_FUNCTION_TRACE(ev_init_global_lock_handler); |
351 | 338 | ||
352 | status = | 339 | status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, |
353 | acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, | 340 | ACPI_CAST_INDIRECT_PTR(struct |
354 | (struct acpi_table_header **)&facs); | 341 | acpi_table_header, |
342 | &facs)); | ||
355 | if (ACPI_FAILURE(status)) { | 343 | if (ACPI_FAILURE(status)) { |
356 | return_ACPI_STATUS(status); | 344 | return_ACPI_STATUS(status); |
357 | } | 345 | } |
@@ -439,7 +427,8 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
439 | * Only one thread can acquire the GL at a time, the global_lock_mutex | 427 | * Only one thread can acquire the GL at a time, the global_lock_mutex |
440 | * enforces this. This interface releases the interpreter if we must wait. | 428 | * enforces this. This interface releases the interpreter if we must wait. |
441 | */ | 429 | */ |
442 | status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, 0); | 430 | status = acpi_ex_system_wait_mutex( |
431 | acpi_gbl_global_lock_mutex->mutex.os_mutex, 0); | ||
443 | if (status == AE_TIME) { | 432 | if (status == AE_TIME) { |
444 | if (acpi_ev_global_lock_thread_id == acpi_os_get_thread_id()) { | 433 | if (acpi_ev_global_lock_thread_id == acpi_os_get_thread_id()) { |
445 | acpi_ev_global_lock_acquired++; | 434 | acpi_ev_global_lock_acquired++; |
@@ -448,9 +437,9 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
448 | } | 437 | } |
449 | 438 | ||
450 | if (ACPI_FAILURE(status)) { | 439 | if (ACPI_FAILURE(status)) { |
451 | status = | 440 | status = acpi_ex_system_wait_mutex( |
452 | acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, | 441 | acpi_gbl_global_lock_mutex->mutex.os_mutex, |
453 | timeout); | 442 | timeout); |
454 | } | 443 | } |
455 | if (ACPI_FAILURE(status)) { | 444 | if (ACPI_FAILURE(status)) { |
456 | return_ACPI_STATUS(status); | 445 | return_ACPI_STATUS(status); |
@@ -460,6 +449,19 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout) | |||
460 | acpi_ev_global_lock_acquired++; | 449 | acpi_ev_global_lock_acquired++; |
461 | 450 | ||
462 | /* | 451 | /* |
452 | * Update the global lock handle and check for wraparound. The handle is | ||
453 | * only used for the external global lock interfaces, but it is updated | ||
454 | * here to properly handle the case where a single thread may acquire the | ||
455 | * lock via both the AML and the acpi_acquire_global_lock interfaces. The | ||
456 | * handle is therefore updated on the first acquire from a given thread | ||
457 | * regardless of where the acquisition request originated. | ||
458 | */ | ||
459 | acpi_gbl_global_lock_handle++; | ||
460 | if (acpi_gbl_global_lock_handle == 0) { | ||
461 | acpi_gbl_global_lock_handle = 1; | ||
462 | } | ||
463 | |||
464 | /* | ||
463 | * Make sure that a global lock actually exists. If not, just treat | 465 | * Make sure that a global lock actually exists. If not, just treat |
464 | * the lock as a standard mutex. | 466 | * the lock as a standard mutex. |
465 | */ | 467 | */ |
@@ -555,7 +557,7 @@ acpi_status acpi_ev_release_global_lock(void) | |||
555 | /* Release the local GL mutex */ | 557 | /* Release the local GL mutex */ |
556 | acpi_ev_global_lock_thread_id = NULL; | 558 | acpi_ev_global_lock_thread_id = NULL; |
557 | acpi_ev_global_lock_acquired = 0; | 559 | acpi_ev_global_lock_acquired = 0; |
558 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex); | 560 | acpi_os_release_mutex(acpi_gbl_global_lock_mutex->mutex.os_mutex); |
559 | return_ACPI_STATUS(status); | 561 | return_ACPI_STATUS(status); |
560 | } | 562 | } |
561 | 563 | ||
diff --git a/drivers/acpi/events/evregion.c b/drivers/acpi/events/evregion.c index 58ad09725dd2..1628f5934752 100644 --- a/drivers/acpi/events/evregion.c +++ b/drivers/acpi/events/evregion.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -394,7 +394,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
394 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | 394 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, |
395 | "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", | 395 | "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", |
396 | ®ion_obj->region.handler->address_space, handler, | 396 | ®ion_obj->region.handler->address_space, handler, |
397 | ACPI_FORMAT_UINT64(address), | 397 | ACPI_FORMAT_NATIVE_UINT(address), |
398 | acpi_ut_get_region_name(region_obj->region. | 398 | acpi_ut_get_region_name(region_obj->region. |
399 | space_id))); | 399 | space_id))); |
400 | 400 | ||
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index b1aaa0e84588..2e3d2c5e4f4d 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/events/evsci.c b/drivers/acpi/events/evsci.c index 7e5d15ce2395..2a8b77877610 100644 --- a/drivers/acpi/events/evsci.c +++ b/drivers/acpi/events/evsci.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/events/evxface.c b/drivers/acpi/events/evxface.c index 6d866a01f5f4..94a6efe020be 100644 --- a/drivers/acpi/events/evxface.c +++ b/drivers/acpi/events/evxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -758,6 +758,12 @@ ACPI_EXPORT_SYMBOL(acpi_remove_gpe_handler) | |||
758 | * | 758 | * |
759 | * DESCRIPTION: Acquire the ACPI Global Lock | 759 | * DESCRIPTION: Acquire the ACPI Global Lock |
760 | * | 760 | * |
761 | * Note: Allows callers with the same thread ID to acquire the global lock | ||
762 | * multiple times. In other words, externally, the behavior of the global lock | ||
763 | * is identical to an AML mutex. On the first acquire, a new handle is | ||
764 | * returned. On any subsequent calls to acquire by the same thread, the same | ||
765 | * handle is returned. | ||
766 | * | ||
761 | ******************************************************************************/ | 767 | ******************************************************************************/ |
762 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | 768 | acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) |
763 | { | 769 | { |
@@ -770,14 +776,19 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle) | |||
770 | /* Must lock interpreter to prevent race conditions */ | 776 | /* Must lock interpreter to prevent race conditions */ |
771 | 777 | ||
772 | acpi_ex_enter_interpreter(); | 778 | acpi_ex_enter_interpreter(); |
773 | status = acpi_ev_acquire_global_lock(timeout); | 779 | |
774 | acpi_ex_exit_interpreter(); | 780 | status = acpi_ex_acquire_mutex_object(timeout, |
781 | acpi_gbl_global_lock_mutex, | ||
782 | acpi_os_get_thread_id()); | ||
775 | 783 | ||
776 | if (ACPI_SUCCESS(status)) { | 784 | if (ACPI_SUCCESS(status)) { |
777 | acpi_gbl_global_lock_handle++; | 785 | |
786 | /* Return the global lock handle (updated in acpi_ev_acquire_global_lock) */ | ||
787 | |||
778 | *handle = acpi_gbl_global_lock_handle; | 788 | *handle = acpi_gbl_global_lock_handle; |
779 | } | 789 | } |
780 | 790 | ||
791 | acpi_ex_exit_interpreter(); | ||
781 | return (status); | 792 | return (status); |
782 | } | 793 | } |
783 | 794 | ||
@@ -798,11 +809,11 @@ acpi_status acpi_release_global_lock(u32 handle) | |||
798 | { | 809 | { |
799 | acpi_status status; | 810 | acpi_status status; |
800 | 811 | ||
801 | if (handle != acpi_gbl_global_lock_handle) { | 812 | if (!handle || (handle != acpi_gbl_global_lock_handle)) { |
802 | return (AE_NOT_ACQUIRED); | 813 | return (AE_NOT_ACQUIRED); |
803 | } | 814 | } |
804 | 815 | ||
805 | status = acpi_ev_release_global_lock(); | 816 | status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex); |
806 | return (status); | 817 | return (status); |
807 | } | 818 | } |
808 | 819 | ||
diff --git a/drivers/acpi/events/evxfevnt.c b/drivers/acpi/events/evxfevnt.c index 9cbd3414a574..99a7502e6a87 100644 --- a/drivers/acpi/events/evxfevnt.c +++ b/drivers/acpi/events/evxfevnt.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/events/evxfregn.c b/drivers/acpi/events/evxfregn.c index 7bf09c5fb242..e8750807e57d 100644 --- a/drivers/acpi/events/evxfregn.c +++ b/drivers/acpi/events/evxfregn.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/executer/exconfig.c b/drivers/acpi/executer/exconfig.c index 25802f302ffe..24da921d13e3 100644 --- a/drivers/acpi/executer/exconfig.c +++ b/drivers/acpi/executer/exconfig.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -45,7 +45,6 @@ | |||
45 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
46 | #include <acpi/amlcode.h> | 46 | #include <acpi/amlcode.h> |
47 | #include <acpi/acnamesp.h> | 47 | #include <acpi/acnamesp.h> |
48 | #include <acpi/acevents.h> | ||
49 | #include <acpi/actables.h> | 48 | #include <acpi/actables.h> |
50 | #include <acpi/acdispat.h> | 49 | #include <acpi/acdispat.h> |
51 | 50 | ||
@@ -138,6 +137,14 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
138 | 137 | ||
139 | ACPI_FUNCTION_TRACE(ex_load_table_op); | 138 | ACPI_FUNCTION_TRACE(ex_load_table_op); |
140 | 139 | ||
140 | /* Validate lengths for the signature_string, OEMIDString, OEMtable_iD */ | ||
141 | |||
142 | if ((operand[0]->string.length > ACPI_NAME_SIZE) || | ||
143 | (operand[1]->string.length > ACPI_OEM_ID_SIZE) || | ||
144 | (operand[2]->string.length > ACPI_OEM_TABLE_ID_SIZE)) { | ||
145 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
146 | } | ||
147 | |||
141 | /* Find the ACPI table in the RSDT/XSDT */ | 148 | /* Find the ACPI table in the RSDT/XSDT */ |
142 | 149 | ||
143 | status = acpi_tb_find_table(operand[0]->string.pointer, | 150 | status = acpi_tb_find_table(operand[0]->string.pointer, |
@@ -229,11 +236,18 @@ acpi_ex_load_table_op(struct acpi_walk_state *walk_state, | |||
229 | status = acpi_get_table_by_index(table_index, &table); | 236 | status = acpi_get_table_by_index(table_index, &table); |
230 | if (ACPI_SUCCESS(status)) { | 237 | if (ACPI_SUCCESS(status)) { |
231 | ACPI_INFO((AE_INFO, | 238 | ACPI_INFO((AE_INFO, |
232 | "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]", | 239 | "Dynamic OEM Table Load - [%.4s] OemId [%.6s] OemTableId [%.8s]", |
233 | table->signature, table->oem_id, | 240 | table->signature, table->oem_id, |
234 | table->oem_table_id)); | 241 | table->oem_table_id)); |
235 | } | 242 | } |
236 | 243 | ||
244 | /* Invoke table handler if present */ | ||
245 | |||
246 | if (acpi_gbl_table_handler) { | ||
247 | (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, table, | ||
248 | acpi_gbl_table_handler_context); | ||
249 | } | ||
250 | |||
237 | *return_desc = ddb_handle; | 251 | *return_desc = ddb_handle; |
238 | return_ACPI_STATUS(status); | 252 | return_ACPI_STATUS(status); |
239 | } | 253 | } |
@@ -268,6 +282,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
268 | struct acpi_table_desc table_desc; | 282 | struct acpi_table_desc table_desc; |
269 | acpi_native_uint table_index; | 283 | acpi_native_uint table_index; |
270 | acpi_status status; | 284 | acpi_status status; |
285 | u32 length; | ||
271 | 286 | ||
272 | ACPI_FUNCTION_TRACE(ex_load_op); | 287 | ACPI_FUNCTION_TRACE(ex_load_op); |
273 | 288 | ||
@@ -278,16 +293,16 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
278 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 293 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
279 | case ACPI_TYPE_REGION: | 294 | case ACPI_TYPE_REGION: |
280 | 295 | ||
296 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n", | ||
297 | obj_desc, | ||
298 | acpi_ut_get_object_type_name(obj_desc))); | ||
299 | |||
281 | /* Region must be system_memory (from ACPI spec) */ | 300 | /* Region must be system_memory (from ACPI spec) */ |
282 | 301 | ||
283 | if (obj_desc->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) { | 302 | if (obj_desc->region.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) { |
284 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 303 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
285 | } | 304 | } |
286 | 305 | ||
287 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n", | ||
288 | obj_desc, | ||
289 | acpi_ut_get_object_type_name(obj_desc))); | ||
290 | |||
291 | /* | 306 | /* |
292 | * If the Region Address and Length have not been previously evaluated, | 307 | * If the Region Address and Length have not been previously evaluated, |
293 | * evaluate them now and save the results. | 308 | * evaluate them now and save the results. |
@@ -299,6 +314,11 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
299 | } | 314 | } |
300 | } | 315 | } |
301 | 316 | ||
317 | /* | ||
318 | * We will simply map the memory region for the table. However, the | ||
319 | * memory region is technically not guaranteed to remain stable and | ||
320 | * we may eventually have to copy the table to a local buffer. | ||
321 | */ | ||
302 | table_desc.address = obj_desc->region.address; | 322 | table_desc.address = obj_desc->region.address; |
303 | table_desc.length = obj_desc->region.length; | 323 | table_desc.length = obj_desc->region.length; |
304 | table_desc.flags = ACPI_TABLE_ORIGIN_MAPPED; | 324 | table_desc.flags = ACPI_TABLE_ORIGIN_MAPPED; |
@@ -306,18 +326,41 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
306 | 326 | ||
307 | case ACPI_TYPE_BUFFER: /* Buffer or resolved region_field */ | 327 | case ACPI_TYPE_BUFFER: /* Buffer or resolved region_field */ |
308 | 328 | ||
309 | /* Simply extract the buffer from the buffer object */ | ||
310 | |||
311 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 329 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
312 | "Load from Buffer or Field %p %s\n", obj_desc, | 330 | "Load from Buffer or Field %p %s\n", obj_desc, |
313 | acpi_ut_get_object_type_name(obj_desc))); | 331 | acpi_ut_get_object_type_name(obj_desc))); |
314 | 332 | ||
315 | table_desc.pointer = ACPI_CAST_PTR(struct acpi_table_header, | 333 | length = obj_desc->buffer.length; |
316 | obj_desc->buffer.pointer); | 334 | |
317 | table_desc.length = table_desc.pointer->length; | 335 | /* Must have at least an ACPI table header */ |
318 | table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED; | 336 | |
337 | if (length < sizeof(struct acpi_table_header)) { | ||
338 | return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); | ||
339 | } | ||
340 | |||
341 | /* Validate checksum here. It won't get validated in tb_add_table */ | ||
319 | 342 | ||
320 | obj_desc->buffer.pointer = NULL; | 343 | status = |
344 | acpi_tb_verify_checksum(ACPI_CAST_PTR | ||
345 | (struct acpi_table_header, | ||
346 | obj_desc->buffer.pointer), length); | ||
347 | if (ACPI_FAILURE(status)) { | ||
348 | return_ACPI_STATUS(status); | ||
349 | } | ||
350 | |||
351 | /* | ||
352 | * We need to copy the buffer since the original buffer could be | ||
353 | * changed or deleted in the future | ||
354 | */ | ||
355 | table_desc.pointer = ACPI_ALLOCATE(length); | ||
356 | if (!table_desc.pointer) { | ||
357 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
358 | } | ||
359 | |||
360 | ACPI_MEMCPY(table_desc.pointer, obj_desc->buffer.pointer, | ||
361 | length); | ||
362 | table_desc.length = length; | ||
363 | table_desc.flags = ACPI_TABLE_ORIGIN_ALLOCATED; | ||
321 | break; | 364 | break; |
322 | 365 | ||
323 | default: | 366 | default: |
@@ -333,7 +376,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
333 | } | 376 | } |
334 | 377 | ||
335 | status = | 378 | status = |
336 | acpi_ex_add_table(table_index, acpi_gbl_root_node, &ddb_handle); | 379 | acpi_ex_add_table(table_index, walk_state->scope_info->scope.node, |
380 | &ddb_handle); | ||
337 | if (ACPI_FAILURE(status)) { | 381 | if (ACPI_FAILURE(status)) { |
338 | 382 | ||
339 | /* On error, table_ptr was deallocated above */ | 383 | /* On error, table_ptr was deallocated above */ |
@@ -349,11 +393,23 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, | |||
349 | 393 | ||
350 | /* table_ptr was deallocated above */ | 394 | /* table_ptr was deallocated above */ |
351 | 395 | ||
396 | acpi_ut_remove_reference(ddb_handle); | ||
352 | return_ACPI_STATUS(status); | 397 | return_ACPI_STATUS(status); |
353 | } | 398 | } |
354 | 399 | ||
400 | /* Invoke table handler if present */ | ||
401 | |||
402 | if (acpi_gbl_table_handler) { | ||
403 | (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_LOAD, | ||
404 | table_desc.pointer, | ||
405 | acpi_gbl_table_handler_context); | ||
406 | } | ||
407 | |||
355 | cleanup: | 408 | cleanup: |
356 | if (ACPI_FAILURE(status)) { | 409 | if (ACPI_FAILURE(status)) { |
410 | |||
411 | /* Delete allocated buffer or mapping */ | ||
412 | |||
357 | acpi_tb_delete_table(&table_desc); | 413 | acpi_tb_delete_table(&table_desc); |
358 | } | 414 | } |
359 | return_ACPI_STATUS(status); | 415 | return_ACPI_STATUS(status); |
@@ -376,6 +432,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
376 | acpi_status status = AE_OK; | 432 | acpi_status status = AE_OK; |
377 | union acpi_operand_object *table_desc = ddb_handle; | 433 | union acpi_operand_object *table_desc = ddb_handle; |
378 | acpi_native_uint table_index; | 434 | acpi_native_uint table_index; |
435 | struct acpi_table_header *table; | ||
379 | 436 | ||
380 | ACPI_FUNCTION_TRACE(ex_unload_table); | 437 | ACPI_FUNCTION_TRACE(ex_unload_table); |
381 | 438 | ||
@@ -395,17 +452,25 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle) | |||
395 | 452 | ||
396 | table_index = (acpi_native_uint) table_desc->reference.object; | 453 | table_index = (acpi_native_uint) table_desc->reference.object; |
397 | 454 | ||
455 | /* Invoke table handler if present */ | ||
456 | |||
457 | if (acpi_gbl_table_handler) { | ||
458 | status = acpi_get_table_by_index(table_index, &table); | ||
459 | if (ACPI_SUCCESS(status)) { | ||
460 | (void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD, | ||
461 | table, | ||
462 | acpi_gbl_table_handler_context); | ||
463 | } | ||
464 | } | ||
465 | |||
398 | /* | 466 | /* |
399 | * Delete the entire namespace under this table Node | 467 | * Delete the entire namespace under this table Node |
400 | * (Offset contains the table_id) | 468 | * (Offset contains the table_id) |
401 | */ | 469 | */ |
402 | acpi_tb_delete_namespace_by_owner(table_index); | 470 | acpi_tb_delete_namespace_by_owner(table_index); |
403 | acpi_tb_release_owner_id(table_index); | 471 | (void)acpi_tb_release_owner_id(table_index); |
404 | 472 | ||
405 | acpi_tb_set_table_loaded_flag(table_index, FALSE); | 473 | acpi_tb_set_table_loaded_flag(table_index, FALSE); |
406 | 474 | ||
407 | /* Delete the table descriptor (ddb_handle) */ | 475 | return_ACPI_STATUS(AE_OK); |
408 | |||
409 | acpi_ut_remove_reference(table_desc); | ||
410 | return_ACPI_STATUS(status); | ||
411 | } | 476 | } |
diff --git a/drivers/acpi/executer/exconvrt.c b/drivers/acpi/executer/exconvrt.c index 79f2c0d42c06..fd954b4ed83d 100644 --- a/drivers/acpi/executer/exconvrt.c +++ b/drivers/acpi/executer/exconvrt.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/executer/excreate.c b/drivers/acpi/executer/excreate.c index 6e9a23e47fef..60e62c4f0577 100644 --- a/drivers/acpi/executer/excreate.c +++ b/drivers/acpi/executer/excreate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -96,6 +96,9 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
96 | * to the original Node. | 96 | * to the original Node. |
97 | */ | 97 | */ |
98 | switch (target_node->type) { | 98 | switch (target_node->type) { |
99 | |||
100 | /* For these types, the sub-object can change dynamically via a Store */ | ||
101 | |||
99 | case ACPI_TYPE_INTEGER: | 102 | case ACPI_TYPE_INTEGER: |
100 | case ACPI_TYPE_STRING: | 103 | case ACPI_TYPE_STRING: |
101 | case ACPI_TYPE_BUFFER: | 104 | case ACPI_TYPE_BUFFER: |
@@ -103,9 +106,18 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
103 | case ACPI_TYPE_BUFFER_FIELD: | 106 | case ACPI_TYPE_BUFFER_FIELD: |
104 | 107 | ||
105 | /* | 108 | /* |
109 | * These types open a new scope, so we need the NS node in order to access | ||
110 | * any children. | ||
111 | */ | ||
112 | case ACPI_TYPE_DEVICE: | ||
113 | case ACPI_TYPE_POWER: | ||
114 | case ACPI_TYPE_PROCESSOR: | ||
115 | case ACPI_TYPE_THERMAL: | ||
116 | case ACPI_TYPE_LOCAL_SCOPE: | ||
117 | |||
118 | /* | ||
106 | * The new alias has the type ALIAS and points to the original | 119 | * The new alias has the type ALIAS and points to the original |
107 | * NS node, not the object itself. This is because for these | 120 | * NS node, not the object itself. |
108 | * types, the object can change dynamically via a Store. | ||
109 | */ | 121 | */ |
110 | alias_node->type = ACPI_TYPE_LOCAL_ALIAS; | 122 | alias_node->type = ACPI_TYPE_LOCAL_ALIAS; |
111 | alias_node->object = | 123 | alias_node->object = |
@@ -115,9 +127,7 @@ acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state) | |||
115 | case ACPI_TYPE_METHOD: | 127 | case ACPI_TYPE_METHOD: |
116 | 128 | ||
117 | /* | 129 | /* |
118 | * The new alias has the type ALIAS and points to the original | 130 | * Control method aliases need to be differentiated |
119 | * NS node, not the object itself. This is because for these | ||
120 | * types, the object can change dynamically via a Store. | ||
121 | */ | 131 | */ |
122 | alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; | 132 | alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS; |
123 | alias_node->object = | 133 | alias_node->object = |
@@ -342,101 +352,6 @@ acpi_ex_create_region(u8 * aml_start, | |||
342 | 352 | ||
343 | /******************************************************************************* | 353 | /******************************************************************************* |
344 | * | 354 | * |
345 | * FUNCTION: acpi_ex_create_table_region | ||
346 | * | ||
347 | * PARAMETERS: walk_state - Current state | ||
348 | * | ||
349 | * RETURN: Status | ||
350 | * | ||
351 | * DESCRIPTION: Create a new data_table_region object | ||
352 | * | ||
353 | ******************************************************************************/ | ||
354 | |||
355 | acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state) | ||
356 | { | ||
357 | acpi_status status; | ||
358 | union acpi_operand_object **operand = &walk_state->operands[0]; | ||
359 | union acpi_operand_object *obj_desc; | ||
360 | struct acpi_namespace_node *node; | ||
361 | union acpi_operand_object *region_obj2; | ||
362 | acpi_native_uint table_index; | ||
363 | struct acpi_table_header *table; | ||
364 | |||
365 | ACPI_FUNCTION_TRACE(ex_create_table_region); | ||
366 | |||
367 | /* Get the Node from the object stack */ | ||
368 | |||
369 | node = walk_state->op->common.node; | ||
370 | |||
371 | /* | ||
372 | * If the region object is already attached to this node, | ||
373 | * just return | ||
374 | */ | ||
375 | if (acpi_ns_get_attached_object(node)) { | ||
376 | return_ACPI_STATUS(AE_OK); | ||
377 | } | ||
378 | |||
379 | /* Find the ACPI table */ | ||
380 | |||
381 | status = acpi_tb_find_table(operand[1]->string.pointer, | ||
382 | operand[2]->string.pointer, | ||
383 | operand[3]->string.pointer, &table_index); | ||
384 | if (ACPI_FAILURE(status)) { | ||
385 | return_ACPI_STATUS(status); | ||
386 | } | ||
387 | |||
388 | /* Create the region descriptor */ | ||
389 | |||
390 | obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION); | ||
391 | if (!obj_desc) { | ||
392 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
393 | } | ||
394 | |||
395 | region_obj2 = obj_desc->common.next_object; | ||
396 | region_obj2->extra.region_context = NULL; | ||
397 | |||
398 | status = acpi_get_table_by_index(table_index, &table); | ||
399 | if (ACPI_FAILURE(status)) { | ||
400 | return_ACPI_STATUS(status); | ||
401 | } | ||
402 | |||
403 | /* Init the region from the operands */ | ||
404 | |||
405 | obj_desc->region.space_id = REGION_DATA_TABLE; | ||
406 | obj_desc->region.address = | ||
407 | (acpi_physical_address) ACPI_TO_INTEGER(table); | ||
408 | obj_desc->region.length = table->length; | ||
409 | obj_desc->region.node = node; | ||
410 | obj_desc->region.flags = AOPOBJ_DATA_VALID; | ||
411 | |||
412 | /* Install the new region object in the parent Node */ | ||
413 | |||
414 | status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION); | ||
415 | if (ACPI_FAILURE(status)) { | ||
416 | goto cleanup; | ||
417 | } | ||
418 | |||
419 | status = acpi_ev_initialize_region(obj_desc, FALSE); | ||
420 | if (ACPI_FAILURE(status)) { | ||
421 | if (status == AE_NOT_EXIST) { | ||
422 | status = AE_OK; | ||
423 | } else { | ||
424 | goto cleanup; | ||
425 | } | ||
426 | } | ||
427 | |||
428 | obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE; | ||
429 | |||
430 | cleanup: | ||
431 | |||
432 | /* Remove local reference to the object */ | ||
433 | |||
434 | acpi_ut_remove_reference(obj_desc); | ||
435 | return_ACPI_STATUS(status); | ||
436 | } | ||
437 | |||
438 | /******************************************************************************* | ||
439 | * | ||
440 | * FUNCTION: acpi_ex_create_processor | 355 | * FUNCTION: acpi_ex_create_processor |
441 | * | 356 | * |
442 | * PARAMETERS: walk_state - Current state | 357 | * PARAMETERS: walk_state - Current state |
diff --git a/drivers/acpi/executer/exdump.c b/drivers/acpi/executer/exdump.c index 51c9c29987c3..74f1b22601b3 100644 --- a/drivers/acpi/executer/exdump.c +++ b/drivers/acpi/executer/exdump.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -500,25 +500,28 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
500 | acpi_os_printf("Reference: Debug\n"); | 500 | acpi_os_printf("Reference: Debug\n"); |
501 | break; | 501 | break; |
502 | 502 | ||
503 | case AML_NAME_OP: | 503 | case AML_INDEX_OP: |
504 | 504 | ||
505 | ACPI_DUMP_PATHNAME(obj_desc->reference.object, | 505 | acpi_os_printf("Reference: Index %p\n", |
506 | "Reference: Name: ", ACPI_LV_INFO, | 506 | obj_desc->reference.object); |
507 | _COMPONENT); | ||
508 | ACPI_DUMP_ENTRY(obj_desc->reference.object, | ||
509 | ACPI_LV_INFO); | ||
510 | break; | 507 | break; |
511 | 508 | ||
512 | case AML_INDEX_OP: | 509 | case AML_LOAD_OP: |
513 | 510 | ||
514 | acpi_os_printf("Reference: Index %p\n", | 511 | acpi_os_printf("Reference: [DdbHandle] TableIndex %p\n", |
515 | obj_desc->reference.object); | 512 | obj_desc->reference.object); |
516 | break; | 513 | break; |
517 | 514 | ||
518 | case AML_REF_OF_OP: | 515 | case AML_REF_OF_OP: |
519 | 516 | ||
520 | acpi_os_printf("Reference: (RefOf) %p\n", | 517 | acpi_os_printf("Reference: (RefOf) %p [%s]\n", |
521 | obj_desc->reference.object); | 518 | obj_desc->reference.object, |
519 | acpi_ut_get_type_name(((union | ||
520 | acpi_operand_object | ||
521 | *)obj_desc-> | ||
522 | reference. | ||
523 | object)->common. | ||
524 | type)); | ||
522 | break; | 525 | break; |
523 | 526 | ||
524 | case AML_ARG_OP: | 527 | case AML_ARG_OP: |
@@ -559,8 +562,9 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
559 | 562 | ||
560 | case AML_INT_NAMEPATH_OP: | 563 | case AML_INT_NAMEPATH_OP: |
561 | 564 | ||
562 | acpi_os_printf("Reference.Node->Name %X\n", | 565 | acpi_os_printf("Reference: Namepath %X [%4.4s]\n", |
563 | obj_desc->reference.node->name.integer); | 566 | obj_desc->reference.node->name.integer, |
567 | obj_desc->reference.node->name.ascii); | ||
564 | break; | 568 | break; |
565 | 569 | ||
566 | default: | 570 | default: |
@@ -640,8 +644,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) | |||
640 | acpi_os_printf("\n"); | 644 | acpi_os_printf("\n"); |
641 | } else { | 645 | } else { |
642 | acpi_os_printf(" base %8.8X%8.8X Length %X\n", | 646 | acpi_os_printf(" base %8.8X%8.8X Length %X\n", |
643 | ACPI_FORMAT_UINT64(obj_desc->region. | 647 | ACPI_FORMAT_NATIVE_UINT(obj_desc->region. |
644 | address), | 648 | address), |
645 | obj_desc->region.length); | 649 | obj_desc->region.length); |
646 | } | 650 | } |
647 | break; | 651 | break; |
@@ -877,20 +881,43 @@ static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc) | |||
877 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; | 881 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
878 | 882 | ||
879 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { | 883 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { |
880 | acpi_os_printf("Named Object %p ", obj_desc->reference.node); | 884 | acpi_os_printf(" Named Object %p ", obj_desc->reference.node); |
881 | 885 | ||
882 | status = | 886 | status = |
883 | acpi_ns_handle_to_pathname(obj_desc->reference.node, | 887 | acpi_ns_handle_to_pathname(obj_desc->reference.node, |
884 | &ret_buf); | 888 | &ret_buf); |
885 | if (ACPI_FAILURE(status)) { | 889 | if (ACPI_FAILURE(status)) { |
886 | acpi_os_printf("Could not convert name to pathname\n"); | 890 | acpi_os_printf(" Could not convert name to pathname\n"); |
887 | } else { | 891 | } else { |
888 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); | 892 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); |
889 | ACPI_FREE(ret_buf.pointer); | 893 | ACPI_FREE(ret_buf.pointer); |
890 | } | 894 | } |
891 | } else if (obj_desc->reference.object) { | 895 | } else if (obj_desc->reference.object) { |
892 | acpi_os_printf("\nReferenced Object: %p\n", | 896 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == |
893 | obj_desc->reference.object); | 897 | ACPI_DESC_TYPE_OPERAND) { |
898 | acpi_os_printf(" Target: %p", | ||
899 | obj_desc->reference.object); | ||
900 | if (obj_desc->reference.opcode == AML_LOAD_OP) { | ||
901 | /* | ||
902 | * For DDBHandle reference, | ||
903 | * obj_desc->Reference.Object is the table index | ||
904 | */ | ||
905 | acpi_os_printf(" [DDBHandle]\n"); | ||
906 | } else { | ||
907 | acpi_os_printf(" [%s]\n", | ||
908 | acpi_ut_get_type_name(((union | ||
909 | acpi_operand_object | ||
910 | *) | ||
911 | obj_desc-> | ||
912 | reference. | ||
913 | object)-> | ||
914 | common. | ||
915 | type)); | ||
916 | } | ||
917 | } else { | ||
918 | acpi_os_printf(" Target: %p\n", | ||
919 | obj_desc->reference.object); | ||
920 | } | ||
894 | } | 921 | } |
895 | } | 922 | } |
896 | 923 | ||
@@ -976,7 +1003,9 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc, | |||
976 | 1003 | ||
977 | case ACPI_TYPE_LOCAL_REFERENCE: | 1004 | case ACPI_TYPE_LOCAL_REFERENCE: |
978 | 1005 | ||
979 | acpi_os_printf("[Object Reference] "); | 1006 | acpi_os_printf("[Object Reference] %s", |
1007 | (acpi_ps_get_opcode_info | ||
1008 | (obj_desc->reference.opcode))->name); | ||
980 | acpi_ex_dump_reference_obj(obj_desc); | 1009 | acpi_ex_dump_reference_obj(obj_desc); |
981 | break; | 1010 | break; |
982 | 1011 | ||
diff --git a/drivers/acpi/executer/exfield.c b/drivers/acpi/executer/exfield.c index 2d88a3d8d1ad..3e440d84226a 100644 --- a/drivers/acpi/executer/exfield.c +++ b/drivers/acpi/executer/exfield.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -71,7 +71,6 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
71 | union acpi_operand_object *buffer_desc; | 71 | union acpi_operand_object *buffer_desc; |
72 | acpi_size length; | 72 | acpi_size length; |
73 | void *buffer; | 73 | void *buffer; |
74 | u8 locked; | ||
75 | 74 | ||
76 | ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); | 75 | ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); |
77 | 76 | ||
@@ -111,9 +110,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
111 | 110 | ||
112 | /* Lock entire transaction if requested */ | 111 | /* Lock entire transaction if requested */ |
113 | 112 | ||
114 | locked = | 113 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); |
115 | acpi_ex_acquire_global_lock(obj_desc->common_field. | ||
116 | field_flags); | ||
117 | 114 | ||
118 | /* | 115 | /* |
119 | * Perform the read. | 116 | * Perform the read. |
@@ -125,7 +122,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
125 | buffer.pointer), | 122 | buffer.pointer), |
126 | ACPI_READ | (obj_desc->field. | 123 | ACPI_READ | (obj_desc->field. |
127 | attribute << 16)); | 124 | attribute << 16)); |
128 | acpi_ex_release_global_lock(locked); | 125 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
129 | goto exit; | 126 | goto exit; |
130 | } | 127 | } |
131 | 128 | ||
@@ -175,13 +172,12 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
175 | 172 | ||
176 | /* Lock entire transaction if requested */ | 173 | /* Lock entire transaction if requested */ |
177 | 174 | ||
178 | locked = | 175 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); |
179 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
180 | 176 | ||
181 | /* Read from the field */ | 177 | /* Read from the field */ |
182 | 178 | ||
183 | status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length); | 179 | status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length); |
184 | acpi_ex_release_global_lock(locked); | 180 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
185 | 181 | ||
186 | exit: | 182 | exit: |
187 | if (ACPI_FAILURE(status)) { | 183 | if (ACPI_FAILURE(status)) { |
@@ -214,10 +210,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
214 | { | 210 | { |
215 | acpi_status status; | 211 | acpi_status status; |
216 | u32 length; | 212 | u32 length; |
217 | u32 required_length; | ||
218 | void *buffer; | 213 | void *buffer; |
219 | void *new_buffer; | ||
220 | u8 locked; | ||
221 | union acpi_operand_object *buffer_desc; | 214 | union acpi_operand_object *buffer_desc; |
222 | 215 | ||
223 | ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); | 216 | ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); |
@@ -278,9 +271,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
278 | 271 | ||
279 | /* Lock entire transaction if requested */ | 272 | /* Lock entire transaction if requested */ |
280 | 273 | ||
281 | locked = | 274 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); |
282 | acpi_ex_acquire_global_lock(obj_desc->common_field. | ||
283 | field_flags); | ||
284 | 275 | ||
285 | /* | 276 | /* |
286 | * Perform the write (returns status and perhaps data in the | 277 | * Perform the write (returns status and perhaps data in the |
@@ -291,7 +282,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
291 | (acpi_integer *) buffer, | 282 | (acpi_integer *) buffer, |
292 | ACPI_WRITE | (obj_desc->field. | 283 | ACPI_WRITE | (obj_desc->field. |
293 | attribute << 16)); | 284 | attribute << 16)); |
294 | acpi_ex_release_global_lock(locked); | 285 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
295 | 286 | ||
296 | *result_desc = buffer_desc; | 287 | *result_desc = buffer_desc; |
297 | return_ACPI_STATUS(status); | 288 | return_ACPI_STATUS(status); |
@@ -319,35 +310,6 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
319 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 310 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
320 | } | 311 | } |
321 | 312 | ||
322 | /* | ||
323 | * We must have a buffer that is at least as long as the field | ||
324 | * we are writing to. This is because individual fields are | ||
325 | * indivisible and partial writes are not supported -- as per | ||
326 | * the ACPI specification. | ||
327 | */ | ||
328 | new_buffer = NULL; | ||
329 | required_length = | ||
330 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); | ||
331 | |||
332 | if (length < required_length) { | ||
333 | |||
334 | /* We need to create a new buffer */ | ||
335 | |||
336 | new_buffer = ACPI_ALLOCATE_ZEROED(required_length); | ||
337 | if (!new_buffer) { | ||
338 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
339 | } | ||
340 | |||
341 | /* | ||
342 | * Copy the original data to the new buffer, starting | ||
343 | * at Byte zero. All unused (upper) bytes of the | ||
344 | * buffer will be 0. | ||
345 | */ | ||
346 | ACPI_MEMCPY((char *)new_buffer, (char *)buffer, length); | ||
347 | buffer = new_buffer; | ||
348 | length = required_length; | ||
349 | } | ||
350 | |||
351 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 313 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
352 | "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", | 314 | "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", |
353 | source_desc, | 315 | source_desc, |
@@ -366,19 +328,12 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
366 | 328 | ||
367 | /* Lock entire transaction if requested */ | 329 | /* Lock entire transaction if requested */ |
368 | 330 | ||
369 | locked = | 331 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); |
370 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
371 | 332 | ||
372 | /* Write to the field */ | 333 | /* Write to the field */ |
373 | 334 | ||
374 | status = acpi_ex_insert_into_field(obj_desc, buffer, length); | 335 | status = acpi_ex_insert_into_field(obj_desc, buffer, length); |
375 | acpi_ex_release_global_lock(locked); | 336 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); |
376 | |||
377 | /* Free temporary buffer if we used one */ | ||
378 | |||
379 | if (new_buffer) { | ||
380 | ACPI_FREE(new_buffer); | ||
381 | } | ||
382 | 337 | ||
383 | return_ACPI_STATUS(status); | 338 | return_ACPI_STATUS(status); |
384 | } | 339 | } |
diff --git a/drivers/acpi/executer/exfldio.c b/drivers/acpi/executer/exfldio.c index 65a48b6170ee..e336b5dc7a50 100644 --- a/drivers/acpi/executer/exfldio.c +++ b/drivers/acpi/executer/exfldio.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -263,7 +263,8 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
263 | rgn_desc->region.space_id, | 263 | rgn_desc->region.space_id, |
264 | obj_desc->common_field.access_byte_width, | 264 | obj_desc->common_field.access_byte_width, |
265 | obj_desc->common_field.base_byte_offset, | 265 | obj_desc->common_field.base_byte_offset, |
266 | field_datum_byte_offset, (void *)address)); | 266 | field_datum_byte_offset, ACPI_CAST_PTR(void, |
267 | address))); | ||
267 | 268 | ||
268 | /* Invoke the appropriate address_space/op_region handler */ | 269 | /* Invoke the appropriate address_space/op_region handler */ |
269 | 270 | ||
@@ -805,18 +806,39 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
805 | u32 datum_count; | 806 | u32 datum_count; |
806 | u32 field_datum_count; | 807 | u32 field_datum_count; |
807 | u32 i; | 808 | u32 i; |
809 | u32 required_length; | ||
810 | void *new_buffer; | ||
808 | 811 | ||
809 | ACPI_FUNCTION_TRACE(ex_insert_into_field); | 812 | ACPI_FUNCTION_TRACE(ex_insert_into_field); |
810 | 813 | ||
811 | /* Validate input buffer */ | 814 | /* Validate input buffer */ |
812 | 815 | ||
813 | if (buffer_length < | 816 | new_buffer = NULL; |
814 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { | 817 | required_length = |
815 | ACPI_ERROR((AE_INFO, | 818 | ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); |
816 | "Field size %X (bits) is too large for buffer (%X)", | 819 | /* |
817 | obj_desc->common_field.bit_length, buffer_length)); | 820 | * We must have a buffer that is at least as long as the field |
821 | * we are writing to. This is because individual fields are | ||
822 | * indivisible and partial writes are not supported -- as per | ||
823 | * the ACPI specification. | ||
824 | */ | ||
825 | if (buffer_length < required_length) { | ||
818 | 826 | ||
819 | return_ACPI_STATUS(AE_BUFFER_OVERFLOW); | 827 | /* We need to create a new buffer */ |
828 | |||
829 | new_buffer = ACPI_ALLOCATE_ZEROED(required_length); | ||
830 | if (!new_buffer) { | ||
831 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
832 | } | ||
833 | |||
834 | /* | ||
835 | * Copy the original data to the new buffer, starting | ||
836 | * at Byte zero. All unused (upper) bytes of the | ||
837 | * buffer will be 0. | ||
838 | */ | ||
839 | ACPI_MEMCPY((char *)new_buffer, (char *)buffer, buffer_length); | ||
840 | buffer = new_buffer; | ||
841 | buffer_length = required_length; | ||
820 | } | 842 | } |
821 | 843 | ||
822 | /* | 844 | /* |
@@ -866,7 +888,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
866 | merged_datum, | 888 | merged_datum, |
867 | field_offset); | 889 | field_offset); |
868 | if (ACPI_FAILURE(status)) { | 890 | if (ACPI_FAILURE(status)) { |
869 | return_ACPI_STATUS(status); | 891 | goto exit; |
870 | } | 892 | } |
871 | 893 | ||
872 | field_offset += obj_desc->common_field.access_byte_width; | 894 | field_offset += obj_desc->common_field.access_byte_width; |
@@ -924,5 +946,11 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, | |||
924 | mask, merged_datum, | 946 | mask, merged_datum, |
925 | field_offset); | 947 | field_offset); |
926 | 948 | ||
949 | exit: | ||
950 | /* Free temporary buffer if we used one */ | ||
951 | |||
952 | if (new_buffer) { | ||
953 | ACPI_FREE(new_buffer); | ||
954 | } | ||
927 | return_ACPI_STATUS(status); | 955 | return_ACPI_STATUS(status); |
928 | } | 956 | } |
diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c index f13d1cec2d6d..cc956a5b5267 100644 --- a/drivers/acpi/executer/exmisc.c +++ b/drivers/acpi/executer/exmisc.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/executer/exmutex.c b/drivers/acpi/executer/exmutex.c index 6748e3ef0997..c873ab40cd0e 100644 --- a/drivers/acpi/executer/exmutex.c +++ b/drivers/acpi/executer/exmutex.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -126,6 +126,79 @@ acpi_ex_link_mutex(union acpi_operand_object *obj_desc, | |||
126 | 126 | ||
127 | /******************************************************************************* | 127 | /******************************************************************************* |
128 | * | 128 | * |
129 | * FUNCTION: acpi_ex_acquire_mutex_object | ||
130 | * | ||
131 | * PARAMETERS: time_desc - Timeout in milliseconds | ||
132 | * obj_desc - Mutex object | ||
133 | * Thread - Current thread state | ||
134 | * | ||
135 | * RETURN: Status | ||
136 | * | ||
137 | * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common | ||
138 | * path that supports multiple acquires by the same thread. | ||
139 | * | ||
140 | * MUTEX: Interpreter must be locked | ||
141 | * | ||
142 | * NOTE: This interface is called from three places: | ||
143 | * 1) From acpi_ex_acquire_mutex, via an AML Acquire() operator | ||
144 | * 2) From acpi_ex_acquire_global_lock when an AML Field access requires the | ||
145 | * global lock | ||
146 | * 3) From the external interface, acpi_acquire_global_lock | ||
147 | * | ||
148 | ******************************************************************************/ | ||
149 | |||
150 | acpi_status | ||
151 | acpi_ex_acquire_mutex_object(u16 timeout, | ||
152 | union acpi_operand_object *obj_desc, | ||
153 | acpi_thread_id thread_id) | ||
154 | { | ||
155 | acpi_status status; | ||
156 | |||
157 | ACPI_FUNCTION_TRACE_PTR(ex_acquire_mutex_object, obj_desc); | ||
158 | |||
159 | if (!obj_desc) { | ||
160 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
161 | } | ||
162 | |||
163 | /* Support for multiple acquires by the owning thread */ | ||
164 | |||
165 | if (obj_desc->mutex.thread_id == thread_id) { | ||
166 | /* | ||
167 | * The mutex is already owned by this thread, just increment the | ||
168 | * acquisition depth | ||
169 | */ | ||
170 | obj_desc->mutex.acquisition_depth++; | ||
171 | return_ACPI_STATUS(AE_OK); | ||
172 | } | ||
173 | |||
174 | /* Acquire the mutex, wait if necessary. Special case for Global Lock */ | ||
175 | |||
176 | if (obj_desc == acpi_gbl_global_lock_mutex) { | ||
177 | status = acpi_ev_acquire_global_lock(timeout); | ||
178 | } else { | ||
179 | status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, | ||
180 | timeout); | ||
181 | } | ||
182 | |||
183 | if (ACPI_FAILURE(status)) { | ||
184 | |||
185 | /* Includes failure from a timeout on time_desc */ | ||
186 | |||
187 | return_ACPI_STATUS(status); | ||
188 | } | ||
189 | |||
190 | /* Acquired the mutex: update mutex object */ | ||
191 | |||
192 | obj_desc->mutex.thread_id = thread_id; | ||
193 | obj_desc->mutex.acquisition_depth = 1; | ||
194 | obj_desc->mutex.original_sync_level = 0; | ||
195 | obj_desc->mutex.owner_thread = NULL; /* Used only for AML Acquire() */ | ||
196 | |||
197 | return_ACPI_STATUS(AE_OK); | ||
198 | } | ||
199 | |||
200 | /******************************************************************************* | ||
201 | * | ||
129 | * FUNCTION: acpi_ex_acquire_mutex | 202 | * FUNCTION: acpi_ex_acquire_mutex |
130 | * | 203 | * |
131 | * PARAMETERS: time_desc - Timeout integer | 204 | * PARAMETERS: time_desc - Timeout integer |
@@ -151,7 +224,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
151 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 224 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
152 | } | 225 | } |
153 | 226 | ||
154 | /* Sanity check: we must have a valid thread ID */ | 227 | /* Must have a valid thread ID */ |
155 | 228 | ||
156 | if (!walk_state->thread) { | 229 | if (!walk_state->thread) { |
157 | ACPI_ERROR((AE_INFO, | 230 | ACPI_ERROR((AE_INFO, |
@@ -161,7 +234,7 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
161 | } | 234 | } |
162 | 235 | ||
163 | /* | 236 | /* |
164 | * Current Sync must be less than or equal to the sync level of the | 237 | * Current sync level must be less than or equal to the sync level of the |
165 | * mutex. This mechanism provides some deadlock prevention | 238 | * mutex. This mechanism provides some deadlock prevention |
166 | */ | 239 | */ |
167 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { | 240 | if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { |
@@ -172,51 +245,89 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, | |||
172 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 245 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
173 | } | 246 | } |
174 | 247 | ||
175 | /* Support for multiple acquires by the owning thread */ | 248 | status = acpi_ex_acquire_mutex_object((u16) time_desc->integer.value, |
249 | obj_desc, | ||
250 | walk_state->thread->thread_id); | ||
251 | if (ACPI_SUCCESS(status) && obj_desc->mutex.acquisition_depth == 1) { | ||
176 | 252 | ||
177 | if (obj_desc->mutex.owner_thread) { | 253 | /* Save Thread object, original/current sync levels */ |
178 | if (obj_desc->mutex.owner_thread->thread_id == | 254 | |
179 | walk_state->thread->thread_id) { | 255 | obj_desc->mutex.owner_thread = walk_state->thread; |
180 | /* | 256 | obj_desc->mutex.original_sync_level = |
181 | * The mutex is already owned by this thread, just increment the | 257 | walk_state->thread->current_sync_level; |
182 | * acquisition depth | 258 | walk_state->thread->current_sync_level = |
183 | */ | 259 | obj_desc->mutex.sync_level; |
184 | obj_desc->mutex.acquisition_depth++; | 260 | |
185 | return_ACPI_STATUS(AE_OK); | 261 | /* Link the mutex to the current thread for force-unlock at method exit */ |
186 | } | 262 | |
263 | acpi_ex_link_mutex(obj_desc, walk_state->thread); | ||
187 | } | 264 | } |
188 | 265 | ||
189 | /* Acquire the mutex, wait if necessary. Special case for Global Lock */ | 266 | return_ACPI_STATUS(status); |
267 | } | ||
190 | 268 | ||
191 | if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) { | 269 | /******************************************************************************* |
192 | status = | 270 | * |
193 | acpi_ev_acquire_global_lock((u16) time_desc->integer.value); | 271 | * FUNCTION: acpi_ex_release_mutex_object |
194 | } else { | 272 | * |
195 | status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, | 273 | * PARAMETERS: obj_desc - The object descriptor for this op |
196 | (u16) time_desc->integer. | 274 | * |
197 | value); | 275 | * RETURN: Status |
276 | * | ||
277 | * DESCRIPTION: Release a previously acquired Mutex, low level interface. | ||
278 | * Provides a common path that supports multiple releases (after | ||
279 | * previous multiple acquires) by the same thread. | ||
280 | * | ||
281 | * MUTEX: Interpreter must be locked | ||
282 | * | ||
283 | * NOTE: This interface is called from three places: | ||
284 | * 1) From acpi_ex_release_mutex, via an AML Acquire() operator | ||
285 | * 2) From acpi_ex_release_global_lock when an AML Field access requires the | ||
286 | * global lock | ||
287 | * 3) From the external interface, acpi_release_global_lock | ||
288 | * | ||
289 | ******************************************************************************/ | ||
290 | |||
291 | acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc) | ||
292 | { | ||
293 | acpi_status status = AE_OK; | ||
294 | |||
295 | ACPI_FUNCTION_TRACE(ex_release_mutex_object); | ||
296 | |||
297 | if (obj_desc->mutex.acquisition_depth == 0) { | ||
298 | return (AE_NOT_ACQUIRED); | ||
198 | } | 299 | } |
199 | 300 | ||
200 | if (ACPI_FAILURE(status)) { | 301 | /* Match multiple Acquires with multiple Releases */ |
201 | 302 | ||
202 | /* Includes failure from a timeout on time_desc */ | 303 | obj_desc->mutex.acquisition_depth--; |
304 | if (obj_desc->mutex.acquisition_depth != 0) { | ||
203 | 305 | ||
204 | return_ACPI_STATUS(status); | 306 | /* Just decrement the depth and return */ |
307 | |||
308 | return_ACPI_STATUS(AE_OK); | ||
205 | } | 309 | } |
206 | 310 | ||
207 | /* Have the mutex: update mutex and walk info and save the sync_level */ | 311 | if (obj_desc->mutex.owner_thread) { |
208 | 312 | ||
209 | obj_desc->mutex.owner_thread = walk_state->thread; | 313 | /* Unlink the mutex from the owner's list */ |
210 | obj_desc->mutex.acquisition_depth = 1; | ||
211 | obj_desc->mutex.original_sync_level = | ||
212 | walk_state->thread->current_sync_level; | ||
213 | 314 | ||
214 | walk_state->thread->current_sync_level = obj_desc->mutex.sync_level; | 315 | acpi_ex_unlink_mutex(obj_desc); |
316 | obj_desc->mutex.owner_thread = NULL; | ||
317 | } | ||
215 | 318 | ||
216 | /* Link the mutex to the current thread for force-unlock at method exit */ | 319 | /* Release the mutex, special case for Global Lock */ |
217 | 320 | ||
218 | acpi_ex_link_mutex(obj_desc, walk_state->thread); | 321 | if (obj_desc == acpi_gbl_global_lock_mutex) { |
219 | return_ACPI_STATUS(AE_OK); | 322 | status = acpi_ev_release_global_lock(); |
323 | } else { | ||
324 | acpi_os_release_mutex(obj_desc->mutex.os_mutex); | ||
325 | } | ||
326 | |||
327 | /* Clear mutex info */ | ||
328 | |||
329 | obj_desc->mutex.thread_id = 0; | ||
330 | return_ACPI_STATUS(status); | ||
220 | } | 331 | } |
221 | 332 | ||
222 | /******************************************************************************* | 333 | /******************************************************************************* |
@@ -253,22 +364,13 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
253 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); | 364 | return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); |
254 | } | 365 | } |
255 | 366 | ||
256 | /* Sanity check: we must have a valid thread ID */ | ||
257 | |||
258 | if (!walk_state->thread) { | ||
259 | ACPI_ERROR((AE_INFO, | ||
260 | "Cannot release Mutex [%4.4s], null thread info", | ||
261 | acpi_ut_get_node_name(obj_desc->mutex.node))); | ||
262 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
263 | } | ||
264 | |||
265 | /* | 367 | /* |
266 | * The Mutex is owned, but this thread must be the owner. | 368 | * The Mutex is owned, but this thread must be the owner. |
267 | * Special case for Global Lock, any thread can release | 369 | * Special case for Global Lock, any thread can release |
268 | */ | 370 | */ |
269 | if ((obj_desc->mutex.owner_thread->thread_id != | 371 | if ((obj_desc->mutex.owner_thread->thread_id != |
270 | walk_state->thread->thread_id) | 372 | walk_state->thread->thread_id) |
271 | && (obj_desc->mutex.os_mutex != acpi_gbl_global_lock_mutex)) { | 373 | && (obj_desc != acpi_gbl_global_lock_mutex)) { |
272 | ACPI_ERROR((AE_INFO, | 374 | ACPI_ERROR((AE_INFO, |
273 | "Thread %lX cannot release Mutex [%4.4s] acquired by thread %lX", | 375 | "Thread %lX cannot release Mutex [%4.4s] acquired by thread %lX", |
274 | (unsigned long)walk_state->thread->thread_id, | 376 | (unsigned long)walk_state->thread->thread_id, |
@@ -278,45 +380,37 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, | |||
278 | return_ACPI_STATUS(AE_AML_NOT_OWNER); | 380 | return_ACPI_STATUS(AE_AML_NOT_OWNER); |
279 | } | 381 | } |
280 | 382 | ||
383 | /* Must have a valid thread ID */ | ||
384 | |||
385 | if (!walk_state->thread) { | ||
386 | ACPI_ERROR((AE_INFO, | ||
387 | "Cannot release Mutex [%4.4s], null thread info", | ||
388 | acpi_ut_get_node_name(obj_desc->mutex.node))); | ||
389 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
390 | } | ||
391 | |||
281 | /* | 392 | /* |
282 | * The sync level of the mutex must be less than or equal to the current | 393 | * The sync level of the mutex must be less than or equal to the current |
283 | * sync level | 394 | * sync level |
284 | */ | 395 | */ |
285 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { | 396 | if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { |
286 | ACPI_ERROR((AE_INFO, | 397 | ACPI_ERROR((AE_INFO, |
287 | "Cannot release Mutex [%4.4s], incorrect SyncLevel", | 398 | "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", |
288 | acpi_ut_get_node_name(obj_desc->mutex.node))); | 399 | acpi_ut_get_node_name(obj_desc->mutex.node), |
400 | obj_desc->mutex.sync_level, | ||
401 | walk_state->thread->current_sync_level)); | ||
289 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); | 402 | return_ACPI_STATUS(AE_AML_MUTEX_ORDER); |
290 | } | 403 | } |
291 | 404 | ||
292 | /* Match multiple Acquires with multiple Releases */ | 405 | status = acpi_ex_release_mutex_object(obj_desc); |
293 | |||
294 | obj_desc->mutex.acquisition_depth--; | ||
295 | if (obj_desc->mutex.acquisition_depth != 0) { | ||
296 | |||
297 | /* Just decrement the depth and return */ | ||
298 | |||
299 | return_ACPI_STATUS(AE_OK); | ||
300 | } | ||
301 | |||
302 | /* Unlink the mutex from the owner's list */ | ||
303 | 406 | ||
304 | acpi_ex_unlink_mutex(obj_desc); | 407 | if (obj_desc->mutex.acquisition_depth == 0) { |
305 | 408 | ||
306 | /* Release the mutex, special case for Global Lock */ | 409 | /* Restore the original sync_level */ |
307 | 410 | ||
308 | if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) { | 411 | walk_state->thread->current_sync_level = |
309 | status = acpi_ev_release_global_lock(); | 412 | obj_desc->mutex.original_sync_level; |
310 | } else { | ||
311 | acpi_os_release_mutex(obj_desc->mutex.os_mutex); | ||
312 | } | 413 | } |
313 | |||
314 | /* Update the mutex and restore sync_level */ | ||
315 | |||
316 | obj_desc->mutex.owner_thread = NULL; | ||
317 | walk_state->thread->current_sync_level = | ||
318 | obj_desc->mutex.original_sync_level; | ||
319 | |||
320 | return_ACPI_STATUS(status); | 414 | return_ACPI_STATUS(status); |
321 | } | 415 | } |
322 | 416 | ||
@@ -357,7 +451,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
357 | 451 | ||
358 | /* Release the mutex, special case for Global Lock */ | 452 | /* Release the mutex, special case for Global Lock */ |
359 | 453 | ||
360 | if (obj_desc->mutex.os_mutex == acpi_gbl_global_lock_mutex) { | 454 | if (obj_desc == acpi_gbl_global_lock_mutex) { |
361 | 455 | ||
362 | /* Ignore errors */ | 456 | /* Ignore errors */ |
363 | 457 | ||
@@ -369,6 +463,7 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) | |||
369 | /* Mark mutex unowned */ | 463 | /* Mark mutex unowned */ |
370 | 464 | ||
371 | obj_desc->mutex.owner_thread = NULL; | 465 | obj_desc->mutex.owner_thread = NULL; |
466 | obj_desc->mutex.thread_id = 0; | ||
372 | 467 | ||
373 | /* Update Thread sync_level (Last mutex is the important one) */ | 468 | /* Update Thread sync_level (Last mutex is the important one) */ |
374 | 469 | ||
diff --git a/drivers/acpi/executer/exnames.c b/drivers/acpi/executer/exnames.c index 308eae52dc05..817e67be3697 100644 --- a/drivers/acpi/executer/exnames.c +++ b/drivers/acpi/executer/exnames.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/executer/exoparg1.c b/drivers/acpi/executer/exoparg1.c index 252f10acbbcc..7c3bea575e02 100644 --- a/drivers/acpi/executer/exoparg1.c +++ b/drivers/acpi/executer/exoparg1.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -121,6 +121,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) | |||
121 | 121 | ||
122 | if ((ACPI_FAILURE(status)) || walk_state->result_obj) { | 122 | if ((ACPI_FAILURE(status)) || walk_state->result_obj) { |
123 | acpi_ut_remove_reference(return_desc); | 123 | acpi_ut_remove_reference(return_desc); |
124 | walk_state->result_obj = NULL; | ||
124 | } else { | 125 | } else { |
125 | /* Save the return value */ | 126 | /* Save the return value */ |
126 | 127 | ||
@@ -739,26 +740,38 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) | |||
739 | value = acpi_gbl_integer_byte_width; | 740 | value = acpi_gbl_integer_byte_width; |
740 | break; | 741 | break; |
741 | 742 | ||
742 | case ACPI_TYPE_BUFFER: | ||
743 | value = temp_desc->buffer.length; | ||
744 | break; | ||
745 | |||
746 | case ACPI_TYPE_STRING: | 743 | case ACPI_TYPE_STRING: |
747 | value = temp_desc->string.length; | 744 | value = temp_desc->string.length; |
748 | break; | 745 | break; |
749 | 746 | ||
747 | case ACPI_TYPE_BUFFER: | ||
748 | |||
749 | /* Buffer arguments may not be evaluated at this point */ | ||
750 | |||
751 | status = acpi_ds_get_buffer_arguments(temp_desc); | ||
752 | value = temp_desc->buffer.length; | ||
753 | break; | ||
754 | |||
750 | case ACPI_TYPE_PACKAGE: | 755 | case ACPI_TYPE_PACKAGE: |
756 | |||
757 | /* Package arguments may not be evaluated at this point */ | ||
758 | |||
759 | status = acpi_ds_get_package_arguments(temp_desc); | ||
751 | value = temp_desc->package.count; | 760 | value = temp_desc->package.count; |
752 | break; | 761 | break; |
753 | 762 | ||
754 | default: | 763 | default: |
755 | ACPI_ERROR((AE_INFO, | 764 | ACPI_ERROR((AE_INFO, |
756 | "Operand is not Buf/Int/Str/Pkg - found type %s", | 765 | "Operand must be Buffer/Integer/String/Package - found type %s", |
757 | acpi_ut_get_type_name(type))); | 766 | acpi_ut_get_type_name(type))); |
758 | status = AE_AML_OPERAND_TYPE; | 767 | status = AE_AML_OPERAND_TYPE; |
759 | goto cleanup; | 768 | goto cleanup; |
760 | } | 769 | } |
761 | 770 | ||
771 | if (ACPI_FAILURE(status)) { | ||
772 | goto cleanup; | ||
773 | } | ||
774 | |||
762 | /* | 775 | /* |
763 | * Now that we have the size of the object, create a result | 776 | * Now that we have the size of the object, create a result |
764 | * object to hold the value | 777 | * object to hold the value |
diff --git a/drivers/acpi/executer/exoparg2.c b/drivers/acpi/executer/exoparg2.c index 17e652e65379..8e8bbb6ccebd 100644 --- a/drivers/acpi/executer/exoparg2.c +++ b/drivers/acpi/executer/exoparg2.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -241,10 +241,6 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) | |||
241 | goto cleanup; | 241 | goto cleanup; |
242 | } | 242 | } |
243 | 243 | ||
244 | /* Return the remainder */ | ||
245 | |||
246 | walk_state->result_obj = return_desc1; | ||
247 | |||
248 | cleanup: | 244 | cleanup: |
249 | /* | 245 | /* |
250 | * Since the remainder is not returned indirectly, remove a reference to | 246 | * Since the remainder is not returned indirectly, remove a reference to |
@@ -259,6 +255,12 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) | |||
259 | acpi_ut_remove_reference(return_desc1); | 255 | acpi_ut_remove_reference(return_desc1); |
260 | } | 256 | } |
261 | 257 | ||
258 | /* Save return object (the remainder) on success */ | ||
259 | |||
260 | else { | ||
261 | walk_state->result_obj = return_desc1; | ||
262 | } | ||
263 | |||
262 | return_ACPI_STATUS(status); | 264 | return_ACPI_STATUS(status); |
263 | } | 265 | } |
264 | 266 | ||
@@ -490,6 +492,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) | |||
490 | 492 | ||
491 | if (ACPI_FAILURE(status)) { | 493 | if (ACPI_FAILURE(status)) { |
492 | acpi_ut_remove_reference(return_desc); | 494 | acpi_ut_remove_reference(return_desc); |
495 | walk_state->result_obj = NULL; | ||
493 | } | 496 | } |
494 | 497 | ||
495 | return_ACPI_STATUS(status); | 498 | return_ACPI_STATUS(status); |
@@ -583,8 +586,6 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
583 | return_desc->integer.value = ACPI_INTEGER_MAX; | 586 | return_desc->integer.value = ACPI_INTEGER_MAX; |
584 | } | 587 | } |
585 | 588 | ||
586 | walk_state->result_obj = return_desc; | ||
587 | |||
588 | cleanup: | 589 | cleanup: |
589 | 590 | ||
590 | /* Delete return object on error */ | 591 | /* Delete return object on error */ |
@@ -593,5 +594,11 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) | |||
593 | acpi_ut_remove_reference(return_desc); | 594 | acpi_ut_remove_reference(return_desc); |
594 | } | 595 | } |
595 | 596 | ||
597 | /* Save return object on success */ | ||
598 | |||
599 | else { | ||
600 | walk_state->result_obj = return_desc; | ||
601 | } | ||
602 | |||
596 | return_ACPI_STATUS(status); | 603 | return_ACPI_STATUS(status); |
597 | } | 604 | } |
diff --git a/drivers/acpi/executer/exoparg3.c b/drivers/acpi/executer/exoparg3.c index 7fe67cf82cee..9cb4197681af 100644 --- a/drivers/acpi/executer/exoparg3.c +++ b/drivers/acpi/executer/exoparg3.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -260,6 +260,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) | |||
260 | 260 | ||
261 | if (ACPI_FAILURE(status) || walk_state->result_obj) { | 261 | if (ACPI_FAILURE(status) || walk_state->result_obj) { |
262 | acpi_ut_remove_reference(return_desc); | 262 | acpi_ut_remove_reference(return_desc); |
263 | walk_state->result_obj = NULL; | ||
263 | } | 264 | } |
264 | 265 | ||
265 | /* Set the return object and exit */ | 266 | /* Set the return object and exit */ |
diff --git a/drivers/acpi/executer/exoparg6.c b/drivers/acpi/executer/exoparg6.c index bd80a9cb3d65..67d48737af53 100644 --- a/drivers/acpi/executer/exoparg6.c +++ b/drivers/acpi/executer/exoparg6.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -322,8 +322,6 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
322 | goto cleanup; | 322 | goto cleanup; |
323 | } | 323 | } |
324 | 324 | ||
325 | walk_state->result_obj = return_desc; | ||
326 | |||
327 | cleanup: | 325 | cleanup: |
328 | 326 | ||
329 | /* Delete return object on error */ | 327 | /* Delete return object on error */ |
@@ -332,5 +330,11 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) | |||
332 | acpi_ut_remove_reference(return_desc); | 330 | acpi_ut_remove_reference(return_desc); |
333 | } | 331 | } |
334 | 332 | ||
333 | /* Save return object on success */ | ||
334 | |||
335 | else { | ||
336 | walk_state->result_obj = return_desc; | ||
337 | } | ||
338 | |||
335 | return_ACPI_STATUS(status); | 339 | return_ACPI_STATUS(status); |
336 | } | 340 | } |
diff --git a/drivers/acpi/executer/exprep.c b/drivers/acpi/executer/exprep.c index efe5d4b461a4..3a2f8cd4c62a 100644 --- a/drivers/acpi/executer/exprep.c +++ b/drivers/acpi/executer/exprep.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -412,6 +412,7 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, | |||
412 | acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | 412 | acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) |
413 | { | 413 | { |
414 | union acpi_operand_object *obj_desc; | 414 | union acpi_operand_object *obj_desc; |
415 | union acpi_operand_object *second_desc = NULL; | ||
415 | u32 type; | 416 | u32 type; |
416 | acpi_status status; | 417 | acpi_status status; |
417 | 418 | ||
@@ -494,6 +495,20 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
494 | obj_desc->field.access_byte_width, | 495 | obj_desc->field.access_byte_width, |
495 | obj_desc->bank_field.region_obj, | 496 | obj_desc->bank_field.region_obj, |
496 | obj_desc->bank_field.bank_obj)); | 497 | obj_desc->bank_field.bank_obj)); |
498 | |||
499 | /* | ||
500 | * Remember location in AML stream of the field unit | ||
501 | * opcode and operands -- since the bank_value | ||
502 | * operands must be evaluated. | ||
503 | */ | ||
504 | second_desc = obj_desc->common.next_object; | ||
505 | second_desc->extra.aml_start = | ||
506 | ((union acpi_parse_object *)(info->data_register_node))-> | ||
507 | named.data; | ||
508 | second_desc->extra.aml_length = | ||
509 | ((union acpi_parse_object *)(info->data_register_node))-> | ||
510 | named.length; | ||
511 | |||
497 | break; | 512 | break; |
498 | 513 | ||
499 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 514 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 3f51b7e84a17..7cd8bb54fa01 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -160,7 +160,7 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
160 | if (!mem_info->mapped_logical_address) { | 160 | if (!mem_info->mapped_logical_address) { |
161 | ACPI_ERROR((AE_INFO, | 161 | ACPI_ERROR((AE_INFO, |
162 | "Could not map memory at %8.8X%8.8X, size %X", | 162 | "Could not map memory at %8.8X%8.8X, size %X", |
163 | ACPI_FORMAT_UINT64(address), | 163 | ACPI_FORMAT_NATIVE_UINT(address), |
164 | (u32) window_size)); | 164 | (u32) window_size)); |
165 | mem_info->mapped_length = 0; | 165 | mem_info->mapped_length = 0; |
166 | return_ACPI_STATUS(AE_NO_MEMORY); | 166 | return_ACPI_STATUS(AE_NO_MEMORY); |
@@ -182,7 +182,8 @@ acpi_ex_system_memory_space_handler(u32 function, | |||
182 | 182 | ||
183 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 183 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
184 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", | 184 | "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", |
185 | bit_width, function, ACPI_FORMAT_UINT64(address))); | 185 | bit_width, function, |
186 | ACPI_FORMAT_NATIVE_UINT(address))); | ||
186 | 187 | ||
187 | /* | 188 | /* |
188 | * Perform the memory read or write | 189 | * Perform the memory read or write |
@@ -284,7 +285,8 @@ acpi_ex_system_io_space_handler(u32 function, | |||
284 | 285 | ||
285 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 286 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
286 | "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", | 287 | "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", |
287 | bit_width, function, ACPI_FORMAT_UINT64(address))); | 288 | bit_width, function, |
289 | ACPI_FORMAT_NATIVE_UINT(address))); | ||
288 | 290 | ||
289 | /* Decode the function parameter */ | 291 | /* Decode the function parameter */ |
290 | 292 | ||
diff --git a/drivers/acpi/executer/exresnte.c b/drivers/acpi/executer/exresnte.c index 2b3a01cc4929..5596f42c9676 100644 --- a/drivers/acpi/executer/exresnte.c +++ b/drivers/acpi/executer/exresnte.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -116,9 +116,11 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
116 | * Several object types require no further processing: | 116 | * Several object types require no further processing: |
117 | * 1) Device/Thermal objects don't have a "real" subobject, return the Node | 117 | * 1) Device/Thermal objects don't have a "real" subobject, return the Node |
118 | * 2) Method locals and arguments have a pseudo-Node | 118 | * 2) Method locals and arguments have a pseudo-Node |
119 | * 3) 10/2007: Added method type to assist with Package construction. | ||
119 | */ | 120 | */ |
120 | if ((entry_type == ACPI_TYPE_DEVICE) || | 121 | if ((entry_type == ACPI_TYPE_DEVICE) || |
121 | (entry_type == ACPI_TYPE_THERMAL) || | 122 | (entry_type == ACPI_TYPE_THERMAL) || |
123 | (entry_type == ACPI_TYPE_METHOD) || | ||
122 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { | 124 | (node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { |
123 | return_ACPI_STATUS(AE_OK); | 125 | return_ACPI_STATUS(AE_OK); |
124 | } | 126 | } |
@@ -214,7 +216,6 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
214 | /* For these objects, just return the object attached to the Node */ | 216 | /* For these objects, just return the object attached to the Node */ |
215 | 217 | ||
216 | case ACPI_TYPE_MUTEX: | 218 | case ACPI_TYPE_MUTEX: |
217 | case ACPI_TYPE_METHOD: | ||
218 | case ACPI_TYPE_POWER: | 219 | case ACPI_TYPE_POWER: |
219 | case ACPI_TYPE_PROCESSOR: | 220 | case ACPI_TYPE_PROCESSOR: |
220 | case ACPI_TYPE_EVENT: | 221 | case ACPI_TYPE_EVENT: |
@@ -238,13 +239,12 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, | |||
238 | case ACPI_TYPE_LOCAL_REFERENCE: | 239 | case ACPI_TYPE_LOCAL_REFERENCE: |
239 | 240 | ||
240 | switch (source_desc->reference.opcode) { | 241 | switch (source_desc->reference.opcode) { |
241 | case AML_LOAD_OP: | 242 | case AML_LOAD_OP: /* This is a ddb_handle */ |
243 | case AML_REF_OF_OP: | ||
244 | case AML_INDEX_OP: | ||
242 | 245 | ||
243 | /* This is a ddb_handle */ | ||
244 | /* Return an additional reference to the object */ | 246 | /* Return an additional reference to the object */ |
245 | 247 | ||
246 | case AML_REF_OF_OP: | ||
247 | |||
248 | obj_desc = source_desc; | 248 | obj_desc = source_desc; |
249 | acpi_ut_add_reference(obj_desc); | 249 | acpi_ut_add_reference(obj_desc); |
250 | break; | 250 | break; |
diff --git a/drivers/acpi/executer/exresolv.c b/drivers/acpi/executer/exresolv.c index 6c64e55dab0e..b35f7c817acf 100644 --- a/drivers/acpi/executer/exresolv.c +++ b/drivers/acpi/executer/exresolv.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -140,7 +140,6 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
140 | { | 140 | { |
141 | acpi_status status = AE_OK; | 141 | acpi_status status = AE_OK; |
142 | union acpi_operand_object *stack_desc; | 142 | union acpi_operand_object *stack_desc; |
143 | void *temp_node; | ||
144 | union acpi_operand_object *obj_desc = NULL; | 143 | union acpi_operand_object *obj_desc = NULL; |
145 | u16 opcode; | 144 | u16 opcode; |
146 | 145 | ||
@@ -156,23 +155,6 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
156 | opcode = stack_desc->reference.opcode; | 155 | opcode = stack_desc->reference.opcode; |
157 | 156 | ||
158 | switch (opcode) { | 157 | switch (opcode) { |
159 | case AML_NAME_OP: | ||
160 | |||
161 | /* | ||
162 | * Convert name reference to a namespace node | ||
163 | * Then, acpi_ex_resolve_node_to_value can be used to get the value | ||
164 | */ | ||
165 | temp_node = stack_desc->reference.object; | ||
166 | |||
167 | /* Delete the Reference Object */ | ||
168 | |||
169 | acpi_ut_remove_reference(stack_desc); | ||
170 | |||
171 | /* Return the namespace node */ | ||
172 | |||
173 | (*stack_ptr) = temp_node; | ||
174 | break; | ||
175 | |||
176 | case AML_LOCAL_OP: | 158 | case AML_LOCAL_OP: |
177 | case AML_ARG_OP: | 159 | case AML_ARG_OP: |
178 | 160 | ||
@@ -207,15 +189,25 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
207 | switch (stack_desc->reference.target_type) { | 189 | switch (stack_desc->reference.target_type) { |
208 | case ACPI_TYPE_BUFFER_FIELD: | 190 | case ACPI_TYPE_BUFFER_FIELD: |
209 | 191 | ||
210 | /* Just return - leave the Reference on the stack */ | 192 | /* Just return - do not dereference */ |
211 | break; | 193 | break; |
212 | 194 | ||
213 | case ACPI_TYPE_PACKAGE: | 195 | case ACPI_TYPE_PACKAGE: |
214 | 196 | ||
197 | /* If method call or copy_object - do not dereference */ | ||
198 | |||
199 | if ((walk_state->opcode == | ||
200 | AML_INT_METHODCALL_OP) | ||
201 | || (walk_state->opcode == AML_COPY_OP)) { | ||
202 | break; | ||
203 | } | ||
204 | |||
205 | /* Otherwise, dereference the package_index to a package element */ | ||
206 | |||
215 | obj_desc = *stack_desc->reference.where; | 207 | obj_desc = *stack_desc->reference.where; |
216 | if (obj_desc) { | 208 | if (obj_desc) { |
217 | /* | 209 | /* |
218 | * Valid obj descriptor, copy pointer to return value | 210 | * Valid object descriptor, copy pointer to return value |
219 | * (i.e., dereference the package index) | 211 | * (i.e., dereference the package index) |
220 | * Delete the ref object, increment the returned object | 212 | * Delete the ref object, increment the returned object |
221 | */ | 213 | */ |
@@ -224,11 +216,11 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
224 | *stack_ptr = obj_desc; | 216 | *stack_ptr = obj_desc; |
225 | } else { | 217 | } else { |
226 | /* | 218 | /* |
227 | * A NULL object descriptor means an unitialized element of | 219 | * A NULL object descriptor means an uninitialized element of |
228 | * the package, can't dereference it | 220 | * the package, can't dereference it |
229 | */ | 221 | */ |
230 | ACPI_ERROR((AE_INFO, | 222 | ACPI_ERROR((AE_INFO, |
231 | "Attempt to deref an Index to NULL pkg element Idx=%p", | 223 | "Attempt to dereference an Index to NULL package element Idx=%p", |
232 | stack_desc)); | 224 | stack_desc)); |
233 | status = AE_AML_UNINITIALIZED_ELEMENT; | 225 | status = AE_AML_UNINITIALIZED_ELEMENT; |
234 | } | 226 | } |
@@ -239,7 +231,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
239 | /* Invalid reference object */ | 231 | /* Invalid reference object */ |
240 | 232 | ||
241 | ACPI_ERROR((AE_INFO, | 233 | ACPI_ERROR((AE_INFO, |
242 | "Unknown TargetType %X in Index/Reference obj %p", | 234 | "Unknown TargetType %X in Index/Reference object %p", |
243 | stack_desc->reference.target_type, | 235 | stack_desc->reference.target_type, |
244 | stack_desc)); | 236 | stack_desc)); |
245 | status = AE_AML_INTERNAL; | 237 | status = AE_AML_INTERNAL; |
@@ -251,7 +243,7 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, | |||
251 | case AML_DEBUG_OP: | 243 | case AML_DEBUG_OP: |
252 | case AML_LOAD_OP: | 244 | case AML_LOAD_OP: |
253 | 245 | ||
254 | /* Just leave the object as-is */ | 246 | /* Just leave the object as-is, do not dereference */ |
255 | 247 | ||
256 | break; | 248 | break; |
257 | 249 | ||
@@ -390,10 +382,10 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
390 | } | 382 | } |
391 | 383 | ||
392 | /* | 384 | /* |
393 | * For reference objects created via the ref_of or Index operators, | 385 | * For reference objects created via the ref_of, Index, or Load/load_table |
394 | * we need to get to the base object (as per the ACPI specification | 386 | * operators, we need to get to the base object (as per the ACPI |
395 | * of the object_type and size_of operators). This means traversing | 387 | * specification of the object_type and size_of operators). This means |
396 | * the list of possibly many nested references. | 388 | * traversing the list of possibly many nested references. |
397 | */ | 389 | */ |
398 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { | 390 | while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) { |
399 | switch (obj_desc->reference.opcode) { | 391 | switch (obj_desc->reference.opcode) { |
@@ -463,6 +455,11 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, | |||
463 | } | 455 | } |
464 | break; | 456 | break; |
465 | 457 | ||
458 | case AML_LOAD_OP: | ||
459 | |||
460 | type = ACPI_TYPE_DDB_HANDLE; | ||
461 | goto exit; | ||
462 | |||
466 | case AML_LOCAL_OP: | 463 | case AML_LOCAL_OP: |
467 | case AML_ARG_OP: | 464 | case AML_ARG_OP: |
468 | 465 | ||
diff --git a/drivers/acpi/executer/exresop.c b/drivers/acpi/executer/exresop.c index 09d897b3f6d5..73e29e566a70 100644 --- a/drivers/acpi/executer/exresop.c +++ b/drivers/acpi/executer/exresop.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -137,7 +137,6 @@ acpi_ex_resolve_operands(u16 opcode, | |||
137 | union acpi_operand_object *obj_desc; | 137 | union acpi_operand_object *obj_desc; |
138 | acpi_status status = AE_OK; | 138 | acpi_status status = AE_OK; |
139 | u8 object_type; | 139 | u8 object_type; |
140 | void *temp_node; | ||
141 | u32 arg_types; | 140 | u32 arg_types; |
142 | const struct acpi_opcode_info *op_info; | 141 | const struct acpi_opcode_info *op_info; |
143 | u32 this_arg_type; | 142 | u32 this_arg_type; |
@@ -239,7 +238,6 @@ acpi_ex_resolve_operands(u16 opcode, | |||
239 | 238 | ||
240 | /*lint -fallthrough */ | 239 | /*lint -fallthrough */ |
241 | 240 | ||
242 | case AML_NAME_OP: | ||
243 | case AML_INDEX_OP: | 241 | case AML_INDEX_OP: |
244 | case AML_REF_OF_OP: | 242 | case AML_REF_OF_OP: |
245 | case AML_ARG_OP: | 243 | case AML_ARG_OP: |
@@ -332,15 +330,6 @@ acpi_ex_resolve_operands(u16 opcode, | |||
332 | if (ACPI_FAILURE(status)) { | 330 | if (ACPI_FAILURE(status)) { |
333 | return_ACPI_STATUS(status); | 331 | return_ACPI_STATUS(status); |
334 | } | 332 | } |
335 | |||
336 | if (obj_desc->reference.opcode == AML_NAME_OP) { | ||
337 | |||
338 | /* Convert a named reference to the actual named object */ | ||
339 | |||
340 | temp_node = obj_desc->reference.object; | ||
341 | acpi_ut_remove_reference(obj_desc); | ||
342 | (*stack_ptr) = temp_node; | ||
343 | } | ||
344 | goto next_operand; | 333 | goto next_operand; |
345 | 334 | ||
346 | case ARGI_DATAREFOBJ: /* Store operator only */ | 335 | case ARGI_DATAREFOBJ: /* Store operator only */ |
diff --git a/drivers/acpi/executer/exstore.c b/drivers/acpi/executer/exstore.c index f4b69a637820..76c875bc3154 100644 --- a/drivers/acpi/executer/exstore.c +++ b/drivers/acpi/executer/exstore.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -84,8 +84,12 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
84 | 84 | ||
85 | ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); | 85 | ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc); |
86 | 86 | ||
87 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", | 87 | /* Print line header as long as we are not in the middle of an object display */ |
88 | level, " ")); | 88 | |
89 | if (!((level > 0) && index == 0)) { | ||
90 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", | ||
91 | level, " ")); | ||
92 | } | ||
89 | 93 | ||
90 | /* Display index for package output only */ | 94 | /* Display index for package output only */ |
91 | 95 | ||
@@ -95,12 +99,12 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
95 | } | 99 | } |
96 | 100 | ||
97 | if (!source_desc) { | 101 | if (!source_desc) { |
98 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n")); | 102 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n")); |
99 | return_VOID; | 103 | return_VOID; |
100 | } | 104 | } |
101 | 105 | ||
102 | if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { | 106 | if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { |
103 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: ", | 107 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s ", |
104 | acpi_ut_get_object_type_name | 108 | acpi_ut_get_object_type_name |
105 | (source_desc))); | 109 | (source_desc))); |
106 | 110 | ||
@@ -123,6 +127,8 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
123 | return_VOID; | 127 | return_VOID; |
124 | } | 128 | } |
125 | 129 | ||
130 | /* source_desc is of type ACPI_DESC_TYPE_OPERAND */ | ||
131 | |||
126 | switch (ACPI_GET_OBJECT_TYPE(source_desc)) { | 132 | switch (ACPI_GET_OBJECT_TYPE(source_desc)) { |
127 | case ACPI_TYPE_INTEGER: | 133 | case ACPI_TYPE_INTEGER: |
128 | 134 | ||
@@ -147,7 +153,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
147 | (u32) source_desc->buffer.length)); | 153 | (u32) source_desc->buffer.length)); |
148 | ACPI_DUMP_BUFFER(source_desc->buffer.pointer, | 154 | ACPI_DUMP_BUFFER(source_desc->buffer.pointer, |
149 | (source_desc->buffer.length < | 155 | (source_desc->buffer.length < |
150 | 32) ? source_desc->buffer.length : 32); | 156 | 256) ? source_desc->buffer.length : 256); |
151 | break; | 157 | break; |
152 | 158 | ||
153 | case ACPI_TYPE_STRING: | 159 | case ACPI_TYPE_STRING: |
@@ -160,7 +166,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
160 | case ACPI_TYPE_PACKAGE: | 166 | case ACPI_TYPE_PACKAGE: |
161 | 167 | ||
162 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, | 168 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, |
163 | "[0x%.2X Elements]\n", | 169 | "[Contains 0x%.2X Elements]\n", |
164 | source_desc->package.count)); | 170 | source_desc->package.count)); |
165 | 171 | ||
166 | /* Output the entire contents of the package */ | 172 | /* Output the entire contents of the package */ |
@@ -180,12 +186,59 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
180 | (source_desc->reference.opcode), | 186 | (source_desc->reference.opcode), |
181 | source_desc->reference.offset)); | 187 | source_desc->reference.offset)); |
182 | } else { | 188 | } else { |
183 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]\n", | 189 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]", |
184 | acpi_ps_get_opcode_name | 190 | acpi_ps_get_opcode_name |
185 | (source_desc->reference.opcode))); | 191 | (source_desc->reference.opcode))); |
186 | } | 192 | } |
187 | 193 | ||
188 | if (source_desc->reference.object) { | 194 | if (source_desc->reference.opcode == AML_LOAD_OP) { /* Load and load_table */ |
195 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, | ||
196 | " Table OwnerId %p\n", | ||
197 | source_desc->reference.object)); | ||
198 | break; | ||
199 | } | ||
200 | |||
201 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, " ")); | ||
202 | |||
203 | /* Check for valid node first, then valid object */ | ||
204 | |||
205 | if (source_desc->reference.node) { | ||
206 | if (ACPI_GET_DESCRIPTOR_TYPE | ||
207 | (source_desc->reference.node) != | ||
208 | ACPI_DESC_TYPE_NAMED) { | ||
209 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, | ||
210 | " %p - Not a valid namespace node\n", | ||
211 | source_desc->reference. | ||
212 | node)); | ||
213 | } else { | ||
214 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, | ||
215 | "Node %p [%4.4s] ", | ||
216 | source_desc->reference. | ||
217 | node, | ||
218 | (source_desc->reference. | ||
219 | node)->name.ascii)); | ||
220 | |||
221 | switch ((source_desc->reference.node)->type) { | ||
222 | |||
223 | /* These types have no attached object */ | ||
224 | |||
225 | case ACPI_TYPE_DEVICE: | ||
226 | acpi_os_printf("Device\n"); | ||
227 | break; | ||
228 | |||
229 | case ACPI_TYPE_THERMAL: | ||
230 | acpi_os_printf("Thermal Zone\n"); | ||
231 | break; | ||
232 | |||
233 | default: | ||
234 | acpi_ex_do_debug_object((source_desc-> | ||
235 | reference. | ||
236 | node)->object, | ||
237 | level + 4, 0); | ||
238 | break; | ||
239 | } | ||
240 | } | ||
241 | } else if (source_desc->reference.object) { | ||
189 | if (ACPI_GET_DESCRIPTOR_TYPE | 242 | if (ACPI_GET_DESCRIPTOR_TYPE |
190 | (source_desc->reference.object) == | 243 | (source_desc->reference.object) == |
191 | ACPI_DESC_TYPE_NAMED) { | 244 | ACPI_DESC_TYPE_NAMED) { |
@@ -198,18 +251,13 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, | |||
198 | acpi_ex_do_debug_object(source_desc->reference. | 251 | acpi_ex_do_debug_object(source_desc->reference. |
199 | object, level + 4, 0); | 252 | object, level + 4, 0); |
200 | } | 253 | } |
201 | } else if (source_desc->reference.node) { | ||
202 | acpi_ex_do_debug_object((source_desc->reference.node)-> | ||
203 | object, level + 4, 0); | ||
204 | } | 254 | } |
205 | break; | 255 | break; |
206 | 256 | ||
207 | default: | 257 | default: |
208 | 258 | ||
209 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p %s\n", | 259 | ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p\n", |
210 | source_desc, | 260 | source_desc)); |
211 | acpi_ut_get_object_type_name | ||
212 | (source_desc))); | ||
213 | break; | 261 | break; |
214 | } | 262 | } |
215 | 263 | ||
@@ -313,7 +361,6 @@ acpi_ex_store(union acpi_operand_object *source_desc, | |||
313 | * 4) Store to the debug object | 361 | * 4) Store to the debug object |
314 | */ | 362 | */ |
315 | switch (ref_desc->reference.opcode) { | 363 | switch (ref_desc->reference.opcode) { |
316 | case AML_NAME_OP: | ||
317 | case AML_REF_OF_OP: | 364 | case AML_REF_OF_OP: |
318 | 365 | ||
319 | /* Storing an object into a Name "container" */ | 366 | /* Storing an object into a Name "container" */ |
@@ -415,11 +462,24 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc, | |||
415 | */ | 462 | */ |
416 | obj_desc = *(index_desc->reference.where); | 463 | obj_desc = *(index_desc->reference.where); |
417 | 464 | ||
418 | status = | 465 | if (ACPI_GET_OBJECT_TYPE(source_desc) == |
419 | acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc, | 466 | ACPI_TYPE_LOCAL_REFERENCE |
420 | walk_state); | 467 | && source_desc->reference.opcode == AML_LOAD_OP) { |
421 | if (ACPI_FAILURE(status)) { | 468 | |
422 | return_ACPI_STATUS(status); | 469 | /* This is a DDBHandle, just add a reference to it */ |
470 | |||
471 | acpi_ut_add_reference(source_desc); | ||
472 | new_desc = source_desc; | ||
473 | } else { | ||
474 | /* Normal object, copy it */ | ||
475 | |||
476 | status = | ||
477 | acpi_ut_copy_iobject_to_iobject(source_desc, | ||
478 | &new_desc, | ||
479 | walk_state); | ||
480 | if (ACPI_FAILURE(status)) { | ||
481 | return_ACPI_STATUS(status); | ||
482 | } | ||
423 | } | 483 | } |
424 | 484 | ||
425 | if (obj_desc) { | 485 | if (obj_desc) { |
@@ -571,10 +631,17 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, | |||
571 | 631 | ||
572 | /* If no implicit conversion, drop into the default case below */ | 632 | /* If no implicit conversion, drop into the default case below */ |
573 | 633 | ||
574 | if ((!implicit_conversion) || (walk_state->opcode == AML_COPY_OP)) { | 634 | if ((!implicit_conversion) || |
575 | 635 | ((walk_state->opcode == AML_COPY_OP) && | |
576 | /* Force execution of default (no implicit conversion) */ | 636 | (target_type != ACPI_TYPE_LOCAL_REGION_FIELD) && |
577 | 637 | (target_type != ACPI_TYPE_LOCAL_BANK_FIELD) && | |
638 | (target_type != ACPI_TYPE_LOCAL_INDEX_FIELD))) { | ||
639 | /* | ||
640 | * Force execution of default (no implicit conversion). Note: | ||
641 | * copy_object does not perform an implicit conversion, as per the ACPI | ||
642 | * spec -- except in case of region/bank/index fields -- because these | ||
643 | * objects must retain their original type permanently. | ||
644 | */ | ||
578 | target_type = ACPI_TYPE_ANY; | 645 | target_type = ACPI_TYPE_ANY; |
579 | } | 646 | } |
580 | 647 | ||
diff --git a/drivers/acpi/executer/exstoren.c b/drivers/acpi/executer/exstoren.c index 1d622c625c64..a6d2168b81f9 100644 --- a/drivers/acpi/executer/exstoren.c +++ b/drivers/acpi/executer/exstoren.c | |||
@@ -7,7 +7,7 @@ | |||
7 | *****************************************************************************/ | 7 | *****************************************************************************/ |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * Copyright (C) 2000 - 2007, R. Byron Moore | 10 | * Copyright (C) 2000 - 2008, Intel Corp. |
11 | * All rights reserved. | 11 | * All rights reserved. |
12 | * | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/executer/exstorob.c b/drivers/acpi/executer/exstorob.c index 8233d40178ee..9a75ff09fb0c 100644 --- a/drivers/acpi/executer/exstorob.c +++ b/drivers/acpi/executer/exstorob.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/executer/exsystem.c b/drivers/acpi/executer/exsystem.c index 9460baff3032..68990f1df371 100644 --- a/drivers/acpi/executer/exsystem.c +++ b/drivers/acpi/executer/exsystem.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -44,7 +44,6 @@ | |||
44 | 44 | ||
45 | #include <acpi/acpi.h> | 45 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 46 | #include <acpi/acinterp.h> |
47 | #include <acpi/acevents.h> | ||
48 | 47 | ||
49 | #define _COMPONENT ACPI_EXECUTER | 48 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME("exsystem") | 49 | ACPI_MODULE_NAME("exsystem") |
diff --git a/drivers/acpi/executer/exutils.c b/drivers/acpi/executer/exutils.c index 6b0aeccbb69b..86c03880b523 100644 --- a/drivers/acpi/executer/exutils.c +++ b/drivers/acpi/executer/exutils.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -61,7 +61,6 @@ | |||
61 | #include <acpi/acpi.h> | 61 | #include <acpi/acpi.h> |
62 | #include <acpi/acinterp.h> | 62 | #include <acpi/acinterp.h> |
63 | #include <acpi/amlcode.h> | 63 | #include <acpi/amlcode.h> |
64 | #include <acpi/acevents.h> | ||
65 | 64 | ||
66 | #define _COMPONENT ACPI_EXECUTER | 65 | #define _COMPONENT ACPI_EXECUTER |
67 | ACPI_MODULE_NAME("exutils") | 66 | ACPI_MODULE_NAME("exutils") |
@@ -217,9 +216,10 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) | |||
217 | 216 | ||
218 | /* | 217 | /* |
219 | * Object must be a valid number and we must be executing | 218 | * Object must be a valid number and we must be executing |
220 | * a control method | 219 | * a control method. NS node could be there for AML_INT_NAMEPATH_OP. |
221 | */ | 220 | */ |
222 | if ((!obj_desc) || | 221 | if ((!obj_desc) || |
222 | (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) || | ||
223 | (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) { | 223 | (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) { |
224 | return; | 224 | return; |
225 | } | 225 | } |
@@ -240,72 +240,73 @@ void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) | |||
240 | * PARAMETERS: field_flags - Flags with Lock rule: | 240 | * PARAMETERS: field_flags - Flags with Lock rule: |
241 | * always_lock or never_lock | 241 | * always_lock or never_lock |
242 | * | 242 | * |
243 | * RETURN: TRUE/FALSE indicating whether the lock was actually acquired | 243 | * RETURN: None |
244 | * | 244 | * |
245 | * DESCRIPTION: Obtain the global lock and keep track of this fact via two | 245 | * DESCRIPTION: Obtain the ACPI hardware Global Lock, only if the field |
246 | * methods. A global variable keeps the state of the lock, and | 246 | * flags specifiy that it is to be obtained before field access. |
247 | * the state is returned to the caller. | ||
248 | * | 247 | * |
249 | ******************************************************************************/ | 248 | ******************************************************************************/ |
250 | 249 | ||
251 | u8 acpi_ex_acquire_global_lock(u32 field_flags) | 250 | void acpi_ex_acquire_global_lock(u32 field_flags) |
252 | { | 251 | { |
253 | u8 locked = FALSE; | ||
254 | acpi_status status; | 252 | acpi_status status; |
255 | 253 | ||
256 | ACPI_FUNCTION_TRACE(ex_acquire_global_lock); | 254 | ACPI_FUNCTION_TRACE(ex_acquire_global_lock); |
257 | 255 | ||
258 | /* Only attempt lock if the always_lock bit is set */ | 256 | /* Only use the lock if the always_lock bit is set */ |
257 | |||
258 | if (!(field_flags & AML_FIELD_LOCK_RULE_MASK)) { | ||
259 | return_VOID; | ||
260 | } | ||
259 | 261 | ||
260 | if (field_flags & AML_FIELD_LOCK_RULE_MASK) { | 262 | /* Attempt to get the global lock, wait forever */ |
261 | 263 | ||
262 | /* We should attempt to get the lock, wait forever */ | 264 | status = acpi_ex_acquire_mutex_object(ACPI_WAIT_FOREVER, |
265 | acpi_gbl_global_lock_mutex, | ||
266 | acpi_os_get_thread_id()); | ||
263 | 267 | ||
264 | status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER); | 268 | if (ACPI_FAILURE(status)) { |
265 | if (ACPI_SUCCESS(status)) { | 269 | ACPI_EXCEPTION((AE_INFO, status, |
266 | locked = TRUE; | 270 | "Could not acquire Global Lock")); |
267 | } else { | ||
268 | ACPI_EXCEPTION((AE_INFO, status, | ||
269 | "Could not acquire Global Lock")); | ||
270 | } | ||
271 | } | 271 | } |
272 | 272 | ||
273 | return_UINT8(locked); | 273 | return_VOID; |
274 | } | 274 | } |
275 | 275 | ||
276 | /******************************************************************************* | 276 | /******************************************************************************* |
277 | * | 277 | * |
278 | * FUNCTION: acpi_ex_release_global_lock | 278 | * FUNCTION: acpi_ex_release_global_lock |
279 | * | 279 | * |
280 | * PARAMETERS: locked_by_me - Return value from corresponding call to | 280 | * PARAMETERS: field_flags - Flags with Lock rule: |
281 | * acquire_global_lock. | 281 | * always_lock or never_lock |
282 | * | 282 | * |
283 | * RETURN: None | 283 | * RETURN: None |
284 | * | 284 | * |
285 | * DESCRIPTION: Release the global lock if it is locked. | 285 | * DESCRIPTION: Release the ACPI hardware Global Lock |
286 | * | 286 | * |
287 | ******************************************************************************/ | 287 | ******************************************************************************/ |
288 | 288 | ||
289 | void acpi_ex_release_global_lock(u8 locked_by_me) | 289 | void acpi_ex_release_global_lock(u32 field_flags) |
290 | { | 290 | { |
291 | acpi_status status; | 291 | acpi_status status; |
292 | 292 | ||
293 | ACPI_FUNCTION_TRACE(ex_release_global_lock); | 293 | ACPI_FUNCTION_TRACE(ex_release_global_lock); |
294 | 294 | ||
295 | /* Only attempt unlock if the caller locked it */ | 295 | /* Only use the lock if the always_lock bit is set */ |
296 | 296 | ||
297 | if (locked_by_me) { | 297 | if (!(field_flags & AML_FIELD_LOCK_RULE_MASK)) { |
298 | return_VOID; | ||
299 | } | ||
298 | 300 | ||
299 | /* OK, now release the lock */ | 301 | /* Release the global lock */ |
300 | 302 | ||
301 | status = acpi_ev_release_global_lock(); | 303 | status = acpi_ex_release_mutex_object(acpi_gbl_global_lock_mutex); |
302 | if (ACPI_FAILURE(status)) { | 304 | if (ACPI_FAILURE(status)) { |
303 | 305 | ||
304 | /* Report the error, but there isn't much else we can do */ | 306 | /* Report the error, but there isn't much else we can do */ |
305 | 307 | ||
306 | ACPI_EXCEPTION((AE_INFO, status, | 308 | ACPI_EXCEPTION((AE_INFO, status, |
307 | "Could not release ACPI Global Lock")); | 309 | "Could not release Global Lock")); |
308 | } | ||
309 | } | 310 | } |
310 | 311 | ||
311 | return_VOID; | 312 | return_VOID; |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 194077ab9b85..6cf10cbc1eee 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -256,24 +256,23 @@ static int acpi_fan_add(struct acpi_device *device) | |||
256 | result = PTR_ERR(cdev); | 256 | result = PTR_ERR(cdev); |
257 | goto end; | 257 | goto end; |
258 | } | 258 | } |
259 | if (cdev) { | 259 | |
260 | printk(KERN_INFO PREFIX | 260 | printk(KERN_INFO PREFIX |
261 | "%s is registered as cooling_device%d\n", | 261 | "%s is registered as cooling_device%d\n", |
262 | device->dev.bus_id, cdev->id); | 262 | device->dev.bus_id, cdev->id); |
263 | 263 | ||
264 | acpi_driver_data(device) = cdev; | 264 | acpi_driver_data(device) = cdev; |
265 | result = sysfs_create_link(&device->dev.kobj, | 265 | result = sysfs_create_link(&device->dev.kobj, |
266 | &cdev->device.kobj, | 266 | &cdev->device.kobj, |
267 | "thermal_cooling"); | 267 | "thermal_cooling"); |
268 | if (result) | 268 | if (result) |
269 | return result; | 269 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
270 | 270 | ||
271 | result = sysfs_create_link(&cdev->device.kobj, | 271 | result = sysfs_create_link(&cdev->device.kobj, |
272 | &device->dev.kobj, | 272 | &device->dev.kobj, |
273 | "device"); | 273 | "device"); |
274 | if (result) | 274 | if (result) |
275 | return result; | 275 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
276 | } | ||
277 | 276 | ||
278 | result = acpi_fan_add_fs(device); | 277 | result = acpi_fan_add_fs(device); |
279 | if (result) | 278 | if (result) |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index eda0978b57c6..06f8634fe58b 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -142,6 +142,7 @@ EXPORT_SYMBOL(acpi_get_physical_device); | |||
142 | 142 | ||
143 | static int acpi_bind_one(struct device *dev, acpi_handle handle) | 143 | static int acpi_bind_one(struct device *dev, acpi_handle handle) |
144 | { | 144 | { |
145 | struct acpi_device *acpi_dev; | ||
145 | acpi_status status; | 146 | acpi_status status; |
146 | 147 | ||
147 | if (dev->archdata.acpi_handle) { | 148 | if (dev->archdata.acpi_handle) { |
@@ -157,6 +158,16 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
157 | } | 158 | } |
158 | dev->archdata.acpi_handle = handle; | 159 | dev->archdata.acpi_handle = handle; |
159 | 160 | ||
161 | status = acpi_bus_get_device(handle, &acpi_dev); | ||
162 | if (!ACPI_FAILURE(status)) { | ||
163 | int ret; | ||
164 | |||
165 | ret = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, | ||
166 | "firmware_node"); | ||
167 | ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, | ||
168 | "physical_node"); | ||
169 | } | ||
170 | |||
160 | return 0; | 171 | return 0; |
161 | } | 172 | } |
162 | 173 | ||
@@ -165,8 +176,17 @@ static int acpi_unbind_one(struct device *dev) | |||
165 | if (!dev->archdata.acpi_handle) | 176 | if (!dev->archdata.acpi_handle) |
166 | return 0; | 177 | return 0; |
167 | if (dev == acpi_get_physical_device(dev->archdata.acpi_handle)) { | 178 | if (dev == acpi_get_physical_device(dev->archdata.acpi_handle)) { |
179 | struct acpi_device *acpi_dev; | ||
180 | |||
168 | /* acpi_get_physical_device increase refcnt by one */ | 181 | /* acpi_get_physical_device increase refcnt by one */ |
169 | put_device(dev); | 182 | put_device(dev); |
183 | |||
184 | if (!acpi_bus_get_device(dev->archdata.acpi_handle, | ||
185 | &acpi_dev)) { | ||
186 | sysfs_remove_link(&dev->kobj, "firmware_node"); | ||
187 | sysfs_remove_link(&acpi_dev->dev.kobj, "physical_node"); | ||
188 | } | ||
189 | |||
170 | acpi_detach_data(dev->archdata.acpi_handle, | 190 | acpi_detach_data(dev->archdata.acpi_handle, |
171 | acpi_glue_data_handler); | 191 | acpi_glue_data_handler); |
172 | dev->archdata.acpi_handle = NULL; | 192 | dev->archdata.acpi_handle = NULL; |
diff --git a/drivers/acpi/hardware/hwacpi.c b/drivers/acpi/hardware/hwacpi.c index 6031ca13dd2f..816894ea839e 100644 --- a/drivers/acpi/hardware/hwacpi.c +++ b/drivers/acpi/hardware/hwacpi.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/hardware/hwgpe.c b/drivers/acpi/hardware/hwgpe.c index 117a05cadaaa..14bc4f456ae8 100644 --- a/drivers/acpi/hardware/hwgpe.c +++ b/drivers/acpi/hardware/hwgpe.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/hardware/hwregs.c b/drivers/acpi/hardware/hwregs.c index 73f9c5fb1ba7..ddf792adcf96 100644 --- a/drivers/acpi/hardware/hwregs.c +++ b/drivers/acpi/hardware/hwregs.c | |||
@@ -7,7 +7,7 @@ | |||
7 | ******************************************************************************/ | 7 | ******************************************************************************/ |
8 | 8 | ||
9 | /* | 9 | /* |
10 | * Copyright (C) 2000 - 2007, R. Byron Moore | 10 | * Copyright (C) 2000 - 2008, Intel Corp. |
11 | * All rights reserved. | 11 | * All rights reserved. |
12 | * | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | 13 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c index 4290e0193097..d9937e05ec6a 100644 --- a/drivers/acpi/hardware/hwsleep.c +++ b/drivers/acpi/hardware/hwsleep.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -70,9 +70,10 @@ acpi_set_firmware_waking_vector(acpi_physical_address physical_address) | |||
70 | 70 | ||
71 | /* Get the FACS */ | 71 | /* Get the FACS */ |
72 | 72 | ||
73 | status = | 73 | status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, |
74 | acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, | 74 | ACPI_CAST_INDIRECT_PTR(struct |
75 | (struct acpi_table_header **)&facs); | 75 | acpi_table_header, |
76 | &facs)); | ||
76 | if (ACPI_FAILURE(status)) { | 77 | if (ACPI_FAILURE(status)) { |
77 | return_ACPI_STATUS(status); | 78 | return_ACPI_STATUS(status); |
78 | } | 79 | } |
@@ -124,9 +125,10 @@ acpi_get_firmware_waking_vector(acpi_physical_address * physical_address) | |||
124 | 125 | ||
125 | /* Get the FACS */ | 126 | /* Get the FACS */ |
126 | 127 | ||
127 | status = | 128 | status = acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, |
128 | acpi_get_table_by_index(ACPI_TABLE_INDEX_FACS, | 129 | ACPI_CAST_INDIRECT_PTR(struct |
129 | (struct acpi_table_header **)&facs); | 130 | acpi_table_header, |
131 | &facs)); | ||
130 | if (ACPI_FAILURE(status)) { | 132 | if (ACPI_FAILURE(status)) { |
131 | return_ACPI_STATUS(status); | 133 | return_ACPI_STATUS(status); |
132 | } | 134 | } |
diff --git a/drivers/acpi/hardware/hwtimer.c b/drivers/acpi/hardware/hwtimer.c index c32eab696acd..b53d575491b9 100644 --- a/drivers/acpi/hardware/hwtimer.c +++ b/drivers/acpi/hardware/hwtimer.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/namespace/nsaccess.c b/drivers/acpi/namespace/nsaccess.c index 57faf598bad8..c39a7f68b889 100644 --- a/drivers/acpi/namespace/nsaccess.c +++ b/drivers/acpi/namespace/nsaccess.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -208,8 +208,7 @@ acpi_status acpi_ns_root_initialize(void) | |||
208 | /* Special case for ACPI Global Lock */ | 208 | /* Special case for ACPI Global Lock */ |
209 | 209 | ||
210 | if (ACPI_STRCMP(init_val->name, "_GL_") == 0) { | 210 | if (ACPI_STRCMP(init_val->name, "_GL_") == 0) { |
211 | acpi_gbl_global_lock_mutex = | 211 | acpi_gbl_global_lock_mutex = obj_desc; |
212 | obj_desc->mutex.os_mutex; | ||
213 | 212 | ||
214 | /* Create additional counting semaphore for global lock */ | 213 | /* Create additional counting semaphore for global lock */ |
215 | 214 | ||
@@ -582,44 +581,68 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, | |||
582 | return_ACPI_STATUS(status); | 581 | return_ACPI_STATUS(status); |
583 | } | 582 | } |
584 | 583 | ||
585 | /* | 584 | /* More segments to follow? */ |
586 | * Sanity typecheck of the target object: | 585 | |
587 | * | 586 | if (num_segments > 0) { |
588 | * If 1) This is the last segment (num_segments == 0) | 587 | /* |
589 | * 2) And we are looking for a specific type | 588 | * If we have an alias to an object that opens a scope (such as a |
590 | * (Not checking for TYPE_ANY) | 589 | * device or processor), we need to dereference the alias here so that |
591 | * 3) Which is not an alias | 590 | * we can access any children of the original node (via the remaining |
592 | * 4) Which is not a local type (TYPE_SCOPE) | 591 | * segments). |
593 | * 5) And the type of target object is known (not TYPE_ANY) | 592 | */ |
594 | * 6) And target object does not match what we are looking for | 593 | if (this_node->type == ACPI_TYPE_LOCAL_ALIAS) { |
595 | * | 594 | if (acpi_ns_opens_scope |
596 | * Then we have a type mismatch. Just warn and ignore it. | 595 | (((struct acpi_namespace_node *)this_node-> |
597 | */ | 596 | object)->type)) { |
598 | if ((num_segments == 0) && | 597 | this_node = |
599 | (type_to_check_for != ACPI_TYPE_ANY) && | 598 | (struct acpi_namespace_node *) |
600 | (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) && | 599 | this_node->object; |
601 | (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) && | 600 | } |
602 | (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) && | 601 | } |
603 | (this_node->type != ACPI_TYPE_ANY) && | ||
604 | (this_node->type != type_to_check_for)) { | ||
605 | |||
606 | /* Complain about a type mismatch */ | ||
607 | |||
608 | ACPI_WARNING((AE_INFO, | ||
609 | "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", | ||
610 | ACPI_CAST_PTR(char, &simple_name), | ||
611 | acpi_ut_get_type_name(this_node->type), | ||
612 | acpi_ut_get_type_name | ||
613 | (type_to_check_for))); | ||
614 | } | 602 | } |
615 | 603 | ||
616 | /* | 604 | /* Special handling for the last segment (num_segments == 0) */ |
617 | * If this is the last name segment and we are not looking for a | 605 | |
618 | * specific type, but the type of found object is known, use that type | 606 | else { |
619 | * to see if it opens a scope. | 607 | /* |
620 | */ | 608 | * Sanity typecheck of the target object: |
621 | if ((num_segments == 0) && (type == ACPI_TYPE_ANY)) { | 609 | * |
622 | type = this_node->type; | 610 | * If 1) This is the last segment (num_segments == 0) |
611 | * 2) And we are looking for a specific type | ||
612 | * (Not checking for TYPE_ANY) | ||
613 | * 3) Which is not an alias | ||
614 | * 4) Which is not a local type (TYPE_SCOPE) | ||
615 | * 5) And the type of target object is known (not TYPE_ANY) | ||
616 | * 6) And target object does not match what we are looking for | ||
617 | * | ||
618 | * Then we have a type mismatch. Just warn and ignore it. | ||
619 | */ | ||
620 | if ((type_to_check_for != ACPI_TYPE_ANY) && | ||
621 | (type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) && | ||
622 | (type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) | ||
623 | && (type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) | ||
624 | && (this_node->type != ACPI_TYPE_ANY) | ||
625 | && (this_node->type != type_to_check_for)) { | ||
626 | |||
627 | /* Complain about a type mismatch */ | ||
628 | |||
629 | ACPI_WARNING((AE_INFO, | ||
630 | "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)", | ||
631 | ACPI_CAST_PTR(char, &simple_name), | ||
632 | acpi_ut_get_type_name(this_node-> | ||
633 | type), | ||
634 | acpi_ut_get_type_name | ||
635 | (type_to_check_for))); | ||
636 | } | ||
637 | |||
638 | /* | ||
639 | * If this is the last name segment and we are not looking for a | ||
640 | * specific type, but the type of found object is known, use that type | ||
641 | * to (later) see if it opens a scope. | ||
642 | */ | ||
643 | if (type == ACPI_TYPE_ANY) { | ||
644 | type = this_node->type; | ||
645 | } | ||
623 | } | 646 | } |
624 | 647 | ||
625 | /* Point to next name segment and make this node current */ | 648 | /* Point to next name segment and make this node current */ |
diff --git a/drivers/acpi/namespace/nsalloc.c b/drivers/acpi/namespace/nsalloc.c index 1d693d8ad2d8..3a1740ac2edc 100644 --- a/drivers/acpi/namespace/nsalloc.c +++ b/drivers/acpi/namespace/nsalloc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index 1fc4f86676e1..5445751b8a3e 100644 --- a/drivers/acpi/namespace/nsdump.c +++ b/drivers/acpi/namespace/nsdump.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -249,7 +249,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
249 | acpi_os_printf("ID %X Len %.4X Addr %p\n", | 249 | acpi_os_printf("ID %X Len %.4X Addr %p\n", |
250 | obj_desc->processor.proc_id, | 250 | obj_desc->processor.proc_id, |
251 | obj_desc->processor.length, | 251 | obj_desc->processor.length, |
252 | (char *)obj_desc->processor.address); | 252 | ACPI_CAST_PTR(void, |
253 | obj_desc->processor. | ||
254 | address)); | ||
253 | break; | 255 | break; |
254 | 256 | ||
255 | case ACPI_TYPE_DEVICE: | 257 | case ACPI_TYPE_DEVICE: |
@@ -320,9 +322,8 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, | |||
320 | space_id)); | 322 | space_id)); |
321 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { | 323 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { |
322 | acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n", | 324 | acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n", |
323 | ACPI_FORMAT_UINT64(obj_desc-> | 325 | ACPI_FORMAT_NATIVE_UINT |
324 | region. | 326 | (obj_desc->region.address), |
325 | address), | ||
326 | obj_desc->region.length); | 327 | obj_desc->region.length); |
327 | } else { | 328 | } else { |
328 | acpi_os_printf | 329 | acpi_os_printf |
diff --git a/drivers/acpi/namespace/nsdumpdv.c b/drivers/acpi/namespace/nsdumpdv.c index 5097e167939e..428f50fde11a 100644 --- a/drivers/acpi/namespace/nsdumpdv.c +++ b/drivers/acpi/namespace/nsdumpdv.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/namespace/nseval.c b/drivers/acpi/namespace/nseval.c index 97b2ac57c16b..14bdfa92bea0 100644 --- a/drivers/acpi/namespace/nseval.c +++ b/drivers/acpi/namespace/nseval.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/namespace/nsinit.c b/drivers/acpi/namespace/nsinit.c index 33db2241044e..6d6d930c8e18 100644 --- a/drivers/acpi/namespace/nsinit.c +++ b/drivers/acpi/namespace/nsinit.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -244,6 +244,10 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
244 | info->field_count++; | 244 | info->field_count++; |
245 | break; | 245 | break; |
246 | 246 | ||
247 | case ACPI_TYPE_LOCAL_BANK_FIELD: | ||
248 | info->field_count++; | ||
249 | break; | ||
250 | |||
247 | case ACPI_TYPE_BUFFER: | 251 | case ACPI_TYPE_BUFFER: |
248 | info->buffer_count++; | 252 | info->buffer_count++; |
249 | break; | 253 | break; |
@@ -287,6 +291,12 @@ acpi_ns_init_one_object(acpi_handle obj_handle, | |||
287 | status = acpi_ds_get_buffer_field_arguments(obj_desc); | 291 | status = acpi_ds_get_buffer_field_arguments(obj_desc); |
288 | break; | 292 | break; |
289 | 293 | ||
294 | case ACPI_TYPE_LOCAL_BANK_FIELD: | ||
295 | |||
296 | info->field_init++; | ||
297 | status = acpi_ds_get_bank_field_arguments(obj_desc); | ||
298 | break; | ||
299 | |||
290 | case ACPI_TYPE_BUFFER: | 300 | case ACPI_TYPE_BUFFER: |
291 | 301 | ||
292 | info->buffer_init++; | 302 | info->buffer_init++; |
diff --git a/drivers/acpi/namespace/nsload.c b/drivers/acpi/namespace/nsload.c index d4f9654fd20f..2c92f6cf5ce1 100644 --- a/drivers/acpi/namespace/nsload.c +++ b/drivers/acpi/namespace/nsload.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -107,11 +107,11 @@ acpi_ns_load_table(acpi_native_uint table_index, | |||
107 | goto unlock; | 107 | goto unlock; |
108 | } | 108 | } |
109 | 109 | ||
110 | status = acpi_ns_parse_table(table_index, node->child); | 110 | status = acpi_ns_parse_table(table_index, node); |
111 | if (ACPI_SUCCESS(status)) { | 111 | if (ACPI_SUCCESS(status)) { |
112 | acpi_tb_set_table_loaded_flag(table_index, TRUE); | 112 | acpi_tb_set_table_loaded_flag(table_index, TRUE); |
113 | } else { | 113 | } else { |
114 | acpi_tb_release_owner_id(table_index); | 114 | (void)acpi_tb_release_owner_id(table_index); |
115 | } | 115 | } |
116 | 116 | ||
117 | unlock: | 117 | unlock: |
diff --git a/drivers/acpi/namespace/nsnames.c b/drivers/acpi/namespace/nsnames.c index cbd94af08cc5..cffef1bcbdbc 100644 --- a/drivers/acpi/namespace/nsnames.c +++ b/drivers/acpi/namespace/nsnames.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -180,6 +180,12 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node) | |||
180 | next_node = node; | 180 | next_node = node; |
181 | 181 | ||
182 | while (next_node && (next_node != acpi_gbl_root_node)) { | 182 | while (next_node && (next_node != acpi_gbl_root_node)) { |
183 | if (ACPI_GET_DESCRIPTOR_TYPE(next_node) != ACPI_DESC_TYPE_NAMED) { | ||
184 | ACPI_ERROR((AE_INFO, | ||
185 | "Invalid NS Node (%p) while traversing path", | ||
186 | next_node)); | ||
187 | return 0; | ||
188 | } | ||
183 | size += ACPI_PATH_SEGMENT_LENGTH; | 189 | size += ACPI_PATH_SEGMENT_LENGTH; |
184 | next_node = acpi_ns_get_parent_node(next_node); | 190 | next_node = acpi_ns_get_parent_node(next_node); |
185 | } | 191 | } |
diff --git a/drivers/acpi/namespace/nsobject.c b/drivers/acpi/namespace/nsobject.c index d9d7377bc6e6..15fe09e24f71 100644 --- a/drivers/acpi/namespace/nsobject.c +++ b/drivers/acpi/namespace/nsobject.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/namespace/nsparse.c b/drivers/acpi/namespace/nsparse.c index e696aa847990..46a79b0103b6 100644 --- a/drivers/acpi/namespace/nsparse.c +++ b/drivers/acpi/namespace/nsparse.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -64,7 +64,8 @@ ACPI_MODULE_NAME("nsparse") | |||
64 | ******************************************************************************/ | 64 | ******************************************************************************/ |
65 | acpi_status | 65 | acpi_status |
66 | acpi_ns_one_complete_parse(acpi_native_uint pass_number, | 66 | acpi_ns_one_complete_parse(acpi_native_uint pass_number, |
67 | acpi_native_uint table_index) | 67 | acpi_native_uint table_index, |
68 | struct acpi_namespace_node * start_node) | ||
68 | { | 69 | { |
69 | union acpi_parse_object *parse_root; | 70 | union acpi_parse_object *parse_root; |
70 | acpi_status status; | 71 | acpi_status status; |
@@ -111,14 +112,25 @@ acpi_ns_one_complete_parse(acpi_native_uint pass_number, | |||
111 | aml_start = (u8 *) table + sizeof(struct acpi_table_header); | 112 | aml_start = (u8 *) table + sizeof(struct acpi_table_header); |
112 | aml_length = table->length - sizeof(struct acpi_table_header); | 113 | aml_length = table->length - sizeof(struct acpi_table_header); |
113 | status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL, | 114 | status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL, |
114 | aml_start, aml_length, NULL, | 115 | aml_start, (u32) aml_length, |
115 | (u8) pass_number); | 116 | NULL, (u8) pass_number); |
116 | } | 117 | } |
117 | 118 | ||
118 | if (ACPI_FAILURE(status)) { | 119 | if (ACPI_FAILURE(status)) { |
119 | acpi_ds_delete_walk_state(walk_state); | 120 | acpi_ds_delete_walk_state(walk_state); |
120 | acpi_ps_delete_parse_tree(parse_root); | 121 | goto cleanup; |
121 | return_ACPI_STATUS(status); | 122 | } |
123 | |||
124 | /* start_node is the default location to load the table */ | ||
125 | |||
126 | if (start_node && start_node != acpi_gbl_root_node) { | ||
127 | status = | ||
128 | acpi_ds_scope_stack_push(start_node, ACPI_TYPE_METHOD, | ||
129 | walk_state); | ||
130 | if (ACPI_FAILURE(status)) { | ||
131 | acpi_ds_delete_walk_state(walk_state); | ||
132 | goto cleanup; | ||
133 | } | ||
122 | } | 134 | } |
123 | 135 | ||
124 | /* Parse the AML */ | 136 | /* Parse the AML */ |
@@ -127,6 +139,7 @@ acpi_ns_one_complete_parse(acpi_native_uint pass_number, | |||
127 | (unsigned)pass_number)); | 139 | (unsigned)pass_number)); |
128 | status = acpi_ps_parse_aml(walk_state); | 140 | status = acpi_ps_parse_aml(walk_state); |
129 | 141 | ||
142 | cleanup: | ||
130 | acpi_ps_delete_parse_tree(parse_root); | 143 | acpi_ps_delete_parse_tree(parse_root); |
131 | return_ACPI_STATUS(status); | 144 | return_ACPI_STATUS(status); |
132 | } | 145 | } |
@@ -163,7 +176,9 @@ acpi_ns_parse_table(acpi_native_uint table_index, | |||
163 | * performs another complete parse of the AML. | 176 | * performs another complete parse of the AML. |
164 | */ | 177 | */ |
165 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); | 178 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); |
166 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, table_index); | 179 | status = |
180 | acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, table_index, | ||
181 | start_node); | ||
167 | if (ACPI_FAILURE(status)) { | 182 | if (ACPI_FAILURE(status)) { |
168 | return_ACPI_STATUS(status); | 183 | return_ACPI_STATUS(status); |
169 | } | 184 | } |
@@ -178,7 +193,9 @@ acpi_ns_parse_table(acpi_native_uint table_index, | |||
178 | * parse objects are all cached. | 193 | * parse objects are all cached. |
179 | */ | 194 | */ |
180 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n")); | 195 | ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n")); |
181 | status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, table_index); | 196 | status = |
197 | acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS2, table_index, | ||
198 | start_node); | ||
182 | if (ACPI_FAILURE(status)) { | 199 | if (ACPI_FAILURE(status)) { |
183 | return_ACPI_STATUS(status); | 200 | return_ACPI_STATUS(status); |
184 | } | 201 | } |
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index e863be665ce8..8399276cba1e 100644 --- a/drivers/acpi/namespace/nssearch.c +++ b/drivers/acpi/namespace/nssearch.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/namespace/nsutils.c b/drivers/acpi/namespace/nsutils.c index 90fd059615ff..64c039843ed2 100644 --- a/drivers/acpi/namespace/nsutils.c +++ b/drivers/acpi/namespace/nsutils.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c index 280b8357c46c..3c905ce26d7d 100644 --- a/drivers/acpi/namespace/nswalk.c +++ b/drivers/acpi/namespace/nswalk.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -77,9 +77,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type, struct | |||
77 | 77 | ||
78 | /* It's really the parent's _scope_ that we want */ | 78 | /* It's really the parent's _scope_ that we want */ |
79 | 79 | ||
80 | if (parent_node->child) { | 80 | next_node = parent_node->child; |
81 | next_node = parent_node->child; | ||
82 | } | ||
83 | } | 81 | } |
84 | 82 | ||
85 | else { | 83 | else { |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index b92133faf5b7..a8d549187c84 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -467,10 +467,13 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
467 | return (AE_CTRL_DEPTH); | 467 | return (AE_CTRL_DEPTH); |
468 | } | 468 | } |
469 | 469 | ||
470 | if (!(flags & ACPI_STA_DEVICE_PRESENT)) { | 470 | if (!(flags & ACPI_STA_DEVICE_PRESENT) && |
471 | 471 | !(flags & ACPI_STA_DEVICE_FUNCTIONING)) { | |
472 | /* Don't examine children of the device if not present */ | 472 | /* |
473 | 473 | * Don't examine the children of the device only when the | |
474 | * device is neither present nor functional. See ACPI spec, | ||
475 | * description of _STA for more information. | ||
476 | */ | ||
474 | return (AE_CTRL_DEPTH); | 477 | return (AE_CTRL_DEPTH); |
475 | } | 478 | } |
476 | 479 | ||
@@ -539,7 +542,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
539 | * value is returned to the caller. | 542 | * value is returned to the caller. |
540 | * | 543 | * |
541 | * This is a wrapper for walk_namespace, but the callback performs | 544 | * This is a wrapper for walk_namespace, but the callback performs |
542 | * additional filtering. Please see acpi_get_device_callback. | 545 | * additional filtering. Please see acpi_ns_get_device_callback. |
543 | * | 546 | * |
544 | ******************************************************************************/ | 547 | ******************************************************************************/ |
545 | 548 | ||
diff --git a/drivers/acpi/namespace/nsxfname.c b/drivers/acpi/namespace/nsxfname.c index b489781b22a8..a287ed550f54 100644 --- a/drivers/acpi/namespace/nsxfname.c +++ b/drivers/acpi/namespace/nsxfname.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/namespace/nsxfobj.c b/drivers/acpi/namespace/nsxfobj.c index faa375887201..2b375ee80cef 100644 --- a/drivers/acpi/namespace/nsxfobj.c +++ b/drivers/acpi/namespace/nsxfobj.c | |||
@@ -6,7 +6,7 @@ | |||
6 | ******************************************************************************/ | 6 | ******************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index a498a6cc68fe..235a1386888a 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -742,6 +742,7 @@ EXPORT_SYMBOL(acpi_os_execute); | |||
742 | void acpi_os_wait_events_complete(void *context) | 742 | void acpi_os_wait_events_complete(void *context) |
743 | { | 743 | { |
744 | flush_workqueue(kacpid_wq); | 744 | flush_workqueue(kacpid_wq); |
745 | flush_workqueue(kacpi_notify_wq); | ||
745 | } | 746 | } |
746 | 747 | ||
747 | EXPORT_SYMBOL(acpi_os_wait_events_complete); | 748 | EXPORT_SYMBOL(acpi_os_wait_events_complete); |
diff --git a/drivers/acpi/parser/psargs.c b/drivers/acpi/parser/psargs.c index c2b9835c890b..f1e8bf65e24e 100644 --- a/drivers/acpi/parser/psargs.c +++ b/drivers/acpi/parser/psargs.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -230,12 +230,12 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
230 | struct acpi_parse_state *parser_state, | 230 | struct acpi_parse_state *parser_state, |
231 | union acpi_parse_object *arg, u8 possible_method_call) | 231 | union acpi_parse_object *arg, u8 possible_method_call) |
232 | { | 232 | { |
233 | acpi_status status; | ||
233 | char *path; | 234 | char *path; |
234 | union acpi_parse_object *name_op; | 235 | union acpi_parse_object *name_op; |
235 | acpi_status status; | ||
236 | union acpi_operand_object *method_desc; | 236 | union acpi_operand_object *method_desc; |
237 | struct acpi_namespace_node *node; | 237 | struct acpi_namespace_node *node; |
238 | union acpi_generic_state scope_info; | 238 | u8 *start = parser_state->aml; |
239 | 239 | ||
240 | ACPI_FUNCTION_TRACE(ps_get_next_namepath); | 240 | ACPI_FUNCTION_TRACE(ps_get_next_namepath); |
241 | 241 | ||
@@ -249,25 +249,18 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
249 | return_ACPI_STATUS(AE_OK); | 249 | return_ACPI_STATUS(AE_OK); |
250 | } | 250 | } |
251 | 251 | ||
252 | /* Setup search scope info */ | ||
253 | |||
254 | scope_info.scope.node = NULL; | ||
255 | node = parser_state->start_node; | ||
256 | if (node) { | ||
257 | scope_info.scope.node = node; | ||
258 | } | ||
259 | |||
260 | /* | 252 | /* |
261 | * Lookup the name in the internal namespace. We don't want to add | 253 | * Lookup the name in the internal namespace, starting with the current |
262 | * anything new to the namespace here, however, so we use MODE_EXECUTE. | 254 | * scope. We don't want to add anything new to the namespace here, |
255 | * however, so we use MODE_EXECUTE. | ||
263 | * Allow searching of the parent tree, but don't open a new scope - | 256 | * Allow searching of the parent tree, but don't open a new scope - |
264 | * we just want to lookup the object (must be mode EXECUTE to perform | 257 | * we just want to lookup the object (must be mode EXECUTE to perform |
265 | * the upsearch) | 258 | * the upsearch) |
266 | */ | 259 | */ |
267 | status = | 260 | status = acpi_ns_lookup(walk_state->scope_info, path, |
268 | acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, | 261 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
269 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, | 262 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, |
270 | NULL, &node); | 263 | NULL, &node); |
271 | 264 | ||
272 | /* | 265 | /* |
273 | * If this name is a control method invocation, we must | 266 | * If this name is a control method invocation, we must |
@@ -275,6 +268,16 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, | |||
275 | */ | 268 | */ |
276 | if (ACPI_SUCCESS(status) && | 269 | if (ACPI_SUCCESS(status) && |
277 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { | 270 | possible_method_call && (node->type == ACPI_TYPE_METHOD)) { |
271 | if (walk_state->op->common.aml_opcode == AML_UNLOAD_OP) { | ||
272 | /* | ||
273 | * acpi_ps_get_next_namestring has increased the AML pointer, | ||
274 | * so we need to restore the saved AML pointer for method call. | ||
275 | */ | ||
276 | walk_state->parser_state.aml = start; | ||
277 | walk_state->arg_count = 1; | ||
278 | acpi_ps_init_op(arg, AML_INT_METHODCALL_OP); | ||
279 | return_ACPI_STATUS(AE_OK); | ||
280 | } | ||
278 | 281 | ||
279 | /* This name is actually a control method invocation */ | 282 | /* This name is actually a control method invocation */ |
280 | 283 | ||
@@ -686,9 +689,29 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, | |||
686 | return_ACPI_STATUS(AE_NO_MEMORY); | 689 | return_ACPI_STATUS(AE_NO_MEMORY); |
687 | } | 690 | } |
688 | 691 | ||
689 | status = | 692 | /* To support super_name arg of Unload */ |
690 | acpi_ps_get_next_namepath(walk_state, parser_state, | 693 | |
691 | arg, 0); | 694 | if (walk_state->op->common.aml_opcode == AML_UNLOAD_OP) { |
695 | status = | ||
696 | acpi_ps_get_next_namepath(walk_state, | ||
697 | parser_state, arg, | ||
698 | 1); | ||
699 | |||
700 | /* | ||
701 | * If the super_name arg of Unload is a method call, | ||
702 | * we have restored the AML pointer, just free this Arg | ||
703 | */ | ||
704 | if (arg->common.aml_opcode == | ||
705 | AML_INT_METHODCALL_OP) { | ||
706 | acpi_ps_free_op(arg); | ||
707 | arg = NULL; | ||
708 | } | ||
709 | } else { | ||
710 | status = | ||
711 | acpi_ps_get_next_namepath(walk_state, | ||
712 | parser_state, arg, | ||
713 | 0); | ||
714 | } | ||
692 | } else { | 715 | } else { |
693 | /* Single complex argument, nothing returned */ | 716 | /* Single complex argument, nothing returned */ |
694 | 717 | ||
diff --git a/drivers/acpi/parser/psloop.c b/drivers/acpi/parser/psloop.c index 773aee82fbb8..c06238e55d98 100644 --- a/drivers/acpi/parser/psloop.c +++ b/drivers/acpi/parser/psloop.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -182,6 +182,7 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | |||
182 | ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state); | 182 | ACPI_FUNCTION_TRACE_PTR(ps_build_named_op, walk_state); |
183 | 183 | ||
184 | unnamed_op->common.value.arg = NULL; | 184 | unnamed_op->common.value.arg = NULL; |
185 | unnamed_op->common.arg_list_length = 0; | ||
185 | unnamed_op->common.aml_opcode = walk_state->opcode; | 186 | unnamed_op->common.aml_opcode = walk_state->opcode; |
186 | 187 | ||
187 | /* | 188 | /* |
@@ -241,7 +242,8 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state, | |||
241 | acpi_ps_append_arg(*op, unnamed_op->common.value.arg); | 242 | acpi_ps_append_arg(*op, unnamed_op->common.value.arg); |
242 | acpi_gbl_depth++; | 243 | acpi_gbl_depth++; |
243 | 244 | ||
244 | if ((*op)->common.aml_opcode == AML_REGION_OP) { | 245 | if ((*op)->common.aml_opcode == AML_REGION_OP || |
246 | (*op)->common.aml_opcode == AML_DATA_REGION_OP) { | ||
245 | /* | 247 | /* |
246 | * Defer final parsing of an operation_region body, because we don't | 248 | * Defer final parsing of an operation_region body, because we don't |
247 | * have enough info in the first pass to parse it correctly (i.e., | 249 | * have enough info in the first pass to parse it correctly (i.e., |
@@ -280,6 +282,9 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state, | |||
280 | acpi_status status = AE_OK; | 282 | acpi_status status = AE_OK; |
281 | union acpi_parse_object *op; | 283 | union acpi_parse_object *op; |
282 | union acpi_parse_object *named_op = NULL; | 284 | union acpi_parse_object *named_op = NULL; |
285 | union acpi_parse_object *parent_scope; | ||
286 | u8 argument_count; | ||
287 | const struct acpi_opcode_info *op_info; | ||
283 | 288 | ||
284 | ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state); | 289 | ACPI_FUNCTION_TRACE_PTR(ps_create_op, walk_state); |
285 | 290 | ||
@@ -320,8 +325,32 @@ acpi_ps_create_op(struct acpi_walk_state *walk_state, | |||
320 | op->named.length = 0; | 325 | op->named.length = 0; |
321 | } | 326 | } |
322 | 327 | ||
323 | acpi_ps_append_arg(acpi_ps_get_parent_scope | 328 | if (walk_state->opcode == AML_BANK_FIELD_OP) { |
324 | (&(walk_state->parser_state)), op); | 329 | /* |
330 | * Backup to beginning of bank_field declaration | ||
331 | * body_length is unknown until we parse the body | ||
332 | */ | ||
333 | op->named.data = aml_op_start; | ||
334 | op->named.length = 0; | ||
335 | } | ||
336 | |||
337 | parent_scope = acpi_ps_get_parent_scope(&(walk_state->parser_state)); | ||
338 | acpi_ps_append_arg(parent_scope, op); | ||
339 | |||
340 | if (parent_scope) { | ||
341 | op_info = | ||
342 | acpi_ps_get_opcode_info(parent_scope->common.aml_opcode); | ||
343 | if (op_info->flags & AML_HAS_TARGET) { | ||
344 | argument_count = | ||
345 | acpi_ps_get_argument_count(op_info->type); | ||
346 | if (parent_scope->common.arg_list_length > | ||
347 | argument_count) { | ||
348 | op->common.flags |= ACPI_PARSEOP_TARGET; | ||
349 | } | ||
350 | } else if (parent_scope->common.aml_opcode == AML_INCREMENT_OP) { | ||
351 | op->common.flags |= ACPI_PARSEOP_TARGET; | ||
352 | } | ||
353 | } | ||
325 | 354 | ||
326 | if (walk_state->descending_callback != NULL) { | 355 | if (walk_state->descending_callback != NULL) { |
327 | /* | 356 | /* |
@@ -603,13 +632,6 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state, | |||
603 | acpi_ps_pop_scope(&(walk_state->parser_state), op, | 632 | acpi_ps_pop_scope(&(walk_state->parser_state), op, |
604 | &walk_state->arg_types, | 633 | &walk_state->arg_types, |
605 | &walk_state->arg_count); | 634 | &walk_state->arg_count); |
606 | |||
607 | if ((*op)->common.aml_opcode != AML_WHILE_OP) { | ||
608 | status2 = acpi_ds_result_stack_pop(walk_state); | ||
609 | if (ACPI_FAILURE(status2)) { | ||
610 | return_ACPI_STATUS(status2); | ||
611 | } | ||
612 | } | ||
613 | } | 635 | } |
614 | 636 | ||
615 | /* Close this iteration of the While loop */ | 637 | /* Close this iteration of the While loop */ |
@@ -640,10 +662,6 @@ acpi_ps_complete_op(struct acpi_walk_state *walk_state, | |||
640 | if (ACPI_FAILURE(status2)) { | 662 | if (ACPI_FAILURE(status2)) { |
641 | return_ACPI_STATUS(status2); | 663 | return_ACPI_STATUS(status2); |
642 | } | 664 | } |
643 | status2 = acpi_ds_result_stack_pop(walk_state); | ||
644 | if (ACPI_FAILURE(status2)) { | ||
645 | return_ACPI_STATUS(status2); | ||
646 | } | ||
647 | 665 | ||
648 | acpi_ut_delete_generic_state | 666 | acpi_ut_delete_generic_state |
649 | (acpi_ut_pop_generic_state | 667 | (acpi_ut_pop_generic_state |
@@ -1005,7 +1023,8 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
1005 | acpi_gbl_depth--; | 1023 | acpi_gbl_depth--; |
1006 | } | 1024 | } |
1007 | 1025 | ||
1008 | if (op->common.aml_opcode == AML_REGION_OP) { | 1026 | if (op->common.aml_opcode == AML_REGION_OP || |
1027 | op->common.aml_opcode == AML_DATA_REGION_OP) { | ||
1009 | /* | 1028 | /* |
1010 | * Skip parsing of control method or opregion body, | 1029 | * Skip parsing of control method or opregion body, |
1011 | * because we don't have enough info in the first pass | 1030 | * because we don't have enough info in the first pass |
@@ -1030,6 +1049,16 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state) | |||
1030 | (u32) (parser_state->aml - op->named.data); | 1049 | (u32) (parser_state->aml - op->named.data); |
1031 | } | 1050 | } |
1032 | 1051 | ||
1052 | if (op->common.aml_opcode == AML_BANK_FIELD_OP) { | ||
1053 | /* | ||
1054 | * Backup to beginning of bank_field declaration | ||
1055 | * | ||
1056 | * body_length is unknown until we parse the body | ||
1057 | */ | ||
1058 | op->named.length = | ||
1059 | (u32) (parser_state->aml - op->named.data); | ||
1060 | } | ||
1061 | |||
1033 | /* This op complete, notify the dispatcher */ | 1062 | /* This op complete, notify the dispatcher */ |
1034 | 1063 | ||
1035 | if (walk_state->ascending_callback != NULL) { | 1064 | if (walk_state->ascending_callback != NULL) { |
diff --git a/drivers/acpi/parser/psopcode.c b/drivers/acpi/parser/psopcode.c index 9296e86761d7..f425ab30eae8 100644 --- a/drivers/acpi/parser/psopcode.c +++ b/drivers/acpi/parser/psopcode.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -49,6 +49,9 @@ | |||
49 | #define _COMPONENT ACPI_PARSER | 49 | #define _COMPONENT ACPI_PARSER |
50 | ACPI_MODULE_NAME("psopcode") | 50 | ACPI_MODULE_NAME("psopcode") |
51 | 51 | ||
52 | static const u8 acpi_gbl_argument_count[] = | ||
53 | { 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 6 }; | ||
54 | |||
52 | /******************************************************************************* | 55 | /******************************************************************************* |
53 | * | 56 | * |
54 | * NAME: acpi_gbl_aml_op_info | 57 | * NAME: acpi_gbl_aml_op_info |
@@ -59,6 +62,7 @@ ACPI_MODULE_NAME("psopcode") | |||
59 | * the operand type. | 62 | * the operand type. |
60 | * | 63 | * |
61 | ******************************************************************************/ | 64 | ******************************************************************************/ |
65 | |||
62 | /* | 66 | /* |
63 | * Summary of opcode types/flags | 67 | * Summary of opcode types/flags |
64 | * | 68 | * |
@@ -176,6 +180,7 @@ ACPI_MODULE_NAME("psopcode") | |||
176 | AML_CREATE_QWORD_FIELD_OP | 180 | AML_CREATE_QWORD_FIELD_OP |
177 | 181 | ||
178 | ******************************************************************************/ | 182 | ******************************************************************************/ |
183 | |||
179 | /* | 184 | /* |
180 | * Master Opcode information table. A summary of everything we know about each | 185 | * Master Opcode information table. A summary of everything we know about each |
181 | * opcode, all in one place. | 186 | * opcode, all in one place. |
@@ -515,9 +520,10 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = { | |||
515 | AML_TYPE_NAMED_FIELD, | 520 | AML_TYPE_NAMED_FIELD, |
516 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), | 521 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), |
517 | /* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, | 522 | /* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, |
518 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, | 523 | ACPI_TYPE_LOCAL_BANK_FIELD, AML_CLASS_NAMED_OBJECT, |
519 | AML_TYPE_NAMED_FIELD, | 524 | AML_TYPE_NAMED_FIELD, |
520 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD), | 525 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD | |
526 | AML_DEFER), | ||
521 | 527 | ||
522 | /* Internal opcodes that map to invalid AML opcodes */ | 528 | /* Internal opcodes that map to invalid AML opcodes */ |
523 | 529 | ||
@@ -619,9 +625,9 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = { | |||
619 | AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), | 625 | AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), |
620 | /* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP, | 626 | /* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP, |
621 | ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, | 627 | ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, |
622 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, | 628 | AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, |
623 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | | 629 | AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | |
624 | AML_NSNODE | AML_NAMED), | 630 | AML_NSNODE | AML_NAMED | AML_DEFER), |
625 | /* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, | 631 | /* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, |
626 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, | 632 | ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, |
627 | AML_TYPE_NAMED_NO_OBJ, | 633 | AML_TYPE_NAMED_NO_OBJ, |
@@ -779,3 +785,25 @@ char *acpi_ps_get_opcode_name(u16 opcode) | |||
779 | 785 | ||
780 | #endif | 786 | #endif |
781 | } | 787 | } |
788 | |||
789 | /******************************************************************************* | ||
790 | * | ||
791 | * FUNCTION: acpi_ps_get_argument_count | ||
792 | * | ||
793 | * PARAMETERS: op_type - Type associated with the AML opcode | ||
794 | * | ||
795 | * RETURN: Argument count | ||
796 | * | ||
797 | * DESCRIPTION: Obtain the number of expected arguments for an AML opcode | ||
798 | * | ||
799 | ******************************************************************************/ | ||
800 | |||
801 | u8 acpi_ps_get_argument_count(u32 op_type) | ||
802 | { | ||
803 | |||
804 | if (op_type <= AML_TYPE_EXEC_6A_0T_1R) { | ||
805 | return (acpi_gbl_argument_count[op_type]); | ||
806 | } | ||
807 | |||
808 | return (0); | ||
809 | } | ||
diff --git a/drivers/acpi/parser/psparse.c b/drivers/acpi/parser/psparse.c index 5d63f48e56b5..15e1702e48d6 100644 --- a/drivers/acpi/parser/psparse.c +++ b/drivers/acpi/parser/psparse.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -205,6 +205,8 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, | |||
205 | || (op->common.parent->common.aml_opcode == | 205 | || (op->common.parent->common.aml_opcode == |
206 | AML_PACKAGE_OP) | 206 | AML_PACKAGE_OP) |
207 | || (op->common.parent->common.aml_opcode == | 207 | || (op->common.parent->common.aml_opcode == |
208 | AML_BANK_FIELD_OP) | ||
209 | || (op->common.parent->common.aml_opcode == | ||
208 | AML_VAR_PACKAGE_OP)) { | 210 | AML_VAR_PACKAGE_OP)) { |
209 | replacement_op = | 211 | replacement_op = |
210 | acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); | 212 | acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP); |
@@ -349,19 +351,13 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
349 | 351 | ||
350 | parser_state->aml = walk_state->aml_last_while; | 352 | parser_state->aml = walk_state->aml_last_while; |
351 | walk_state->control_state->common.value = FALSE; | 353 | walk_state->control_state->common.value = FALSE; |
352 | status = acpi_ds_result_stack_pop(walk_state); | 354 | status = AE_CTRL_BREAK; |
353 | if (ACPI_SUCCESS(status)) { | ||
354 | status = AE_CTRL_BREAK; | ||
355 | } | ||
356 | break; | 355 | break; |
357 | 356 | ||
358 | case AE_CTRL_CONTINUE: | 357 | case AE_CTRL_CONTINUE: |
359 | 358 | ||
360 | parser_state->aml = walk_state->aml_last_while; | 359 | parser_state->aml = walk_state->aml_last_while; |
361 | status = acpi_ds_result_stack_pop(walk_state); | 360 | status = AE_CTRL_CONTINUE; |
362 | if (ACPI_SUCCESS(status)) { | ||
363 | status = AE_CTRL_CONTINUE; | ||
364 | } | ||
365 | break; | 361 | break; |
366 | 362 | ||
367 | case AE_CTRL_PENDING: | 363 | case AE_CTRL_PENDING: |
@@ -383,10 +379,7 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, | |||
383 | * Just close out this package | 379 | * Just close out this package |
384 | */ | 380 | */ |
385 | parser_state->aml = acpi_ps_get_next_package_end(parser_state); | 381 | parser_state->aml = acpi_ps_get_next_package_end(parser_state); |
386 | status = acpi_ds_result_stack_pop(walk_state); | 382 | status = AE_CTRL_PENDING; |
387 | if (ACPI_SUCCESS(status)) { | ||
388 | status = AE_CTRL_PENDING; | ||
389 | } | ||
390 | break; | 383 | break; |
391 | 384 | ||
392 | case AE_CTRL_FALSE: | 385 | case AE_CTRL_FALSE: |
@@ -541,7 +534,7 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
541 | if ((status == AE_ALREADY_EXISTS) && | 534 | if ((status == AE_ALREADY_EXISTS) && |
542 | (!walk_state->method_desc->method.mutex)) { | 535 | (!walk_state->method_desc->method.mutex)) { |
543 | ACPI_INFO((AE_INFO, | 536 | ACPI_INFO((AE_INFO, |
544 | "Marking method %4.4s as Serialized", | 537 | "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error", |
545 | walk_state->method_node->name. | 538 | walk_state->method_node->name. |
546 | ascii)); | 539 | ascii)); |
547 | 540 | ||
@@ -601,6 +594,30 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) | |||
601 | * The object is deleted | 594 | * The object is deleted |
602 | */ | 595 | */ |
603 | if (!previous_walk_state->return_desc) { | 596 | if (!previous_walk_state->return_desc) { |
597 | /* | ||
598 | * In slack mode execution, if there is no return value | ||
599 | * we should implicitly return zero (0) as a default value. | ||
600 | */ | ||
601 | if (acpi_gbl_enable_interpreter_slack && | ||
602 | !previous_walk_state-> | ||
603 | implicit_return_obj) { | ||
604 | previous_walk_state-> | ||
605 | implicit_return_obj = | ||
606 | acpi_ut_create_internal_object | ||
607 | (ACPI_TYPE_INTEGER); | ||
608 | if (!previous_walk_state-> | ||
609 | implicit_return_obj) { | ||
610 | return_ACPI_STATUS | ||
611 | (AE_NO_MEMORY); | ||
612 | } | ||
613 | |||
614 | previous_walk_state-> | ||
615 | implicit_return_obj-> | ||
616 | integer.value = 0; | ||
617 | } | ||
618 | |||
619 | /* Restart the calling control method */ | ||
620 | |||
604 | status = | 621 | status = |
605 | acpi_ds_restart_control_method | 622 | acpi_ds_restart_control_method |
606 | (walk_state, | 623 | (walk_state, |
diff --git a/drivers/acpi/parser/psscope.c b/drivers/acpi/parser/psscope.c index 77cfa4ed0cfe..ee50e67c9443 100644 --- a/drivers/acpi/parser/psscope.c +++ b/drivers/acpi/parser/psscope.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/parser/pstree.c b/drivers/acpi/parser/pstree.c index 966e7ea2a0c4..1dd355ddd182 100644 --- a/drivers/acpi/parser/pstree.c +++ b/drivers/acpi/parser/pstree.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -171,6 +171,8 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg) | |||
171 | while (arg) { | 171 | while (arg) { |
172 | arg->common.parent = op; | 172 | arg->common.parent = op; |
173 | arg = arg->common.next; | 173 | arg = arg->common.next; |
174 | |||
175 | op->common.arg_list_length++; | ||
174 | } | 176 | } |
175 | } | 177 | } |
176 | 178 | ||
diff --git a/drivers/acpi/parser/psutils.c b/drivers/acpi/parser/psutils.c index 8ca52002db55..7cf1f65cd5bb 100644 --- a/drivers/acpi/parser/psutils.c +++ b/drivers/acpi/parser/psutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/parser/pswalk.c b/drivers/acpi/parser/pswalk.c index 49f9757434e4..8b86ad5a3201 100644 --- a/drivers/acpi/parser/pswalk.c +++ b/drivers/acpi/parser/pswalk.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/parser/psxface.c b/drivers/acpi/parser/psxface.c index 94103bced75e..52581454c47c 100644 --- a/drivers/acpi/parser/psxface.c +++ b/drivers/acpi/parser/psxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 21fc8bf0d31f..81e4f081a4ae 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -122,7 +122,7 @@ acpi_power_get_context(acpi_handle handle, | |||
122 | } | 122 | } |
123 | 123 | ||
124 | *resource = acpi_driver_data(device); | 124 | *resource = acpi_driver_data(device); |
125 | if (!resource) | 125 | if (!*resource) |
126 | return -ENODEV; | 126 | return -ENODEV; |
127 | 127 | ||
128 | return 0; | 128 | return 0; |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 5241e3ff5080..386e5aa48834 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -674,22 +674,21 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
674 | result = PTR_ERR(pr->cdev); | 674 | result = PTR_ERR(pr->cdev); |
675 | goto end; | 675 | goto end; |
676 | } | 676 | } |
677 | if (pr->cdev) { | 677 | |
678 | printk(KERN_INFO PREFIX | 678 | printk(KERN_INFO PREFIX |
679 | "%s is registered as cooling_device%d\n", | 679 | "%s is registered as cooling_device%d\n", |
680 | device->dev.bus_id, pr->cdev->id); | 680 | device->dev.bus_id, pr->cdev->id); |
681 | 681 | ||
682 | result = sysfs_create_link(&device->dev.kobj, | 682 | result = sysfs_create_link(&device->dev.kobj, |
683 | &pr->cdev->device.kobj, | 683 | &pr->cdev->device.kobj, |
684 | "thermal_cooling"); | 684 | "thermal_cooling"); |
685 | if (result) | 685 | if (result) |
686 | return result; | 686 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
687 | result = sysfs_create_link(&pr->cdev->device.kobj, | 687 | result = sysfs_create_link(&pr->cdev->device.kobj, |
688 | &device->dev.kobj, | 688 | &device->dev.kobj, |
689 | "device"); | 689 | "device"); |
690 | if (result) | 690 | if (result) |
691 | return result; | 691 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
692 | } | ||
693 | 692 | ||
694 | if (pr->flags.throttling) { | 693 | if (pr->flags.throttling) { |
695 | printk(KERN_INFO PREFIX "%s [%s] (supports", | 694 | printk(KERN_INFO PREFIX "%s [%s] (supports", |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 789d4947ed31..2dd2c1f3a01c 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -847,6 +847,7 @@ static int acpi_processor_get_power_info_default(struct acpi_processor *pr) | |||
847 | /* all processors need to support C1 */ | 847 | /* all processors need to support C1 */ |
848 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; | 848 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; |
849 | pr->power.states[ACPI_STATE_C1].valid = 1; | 849 | pr->power.states[ACPI_STATE_C1].valid = 1; |
850 | pr->power.states[ACPI_STATE_C1].entry_method = ACPI_CSTATE_HALT; | ||
850 | } | 851 | } |
851 | /* the C0 state only exists as a filler in our array */ | 852 | /* the C0 state only exists as a filler in our array */ |
852 | pr->power.states[ACPI_STATE_C0].valid = 1; | 853 | pr->power.states[ACPI_STATE_C0].valid = 1; |
@@ -959,6 +960,9 @@ static int acpi_processor_get_power_info_cst(struct acpi_processor *pr) | |||
959 | cx.address); | 960 | cx.address); |
960 | } | 961 | } |
961 | 962 | ||
963 | if (cx.type == ACPI_STATE_C1) { | ||
964 | cx.valid = 1; | ||
965 | } | ||
962 | 966 | ||
963 | obj = &(element->package.elements[2]); | 967 | obj = &(element->package.elements[2]); |
964 | if (obj->type != ACPI_TYPE_INTEGER) | 968 | if (obj->type != ACPI_TYPE_INTEGER) |
@@ -1295,6 +1299,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1295 | { | 1299 | { |
1296 | int result = 0; | 1300 | int result = 0; |
1297 | 1301 | ||
1302 | if (boot_option_idle_override) | ||
1303 | return 0; | ||
1298 | 1304 | ||
1299 | if (!pr) | 1305 | if (!pr) |
1300 | return -EINVAL; | 1306 | return -EINVAL; |
@@ -1734,6 +1740,9 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1734 | { | 1740 | { |
1735 | int ret; | 1741 | int ret; |
1736 | 1742 | ||
1743 | if (boot_option_idle_override) | ||
1744 | return 0; | ||
1745 | |||
1737 | if (!pr) | 1746 | if (!pr) |
1738 | return -EINVAL; | 1747 | return -EINVAL; |
1739 | 1748 | ||
@@ -1764,6 +1773,8 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
1764 | struct proc_dir_entry *entry = NULL; | 1773 | struct proc_dir_entry *entry = NULL; |
1765 | unsigned int i; | 1774 | unsigned int i; |
1766 | 1775 | ||
1776 | if (boot_option_idle_override) | ||
1777 | return 0; | ||
1767 | 1778 | ||
1768 | if (!first_run) { | 1779 | if (!first_run) { |
1769 | dmi_check_system(processor_power_dmi_table); | 1780 | dmi_check_system(processor_power_dmi_table); |
@@ -1799,7 +1810,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
1799 | * Note that we use previously set idle handler will be used on | 1810 | * Note that we use previously set idle handler will be used on |
1800 | * platforms that only support C1. | 1811 | * platforms that only support C1. |
1801 | */ | 1812 | */ |
1802 | if ((pr->flags.power) && (!boot_option_idle_override)) { | 1813 | if (pr->flags.power) { |
1803 | #ifdef CONFIG_CPU_IDLE | 1814 | #ifdef CONFIG_CPU_IDLE |
1804 | acpi_processor_setup_cpuidle(pr); | 1815 | acpi_processor_setup_cpuidle(pr); |
1805 | pr->power.dev.cpu = pr->id; | 1816 | pr->power.dev.cpu = pr->id; |
@@ -1835,8 +1846,11 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
1835 | int acpi_processor_power_exit(struct acpi_processor *pr, | 1846 | int acpi_processor_power_exit(struct acpi_processor *pr, |
1836 | struct acpi_device *device) | 1847 | struct acpi_device *device) |
1837 | { | 1848 | { |
1849 | if (boot_option_idle_override) | ||
1850 | return 0; | ||
1851 | |||
1838 | #ifdef CONFIG_CPU_IDLE | 1852 | #ifdef CONFIG_CPU_IDLE |
1839 | if ((pr->flags.power) && (!boot_option_idle_override)) | 1853 | if (pr->flags.power) |
1840 | cpuidle_unregister_device(&pr->power.dev); | 1854 | cpuidle_unregister_device(&pr->power.dev); |
1841 | #endif | 1855 | #endif |
1842 | pr->flags.power_setup_done = 0; | 1856 | pr->flags.power_setup_done = 0; |
diff --git a/drivers/acpi/resources/rsaddr.c b/drivers/acpi/resources/rsaddr.c index 271e61509eeb..7f96332822bf 100644 --- a/drivers/acpi/resources/rsaddr.c +++ b/drivers/acpi/resources/rsaddr.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 0dd2ce8a3475..8a112d11d491 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -73,7 +73,7 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length); | |||
73 | 73 | ||
74 | static u8 acpi_rs_count_set_bits(u16 bit_field) | 74 | static u8 acpi_rs_count_set_bits(u16 bit_field) |
75 | { | 75 | { |
76 | u8 bits_set; | 76 | acpi_native_uint bits_set; |
77 | 77 | ||
78 | ACPI_FUNCTION_ENTRY(); | 78 | ACPI_FUNCTION_ENTRY(); |
79 | 79 | ||
@@ -81,10 +81,10 @@ static u8 acpi_rs_count_set_bits(u16 bit_field) | |||
81 | 81 | ||
82 | /* Zero the least significant bit that is set */ | 82 | /* Zero the least significant bit that is set */ |
83 | 83 | ||
84 | bit_field &= (bit_field - 1); | 84 | bit_field &= (u16) (bit_field - 1); |
85 | } | 85 | } |
86 | 86 | ||
87 | return (bits_set); | 87 | return ((u8) bits_set); |
88 | } | 88 | } |
89 | 89 | ||
90 | /******************************************************************************* | 90 | /******************************************************************************* |
@@ -211,6 +211,24 @@ acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) | |||
211 | * variable-length fields | 211 | * variable-length fields |
212 | */ | 212 | */ |
213 | switch (resource->type) { | 213 | switch (resource->type) { |
214 | case ACPI_RESOURCE_TYPE_IRQ: | ||
215 | |||
216 | /* Length can be 3 or 2 */ | ||
217 | |||
218 | if (resource->data.irq.descriptor_length == 2) { | ||
219 | total_size--; | ||
220 | } | ||
221 | break; | ||
222 | |||
223 | case ACPI_RESOURCE_TYPE_START_DEPENDENT: | ||
224 | |||
225 | /* Length can be 1 or 0 */ | ||
226 | |||
227 | if (resource->data.irq.descriptor_length == 0) { | ||
228 | total_size--; | ||
229 | } | ||
230 | break; | ||
231 | |||
214 | case ACPI_RESOURCE_TYPE_VENDOR: | 232 | case ACPI_RESOURCE_TYPE_VENDOR: |
215 | /* | 233 | /* |
216 | * Vendor Defined Resource: | 234 | * Vendor Defined Resource: |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 50da494c3ee2..faddaee1bc07 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 46da116a4030..6bbbb7b8941a 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -87,8 +87,10 @@ acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); | |||
87 | * | 87 | * |
88 | ******************************************************************************/ | 88 | ******************************************************************************/ |
89 | 89 | ||
90 | struct acpi_rsdump_info acpi_rs_dump_irq[6] = { | 90 | struct acpi_rsdump_info acpi_rs_dump_irq[7] = { |
91 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, | 91 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, |
92 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.descriptor_length), | ||
93 | "Descriptor Length", NULL}, | ||
92 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", | 94 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", |
93 | acpi_gbl_he_decode}, | 95 | acpi_gbl_he_decode}, |
94 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", | 96 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", |
@@ -115,9 +117,11 @@ struct acpi_rsdump_info acpi_rs_dump_dma[6] = { | |||
115 | NULL} | 117 | NULL} |
116 | }; | 118 | }; |
117 | 119 | ||
118 | struct acpi_rsdump_info acpi_rs_dump_start_dpf[3] = { | 120 | struct acpi_rsdump_info acpi_rs_dump_start_dpf[4] = { |
119 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf), | 121 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf), |
120 | "Start-Dependent-Functions", NULL}, | 122 | "Start-Dependent-Functions", NULL}, |
123 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(start_dpf.descriptor_length), | ||
124 | "Descriptor Length", NULL}, | ||
121 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority), | 125 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority), |
122 | "Compatibility Priority", acpi_gbl_config_decode}, | 126 | "Compatibility Priority", acpi_gbl_config_decode}, |
123 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness), | 127 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness), |
diff --git a/drivers/acpi/resources/rsinfo.c b/drivers/acpi/resources/rsinfo.c index 2c2adb6292c1..3f0a1fedbe0e 100644 --- a/drivers/acpi/resources/rsinfo.c +++ b/drivers/acpi/resources/rsinfo.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/resources/rsio.c b/drivers/acpi/resources/rsio.c index b297bc3e4419..b66d42e7402e 100644 --- a/drivers/acpi/resources/rsio.c +++ b/drivers/acpi/resources/rsio.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -185,7 +185,7 @@ struct acpi_rsconvert_info acpi_rs_convert_end_tag[2] = { | |||
185 | * | 185 | * |
186 | ******************************************************************************/ | 186 | ******************************************************************************/ |
187 | 187 | ||
188 | struct acpi_rsconvert_info acpi_rs_get_start_dpf[5] = { | 188 | struct acpi_rsconvert_info acpi_rs_get_start_dpf[6] = { |
189 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, | 189 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT, |
190 | ACPI_RS_SIZE(struct acpi_resource_start_dependent), | 190 | ACPI_RS_SIZE(struct acpi_resource_start_dependent), |
191 | ACPI_RSC_TABLE_SIZE(acpi_rs_get_start_dpf)}, | 191 | ACPI_RSC_TABLE_SIZE(acpi_rs_get_start_dpf)}, |
@@ -196,6 +196,12 @@ struct acpi_rsconvert_info acpi_rs_get_start_dpf[5] = { | |||
196 | ACPI_ACCEPTABLE_CONFIGURATION, | 196 | ACPI_ACCEPTABLE_CONFIGURATION, |
197 | 2}, | 197 | 2}, |
198 | 198 | ||
199 | /* Get the descriptor length (0 or 1 for Start Dpf descriptor) */ | ||
200 | |||
201 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.start_dpf.descriptor_length), | ||
202 | AML_OFFSET(start_dpf.descriptor_type), | ||
203 | 0}, | ||
204 | |||
199 | /* All done if there is no flag byte present in the descriptor */ | 205 | /* All done if there is no flag byte present in the descriptor */ |
200 | 206 | ||
201 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, | 207 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1}, |
@@ -219,7 +225,9 @@ struct acpi_rsconvert_info acpi_rs_get_start_dpf[5] = { | |||
219 | * | 225 | * |
220 | ******************************************************************************/ | 226 | ******************************************************************************/ |
221 | 227 | ||
222 | struct acpi_rsconvert_info acpi_rs_set_start_dpf[6] = { | 228 | struct acpi_rsconvert_info acpi_rs_set_start_dpf[10] = { |
229 | /* Start with a default descriptor of length 1 */ | ||
230 | |||
223 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, | 231 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT, |
224 | sizeof(struct aml_resource_start_dependent), | 232 | sizeof(struct aml_resource_start_dependent), |
225 | ACPI_RSC_TABLE_SIZE(acpi_rs_set_start_dpf)}, | 233 | ACPI_RSC_TABLE_SIZE(acpi_rs_set_start_dpf)}, |
@@ -236,6 +244,33 @@ struct acpi_rsconvert_info acpi_rs_set_start_dpf[6] = { | |||
236 | AML_OFFSET(start_dpf.flags), | 244 | AML_OFFSET(start_dpf.flags), |
237 | 2}, | 245 | 2}, |
238 | /* | 246 | /* |
247 | * All done if the output descriptor length is required to be 1 | ||
248 | * (i.e., optimization to 0 bytes cannot be attempted) | ||
249 | */ | ||
250 | {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, | ||
251 | ACPI_RS_OFFSET(data.start_dpf.descriptor_length), | ||
252 | 1}, | ||
253 | |||
254 | /* Set length to 0 bytes (no flags byte) */ | ||
255 | |||
256 | {ACPI_RSC_LENGTH, 0, 0, | ||
257 | sizeof(struct aml_resource_start_dependent_noprio)}, | ||
258 | |||
259 | /* | ||
260 | * All done if the output descriptor length is required to be 0. | ||
261 | * | ||
262 | * TBD: Perhaps we should check for error if input flags are not | ||
263 | * compatible with a 0-byte descriptor. | ||
264 | */ | ||
265 | {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, | ||
266 | ACPI_RS_OFFSET(data.start_dpf.descriptor_length), | ||
267 | 0}, | ||
268 | |||
269 | /* Reset length to 1 byte (descriptor with flags byte) */ | ||
270 | |||
271 | {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_start_dependent)}, | ||
272 | |||
273 | /* | ||
239 | * All done if flags byte is necessary -- if either priority value | 274 | * All done if flags byte is necessary -- if either priority value |
240 | * is not ACPI_ACCEPTABLE_CONFIGURATION | 275 | * is not ACPI_ACCEPTABLE_CONFIGURATION |
241 | */ | 276 | */ |
diff --git a/drivers/acpi/resources/rsirq.c b/drivers/acpi/resources/rsirq.c index 5657f7b95039..a8805efc0366 100644 --- a/drivers/acpi/resources/rsirq.c +++ b/drivers/acpi/resources/rsirq.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -52,7 +52,7 @@ ACPI_MODULE_NAME("rsirq") | |||
52 | * acpi_rs_get_irq | 52 | * acpi_rs_get_irq |
53 | * | 53 | * |
54 | ******************************************************************************/ | 54 | ******************************************************************************/ |
55 | struct acpi_rsconvert_info acpi_rs_get_irq[7] = { | 55 | struct acpi_rsconvert_info acpi_rs_get_irq[8] = { |
56 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, | 56 | {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, |
57 | ACPI_RS_SIZE(struct acpi_resource_irq), | 57 | ACPI_RS_SIZE(struct acpi_resource_irq), |
58 | ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)}, | 58 | ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)}, |
@@ -69,6 +69,12 @@ struct acpi_rsconvert_info acpi_rs_get_irq[7] = { | |||
69 | ACPI_EDGE_SENSITIVE, | 69 | ACPI_EDGE_SENSITIVE, |
70 | 1}, | 70 | 1}, |
71 | 71 | ||
72 | /* Get the descriptor length (2 or 3 for IRQ descriptor) */ | ||
73 | |||
74 | {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.irq.descriptor_length), | ||
75 | AML_OFFSET(irq.descriptor_type), | ||
76 | 0}, | ||
77 | |||
72 | /* All done if no flag byte present in descriptor */ | 78 | /* All done if no flag byte present in descriptor */ |
73 | 79 | ||
74 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, | 80 | {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, |
@@ -94,7 +100,9 @@ struct acpi_rsconvert_info acpi_rs_get_irq[7] = { | |||
94 | * | 100 | * |
95 | ******************************************************************************/ | 101 | ******************************************************************************/ |
96 | 102 | ||
97 | struct acpi_rsconvert_info acpi_rs_set_irq[9] = { | 103 | struct acpi_rsconvert_info acpi_rs_set_irq[13] = { |
104 | /* Start with a default descriptor of length 3 */ | ||
105 | |||
98 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, | 106 | {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, |
99 | sizeof(struct aml_resource_irq), | 107 | sizeof(struct aml_resource_irq), |
100 | ACPI_RSC_TABLE_SIZE(acpi_rs_set_irq)}, | 108 | ACPI_RSC_TABLE_SIZE(acpi_rs_set_irq)}, |
@@ -105,7 +113,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[9] = { | |||
105 | AML_OFFSET(irq.irq_mask), | 113 | AML_OFFSET(irq.irq_mask), |
106 | ACPI_RS_OFFSET(data.irq.interrupt_count)}, | 114 | ACPI_RS_OFFSET(data.irq.interrupt_count)}, |
107 | 115 | ||
108 | /* Set the flags byte by default */ | 116 | /* Set the flags byte */ |
109 | 117 | ||
110 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), | 118 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering), |
111 | AML_OFFSET(irq.flags), | 119 | AML_OFFSET(irq.flags), |
@@ -118,6 +126,33 @@ struct acpi_rsconvert_info acpi_rs_set_irq[9] = { | |||
118 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), | 126 | {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable), |
119 | AML_OFFSET(irq.flags), | 127 | AML_OFFSET(irq.flags), |
120 | 4}, | 128 | 4}, |
129 | |||
130 | /* | ||
131 | * All done if the output descriptor length is required to be 3 | ||
132 | * (i.e., optimization to 2 bytes cannot be attempted) | ||
133 | */ | ||
134 | {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, | ||
135 | ACPI_RS_OFFSET(data.irq.descriptor_length), | ||
136 | 3}, | ||
137 | |||
138 | /* Set length to 2 bytes (no flags byte) */ | ||
139 | |||
140 | {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)}, | ||
141 | |||
142 | /* | ||
143 | * All done if the output descriptor length is required to be 2. | ||
144 | * | ||
145 | * TBD: Perhaps we should check for error if input flags are not | ||
146 | * compatible with a 2-byte descriptor. | ||
147 | */ | ||
148 | {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, | ||
149 | ACPI_RS_OFFSET(data.irq.descriptor_length), | ||
150 | 2}, | ||
151 | |||
152 | /* Reset length to 3 bytes (descriptor with flags byte) */ | ||
153 | |||
154 | {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq)}, | ||
155 | |||
121 | /* | 156 | /* |
122 | * Check if the flags byte is necessary. Not needed if the flags are: | 157 | * Check if the flags byte is necessary. Not needed if the flags are: |
123 | * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE | 158 | * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE |
@@ -134,7 +169,7 @@ struct acpi_rsconvert_info acpi_rs_set_irq[9] = { | |||
134 | ACPI_RS_OFFSET(data.irq.sharable), | 169 | ACPI_RS_OFFSET(data.irq.sharable), |
135 | ACPI_EXCLUSIVE}, | 170 | ACPI_EXCLUSIVE}, |
136 | 171 | ||
137 | /* irq_no_flags() descriptor can be used */ | 172 | /* We can optimize to a 2-byte irq_no_flags() descriptor */ |
138 | 173 | ||
139 | {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)} | 174 | {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)} |
140 | }; | 175 | }; |
diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index ca21e4660c79..b78c7e797a19 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/resources/rsmemory.c b/drivers/acpi/resources/rsmemory.c index 521eab7dd8df..63b21abd90bb 100644 --- a/drivers/acpi/resources/rsmemory.c +++ b/drivers/acpi/resources/rsmemory.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index c7081afa893a..de1ac3881b22 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -497,6 +497,17 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
497 | } | 497 | } |
498 | break; | 498 | break; |
499 | 499 | ||
500 | case ACPI_RSC_EXIT_EQ: | ||
501 | /* | ||
502 | * Control - Exit conversion if equal | ||
503 | */ | ||
504 | if (*ACPI_ADD_PTR(u8, resource, | ||
505 | COMPARE_TARGET(info)) == | ||
506 | COMPARE_VALUE(info)) { | ||
507 | goto exit; | ||
508 | } | ||
509 | break; | ||
510 | |||
500 | default: | 511 | default: |
501 | 512 | ||
502 | ACPI_ERROR((AE_INFO, "Invalid conversion opcode")); | 513 | ACPI_ERROR((AE_INFO, "Invalid conversion opcode")); |
diff --git a/drivers/acpi/resources/rsutils.c b/drivers/acpi/resources/rsutils.c index 11c0bd7b9cfd..befe2302f41b 100644 --- a/drivers/acpi/resources/rsutils.c +++ b/drivers/acpi/resources/rsutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -97,17 +97,17 @@ u8 acpi_rs_decode_bitmask(u16 mask, u8 * list) | |||
97 | u16 acpi_rs_encode_bitmask(u8 * list, u8 count) | 97 | u16 acpi_rs_encode_bitmask(u8 * list, u8 count) |
98 | { | 98 | { |
99 | acpi_native_uint i; | 99 | acpi_native_uint i; |
100 | u16 mask; | 100 | acpi_native_uint mask; |
101 | 101 | ||
102 | ACPI_FUNCTION_ENTRY(); | 102 | ACPI_FUNCTION_ENTRY(); |
103 | 103 | ||
104 | /* Encode the list into a single bitmask */ | 104 | /* Encode the list into a single bitmask */ |
105 | 105 | ||
106 | for (i = 0, mask = 0; i < count; i++) { | 106 | for (i = 0, mask = 0; i < count; i++) { |
107 | mask |= (0x0001 << list[i]); | 107 | mask |= (0x1 << list[i]); |
108 | } | 108 | } |
109 | 109 | ||
110 | return (mask); | 110 | return ((u16) mask); |
111 | } | 111 | } |
112 | 112 | ||
113 | /******************************************************************************* | 113 | /******************************************************************************* |
diff --git a/drivers/acpi/resources/rsxface.c b/drivers/acpi/resources/rsxface.c index 4c3fd4cdaf73..f59f4c4e034c 100644 --- a/drivers/acpi/resources/rsxface.c +++ b/drivers/acpi/resources/rsxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index e6ce262b5d44..6d85289f1c12 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -677,9 +677,8 @@ acpi_bus_extract_wakeup_device_power_package(struct acpi_device *device, | |||
677 | device->wakeup.resources.count = package->package.count - 2; | 677 | device->wakeup.resources.count = package->package.count - 2; |
678 | for (i = 0; i < device->wakeup.resources.count; i++) { | 678 | for (i = 0; i < device->wakeup.resources.count; i++) { |
679 | element = &(package->package.elements[i + 2]); | 679 | element = &(package->package.elements[i + 2]); |
680 | if (element->type != ACPI_TYPE_ANY) { | 680 | if (element->type != ACPI_TYPE_LOCAL_REFERENCE) |
681 | return AE_BAD_DATA; | 681 | return AE_BAD_DATA; |
682 | } | ||
683 | 682 | ||
684 | device->wakeup.resources.handles[i] = element->reference.handle; | 683 | device->wakeup.resources.handles[i] = element->reference.handle; |
685 | } | 684 | } |
@@ -692,6 +691,9 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
692 | acpi_status status = 0; | 691 | acpi_status status = 0; |
693 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 692 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
694 | union acpi_object *package = NULL; | 693 | union acpi_object *package = NULL; |
694 | union acpi_object in_arg[3]; | ||
695 | struct acpi_object_list arg_list = { 3, in_arg }; | ||
696 | acpi_status psw_status = AE_OK; | ||
695 | 697 | ||
696 | struct acpi_device_id button_device_ids[] = { | 698 | struct acpi_device_id button_device_ids[] = { |
697 | {"PNP0C0D", 0}, | 699 | {"PNP0C0D", 0}, |
@@ -700,7 +702,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
700 | {"", 0}, | 702 | {"", 0}, |
701 | }; | 703 | }; |
702 | 704 | ||
703 | |||
704 | /* _PRW */ | 705 | /* _PRW */ |
705 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); | 706 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); |
706 | if (ACPI_FAILURE(status)) { | 707 | if (ACPI_FAILURE(status)) { |
@@ -718,6 +719,45 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
718 | kfree(buffer.pointer); | 719 | kfree(buffer.pointer); |
719 | 720 | ||
720 | device->wakeup.flags.valid = 1; | 721 | device->wakeup.flags.valid = 1; |
722 | /* Call _PSW/_DSW object to disable its ability to wake the sleeping | ||
723 | * system for the ACPI device with the _PRW object. | ||
724 | * The _PSW object is depreciated in ACPI 3.0 and is replaced by _DSW. | ||
725 | * So it is necessary to call _DSW object first. Only when it is not | ||
726 | * present will the _PSW object used. | ||
727 | */ | ||
728 | /* | ||
729 | * Three agruments are needed for the _DSW object. | ||
730 | * Argument 0: enable/disable the wake capabilities | ||
731 | * When _DSW object is called to disable the wake capabilities, maybe | ||
732 | * the first argument is filled. The value of the other two agruments | ||
733 | * is meaningless. | ||
734 | */ | ||
735 | in_arg[0].type = ACPI_TYPE_INTEGER; | ||
736 | in_arg[0].integer.value = 0; | ||
737 | in_arg[1].type = ACPI_TYPE_INTEGER; | ||
738 | in_arg[1].integer.value = 0; | ||
739 | in_arg[2].type = ACPI_TYPE_INTEGER; | ||
740 | in_arg[2].integer.value = 0; | ||
741 | psw_status = acpi_evaluate_object(device->handle, "_DSW", | ||
742 | &arg_list, NULL); | ||
743 | if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) | ||
744 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in evaluate _DSW\n")); | ||
745 | /* | ||
746 | * When the _DSW object is not present, OSPM will call _PSW object. | ||
747 | */ | ||
748 | if (psw_status == AE_NOT_FOUND) { | ||
749 | /* | ||
750 | * Only one agruments is required for the _PSW object. | ||
751 | * agrument 0: enable/disable the wake capabilities | ||
752 | */ | ||
753 | arg_list.count = 1; | ||
754 | in_arg[0].integer.value = 0; | ||
755 | psw_status = acpi_evaluate_object(device->handle, "_PSW", | ||
756 | &arg_list, NULL); | ||
757 | if (ACPI_FAILURE(psw_status) && (psw_status != AE_NOT_FOUND)) | ||
758 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "error in " | ||
759 | "evaluate _PSW\n")); | ||
760 | } | ||
721 | /* Power button, Lid switch always enable wakeup */ | 761 | /* Power button, Lid switch always enable wakeup */ |
722 | if (!acpi_match_device_ids(device, button_device_ids)) | 762 | if (!acpi_match_device_ids(device, button_device_ids)) |
723 | device->wakeup.flags.run_wake = 1; | 763 | device->wakeup.flags.run_wake = 1; |
@@ -882,10 +922,7 @@ static void acpi_device_get_busid(struct acpi_device *device, | |||
882 | static int | 922 | static int |
883 | acpi_video_bus_match(struct acpi_device *device) | 923 | acpi_video_bus_match(struct acpi_device *device) |
884 | { | 924 | { |
885 | acpi_handle h_dummy1; | 925 | acpi_handle h_dummy; |
886 | acpi_handle h_dummy2; | ||
887 | acpi_handle h_dummy3; | ||
888 | |||
889 | 926 | ||
890 | if (!device) | 927 | if (!device) |
891 | return -EINVAL; | 928 | return -EINVAL; |
@@ -895,18 +932,18 @@ acpi_video_bus_match(struct acpi_device *device) | |||
895 | */ | 932 | */ |
896 | 933 | ||
897 | /* Does this device able to support video switching ? */ | 934 | /* Does this device able to support video switching ? */ |
898 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy1)) && | 935 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) && |
899 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy2))) | 936 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy))) |
900 | return 0; | 937 | return 0; |
901 | 938 | ||
902 | /* Does this device able to retrieve a video ROM ? */ | 939 | /* Does this device able to retrieve a video ROM ? */ |
903 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy1))) | 940 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy))) |
904 | return 0; | 941 | return 0; |
905 | 942 | ||
906 | /* Does this device able to configure which video head to be POSTed ? */ | 943 | /* Does this device able to configure which video head to be POSTed ? */ |
907 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy1)) && | 944 | if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy)) && |
908 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy2)) && | 945 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy)) && |
909 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy3))) | 946 | ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy))) |
910 | return 0; | 947 | return 0; |
911 | 948 | ||
912 | return -ENODEV; | 949 | return -ENODEV; |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 71183eea7906..c3b0cd88d09f 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -51,7 +51,7 @@ static int acpi_sleep_prepare(u32 acpi_state) | |||
51 | } | 51 | } |
52 | 52 | ||
53 | #ifdef CONFIG_SUSPEND | 53 | #ifdef CONFIG_SUSPEND |
54 | static struct platform_suspend_ops acpi_pm_ops; | 54 | static struct platform_suspend_ops acpi_suspend_ops; |
55 | 55 | ||
56 | extern void do_suspend_lowlevel(void); | 56 | extern void do_suspend_lowlevel(void); |
57 | 57 | ||
@@ -65,11 +65,11 @@ static u32 acpi_suspend_states[] = { | |||
65 | static int init_8259A_after_S1; | 65 | static int init_8259A_after_S1; |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * acpi_pm_begin - Set the target system sleep state to the state | 68 | * acpi_suspend_begin - Set the target system sleep state to the state |
69 | * associated with given @pm_state, if supported. | 69 | * associated with given @pm_state, if supported. |
70 | */ | 70 | */ |
71 | 71 | ||
72 | static int acpi_pm_begin(suspend_state_t pm_state) | 72 | static int acpi_suspend_begin(suspend_state_t pm_state) |
73 | { | 73 | { |
74 | u32 acpi_state = acpi_suspend_states[pm_state]; | 74 | u32 acpi_state = acpi_suspend_states[pm_state]; |
75 | int error = 0; | 75 | int error = 0; |
@@ -85,13 +85,13 @@ static int acpi_pm_begin(suspend_state_t pm_state) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * acpi_pm_prepare - Do preliminary suspend work. | 88 | * acpi_suspend_prepare - Do preliminary suspend work. |
89 | * | 89 | * |
90 | * If necessary, set the firmware waking vector and do arch-specific | 90 | * If necessary, set the firmware waking vector and do arch-specific |
91 | * nastiness to get the wakeup code to the waking vector. | 91 | * nastiness to get the wakeup code to the waking vector. |
92 | */ | 92 | */ |
93 | 93 | ||
94 | static int acpi_pm_prepare(void) | 94 | static int acpi_suspend_prepare(void) |
95 | { | 95 | { |
96 | int error = acpi_sleep_prepare(acpi_target_sleep_state); | 96 | int error = acpi_sleep_prepare(acpi_target_sleep_state); |
97 | 97 | ||
@@ -104,7 +104,7 @@ static int acpi_pm_prepare(void) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * acpi_pm_enter - Actually enter a sleep state. | 107 | * acpi_suspend_enter - Actually enter a sleep state. |
108 | * @pm_state: ignored | 108 | * @pm_state: ignored |
109 | * | 109 | * |
110 | * Flush caches and go to sleep. For STR we have to call arch-specific | 110 | * Flush caches and go to sleep. For STR we have to call arch-specific |
@@ -112,7 +112,7 @@ static int acpi_pm_prepare(void) | |||
112 | * It's unfortunate, but it works. Please fix if you're feeling frisky. | 112 | * It's unfortunate, but it works. Please fix if you're feeling frisky. |
113 | */ | 113 | */ |
114 | 114 | ||
115 | static int acpi_pm_enter(suspend_state_t pm_state) | 115 | static int acpi_suspend_enter(suspend_state_t pm_state) |
116 | { | 116 | { |
117 | acpi_status status = AE_OK; | 117 | acpi_status status = AE_OK; |
118 | unsigned long flags = 0; | 118 | unsigned long flags = 0; |
@@ -169,13 +169,13 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
169 | } | 169 | } |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * acpi_pm_finish - Instruct the platform to leave a sleep state. | 172 | * acpi_suspend_finish - Instruct the platform to leave a sleep state. |
173 | * | 173 | * |
174 | * This is called after we wake back up (or if entering the sleep state | 174 | * This is called after we wake back up (or if entering the sleep state |
175 | * failed). | 175 | * failed). |
176 | */ | 176 | */ |
177 | 177 | ||
178 | static void acpi_pm_finish(void) | 178 | static void acpi_suspend_finish(void) |
179 | { | 179 | { |
180 | u32 acpi_state = acpi_target_sleep_state; | 180 | u32 acpi_state = acpi_target_sleep_state; |
181 | 181 | ||
@@ -196,19 +196,19 @@ static void acpi_pm_finish(void) | |||
196 | } | 196 | } |
197 | 197 | ||
198 | /** | 198 | /** |
199 | * acpi_pm_end - Finish up suspend sequence. | 199 | * acpi_suspend_end - Finish up suspend sequence. |
200 | */ | 200 | */ |
201 | 201 | ||
202 | static void acpi_pm_end(void) | 202 | static void acpi_suspend_end(void) |
203 | { | 203 | { |
204 | /* | 204 | /* |
205 | * This is necessary in case acpi_pm_finish() is not called during a | 205 | * This is necessary in case acpi_suspend_finish() is not called during a |
206 | * failing transition to a sleep state. | 206 | * failing transition to a sleep state. |
207 | */ | 207 | */ |
208 | acpi_target_sleep_state = ACPI_STATE_S0; | 208 | acpi_target_sleep_state = ACPI_STATE_S0; |
209 | } | 209 | } |
210 | 210 | ||
211 | static int acpi_pm_state_valid(suspend_state_t pm_state) | 211 | static int acpi_suspend_state_valid(suspend_state_t pm_state) |
212 | { | 212 | { |
213 | u32 acpi_state; | 213 | u32 acpi_state; |
214 | 214 | ||
@@ -224,13 +224,13 @@ static int acpi_pm_state_valid(suspend_state_t pm_state) | |||
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | static struct platform_suspend_ops acpi_pm_ops = { | 227 | static struct platform_suspend_ops acpi_suspend_ops = { |
228 | .valid = acpi_pm_state_valid, | 228 | .valid = acpi_suspend_state_valid, |
229 | .begin = acpi_pm_begin, | 229 | .begin = acpi_suspend_begin, |
230 | .prepare = acpi_pm_prepare, | 230 | .prepare = acpi_suspend_prepare, |
231 | .enter = acpi_pm_enter, | 231 | .enter = acpi_suspend_enter, |
232 | .finish = acpi_pm_finish, | 232 | .finish = acpi_suspend_finish, |
233 | .end = acpi_pm_end, | 233 | .end = acpi_suspend_end, |
234 | }; | 234 | }; |
235 | 235 | ||
236 | /* | 236 | /* |
@@ -492,7 +492,7 @@ int __init acpi_sleep_init(void) | |||
492 | } | 492 | } |
493 | } | 493 | } |
494 | 494 | ||
495 | suspend_set_ops(&acpi_pm_ops); | 495 | suspend_set_ops(&acpi_suspend_ops); |
496 | #endif | 496 | #endif |
497 | 497 | ||
498 | #ifdef CONFIG_HIBERNATION | 498 | #ifdef CONFIG_HIBERNATION |
diff --git a/drivers/acpi/tables/tbfadt.c b/drivers/acpi/tables/tbfadt.c index 002bb33003af..949d4114eb9f 100644 --- a/drivers/acpi/tables/tbfadt.c +++ b/drivers/acpi/tables/tbfadt.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/tables/tbfind.c b/drivers/acpi/tables/tbfind.c index 058c064948e1..9ca3afc98c80 100644 --- a/drivers/acpi/tables/tbfind.c +++ b/drivers/acpi/tables/tbfind.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -70,12 +70,22 @@ acpi_tb_find_table(char *signature, | |||
70 | { | 70 | { |
71 | acpi_native_uint i; | 71 | acpi_native_uint i; |
72 | acpi_status status; | 72 | acpi_status status; |
73 | struct acpi_table_header header; | ||
73 | 74 | ||
74 | ACPI_FUNCTION_TRACE(tb_find_table); | 75 | ACPI_FUNCTION_TRACE(tb_find_table); |
75 | 76 | ||
77 | /* Normalize the input strings */ | ||
78 | |||
79 | ACPI_MEMSET(&header, 0, sizeof(struct acpi_table_header)); | ||
80 | ACPI_STRNCPY(header.signature, signature, ACPI_NAME_SIZE); | ||
81 | ACPI_STRNCPY(header.oem_id, oem_id, ACPI_OEM_ID_SIZE); | ||
82 | ACPI_STRNCPY(header.oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE); | ||
83 | |||
84 | /* Search for the table */ | ||
85 | |||
76 | for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { | 86 | for (i = 0; i < acpi_gbl_root_table_list.count; ++i) { |
77 | if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature), | 87 | if (ACPI_MEMCMP(&(acpi_gbl_root_table_list.tables[i].signature), |
78 | signature, ACPI_NAME_SIZE)) { | 88 | header.signature, ACPI_NAME_SIZE)) { |
79 | 89 | ||
80 | /* Not the requested table */ | 90 | /* Not the requested table */ |
81 | 91 | ||
@@ -104,20 +114,24 @@ acpi_tb_find_table(char *signature, | |||
104 | 114 | ||
105 | if (!ACPI_MEMCMP | 115 | if (!ACPI_MEMCMP |
106 | (acpi_gbl_root_table_list.tables[i].pointer->signature, | 116 | (acpi_gbl_root_table_list.tables[i].pointer->signature, |
107 | signature, ACPI_NAME_SIZE) && (!oem_id[0] | 117 | header.signature, ACPI_NAME_SIZE) && (!oem_id[0] |
108 | || | 118 | || |
109 | !ACPI_MEMCMP | 119 | !ACPI_MEMCMP |
110 | (acpi_gbl_root_table_list. | 120 | (acpi_gbl_root_table_list. |
111 | tables[i].pointer->oem_id, | 121 | tables[i].pointer-> |
112 | oem_id, ACPI_OEM_ID_SIZE)) | 122 | oem_id, |
123 | header.oem_id, | ||
124 | ACPI_OEM_ID_SIZE)) | ||
113 | && (!oem_table_id[0] | 125 | && (!oem_table_id[0] |
114 | || !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i]. | 126 | || !ACPI_MEMCMP(acpi_gbl_root_table_list.tables[i]. |
115 | pointer->oem_table_id, oem_table_id, | 127 | pointer->oem_table_id, |
128 | header.oem_table_id, | ||
116 | ACPI_OEM_TABLE_ID_SIZE))) { | 129 | ACPI_OEM_TABLE_ID_SIZE))) { |
117 | *table_index = i; | 130 | *table_index = i; |
118 | 131 | ||
119 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, | 132 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
120 | "Found table [%4.4s]\n", signature)); | 133 | "Found table [%4.4s]\n", |
134 | header.signature)); | ||
121 | return_ACPI_STATUS(AE_OK); | 135 | return_ACPI_STATUS(AE_OK); |
122 | } | 136 | } |
123 | } | 137 | } |
diff --git a/drivers/acpi/tables/tbinstal.c b/drivers/acpi/tables/tbinstal.c index 3bc0c67a9283..402f93e1ff20 100644 --- a/drivers/acpi/tables/tbinstal.c +++ b/drivers/acpi/tables/tbinstal.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -125,13 +125,20 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, | |||
125 | 125 | ||
126 | /* The table must be either an SSDT or a PSDT or an OEMx */ | 126 | /* The table must be either an SSDT or a PSDT or an OEMx */ |
127 | 127 | ||
128 | if ((!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)) | 128 | if (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)&& |
129 | && | 129 | !ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT)&& |
130 | (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT)) | 130 | strncmp(table_desc->pointer->signature, "OEM", 3)) { |
131 | && (strncmp(table_desc->pointer->signature, "OEM", 3))) { | 131 | /* Check for a printable name */ |
132 | ACPI_ERROR((AE_INFO, | 132 | if (acpi_ut_valid_acpi_name( |
133 | "Table has invalid signature [%4.4s], must be SSDT, PSDT or OEMx", | 133 | *(u32 *) table_desc->pointer->signature)) { |
134 | table_desc->pointer->signature)); | 134 | ACPI_ERROR((AE_INFO, "Table has invalid signature " |
135 | "[%4.4s], must be SSDT or PSDT", | ||
136 | table_desc->pointer->signature)); | ||
137 | } else { | ||
138 | ACPI_ERROR((AE_INFO, "Table has invalid signature " | ||
139 | "(0x%8.8X), must be SSDT or PSDT", | ||
140 | *(u32 *) table_desc->pointer->signature)); | ||
141 | } | ||
135 | return_ACPI_STATUS(AE_BAD_SIGNATURE); | 142 | return_ACPI_STATUS(AE_BAD_SIGNATURE); |
136 | } | 143 | } |
137 | 144 | ||
@@ -162,6 +169,7 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, | |||
162 | 169 | ||
163 | acpi_tb_delete_table(table_desc); | 170 | acpi_tb_delete_table(table_desc); |
164 | *table_index = i; | 171 | *table_index = i; |
172 | status = AE_ALREADY_EXISTS; | ||
165 | goto release; | 173 | goto release; |
166 | } | 174 | } |
167 | 175 | ||
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 010f19652f80..bc019b9b6a68 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -212,7 +212,7 @@ acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length) | |||
212 | 212 | ||
213 | if (checksum) { | 213 | if (checksum) { |
214 | ACPI_WARNING((AE_INFO, | 214 | ACPI_WARNING((AE_INFO, |
215 | "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", | 215 | "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", |
216 | table->signature, table->checksum, | 216 | table->signature, table->checksum, |
217 | (u8) (table->checksum - checksum))); | 217 | (u8) (table->checksum - checksum))); |
218 | 218 | ||
diff --git a/drivers/acpi/tables/tbxface.c b/drivers/acpi/tables/tbxface.c index a9e3331fee5d..fb57b93c2495 100644 --- a/drivers/acpi/tables/tbxface.c +++ b/drivers/acpi/tables/tbxface.c | |||
@@ -6,7 +6,7 @@ | |||
6 | *****************************************************************************/ | 6 | *****************************************************************************/ |
7 | 7 | ||
8 | /* | 8 | /* |
9 | * Copyright (C) 2000 - 2007, R. Byron Moore | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
10 | * All rights reserved. | 10 | * All rights reserved. |
11 | * | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without |
@@ -635,6 +635,95 @@ acpi_status acpi_load_tables(void) | |||
635 | ACPI_EXPORT_SYMBOL(acpi_load_tables) | 635 | ACPI_EXPORT_SYMBOL(acpi_load_tables) |
636 | 636 | ||
637 | 637 | ||
638 | /******************************************************************************* | ||
639 | * | ||
640 | * FUNCTION: acpi_install_table_handler | ||
641 | * | ||
642 | * PARAMETERS: Handler - Table event handler | ||
643 | * Context - Value passed to the handler on each event | ||
644 | * | ||
645 | * RETURN: Status | ||
646 | * | ||
647 | * DESCRIPTION: Install table event handler | ||
648 | * | ||
649 | ******************************************************************************/ | ||
650 | acpi_status | ||
651 | acpi_install_table_handler(acpi_tbl_handler handler, void *context) | ||
652 | { | ||
653 | acpi_status status; | ||
654 | |||
655 | ACPI_FUNCTION_TRACE(acpi_install_table_handler); | ||
656 | |||
657 | if (!handler) { | ||
658 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
659 | } | ||
660 | |||
661 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
662 | if (ACPI_FAILURE(status)) { | ||
663 | return_ACPI_STATUS(status); | ||
664 | } | ||
665 | |||
666 | /* Don't allow more than one handler */ | ||
667 | |||
668 | if (acpi_gbl_table_handler) { | ||
669 | status = AE_ALREADY_EXISTS; | ||
670 | goto cleanup; | ||
671 | } | ||
672 | |||
673 | /* Install the handler */ | ||
674 | |||
675 | acpi_gbl_table_handler = handler; | ||
676 | acpi_gbl_table_handler_context = context; | ||
677 | |||
678 | cleanup: | ||
679 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
680 | return_ACPI_STATUS(status); | ||
681 | } | ||
682 | |||
683 | ACPI_EXPORT_SYMBOL(acpi_install_table_handler) | ||
684 | |||
685 | /******************************************************************************* | ||
686 | * | ||
687 | * FUNCTION: acpi_remove_table_handler | ||
688 | * | ||
689 | * PARAMETERS: Handler - Table event handler that was installed | ||
690 | * previously. | ||
691 | * | ||
692 | * RETURN: Status | ||
693 | * | ||
694 | * DESCRIPTION: Remove table event handler | ||
695 | * | ||
696 | ******************************************************************************/ | ||
697 | acpi_status acpi_remove_table_handler(acpi_tbl_handler handler) | ||
698 | { | ||
699 | acpi_status status; | ||
700 | |||
701 | ACPI_FUNCTION_TRACE(acpi_remove_table_handler); | ||
702 | |||
703 | status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); | ||
704 | if (ACPI_FAILURE(status)) { | ||
705 | return_ACPI_STATUS(status); | ||
706 | } | ||
707 | |||
708 | /* Make sure that the installed handler is the same */ | ||
709 | |||
710 | if (!handler || handler != acpi_gbl_table_handler) { | ||
711 | status = AE_BAD_PARAMETER; | ||
712 | goto cleanup; | ||
713 | } | ||
714 | |||
715 | /* Remove the handler */ | ||
716 | |||
717 | acpi_gbl_table_handler = NULL; | ||
718 | |||
719 | cleanup: | ||
720 | (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); | ||
721 | return_ACPI_STATUS(status); | ||
722 | } | ||
723 | |||
724 | ACPI_EXPORT_SYMBOL(acpi_remove_table_handler) | ||
725 | |||
726 | |||
638 | static int __init acpi_no_auto_ssdt_setup(char *s) { | 727 | static int __init acpi_no_auto_ssdt_setup(char *s) { |
639 | 728 | ||
640 | printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n"); | 729 | printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n"); |
diff --git a/drivers/acpi/tables/tbxfroot.c b/drivers/acpi/tables/tbxfroot.c index 9ecb4b6c1e7d..b8c0dfa084f6 100644 --- a/drivers/acpi/tables/tbxfroot.c +++ b/drivers/acpi/tables/tbxfroot.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 0815ac3ae3d6..504385b1f211 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -889,10 +889,15 @@ static void acpi_thermal_check(void *data) | |||
889 | static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) | 889 | static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) |
890 | { | 890 | { |
891 | struct acpi_thermal *tz = thermal->devdata; | 891 | struct acpi_thermal *tz = thermal->devdata; |
892 | int result; | ||
892 | 893 | ||
893 | if (!tz) | 894 | if (!tz) |
894 | return -EINVAL; | 895 | return -EINVAL; |
895 | 896 | ||
897 | result = acpi_thermal_get_temperature(tz); | ||
898 | if (result) | ||
899 | return result; | ||
900 | |||
896 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature)); | 901 | return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature)); |
897 | } | 902 | } |
898 | 903 | ||
@@ -1017,6 +1022,18 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal, | |||
1017 | return -EINVAL; | 1022 | return -EINVAL; |
1018 | } | 1023 | } |
1019 | 1024 | ||
1025 | static int thermal_get_crit_temp(struct thermal_zone_device *thermal, | ||
1026 | unsigned long *temperature) { | ||
1027 | struct acpi_thermal *tz = thermal->devdata; | ||
1028 | |||
1029 | if (tz->trips.critical.flags.valid) { | ||
1030 | *temperature = KELVIN_TO_MILLICELSIUS( | ||
1031 | tz->trips.critical.temperature); | ||
1032 | return 0; | ||
1033 | } else | ||
1034 | return -EINVAL; | ||
1035 | } | ||
1036 | |||
1020 | typedef int (*cb)(struct thermal_zone_device *, int, | 1037 | typedef int (*cb)(struct thermal_zone_device *, int, |
1021 | struct thermal_cooling_device *); | 1038 | struct thermal_cooling_device *); |
1022 | static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, | 1039 | static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, |
@@ -1108,6 +1125,7 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = { | |||
1108 | .set_mode = thermal_set_mode, | 1125 | .set_mode = thermal_set_mode, |
1109 | .get_trip_type = thermal_get_trip_type, | 1126 | .get_trip_type = thermal_get_trip_type, |
1110 | .get_trip_temp = thermal_get_trip_temp, | 1127 | .get_trip_temp = thermal_get_trip_temp, |
1128 | .get_crit_temp = thermal_get_crit_temp, | ||
1111 | }; | 1129 | }; |
1112 | 1130 | ||
1113 | static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | 1131 | static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) |
@@ -1128,7 +1146,7 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) | |||
1128 | 1146 | ||
1129 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && | 1147 | for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && |
1130 | tz->trips.active[i].flags.valid; i++, trips++); | 1148 | tz->trips.active[i].flags.valid; i++, trips++); |
1131 | tz->thermal_zone = thermal_zone_device_register("ACPI thermal zone", | 1149 | tz->thermal_zone = thermal_zone_device_register("acpitz", |
1132 | trips, tz, &acpi_thermal_zone_ops); | 1150 | trips, tz, &acpi_thermal_zone_ops); |
1133 | if (IS_ERR(tz->thermal_zone)) | 1151 | if (IS_ERR(tz->thermal_zone)) |
1134 | return -ENODEV; | 1152 | return -ENODEV; |
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c index 6e56d5f7c43a..ede084829a70 100644 --- a/drivers/acpi/utilities/utalloc.c +++ b/drivers/acpi/utilities/utalloc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -147,7 +147,7 @@ acpi_status acpi_ut_delete_caches(void) | |||
147 | 147 | ||
148 | if (acpi_gbl_display_final_mem_stats) { | 148 | if (acpi_gbl_display_final_mem_stats) { |
149 | ACPI_STRCPY(buffer, "MEMORY"); | 149 | ACPI_STRCPY(buffer, "MEMORY"); |
150 | acpi_db_display_statistics(buffer); | 150 | (void)acpi_db_display_statistics(buffer); |
151 | } | 151 | } |
152 | #endif | 152 | #endif |
153 | 153 | ||
diff --git a/drivers/acpi/utilities/utcache.c b/drivers/acpi/utilities/utcache.c index 285a0f531760..245fa80cf600 100644 --- a/drivers/acpi/utilities/utcache.c +++ b/drivers/acpi/utilities/utcache.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c index 879eaa10d3ae..655c290aca7b 100644 --- a/drivers/acpi/utilities/utcopy.c +++ b/drivers/acpi/utilities/utcopy.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -43,6 +43,8 @@ | |||
43 | 43 | ||
44 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
45 | #include <acpi/amlcode.h> | 45 | #include <acpi/amlcode.h> |
46 | #include <acpi/acnamesp.h> | ||
47 | |||
46 | 48 | ||
47 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME("utcopy") | 50 | ACPI_MODULE_NAME("utcopy") |
@@ -172,22 +174,21 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, | |||
172 | 174 | ||
173 | case ACPI_TYPE_LOCAL_REFERENCE: | 175 | case ACPI_TYPE_LOCAL_REFERENCE: |
174 | 176 | ||
175 | /* | 177 | /* This is an object reference. */ |
176 | * This is an object reference. Attempt to dereference it. | 178 | |
177 | */ | ||
178 | switch (internal_object->reference.opcode) { | 179 | switch (internal_object->reference.opcode) { |
179 | case AML_INT_NAMEPATH_OP: | 180 | case AML_INT_NAMEPATH_OP: |
180 | 181 | ||
181 | /* For namepath, return the object handle ("reference") */ | 182 | /* For namepath, return the object handle ("reference") */ |
182 | 183 | ||
183 | default: | 184 | default: |
184 | /* | 185 | |
185 | * Use the object type of "Any" to indicate a reference | 186 | /* We are referring to the namespace node */ |
186 | * to object containing a handle to an ACPI named object. | 187 | |
187 | */ | ||
188 | external_object->type = ACPI_TYPE_ANY; | ||
189 | external_object->reference.handle = | 188 | external_object->reference.handle = |
190 | internal_object->reference.node; | 189 | internal_object->reference.node; |
190 | external_object->reference.actual_type = | ||
191 | acpi_ns_get_type(internal_object->reference.node); | ||
191 | break; | 192 | break; |
192 | } | 193 | } |
193 | break; | 194 | break; |
@@ -215,6 +216,11 @@ acpi_ut_copy_isimple_to_esimple(union acpi_operand_object *internal_object, | |||
215 | /* | 216 | /* |
216 | * There is no corresponding external object type | 217 | * There is no corresponding external object type |
217 | */ | 218 | */ |
219 | ACPI_ERROR((AE_INFO, | ||
220 | "Unsupported object type, cannot convert to external object: %s", | ||
221 | acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE | ||
222 | (internal_object)))); | ||
223 | |||
218 | return_ACPI_STATUS(AE_SUPPORT); | 224 | return_ACPI_STATUS(AE_SUPPORT); |
219 | } | 225 | } |
220 | 226 | ||
@@ -455,6 +461,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
455 | case ACPI_TYPE_STRING: | 461 | case ACPI_TYPE_STRING: |
456 | case ACPI_TYPE_BUFFER: | 462 | case ACPI_TYPE_BUFFER: |
457 | case ACPI_TYPE_INTEGER: | 463 | case ACPI_TYPE_INTEGER: |
464 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
458 | 465 | ||
459 | internal_object = acpi_ut_create_internal_object((u8) | 466 | internal_object = acpi_ut_create_internal_object((u8) |
460 | external_object-> | 467 | external_object-> |
@@ -464,9 +471,18 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
464 | } | 471 | } |
465 | break; | 472 | break; |
466 | 473 | ||
474 | case ACPI_TYPE_ANY: /* This is the case for a NULL object */ | ||
475 | |||
476 | *ret_internal_object = NULL; | ||
477 | return_ACPI_STATUS(AE_OK); | ||
478 | |||
467 | default: | 479 | default: |
468 | /* All other types are not supported */ | 480 | /* All other types are not supported */ |
469 | 481 | ||
482 | ACPI_ERROR((AE_INFO, | ||
483 | "Unsupported object type, cannot convert to internal object: %s", | ||
484 | acpi_ut_get_type_name(external_object->type))); | ||
485 | |||
470 | return_ACPI_STATUS(AE_SUPPORT); | 486 | return_ACPI_STATUS(AE_SUPPORT); |
471 | } | 487 | } |
472 | 488 | ||
@@ -502,6 +518,10 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
502 | external_object->buffer.length); | 518 | external_object->buffer.length); |
503 | 519 | ||
504 | internal_object->buffer.length = external_object->buffer.length; | 520 | internal_object->buffer.length = external_object->buffer.length; |
521 | |||
522 | /* Mark buffer data valid */ | ||
523 | |||
524 | internal_object->buffer.flags |= AOPOBJ_DATA_VALID; | ||
505 | break; | 525 | break; |
506 | 526 | ||
507 | case ACPI_TYPE_INTEGER: | 527 | case ACPI_TYPE_INTEGER: |
@@ -509,6 +529,15 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, | |||
509 | internal_object->integer.value = external_object->integer.value; | 529 | internal_object->integer.value = external_object->integer.value; |
510 | break; | 530 | break; |
511 | 531 | ||
532 | case ACPI_TYPE_LOCAL_REFERENCE: | ||
533 | |||
534 | /* TBD: should validate incoming handle */ | ||
535 | |||
536 | internal_object->reference.opcode = AML_INT_NAMEPATH_OP; | ||
537 | internal_object->reference.node = | ||
538 | external_object->reference.handle; | ||
539 | break; | ||
540 | |||
512 | default: | 541 | default: |
513 | /* Other types can't get here */ | 542 | /* Other types can't get here */ |
514 | break; | 543 | break; |
@@ -570,13 +599,17 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object, | |||
570 | 599 | ||
571 | /* Truncate package and delete it */ | 600 | /* Truncate package and delete it */ |
572 | 601 | ||
573 | package_object->package.count = i; | 602 | package_object->package.count = (u32) i; |
574 | package_elements[i] = NULL; | 603 | package_elements[i] = NULL; |
575 | acpi_ut_remove_reference(package_object); | 604 | acpi_ut_remove_reference(package_object); |
576 | return_ACPI_STATUS(status); | 605 | return_ACPI_STATUS(status); |
577 | } | 606 | } |
578 | } | 607 | } |
579 | 608 | ||
609 | /* Mark package data valid */ | ||
610 | |||
611 | package_object->package.flags |= AOPOBJ_DATA_VALID; | ||
612 | |||
580 | *internal_object = package_object; | 613 | *internal_object = package_object; |
581 | return_ACPI_STATUS(status); | 614 | return_ACPI_STATUS(status); |
582 | } | 615 | } |
@@ -709,7 +742,15 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc, | |||
709 | /* | 742 | /* |
710 | * We copied the reference object, so we now must add a reference | 743 | * We copied the reference object, so we now must add a reference |
711 | * to the object pointed to by the reference | 744 | * to the object pointed to by the reference |
745 | * | ||
746 | * DDBHandle reference (from Load/load_table is a special reference, | ||
747 | * it's Reference.Object is the table index, so does not need to | ||
748 | * increase the reference count | ||
712 | */ | 749 | */ |
750 | if (source_desc->reference.opcode == AML_LOAD_OP) { | ||
751 | break; | ||
752 | } | ||
753 | |||
713 | acpi_ut_add_reference(source_desc->reference.object); | 754 | acpi_ut_add_reference(source_desc->reference.object); |
714 | break; | 755 | break; |
715 | 756 | ||
diff --git a/drivers/acpi/utilities/utdebug.c b/drivers/acpi/utilities/utdebug.c index 7361204b1eef..f938f465efa4 100644 --- a/drivers/acpi/utilities/utdebug.c +++ b/drivers/acpi/utilities/utdebug.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -68,9 +68,9 @@ static const char *acpi_ut_trim_function_name(const char *function_name); | |||
68 | 68 | ||
69 | void acpi_ut_init_stack_ptr_trace(void) | 69 | void acpi_ut_init_stack_ptr_trace(void) |
70 | { | 70 | { |
71 | u32 current_sp; | 71 | acpi_size current_sp; |
72 | 72 | ||
73 | acpi_gbl_entry_stack_pointer = ACPI_PTR_DIFF(¤t_sp, NULL); | 73 | acpi_gbl_entry_stack_pointer = ¤t_sp; |
74 | } | 74 | } |
75 | 75 | ||
76 | /******************************************************************************* | 76 | /******************************************************************************* |
@@ -89,10 +89,8 @@ void acpi_ut_track_stack_ptr(void) | |||
89 | { | 89 | { |
90 | acpi_size current_sp; | 90 | acpi_size current_sp; |
91 | 91 | ||
92 | current_sp = ACPI_PTR_DIFF(¤t_sp, NULL); | 92 | if (¤t_sp < acpi_gbl_lowest_stack_pointer) { |
93 | 93 | acpi_gbl_lowest_stack_pointer = ¤t_sp; | |
94 | if (current_sp < acpi_gbl_lowest_stack_pointer) { | ||
95 | acpi_gbl_lowest_stack_pointer = current_sp; | ||
96 | } | 94 | } |
97 | 95 | ||
98 | if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) { | 96 | if (acpi_gbl_nesting_level > acpi_gbl_deepest_nesting) { |
@@ -203,6 +201,7 @@ acpi_ut_debug_print(u32 requested_debug_level, | |||
203 | 201 | ||
204 | va_start(args, format); | 202 | va_start(args, format); |
205 | acpi_os_vprintf(format, args); | 203 | acpi_os_vprintf(format, args); |
204 | va_end(args); | ||
206 | } | 205 | } |
207 | 206 | ||
208 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) | 207 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print) |
@@ -240,6 +239,7 @@ acpi_ut_debug_print_raw(u32 requested_debug_level, | |||
240 | 239 | ||
241 | va_start(args, format); | 240 | va_start(args, format); |
242 | acpi_os_vprintf(format, args); | 241 | acpi_os_vprintf(format, args); |
242 | va_end(args); | ||
243 | } | 243 | } |
244 | 244 | ||
245 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) | 245 | ACPI_EXPORT_SYMBOL(acpi_ut_debug_print_raw) |
@@ -524,6 +524,11 @@ void acpi_ut_dump_buffer2(u8 * buffer, u32 count, u32 display) | |||
524 | u32 temp32; | 524 | u32 temp32; |
525 | u8 buf_char; | 525 | u8 buf_char; |
526 | 526 | ||
527 | if (!buffer) { | ||
528 | acpi_os_printf("Null Buffer Pointer in DumpBuffer!\n"); | ||
529 | return; | ||
530 | } | ||
531 | |||
527 | if ((count < 4) || (count & 0x01)) { | 532 | if ((count < 4) || (count & 0x01)) { |
528 | display = DB_BYTE_DISPLAY; | 533 | display = DB_BYTE_DISPLAY; |
529 | } | 534 | } |
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index f777cebdc46d..1fbc35139e84 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -158,7 +158,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
158 | "***** Mutex %p, OS Mutex %p\n", | 158 | "***** Mutex %p, OS Mutex %p\n", |
159 | object, object->mutex.os_mutex)); | 159 | object, object->mutex.os_mutex)); |
160 | 160 | ||
161 | if (object->mutex.os_mutex == acpi_gbl_global_lock_mutex) { | 161 | if (object == acpi_gbl_global_lock_mutex) { |
162 | 162 | ||
163 | /* Global Lock has extra semaphore */ | 163 | /* Global Lock has extra semaphore */ |
164 | 164 | ||
@@ -252,6 +252,17 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) | |||
252 | } | 252 | } |
253 | break; | 253 | break; |
254 | 254 | ||
255 | case ACPI_TYPE_LOCAL_BANK_FIELD: | ||
256 | |||
257 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, | ||
258 | "***** Bank Field %p\n", object)); | ||
259 | |||
260 | second_desc = acpi_ns_get_secondary_object(object); | ||
261 | if (second_desc) { | ||
262 | acpi_ut_delete_object_desc(second_desc); | ||
263 | } | ||
264 | break; | ||
265 | |||
255 | default: | 266 | default: |
256 | break; | 267 | break; |
257 | } | 268 | } |
@@ -524,10 +535,12 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) | |||
524 | 535 | ||
525 | case ACPI_TYPE_LOCAL_REFERENCE: | 536 | case ACPI_TYPE_LOCAL_REFERENCE: |
526 | /* | 537 | /* |
527 | * The target of an Index (a package, string, or buffer) must track | 538 | * The target of an Index (a package, string, or buffer) or a named |
528 | * changes to the ref count of the index. | 539 | * reference must track changes to the ref count of the index or |
540 | * target object. | ||
529 | */ | 541 | */ |
530 | if (object->reference.opcode == AML_INDEX_OP) { | 542 | if ((object->reference.opcode == AML_INDEX_OP) || |
543 | (object->reference.opcode == AML_INT_NAMEPATH_OP)) { | ||
531 | next_object = object->reference.object; | 544 | next_object = object->reference.object; |
532 | } | 545 | } |
533 | break; | 546 | break; |
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index 0042b7e78b26..05e61be267d5 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c index 630c9a2c5b7b..a6e71b801d2d 100644 --- a/drivers/acpi/utilities/utglobal.c +++ b/drivers/acpi/utilities/utglobal.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -602,6 +602,48 @@ char *acpi_ut_get_mutex_name(u32 mutex_id) | |||
602 | 602 | ||
603 | return (acpi_gbl_mutex_names[mutex_id]); | 603 | return (acpi_gbl_mutex_names[mutex_id]); |
604 | } | 604 | } |
605 | |||
606 | /******************************************************************************* | ||
607 | * | ||
608 | * FUNCTION: acpi_ut_get_notify_name | ||
609 | * | ||
610 | * PARAMETERS: notify_value - Value from the Notify() request | ||
611 | * | ||
612 | * RETURN: String corresponding to the Notify Value. | ||
613 | * | ||
614 | * DESCRIPTION: Translate a Notify Value to a notify namestring. | ||
615 | * | ||
616 | ******************************************************************************/ | ||
617 | |||
618 | /* Names for Notify() values, used for debug output */ | ||
619 | |||
620 | static const char *acpi_gbl_notify_value_names[] = { | ||
621 | "Bus Check", | ||
622 | "Device Check", | ||
623 | "Device Wake", | ||
624 | "Eject Request", | ||
625 | "Device Check Light", | ||
626 | "Frequency Mismatch", | ||
627 | "Bus Mode Mismatch", | ||
628 | "Power Fault", | ||
629 | "Capabilities Check", | ||
630 | "Device PLD Check", | ||
631 | "Reserved", | ||
632 | "System Locality Update" | ||
633 | }; | ||
634 | |||
635 | const char *acpi_ut_get_notify_name(u32 notify_value) | ||
636 | { | ||
637 | |||
638 | if (notify_value <= ACPI_NOTIFY_MAX) { | ||
639 | return (acpi_gbl_notify_value_names[notify_value]); | ||
640 | } else if (notify_value <= ACPI_MAX_SYS_NOTIFY) { | ||
641 | return ("Reserved"); | ||
642 | } else { /* Greater or equal to 0x80 */ | ||
643 | |||
644 | return ("**Device Specific**"); | ||
645 | } | ||
646 | } | ||
605 | #endif | 647 | #endif |
606 | 648 | ||
607 | /******************************************************************************* | 649 | /******************************************************************************* |
@@ -675,12 +717,13 @@ void acpi_ut_init_globals(void) | |||
675 | acpi_gbl_gpe_fadt_blocks[0] = NULL; | 717 | acpi_gbl_gpe_fadt_blocks[0] = NULL; |
676 | acpi_gbl_gpe_fadt_blocks[1] = NULL; | 718 | acpi_gbl_gpe_fadt_blocks[1] = NULL; |
677 | 719 | ||
678 | /* Global notify handlers */ | 720 | /* Global handlers */ |
679 | 721 | ||
680 | acpi_gbl_system_notify.handler = NULL; | 722 | acpi_gbl_system_notify.handler = NULL; |
681 | acpi_gbl_device_notify.handler = NULL; | 723 | acpi_gbl_device_notify.handler = NULL; |
682 | acpi_gbl_exception_handler = NULL; | 724 | acpi_gbl_exception_handler = NULL; |
683 | acpi_gbl_init_handler = NULL; | 725 | acpi_gbl_init_handler = NULL; |
726 | acpi_gbl_table_handler = NULL; | ||
684 | 727 | ||
685 | /* Global Lock support */ | 728 | /* Global Lock support */ |
686 | 729 | ||
@@ -722,7 +765,7 @@ void acpi_ut_init_globals(void) | |||
722 | acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST; | 765 | acpi_gbl_root_node_struct.flags = ANOBJ_END_OF_PEER_LIST; |
723 | 766 | ||
724 | #ifdef ACPI_DEBUG_OUTPUT | 767 | #ifdef ACPI_DEBUG_OUTPUT |
725 | acpi_gbl_lowest_stack_pointer = ACPI_SIZE_MAX; | 768 | acpi_gbl_lowest_stack_pointer = ACPI_CAST_PTR(acpi_size, ACPI_SIZE_MAX); |
726 | #endif | 769 | #endif |
727 | 770 | ||
728 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS | 771 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c index ad3c0d0a5cf8..cae515fc02d3 100644 --- a/drivers/acpi/utilities/utinit.c +++ b/drivers/acpi/utilities/utinit.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -125,9 +125,12 @@ void acpi_ut_subsystem_shutdown(void) | |||
125 | acpi_gbl_startup_flags = 0; | 125 | acpi_gbl_startup_flags = 0; |
126 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); | 126 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); |
127 | 127 | ||
128 | #ifndef ACPI_ASL_COMPILER | ||
129 | |||
128 | /* Close the acpi_event Handling */ | 130 | /* Close the acpi_event Handling */ |
129 | 131 | ||
130 | acpi_ev_terminate(); | 132 | acpi_ev_terminate(); |
133 | #endif | ||
131 | 134 | ||
132 | /* Close the Namespace */ | 135 | /* Close the Namespace */ |
133 | 136 | ||
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c index 0c56a0d20b29..c927324fdd26 100644 --- a/drivers/acpi/utilities/utmath.c +++ b/drivers/acpi/utilities/utmath.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -276,7 +276,7 @@ acpi_ut_short_divide(acpi_integer in_dividend, | |||
276 | *out_quotient = in_dividend / divisor; | 276 | *out_quotient = in_dividend / divisor; |
277 | } | 277 | } |
278 | if (out_remainder) { | 278 | if (out_remainder) { |
279 | *out_remainder = (u32) in_dividend % divisor; | 279 | *out_remainder = (u32) (in_dividend % divisor); |
280 | } | 280 | } |
281 | 281 | ||
282 | return_ACPI_STATUS(AE_OK); | 282 | return_ACPI_STATUS(AE_OK); |
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c index 2d19f71e9cfa..e4ba7192cd15 100644 --- a/drivers/acpi/utilities/utmisc.c +++ b/drivers/acpi/utilities/utmisc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -1033,6 +1033,7 @@ acpi_ut_error(char *module_name, u32 line_number, char *format, ...) | |||
1033 | va_start(args, format); | 1033 | va_start(args, format); |
1034 | acpi_os_vprintf(format, args); | 1034 | acpi_os_vprintf(format, args); |
1035 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); | 1035 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); |
1036 | va_end(args); | ||
1036 | } | 1037 | } |
1037 | 1038 | ||
1038 | void ACPI_INTERNAL_VAR_XFACE | 1039 | void ACPI_INTERNAL_VAR_XFACE |
@@ -1061,6 +1062,8 @@ acpi_ut_warning(char *module_name, u32 line_number, char *format, ...) | |||
1061 | va_start(args, format); | 1062 | va_start(args, format); |
1062 | acpi_os_vprintf(format, args); | 1063 | acpi_os_vprintf(format, args); |
1063 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); | 1064 | acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); |
1065 | va_end(args); | ||
1066 | va_end(args); | ||
1064 | } | 1067 | } |
1065 | 1068 | ||
1066 | void ACPI_INTERNAL_VAR_XFACE | 1069 | void ACPI_INTERNAL_VAR_XFACE |
@@ -1077,4 +1080,5 @@ acpi_ut_info(char *module_name, u32 line_number, char *format, ...) | |||
1077 | va_start(args, format); | 1080 | va_start(args, format); |
1078 | acpi_os_vprintf(format, args); | 1081 | acpi_os_vprintf(format, args); |
1079 | acpi_os_printf("\n"); | 1082 | acpi_os_printf("\n"); |
1083 | va_end(args); | ||
1080 | } | 1084 | } |
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c index 4820bc86d1f5..f7d602b1a894 100644 --- a/drivers/acpi/utilities/utmutex.c +++ b/drivers/acpi/utilities/utmutex.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c index e08b3fa6639f..e68466de8044 100644 --- a/drivers/acpi/utilities/utobject.c +++ b/drivers/acpi/utilities/utobject.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -107,6 +107,7 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(char *module_name, | |||
107 | switch (type) { | 107 | switch (type) { |
108 | case ACPI_TYPE_REGION: | 108 | case ACPI_TYPE_REGION: |
109 | case ACPI_TYPE_BUFFER_FIELD: | 109 | case ACPI_TYPE_BUFFER_FIELD: |
110 | case ACPI_TYPE_LOCAL_BANK_FIELD: | ||
110 | 111 | ||
111 | /* These types require a secondary object */ | 112 | /* These types require a secondary object */ |
112 | 113 | ||
@@ -469,9 +470,8 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, | |||
469 | case ACPI_TYPE_PROCESSOR: | 470 | case ACPI_TYPE_PROCESSOR: |
470 | case ACPI_TYPE_POWER: | 471 | case ACPI_TYPE_POWER: |
471 | 472 | ||
472 | /* | 473 | /* No extra data for these types */ |
473 | * No extra data for these types | 474 | |
474 | */ | ||
475 | break; | 475 | break; |
476 | 476 | ||
477 | case ACPI_TYPE_LOCAL_REFERENCE: | 477 | case ACPI_TYPE_LOCAL_REFERENCE: |
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c index b630ee137ee1..c3e3e1308edc 100644 --- a/drivers/acpi/utilities/utresrc.c +++ b/drivers/acpi/utilities/utresrc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index edcaafad0a31..63a6d3d77d88 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c | |||
@@ -5,7 +5,7 @@ | |||
5 | ******************************************************************************/ | 5 | ******************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c index 2d496918b3cd..f8bdadf3c32f 100644 --- a/drivers/acpi/utilities/utxface.c +++ b/drivers/acpi/utilities/utxface.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2007, R. Byron Moore | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
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 |
@@ -49,6 +49,7 @@ | |||
49 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
50 | ACPI_MODULE_NAME("utxface") | 50 | ACPI_MODULE_NAME("utxface") |
51 | 51 | ||
52 | #ifndef ACPI_ASL_COMPILER | ||
52 | /******************************************************************************* | 53 | /******************************************************************************* |
53 | * | 54 | * |
54 | * FUNCTION: acpi_initialize_subsystem | 55 | * FUNCTION: acpi_initialize_subsystem |
@@ -192,24 +193,6 @@ acpi_status acpi_enable_subsystem(u32 flags) | |||
192 | } | 193 | } |
193 | } | 194 | } |
194 | 195 | ||
195 | /* | ||
196 | * Complete the GPE initialization for the GPE blocks defined in the FADT | ||
197 | * (GPE block 0 and 1). | ||
198 | * | ||
199 | * Note1: This is where the _PRW methods are executed for the GPEs. These | ||
200 | * methods can only be executed after the SCI and Global Lock handlers are | ||
201 | * installed and initialized. | ||
202 | * | ||
203 | * Note2: Currently, there seems to be no need to run the _REG methods | ||
204 | * before execution of the _PRW methods and enabling of the GPEs. | ||
205 | */ | ||
206 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
207 | status = acpi_ev_install_fadt_gpes(); | ||
208 | if (ACPI_FAILURE(status)) { | ||
209 | return (status); | ||
210 | } | ||
211 | } | ||
212 | |||
213 | return_ACPI_STATUS(status); | 196 | return_ACPI_STATUS(status); |
214 | } | 197 | } |
215 | 198 | ||
@@ -280,6 +263,23 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
280 | } | 263 | } |
281 | 264 | ||
282 | /* | 265 | /* |
266 | * Complete the GPE initialization for the GPE blocks defined in the FADT | ||
267 | * (GPE block 0 and 1). | ||
268 | * | ||
269 | * Note1: This is where the _PRW methods are executed for the GPEs. These | ||
270 | * methods can only be executed after the SCI and Global Lock handlers are | ||
271 | * installed and initialized. | ||
272 | * | ||
273 | * Note2: Currently, there seems to be no need to run the _REG methods | ||
274 | * before execution of the _PRW methods and enabling of the GPEs. | ||
275 | */ | ||
276 | if (!(flags & ACPI_NO_EVENT_INIT)) { | ||
277 | status = acpi_ev_install_fadt_gpes(); | ||
278 | if (ACPI_FAILURE(status)) | ||
279 | return (status); | ||
280 | } | ||
281 | |||
282 | /* | ||
283 | * Empty the caches (delete the cached objects) on the assumption that | 283 | * Empty the caches (delete the cached objects) on the assumption that |
284 | * the table load filled them up more than they will be at runtime -- | 284 | * the table load filled them up more than they will be at runtime -- |
285 | * thus wasting non-paged memory. | 285 | * thus wasting non-paged memory. |
@@ -292,6 +292,7 @@ acpi_status acpi_initialize_objects(u32 flags) | |||
292 | 292 | ||
293 | ACPI_EXPORT_SYMBOL(acpi_initialize_objects) | 293 | ACPI_EXPORT_SYMBOL(acpi_initialize_objects) |
294 | 294 | ||
295 | #endif | ||
295 | /******************************************************************************* | 296 | /******************************************************************************* |
296 | * | 297 | * |
297 | * FUNCTION: acpi_terminate | 298 | * FUNCTION: acpi_terminate |
@@ -335,6 +336,7 @@ acpi_status acpi_terminate(void) | |||
335 | } | 336 | } |
336 | 337 | ||
337 | ACPI_EXPORT_SYMBOL(acpi_terminate) | 338 | ACPI_EXPORT_SYMBOL(acpi_terminate) |
339 | #ifndef ACPI_ASL_COMPILER | ||
338 | #ifdef ACPI_FUTURE_USAGE | 340 | #ifdef ACPI_FUTURE_USAGE |
339 | /******************************************************************************* | 341 | /******************************************************************************* |
340 | * | 342 | * |
@@ -490,3 +492,4 @@ acpi_status acpi_purge_cached_objects(void) | |||
490 | } | 492 | } |
491 | 493 | ||
492 | ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) | 494 | ACPI_EXPORT_SYMBOL(acpi_purge_cached_objects) |
495 | #endif | ||
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 44ea60cf21c0..100926143818 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -398,7 +398,7 @@ acpi_evaluate_reference(acpi_handle handle, | |||
398 | 398 | ||
399 | element = &(package->package.elements[i]); | 399 | element = &(package->package.elements[i]); |
400 | 400 | ||
401 | if (element->type != ACPI_TYPE_ANY) { | 401 | if (element->type != ACPI_TYPE_LOCAL_REFERENCE) { |
402 | status = AE_BAD_DATA; | 402 | status = AE_BAD_DATA; |
403 | printk(KERN_ERR PREFIX | 403 | printk(KERN_ERR PREFIX |
404 | "Expecting a [Reference] package element, found type %X\n", | 404 | "Expecting a [Reference] package element, found type %X\n", |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 43b228314a86..f7eb12e55602 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -57,8 +57,6 @@ | |||
57 | #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88 | 57 | #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88 |
58 | #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89 | 58 | #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89 |
59 | 59 | ||
60 | #define ACPI_VIDEO_HEAD_INVALID (~0u - 1) | ||
61 | #define ACPI_VIDEO_HEAD_END (~0u) | ||
62 | #define MAX_NAME_LEN 20 | 60 | #define MAX_NAME_LEN 20 |
63 | 61 | ||
64 | #define ACPI_VIDEO_DISPLAY_CRT 1 | 62 | #define ACPI_VIDEO_DISPLAY_CRT 1 |
@@ -743,21 +741,19 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
743 | if (IS_ERR(device->cdev)) | 741 | if (IS_ERR(device->cdev)) |
744 | return; | 742 | return; |
745 | 743 | ||
746 | if (device->cdev) { | 744 | printk(KERN_INFO PREFIX |
747 | printk(KERN_INFO PREFIX | 745 | "%s is registered as cooling_device%d\n", |
748 | "%s is registered as cooling_device%d\n", | 746 | device->dev->dev.bus_id, device->cdev->id); |
749 | device->dev->dev.bus_id, device->cdev->id); | 747 | result = sysfs_create_link(&device->dev->dev.kobj, |
750 | result = sysfs_create_link(&device->dev->dev.kobj, | 748 | &device->cdev->device.kobj, |
751 | &device->cdev->device.kobj, | 749 | "thermal_cooling"); |
752 | "thermal_cooling"); | 750 | if (result) |
753 | if (result) | 751 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
754 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | 752 | result = sysfs_create_link(&device->cdev->device.kobj, |
755 | result = sysfs_create_link(&device->cdev->device.kobj, | 753 | &device->dev->dev.kobj, "device"); |
756 | &device->dev->dev.kobj, | 754 | if (result) |
757 | "device"); | 755 | printk(KERN_ERR PREFIX "Create sysfs link\n"); |
758 | if (result) | 756 | |
759 | printk(KERN_ERR PREFIX "Create sysfs link\n"); | ||
760 | } | ||
761 | } | 757 | } |
762 | if (device->cap._DCS && device->cap._DSS){ | 758 | if (device->cap._DCS && device->cap._DSS){ |
763 | static int count = 0; | 759 | static int count = 0; |
@@ -1059,30 +1055,25 @@ acpi_video_device_EDID_open_fs(struct inode *inode, struct file *file) | |||
1059 | 1055 | ||
1060 | static int acpi_video_device_add_fs(struct acpi_device *device) | 1056 | static int acpi_video_device_add_fs(struct acpi_device *device) |
1061 | { | 1057 | { |
1062 | struct proc_dir_entry *entry = NULL; | 1058 | struct proc_dir_entry *entry, *device_dir; |
1063 | struct acpi_video_device *vid_dev; | 1059 | struct acpi_video_device *vid_dev; |
1064 | 1060 | ||
1065 | |||
1066 | if (!device) | ||
1067 | return -ENODEV; | ||
1068 | |||
1069 | vid_dev = acpi_driver_data(device); | 1061 | vid_dev = acpi_driver_data(device); |
1070 | if (!vid_dev) | 1062 | if (!vid_dev) |
1071 | return -ENODEV; | 1063 | return -ENODEV; |
1072 | 1064 | ||
1073 | if (!acpi_device_dir(device)) { | 1065 | device_dir = proc_mkdir(acpi_device_bid(device), |
1074 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 1066 | vid_dev->video->dir); |
1075 | vid_dev->video->dir); | 1067 | if (!device_dir) |
1076 | if (!acpi_device_dir(device)) | 1068 | return -ENOMEM; |
1077 | return -ENODEV; | 1069 | |
1078 | acpi_device_dir(device)->owner = THIS_MODULE; | 1070 | device_dir->owner = THIS_MODULE; |
1079 | } | ||
1080 | 1071 | ||
1081 | /* 'info' [R] */ | 1072 | /* 'info' [R] */ |
1082 | entry = proc_create_data("info", S_IRUGO, acpi_device_dir(device), | 1073 | entry = proc_create_data("info", S_IRUGO, acpi_device_dir(device), |
1083 | &acpi_video_device_info_fops, acpi_driver_data(device)); | 1074 | &acpi_video_device_info_fops, acpi_driver_data(device)); |
1084 | if (!entry) | 1075 | if (!entry) |
1085 | return -ENODEV; | 1076 | goto err_remove_dir; |
1086 | 1077 | ||
1087 | /* 'state' [R/W] */ | 1078 | /* 'state' [R/W] */ |
1088 | acpi_video_device_state_fops.write = acpi_video_device_write_state; | 1079 | acpi_video_device_state_fops.write = acpi_video_device_write_state; |
@@ -1091,7 +1082,7 @@ static int acpi_video_device_add_fs(struct acpi_device *device) | |||
1091 | &acpi_video_device_state_fops, | 1082 | &acpi_video_device_state_fops, |
1092 | acpi_driver_data(device)); | 1083 | acpi_driver_data(device)); |
1093 | if (!entry) | 1084 | if (!entry) |
1094 | return -ENODEV; | 1085 | goto err_remove_info; |
1095 | 1086 | ||
1096 | /* 'brightness' [R/W] */ | 1087 | /* 'brightness' [R/W] */ |
1097 | acpi_video_device_brightness_fops.write = | 1088 | acpi_video_device_brightness_fops.write = |
@@ -1101,30 +1092,43 @@ static int acpi_video_device_add_fs(struct acpi_device *device) | |||
1101 | &acpi_video_device_brightness_fops, | 1092 | &acpi_video_device_brightness_fops, |
1102 | acpi_driver_data(device)); | 1093 | acpi_driver_data(device)); |
1103 | if (!entry) | 1094 | if (!entry) |
1104 | return -ENODEV; | 1095 | goto err_remove_state; |
1105 | 1096 | ||
1106 | /* 'EDID' [R] */ | 1097 | /* 'EDID' [R] */ |
1107 | entry = proc_create_data("EDID", S_IRUGO, acpi_device_dir(device), | 1098 | entry = proc_create_data("EDID", S_IRUGO, acpi_device_dir(device), |
1108 | &acpi_video_device_EDID_fops, | 1099 | &acpi_video_device_EDID_fops, |
1109 | acpi_driver_data(device)); | 1100 | acpi_driver_data(device)); |
1110 | if (!entry) | 1101 | if (!entry) |
1111 | return -ENODEV; | 1102 | goto err_remove_brightness; |
1103 | |||
1112 | return 0; | 1104 | return 0; |
1105 | |||
1106 | err_remove_brightness: | ||
1107 | remove_proc_entry("brightness", device_dir); | ||
1108 | err_remove_state: | ||
1109 | remove_proc_entry("state", device_dir); | ||
1110 | err_remove_info: | ||
1111 | remove_proc_entry("info", device_dir); | ||
1112 | err_remove_dir: | ||
1113 | remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); | ||
1114 | return -ENOMEM; | ||
1113 | } | 1115 | } |
1114 | 1116 | ||
1115 | static int acpi_video_device_remove_fs(struct acpi_device *device) | 1117 | static int acpi_video_device_remove_fs(struct acpi_device *device) |
1116 | { | 1118 | { |
1117 | struct acpi_video_device *vid_dev; | 1119 | struct acpi_video_device *vid_dev; |
1120 | struct proc_dir_entry *device_dir; | ||
1118 | 1121 | ||
1119 | vid_dev = acpi_driver_data(device); | 1122 | vid_dev = acpi_driver_data(device); |
1120 | if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) | 1123 | if (!vid_dev || !vid_dev->video || !vid_dev->video->dir) |
1121 | return -ENODEV; | 1124 | return -ENODEV; |
1122 | 1125 | ||
1123 | if (acpi_device_dir(device)) { | 1126 | device_dir = acpi_device_dir(device); |
1124 | remove_proc_entry("info", acpi_device_dir(device)); | 1127 | if (device_dir) { |
1125 | remove_proc_entry("state", acpi_device_dir(device)); | 1128 | remove_proc_entry("info", device_dir); |
1126 | remove_proc_entry("brightness", acpi_device_dir(device)); | 1129 | remove_proc_entry("state", device_dir); |
1127 | remove_proc_entry("EDID", acpi_device_dir(device)); | 1130 | remove_proc_entry("brightness", device_dir); |
1131 | remove_proc_entry("EDID", device_dir); | ||
1128 | remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); | 1132 | remove_proc_entry(acpi_device_bid(device), vid_dev->video->dir); |
1129 | acpi_device_dir(device) = NULL; | 1133 | acpi_device_dir(device) = NULL; |
1130 | } | 1134 | } |
@@ -1331,76 +1335,81 @@ acpi_video_bus_write_DOS(struct file *file, | |||
1331 | 1335 | ||
1332 | static int acpi_video_bus_add_fs(struct acpi_device *device) | 1336 | static int acpi_video_bus_add_fs(struct acpi_device *device) |
1333 | { | 1337 | { |
1334 | struct proc_dir_entry *entry = NULL; | 1338 | struct acpi_video_bus *video = acpi_driver_data(device); |
1335 | struct acpi_video_bus *video; | 1339 | struct proc_dir_entry *device_dir; |
1340 | struct proc_dir_entry *entry; | ||
1336 | 1341 | ||
1342 | device_dir = proc_mkdir(acpi_device_bid(device), acpi_video_dir); | ||
1343 | if (!device_dir) | ||
1344 | return -ENOMEM; | ||
1337 | 1345 | ||
1338 | video = acpi_driver_data(device); | 1346 | device_dir->owner = THIS_MODULE; |
1339 | |||
1340 | if (!acpi_device_dir(device)) { | ||
1341 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | ||
1342 | acpi_video_dir); | ||
1343 | if (!acpi_device_dir(device)) | ||
1344 | return -ENODEV; | ||
1345 | video->dir = acpi_device_dir(device); | ||
1346 | acpi_device_dir(device)->owner = THIS_MODULE; | ||
1347 | } | ||
1348 | 1347 | ||
1349 | /* 'info' [R] */ | 1348 | /* 'info' [R] */ |
1350 | entry = proc_create_data("info", S_IRUGO, acpi_device_dir(device), | 1349 | entry = proc_create_data("info", S_IRUGO, acpi_device_dir(device), |
1351 | &acpi_video_bus_info_fops, | 1350 | &acpi_video_bus_info_fops, |
1352 | acpi_driver_data(device)); | 1351 | acpi_driver_data(device)); |
1353 | if (!entry) | 1352 | if (!entry) |
1354 | return -ENODEV; | 1353 | goto err_remove_dir; |
1355 | 1354 | ||
1356 | /* 'ROM' [R] */ | 1355 | /* 'ROM' [R] */ |
1357 | entry = proc_create_data("ROM", S_IRUGO, acpi_device_dir(device), | 1356 | entry = proc_create_data("ROM", S_IRUGO, acpi_device_dir(device), |
1358 | &acpi_video_bus_ROM_fops, | 1357 | &acpi_video_bus_ROM_fops, |
1359 | acpi_driver_data(device)); | 1358 | acpi_driver_data(device)); |
1360 | if (!entry) | 1359 | if (!entry) |
1361 | return -ENODEV; | 1360 | goto err_remove_info; |
1362 | 1361 | ||
1363 | /* 'POST_info' [R] */ | 1362 | /* 'POST_info' [R] */ |
1364 | entry = proc_create_data("POST_info", S_IRUGO, acpi_device_dir(device), | 1363 | entry = proc_create_data("POST_info", S_IRUGO, acpi_device_dir(device), |
1365 | &acpi_video_bus_POST_info_fops, | 1364 | &acpi_video_bus_POST_info_fops, |
1366 | acpi_driver_data(device)); | 1365 | acpi_driver_data(device)); |
1367 | if (!entry) | 1366 | if (!entry) |
1368 | return -ENODEV; | 1367 | goto err_remove_rom; |
1369 | 1368 | ||
1370 | /* 'POST' [R/W] */ | 1369 | /* 'POST' [R/W] */ |
1371 | acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; | 1370 | acpi_video_bus_POST_fops.write = acpi_video_bus_write_POST; |
1372 | entry = proc_create_data("POST", S_IFREG | S_IRUGO | S_IRUSR, | 1371 | entry = proc_create_data("POST", S_IFREG | S_IRUGO | S_IWUSR, |
1373 | acpi_device_dir(device), | 1372 | acpi_device_dir(device), |
1374 | &acpi_video_bus_POST_fops, | 1373 | &acpi_video_bus_POST_fops, |
1375 | acpi_driver_data(device)); | 1374 | acpi_driver_data(device)); |
1376 | if (!entry) | 1375 | if (!entry) |
1377 | return -ENODEV; | 1376 | goto err_remove_post_info; |
1378 | 1377 | ||
1379 | /* 'DOS' [R/W] */ | 1378 | /* 'DOS' [R/W] */ |
1380 | acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; | 1379 | acpi_video_bus_DOS_fops.write = acpi_video_bus_write_DOS; |
1381 | entry = proc_create_data("DOS", S_IFREG | S_IRUGO | S_IRUSR, | 1380 | entry = proc_create_data("DOS", S_IFREG | S_IRUGO | S_IWUSR, |
1382 | acpi_device_dir(device), | 1381 | acpi_device_dir(device), |
1383 | &acpi_video_bus_DOS_fops, | 1382 | &acpi_video_bus_DOS_fops, |
1384 | acpi_driver_data(device)); | 1383 | acpi_driver_data(device)); |
1385 | if (!entry) | 1384 | if (!entry) |
1386 | return -ENODEV; | 1385 | goto err_remove_post; |
1387 | 1386 | ||
1387 | video->dir = acpi_device_dir(device) = device_dir; | ||
1388 | return 0; | 1388 | return 0; |
1389 | |||
1390 | err_remove_post: | ||
1391 | remove_proc_entry("POST", device_dir); | ||
1392 | err_remove_post_info: | ||
1393 | remove_proc_entry("POST_info", device_dir); | ||
1394 | err_remove_rom: | ||
1395 | remove_proc_entry("ROM", device_dir); | ||
1396 | err_remove_info: | ||
1397 | remove_proc_entry("info", device_dir); | ||
1398 | err_remove_dir: | ||
1399 | remove_proc_entry(acpi_device_bid(device), acpi_video_dir); | ||
1400 | return -ENOMEM; | ||
1389 | } | 1401 | } |
1390 | 1402 | ||
1391 | static int acpi_video_bus_remove_fs(struct acpi_device *device) | 1403 | static int acpi_video_bus_remove_fs(struct acpi_device *device) |
1392 | { | 1404 | { |
1393 | struct acpi_video_bus *video; | 1405 | struct proc_dir_entry *device_dir = acpi_device_dir(device); |
1394 | |||
1395 | 1406 | ||
1396 | video = acpi_driver_data(device); | 1407 | if (device_dir) { |
1397 | 1408 | remove_proc_entry("info", device_dir); | |
1398 | if (acpi_device_dir(device)) { | 1409 | remove_proc_entry("ROM", device_dir); |
1399 | remove_proc_entry("info", acpi_device_dir(device)); | 1410 | remove_proc_entry("POST_info", device_dir); |
1400 | remove_proc_entry("ROM", acpi_device_dir(device)); | 1411 | remove_proc_entry("POST", device_dir); |
1401 | remove_proc_entry("POST_info", acpi_device_dir(device)); | 1412 | remove_proc_entry("DOS", device_dir); |
1402 | remove_proc_entry("POST", acpi_device_dir(device)); | ||
1403 | remove_proc_entry("DOS", acpi_device_dir(device)); | ||
1404 | remove_proc_entry(acpi_device_bid(device), acpi_video_dir); | 1413 | remove_proc_entry(acpi_device_bid(device), acpi_video_dir); |
1405 | acpi_device_dir(device) = NULL; | 1414 | acpi_device_dir(device) = NULL; |
1406 | } | 1415 | } |
@@ -1416,11 +1425,15 @@ static int acpi_video_bus_remove_fs(struct acpi_device *device) | |||
1416 | static struct acpi_video_device_attrib* | 1425 | static struct acpi_video_device_attrib* |
1417 | acpi_video_get_device_attr(struct acpi_video_bus *video, unsigned long device_id) | 1426 | acpi_video_get_device_attr(struct acpi_video_bus *video, unsigned long device_id) |
1418 | { | 1427 | { |
1419 | int count; | 1428 | struct acpi_video_enumerated_device *ids; |
1429 | int i; | ||
1430 | |||
1431 | for (i = 0; i < video->attached_count; i++) { | ||
1432 | ids = &video->attached_array[i]; | ||
1433 | if ((ids->value.int_val & 0xffff) == device_id) | ||
1434 | return &ids->value.attrib; | ||
1435 | } | ||
1420 | 1436 | ||
1421 | for(count = 0; count < video->attached_count; count++) | ||
1422 | if((video->attached_array[count].value.int_val & 0xffff) == device_id) | ||
1423 | return &(video->attached_array[count].value.attrib); | ||
1424 | return NULL; | 1437 | return NULL; |
1425 | } | 1438 | } |
1426 | 1439 | ||
@@ -1547,20 +1560,16 @@ static void | |||
1547 | acpi_video_device_bind(struct acpi_video_bus *video, | 1560 | acpi_video_device_bind(struct acpi_video_bus *video, |
1548 | struct acpi_video_device *device) | 1561 | struct acpi_video_device *device) |
1549 | { | 1562 | { |
1563 | struct acpi_video_enumerated_device *ids; | ||
1550 | int i; | 1564 | int i; |
1551 | 1565 | ||
1552 | #define IDS_VAL(i) video->attached_array[i].value.int_val | 1566 | for (i = 0; i < video->attached_count; i++) { |
1553 | #define IDS_BIND(i) video->attached_array[i].bind_info | 1567 | ids = &video->attached_array[i]; |
1554 | 1568 | if (device->device_id == (ids->value.int_val & 0xffff)) { | |
1555 | for (i = 0; IDS_VAL(i) != ACPI_VIDEO_HEAD_INVALID && | 1569 | ids->bind_info = device; |
1556 | i < video->attached_count; i++) { | ||
1557 | if (device->device_id == (IDS_VAL(i) & 0xffff)) { | ||
1558 | IDS_BIND(i) = device; | ||
1559 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i)); | 1570 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "device_bind %d\n", i)); |
1560 | } | 1571 | } |
1561 | } | 1572 | } |
1562 | #undef IDS_VAL | ||
1563 | #undef IDS_BIND | ||
1564 | } | 1573 | } |
1565 | 1574 | ||
1566 | /* | 1575 | /* |
@@ -1579,7 +1588,7 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
1579 | int status; | 1588 | int status; |
1580 | int count; | 1589 | int count; |
1581 | int i; | 1590 | int i; |
1582 | struct acpi_video_enumerated_device *active_device_list; | 1591 | struct acpi_video_enumerated_device *active_list; |
1583 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 1592 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
1584 | union acpi_object *dod = NULL; | 1593 | union acpi_object *dod = NULL; |
1585 | union acpi_object *obj; | 1594 | union acpi_object *obj; |
@@ -1600,13 +1609,10 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
1600 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n", | 1609 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d video heads in _DOD\n", |
1601 | dod->package.count)); | 1610 | dod->package.count)); |
1602 | 1611 | ||
1603 | active_device_list = kmalloc((1 + | 1612 | active_list = kcalloc(1 + dod->package.count, |
1604 | dod->package.count) * | 1613 | sizeof(struct acpi_video_enumerated_device), |
1605 | sizeof(struct | 1614 | GFP_KERNEL); |
1606 | acpi_video_enumerated_device), | 1615 | if (!active_list) { |
1607 | GFP_KERNEL); | ||
1608 | |||
1609 | if (!active_device_list) { | ||
1610 | status = -ENOMEM; | 1616 | status = -ENOMEM; |
1611 | goto out; | 1617 | goto out; |
1612 | } | 1618 | } |
@@ -1616,23 +1622,24 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
1616 | obj = &dod->package.elements[i]; | 1622 | obj = &dod->package.elements[i]; |
1617 | 1623 | ||
1618 | if (obj->type != ACPI_TYPE_INTEGER) { | 1624 | if (obj->type != ACPI_TYPE_INTEGER) { |
1619 | printk(KERN_ERR PREFIX "Invalid _DOD data\n"); | 1625 | printk(KERN_ERR PREFIX |
1620 | active_device_list[i].value.int_val = | 1626 | "Invalid _DOD data in element %d\n", i); |
1621 | ACPI_VIDEO_HEAD_INVALID; | 1627 | continue; |
1622 | } | 1628 | } |
1623 | active_device_list[i].value.int_val = obj->integer.value; | 1629 | |
1624 | active_device_list[i].bind_info = NULL; | 1630 | active_list[count].value.int_val = obj->integer.value; |
1631 | active_list[count].bind_info = NULL; | ||
1625 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i, | 1632 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "dod element[%d] = %d\n", i, |
1626 | (int)obj->integer.value)); | 1633 | (int)obj->integer.value)); |
1627 | count++; | 1634 | count++; |
1628 | } | 1635 | } |
1629 | active_device_list[count].value.int_val = ACPI_VIDEO_HEAD_END; | ||
1630 | 1636 | ||
1631 | kfree(video->attached_array); | 1637 | kfree(video->attached_array); |
1632 | 1638 | ||
1633 | video->attached_array = active_device_list; | 1639 | video->attached_array = active_list; |
1634 | video->attached_count = count; | 1640 | video->attached_count = count; |
1635 | out: | 1641 | |
1642 | out: | ||
1636 | kfree(buffer.pointer); | 1643 | kfree(buffer.pointer); |
1637 | return status; | 1644 | return status; |
1638 | } | 1645 | } |