Rev 1498 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1498 | Rev 2216 | ||
---|---|---|---|
1 | /****************************************************************************** |
1 | /****************************************************************************** |
2 | * |
2 | * |
3 | * Module Name: dswload - Dispatcher namespace load callbacks |
3 | * Module Name: dswload - Dispatcher first pass namespace load callbacks |
4 | * |
4 | * |
5 | *****************************************************************************/ |
5 | *****************************************************************************/ |
6 | 6 | ||
7 | /****************************************************************************** |
7 | /****************************************************************************** |
8 | * |
8 | * |
9 | * 1. Copyright Notice |
9 | * 1. Copyright Notice |
10 | * |
10 | * |
11 | * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. |
11 | * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp. |
12 | * All rights reserved. |
12 | * All rights reserved. |
13 | * |
13 | * |
14 | * 2. License |
14 | * 2. License |
15 | * |
15 | * |
16 | * 2.1. This is your license from Intel Corp. under its intellectual property |
16 | * 2.1. This is your license from Intel Corp. under its intellectual property |
17 | * rights. You may have additional license terms from the party that provided |
17 | * rights. You may have additional license terms from the party that provided |
18 | * you this software, covering your right to use that party's intellectual |
18 | * you this software, covering your right to use that party's intellectual |
19 | * property rights. |
19 | * property rights. |
20 | * |
20 | * |
21 | * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a |
21 | * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a |
22 | * copy of the source code appearing in this file ("Covered Code") an |
22 | * copy of the source code appearing in this file ("Covered Code") an |
23 | * irrevocable, perpetual, worldwide license under Intel's copyrights in the |
23 | * irrevocable, perpetual, worldwide license under Intel's copyrights in the |
24 | * base code distributed originally by Intel ("Original Intel Code") to copy, |
24 | * base code distributed originally by Intel ("Original Intel Code") to copy, |
25 | * make derivatives, distribute, use and display any portion of the Covered |
25 | * make derivatives, distribute, use and display any portion of the Covered |
26 | * Code in any form, with the right to sublicense such rights; and |
26 | * Code in any form, with the right to sublicense such rights; and |
27 | * |
27 | * |
28 | * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent |
28 | * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent |
29 | * license (with the right to sublicense), under only those claims of Intel |
29 | * license (with the right to sublicense), under only those claims of Intel |
30 | * patents that are infringed by the Original Intel Code, to make, use, sell, |
30 | * patents that are infringed by the Original Intel Code, to make, use, sell, |
31 | * offer to sell, and import the Covered Code and derivative works thereof |
31 | * offer to sell, and import the Covered Code and derivative works thereof |
32 | * solely to the minimum extent necessary to exercise the above copyright |
32 | * solely to the minimum extent necessary to exercise the above copyright |
33 | * license, and in no event shall the patent license extend to any additions |
33 | * license, and in no event shall the patent license extend to any additions |
34 | * to or modifications of the Original Intel Code. No other license or right |
34 | * to or modifications of the Original Intel Code. No other license or right |
35 | * is granted directly or by implication, estoppel or otherwise; |
35 | * is granted directly or by implication, estoppel or otherwise; |
36 | * |
36 | * |
37 | * The above copyright and patent license is granted only if the following |
37 | * The above copyright and patent license is granted only if the following |
38 | * conditions are met: |
38 | * conditions are met: |
39 | * |
39 | * |
40 | * 3. Conditions |
40 | * 3. Conditions |
41 | * |
41 | * |
42 | * 3.1. Redistribution of Source with Rights to Further Distribute Source. |
42 | * 3.1. Redistribution of Source with Rights to Further Distribute Source. |
43 | * Redistribution of source code of any substantial portion of the Covered |
43 | * Redistribution of source code of any substantial portion of the Covered |
44 | * Code or modification with rights to further distribute source must include |
44 | * Code or modification with rights to further distribute source must include |
45 | * the above Copyright Notice, the above License, this list of Conditions, |
45 | * the above Copyright Notice, the above License, this list of Conditions, |
46 | * and the following Disclaimer and Export Compliance provision. In addition, |
46 | * and the following Disclaimer and Export Compliance provision. In addition, |
47 | * Licensee must cause all Covered Code to which Licensee contributes to |
47 | * Licensee must cause all Covered Code to which Licensee contributes to |
48 | * contain a file documenting the changes Licensee made to create that Covered |
48 | * contain a file documenting the changes Licensee made to create that Covered |
49 | * Code and the date of any change. Licensee must include in that file the |
49 | * Code and the date of any change. Licensee must include in that file the |
50 | * documentation of any changes made by any predecessor Licensee. Licensee |
50 | * documentation of any changes made by any predecessor Licensee. Licensee |
51 | * must include a prominent statement that the modification is derived, |
51 | * must include a prominent statement that the modification is derived, |
52 | * directly or indirectly, from Original Intel Code. |
52 | * directly or indirectly, from Original Intel Code. |
53 | * |
53 | * |
54 | * 3.2. Redistribution of Source with no Rights to Further Distribute Source. |
54 | * 3.2. Redistribution of Source with no Rights to Further Distribute Source. |
55 | * Redistribution of source code of any substantial portion of the Covered |
55 | * Redistribution of source code of any substantial portion of the Covered |
56 | * Code or modification without rights to further distribute source must |
56 | * Code or modification without rights to further distribute source must |
57 | * include the following Disclaimer and Export Compliance provision in the |
57 | * include the following Disclaimer and Export Compliance provision in the |
58 | * documentation and/or other materials provided with distribution. In |
58 | * documentation and/or other materials provided with distribution. In |
59 | * addition, Licensee may not authorize further sublicense of source of any |
59 | * addition, Licensee may not authorize further sublicense of source of any |
60 | * portion of the Covered Code, and must include terms to the effect that the |
60 | * portion of the Covered Code, and must include terms to the effect that the |
61 | * license from Licensee to its licensee is limited to the intellectual |
61 | * license from Licensee to its licensee is limited to the intellectual |
62 | * property embodied in the software Licensee provides to its licensee, and |
62 | * property embodied in the software Licensee provides to its licensee, and |
63 | * not to intellectual property embodied in modifications its licensee may |
63 | * not to intellectual property embodied in modifications its licensee may |
64 | * make. |
64 | * make. |
65 | * |
65 | * |
66 | * 3.3. Redistribution of Executable. Redistribution in executable form of any |
66 | * 3.3. Redistribution of Executable. Redistribution in executable form of any |
67 | * substantial portion of the Covered Code or modification must reproduce the |
67 | * substantial portion of the Covered Code or modification must reproduce the |
68 | * above Copyright Notice, and the following Disclaimer and Export Compliance |
68 | * above Copyright Notice, and the following Disclaimer and Export Compliance |
69 | * provision in the documentation and/or other materials provided with the |
69 | * provision in the documentation and/or other materials provided with the |
70 | * distribution. |
70 | * distribution. |
71 | * |
71 | * |
72 | * 3.4. Intel retains all right, title, and interest in and to the Original |
72 | * 3.4. Intel retains all right, title, and interest in and to the Original |
73 | * Intel Code. |
73 | * Intel Code. |
74 | * |
74 | * |
75 | * 3.5. Neither the name Intel nor any other trademark owned or controlled by |
75 | * 3.5. Neither the name Intel nor any other trademark owned or controlled by |
76 | * Intel shall be used in advertising or otherwise to promote the sale, use or |
76 | * Intel shall be used in advertising or otherwise to promote the sale, use or |
77 | * other dealings in products derived from or relating to the Covered Code |
77 | * other dealings in products derived from or relating to the Covered Code |
78 | * without prior written authorization from Intel. |
78 | * without prior written authorization from Intel. |
79 | * |
79 | * |
80 | * 4. Disclaimer and Export Compliance |
80 | * 4. Disclaimer and Export Compliance |
81 | * |
81 | * |
82 | * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED |
82 | * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED |
83 | * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE |
83 | * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE |
84 | * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, |
84 | * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, |
85 | * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY |
85 | * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY |
86 | * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY |
86 | * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY |
87 | * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A |
87 | * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A |
88 | * PARTICULAR PURPOSE. |
88 | * PARTICULAR PURPOSE. |
89 | * |
89 | * |
90 | * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES |
90 | * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES |
91 | * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR |
91 | * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR |
92 | * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, |
92 | * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, |
93 | * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY |
93 | * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY |
94 | * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL |
94 | * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL |
95 | * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS |
95 | * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS |
96 | * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY |
96 | * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY |
97 | * LIMITED REMEDY. |
97 | * LIMITED REMEDY. |
98 | * |
98 | * |
99 | * 4.3. Licensee shall not export, either directly or indirectly, any of this |
99 | * 4.3. Licensee shall not export, either directly or indirectly, any of this |
100 | * software or system incorporating such software without first obtaining any |
100 | * software or system incorporating such software without first obtaining any |
101 | * required license or other approval from the U. S. Department of Commerce or |
101 | * required license or other approval from the U. S. Department of Commerce or |
102 | * any other agency or department of the United States Government. In the |
102 | * any other agency or department of the United States Government. In the |
103 | * event Licensee exports any such software from the United States or |
103 | * event Licensee exports any such software from the United States or |
104 | * re-exports any such software from a foreign destination, Licensee shall |
104 | * re-exports any such software from a foreign destination, Licensee shall |
105 | * ensure that the distribution and export/re-export of the software is in |
105 | * ensure that the distribution and export/re-export of the software is in |
106 | * compliance with all laws, regulations, orders, or other restrictions of the |
106 | * compliance with all laws, regulations, orders, or other restrictions of the |
107 | * U.S. Export Administration Regulations. Licensee agrees that neither it nor |
107 | * U.S. Export Administration Regulations. Licensee agrees that neither it nor |
108 | * any of its subsidiaries will export/re-export any technical data, process, |
108 | * any of its subsidiaries will export/re-export any technical data, process, |
109 | * software, or service, directly or indirectly, to any country for which the |
109 | * software, or service, directly or indirectly, to any country for which the |
110 | * United States government or any agency thereof requires an export license, |
110 | * United States government or any agency thereof requires an export license, |
111 | * other governmental approval, or letter of assurance, without first obtaining |
111 | * other governmental approval, or letter of assurance, without first obtaining |
112 | * such license, approval or letter. |
112 | * such license, approval or letter. |
113 | * |
113 | * |
114 | *****************************************************************************/ |
114 | *****************************************************************************/ |
115 | 115 | ||
116 | #define __DSWLOAD_C__ |
116 | #define __DSWLOAD_C__ |
117 | 117 | ||
118 | #include "acpi.h" |
118 | #include "acpi.h" |
119 | #include "accommon.h" |
119 | #include "accommon.h" |
120 | #include "acparser.h" |
120 | #include "acparser.h" |
121 | #include "amlcode.h" |
121 | #include "amlcode.h" |
122 | #include "acdispat.h" |
122 | #include "acdispat.h" |
123 | #include "acinterp.h" |
123 | #include "acinterp.h" |
124 | #include "acnamesp.h" |
124 | #include "acnamesp.h" |
125 | #include "acevents.h" |
- | |
126 | 125 | ||
127 | #ifdef ACPI_ASL_COMPILER |
126 | #ifdef ACPI_ASL_COMPILER |
128 | #include "acdisasm.h" |
127 | #include "acdisasm.h" |
129 | #endif |
128 | #endif |
130 | 129 | ||
131 | #define _COMPONENT ACPI_DISPATCHER |
130 | #define _COMPONENT ACPI_DISPATCHER |
132 | ACPI_MODULE_NAME ("dswload") |
131 | ACPI_MODULE_NAME ("dswload") |
133 | 132 | ||
134 | 133 | ||
135 | /******************************************************************************* |
134 | /******************************************************************************* |
136 | * |
135 | * |
137 | * FUNCTION: AcpiDsInitCallbacks |
136 | * FUNCTION: AcpiDsInitCallbacks |
138 | * |
137 | * |
139 | * PARAMETERS: WalkState - Current state of the parse tree walk |
138 | * PARAMETERS: WalkState - Current state of the parse tree walk |
140 | * PassNumber - 1, 2, or 3 |
139 | * PassNumber - 1, 2, or 3 |
141 | * |
140 | * |
142 | * RETURN: Status |
141 | * RETURN: Status |
143 | * |
142 | * |
144 | * DESCRIPTION: Init walk state callbacks |
143 | * DESCRIPTION: Init walk state callbacks |
145 | * |
144 | * |
146 | ******************************************************************************/ |
145 | ******************************************************************************/ |
147 | 146 | ||
148 | ACPI_STATUS |
147 | ACPI_STATUS |
149 | AcpiDsInitCallbacks ( |
148 | AcpiDsInitCallbacks ( |
150 | ACPI_WALK_STATE *WalkState, |
149 | ACPI_WALK_STATE *WalkState, |
151 | UINT32 PassNumber) |
150 | UINT32 PassNumber) |
152 | { |
151 | { |
153 | 152 | ||
154 | switch (PassNumber) |
153 | switch (PassNumber) |
155 | { |
154 | { |
156 | case 1: |
155 | case 1: |
157 | WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | |
156 | WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | |
158 | ACPI_PARSE_DELETE_TREE; |
157 | ACPI_PARSE_DELETE_TREE; |
159 | WalkState->DescendingCallback = AcpiDsLoad1BeginOp; |
158 | WalkState->DescendingCallback = AcpiDsLoad1BeginOp; |
160 | WalkState->AscendingCallback = AcpiDsLoad1EndOp; |
159 | WalkState->AscendingCallback = AcpiDsLoad1EndOp; |
161 | break; |
160 | break; |
162 | 161 | ||
163 | case 2: |
162 | case 2: |
164 | WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | |
163 | WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | |
165 | ACPI_PARSE_DELETE_TREE; |
164 | ACPI_PARSE_DELETE_TREE; |
166 | WalkState->DescendingCallback = AcpiDsLoad2BeginOp; |
165 | WalkState->DescendingCallback = AcpiDsLoad2BeginOp; |
167 | WalkState->AscendingCallback = AcpiDsLoad2EndOp; |
166 | WalkState->AscendingCallback = AcpiDsLoad2EndOp; |
168 | break; |
167 | break; |
169 | 168 | ||
170 | case 3: |
169 | case 3: |
171 | #ifndef ACPI_NO_METHOD_EXECUTION |
170 | #ifndef ACPI_NO_METHOD_EXECUTION |
172 | WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | |
171 | WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | |
173 | ACPI_PARSE_DELETE_TREE; |
172 | ACPI_PARSE_DELETE_TREE; |
174 | WalkState->DescendingCallback = AcpiDsExecBeginOp; |
173 | WalkState->DescendingCallback = AcpiDsExecBeginOp; |
175 | WalkState->AscendingCallback = AcpiDsExecEndOp; |
174 | WalkState->AscendingCallback = AcpiDsExecEndOp; |
176 | #endif |
175 | #endif |
177 | break; |
176 | break; |
178 | 177 | ||
179 | default: |
178 | default: |
180 | return (AE_BAD_PARAMETER); |
179 | return (AE_BAD_PARAMETER); |
181 | } |
180 | } |
182 | 181 | ||
183 | return (AE_OK); |
182 | return (AE_OK); |
184 | } |
183 | } |
185 | 184 | ||
186 | 185 | ||
187 | /******************************************************************************* |
186 | /******************************************************************************* |
188 | * |
187 | * |
189 | * FUNCTION: AcpiDsLoad1BeginOp |
188 | * FUNCTION: AcpiDsLoad1BeginOp |
190 | * |
189 | * |
191 | * PARAMETERS: WalkState - Current state of the parse tree walk |
190 | * PARAMETERS: WalkState - Current state of the parse tree walk |
192 | * OutOp - Where to return op if a new one is created |
191 | * OutOp - Where to return op if a new one is created |
193 | * |
192 | * |
194 | * RETURN: Status |
193 | * RETURN: Status |
195 | * |
194 | * |
196 | * DESCRIPTION: Descending callback used during the loading of ACPI tables. |
195 | * DESCRIPTION: Descending callback used during the loading of ACPI tables. |
197 | * |
196 | * |
198 | ******************************************************************************/ |
197 | ******************************************************************************/ |
199 | 198 | ||
200 | ACPI_STATUS |
199 | ACPI_STATUS |
201 | AcpiDsLoad1BeginOp ( |
200 | AcpiDsLoad1BeginOp ( |
202 | ACPI_WALK_STATE *WalkState, |
201 | ACPI_WALK_STATE *WalkState, |
203 | ACPI_PARSE_OBJECT **OutOp) |
202 | ACPI_PARSE_OBJECT **OutOp) |
204 | { |
203 | { |
205 | ACPI_PARSE_OBJECT *Op; |
204 | ACPI_PARSE_OBJECT *Op; |
206 | ACPI_NAMESPACE_NODE *Node; |
205 | ACPI_NAMESPACE_NODE *Node; |
207 | ACPI_STATUS Status; |
206 | ACPI_STATUS Status; |
208 | ACPI_OBJECT_TYPE ObjectType; |
207 | ACPI_OBJECT_TYPE ObjectType; |
209 | char *Path; |
208 | char *Path; |
210 | UINT32 Flags; |
209 | UINT32 Flags; |
211 | 210 | ||
212 | 211 | ||
213 | ACPI_FUNCTION_TRACE (DsLoad1BeginOp); |
212 | ACPI_FUNCTION_TRACE (DsLoad1BeginOp); |
214 | 213 | ||
215 | 214 | ||
216 | Op = WalkState->Op; |
215 | Op = WalkState->Op; |
217 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); |
216 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); |
218 | 217 | ||
219 | /* We are only interested in opcodes that have an associated name */ |
218 | /* We are only interested in opcodes that have an associated name */ |
220 | 219 | ||
221 | if (Op) |
220 | if (Op) |
222 | { |
221 | { |
223 | if (!(WalkState->OpInfo->Flags & AML_NAMED)) |
222 | if (!(WalkState->OpInfo->Flags & AML_NAMED)) |
224 | { |
223 | { |
225 | *OutOp = Op; |
224 | *OutOp = Op; |
226 | return_ACPI_STATUS (AE_OK); |
225 | return_ACPI_STATUS (AE_OK); |
227 | } |
226 | } |
228 | 227 | ||
229 | /* Check if this object has already been installed in the namespace */ |
228 | /* Check if this object has already been installed in the namespace */ |
230 | 229 | ||
231 | if (Op->Common.Node) |
230 | if (Op->Common.Node) |
232 | { |
231 | { |
233 | *OutOp = Op; |
232 | *OutOp = Op; |
234 | return_ACPI_STATUS (AE_OK); |
233 | return_ACPI_STATUS (AE_OK); |
235 | } |
234 | } |
236 | } |
235 | } |
237 | 236 | ||
238 | Path = AcpiPsGetNextNamestring (&WalkState->ParserState); |
237 | Path = AcpiPsGetNextNamestring (&WalkState->ParserState); |
239 | 238 | ||
240 | /* Map the raw opcode into an internal object type */ |
239 | /* Map the raw opcode into an internal object type */ |
241 | 240 | ||
242 | ObjectType = WalkState->OpInfo->ObjectType; |
241 | ObjectType = WalkState->OpInfo->ObjectType; |
243 | 242 | ||
244 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
243 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
245 | "State=%p Op=%p [%s]\n", WalkState, Op, AcpiUtGetTypeName (ObjectType))); |
244 | "State=%p Op=%p [%s]\n", WalkState, Op, AcpiUtGetTypeName (ObjectType))); |
246 | 245 | ||
247 | switch (WalkState->Opcode) |
246 | switch (WalkState->Opcode) |
248 | { |
247 | { |
249 | case AML_SCOPE_OP: |
248 | case AML_SCOPE_OP: |
250 | 249 | ||
251 | /* |
250 | /* |
252 | * The target name of the Scope() operator must exist at this point so |
251 | * The target name of the Scope() operator must exist at this point so |
253 | * that we can actually open the scope to enter new names underneath it. |
252 | * that we can actually open the scope to enter new names underneath it. |
254 | * Allow search-to-root for single namesegs. |
253 | * Allow search-to-root for single namesegs. |
255 | */ |
254 | */ |
256 | Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, |
255 | Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, |
257 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); |
256 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); |
258 | #ifdef ACPI_ASL_COMPILER |
257 | #ifdef ACPI_ASL_COMPILER |
259 | if (Status == AE_NOT_FOUND) |
258 | if (Status == AE_NOT_FOUND) |
260 | { |
259 | { |
261 | /* |
260 | /* |
262 | * Table disassembly: |
261 | * Table disassembly: |
263 | * Target of Scope() not found. Generate an External for it, and |
262 | * Target of Scope() not found. Generate an External for it, and |
264 | * insert the name into the namespace. |
263 | * insert the name into the namespace. |
265 | */ |
264 | */ |
266 | AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0); |
265 | AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_DEVICE, 0); |
267 | Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, |
266 | Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, |
268 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, |
267 | ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, |
269 | WalkState, &Node); |
268 | WalkState, &Node); |
270 | } |
269 | } |
271 | #endif |
270 | #endif |
272 | if (ACPI_FAILURE (Status)) |
271 | if (ACPI_FAILURE (Status)) |
273 | { |
272 | { |
274 | ACPI_ERROR_NAMESPACE (Path, Status); |
273 | ACPI_ERROR_NAMESPACE (Path, Status); |
275 | return_ACPI_STATUS (Status); |
274 | return_ACPI_STATUS (Status); |
276 | } |
275 | } |
277 | 276 | ||
278 | /* |
277 | /* |
279 | * Check to make sure that the target is |
278 | * Check to make sure that the target is |
280 | * one of the opcodes that actually opens a scope |
279 | * one of the opcodes that actually opens a scope |
281 | */ |
280 | */ |
282 | switch (Node->Type) |
281 | switch (Node->Type) |
283 | { |
282 | { |
284 | case ACPI_TYPE_ANY: |
283 | case ACPI_TYPE_ANY: |
285 | case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ |
284 | case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ |
286 | case ACPI_TYPE_DEVICE: |
285 | case ACPI_TYPE_DEVICE: |
287 | case ACPI_TYPE_POWER: |
286 | case ACPI_TYPE_POWER: |
288 | case ACPI_TYPE_PROCESSOR: |
287 | case ACPI_TYPE_PROCESSOR: |
289 | case ACPI_TYPE_THERMAL: |
288 | case ACPI_TYPE_THERMAL: |
290 | 289 | ||
291 | /* These are acceptable types */ |
290 | /* These are acceptable types */ |
292 | break; |
291 | break; |
293 | 292 | ||
294 | case ACPI_TYPE_INTEGER: |
293 | case ACPI_TYPE_INTEGER: |
295 | case ACPI_TYPE_STRING: |
294 | case ACPI_TYPE_STRING: |
296 | case ACPI_TYPE_BUFFER: |
295 | case ACPI_TYPE_BUFFER: |
297 | 296 | ||
298 | /* |
297 | /* |
299 | * These types we will allow, but we will change the type. |
298 | * These types we will allow, but we will change the type. |
300 | * This enables some existing code of the form: |
299 | * This enables some existing code of the form: |
301 | * |
300 | * |
302 | * Name (DEB, 0) |
301 | * Name (DEB, 0) |
303 | * Scope (DEB) { ... } |
302 | * Scope (DEB) { ... } |
304 | * |
303 | * |
305 | * Note: silently change the type here. On the second pass, |
304 | * Note: silently change the type here. On the second pass, |
306 | * we will report a warning |
305 | * we will report a warning |
307 | */ |
306 | */ |
308 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
307 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, |
309 | "Type override - [%4.4s] had invalid type (%s) " |
308 | "Type override - [%4.4s] had invalid type (%s) " |
310 | "for Scope operator, changed to type ANY\n", |
309 | "for Scope operator, changed to type ANY\n", |
311 | AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type))); |
310 | AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type))); |
312 | 311 | ||
313 | Node->Type = ACPI_TYPE_ANY; |
312 | Node->Type = ACPI_TYPE_ANY; |
314 | WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; |
313 | WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; |
315 | break; |
314 | break; |
316 | 315 | ||
317 | default: |
316 | default: |
318 | 317 | ||
319 | /* All other types are an error */ |
318 | /* All other types are an error */ |
320 | 319 | ||
321 | ACPI_ERROR ((AE_INFO, |
320 | ACPI_ERROR ((AE_INFO, |
322 | "Invalid type (%s) for target of " |
321 | "Invalid type (%s) for target of " |
323 | "Scope operator [%4.4s] (Cannot override)", |
322 | "Scope operator [%4.4s] (Cannot override)", |
324 | AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node))); |
323 | AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node))); |
325 | 324 | ||
326 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
325 | return_ACPI_STATUS (AE_AML_OPERAND_TYPE); |
327 | } |
326 | } |
328 | break; |
327 | break; |
329 | 328 | ||
330 | 329 | ||
331 | default: |
330 | default: |
332 | /* |
331 | /* |
333 | * For all other named opcodes, we will enter the name into |
332 | * For all other named opcodes, we will enter the name into |
334 | * the namespace. |
333 | * the namespace. |
335 | * |
334 | * |
336 | * Setup the search flags. |
335 | * Setup the search flags. |
337 | * Since we are entering a name into the namespace, we do not want to |
336 | * Since we are entering a name into the namespace, we do not want to |
338 | * enable the search-to-root upsearch. |
337 | * enable the search-to-root upsearch. |
339 | * |
338 | * |
340 | * There are only two conditions where it is acceptable that the name |
339 | * There are only two conditions where it is acceptable that the name |
341 | * already exists: |
340 | * already exists: |
342 | * 1) the Scope() operator can reopen a scoping object that was |
341 | * 1) the Scope() operator can reopen a scoping object that was |
343 | * previously defined (Scope, Method, Device, etc.) |
342 | * previously defined (Scope, Method, Device, etc.) |
344 | * 2) Whenever we are parsing a deferred opcode (OpRegion, Buffer, |
343 | * 2) Whenever we are parsing a deferred opcode (OpRegion, Buffer, |
345 | * BufferField, or Package), the name of the object is already |
344 | * BufferField, or Package), the name of the object is already |
346 | * in the namespace. |
345 | * in the namespace. |
347 | */ |
346 | */ |
348 | if (WalkState->DeferredNode) |
347 | if (WalkState->DeferredNode) |
349 | { |
348 | { |
350 | /* This name is already in the namespace, get the node */ |
349 | /* This name is already in the namespace, get the node */ |
351 | 350 | ||
352 | Node = WalkState->DeferredNode; |
351 | Node = WalkState->DeferredNode; |
353 | Status = AE_OK; |
352 | Status = AE_OK; |
354 | break; |
353 | break; |
355 | } |
354 | } |
356 | 355 | ||
357 | /* |
356 | /* |
358 | * If we are executing a method, do not create any namespace objects |
357 | * If we are executing a method, do not create any namespace objects |
359 | * during the load phase, only during execution. |
358 | * during the load phase, only during execution. |
360 | */ |
359 | */ |
361 | if (WalkState->MethodNode) |
360 | if (WalkState->MethodNode) |
362 | { |
361 | { |
363 | Node = NULL; |
362 | Node = NULL; |
364 | Status = AE_OK; |
363 | Status = AE_OK; |
365 | break; |
364 | break; |
366 | } |
365 | } |
367 | 366 | ||
368 | Flags = ACPI_NS_NO_UPSEARCH; |
367 | Flags = ACPI_NS_NO_UPSEARCH; |
369 | if ((WalkState->Opcode != AML_SCOPE_OP) && |
368 | if ((WalkState->Opcode != AML_SCOPE_OP) && |
370 | (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP))) |
369 | (!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP))) |
371 | { |
370 | { |
372 | Flags |= ACPI_NS_ERROR_IF_FOUND; |
371 | Flags |= ACPI_NS_ERROR_IF_FOUND; |
373 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", |
372 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n", |
374 | AcpiUtGetTypeName (ObjectType))); |
373 | AcpiUtGetTypeName (ObjectType))); |
375 | } |
374 | } |
376 | else |
375 | else |
377 | { |
376 | { |
378 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
377 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
379 | "[%s] Both Find or Create allowed\n", |
378 | "[%s] Both Find or Create allowed\n", |
380 | AcpiUtGetTypeName (ObjectType))); |
379 | AcpiUtGetTypeName (ObjectType))); |
381 | } |
380 | } |
382 | 381 | ||
383 | /* |
382 | /* |
384 | * Enter the named type into the internal namespace. We enter the name |
383 | * Enter the named type into the internal namespace. We enter the name |
385 | * as we go downward in the parse tree. Any necessary subobjects that |
384 | * as we go downward in the parse tree. Any necessary subobjects that |
386 | * involve arguments to the opcode must be created as we go back up the |
385 | * involve arguments to the opcode must be created as we go back up the |
387 | * parse tree later. |
386 | * parse tree later. |
388 | */ |
387 | */ |
389 | Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, |
388 | Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, |
390 | ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); |
389 | ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); |
391 | if (ACPI_FAILURE (Status)) |
390 | if (ACPI_FAILURE (Status)) |
392 | { |
391 | { |
393 | if (Status == AE_ALREADY_EXISTS) |
392 | if (Status == AE_ALREADY_EXISTS) |
394 | { |
393 | { |
395 | /* The name already exists in this scope */ |
394 | /* The name already exists in this scope */ |
396 | 395 | ||
397 | if (Node->Flags & ANOBJ_IS_EXTERNAL) |
396 | if (Node->Flags & ANOBJ_IS_EXTERNAL) |
398 | { |
397 | { |
399 | /* |
398 | /* |
400 | * Allow one create on an object or segment that was |
399 | * Allow one create on an object or segment that was |
401 | * previously declared External |
400 | * previously declared External |
402 | */ |
401 | */ |
403 | Node->Flags &= ~ANOBJ_IS_EXTERNAL; |
402 | Node->Flags &= ~ANOBJ_IS_EXTERNAL; |
404 | Node->Type = (UINT8) ObjectType; |
403 | Node->Type = (UINT8) ObjectType; |
405 | 404 | ||
406 | /* Just retyped a node, probably will need to open a scope */ |
405 | /* Just retyped a node, probably will need to open a scope */ |
407 | 406 | ||
408 | if (AcpiNsOpensScope (ObjectType)) |
407 | if (AcpiNsOpensScope (ObjectType)) |
409 | { |
408 | { |
410 | Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); |
409 | Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); |
411 | if (ACPI_FAILURE (Status)) |
410 | if (ACPI_FAILURE (Status)) |
412 | { |
411 | { |
413 | return_ACPI_STATUS (Status); |
412 | return_ACPI_STATUS (Status); |
414 | } |
413 | } |
415 | } |
414 | } |
416 | 415 | ||
417 | Status = AE_OK; |
416 | Status = AE_OK; |
418 | } |
417 | } |
419 | } |
418 | } |
420 | 419 | ||
421 | if (ACPI_FAILURE (Status)) |
420 | if (ACPI_FAILURE (Status)) |
422 | { |
421 | { |
423 | ACPI_ERROR_NAMESPACE (Path, Status); |
422 | ACPI_ERROR_NAMESPACE (Path, Status); |
424 | return_ACPI_STATUS (Status); |
423 | return_ACPI_STATUS (Status); |
425 | } |
424 | } |
426 | } |
425 | } |
427 | break; |
426 | break; |
428 | } |
427 | } |
429 | 428 | ||
430 | /* Common exit */ |
429 | /* Common exit */ |
431 | 430 | ||
432 | if (!Op) |
431 | if (!Op) |
433 | { |
432 | { |
434 | /* Create a new op */ |
433 | /* Create a new op */ |
435 | 434 | ||
436 | Op = AcpiPsAllocOp (WalkState->Opcode); |
435 | Op = AcpiPsAllocOp (WalkState->Opcode); |
437 | if (!Op) |
436 | if (!Op) |
438 | { |
437 | { |
439 | return_ACPI_STATUS (AE_NO_MEMORY); |
438 | return_ACPI_STATUS (AE_NO_MEMORY); |
440 | } |
439 | } |
441 | } |
440 | } |
442 | 441 | ||
443 | /* Initialize the op */ |
442 | /* Initialize the op */ |
444 | 443 | ||
445 | #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) |
444 | #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) |
446 | Op->Named.Path = ACPI_CAST_PTR (UINT8, Path); |
445 | Op->Named.Path = ACPI_CAST_PTR (UINT8, Path); |
447 | #endif |
446 | #endif |
448 | 447 | ||
449 | if (Node) |
448 | if (Node) |
450 | { |
449 | { |
451 | /* |
450 | /* |
452 | * Put the Node in the "op" object that the parser uses, so we |
451 | * Put the Node in the "op" object that the parser uses, so we |
453 | * can get it again quickly when this scope is closed |
452 | * can get it again quickly when this scope is closed |
454 | */ |
453 | */ |
455 | Op->Common.Node = Node; |
454 | Op->Common.Node = Node; |
456 | Op->Named.Name = Node->Name.Integer; |
455 | Op->Named.Name = Node->Name.Integer; |
457 | } |
456 | } |
458 | 457 | ||
459 | AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op); |
458 | AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op); |
460 | *OutOp = Op; |
459 | *OutOp = Op; |
461 | return_ACPI_STATUS (Status); |
460 | return_ACPI_STATUS (Status); |
462 | } |
461 | } |
463 | 462 | ||
464 | 463 | ||
465 | /******************************************************************************* |
464 | /******************************************************************************* |
466 | * |
465 | * |
467 | * FUNCTION: AcpiDsLoad1EndOp |
466 | * FUNCTION: AcpiDsLoad1EndOp |
468 | * |
467 | * |
469 | * PARAMETERS: WalkState - Current state of the parse tree walk |
468 | * PARAMETERS: WalkState - Current state of the parse tree walk |
470 | * |
469 | * |
471 | * RETURN: Status |
470 | * RETURN: Status |
472 | * |
471 | * |
473 | * DESCRIPTION: Ascending callback used during the loading of the namespace, |
472 | * DESCRIPTION: Ascending callback used during the loading of the namespace, |
474 | * both control methods and everything else. |
473 | * both control methods and everything else. |
475 | * |
474 | * |
476 | ******************************************************************************/ |
475 | ******************************************************************************/ |
477 | 476 | ||
478 | ACPI_STATUS |
477 | ACPI_STATUS |
479 | AcpiDsLoad1EndOp ( |
478 | AcpiDsLoad1EndOp ( |
480 | ACPI_WALK_STATE *WalkState) |
479 | ACPI_WALK_STATE *WalkState) |
481 | { |
480 | { |
482 | ACPI_PARSE_OBJECT *Op; |
481 | ACPI_PARSE_OBJECT *Op; |
483 | ACPI_OBJECT_TYPE ObjectType; |
482 | ACPI_OBJECT_TYPE ObjectType; |
484 | ACPI_STATUS Status = AE_OK; |
483 | ACPI_STATUS Status = AE_OK; |
485 | 484 | ||
486 | 485 | ||
487 | ACPI_FUNCTION_TRACE (DsLoad1EndOp); |
486 | ACPI_FUNCTION_TRACE (DsLoad1EndOp); |
488 | 487 | ||
489 | 488 | ||
490 | Op = WalkState->Op; |
489 | Op = WalkState->Op; |
491 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); |
490 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); |
492 | 491 | ||
493 | /* We are only interested in opcodes that have an associated name */ |
492 | /* We are only interested in opcodes that have an associated name */ |
494 | 493 | ||
495 | if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD))) |
494 | if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD))) |
496 | { |
495 | { |
497 | return_ACPI_STATUS (AE_OK); |
496 | return_ACPI_STATUS (AE_OK); |
498 | } |
497 | } |
499 | 498 | ||
500 | /* Get the object type to determine if we should pop the scope */ |
499 | /* Get the object type to determine if we should pop the scope */ |
501 | 500 | ||
502 | ObjectType = WalkState->OpInfo->ObjectType; |
501 | ObjectType = WalkState->OpInfo->ObjectType; |
503 | 502 | ||
504 | #ifndef ACPI_NO_METHOD_EXECUTION |
503 | #ifndef ACPI_NO_METHOD_EXECUTION |
505 | if (WalkState->OpInfo->Flags & AML_FIELD) |
504 | if (WalkState->OpInfo->Flags & AML_FIELD) |
506 | { |
505 | { |
507 | /* |
506 | /* |
508 | * If we are executing a method, do not create any namespace objects |
507 | * If we are executing a method, do not create any namespace objects |
509 | * during the load phase, only during execution. |
508 | * during the load phase, only during execution. |
510 | */ |
509 | */ |
511 | if (!WalkState->MethodNode) |
510 | if (!WalkState->MethodNode) |
512 | { |
511 | { |
513 | if (WalkState->Opcode == AML_FIELD_OP || |
512 | if (WalkState->Opcode == AML_FIELD_OP || |
514 | WalkState->Opcode == AML_BANK_FIELD_OP || |
513 | WalkState->Opcode == AML_BANK_FIELD_OP || |
515 | WalkState->Opcode == AML_INDEX_FIELD_OP) |
514 | WalkState->Opcode == AML_INDEX_FIELD_OP) |
516 | { |
515 | { |
517 | Status = AcpiDsInitFieldObjects (Op, WalkState); |
516 | Status = AcpiDsInitFieldObjects (Op, WalkState); |
518 | } |
517 | } |
519 | } |
518 | } |
520 | return_ACPI_STATUS (Status); |
519 | return_ACPI_STATUS (Status); |
521 | } |
520 | } |
522 | 521 | ||
523 | /* |
522 | /* |
524 | * If we are executing a method, do not create any namespace objects |
523 | * If we are executing a method, do not create any namespace objects |
525 | * during the load phase, only during execution. |
524 | * during the load phase, only during execution. |
526 | */ |
525 | */ |
527 | if (!WalkState->MethodNode) |
526 | if (!WalkState->MethodNode) |
528 | { |
527 | { |
529 | if (Op->Common.AmlOpcode == AML_REGION_OP) |
528 | if (Op->Common.AmlOpcode == AML_REGION_OP) |
530 | { |
529 | { |
531 | Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, |
530 | Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, |
532 | (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), |
531 | (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), |
533 | WalkState); |
532 | WalkState); |
534 | if (ACPI_FAILURE (Status)) |
533 | if (ACPI_FAILURE (Status)) |
535 | { |
534 | { |
536 | return_ACPI_STATUS (Status); |
535 | return_ACPI_STATUS (Status); |
537 | } |
536 | } |
538 | } |
537 | } |
539 | else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) |
538 | else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP) |
540 | { |
539 | { |
541 | Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, |
540 | Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, |
542 | REGION_DATA_TABLE, WalkState); |
541 | ACPI_ADR_SPACE_DATA_TABLE, WalkState); |
543 | if (ACPI_FAILURE (Status)) |
542 | if (ACPI_FAILURE (Status)) |
544 | { |
543 | { |
545 | return_ACPI_STATUS (Status); |
544 | return_ACPI_STATUS (Status); |
546 | } |
545 | } |
547 | } |
546 | } |
548 | } |
547 | } |
549 | #endif |
548 | #endif |
550 | 549 | ||
551 | if (Op->Common.AmlOpcode == AML_NAME_OP) |
550 | if (Op->Common.AmlOpcode == AML_NAME_OP) |
552 | { |
551 | { |
553 | /* For Name opcode, get the object type from the argument */ |
552 | /* For Name opcode, get the object type from the argument */ |
554 | 553 | ||
555 | if (Op->Common.Value.Arg) |
554 | if (Op->Common.Value.Arg) |
556 | { |
555 | { |
557 | ObjectType = (AcpiPsGetOpcodeInfo ( |
556 | ObjectType = (AcpiPsGetOpcodeInfo ( |
558 | (Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType; |
557 | (Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType; |
559 | 558 | ||
560 | /* Set node type if we have a namespace node */ |
559 | /* Set node type if we have a namespace node */ |
561 | 560 | ||
562 | if (Op->Common.Node) |
561 | if (Op->Common.Node) |
563 | { |
562 | { |
564 | Op->Common.Node->Type = (UINT8) ObjectType; |
563 | Op->Common.Node->Type = (UINT8) ObjectType; |
565 | } |
564 | } |
566 | } |
565 | } |
567 | } |
566 | } |
568 | 567 | ||
569 | /* |
568 | /* |
570 | * If we are executing a method, do not create any namespace objects |
569 | * If we are executing a method, do not create any namespace objects |
571 | * during the load phase, only during execution. |
570 | * during the load phase, only during execution. |
572 | */ |
571 | */ |
573 | if (!WalkState->MethodNode) |
572 | if (!WalkState->MethodNode) |
574 | { |
573 | { |
575 | if (Op->Common.AmlOpcode == AML_METHOD_OP) |
574 | if (Op->Common.AmlOpcode == AML_METHOD_OP) |
576 | { |
575 | { |
577 | /* |
576 | /* |
578 | * MethodOp PkgLength NameString MethodFlags TermList |
577 | * MethodOp PkgLength NameString MethodFlags TermList |
579 | * |
578 | * |
580 | * Note: We must create the method node/object pair as soon as we |
579 | * Note: We must create the method node/object pair as soon as we |
581 | * see the method declaration. This allows later pass1 parsing |
580 | * see the method declaration. This allows later pass1 parsing |
582 | * of invocations of the method (need to know the number of |
581 | * of invocations of the method (need to know the number of |
583 | * arguments.) |
582 | * arguments.) |
584 | */ |
583 | */ |
585 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
584 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
586 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", |
585 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", |
587 | WalkState, Op, Op->Named.Node)); |
586 | WalkState, Op, Op->Named.Node)); |
588 | 587 | ||
589 | if (!AcpiNsGetAttachedObject (Op->Named.Node)) |
588 | if (!AcpiNsGetAttachedObject (Op->Named.Node)) |
590 | { |
589 | { |
591 | WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); |
590 | WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); |
592 | WalkState->NumOperands = 1; |
591 | WalkState->NumOperands = 1; |
593 | 592 | ||
594 | Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); |
593 | Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); |
595 | if (ACPI_SUCCESS (Status)) |
594 | if (ACPI_SUCCESS (Status)) |
596 | { |
595 | { |
597 | Status = AcpiExCreateMethod (Op->Named.Data, |
596 | Status = AcpiExCreateMethod (Op->Named.Data, |
598 | Op->Named.Length, WalkState); |
597 | Op->Named.Length, WalkState); |
599 | } |
598 | } |
600 | 599 | ||
601 | WalkState->Operands[0] = NULL; |
600 | WalkState->Operands[0] = NULL; |
602 | WalkState->NumOperands = 0; |
601 | WalkState->NumOperands = 0; |
603 | 602 | ||
604 | if (ACPI_FAILURE (Status)) |
603 | if (ACPI_FAILURE (Status)) |
605 | { |
604 | { |
606 | return_ACPI_STATUS (Status); |
605 | return_ACPI_STATUS (Status); |
607 | } |
606 | } |
608 | } |
607 | } |
609 | } |
608 | } |
610 | } |
609 | } |
611 | 610 | ||
612 | /* Pop the scope stack (only if loading a table) */ |
611 | /* Pop the scope stack (only if loading a table) */ |
613 | 612 | ||
614 | if (!WalkState->MethodNode && |
613 | if (!WalkState->MethodNode && |
615 | AcpiNsOpensScope (ObjectType)) |
614 | AcpiNsOpensScope (ObjectType)) |
616 | { |
615 | { |
617 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", |
616 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", |
618 | AcpiUtGetTypeName (ObjectType), Op)); |
617 | AcpiUtGetTypeName (ObjectType), Op)); |
619 | 618 | ||
620 | Status = AcpiDsScopeStackPop (WalkState); |
619 | Status = AcpiDsScopeStackPop (WalkState); |
621 | } |
620 | } |
622 | 621 | ||
623 | return_ACPI_STATUS (Status); |
622 | return_ACPI_STATUS (Status); |
624 | } |
623 | } |
625 | - | ||
626 | - | ||
627 | /******************************************************************************* |
- | |
628 | * |
- | |
629 | * FUNCTION: AcpiDsLoad2BeginOp |
- | |
630 | * |
- | |
631 | * PARAMETERS: WalkState - Current state of the parse tree walk |
- | |
632 | * OutOp - Wher to return op if a new one is created |
- | |
633 | * |
- | |
634 | * RETURN: Status |
- | |
635 | * |
- | |
636 | * DESCRIPTION: Descending callback used during the loading of ACPI tables. |
- | |
637 | * |
- | |
638 | ******************************************************************************/ |
- | |
639 | - | ||
640 | ACPI_STATUS |
- | |
641 | AcpiDsLoad2BeginOp ( |
- | |
642 | ACPI_WALK_STATE *WalkState, |
- | |
643 | ACPI_PARSE_OBJECT **OutOp) |
- | |
644 | { |
- | |
645 | ACPI_PARSE_OBJECT *Op; |
- | |
646 | ACPI_NAMESPACE_NODE *Node; |
- | |
647 | ACPI_STATUS Status; |
- | |
648 | ACPI_OBJECT_TYPE ObjectType; |
- | |
649 | char *BufferPtr; |
- | |
650 | UINT32 Flags; |
- | |
651 | - | ||
652 | - | ||
653 | ACPI_FUNCTION_TRACE (DsLoad2BeginOp); |
- | |
654 | - | ||
655 | - | ||
656 | Op = WalkState->Op; |
- | |
657 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); |
- | |
658 | - | ||
659 | if (Op) |
- | |
660 | { |
- | |
661 | if ((WalkState->ControlState) && |
- | |
662 | (WalkState->ControlState->Common.State == |
- | |
663 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) |
- | |
664 | { |
- | |
665 | /* We are executing a while loop outside of a method */ |
- | |
666 | - | ||
667 | Status = AcpiDsExecBeginOp (WalkState, OutOp); |
- | |
668 | return_ACPI_STATUS (Status); |
- | |
669 | } |
- | |
670 | - | ||
671 | /* We only care about Namespace opcodes here */ |
- | |
672 | - | ||
673 | if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && |
- | |
674 | (WalkState->Opcode != AML_INT_NAMEPATH_OP)) || |
- | |
675 | (!(WalkState->OpInfo->Flags & AML_NAMED))) |
- | |
676 | { |
- | |
677 | return_ACPI_STATUS (AE_OK); |
- | |
678 | } |
- | |
679 | - | ||
680 | /* Get the name we are going to enter or lookup in the namespace */ |
- | |
681 | - | ||
682 | if (WalkState->Opcode == AML_INT_NAMEPATH_OP) |
- | |
683 | { |
- | |
684 | /* For Namepath op, get the path string */ |
- | |
685 | - | ||
686 | BufferPtr = Op->Common.Value.String; |
- | |
687 | if (!BufferPtr) |
- | |
688 | { |
- | |
689 | /* No name, just exit */ |
- | |
690 | - | ||
691 | return_ACPI_STATUS (AE_OK); |
- | |
692 | } |
- | |
693 | } |
- | |
694 | else |
- | |
695 | { |
- | |
696 | /* Get name from the op */ |
- | |
697 | - | ||
698 | BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name); |
- | |
699 | } |
- | |
700 | } |
- | |
701 | else |
- | |
702 | { |
- | |
703 | /* Get the namestring from the raw AML */ |
- | |
704 | - | ||
705 | BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState); |
- | |
706 | } |
- | |
707 | - | ||
708 | /* Map the opcode into an internal object type */ |
- | |
709 | - | ||
710 | ObjectType = WalkState->OpInfo->ObjectType; |
- | |
711 | - | ||
712 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
- | |
713 | "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType)); |
- | |
714 | - | ||
715 | switch (WalkState->Opcode) |
- | |
716 | { |
- | |
717 | case AML_FIELD_OP: |
- | |
718 | case AML_BANK_FIELD_OP: |
- | |
719 | case AML_INDEX_FIELD_OP: |
- | |
720 | - | ||
721 | Node = NULL; |
- | |
722 | Status = AE_OK; |
- | |
723 | break; |
- | |
724 | - | ||
725 | case AML_INT_NAMEPATH_OP: |
- | |
726 | /* |
- | |
727 | * The NamePath is an object reference to an existing object. |
- | |
728 | * Don't enter the name into the namespace, but look it up |
- | |
729 | * for use later. |
- | |
730 | */ |
- | |
731 | Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, |
- | |
732 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
- | |
733 | WalkState, &(Node)); |
- | |
734 | break; |
- | |
735 | - | ||
736 | case AML_SCOPE_OP: |
- | |
737 | - | ||
738 | /* Special case for Scope(\) -> refers to the Root node */ |
- | |
739 | - | ||
740 | if (Op && (Op->Named.Node == AcpiGbl_RootNode)) |
- | |
741 | { |
- | |
742 | Node = Op->Named.Node; |
- | |
743 | - | ||
744 | Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); |
- | |
745 | if (ACPI_FAILURE (Status)) |
- | |
746 | { |
- | |
747 | return_ACPI_STATUS (Status); |
- | |
748 | } |
- | |
749 | } |
- | |
750 | else |
- | |
751 | { |
- | |
752 | /* |
- | |
753 | * The Path is an object reference to an existing object. |
- | |
754 | * Don't enter the name into the namespace, but look it up |
- | |
755 | * for use later. |
- | |
756 | */ |
- | |
757 | Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, |
- | |
758 | ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, |
- | |
759 | WalkState, &(Node)); |
- | |
760 | if (ACPI_FAILURE (Status)) |
- | |
761 | { |
- | |
762 | #ifdef ACPI_ASL_COMPILER |
- | |
763 | if (Status == AE_NOT_FOUND) |
- | |
764 | { |
- | |
765 | Status = AE_OK; |
- | |
766 | } |
- | |
767 | else |
- | |
768 | { |
- | |
769 | ACPI_ERROR_NAMESPACE (BufferPtr, Status); |
- | |
770 | } |
- | |
771 | #else |
- | |
772 | ACPI_ERROR_NAMESPACE (BufferPtr, Status); |
- | |
773 | #endif |
- | |
774 | return_ACPI_STATUS (Status); |
- | |
775 | } |
- | |
776 | } |
- | |
777 | - | ||
778 | /* |
- | |
779 | * We must check to make sure that the target is |
- | |
780 | * one of the opcodes that actually opens a scope |
- | |
781 | */ |
- | |
782 | switch (Node->Type) |
- | |
783 | { |
- | |
784 | case ACPI_TYPE_ANY: |
- | |
785 | case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ |
- | |
786 | case ACPI_TYPE_DEVICE: |
- | |
787 | case ACPI_TYPE_POWER: |
- | |
788 | case ACPI_TYPE_PROCESSOR: |
- | |
789 | case ACPI_TYPE_THERMAL: |
- | |
790 | - | ||
791 | /* These are acceptable types */ |
- | |
792 | break; |
- | |
793 | - | ||
794 | case ACPI_TYPE_INTEGER: |
- | |
795 | case ACPI_TYPE_STRING: |
- | |
796 | case ACPI_TYPE_BUFFER: |
- | |
797 | - | ||
798 | /* |
- | |
799 | * These types we will allow, but we will change the type. |
- | |
800 | * This enables some existing code of the form: |
- | |
801 | * |
- | |
802 | * Name (DEB, 0) |
- | |
803 | * Scope (DEB) { ... } |
- | |
804 | */ |
- | |
805 | ACPI_WARNING ((AE_INFO, |
- | |
806 | "Type override - [%4.4s] had invalid type (%s) " |
- | |
807 | "for Scope operator, changed to type ANY\n", |
- | |
808 | AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type))); |
- | |
809 | - | ||
810 | Node->Type = ACPI_TYPE_ANY; |
- | |
811 | WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY; |
- | |
812 | break; |
- | |
813 | - | ||
814 | default: |
- | |
815 | - | ||
816 | /* All other types are an error */ |
- | |
817 | - | ||
818 | ACPI_ERROR ((AE_INFO, |
- | |
819 | "Invalid type (%s) for target of " |
- | |
820 | "Scope operator [%4.4s] (Cannot override)", |
- | |
821 | AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node))); |
- | |
822 | - | ||
823 | return (AE_AML_OPERAND_TYPE); |
- | |
824 | } |
- | |
825 | break; |
- | |
826 | - | ||
827 | default: |
- | |
828 | - | ||
829 | /* All other opcodes */ |
- | |
830 | - | ||
831 | if (Op && Op->Common.Node) |
- | |
832 | { |
- | |
833 | /* This op/node was previously entered into the namespace */ |
- | |
834 | - | ||
835 | Node = Op->Common.Node; |
- | |
836 | - | ||
837 | if (AcpiNsOpensScope (ObjectType)) |
- | |
838 | { |
- | |
839 | Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState); |
- | |
840 | if (ACPI_FAILURE (Status)) |
- | |
841 | { |
- | |
842 | return_ACPI_STATUS (Status); |
- | |
843 | } |
- | |
844 | } |
- | |
845 | - | ||
846 | return_ACPI_STATUS (AE_OK); |
- | |
847 | } |
- | |
848 | - | ||
849 | /* |
- | |
850 | * Enter the named type into the internal namespace. We enter the name |
- | |
851 | * as we go downward in the parse tree. Any necessary subobjects that |
- | |
852 | * involve arguments to the opcode must be created as we go back up the |
- | |
853 | * parse tree later. |
- | |
854 | * |
- | |
855 | * Note: Name may already exist if we are executing a deferred opcode. |
- | |
856 | */ |
- | |
857 | if (WalkState->DeferredNode) |
- | |
858 | { |
- | |
859 | /* This name is already in the namespace, get the node */ |
- | |
860 | - | ||
861 | Node = WalkState->DeferredNode; |
- | |
862 | Status = AE_OK; |
- | |
863 | break; |
- | |
864 | } |
- | |
865 | - | ||
866 | Flags = ACPI_NS_NO_UPSEARCH; |
- | |
867 | if (WalkState->PassNumber == ACPI_IMODE_EXECUTE) |
- | |
868 | { |
- | |
869 | /* Execution mode, node cannot already exist, node is temporary */ |
- | |
870 | - | ||
871 | Flags |= ACPI_NS_ERROR_IF_FOUND; |
- | |
872 | - | ||
873 | if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) |
- | |
874 | { |
- | |
875 | Flags |= ACPI_NS_TEMPORARY; |
- | |
876 | } |
- | |
877 | } |
- | |
878 | - | ||
879 | /* Add new entry or lookup existing entry */ |
- | |
880 | - | ||
881 | Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, |
- | |
882 | ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node); |
- | |
883 | - | ||
884 | if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY)) |
- | |
885 | { |
- | |
886 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
- | |
887 | "***New Node [%4.4s] %p is temporary\n", |
- | |
888 | AcpiUtGetNodeName (Node), Node)); |
- | |
889 | } |
- | |
890 | break; |
- | |
891 | } |
- | |
892 | - | ||
893 | if (ACPI_FAILURE (Status)) |
- | |
894 | { |
- | |
895 | ACPI_ERROR_NAMESPACE (BufferPtr, Status); |
- | |
896 | return_ACPI_STATUS (Status); |
- | |
897 | } |
- | |
898 | - | ||
899 | if (!Op) |
- | |
900 | { |
- | |
901 | /* Create a new op */ |
- | |
902 | - | ||
903 | Op = AcpiPsAllocOp (WalkState->Opcode); |
- | |
904 | if (!Op) |
- | |
905 | { |
- | |
906 | return_ACPI_STATUS (AE_NO_MEMORY); |
- | |
907 | } |
- | |
908 | - | ||
909 | /* Initialize the new op */ |
- | |
910 | - | ||
911 | if (Node) |
- | |
912 | { |
- | |
913 | Op->Named.Name = Node->Name.Integer; |
- | |
914 | } |
- | |
915 | *OutOp = Op; |
- | |
916 | } |
- | |
917 | - | ||
918 | /* |
- | |
919 | * Put the Node in the "op" object that the parser uses, so we |
- | |
920 | * can get it again quickly when this scope is closed |
- | |
921 | */ |
- | |
922 | Op->Common.Node = Node; |
- | |
923 | return_ACPI_STATUS (Status); |
- | |
924 | } |
- | |
925 | - | ||
926 | - | ||
927 | /******************************************************************************* |
- | |
928 | * |
- | |
929 | * FUNCTION: AcpiDsLoad2EndOp |
- | |
930 | * |
- | |
931 | * PARAMETERS: WalkState - Current state of the parse tree walk |
- | |
932 | * |
- | |
933 | * RETURN: Status |
- | |
934 | * |
- | |
935 | * DESCRIPTION: Ascending callback used during the loading of the namespace, |
- | |
936 | * both control methods and everything else. |
- | |
937 | * |
- | |
938 | ******************************************************************************/ |
- | |
939 | - | ||
940 | ACPI_STATUS |
- | |
941 | AcpiDsLoad2EndOp ( |
- | |
942 | ACPI_WALK_STATE *WalkState) |
- | |
943 | { |
- | |
944 | ACPI_PARSE_OBJECT *Op; |
- | |
945 | ACPI_STATUS Status = AE_OK; |
- | |
946 | ACPI_OBJECT_TYPE ObjectType; |
- | |
947 | ACPI_NAMESPACE_NODE *Node; |
- | |
948 | ACPI_PARSE_OBJECT *Arg; |
- | |
949 | ACPI_NAMESPACE_NODE *NewNode; |
- | |
950 | #ifndef ACPI_NO_METHOD_EXECUTION |
- | |
951 | UINT32 i; |
- | |
952 | UINT8 RegionSpace; |
- | |
953 | #endif |
- | |
954 | - | ||
955 | - | ||
956 | ACPI_FUNCTION_TRACE (DsLoad2EndOp); |
- | |
957 | - | ||
958 | Op = WalkState->Op; |
- | |
959 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", |
- | |
960 | WalkState->OpInfo->Name, Op, WalkState)); |
- | |
961 | - | ||
962 | /* Check if opcode had an associated namespace object */ |
- | |
963 | - | ||
964 | if (!(WalkState->OpInfo->Flags & AML_NSOBJECT)) |
- | |
965 | { |
- | |
966 | return_ACPI_STATUS (AE_OK); |
- | |
967 | } |
- | |
968 | - | ||
969 | if (Op->Common.AmlOpcode == AML_SCOPE_OP) |
- | |
970 | { |
- | |
971 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
- | |
972 | "Ending scope Op=%p State=%p\n", Op, WalkState)); |
- | |
973 | } |
- | |
974 | - | ||
975 | ObjectType = WalkState->OpInfo->ObjectType; |
- | |
976 | - | ||
977 | /* |
- | |
978 | * Get the Node/name from the earlier lookup |
- | |
979 | * (It was saved in the *op structure) |
- | |
980 | */ |
- | |
981 | Node = Op->Common.Node; |
- | |
982 | - | ||
983 | /* |
- | |
984 | * Put the Node on the object stack (Contains the ACPI Name of |
- | |
985 | * this object) |
- | |
986 | */ |
- | |
987 | WalkState->Operands[0] = (void *) Node; |
- | |
988 | WalkState->NumOperands = 1; |
- | |
989 | - | ||
990 | /* Pop the scope stack */ |
- | |
991 | - | ||
992 | if (AcpiNsOpensScope (ObjectType) && |
- | |
993 | (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP)) |
- | |
994 | { |
- | |
995 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", |
- | |
996 | AcpiUtGetTypeName (ObjectType), Op)); |
- | |
997 | - | ||
998 | Status = AcpiDsScopeStackPop (WalkState); |
- | |
999 | if (ACPI_FAILURE (Status)) |
- | |
1000 | { |
- | |
1001 | goto Cleanup; |
- | |
1002 | } |
- | |
1003 | } |
- | |
1004 | - | ||
1005 | /* |
- | |
1006 | * Named operations are as follows: |
- | |
1007 | * |
- | |
1008 | * AML_ALIAS |
- | |
1009 | * AML_BANKFIELD |
- | |
1010 | * AML_CREATEBITFIELD |
- | |
1011 | * AML_CREATEBYTEFIELD |
- | |
1012 | * AML_CREATEDWORDFIELD |
- | |
1013 | * AML_CREATEFIELD |
- | |
1014 | * AML_CREATEQWORDFIELD |
- | |
1015 | * AML_CREATEWORDFIELD |
- | |
1016 | * AML_DATA_REGION |
- | |
1017 | * AML_DEVICE |
- | |
1018 | * AML_EVENT |
- | |
1019 | * AML_FIELD |
- | |
1020 | * AML_INDEXFIELD |
- | |
1021 | * AML_METHOD |
- | |
1022 | * AML_METHODCALL |
- | |
1023 | * AML_MUTEX |
- | |
1024 | * AML_NAME |
- | |
1025 | * AML_NAMEDFIELD |
- | |
1026 | * AML_OPREGION |
- | |
1027 | * AML_POWERRES |
- | |
1028 | * AML_PROCESSOR |
- | |
1029 | * AML_SCOPE |
- | |
1030 | * AML_THERMALZONE |
- | |
1031 | */ |
- | |
1032 | - | ||
1033 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
- | |
1034 | "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", |
- | |
1035 | AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node)); |
- | |
1036 | - | ||
1037 | /* Decode the opcode */ |
- | |
1038 | - | ||
1039 | Arg = Op->Common.Value.Arg; |
- | |
1040 | - | ||
1041 | switch (WalkState->OpInfo->Type) |
- | |
1042 | { |
- | |
1043 | #ifndef ACPI_NO_METHOD_EXECUTION |
- | |
1044 | - | ||
1045 | case AML_TYPE_CREATE_FIELD: |
- | |
1046 | /* |
- | |
1047 | * Create the field object, but the field buffer and index must |
- | |
1048 | * be evaluated later during the execution phase |
- | |
1049 | */ |
- | |
1050 | Status = AcpiDsCreateBufferField (Op, WalkState); |
- | |
1051 | break; |
- | |
1052 | - | ||
1053 | - | ||
1054 | case AML_TYPE_NAMED_FIELD: |
- | |
1055 | /* |
- | |
1056 | * If we are executing a method, initialize the field |
- | |
1057 | */ |
- | |
1058 | if (WalkState->MethodNode) |
- | |
1059 | { |
- | |
1060 | Status = AcpiDsInitFieldObjects (Op, WalkState); |
- | |
1061 | } |
- | |
1062 | - | ||
1063 | switch (Op->Common.AmlOpcode) |
- | |
1064 | { |
- | |
1065 | case AML_INDEX_FIELD_OP: |
- | |
1066 | - | ||
1067 | Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, |
- | |
1068 | WalkState); |
- | |
1069 | break; |
- | |
1070 | - | ||
1071 | case AML_BANK_FIELD_OP: |
- | |
1072 | - | ||
1073 | Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState); |
- | |
1074 | break; |
- | |
1075 | - | ||
1076 | case AML_FIELD_OP: |
- | |
1077 | - | ||
1078 | Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState); |
- | |
1079 | break; |
- | |
1080 | - | ||
1081 | default: |
- | |
1082 | /* All NAMED_FIELD opcodes must be handled above */ |
- | |
1083 | break; |
- | |
1084 | } |
- | |
1085 | break; |
- | |
1086 | - | ||
1087 | - | ||
1088 | case AML_TYPE_NAMED_SIMPLE: |
- | |
1089 | - | ||
1090 | Status = AcpiDsCreateOperands (WalkState, Arg); |
- | |
1091 | if (ACPI_FAILURE (Status)) |
- | |
1092 | { |
- | |
1093 | goto Cleanup; |
- | |
1094 | } |
- | |
1095 | - | ||
1096 | switch (Op->Common.AmlOpcode) |
- | |
1097 | { |
- | |
1098 | case AML_PROCESSOR_OP: |
- | |
1099 | - | ||
1100 | Status = AcpiExCreateProcessor (WalkState); |
- | |
1101 | break; |
- | |
1102 | - | ||
1103 | case AML_POWER_RES_OP: |
- | |
1104 | - | ||
1105 | Status = AcpiExCreatePowerResource (WalkState); |
- | |
1106 | break; |
- | |
1107 | - | ||
1108 | case AML_MUTEX_OP: |
- | |
1109 | - | ||
1110 | Status = AcpiExCreateMutex (WalkState); |
- | |
1111 | break; |
- | |
1112 | - | ||
1113 | case AML_EVENT_OP: |
- | |
1114 | - | ||
1115 | Status = AcpiExCreateEvent (WalkState); |
- | |
1116 | break; |
- | |
1117 | - | ||
1118 | - | ||
1119 | case AML_ALIAS_OP: |
- | |
1120 | - | ||
1121 | Status = AcpiExCreateAlias (WalkState); |
- | |
1122 | break; |
- | |
1123 | - | ||
1124 | default: |
- | |
1125 | /* Unknown opcode */ |
- | |
1126 | - | ||
1127 | Status = AE_OK; |
- | |
1128 | goto Cleanup; |
- | |
1129 | } |
- | |
1130 | - | ||
1131 | /* Delete operands */ |
- | |
1132 | - | ||
1133 | for (i = 1; i < WalkState->NumOperands; i++) |
- | |
1134 | { |
- | |
1135 | AcpiUtRemoveReference (WalkState->Operands[i]); |
- | |
1136 | WalkState->Operands[i] = NULL; |
- | |
1137 | } |
- | |
1138 | - | ||
1139 | break; |
- | |
1140 | #endif /* ACPI_NO_METHOD_EXECUTION */ |
- | |
1141 | - | ||
1142 | case AML_TYPE_NAMED_COMPLEX: |
- | |
1143 | - | ||
1144 | switch (Op->Common.AmlOpcode) |
- | |
1145 | { |
- | |
1146 | #ifndef ACPI_NO_METHOD_EXECUTION |
- | |
1147 | case AML_REGION_OP: |
- | |
1148 | case AML_DATA_REGION_OP: |
- | |
1149 | - | ||
1150 | if (Op->Common.AmlOpcode == AML_REGION_OP) |
- | |
1151 | { |
- | |
1152 | RegionSpace = (ACPI_ADR_SPACE_TYPE) |
- | |
1153 | ((Op->Common.Value.Arg)->Common.Value.Integer); |
- | |
1154 | } |
- | |
1155 | else |
- | |
1156 | { |
- | |
1157 | RegionSpace = REGION_DATA_TABLE; |
- | |
1158 | } |
- | |
1159 | - | ||
1160 | /* |
- | |
1161 | * The OpRegion is not fully parsed at this time. The only valid |
- | |
1162 | * argument is the SpaceId. (We must save the address of the |
- | |
1163 | * AML of the address and length operands) |
- | |
1164 | * |
- | |
1165 | * If we have a valid region, initialize it. The namespace is |
- | |
1166 | * unlocked at this point. |
- | |
1167 | * |
- | |
1168 | * Need to unlock interpreter if it is locked (if we are running |
- | |
1169 | * a control method), in order to allow _REG methods to be run |
- | |
1170 | * during AcpiEvInitializeRegion. |
- | |
1171 | */ |
- | |
1172 | if (WalkState->MethodNode) |
- | |
1173 | { |
- | |
1174 | /* |
- | |
1175 | * Executing a method: initialize the region and unlock |
- | |
1176 | * the interpreter |
- | |
1177 | */ |
- | |
1178 | Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, |
- | |
1179 | RegionSpace, WalkState); |
- | |
1180 | if (ACPI_FAILURE (Status)) |
- | |
1181 | { |
- | |
1182 | return (Status); |
- | |
1183 | } |
- | |
1184 | - | ||
1185 | AcpiExExitInterpreter (); |
- | |
1186 | } |
- | |
1187 | - | ||
1188 | Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), |
- | |
1189 | FALSE); |
- | |
1190 | if (WalkState->MethodNode) |
- | |
1191 | { |
- | |
1192 | AcpiExEnterInterpreter (); |
- | |
1193 | } |
- | |
1194 | - | ||
1195 | if (ACPI_FAILURE (Status)) |
- | |
1196 | { |
- | |
1197 | /* |
- | |
1198 | * If AE_NOT_EXIST is returned, it is not fatal |
- | |
1199 | * because many regions get created before a handler |
- | |
1200 | * is installed for said region. |
- | |
1201 | */ |
- | |
1202 | if (AE_NOT_EXIST == Status) |
- | |
1203 | { |
- | |
1204 | Status = AE_OK; |
- | |
1205 | } |
- | |
1206 | } |
- | |
1207 | break; |
- | |
1208 | - | ||
1209 | - | ||
1210 | case AML_NAME_OP: |
- | |
1211 | - | ||
1212 | Status = AcpiDsCreateNode (WalkState, Node, Op); |
- | |
1213 | break; |
- | |
1214 | - | ||
1215 | - | ||
1216 | case AML_METHOD_OP: |
- | |
1217 | /* |
- | |
1218 | * MethodOp PkgLength NameString MethodFlags TermList |
- | |
1219 | * |
- | |
1220 | * Note: We must create the method node/object pair as soon as we |
- | |
1221 | * see the method declaration. This allows later pass1 parsing |
- | |
1222 | * of invocations of the method (need to know the number of |
- | |
1223 | * arguments.) |
- | |
1224 | */ |
- | |
1225 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
- | |
1226 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", |
- | |
1227 | WalkState, Op, Op->Named.Node)); |
- | |
1228 | - | ||
1229 | if (!AcpiNsGetAttachedObject (Op->Named.Node)) |
- | |
1230 | { |
- | |
1231 | WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node); |
- | |
1232 | WalkState->NumOperands = 1; |
- | |
1233 | - | ||
1234 | Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); |
- | |
1235 | if (ACPI_SUCCESS (Status)) |
- | |
1236 | { |
- | |
1237 | Status = AcpiExCreateMethod (Op->Named.Data, |
- | |
1238 | Op->Named.Length, WalkState); |
- | |
1239 | } |
- | |
1240 | WalkState->Operands[0] = NULL; |
- | |
1241 | WalkState->NumOperands = 0; |
- | |
1242 | - | ||
1243 | if (ACPI_FAILURE (Status)) |
- | |
1244 | { |
- | |
1245 | return_ACPI_STATUS (Status); |
- | |
1246 | } |
- | |
1247 | } |
- | |
1248 | break; |
- | |
1249 | - | ||
1250 | #endif /* ACPI_NO_METHOD_EXECUTION */ |
- | |
1251 | - | ||
1252 | default: |
- | |
1253 | /* All NAMED_COMPLEX opcodes must be handled above */ |
- | |
1254 | break; |
- | |
1255 | } |
- | |
1256 | break; |
- | |
1257 | - | ||
1258 | - | ||
1259 | case AML_CLASS_INTERNAL: |
- | |
1260 | - | ||
1261 | /* case AML_INT_NAMEPATH_OP: */ |
- | |
1262 | break; |
- | |
1263 | - | ||
1264 | - | ||
1265 | case AML_CLASS_METHOD_CALL: |
- | |
1266 | - | ||
1267 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
- | |
1268 | "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", |
- | |
1269 | WalkState, Op, Node)); |
- | |
1270 | - | ||
1271 | /* |
- | |
1272 | * Lookup the method name and save the Node |
- | |
1273 | */ |
- | |
1274 | Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, |
- | |
1275 | ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, |
- | |
1276 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, |
- | |
1277 | WalkState, &(NewNode)); |
- | |
1278 | if (ACPI_SUCCESS (Status)) |
- | |
1279 | { |
- | |
1280 | /* |
- | |
1281 | * Make sure that what we found is indeed a method |
- | |
1282 | * We didn't search for a method on purpose, to see if the name |
- | |
1283 | * would resolve |
- | |
1284 | */ |
- | |
1285 | if (NewNode->Type != ACPI_TYPE_METHOD) |
- | |
1286 | { |
- | |
1287 | Status = AE_AML_OPERAND_TYPE; |
- | |
1288 | } |
- | |
1289 | - | ||
1290 | /* We could put the returned object (Node) on the object stack for |
- | |
1291 | * later, but for now, we will put it in the "op" object that the |
- | |
1292 | * parser uses, so we can get it again at the end of this scope |
- | |
1293 | */ |
- | |
1294 | Op->Common.Node = NewNode; |
- | |
1295 | } |
- | |
1296 | else |
- | |
1297 | { |
- | |
1298 | ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); |
- | |
1299 | } |
- | |
1300 | break; |
- | |
1301 | - | ||
1302 | - | ||
1303 | default: |
- | |
1304 | break; |
- | |
1305 | } |
- | |
1306 | - | ||
1307 | Cleanup: |
- | |
1308 | - | ||
1309 | /* Remove the Node pushed at the very beginning */ |
- | |
1310 | - | ||
1311 | WalkState->Operands[0] = NULL; |
- | |
1312 | WalkState->NumOperands = 0; |
- | |
1313 | return_ACPI_STATUS (Status); |
- | |
1314 | }> |
- | |
1315 | - | ||
1316 | - |