diff options
author | Robert Moore <robert.moore@intel.com> | 2005-04-18 22:49:35 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-07-12 00:08:52 -0400 |
commit | 44f6c01242da4e162f28d8e1216a8c7a91174605 (patch) | |
tree | 53f724764f1bd9036dfb049a643d198125cc9edc /drivers/acpi/dispatcher/dswstate.c | |
parent | ebb6e1a6122fd6b7c96470cfd4ce0f04150e5084 (diff) |
ACPICA 20050408 from Bob Moore
Fixed three cases in the interpreter where an "index"
argument to an ASL function was still (internally) 32
bits instead of the required 64 bits. This was the Index
argument to the Index, Mid, and Match operators.
The "strupr" function is now permanently local
(acpi_ut_strupr), since this is not a POSIX-defined
function and not present in most kernel-level C
libraries. References to the C library strupr function
have been removed from the headers.
Completed the deployment of static
functions/prototypes. All prototypes with the static
attribute have been moved from the headers to the owning
C file.
ACPICA 20050329 from Bob Moore
An error is now generated if an attempt is made to create
a Buffer Field of length zero (A CreateField with a length
operand of zero.)
The interpreter now issues a warning whenever executable
code at the module level is detected during ACPI table
load. This will give some idea of the prevalence of this
type of code.
Implemented support for references to named objects (other
than control methods) within package objects.
Enhanced package object output for the debug
object. Package objects are now completely dumped, showing
all elements.
Enhanced miscellaneous object output for the debug
object. Any object can now be written to the debug object
(for example, a device object can be written, and the type
of the object will be displayed.)
The "static" qualifier has been added to all local
functions across the core subsystem.
The number of "long" lines (> 80 chars) within the source
has been significantly reduced, by about 1/3.
Cleaned up all header files to ensure that all CA/iASL
functions are prototyped (even static functions) and the
formatting is consistent.
Two new header files have been added, acopcode.h and
acnames.h.
Removed several obsolete functions that were no longer
used.
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/dispatcher/dswstate.c')
-rw-r--r-- | drivers/acpi/dispatcher/dswstate.c | 458 |
1 files changed, 244 insertions, 214 deletions
diff --git a/drivers/acpi/dispatcher/dswstate.c b/drivers/acpi/dispatcher/dswstate.c index e555b3fbd5e5..9cd3db652b31 100644 --- a/drivers/acpi/dispatcher/dswstate.c +++ b/drivers/acpi/dispatcher/dswstate.c | |||
@@ -50,67 +50,31 @@ | |||
50 | #define _COMPONENT ACPI_DISPATCHER | 50 | #define _COMPONENT ACPI_DISPATCHER |
51 | ACPI_MODULE_NAME ("dswstate") | 51 | ACPI_MODULE_NAME ("dswstate") |
52 | 52 | ||
53 | /* Local prototypes */ | ||
53 | 54 | ||
54 | #ifdef ACPI_FUTURE_USAGE | 55 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
55 | |||
56 | /******************************************************************************* | ||
57 | * | ||
58 | * FUNCTION: acpi_ds_result_insert | ||
59 | * | ||
60 | * PARAMETERS: Object - Object to push | ||
61 | * Index - Where to insert the object | ||
62 | * walk_state - Current Walk state | ||
63 | * | ||
64 | * RETURN: Status | ||
65 | * | ||
66 | * DESCRIPTION: Insert an object onto this walk's result stack | ||
67 | * | ||
68 | ******************************************************************************/ | ||
69 | |||
70 | acpi_status | 56 | acpi_status |
71 | acpi_ds_result_insert ( | 57 | acpi_ds_result_insert ( |
72 | void *object, | 58 | void *object, |
73 | u32 index, | 59 | u32 index, |
74 | struct acpi_walk_state *walk_state) | 60 | struct acpi_walk_state *walk_state); |
75 | { | ||
76 | union acpi_generic_state *state; | ||
77 | |||
78 | 61 | ||
79 | ACPI_FUNCTION_NAME ("ds_result_insert"); | 62 | acpi_status |
80 | 63 | acpi_ds_obj_stack_delete_all ( | |
81 | 64 | struct acpi_walk_state *walk_state); | |
82 | state = walk_state->results; | ||
83 | if (!state) { | ||
84 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", | ||
85 | walk_state)); | ||
86 | return (AE_NOT_EXIST); | ||
87 | } | ||
88 | |||
89 | if (index >= ACPI_OBJ_NUM_OPERANDS) { | ||
90 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
91 | "Index out of range: %X Obj=%p State=%p Num=%X\n", | ||
92 | index, object, walk_state, state->results.num_results)); | ||
93 | return (AE_BAD_PARAMETER); | ||
94 | } | ||
95 | |||
96 | if (!object) { | ||
97 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
98 | "Null Object! Index=%X Obj=%p State=%p Num=%X\n", | ||
99 | index, object, walk_state, state->results.num_results)); | ||
100 | return (AE_BAD_PARAMETER); | ||
101 | } | ||
102 | |||
103 | state->results.obj_desc [index] = object; | ||
104 | state->results.num_results++; | ||
105 | 65 | ||
106 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | 66 | acpi_status |
107 | "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | 67 | acpi_ds_obj_stack_pop_object ( |
108 | object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", | 68 | union acpi_operand_object **object, |
109 | walk_state, state->results.num_results, walk_state->current_result)); | 69 | struct acpi_walk_state *walk_state); |
110 | 70 | ||
111 | return (AE_OK); | 71 | void * |
112 | } | 72 | acpi_ds_obj_stack_get_value ( |
73 | u32 index, | ||
74 | struct acpi_walk_state *walk_state); | ||
75 | #endif | ||
113 | 76 | ||
77 | #ifdef ACPI_FUTURE_USAGE | ||
114 | 78 | ||
115 | /******************************************************************************* | 79 | /******************************************************************************* |
116 | * | 80 | * |
@@ -178,7 +142,6 @@ acpi_ds_result_remove ( | |||
178 | 142 | ||
179 | #endif /* ACPI_FUTURE_USAGE */ | 143 | #endif /* ACPI_FUTURE_USAGE */ |
180 | 144 | ||
181 | |||
182 | /******************************************************************************* | 145 | /******************************************************************************* |
183 | * | 146 | * |
184 | * FUNCTION: acpi_ds_result_pop | 147 | * FUNCTION: acpi_ds_result_pop |
@@ -227,15 +190,18 @@ acpi_ds_result_pop ( | |||
227 | *object = state->results.obj_desc [index -1]; | 190 | *object = state->results.obj_desc [index -1]; |
228 | state->results.obj_desc [index -1] = NULL; | 191 | state->results.obj_desc [index -1] = NULL; |
229 | 192 | ||
230 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n", | 193 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, |
231 | *object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", | 194 | "Obj=%p [%s] Index=%X State=%p Num=%X\n", |
195 | *object, | ||
196 | (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", | ||
232 | (u32) index -1, walk_state, state->results.num_results)); | 197 | (u32) index -1, walk_state, state->results.num_results)); |
233 | 198 | ||
234 | return (AE_OK); | 199 | return (AE_OK); |
235 | } | 200 | } |
236 | } | 201 | } |
237 | 202 | ||
238 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); | 203 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
204 | "No result objects! State=%p\n", walk_state)); | ||
239 | return (AE_AML_NO_RETURN_VALUE); | 205 | return (AE_AML_NO_RETURN_VALUE); |
240 | } | 206 | } |
241 | 207 | ||
@@ -274,7 +240,8 @@ acpi_ds_result_pop_from_bottom ( | |||
274 | } | 240 | } |
275 | 241 | ||
276 | if (!state->results.num_results) { | 242 | if (!state->results.num_results) { |
277 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); | 243 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", |
244 | walk_state)); | ||
278 | return (AE_AML_NO_RETURN_VALUE); | 245 | return (AE_AML_NO_RETURN_VALUE); |
279 | } | 246 | } |
280 | 247 | ||
@@ -293,7 +260,8 @@ acpi_ds_result_pop_from_bottom ( | |||
293 | /* Check for a valid result object */ | 260 | /* Check for a valid result object */ |
294 | 261 | ||
295 | if (!*object) { | 262 | if (!*object) { |
296 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n", | 263 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
264 | "Null operand! State=%p #Ops=%X, Index=%X\n", | ||
297 | walk_state, state->results.num_results, (u32) index)); | 265 | walk_state, state->results.num_results, (u32) index)); |
298 | return (AE_AML_NO_RETURN_VALUE); | 266 | return (AE_AML_NO_RETURN_VALUE); |
299 | } | 267 | } |
@@ -344,7 +312,8 @@ acpi_ds_result_push ( | |||
344 | } | 312 | } |
345 | 313 | ||
346 | if (!object) { | 314 | if (!object) { |
347 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n", | 315 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
316 | "Null Object! Obj=%p State=%p Num=%X\n", | ||
348 | object, walk_state, state->results.num_results)); | 317 | object, walk_state, state->results.num_results)); |
349 | return (AE_BAD_PARAMETER); | 318 | return (AE_BAD_PARAMETER); |
350 | } | 319 | } |
@@ -439,43 +408,6 @@ acpi_ds_result_stack_pop ( | |||
439 | 408 | ||
440 | /******************************************************************************* | 409 | /******************************************************************************* |
441 | * | 410 | * |
442 | * FUNCTION: acpi_ds_obj_stack_delete_all | ||
443 | * | ||
444 | * PARAMETERS: walk_state - Current Walk state | ||
445 | * | ||
446 | * RETURN: Status | ||
447 | * | ||
448 | * DESCRIPTION: Clear the object stack by deleting all objects that are on it. | ||
449 | * Should be used with great care, if at all! | ||
450 | * | ||
451 | ******************************************************************************/ | ||
452 | #ifdef ACPI_FUTURE_USAGE | ||
453 | acpi_status | ||
454 | acpi_ds_obj_stack_delete_all ( | ||
455 | struct acpi_walk_state *walk_state) | ||
456 | { | ||
457 | u32 i; | ||
458 | |||
459 | |||
460 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state); | ||
461 | |||
462 | |||
463 | /* The stack size is configurable, but fixed */ | ||
464 | |||
465 | for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { | ||
466 | if (walk_state->operands[i]) { | ||
467 | acpi_ut_remove_reference (walk_state->operands[i]); | ||
468 | walk_state->operands[i] = NULL; | ||
469 | } | ||
470 | } | ||
471 | |||
472 | return_ACPI_STATUS (AE_OK); | ||
473 | } | ||
474 | #endif /* ACPI_FUTURE_USAGE */ | ||
475 | |||
476 | |||
477 | /******************************************************************************* | ||
478 | * | ||
479 | * FUNCTION: acpi_ds_obj_stack_push | 411 | * FUNCTION: acpi_ds_obj_stack_push |
480 | * | 412 | * |
481 | * PARAMETERS: Object - Object to push | 413 | * PARAMETERS: Object - Object to push |
@@ -517,67 +449,6 @@ acpi_ds_obj_stack_push ( | |||
517 | } | 449 | } |
518 | 450 | ||
519 | 451 | ||
520 | #if 0 | ||
521 | /******************************************************************************* | ||
522 | * | ||
523 | * FUNCTION: acpi_ds_obj_stack_pop_object | ||
524 | * | ||
525 | * PARAMETERS: pop_count - Number of objects/entries to pop | ||
526 | * walk_state - Current Walk state | ||
527 | * | ||
528 | * RETURN: Status | ||
529 | * | ||
530 | * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT | ||
531 | * deleted by this routine. | ||
532 | * | ||
533 | ******************************************************************************/ | ||
534 | |||
535 | acpi_status | ||
536 | acpi_ds_obj_stack_pop_object ( | ||
537 | union acpi_operand_object **object, | ||
538 | struct acpi_walk_state *walk_state) | ||
539 | { | ||
540 | ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object"); | ||
541 | |||
542 | |||
543 | /* Check for stack underflow */ | ||
544 | |||
545 | if (walk_state->num_operands == 0) { | ||
546 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
547 | "Missing operand/stack empty! State=%p #Ops=%X\n", | ||
548 | walk_state, walk_state->num_operands)); | ||
549 | *object = NULL; | ||
550 | return (AE_AML_NO_OPERAND); | ||
551 | } | ||
552 | |||
553 | /* Pop the stack */ | ||
554 | |||
555 | walk_state->num_operands--; | ||
556 | |||
557 | /* Check for a valid operand */ | ||
558 | |||
559 | if (!walk_state->operands [walk_state->num_operands]) { | ||
560 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
561 | "Null operand! State=%p #Ops=%X\n", | ||
562 | walk_state, walk_state->num_operands)); | ||
563 | *object = NULL; | ||
564 | return (AE_AML_NO_OPERAND); | ||
565 | } | ||
566 | |||
567 | /* Get operand and set stack entry to null */ | ||
568 | |||
569 | *object = walk_state->operands [walk_state->num_operands]; | ||
570 | walk_state->operands [walk_state->num_operands] = NULL; | ||
571 | |||
572 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | ||
573 | *object, acpi_ut_get_object_type_name (*object), | ||
574 | walk_state, walk_state->num_operands)); | ||
575 | |||
576 | return (AE_OK); | ||
577 | } | ||
578 | #endif | ||
579 | |||
580 | |||
581 | /******************************************************************************* | 452 | /******************************************************************************* |
582 | * | 453 | * |
583 | * FUNCTION: acpi_ds_obj_stack_pop | 454 | * FUNCTION: acpi_ds_obj_stack_pop |
@@ -680,48 +551,6 @@ acpi_ds_obj_stack_pop_and_delete ( | |||
680 | 551 | ||
681 | /******************************************************************************* | 552 | /******************************************************************************* |
682 | * | 553 | * |
683 | * FUNCTION: acpi_ds_obj_stack_get_value | ||
684 | * | ||
685 | * PARAMETERS: Index - Stack index whose value is desired. Based | ||
686 | * on the top of the stack (index=0 == top) | ||
687 | * walk_state - Current Walk state | ||
688 | * | ||
689 | * RETURN: Status | ||
690 | * | ||
691 | * DESCRIPTION: Retrieve an object from this walk's object stack. Index must | ||
692 | * be within the range of the current stack pointer. | ||
693 | * | ||
694 | ******************************************************************************/ | ||
695 | #ifdef ACPI_FUTURE_USAGE | ||
696 | void * | ||
697 | acpi_ds_obj_stack_get_value ( | ||
698 | u32 index, | ||
699 | struct acpi_walk_state *walk_state) | ||
700 | { | ||
701 | |||
702 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state); | ||
703 | |||
704 | |||
705 | /* Can't do it if the stack is empty */ | ||
706 | |||
707 | if (walk_state->num_operands == 0) { | ||
708 | return_PTR (NULL); | ||
709 | } | ||
710 | |||
711 | /* or if the index is past the top of the stack */ | ||
712 | |||
713 | if (index > (walk_state->num_operands - (u32) 1)) { | ||
714 | return_PTR (NULL); | ||
715 | } | ||
716 | |||
717 | return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) - | ||
718 | index]); | ||
719 | } | ||
720 | #endif /* ACPI_FUTURE_USAGE */ | ||
721 | |||
722 | |||
723 | /******************************************************************************* | ||
724 | * | ||
725 | * FUNCTION: acpi_ds_get_current_walk_state | 554 | * FUNCTION: acpi_ds_get_current_walk_state |
726 | * | 555 | * |
727 | * PARAMETERS: Thread - Get current active state for this Thread | 556 | * PARAMETERS: Thread - Get current active state for this Thread |
@@ -757,11 +586,11 @@ acpi_ds_get_current_walk_state ( | |||
757 | * FUNCTION: acpi_ds_push_walk_state | 586 | * FUNCTION: acpi_ds_push_walk_state |
758 | * | 587 | * |
759 | * PARAMETERS: walk_state - State to push | 588 | * PARAMETERS: walk_state - State to push |
760 | * walk_list - The list that owns the walk stack | 589 | * Thread - Thread state object |
761 | * | 590 | * |
762 | * RETURN: None | 591 | * RETURN: None |
763 | * | 592 | * |
764 | * DESCRIPTION: Place the walk_state at the head of the state list. | 593 | * DESCRIPTION: Place the Thread state at the head of the state list. |
765 | * | 594 | * |
766 | ******************************************************************************/ | 595 | ******************************************************************************/ |
767 | 596 | ||
@@ -784,9 +613,9 @@ acpi_ds_push_walk_state ( | |||
784 | * | 613 | * |
785 | * FUNCTION: acpi_ds_pop_walk_state | 614 | * FUNCTION: acpi_ds_pop_walk_state |
786 | * | 615 | * |
787 | * PARAMETERS: walk_list - The list that owns the walk stack | 616 | * PARAMETERS: Thread - Current thread state |
788 | * | 617 | * |
789 | * RETURN: A walk_state object popped from the stack | 618 | * RETURN: A walk_state object popped from the thread's stack |
790 | * | 619 | * |
791 | * DESCRIPTION: Remove and return the walkstate object that is at the head of | 620 | * DESCRIPTION: Remove and return the walkstate object that is at the head of |
792 | * the walk stack for the given walk list. NULL indicates that | 621 | * the walk stack for the given walk list. NULL indicates that |
@@ -814,7 +643,7 @@ acpi_ds_pop_walk_state ( | |||
814 | /* | 643 | /* |
815 | * Don't clear the NEXT field, this serves as an indicator | 644 | * Don't clear the NEXT field, this serves as an indicator |
816 | * that there is a parent WALK STATE | 645 | * that there is a parent WALK STATE |
817 | * NO: walk_state->Next = NULL; | 646 | * Do Not: walk_state->Next = NULL; |
818 | */ | 647 | */ |
819 | } | 648 | } |
820 | 649 | ||
@@ -826,7 +655,9 @@ acpi_ds_pop_walk_state ( | |||
826 | * | 655 | * |
827 | * FUNCTION: acpi_ds_create_walk_state | 656 | * FUNCTION: acpi_ds_create_walk_state |
828 | * | 657 | * |
829 | * PARAMETERS: Origin - Starting point for this walk | 658 | * PARAMETERS: owner_id - ID for object creation |
659 | * Origin - Starting point for this walk | ||
660 | * mth_desc - Method object | ||
830 | * Thread - Current thread state | 661 | * Thread - Current thread state |
831 | * | 662 | * |
832 | * RETURN: Pointer to the new walk state. | 663 | * RETURN: Pointer to the new walk state. |
@@ -896,8 +727,7 @@ acpi_ds_create_walk_state ( | |||
896 | * method_node - Control method NS node, if any | 727 | * method_node - Control method NS node, if any |
897 | * aml_start - Start of AML | 728 | * aml_start - Start of AML |
898 | * aml_length - Length of AML | 729 | * aml_length - Length of AML |
899 | * Params - Method args, if any | 730 | * Info - Method info block (params, etc.) |
900 | * return_obj_desc - Where to store a return object, if any | ||
901 | * pass_number - 1, 2, or 3 | 731 | * pass_number - 1, 2, or 3 |
902 | * | 732 | * |
903 | * RETURN: Status | 733 | * RETURN: Status |
@@ -931,7 +761,7 @@ acpi_ds_init_aml_walk ( | |||
931 | 761 | ||
932 | /* The next_op of the next_walk will be the beginning of the method */ | 762 | /* The next_op of the next_walk will be the beginning of the method */ |
933 | 763 | ||
934 | walk_state->next_op = NULL; | 764 | walk_state->next_op = NULL; |
935 | 765 | ||
936 | if (info) { | 766 | if (info) { |
937 | if (info->parameter_type == ACPI_PARAM_GPE) { | 767 | if (info->parameter_type == ACPI_PARAM_GPE) { |
@@ -939,8 +769,8 @@ acpi_ds_init_aml_walk ( | |||
939 | info->parameters); | 769 | info->parameters); |
940 | } | 770 | } |
941 | else { | 771 | else { |
942 | walk_state->params = info->parameters; | 772 | walk_state->params = info->parameters; |
943 | walk_state->caller_return_desc = &info->return_object; | 773 | walk_state->caller_return_desc = &info->return_object; |
944 | } | 774 | } |
945 | } | 775 | } |
946 | 776 | ||
@@ -964,7 +794,8 @@ acpi_ds_init_aml_walk ( | |||
964 | 794 | ||
965 | /* Init the method arguments */ | 795 | /* Init the method arguments */ |
966 | 796 | ||
967 | status = acpi_ds_method_data_init_args (walk_state->params, ACPI_METHOD_NUM_ARGS, walk_state); | 797 | status = acpi_ds_method_data_init_args (walk_state->params, |
798 | ACPI_METHOD_NUM_ARGS, walk_state); | ||
968 | if (ACPI_FAILURE (status)) { | 799 | if (ACPI_FAILURE (status)) { |
969 | return_ACPI_STATUS (status); | 800 | return_ACPI_STATUS (status); |
970 | } | 801 | } |
@@ -1031,12 +862,14 @@ acpi_ds_delete_walk_state ( | |||
1031 | } | 862 | } |
1032 | 863 | ||
1033 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { | 864 | if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { |
1034 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", walk_state)); | 865 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", |
866 | walk_state)); | ||
1035 | return; | 867 | return; |
1036 | } | 868 | } |
1037 | 869 | ||
1038 | if (walk_state->parser_state.scope) { | 870 | if (walk_state->parser_state.scope) { |
1039 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state)); | 871 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", |
872 | walk_state)); | ||
1040 | } | 873 | } |
1041 | 874 | ||
1042 | /* Always must free any linked control states */ | 875 | /* Always must free any linked control states */ |
@@ -1078,7 +911,7 @@ acpi_ds_delete_walk_state ( | |||
1078 | * | 911 | * |
1079 | * PARAMETERS: None | 912 | * PARAMETERS: None |
1080 | * | 913 | * |
1081 | * RETURN: Status | 914 | * RETURN: None |
1082 | * | 915 | * |
1083 | * DESCRIPTION: Purge the global state object cache. Used during subsystem | 916 | * DESCRIPTION: Purge the global state object cache. Used during subsystem |
1084 | * termination. | 917 | * termination. |
@@ -1098,3 +931,200 @@ acpi_ds_delete_walk_state_cache ( | |||
1098 | #endif | 931 | #endif |
1099 | 932 | ||
1100 | 933 | ||
934 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
935 | /******************************************************************************* | ||
936 | * | ||
937 | * FUNCTION: acpi_ds_result_insert | ||
938 | * | ||
939 | * PARAMETERS: Object - Object to push | ||
940 | * Index - Where to insert the object | ||
941 | * walk_state - Current Walk state | ||
942 | * | ||
943 | * RETURN: Status | ||
944 | * | ||
945 | * DESCRIPTION: Insert an object onto this walk's result stack | ||
946 | * | ||
947 | ******************************************************************************/ | ||
948 | |||
949 | acpi_status | ||
950 | acpi_ds_result_insert ( | ||
951 | void *object, | ||
952 | u32 index, | ||
953 | struct acpi_walk_state *walk_state) | ||
954 | { | ||
955 | union acpi_generic_state *state; | ||
956 | |||
957 | |||
958 | ACPI_FUNCTION_NAME ("ds_result_insert"); | ||
959 | |||
960 | |||
961 | state = walk_state->results; | ||
962 | if (!state) { | ||
963 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n", | ||
964 | walk_state)); | ||
965 | return (AE_NOT_EXIST); | ||
966 | } | ||
967 | |||
968 | if (index >= ACPI_OBJ_NUM_OPERANDS) { | ||
969 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
970 | "Index out of range: %X Obj=%p State=%p Num=%X\n", | ||
971 | index, object, walk_state, state->results.num_results)); | ||
972 | return (AE_BAD_PARAMETER); | ||
973 | } | ||
974 | |||
975 | if (!object) { | ||
976 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
977 | "Null Object! Index=%X Obj=%p State=%p Num=%X\n", | ||
978 | index, object, walk_state, state->results.num_results)); | ||
979 | return (AE_BAD_PARAMETER); | ||
980 | } | ||
981 | |||
982 | state->results.obj_desc [index] = object; | ||
983 | state->results.num_results++; | ||
984 | |||
985 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, | ||
986 | "Obj=%p [%s] State=%p Num=%X Cur=%X\n", | ||
987 | object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL", | ||
988 | walk_state, state->results.num_results, walk_state->current_result)); | ||
989 | |||
990 | return (AE_OK); | ||
991 | } | ||
992 | |||
993 | |||
994 | /******************************************************************************* | ||
995 | * | ||
996 | * FUNCTION: acpi_ds_obj_stack_delete_all | ||
997 | * | ||
998 | * PARAMETERS: walk_state - Current Walk state | ||
999 | * | ||
1000 | * RETURN: Status | ||
1001 | * | ||
1002 | * DESCRIPTION: Clear the object stack by deleting all objects that are on it. | ||
1003 | * Should be used with great care, if at all! | ||
1004 | * | ||
1005 | ******************************************************************************/ | ||
1006 | |||
1007 | acpi_status | ||
1008 | acpi_ds_obj_stack_delete_all ( | ||
1009 | struct acpi_walk_state *walk_state) | ||
1010 | { | ||
1011 | u32 i; | ||
1012 | |||
1013 | |||
1014 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state); | ||
1015 | |||
1016 | |||
1017 | /* The stack size is configurable, but fixed */ | ||
1018 | |||
1019 | for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) { | ||
1020 | if (walk_state->operands[i]) { | ||
1021 | acpi_ut_remove_reference (walk_state->operands[i]); | ||
1022 | walk_state->operands[i] = NULL; | ||
1023 | } | ||
1024 | } | ||
1025 | |||
1026 | return_ACPI_STATUS (AE_OK); | ||
1027 | } | ||
1028 | |||
1029 | |||
1030 | /******************************************************************************* | ||
1031 | * | ||
1032 | * FUNCTION: acpi_ds_obj_stack_pop_object | ||
1033 | * | ||
1034 | * PARAMETERS: Object - Where to return the popped object | ||
1035 | * walk_state - Current Walk state | ||
1036 | * | ||
1037 | * RETURN: Status | ||
1038 | * | ||
1039 | * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT | ||
1040 | * deleted by this routine. | ||
1041 | * | ||
1042 | ******************************************************************************/ | ||
1043 | |||
1044 | acpi_status | ||
1045 | acpi_ds_obj_stack_pop_object ( | ||
1046 | union acpi_operand_object **object, | ||
1047 | struct acpi_walk_state *walk_state) | ||
1048 | { | ||
1049 | ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object"); | ||
1050 | |||
1051 | |||
1052 | /* Check for stack underflow */ | ||
1053 | |||
1054 | if (walk_state->num_operands == 0) { | ||
1055 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
1056 | "Missing operand/stack empty! State=%p #Ops=%X\n", | ||
1057 | walk_state, walk_state->num_operands)); | ||
1058 | *object = NULL; | ||
1059 | return (AE_AML_NO_OPERAND); | ||
1060 | } | ||
1061 | |||
1062 | /* Pop the stack */ | ||
1063 | |||
1064 | walk_state->num_operands--; | ||
1065 | |||
1066 | /* Check for a valid operand */ | ||
1067 | |||
1068 | if (!walk_state->operands [walk_state->num_operands]) { | ||
1069 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | ||
1070 | "Null operand! State=%p #Ops=%X\n", | ||
1071 | walk_state, walk_state->num_operands)); | ||
1072 | *object = NULL; | ||
1073 | return (AE_AML_NO_OPERAND); | ||
1074 | } | ||
1075 | |||
1076 | /* Get operand and set stack entry to null */ | ||
1077 | |||
1078 | *object = walk_state->operands [walk_state->num_operands]; | ||
1079 | walk_state->operands [walk_state->num_operands] = NULL; | ||
1080 | |||
1081 | ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", | ||
1082 | *object, acpi_ut_get_object_type_name (*object), | ||
1083 | walk_state, walk_state->num_operands)); | ||
1084 | |||
1085 | return (AE_OK); | ||
1086 | } | ||
1087 | |||
1088 | |||
1089 | /******************************************************************************* | ||
1090 | * | ||
1091 | * FUNCTION: acpi_ds_obj_stack_get_value | ||
1092 | * | ||
1093 | * PARAMETERS: Index - Stack index whose value is desired. Based | ||
1094 | * on the top of the stack (index=0 == top) | ||
1095 | * walk_state - Current Walk state | ||
1096 | * | ||
1097 | * RETURN: Pointer to the requested operand | ||
1098 | * | ||
1099 | * DESCRIPTION: Retrieve an object from this walk's operand stack. Index must | ||
1100 | * be within the range of the current stack pointer. | ||
1101 | * | ||
1102 | ******************************************************************************/ | ||
1103 | |||
1104 | void * | ||
1105 | acpi_ds_obj_stack_get_value ( | ||
1106 | u32 index, | ||
1107 | struct acpi_walk_state *walk_state) | ||
1108 | { | ||
1109 | |||
1110 | ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state); | ||
1111 | |||
1112 | |||
1113 | /* Can't do it if the stack is empty */ | ||
1114 | |||
1115 | if (walk_state->num_operands == 0) { | ||
1116 | return_PTR (NULL); | ||
1117 | } | ||
1118 | |||
1119 | /* or if the index is past the top of the stack */ | ||
1120 | |||
1121 | if (index > (walk_state->num_operands - (u32) 1)) { | ||
1122 | return_PTR (NULL); | ||
1123 | } | ||
1124 | |||
1125 | return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) - | ||
1126 | index]); | ||
1127 | } | ||
1128 | #endif | ||
1129 | |||
1130 | |||