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: pstree - Parser op tree manipulation/traversal/search
^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 "amlcode.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include "acconvert.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #define _COMPONENT          ACPI_PARSER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) ACPI_MODULE_NAME("pstree")
^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) #ifdef ACPI_OBSOLETE_FUNCTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #endif
^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_ps_get_arg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * PARAMETERS:  op              - Get an argument for this op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  *              argn            - Nth argument to get
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * RETURN:      The argument (as an Op object). NULL if argument does not exist
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * DESCRIPTION: Get the specified op's argument.
^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) union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	union acpi_parse_object *arg = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	const struct acpi_opcode_info *op_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	ACPI_FUNCTION_ENTRY();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	if (Op->Common.aml_opcode == AML_INT_CONNECTION_OP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		return (Op->Common.Value.Arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	/* Get the info structure for this opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	if (op_info->class == AML_CLASS_UNKNOWN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		/* Invalid opcode or ASCII character */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		return (NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	/* Check if this opcode requires argument sub-objects */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	if (!(op_info->flags & AML_HAS_ARGS)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		/* Has no linked argument objects */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		return (NULL);
^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) 	/* Get the requested argument object */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	arg = op->common.value.arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	while (arg && argn) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		argn--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		arg = arg->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	return (arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^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)  * FUNCTION:    acpi_ps_append_arg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  * PARAMETERS:  op              - Append an argument to this Op.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  *              arg             - Argument Op to append
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  * RETURN:      None.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)  * DESCRIPTION: Append an argument to an op's argument list (a NULL arg is OK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	union acpi_parse_object *prev_arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	const struct acpi_opcode_info *op_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	ACPI_FUNCTION_TRACE(ps_append_arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	if (!op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	/* Get the info structure for this opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	if (op_info->class == AML_CLASS_UNKNOWN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		/* Invalid opcode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 			    op->common.aml_opcode));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	/* Check if this opcode requires argument sub-objects */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	if (!(op_info->flags & AML_HAS_ARGS)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		/* Has no linked argument objects */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	/* Append the argument to the linked argument list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	if (op->common.value.arg) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		/* Append to existing argument list */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		prev_arg = op->common.value.arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		while (prev_arg->common.next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			prev_arg = prev_arg->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		prev_arg->common.next = arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		/* No argument list, this will be the first argument */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		op->common.value.arg = arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	/* Set the parent in this arg and any args linked after it */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	while (arg) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		arg->common.parent = op;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		arg = arg->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		op->common.arg_list_length++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	return_VOID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)  * FUNCTION:    acpi_ps_get_depth_next
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * PARAMETERS:  origin          - Root of subtree to search
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  *              op              - Last (previous) Op that was found
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  * RETURN:      Next Op found in the search.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)  * DESCRIPTION: Get next op in tree (walking the tree in depth-first order)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  *              Return NULL when reaching "origin" or when walking up from root
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 						union acpi_parse_object *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	union acpi_parse_object *next = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	union acpi_parse_object *parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	union acpi_parse_object *arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	ACPI_FUNCTION_ENTRY();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	if (!op) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		return (NULL);
^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) 	/* Look for an argument or child */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	next = acpi_ps_get_arg(op, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	if (next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		ASL_CV_LABEL_FILENODE(next);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 		return (next);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	/* Look for a sibling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	next = op->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	if (next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		ASL_CV_LABEL_FILENODE(next);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		return (next);
^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) 	/* Look for a sibling of parent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	parent = op->common.parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	while (parent) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		arg = acpi_ps_get_arg(parent, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		while (arg && (arg != origin) && (arg != op)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 			ASL_CV_LABEL_FILENODE(arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 			arg = arg->common.next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		if (arg == origin) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 			/* Reached parent of origin, end search */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 			return (NULL);
^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) 		if (parent->common.next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 			/* Found sibling of parent */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 			ASL_CV_LABEL_FILENODE(parent->common.next);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 			return (parent->common.next);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		op = parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		parent = parent->common.parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	ASL_CV_LABEL_FILENODE(next);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	return (next);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) #ifdef ACPI_OBSOLETE_FUNCTIONS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) /*******************************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)  * FUNCTION:    acpi_ps_get_child
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)  * PARAMETERS:  op              - Get the child of this Op
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)  * RETURN:      Child Op, Null if none is found.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)  * DESCRIPTION: Get op's children or NULL if none
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)  ******************************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	union acpi_parse_object *child = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	ACPI_FUNCTION_ENTRY();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	switch (op->common.aml_opcode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	case AML_SCOPE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 	case AML_ELSE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	case AML_DEVICE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	case AML_THERMAL_ZONE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	case AML_INT_METHODCALL_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 		child = acpi_ps_get_arg(op, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	case AML_BUFFER_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	case AML_PACKAGE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	case AML_VARIABLE_PACKAGE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	case AML_METHOD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	case AML_IF_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	case AML_WHILE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	case AML_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 		child = acpi_ps_get_arg(op, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	case AML_POWER_RESOURCE_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	case AML_INDEX_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		child = acpi_ps_get_arg(op, 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	case AML_PROCESSOR_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	case AML_BANK_FIELD_OP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 		child = acpi_ps_get_arg(op, 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 		/* All others have no children */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 	return (child);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) #endif