^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Module Name: dswstate - Dispatcher parse tree walk management routines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (C) 2000 - 2020, Intel Corp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *****************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <acpi/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include "accommon.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "acparser.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "acdispat.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include "acnamesp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define _COMPONENT ACPI_DISPATCHER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) ACPI_MODULE_NAME("dswstate")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) /* Local prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) acpi_ds_result_stack_push(struct acpi_walk_state *walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * FUNCTION: acpi_ds_result_pop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * PARAMETERS: object - Where to return the popped object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) * walk_state - Current Walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * DESCRIPTION: Pop an object off the top of this walk's result stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) acpi_ds_result_pop(union acpi_operand_object **object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) u32 index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) union acpi_generic_state *state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ACPI_FUNCTION_NAME(ds_result_pop);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) state = walk_state->results;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* Incorrect state of result stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) if (state && !walk_state->result_count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) ACPI_ERROR((AE_INFO, "No results on result stack"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) return (AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) if (!state && walk_state->result_count) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) ACPI_ERROR((AE_INFO, "No result state for result stack"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) return (AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) /* Empty result stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) if (!state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) ACPI_ERROR((AE_INFO, "Result stack is empty! State=%p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) return (AE_AML_NO_RETURN_VALUE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) /* Return object of the top element and clean that top element result stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) walk_state->result_count--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) index = (u32)walk_state->result_count % ACPI_RESULTS_FRAME_OBJ_NUM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) *object = state->results.obj_desc[index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) if (!*object) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) "No result objects on result stack, State=%p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) return (AE_AML_NO_RETURN_VALUE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) state->results.obj_desc[index] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) if (index == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) status = acpi_ds_result_stack_pop(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) "Obj=%p [%s] Index=%X State=%p Num=%X\n", *object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) acpi_ut_get_object_type_name(*object),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) index, walk_state, walk_state->result_count));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * FUNCTION: acpi_ds_result_push
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * PARAMETERS: object - Where to return the popped object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * walk_state - Current Walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * DESCRIPTION: Push an object onto the current result stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) acpi_ds_result_push(union acpi_operand_object *object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) union acpi_generic_state *state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) u32 index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) ACPI_FUNCTION_NAME(ds_result_push);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) if (walk_state->result_count > walk_state->result_size) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) ACPI_ERROR((AE_INFO, "Result stack is full"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) return (AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) } else if (walk_state->result_count == walk_state->result_size) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) /* Extend the result stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) status = acpi_ds_result_stack_push(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) "Failed to extend the result stack"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) return (status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) if (!(walk_state->result_count < walk_state->result_size)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) ACPI_ERROR((AE_INFO, "No free elements in result stack"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) return (AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) state = walk_state->results;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) if (!state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) ACPI_ERROR((AE_INFO, "No result stack frame during push"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) return (AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) if (!object) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) "Null Object! Obj=%p State=%p Num=%u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) object, walk_state, walk_state->result_count));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) return (AE_BAD_PARAMETER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /* Assign the address of object to the top free element of result stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) index = (u32)walk_state->result_count % ACPI_RESULTS_FRAME_OBJ_NUM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) state->results.obj_desc[index] = object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) walk_state->result_count++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) acpi_ut_get_object_type_name((union
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) acpi_operand_object *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) object), walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) walk_state->result_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) walk_state->current_result));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) * FUNCTION: acpi_ds_result_stack_push
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) * PARAMETERS: walk_state - Current Walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * DESCRIPTION: Push an object onto the walk_state result stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) union acpi_generic_state *state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) ACPI_FUNCTION_NAME(ds_result_stack_push);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) /* Check for stack overflow */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) if (((u32) walk_state->result_size + ACPI_RESULTS_FRAME_OBJ_NUM) >
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) ACPI_RESULTS_OBJ_NUM_MAX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) ACPI_ERROR((AE_INFO, "Result stack overflow: State=%p Num=%u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) walk_state, walk_state->result_size));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) return (AE_STACK_OVERFLOW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) state = acpi_ut_create_generic_state();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) if (!state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) return (AE_NO_MEMORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) state->common.descriptor_type = ACPI_DESC_TYPE_STATE_RESULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) acpi_ut_push_generic_state(&walk_state->results, state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) /* Increase the length of the result stack by the length of frame */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) walk_state->result_size += ACPI_RESULTS_FRAME_OBJ_NUM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Results=%p State=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) state, walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * FUNCTION: acpi_ds_result_stack_pop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) * PARAMETERS: walk_state - Current Walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) * DESCRIPTION: Pop an object off of the walk_state result stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) union acpi_generic_state *state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) ACPI_FUNCTION_NAME(ds_result_stack_pop);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) /* Check for stack underflow */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) if (walk_state->results == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) "Result stack underflow - State=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) return (AE_AML_NO_OPERAND);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) if (walk_state->result_size < ACPI_RESULTS_FRAME_OBJ_NUM) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) ACPI_ERROR((AE_INFO, "Insufficient result stack size"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) return (AE_AML_INTERNAL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) state = acpi_ut_pop_generic_state(&walk_state->results);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) acpi_ut_delete_generic_state(state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /* Decrease the length of result stack by the length of frame */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) walk_state->result_size -= ACPI_RESULTS_FRAME_OBJ_NUM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) "Result=%p RemainingResults=%X State=%p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) state, walk_state->result_count, walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) * FUNCTION: acpi_ds_obj_stack_push
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) * PARAMETERS: object - Object to push
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) * walk_state - Current Walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) * DESCRIPTION: Push an object onto this walk's object/operand stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) ACPI_FUNCTION_NAME(ds_obj_stack_push);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) /* Check for stack overflow */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) "Object stack overflow! Obj=%p State=%p #Ops=%u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) object, walk_state, walk_state->num_operands));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) return (AE_STACK_OVERFLOW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) /* Put the object onto the stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) walk_state->operands[walk_state->operand_index] = object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) walk_state->num_operands++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) /* For the usual order of filling the operand stack */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) walk_state->operand_index++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) object,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) acpi_ut_get_object_type_name((union
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) acpi_operand_object *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) object), walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) walk_state->num_operands));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) * FUNCTION: acpi_ds_obj_stack_pop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) * PARAMETERS: pop_count - Number of objects/entries to pop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) * walk_state - Current Walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) * deleted by this routine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) u32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) ACPI_FUNCTION_NAME(ds_obj_stack_pop);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) for (i = 0; i < pop_count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) /* Check for stack underflow */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) if (walk_state->num_operands == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) ACPI_ERROR((AE_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) "Object stack underflow! Count=%X State=%p #Ops=%u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) pop_count, walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) walk_state->num_operands));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) return (AE_STACK_UNDERFLOW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /* Just set the stack entry to null */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) walk_state->num_operands--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) walk_state->operands[walk_state->num_operands] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%u\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) pop_count, walk_state, walk_state->num_operands));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) return (AE_OK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) * FUNCTION: acpi_ds_obj_stack_pop_and_delete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) * PARAMETERS: pop_count - Number of objects/entries to pop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) * walk_state - Current Walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) * DESCRIPTION: Pop this walk's object stack and delete each object that is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) * popped off.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) s32 i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) union acpi_operand_object *obj_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) ACPI_FUNCTION_NAME(ds_obj_stack_pop_and_delete);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) if (pop_count == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) for (i = (s32)pop_count - 1; i >= 0; i--) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) if (walk_state->num_operands == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) /* Pop the stack and delete an object if present in this stack entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) walk_state->num_operands--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) obj_desc = walk_state->operands[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) if (obj_desc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) acpi_ut_remove_reference(walk_state->operands[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) walk_state->operands[i] = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) pop_count, walk_state, walk_state->num_operands));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) * FUNCTION: acpi_ds_get_current_walk_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) * PARAMETERS: thread - Get current active state for this Thread
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) * RETURN: Pointer to the current walk state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) * DESCRIPTION: Get the walk state that is at the head of the list (the "current"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) * walk state.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) *thread)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) ACPI_FUNCTION_NAME(ds_get_current_walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) if (!thread) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) return (NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "Current WalkState %p\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) thread->walk_state_list));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) return (thread->walk_state_list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) * FUNCTION: acpi_ds_push_walk_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * PARAMETERS: walk_state - State to push
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) * thread - Thread state object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * RETURN: None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) * DESCRIPTION: Place the Thread state at the head of the state list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) struct acpi_thread_state *thread)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) ACPI_FUNCTION_TRACE(ds_push_walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) walk_state->next = thread->walk_state_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) thread->walk_state_list = walk_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) * FUNCTION: acpi_ds_pop_walk_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) * PARAMETERS: thread - Current thread state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) * RETURN: A walk_state object popped from the thread's stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) * DESCRIPTION: Remove and return the walkstate object that is at the head of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) * the walk stack for the given walk list. NULL indicates that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) * the list is empty.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) struct acpi_walk_state *walk_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) ACPI_FUNCTION_TRACE(ds_pop_walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) walk_state = thread->walk_state_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) if (walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) /* Next walk state becomes the current walk state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) thread->walk_state_list = walk_state->next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) * Don't clear the NEXT field, this serves as an indicator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) * that there is a parent WALK STATE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) * Do Not: walk_state->Next = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) return_PTR(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) * FUNCTION: acpi_ds_create_walk_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) * PARAMETERS: owner_id - ID for object creation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) * origin - Starting point for this walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) * method_desc - Method object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) * thread - Current thread state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) * RETURN: Pointer to the new walk state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) * DESCRIPTION: Allocate and initialize a new walk state. The current walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) * state is set to this new state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) union acpi_parse_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) *origin,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) union acpi_operand_object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) *method_desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) struct acpi_thread_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) *thread)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) struct acpi_walk_state *walk_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) ACPI_FUNCTION_TRACE(ds_create_walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) walk_state = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) return_PTR(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) walk_state->descriptor_type = ACPI_DESC_TYPE_WALK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) walk_state->method_desc = method_desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) walk_state->owner_id = owner_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) walk_state->origin = origin;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) walk_state->thread = thread;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) walk_state->parser_state.start_op = origin;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) /* Init the method args/local */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) #ifndef ACPI_CONSTANT_EVAL_ONLY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) acpi_ds_method_data_init(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) /* Put the new state at the head of the walk list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) if (thread) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) acpi_ds_push_walk_state(walk_state, thread);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) return_PTR(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) * FUNCTION: acpi_ds_init_aml_walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) * PARAMETERS: walk_state - New state to be initialized
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) * op - Current parse op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) * method_node - Control method NS node, if any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) * aml_start - Start of AML
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) * aml_length - Length of AML
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) * info - Method info block (params, etc.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) * pass_number - 1, 2, or 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) * DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) acpi_status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) union acpi_parse_object *op,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) struct acpi_namespace_node *method_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) u8 * aml_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) u32 aml_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) struct acpi_evaluate_info *info, u8 pass_number)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) struct acpi_parse_state *parser_state = &walk_state->parser_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) union acpi_parse_object *extra_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) ACPI_FUNCTION_TRACE(ds_init_aml_walk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) walk_state->parser_state.aml =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) walk_state->parser_state.aml_start = aml_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) walk_state->parser_state.aml_end =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) walk_state->parser_state.pkg_end = aml_start + aml_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) /* The next_op of the next_walk will be the beginning of the method */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) walk_state->next_op = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) walk_state->pass_number = pass_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) if (info) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) walk_state->params = info->parameters;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) walk_state->caller_return_desc = &info->return_object;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) status = acpi_ps_init_scope(&walk_state->parser_state, op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) if (method_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) walk_state->parser_state.start_node = method_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) walk_state->walk_type = ACPI_WALK_METHOD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) walk_state->method_node = method_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) walk_state->method_desc =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) acpi_ns_get_attached_object(method_node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) /* Push start scope on scope stack and make it current */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) acpi_ds_scope_stack_push(method_node, ACPI_TYPE_METHOD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) /* Init the method arguments */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) status = acpi_ds_method_data_init_args(walk_state->params,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) ACPI_METHOD_NUM_ARGS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) * Setup the current scope.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) * Find a Named Op that has a namespace node associated with it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) * search upwards from this Op. Current scope is the first
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) * Op with a namespace node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) extra_op = parser_state->start_op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) while (extra_op && !extra_op->common.node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) extra_op = extra_op->common.parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) if (!extra_op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) parser_state->start_node = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) parser_state->start_node = extra_op->common.node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) if (parser_state->start_node) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) /* Push start scope on scope stack and make it current */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) status =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) acpi_ds_scope_stack_push(parser_state->start_node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) parser_state->start_node->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) type, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) if (ACPI_FAILURE(status)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) status = acpi_ds_init_callbacks(walk_state, pass_number);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) return_ACPI_STATUS(status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) * FUNCTION: acpi_ds_delete_walk_state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) * PARAMETERS: walk_state - State to delete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) * RETURN: Status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) * DESCRIPTION: Delete a walk state including all internal data structures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) union acpi_generic_state *state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) ACPI_FUNCTION_TRACE_PTR(ds_delete_walk_state, walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) if (!walk_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) ACPI_ERROR((AE_INFO, "%p is not a valid walk state",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) /* There should not be any open scopes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) if (walk_state->parser_state.scope) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) ACPI_ERROR((AE_INFO, "%p walk still has a scope list",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) walk_state));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) acpi_ps_cleanup_scope(&walk_state->parser_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) /* Always must free any linked control states */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) while (walk_state->control_state) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) state = walk_state->control_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) walk_state->control_state = state->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) acpi_ut_delete_generic_state(state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) /* Always must free any linked parse states */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) while (walk_state->scope_info) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) state = walk_state->scope_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) walk_state->scope_info = state->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) acpi_ut_delete_generic_state(state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) /* Always must free any stacked result states */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) while (walk_state->results) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) state = walk_state->results;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) walk_state->results = state->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) acpi_ut_delete_generic_state(state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) ACPI_FREE(walk_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) }