// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines * * Copyright (C) 2000 - 2023, Intel Corp. * *****************************************************************************/ /* * Parse the AML and build an operation tree as most interpreters, * like Perl, do. Parsing is done by hand rather than with a YACC * generated parser to tightly constrain stack and dynamic memory * usage. At the same time, parsing is kept flexible and the code * fairly compact by parsing based on a list of AML opcode * templates in aml_op_info[] */ #include <acpi/acpi.h> #include "accommon.h" #include "acparser.h" #include "acdispat.h" #include "amlcode.h" #include "acinterp.h" #include "acnamesp.h" #define _COMPONENT … ACPI_MODULE_NAME("psparse") /******************************************************************************* * * FUNCTION: acpi_ps_get_opcode_size * * PARAMETERS: opcode - An AML opcode * * RETURN: Size of the opcode, in bytes (1 or 2) * * DESCRIPTION: Get the size of the current opcode. * ******************************************************************************/ u32 acpi_ps_get_opcode_size(u32 opcode) { … } /******************************************************************************* * * FUNCTION: acpi_ps_peek_opcode * * PARAMETERS: parser_state - A parser state object * * RETURN: Next AML opcode * * DESCRIPTION: Get next AML opcode (without incrementing AML pointer) * ******************************************************************************/ u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state) { … } /******************************************************************************* * * FUNCTION: acpi_ps_complete_this_op * * PARAMETERS: walk_state - Current State * op - Op to complete * * RETURN: Status * * DESCRIPTION: Perform any cleanup at the completion of an Op. * ******************************************************************************/ acpi_status acpi_ps_complete_this_op(struct acpi_walk_state *walk_state, union acpi_parse_object *op) { … } /******************************************************************************* * * FUNCTION: acpi_ps_next_parse_state * * PARAMETERS: walk_state - Current state * op - Current parse op * callback_status - Status from previous operation * * RETURN: Status * * DESCRIPTION: Update the parser state based upon the return exception from * the parser callback. * ******************************************************************************/ acpi_status acpi_ps_next_parse_state(struct acpi_walk_state *walk_state, union acpi_parse_object *op, acpi_status callback_status) { … } /******************************************************************************* * * FUNCTION: acpi_ps_parse_aml * * PARAMETERS: walk_state - Current state * * * RETURN: Status * * DESCRIPTION: Parse raw AML and return a tree of ops * ******************************************************************************/ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) { … }