ReactOS 0.4.15-dev-7931-gfd331f1
nsparse.c File Reference
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acdispat.h"
#include "actables.h"
#include "acinterp.h"
Include dependency graph for nsparse.c:

Go to the source code of this file.

Macros

#define _COMPONENT   ACPI_NAMESPACE
 

Functions

ACPI_STATUS AcpiNsExecuteTable (UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode)
 
ACPI_STATUS AcpiNsOneCompleteParse (UINT32 PassNumber, UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode)
 
ACPI_STATUS AcpiNsParseTable (UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode)
 

Macro Definition Documentation

◆ _COMPONENT

#define _COMPONENT   ACPI_NAMESPACE

Definition at line 53 of file nsparse.c.

Function Documentation

◆ AcpiNsExecuteTable()

ACPI_STATUS AcpiNsExecuteTable ( UINT32  TableIndex,
ACPI_NAMESPACE_NODE StartNode 
)

Definition at line 81 of file nsparse.c.

84{
89 UINT32 AmlLength;
90 UINT8 *AmlStart;
91 ACPI_OPERAND_OBJECT *MethodObj = NULL;
92
93
94 ACPI_FUNCTION_TRACE (NsExecuteTable);
95
96
97 Status = AcpiGetTableByIndex (TableIndex, &Table);
98 if (ACPI_FAILURE (Status))
99 {
101 }
102
103 /* Table must consist of at least a complete header */
104
105 if (Table->Length < sizeof (ACPI_TABLE_HEADER))
106 {
108 }
109
110 AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
111 AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
112
113 Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
114 if (ACPI_FAILURE (Status))
115 {
117 }
118
119 /* Create, initialize, and link a new temporary method object */
120
122 if (!MethodObj)
123 {
125 }
126
127 /* Allocate the evaluation information block */
128
130 if (!Info)
131 {
133 goto Cleanup;
134 }
135
137 "%s: Create table pseudo-method for [%4.4s] @%p, method %p\n",
138 ACPI_GET_FUNCTION_NAME, Table->Signature, Table, MethodObj));
139
140 MethodObj->Method.AmlStart = AmlStart;
141 MethodObj->Method.AmlLength = AmlLength;
142 MethodObj->Method.OwnerId = OwnerId;
144
145 Info->PassNumber = ACPI_IMODE_EXECUTE;
146 Info->Node = StartNode;
147 Info->ObjDesc = MethodObj;
148 Info->NodeFlags = Info->Node->Flags;
149 Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE);
150 if (!Info->FullPathname)
151 {
153 goto Cleanup;
154 }
155
156 /* Optional object evaluation log */
157
159 "%-26s: (Definition Block level)\n", "Module-level evaluation"));
160
162
163 /* Optional object evaluation log */
164
166 "%-26s: (Definition Block level)\n", "Module-level complete"));
167
168Cleanup:
169 if (Info)
170 {
171 ACPI_FREE (Info->FullPathname);
172 Info->FullPathname = NULL;
173 }
174 ACPI_FREE (Info);
175 AcpiUtRemoveReference (MethodObj);
177}
unsigned char UINT8
unsigned int UINT32
#define AE_BAD_HEADER
Definition: acexcep.h:168
#define ACPI_FAILURE(a)
Definition: acexcep.h:95
#define AE_NO_MEMORY
Definition: acexcep.h:112
#define ACPI_GET_FUNCTION_NAME
Definition: acgcc.h:67
@ ACPI_IMODE_EXECUTE
Definition: aclocal.h:169
char * AcpiNsGetNormalizedPathname(ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing)
Definition: nsnames.c:367
#define ACPI_METHOD_MODULE_LEVEL
Definition: acobject.h:236
#define ACPI_DB_PARSE
Definition: acoutput.h:162
#define return_ACPI_STATUS(s)
Definition: acoutput.h:496
#define ACPI_FUNCTION_TRACE(a)
Definition: acoutput.h:480
#define ACPI_DEBUG_PRINT_RAW(pl)
Definition: acoutput.h:476
#define ACPI_DB_EVALUATION
Definition: acoutput.h:181
ACPI_STATUS AcpiPsExecuteTable(ACPI_EVALUATE_INFO *Info)
Definition: psxface.c:297
ACPI_STATUS AcpiTbGetOwnerId(UINT32 TableIndex, ACPI_OWNER_ID *OwnerId)
Definition: tbdata.c:993
struct acpi_table_header ACPI_TABLE_HEADER
#define ACPI_FREE(a)
Definition: actypes.h:386
UINT32 ACPI_STATUS
Definition: actypes.h:460
#define ACPI_ALLOCATE_ZEROED(a)
Definition: actypes.h:385
UINT16 ACPI_OWNER_ID
Definition: actypes.h:486
#define ACPI_TYPE_METHOD
Definition: actypes.h:695
#define AcpiUtCreateInternalObject(t)
Definition: acutils.h:681
void AcpiUtRemoveReference(ACPI_OPERAND_OBJECT *Object)
Definition: utdelete.c:790
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static const WCHAR Cleanup[]
Definition: register.c:80
_Must_inspect_result_ _In_opt_ PVOID OwnerId
Definition: fsrtlfuncs.h:907
Status
Definition: gdiplustypes.h:25
ASMGENDATA Table[]
Definition: genincdata.c:61
ACPI_OWNER_ID OwnerId
Definition: acobject.h:229
UINT8 * AmlStart
Definition: acobject.h:221
ACPI_OBJECT_COMMON_HEADER UINT8 InfoFlags
Definition: acobject.h:216
ACPI_STATUS AcpiGetTableByIndex(UINT32 TableIndex, ACPI_TABLE_HEADER **OutTable)
Definition: tbxface.c:491
ACPI_OBJECT_METHOD Method
Definition: acobject.h:525
ACPI_NAMESPACE_NODE Node
Definition: acobject.h:550
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by AcpiNsParseTable().

◆ AcpiNsOneCompleteParse()

ACPI_STATUS AcpiNsOneCompleteParse ( UINT32  PassNumber,
UINT32  TableIndex,
ACPI_NAMESPACE_NODE StartNode 
)

Definition at line 194 of file nsparse.c.

198{
199 ACPI_PARSE_OBJECT *ParseRoot;
201 UINT32 AmlLength;
202 UINT8 *AmlStart;
203 ACPI_WALK_STATE *WalkState;
206
207
208 ACPI_FUNCTION_TRACE (NsOneCompleteParse);
209
210
211 Status = AcpiGetTableByIndex (TableIndex, &Table);
212 if (ACPI_FAILURE (Status))
213 {
215 }
216
217 /* Table must consist of at least a complete header */
218
219 if (Table->Length < sizeof (ACPI_TABLE_HEADER))
220 {
222 }
223
224 AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
225 AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
226
227 Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
228 if (ACPI_FAILURE (Status))
229 {
231 }
232
233 /* Create and init a Root Node */
234
235 ParseRoot = AcpiPsCreateScopeOp (AmlStart);
236 if (!ParseRoot)
237 {
239 }
240
241 /* Create and initialize a new walk state */
242
243 WalkState = AcpiDsCreateWalkState (OwnerId, NULL, NULL, NULL);
244 if (!WalkState)
245 {
246 AcpiPsFreeOp (ParseRoot);
248 }
249
250 Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL,
251 AmlStart, AmlLength, NULL, (UINT8) PassNumber);
252 if (ACPI_FAILURE (Status))
253 {
254 AcpiDsDeleteWalkState (WalkState);
255 goto Cleanup;
256 }
257
258 /* Found OSDT table, enable the namespace override feature */
259
260 if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_OSDT) &&
261 PassNumber == ACPI_IMODE_LOAD_PASS1)
262 {
263 WalkState->NamespaceOverride = TRUE;
264 }
265
266 /* StartNode is the default location to load the table */
267
268 if (StartNode && StartNode != AcpiGbl_RootNode)
269 {
271 StartNode, ACPI_TYPE_METHOD, WalkState);
272 if (ACPI_FAILURE (Status))
273 {
274 AcpiDsDeleteWalkState (WalkState);
275 goto Cleanup;
276 }
277 }
278
279 /* Parse the AML */
280
282 "*PARSE* pass %u parse\n", PassNumber));
284 Status = AcpiPsParseAml (WalkState);
286
287Cleanup:
288 AcpiPsDeleteParseTree (ParseRoot);
290}
@ ACPI_IMODE_LOAD_PASS1
Definition: aclocal.h:167
#define ACPI_DEBUG_PRINT(pl)
Definition: acoutput.h:475
void AcpiPsDeleteParseTree(ACPI_PARSE_OBJECT *root)
Definition: pswalk.c:67
void AcpiPsFreeOp(ACPI_PARSE_OBJECT *Op)
Definition: psutils.c:212
ACPI_STATUS AcpiPsParseAml(ACPI_WALK_STATE *WalkState)
Definition: psparse.c:453
ACPI_PARSE_OBJECT * AcpiPsCreateScopeOp(UINT8 *Aml)
Definition: psutils.c:67
#define ACPI_SIG_OSDT
Definition: actbl.h:70
#define ACPI_COMPARE_NAMESEG(a, b)
Definition: actypes.h:564
ACPI_STATUS AcpiDsScopeStackPush(ACPI_NAMESPACE_NODE *Node, ACPI_OBJECT_TYPE Type, ACPI_WALK_STATE *WalkState)
Definition: dswscope.c:107
ACPI_WALK_STATE * AcpiDsCreateWalkState(ACPI_OWNER_ID OwnerId, ACPI_PARSE_OBJECT *Origin, ACPI_OPERAND_OBJECT *MethodDesc, ACPI_THREAD_STATE *Thread)
Definition: dswstate.c:600
ACPI_STATUS AcpiDsInitAmlWalk(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *MethodNode, UINT8 *AmlStart, UINT32 AmlLength, ACPI_EVALUATE_INFO *Info, UINT8 PassNumber)
Definition: dswstate.c:662
void AcpiDsDeleteWalkState(ACPI_WALK_STATE *WalkState)
Definition: dswstate.c:780
void AcpiExExitInterpreter(void)
Definition: exutils.c:139
void AcpiExEnterInterpreter(void)
Definition: exutils.c:91
BOOLEAN NamespaceOverride
Definition: acstruct.h:88

◆ AcpiNsParseTable()

ACPI_STATUS AcpiNsParseTable ( UINT32  TableIndex,
ACPI_NAMESPACE_NODE StartNode 
)

Definition at line 307 of file nsparse.c.

310{
312
313
314 ACPI_FUNCTION_TRACE (NsParseTable);
315
316
317 /*
318 * Executes the AML table as one large control method.
319 * The point of this is to execute any module-level code in-place
320 * as the table is parsed. Some AML code depends on this behavior.
321 *
322 * Note: This causes the table to only have a single-pass parse.
323 * However, this is compatible with other ACPI implementations.
324 */
326 "%s: **** Start table execution pass\n", ACPI_GET_FUNCTION_NAME));
327
328 Status = AcpiNsExecuteTable (TableIndex, StartNode);
329
331}
ACPI_STATUS AcpiNsExecuteTable(UINT32 TableIndex, ACPI_NAMESPACE_NODE *StartNode)
Definition: nsparse.c:81

Referenced by AcpiNsLoadTable().