/******************************************************************************* * * FUNCTION: acpi_ds_result_pop * * PARAMETERS: object - Where to return the popped object * walk_state - Current Walk state * * RETURN: Status * * DESCRIPTION: Pop an object off the top of this walk's result stack *
******************************************************************************/
if (state && !walk_state->result_count) {
ACPI_ERROR((AE_INFO, "No results on result stack")); return (AE_AML_INTERNAL);
}
if (!state && walk_state->result_count) {
ACPI_ERROR((AE_INFO, "No result state for result stack")); return (AE_AML_INTERNAL);
}
/* Empty result stack */
if (!state) {
ACPI_ERROR((AE_INFO, "Result stack is empty! State=%p",
walk_state)); return (AE_AML_NO_RETURN_VALUE);
}
/* Return object of the top element and clean that top element result stack */
walk_state->result_count--;
index = (u32)walk_state->result_count % ACPI_RESULTS_FRAME_OBJ_NUM;
*object = state->results.obj_desc[index]; if (!*object) {
ACPI_ERROR((AE_INFO, "No result objects on result stack, State=%p",
walk_state)); return (AE_AML_NO_RETURN_VALUE);
}
state->results.obj_desc[index] = NULL; if (index == 0) {
status = acpi_ds_result_stack_pop(walk_state); if (ACPI_FAILURE(status)) { return (status);
}
}
/******************************************************************************* * * FUNCTION: acpi_ds_result_push * * PARAMETERS: object - Where to return the popped object * walk_state - Current Walk state * * RETURN: Status * * DESCRIPTION: Push an object onto the current result stack *
******************************************************************************/
if (walk_state->result_count > walk_state->result_size) {
ACPI_ERROR((AE_INFO, "Result stack is full")); return (AE_AML_INTERNAL);
} elseif (walk_state->result_count == walk_state->result_size) {
/* Extend the result stack */
status = acpi_ds_result_stack_push(walk_state); if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO, "Failed to extend the result stack")); return (status);
}
}
if (!(walk_state->result_count < walk_state->result_size)) {
ACPI_ERROR((AE_INFO, "No free elements in result stack")); return (AE_AML_INTERNAL);
}
state = walk_state->results; if (!state) {
ACPI_ERROR((AE_INFO, "No result stack frame during push")); return (AE_AML_INTERNAL);
}
/******************************************************************************* * * FUNCTION: acpi_ds_result_stack_push * * PARAMETERS: walk_state - Current Walk state * * RETURN: Status * * DESCRIPTION: Push an object onto the walk_state result stack *
******************************************************************************/
static acpi_status acpi_ds_result_stack_push(struct acpi_walk_state *walk_state)
{ union acpi_generic_state *state;
/******************************************************************************* * * FUNCTION: acpi_ds_result_stack_pop * * PARAMETERS: walk_state - Current Walk state * * RETURN: Status * * DESCRIPTION: Pop an object off of the walk_state result stack *
******************************************************************************/
static acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state *walk_state)
{ union acpi_generic_state *state;
/******************************************************************************* * * FUNCTION: acpi_ds_obj_stack_pop * * PARAMETERS: pop_count - Number of objects/entries to pop * walk_state - Current Walk state * * RETURN: Status * * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT * deleted by this routine. *
******************************************************************************/
/******************************************************************************* * * FUNCTION: acpi_ds_obj_stack_pop_and_delete * * PARAMETERS: pop_count - Number of objects/entries to pop * walk_state - Current Walk state * * RETURN: Status * * DESCRIPTION: Pop this walk's object stack and delete each object that is * popped off. *
******************************************************************************/
/******************************************************************************* * * FUNCTION: acpi_ds_get_current_walk_state * * PARAMETERS: thread - Get current active state for this Thread * * RETURN: Pointer to the current walk state * * DESCRIPTION: Get the walk state that is at the head of the list (the "current" * walk state.) *
******************************************************************************/
/******************************************************************************* * * FUNCTION: acpi_ds_push_walk_state * * PARAMETERS: walk_state - State to push * thread - Thread state object * * RETURN: None * * DESCRIPTION: Place the Thread state at the head of the state list *
******************************************************************************/
/******************************************************************************* * * FUNCTION: acpi_ds_pop_walk_state * * PARAMETERS: thread - Current thread state * * RETURN: A walk_state object popped from the thread's stack * * DESCRIPTION: Remove and return the walkstate object that is at the head of * the walk stack for the given walk list. NULL indicates that * the list is empty. *
******************************************************************************/
/* Next walk state becomes the current walk state */
thread->walk_state_list = walk_state->next;
/* * Don't clear the NEXT field, this serves as an indicator * that there is a parent WALK STATE * Do Not: walk_state->Next = NULL;
*/
}
return_PTR(walk_state);
}
/******************************************************************************* * * FUNCTION: acpi_ds_create_walk_state * * PARAMETERS: owner_id - ID for object creation * origin - Starting point for this walk * method_desc - Method object * thread - Current thread state * * RETURN: Pointer to the new walk state. * * DESCRIPTION: Allocate and initialize a new walk state. The current walk * state is set to this new state. *
******************************************************************************/
struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_parse_object
*origin, union acpi_operand_object
*method_desc, struct acpi_thread_state
*thread)
{ struct acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE(ds_create_walk_state);
walk_state = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_walk_state)); if (!walk_state) {
return_PTR(NULL);
}
/* Put the new state at the head of the walk list */
if (thread) {
acpi_ds_push_walk_state(walk_state, thread);
}
return_PTR(walk_state);
}
/******************************************************************************* * * FUNCTION: acpi_ds_init_aml_walk * * PARAMETERS: walk_state - New state to be initialized * op - Current parse op * method_node - Control method NS node, if any * aml_start - Start of AML * aml_length - Length of AML * info - Method info block (params, etc.) * pass_number - 1, 2, or 3 * * RETURN: Status * * DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk *
******************************************************************************/
/* Push start scope on scope stack and make it current */
status =
acpi_ds_scope_stack_push(method_node, ACPI_TYPE_METHOD,
walk_state); if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Init the method arguments */
status = acpi_ds_method_data_init_args(walk_state->params,
ACPI_METHOD_NUM_ARGS,
walk_state); if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
} else { /* * Setup the current scope. * Find a Named Op that has a namespace node associated with it. * search upwards from this Op. Current scope is the first * Op with a namespace node.
*/
extra_op = parser_state->start_op; while (extra_op && !extra_op->common.node) {
extra_op = extra_op->common.parent;
}
/* Push start scope on scope stack and make it current */
status =
acpi_ds_scope_stack_push(parser_state->start_node,
parser_state->start_node->
type, walk_state); if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}
}
status = acpi_ds_init_callbacks(walk_state, pass_number);
return_ACPI_STATUS(status);
}
/******************************************************************************* * * FUNCTION: acpi_ds_delete_walk_state * * PARAMETERS: walk_state - State to delete * * RETURN: Status * * DESCRIPTION: Delete a walk state including all internal data structures *
******************************************************************************/
void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state)
{ union acpi_generic_state *state;
if (walk_state->descriptor_type != ACPI_DESC_TYPE_WALK) {
ACPI_ERROR((AE_INFO, "%p is not a valid walk state",
walk_state));
return_VOID;
}
/* There should not be any open scopes */
if (walk_state->parser_state.scope) {
ACPI_ERROR((AE_INFO, "%p walk still has a scope list",
walk_state));
acpi_ps_cleanup_scope(&walk_state->parser_state);
}
/* Always must free any linked control states */
while (walk_state->control_state) {
state = walk_state->control_state;
walk_state->control_state = state->common.next;
acpi_ut_delete_generic_state(state);
}
/* Always must free any linked parse states */
while (walk_state->scope_info) {
state = walk_state->scope_info;
walk_state->scope_info = state->common.next;
acpi_ut_delete_generic_state(state);
}
/* Always must free any stacked result states */
while (walk_state->results) {
state = walk_state->results;
walk_state->results = state->common.next;
acpi_ut_delete_generic_state(state);
}
ACPI_FREE(walk_state);
return_VOID;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.37 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.