ReactOS 0.4.15-dev-7906-g1b85a5f
pstree.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acparser.h"
#include "amlcode.h"
#include "acconvert.h"
Include dependency graph for pstree.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_PARSER
 

Functions

ACPI_PARSE_OBJECTAcpiPsGetArg (ACPI_PARSE_OBJECT *Op, UINT32 Argn)
 
void AcpiPsAppendArg (ACPI_PARSE_OBJECT *Op, ACPI_PARSE_OBJECT *Arg)
 
ACPI_PARSE_OBJECTAcpiPsGetDepthNext (ACPI_PARSE_OBJECT *Origin, ACPI_PARSE_OBJECT *Op)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_PARSER

Definition at line 50 of file pstree.c.

Function Documentation

◆ AcpiPsAppendArg()

void AcpiPsAppendArg ( ACPI_PARSE_OBJECT Op,
ACPI_PARSE_OBJECT Arg 
)

Definition at line 138 of file pstree.c.

141{
142 ACPI_PARSE_OBJECT *PrevArg;
143 const ACPI_OPCODE_INFO *OpInfo;
144
145
146 ACPI_FUNCTION_TRACE (PsAppendArg);
147
148
149 if (!Op)
150 {
152 }
153
154 /* Get the info structure for this opcode */
155
156 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
157 if (OpInfo->Class == AML_CLASS_UNKNOWN)
158 {
159 /* Invalid opcode */
160
161 ACPI_ERROR ((AE_INFO, "Invalid AML Opcode: 0x%2.2X",
162 Op->Common.AmlOpcode));
164 }
165
166 /* Check if this opcode requires argument sub-objects */
167
168 if (!(OpInfo->Flags & AML_HAS_ARGS))
169 {
170 /* Has no linked argument objects */
171
173 }
174
175 /* Append the argument to the linked argument list */
176
177 if (Op->Common.Value.Arg)
178 {
179 /* Append to existing argument list */
180
181 PrevArg = Op->Common.Value.Arg;
182 while (PrevArg->Common.Next)
183 {
184 PrevArg = PrevArg->Common.Next;
185 }
186 PrevArg->Common.Next = Arg;
187 }
188 else
189 {
190 /* No argument list, this will be the first argument */
191
192 Op->Common.Value.Arg = Arg;
193 }
194
195 /* Set the parent in this arg and any args linked after it */
196
197 while (Arg)
198 {
199 Arg->Common.Parent = Op;
200 Arg = Arg->Common.Next;
201
202 Op->Common.ArgListLength++;
203 }
204
206}
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_ERROR(plist)
Definition: acoutput.h:240
#define AE_INFO
Definition: acoutput.h:230
#define return_VOID
Definition: acoutput.h:495
const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo(UINT16 Opcode)
Definition: psopinfo.c:72
#define AML_HAS_ARGS
Definition: amlcode.h:329
#define AML_CLASS_UNKNOWN
Definition: amlcode.h:410
UINT16 Flags
Definition: aclocal.h:873
ACPI_PARSE_OBJ_COMMON Common
Definition: aclocal.h:1078

Referenced by AcpiDsLoad1BeginOp(), AcpiPsBuildNamedOp(), AcpiPsCreateOp(), AcpiPsGetArguments(), AcpiPsGetNextField(), and AcpiPsGetNextNamepath().

◆ AcpiPsGetArg()

ACPI_PARSE_OBJECT * AcpiPsGetArg ( ACPI_PARSE_OBJECT Op,
UINT32  Argn 
)

Definition at line 76 of file pstree.c.

79{
81 const ACPI_OPCODE_INFO *OpInfo;
82
83
85
86/*
87 if (Op->Common.AmlOpcode == AML_INT_CONNECTION_OP)
88 {
89 return (Op->Common.Value.Arg);
90 }
91*/
92 /* Get the info structure for this opcode */
93
94 OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
95 if (OpInfo->Class == AML_CLASS_UNKNOWN)
96 {
97 /* Invalid opcode or ASCII character */
98
99 return (NULL);
100 }
101
102 /* Check if this opcode requires argument sub-objects */
103
104 if (!(OpInfo->Flags & AML_HAS_ARGS))
105 {
106 /* Has no linked argument objects */
107
108 return (NULL);
109 }
110
111 /* Get the requested argument object */
112
113 Arg = Op->Common.Value.Arg;
114 while (Arg && Argn)
115 {
116 Argn--;
117 Arg = Arg->Common.Next;
118 }
119
120 return (Arg);
121}
#define ACPI_FUNCTION_ENTRY()
Definition: acoutput.h:484
#define NULL
Definition: types.h:112

Referenced by AcpiDsCreateBufferField(), AcpiDsEvalBankFieldOperands(), AcpiDsInitFieldObjects(), AcpiPsDeleteParseTree(), and AcpiPsGetDepthNext().

◆ AcpiPsGetDepthNext()

ACPI_PARSE_OBJECT * AcpiPsGetDepthNext ( ACPI_PARSE_OBJECT Origin,
ACPI_PARSE_OBJECT Op 
)

Definition at line 224 of file pstree.c.

227{
228 ACPI_PARSE_OBJECT *Next = NULL;
231
232
234
235
236 if (!Op)
237 {
238 return (NULL);
239 }
240
241 /* Look for an argument or child */
242
243 Next = AcpiPsGetArg (Op, 0);
244 if (Next)
245 {
247 return (Next);
248 }
249
250 /* Look for a sibling */
251
252 Next = Op->Common.Next;
253 if (Next)
254 {
256 return (Next);
257 }
258
259 /* Look for a sibling of parent */
260
261 Parent = Op->Common.Parent;
262
263 while (Parent)
264 {
265 Arg = AcpiPsGetArg (Parent, 0);
266 while (Arg && (Arg != Origin) && (Arg != Op))
267 {
268
270 Arg = Arg->Common.Next;
271 }
272
273 if (Arg == Origin)
274 {
275 /* Reached parent of origin, end search */
276
277 return (NULL);
278 }
279
280 if (Parent->Common.Next)
281 {
282 /* Found sibling of parent */
283
284 ASL_CV_LABEL_FILENODE (Parent->Common.Next);
285 return (Parent->Common.Next);
286 }
287
288 Op = Parent;
289 Parent = Parent->Common.Parent;
290 }
291
293 return (Next);
294}
#define ASL_CV_LABEL_FILENODE(a)
Definition: acmacros.h:524
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
ACPI_PARSE_OBJECT * AcpiPsGetArg(ACPI_PARSE_OBJECT *Op, UINT32 Argn)
Definition: pstree.c:76