Deleted Added
full compact
nsload.c (104470) nsload.c (114237)
1/******************************************************************************
2 *
3 * Module Name: nsload - namespace loading/expanding/contracting procedures
1/******************************************************************************
2 *
3 * Module Name: nsload - namespace loading/expanding/contracting procedures
4 * $Revision: 59 $
4 * $Revision: 64 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
12 * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.

--- 92 unchanged lines hidden (view full) ---

113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#define __NSLOAD_C__
118
119#include "acpi.h"
120#include "acnamesp.h"
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.

--- 92 unchanged lines hidden (view full) ---

113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#define __NSLOAD_C__
118
119#include "acpi.h"
120#include "acnamesp.h"
121#include "acparser.h"
122#include "acdispat.h"
123
124
125#define _COMPONENT ACPI_NAMESPACE
126 ACPI_MODULE_NAME ("nsload")
127
128
121#include "acdispat.h"
122
123
124#define _COMPONENT ACPI_NAMESPACE
125 ACPI_MODULE_NAME ("nsload")
126
127
129/*******************************************************************************
130 *
131 * FUNCTION: NsOneCompleteParse
132 *
133 * PARAMETERS: PassNumber - 1 or 2
134 * TableDesc - The table to be parsed.
135 *
136 * RETURN: Status
137 *
138 * DESCRIPTION: Perform one complete parse of an ACPI/AML table.
139 *
140 ******************************************************************************/
141
142ACPI_STATUS
143AcpiNsOneCompleteParse (
144 UINT32 PassNumber,
145 ACPI_TABLE_DESC *TableDesc)
146{
147 ACPI_PARSE_OBJECT *ParseRoot;
148 ACPI_STATUS Status;
149 ACPI_WALK_STATE *WalkState;
150
151
152 ACPI_FUNCTION_TRACE ("NsOneCompleteParse");
153
154
155 /* Create and init a Root Node */
156
157 ParseRoot = AcpiPsCreateScopeOp ();
158 if (!ParseRoot)
159 {
160 return_ACPI_STATUS (AE_NO_MEMORY);
161 }
162
163
164 /* Create and initialize a new walk state */
165
166 WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT,
167 NULL, NULL, NULL);
168 if (!WalkState)
169 {
170 AcpiPsFreeOp (ParseRoot);
171 return_ACPI_STATUS (AE_NO_MEMORY);
172 }
173
174 Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, TableDesc->AmlStart,
175 TableDesc->AmlLength, NULL, NULL, PassNumber);
176 if (ACPI_FAILURE (Status))
177 {
178 AcpiDsDeleteWalkState (WalkState);
179 return_ACPI_STATUS (Status);
180 }
181
182 /* Parse the AML */
183
184 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber));
185 Status = AcpiPsParseAml (WalkState);
186
187 AcpiPsDeleteParseTree (ParseRoot);
188 return_ACPI_STATUS (Status);
189}
190
191
192/*******************************************************************************
193 *
194 * FUNCTION: AcpiNsParseTable
195 *
196 * PARAMETERS: TableDesc - An ACPI table descriptor for table to parse
197 * StartNode - Where to enter the table into the namespace
198 *
199 * RETURN: Status
200 *
201 * DESCRIPTION: Parse AML within an ACPI table and return a tree of ops
202 *
203 ******************************************************************************/
204
205ACPI_STATUS
206AcpiNsParseTable (
207 ACPI_TABLE_DESC *TableDesc,
208 ACPI_NAMESPACE_NODE *StartNode)
209{
210 ACPI_STATUS Status;
211
212
213 ACPI_FUNCTION_TRACE ("NsParseTable");
214
215
216 /*
217 * AML Parse, pass 1
218 *
219 * In this pass, we load most of the namespace. Control methods
220 * are not parsed until later. A parse tree is not created. Instead,
221 * each Parser Op subtree is deleted when it is finished. This saves
222 * a great deal of memory, and allows a small cache of parse objects
223 * to service the entire parse. The second pass of the parse then
224 * performs another complete parse of the AML..
225 */
226 Status = AcpiNsOneCompleteParse (1, TableDesc);
227 if (ACPI_FAILURE (Status))
228 {
229 return_ACPI_STATUS (Status);
230 }
231
232 /*
233 * AML Parse, pass 2
234 *
235 * In this pass, we resolve forward references and other things
236 * that could not be completed during the first pass.
237 * Another complete parse of the AML is performed, but the
238 * overhead of this is compensated for by the fact that the
239 * parse objects are all cached.
240 */
241 Status = AcpiNsOneCompleteParse (2, TableDesc);
242 if (ACPI_FAILURE (Status))
243 {
244 return_ACPI_STATUS (Status);
245 }
246
247 return_ACPI_STATUS (Status);
248}
249
250#ifndef ACPI_NO_METHOD_EXECUTION
251
252/*******************************************************************************
253 *
254 * FUNCTION: AcpiNsLoadTable
255 *
256 * PARAMETERS: TableDesc - Descriptor for table to be loaded
257 * Node - Owning NS node

--- 29 unchanged lines hidden (view full) ---

287 if (!TableDesc->AmlStart)
288 {
289 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
290 return_ACPI_STATUS (AE_BAD_PARAMETER);
291 }
292
293 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", TableDesc->AmlStart));
294
128#ifndef ACPI_NO_METHOD_EXECUTION
129
130/*******************************************************************************
131 *
132 * FUNCTION: AcpiNsLoadTable
133 *
134 * PARAMETERS: TableDesc - Descriptor for table to be loaded
135 * Node - Owning NS node

--- 29 unchanged lines hidden (view full) ---

165 if (!TableDesc->AmlStart)
166 {
167 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
168 return_ACPI_STATUS (AE_BAD_PARAMETER);
169 }
170
171 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n", TableDesc->AmlStart));
172
173 /* Ignore table if there is no AML contained within */
174
295 if (!TableDesc->AmlLength)
296 {
175 if (!TableDesc->AmlLength)
176 {
297 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Zero-length AML block\n"));
298 return_ACPI_STATUS (AE_BAD_PARAMETER);
177 ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n", TableDesc->Pointer->Signature));
178 return_ACPI_STATUS (AE_OK);
299 }
300
301 /*
302 * Parse the table and load the namespace with all named
303 * objects found within. Control methods are NOT parsed
304 * at this time. In fact, the control methods cannot be
305 * parsed until the entire namespace is loaded, because
306 * if a control method makes a forward reference (call)

--- 213 unchanged lines hidden (view full) ---

520 return_ACPI_STATUS (Status);
521 }
522
523 /* Ignore exceptions from these */
524
525 (void) AcpiNsLoadTableByType (ACPI_TABLE_SSDT);
526 (void) AcpiNsLoadTableByType (ACPI_TABLE_PSDT);
527
179 }
180
181 /*
182 * Parse the table and load the namespace with all named
183 * objects found within. Control methods are NOT parsed
184 * at this time. In fact, the control methods cannot be
185 * parsed until the entire namespace is loaded, because
186 * if a control method makes a forward reference (call)

--- 213 unchanged lines hidden (view full) ---

400 return_ACPI_STATUS (Status);
401 }
402
403 /* Ignore exceptions from these */
404
405 (void) AcpiNsLoadTableByType (ACPI_TABLE_SSDT);
406 (void) AcpiNsLoadTableByType (ACPI_TABLE_PSDT);
407
528 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK,
408 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
529 "ACPI Namespace successfully loaded at root %p\n",
530 AcpiGbl_RootNode));
531
532 return_ACPI_STATUS (Status);
533}
534
535
536/*******************************************************************************

--- 139 unchanged lines hidden ---
409 "ACPI Namespace successfully loaded at root %p\n",
410 AcpiGbl_RootNode));
411
412 return_ACPI_STATUS (Status);
413}
414
415
416/*******************************************************************************

--- 139 unchanged lines hidden ---