nsparse.c (151937) | nsparse.c (167802) |
---|---|
1/****************************************************************************** 2 * 3 * Module Name: nsparse - namespace interface to AML parser | 1/****************************************************************************** 2 * 3 * Module Name: nsparse - namespace interface to AML parser |
4 * $Revision: 1.10 $ | 4 * $Revision: 1.16 $ |
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 - 2005, Intel Corp. | 12 * Some or all of this work - Copyright (c) 1999 - 2007, 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. --- 94 unchanged lines hidden (view full) --- 115 *****************************************************************************/ 116 117#define __NSPARSE_C__ 118 119#include <contrib/dev/acpica/acpi.h> 120#include <contrib/dev/acpica/acnamesp.h> 121#include <contrib/dev/acpica/acparser.h> 122#include <contrib/dev/acpica/acdispat.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. --- 94 unchanged lines hidden (view full) --- 115 *****************************************************************************/ 116 117#define __NSPARSE_C__ 118 119#include <contrib/dev/acpica/acpi.h> 120#include <contrib/dev/acpica/acnamesp.h> 121#include <contrib/dev/acpica/acparser.h> 122#include <contrib/dev/acpica/acdispat.h> |
123#include <contrib/dev/acpica/actables.h> |
|
123 124 125#define _COMPONENT ACPI_NAMESPACE 126 ACPI_MODULE_NAME ("nsparse") 127 128 129/******************************************************************************* 130 * --- 5 unchanged lines hidden (view full) --- 136 * RETURN: Status 137 * 138 * DESCRIPTION: Perform one complete parse of an ACPI/AML table. 139 * 140 ******************************************************************************/ 141 142ACPI_STATUS 143AcpiNsOneCompleteParse ( | 124 125 126#define _COMPONENT ACPI_NAMESPACE 127 ACPI_MODULE_NAME ("nsparse") 128 129 130/******************************************************************************* 131 * --- 5 unchanged lines hidden (view full) --- 137 * RETURN: Status 138 * 139 * DESCRIPTION: Perform one complete parse of an ACPI/AML table. 140 * 141 ******************************************************************************/ 142 143ACPI_STATUS 144AcpiNsOneCompleteParse ( |
144 UINT8 PassNumber, 145 ACPI_TABLE_DESC *TableDesc) | 145 ACPI_NATIVE_UINT PassNumber, 146 ACPI_NATIVE_UINT TableIndex) |
146{ 147 ACPI_PARSE_OBJECT *ParseRoot; 148 ACPI_STATUS Status; | 147{ 148 ACPI_PARSE_OBJECT *ParseRoot; 149 ACPI_STATUS Status; |
150 ACPI_NATIVE_UINT AmlLength; 151 UINT8 *AmlStart; |
|
149 ACPI_WALK_STATE *WalkState; | 152 ACPI_WALK_STATE *WalkState; |
153 ACPI_TABLE_HEADER *Table; 154 ACPI_OWNER_ID OwnerId; |
|
150 151 | 155 156 |
152 ACPI_FUNCTION_TRACE ("NsOneCompleteParse"); | 157 ACPI_FUNCTION_TRACE (NsOneCompleteParse); |
153 154 | 158 159 |
160 Status = AcpiTbGetOwnerId (TableIndex, &OwnerId); 161 if (ACPI_FAILURE (Status)) 162 { 163 return_ACPI_STATUS (Status); 164 } 165 |
|
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 /* Create and initialize a new walk state */ 164 | 166 /* Create and init a Root Node */ 167 168 ParseRoot = AcpiPsCreateScopeOp (); 169 if (!ParseRoot) 170 { 171 return_ACPI_STATUS (AE_NO_MEMORY); 172 } 173 174 /* Create and initialize a new walk state */ 175 |
165 WalkState = AcpiDsCreateWalkState (TableDesc->OwnerId, 166 NULL, NULL, NULL); | 176 WalkState = AcpiDsCreateWalkState (OwnerId, NULL, NULL, NULL); |
167 if (!WalkState) 168 { 169 AcpiPsFreeOp (ParseRoot); 170 return_ACPI_STATUS (AE_NO_MEMORY); 171 } 172 | 177 if (!WalkState) 178 { 179 AcpiPsFreeOp (ParseRoot); 180 return_ACPI_STATUS (AE_NO_MEMORY); 181 } 182 |
173 Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, 174 TableDesc->AmlStart, TableDesc->AmlLength, 175 NULL, PassNumber); | 183 Status = AcpiGetTableByIndex (TableIndex, &Table); |
176 if (ACPI_FAILURE (Status)) 177 { 178 AcpiDsDeleteWalkState (WalkState); | 184 if (ACPI_FAILURE (Status)) 185 { 186 AcpiDsDeleteWalkState (WalkState); |
187 AcpiPsFreeOp (ParseRoot); |
|
179 return_ACPI_STATUS (Status); 180 } 181 | 188 return_ACPI_STATUS (Status); 189 } 190 |
191 /* Table must consist of at least a complete header */ 192 193 if (Table->Length < sizeof (ACPI_TABLE_HEADER)) 194 { 195 Status = AE_BAD_HEADER; 196 } 197 else 198 { 199 AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER); 200 AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); 201 Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL, 202 AmlStart, AmlLength, NULL, (UINT8) PassNumber); 203 } 204 205 if (ACPI_FAILURE (Status)) 206 { 207 AcpiDsDeleteWalkState (WalkState); 208 AcpiPsDeleteParseTree (ParseRoot); 209 return_ACPI_STATUS (Status); 210 } 211 |
|
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} --- 9 unchanged lines hidden (view full) --- 199 * RETURN: Status 200 * 201 * DESCRIPTION: Parse AML within an ACPI table and return a tree of ops 202 * 203 ******************************************************************************/ 204 205ACPI_STATUS 206AcpiNsParseTable ( | 212 /* Parse the AML */ 213 214 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber)); 215 Status = AcpiPsParseAml (WalkState); 216 217 AcpiPsDeleteParseTree (ParseRoot); 218 return_ACPI_STATUS (Status); 219} --- 9 unchanged lines hidden (view full) --- 229 * RETURN: Status 230 * 231 * DESCRIPTION: Parse AML within an ACPI table and return a tree of ops 232 * 233 ******************************************************************************/ 234 235ACPI_STATUS 236AcpiNsParseTable ( |
207 ACPI_TABLE_DESC *TableDesc, | 237 ACPI_NATIVE_UINT TableIndex, |
208 ACPI_NAMESPACE_NODE *StartNode) 209{ 210 ACPI_STATUS Status; 211 212 | 238 ACPI_NAMESPACE_NODE *StartNode) 239{ 240 ACPI_STATUS Status; 241 242 |
213 ACPI_FUNCTION_TRACE ("NsParseTable"); | 243 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 | 244 245 246 /* 247 * AML Parse, pass 1 248 * 249 * In this pass, we load most of the namespace. Control methods 250 * are not parsed until later. A parse tree is not created. Instead, 251 * each Parser Op subtree is deleted when it is finished. This saves 252 * a great deal of memory, and allows a small cache of parse objects 253 * to service the entire parse. The second pass of the parse then |
224 * performs another complete parse of the AML.. | 254 * performs another complete parse of the AML. |
225 */ 226 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); | 255 */ 256 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n")); |
227 Status = AcpiNsOneCompleteParse (1, TableDesc); | 257 Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, TableIndex); |
228 if (ACPI_FAILURE (Status)) 229 { 230 return_ACPI_STATUS (Status); 231 } 232 233 /* 234 * AML Parse, pass 2 235 * 236 * In this pass, we resolve forward references and other things 237 * that could not be completed during the first pass. 238 * Another complete parse of the AML is performed, but the 239 * overhead of this is compensated for by the fact that the 240 * parse objects are all cached. 241 */ 242 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); | 258 if (ACPI_FAILURE (Status)) 259 { 260 return_ACPI_STATUS (Status); 261 } 262 263 /* 264 * AML Parse, pass 2 265 * 266 * In this pass, we resolve forward references and other things 267 * that could not be completed during the first pass. 268 * Another complete parse of the AML is performed, but the 269 * overhead of this is compensated for by the fact that the 270 * parse objects are all cached. 271 */ 272 ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n")); |
243 Status = AcpiNsOneCompleteParse (2, TableDesc); | 273 Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex); |
244 if (ACPI_FAILURE (Status)) 245 { 246 return_ACPI_STATUS (Status); 247 } 248 249 return_ACPI_STATUS (Status); 250} 251 252 | 274 if (ACPI_FAILURE (Status)) 275 { 276 return_ACPI_STATUS (Status); 277 } 278 279 return_ACPI_STATUS (Status); 280} 281 282 |