Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^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: pswalk - Parser routines to walk parsed op tree(s)
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define _COMPONENT          ACPI_PARSER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) ACPI_MODULE_NAME("pswalk")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * FUNCTION:    acpi_ps_delete_parse_tree
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  * PARAMETERS:  subtree_root        - Root of tree (or subtree) to delete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * RETURN:      None
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * DESCRIPTION: Delete a portion of or an entire parse tree.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include "amlcode.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	union acpi_parse_object *op = subtree_root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	union acpi_parse_object *next = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	union acpi_parse_object *parent = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	u32 level = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	ACPI_FUNCTION_TRACE_PTR(ps_delete_parse_tree, subtree_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	ACPI_DEBUG_PRINT((ACPI_DB_PARSE_TREES, " root %p\n", subtree_root));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	/* Visit all nodes in the subtree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	while (op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		if (op != parent) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 			/* This is the descending case */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 			if (ACPI_IS_DEBUG_ENABLED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 			    (ACPI_LV_PARSE_TREES, _COMPONENT)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 				/* This debug option will print the entire parse tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 				acpi_os_printf("      %*.s%s %p", (level * 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 					       " ",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 					       acpi_ps_get_opcode_name(op->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 								       common.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 								       aml_opcode),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 					       op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 				if (op->named.aml_opcode == AML_INT_NAMEPATH_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 					acpi_os_printf("  %4.4s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 						       op->common.value.string);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 				if (op->named.aml_opcode == AML_STRING_OP) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 					acpi_os_printf("  %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 						       op->common.value.string);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 				acpi_os_printf("\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 			/* Look for an argument or child of the current op */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 			next = acpi_ps_get_arg(op, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 			if (next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 				/* Still going downward in tree (Op is not completed yet) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 				op = next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 				level++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 				continue;
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		/* No more children, this Op is complete. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		next = op->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		parent = op->common.parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		acpi_ps_free_op(op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		/* If we are back to the starting point, the walk is complete. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		if (op == subtree_root) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 			return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		if (next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 			op = next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 			level--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			op = parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) }