Rev 1498 | 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: asllookup- Namespace lookup |
3 | * Module Name: asllookup- Namespace lookup |
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 | 116 | ||
117 | #include "aslcompiler.h" |
117 | #include "aslcompiler.h" |
118 | #include "aslcompiler.y.h" |
118 | #include "aslcompiler.y.h" |
119 | 119 | ||
120 | #include "acparser.h" |
120 | #include "acparser.h" |
121 | #include "amlcode.h" |
121 | #include "amlcode.h" |
122 | #include "acnamesp.h" |
122 | #include "acnamesp.h" |
123 | #include "acdispat.h" |
123 | #include "acdispat.h" |
124 | 124 | ||
125 | 125 | ||
126 | #define _COMPONENT ACPI_COMPILER |
126 | #define _COMPONENT ACPI_COMPILER |
127 | ACPI_MODULE_NAME ("asllookup") |
127 | ACPI_MODULE_NAME ("asllookup") |
128 | 128 | ||
129 | /* Local prototypes */ |
129 | /* Local prototypes */ |
130 | 130 | ||
131 | static ACPI_STATUS |
131 | static ACPI_STATUS |
132 | LsCompareOneNamespaceObject ( |
132 | LsCompareOneNamespaceObject ( |
133 | ACPI_HANDLE ObjHandle, |
133 | ACPI_HANDLE ObjHandle, |
134 | UINT32 Level, |
134 | UINT32 Level, |
135 | void *Context, |
135 | void *Context, |
136 | void **ReturnValue); |
136 | void **ReturnValue); |
137 | 137 | ||
138 | static ACPI_STATUS |
138 | static ACPI_STATUS |
139 | LsDoOneNamespaceObject ( |
139 | LsDoOneNamespaceObject ( |
140 | ACPI_HANDLE ObjHandle, |
140 | ACPI_HANDLE ObjHandle, |
141 | UINT32 Level, |
141 | UINT32 Level, |
142 | void *Context, |
142 | void *Context, |
143 | void **ReturnValue); |
143 | void **ReturnValue); |
144 | 144 | ||
145 | static BOOLEAN |
145 | static BOOLEAN |
146 | LkObjectExists ( |
146 | LkObjectExists ( |
147 | char *Name); |
147 | char *Name); |
148 | 148 | ||
149 | static void |
149 | static void |
150 | LkCheckFieldRange ( |
150 | LkCheckFieldRange ( |
151 | ACPI_PARSE_OBJECT *Op, |
151 | ACPI_PARSE_OBJECT *Op, |
152 | UINT32 RegionBitLength, |
152 | UINT32 RegionBitLength, |
153 | UINT32 FieldBitOffset, |
153 | UINT32 FieldBitOffset, |
154 | UINT32 FieldBitLength, |
154 | UINT32 FieldBitLength, |
155 | UINT32 AccessBitWidth); |
155 | UINT32 AccessBitWidth); |
156 | 156 | ||
157 | static ACPI_STATUS |
157 | static ACPI_STATUS |
158 | LkNamespaceLocateBegin ( |
158 | LkNamespaceLocateBegin ( |
159 | ACPI_PARSE_OBJECT *Op, |
159 | ACPI_PARSE_OBJECT *Op, |
160 | UINT32 Level, |
160 | UINT32 Level, |
161 | void *Context); |
161 | void *Context); |
162 | 162 | ||
163 | static ACPI_STATUS |
163 | static ACPI_STATUS |
164 | LkNamespaceLocateEnd ( |
164 | LkNamespaceLocateEnd ( |
165 | ACPI_PARSE_OBJECT *Op, |
165 | ACPI_PARSE_OBJECT *Op, |
166 | UINT32 Level, |
166 | UINT32 Level, |
167 | void *Context); |
167 | void *Context); |
168 | 168 | ||
169 | static ACPI_STATUS |
169 | static ACPI_STATUS |
170 | LkIsObjectUsed ( |
170 | LkIsObjectUsed ( |
171 | ACPI_HANDLE ObjHandle, |
171 | ACPI_HANDLE ObjHandle, |
172 | UINT32 Level, |
172 | UINT32 Level, |
173 | void *Context, |
173 | void *Context, |
174 | void **ReturnValue); |
174 | void **ReturnValue); |
175 | 175 | ||
176 | static ACPI_STATUS |
176 | static ACPI_STATUS |
177 | LsDoOnePathname ( |
177 | LsDoOnePathname ( |
178 | ACPI_HANDLE ObjHandle, |
178 | ACPI_HANDLE ObjHandle, |
179 | UINT32 Level, |
179 | UINT32 Level, |
180 | void *Context, |
180 | void *Context, |
181 | void **ReturnValue); |
181 | void **ReturnValue); |
182 | - | ||
183 | void |
- | |
184 | LsSetupNsList ( |
- | |
185 | void *Handle); |
- | |
186 | 182 | ||
187 | ACPI_PARSE_OBJECT * |
183 | static ACPI_PARSE_OBJECT * |
188 | LkGetNameOp ( |
184 | LkGetNameOp ( |
189 | ACPI_PARSE_OBJECT *Op); |
185 | ACPI_PARSE_OBJECT *Op); |
190 | 186 | ||
191 | 187 | ||
192 | /******************************************************************************* |
188 | /******************************************************************************* |
193 | * |
189 | * |
194 | * FUNCTION: LsDoOneNamespaceObject |
190 | * FUNCTION: LsDoOneNamespaceObject |
195 | * |
191 | * |
196 | * PARAMETERS: ACPI_WALK_CALLBACK |
192 | * PARAMETERS: ACPI_WALK_CALLBACK |
197 | * |
193 | * |
198 | * RETURN: Status |
194 | * RETURN: Status |
199 | * |
195 | * |
200 | * DESCRIPTION: Dump a namespace object to the namespace output file. |
196 | * DESCRIPTION: Dump a namespace object to the namespace output file. |
201 | * Called during the walk of the namespace to dump all objects. |
197 | * Called during the walk of the namespace to dump all objects. |
202 | * |
198 | * |
203 | ******************************************************************************/ |
199 | ******************************************************************************/ |
204 | 200 | ||
205 | static ACPI_STATUS |
201 | static ACPI_STATUS |
206 | LsDoOneNamespaceObject ( |
202 | LsDoOneNamespaceObject ( |
207 | ACPI_HANDLE ObjHandle, |
203 | ACPI_HANDLE ObjHandle, |
208 | UINT32 Level, |
204 | UINT32 Level, |
209 | void *Context, |
205 | void *Context, |
210 | void **ReturnValue) |
206 | void **ReturnValue) |
211 | { |
207 | { |
212 | ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; |
208 | ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; |
213 | ACPI_OPERAND_OBJECT *ObjDesc; |
209 | ACPI_OPERAND_OBJECT *ObjDesc; |
214 | ACPI_PARSE_OBJECT *Op; |
210 | ACPI_PARSE_OBJECT *Op; |
215 | 211 | ||
216 | 212 | ||
217 | Gbl_NumNamespaceObjects++; |
213 | Gbl_NumNamespaceObjects++; |
218 | 214 | ||
219 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s", |
215 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5u [%u] %*s %4.4s - %s", |
220 | Gbl_NumNamespaceObjects, Level, (Level * 3), " ", |
216 | Gbl_NumNamespaceObjects, Level, (Level * 3), " ", |
221 | &Node->Name, |
217 | &Node->Name, |
222 | AcpiUtGetTypeName (Node->Type)); |
218 | AcpiUtGetTypeName (Node->Type)); |
223 | 219 | ||
224 | Op = Node->Op; |
220 | Op = Node->Op; |
225 | ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object); |
221 | ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object); |
226 | 222 | ||
227 | if (!Op) |
223 | if (!Op) |
228 | { |
224 | { |
229 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n"); |
225 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n"); |
230 | return (AE_OK); |
226 | return (AE_OK); |
231 | } |
227 | } |
232 | 228 | ||
233 | 229 | ||
234 | if ((ObjDesc) && |
230 | if ((ObjDesc) && |
235 | (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)) |
231 | (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND)) |
236 | { |
232 | { |
237 | switch (Node->Type) |
233 | switch (Node->Type) |
238 | { |
234 | { |
239 | case ACPI_TYPE_INTEGER: |
235 | case ACPI_TYPE_INTEGER: |
240 | 236 | ||
241 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
237 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
242 | " [Initial Value 0x%8.8X%8.8X]", |
238 | " [Initial Value 0x%8.8X%8.8X]", |
243 | ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); |
239 | ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); |
244 | break; |
240 | break; |
245 | 241 | ||
246 | 242 | ||
247 | case ACPI_TYPE_STRING: |
243 | case ACPI_TYPE_STRING: |
248 | 244 | ||
249 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
245 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
250 | " [Initial Value \"%s\"]", |
246 | " [Initial Value \"%s\"]", |
251 | ObjDesc->String.Pointer); |
247 | ObjDesc->String.Pointer); |
252 | break; |
248 | break; |
253 | 249 | ||
254 | default: |
250 | default: |
255 | /* Nothing to do for other types */ |
251 | /* Nothing to do for other types */ |
256 | break; |
252 | break; |
257 | } |
253 | } |
258 | 254 | ||
259 | } |
255 | } |
260 | else |
256 | else |
261 | { |
257 | { |
262 | switch (Node->Type) |
258 | switch (Node->Type) |
263 | { |
259 | { |
264 | case ACPI_TYPE_INTEGER: |
260 | case ACPI_TYPE_INTEGER: |
265 | 261 | ||
266 | if (Op->Asl.ParseOpcode == PARSEOP_NAME) |
262 | if (Op->Asl.ParseOpcode == PARSEOP_NAME) |
267 | { |
263 | { |
268 | Op = Op->Asl.Child; |
264 | Op = Op->Asl.Child; |
269 | } |
265 | } |
270 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
266 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
271 | (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) |
267 | (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) |
272 | { |
268 | { |
273 | Op = Op->Asl.Next; |
269 | Op = Op->Asl.Next; |
274 | } |
270 | } |
275 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
271 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
276 | " [Initial Value 0x%8.8X%8.8X]", |
272 | " [Initial Value 0x%8.8X%8.8X]", |
277 | ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); |
273 | ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); |
278 | break; |
274 | break; |
279 | 275 | ||
280 | 276 | ||
281 | case ACPI_TYPE_STRING: |
277 | case ACPI_TYPE_STRING: |
282 | 278 | ||
283 | if (Op->Asl.ParseOpcode == PARSEOP_NAME) |
279 | if (Op->Asl.ParseOpcode == PARSEOP_NAME) |
284 | { |
280 | { |
285 | Op = Op->Asl.Child; |
281 | Op = Op->Asl.Child; |
286 | } |
282 | } |
287 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
283 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
288 | (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) |
284 | (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) |
289 | { |
285 | { |
290 | Op = Op->Asl.Next; |
286 | Op = Op->Asl.Next; |
291 | } |
287 | } |
292 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
288 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
293 | " [Initial Value \"%s\"]", |
289 | " [Initial Value \"%s\"]", |
294 | Op->Asl.Value.String); |
290 | Op->Asl.Value.String); |
295 | break; |
291 | break; |
296 | 292 | ||
297 | 293 | ||
298 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
294 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
299 | 295 | ||
300 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
296 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
301 | (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) |
297 | (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) |
302 | { |
298 | { |
303 | Op = Op->Asl.Child; |
299 | Op = Op->Asl.Child; |
304 | } |
300 | } |
305 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
301 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
306 | " [Offset 0x%04X Length 0x%04X bits]", |
302 | " [Offset 0x%04X Length 0x%04X bits]", |
307 | Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer); |
303 | Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer); |
308 | break; |
304 | break; |
309 | 305 | ||
310 | 306 | ||
311 | case ACPI_TYPE_BUFFER_FIELD: |
307 | case ACPI_TYPE_BUFFER_FIELD: |
312 | 308 | ||
313 | switch (Op->Asl.ParseOpcode) |
309 | switch (Op->Asl.ParseOpcode) |
314 | { |
310 | { |
315 | case PARSEOP_CREATEBYTEFIELD: |
311 | case PARSEOP_CREATEBYTEFIELD: |
316 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BYTE ( 8 bit)]"); |
312 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BYTE ( 8 bit)]"); |
317 | break; |
313 | break; |
318 | 314 | ||
319 | case PARSEOP_CREATEDWORDFIELD: |
315 | case PARSEOP_CREATEDWORDFIELD: |
320 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [DWORD (32 bit)]"); |
316 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [DWORD (32 bit)]"); |
321 | break; |
317 | break; |
322 | 318 | ||
323 | case PARSEOP_CREATEQWORDFIELD: |
319 | case PARSEOP_CREATEQWORDFIELD: |
324 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [QWORD (64 bit)]"); |
320 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [QWORD (64 bit)]"); |
325 | break; |
321 | break; |
326 | 322 | ||
327 | case PARSEOP_CREATEWORDFIELD: |
323 | case PARSEOP_CREATEWORDFIELD: |
328 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [WORD (16 bit)]"); |
324 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [WORD (16 bit)]"); |
329 | break; |
325 | break; |
330 | 326 | ||
331 | case PARSEOP_CREATEBITFIELD: |
327 | case PARSEOP_CREATEBITFIELD: |
332 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BIT ( 1 bit)]"); |
328 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BIT ( 1 bit)]"); |
333 | break; |
329 | break; |
334 | 330 | ||
335 | case PARSEOP_CREATEFIELD: |
331 | case PARSEOP_CREATEFIELD: |
336 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Arbitrary Bit Field]"); |
332 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Arbitrary Bit Field]"); |
337 | break; |
333 | break; |
338 | 334 | ||
339 | default: |
335 | default: |
340 | break; |
336 | break; |
341 | 337 | ||
342 | } |
338 | } |
343 | break; |
339 | break; |
344 | 340 | ||
345 | 341 | ||
346 | case ACPI_TYPE_PACKAGE: |
342 | case ACPI_TYPE_PACKAGE: |
347 | 343 | ||
348 | if (Op->Asl.ParseOpcode == PARSEOP_NAME) |
344 | if (Op->Asl.ParseOpcode == PARSEOP_NAME) |
349 | { |
345 | { |
350 | Op = Op->Asl.Child; |
346 | Op = Op->Asl.Child; |
351 | } |
347 | } |
352 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
348 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
353 | (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) |
349 | (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) |
354 | { |
350 | { |
355 | Op = Op->Asl.Next; |
351 | Op = Op->Asl.Next; |
356 | } |
352 | } |
357 | Op = Op->Asl.Child; |
353 | Op = Op->Asl.Child; |
358 | 354 | ||
359 | if ((Op->Asl.ParseOpcode == PARSEOP_BYTECONST) || |
355 | if ((Op->Asl.ParseOpcode == PARSEOP_BYTECONST) || |
360 | (Op->Asl.ParseOpcode == PARSEOP_RAW_DATA)) |
356 | (Op->Asl.ParseOpcode == PARSEOP_RAW_DATA)) |
361 | { |
357 | { |
362 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
358 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
363 | " [Initial Length 0x%.2X elements]", |
359 | " [Initial Length 0x%.2X elements]", |
364 | Op->Asl.Value.Integer); |
360 | Op->Asl.Value.Integer); |
365 | } |
361 | } |
366 | break; |
362 | break; |
367 | 363 | ||
368 | 364 | ||
369 | case ACPI_TYPE_BUFFER: |
365 | case ACPI_TYPE_BUFFER: |
370 | 366 | ||
371 | if (Op->Asl.ParseOpcode == PARSEOP_NAME) |
367 | if (Op->Asl.ParseOpcode == PARSEOP_NAME) |
372 | { |
368 | { |
373 | Op = Op->Asl.Child; |
369 | Op = Op->Asl.Child; |
374 | } |
370 | } |
375 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
371 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
376 | (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) |
372 | (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) |
377 | { |
373 | { |
378 | Op = Op->Asl.Next; |
374 | Op = Op->Asl.Next; |
379 | } |
375 | } |
380 | Op = Op->Asl.Child; |
376 | Op = Op->Asl.Child; |
381 | 377 | ||
382 | if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER)) |
378 | if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER)) |
383 | { |
379 | { |
384 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
380 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
385 | " [Initial Length 0x%.2X bytes]", |
381 | " [Initial Length 0x%.2X bytes]", |
386 | Op->Asl.Value.Integer); |
382 | Op->Asl.Value.Integer); |
387 | } |
383 | } |
388 | break; |
384 | break; |
389 | 385 | ||
390 | 386 | ||
391 | case ACPI_TYPE_METHOD: |
387 | case ACPI_TYPE_METHOD: |
392 | 388 | ||
393 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
389 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
394 | " [Code Length 0x%.4X bytes]", |
390 | " [Code Length 0x%.4X bytes]", |
395 | Op->Asl.AmlSubtreeLength); |
391 | Op->Asl.AmlSubtreeLength); |
396 | break; |
392 | break; |
397 | 393 | ||
398 | 394 | ||
399 | case ACPI_TYPE_LOCAL_RESOURCE: |
395 | case ACPI_TYPE_LOCAL_RESOURCE: |
400 | 396 | ||
401 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
397 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
402 | " [Desc Offset 0x%.4X Bytes]", Node->Value); |
398 | " [Desc Offset 0x%.4X Bytes]", Node->Value); |
403 | break; |
399 | break; |
404 | 400 | ||
405 | 401 | ||
406 | case ACPI_TYPE_LOCAL_RESOURCE_FIELD: |
402 | case ACPI_TYPE_LOCAL_RESOURCE_FIELD: |
407 | 403 | ||
408 | if (Node->Flags & 0x80) |
404 | if (Node->Flags & 0x80) |
409 | { |
405 | { |
410 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
406 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
411 | " [Field Offset 0x%.4X Bits 0x%.4X Bytes]", |
407 | " [Field Offset 0x%.4X Bits 0x%.4X Bytes]", |
412 | Node->Value, Node->Value / 8); |
408 | Node->Value, Node->Value / 8); |
413 | } |
409 | } |
414 | else |
410 | else |
415 | { |
411 | { |
416 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
412 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, |
417 | " [Field Offset 0x%.4X Bytes]", Node->Value); |
413 | " [Field Offset 0x%.4X Bytes]", Node->Value); |
418 | } |
414 | } |
419 | break; |
415 | break; |
420 | 416 | ||
421 | 417 | ||
422 | default: |
418 | default: |
423 | /* Nothing to do for other types */ |
419 | /* Nothing to do for other types */ |
424 | break; |
420 | break; |
425 | } |
421 | } |
426 | } |
422 | } |
427 | 423 | ||
428 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n"); |
424 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n"); |
429 | return (AE_OK); |
425 | return (AE_OK); |
430 | } |
426 | } |
431 | 427 | ||
432 | 428 | ||
433 | /******************************************************************************* |
429 | /******************************************************************************* |
434 | * |
430 | * |
435 | * FUNCTION: LsSetupNsList |
431 | * FUNCTION: LsSetupNsList |
436 | * |
432 | * |
437 | * PARAMETERS: Handle - local file handle |
433 | * PARAMETERS: Handle - local file handle |
438 | * |
434 | * |
439 | * RETURN: None |
435 | * RETURN: None |
440 | * |
436 | * |
441 | * DESCRIPTION: Set the namespace output file to the input handle |
437 | * DESCRIPTION: Set the namespace output file to the input handle |
442 | * |
438 | * |
443 | ******************************************************************************/ |
439 | ******************************************************************************/ |
444 | 440 | ||
445 | void |
441 | void |
446 | LsSetupNsList ( |
442 | LsSetupNsList ( |
447 | void *Handle) |
443 | void *Handle) |
448 | { |
444 | { |
449 | 445 | ||
450 | Gbl_NsOutputFlag = TRUE; |
446 | Gbl_NsOutputFlag = TRUE; |
451 | Gbl_Files[ASL_FILE_NAMESPACE_OUTPUT].Handle = Handle; |
447 | Gbl_Files[ASL_FILE_NAMESPACE_OUTPUT].Handle = Handle; |
452 | } |
448 | } |
453 | 449 | ||
454 | 450 | ||
455 | /******************************************************************************* |
451 | /******************************************************************************* |
456 | * |
452 | * |
457 | * FUNCTION: LsDoOnePathname |
453 | * FUNCTION: LsDoOnePathname |
458 | * |
454 | * |
459 | * PARAMETERS: ACPI_WALK_CALLBACK |
455 | * PARAMETERS: ACPI_WALK_CALLBACK |
460 | * |
456 | * |
461 | * RETURN: Status |
457 | * RETURN: Status |
462 | * |
458 | * |
463 | * DESCRIPTION: Print the full pathname for a namespace node. |
459 | * DESCRIPTION: Print the full pathname for a namespace node. |
464 | * |
460 | * |
465 | ******************************************************************************/ |
461 | ******************************************************************************/ |
466 | 462 | ||
467 | static ACPI_STATUS |
463 | static ACPI_STATUS |
468 | LsDoOnePathname ( |
464 | LsDoOnePathname ( |
469 | ACPI_HANDLE ObjHandle, |
465 | ACPI_HANDLE ObjHandle, |
470 | UINT32 Level, |
466 | UINT32 Level, |
471 | void *Context, |
467 | void *Context, |
472 | void **ReturnValue) |
468 | void **ReturnValue) |
473 | { |
469 | { |
474 | ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; |
470 | ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; |
475 | ACPI_STATUS Status; |
471 | ACPI_STATUS Status; |
476 | ACPI_BUFFER TargetPath; |
472 | ACPI_BUFFER TargetPath; |
477 | 473 | ||
478 | 474 | ||
479 | TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; |
475 | TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; |
480 | Status = AcpiNsHandleToPathname (Node, &TargetPath); |
476 | Status = AcpiNsHandleToPathname (Node, &TargetPath); |
481 | if (ACPI_FAILURE (Status)) |
477 | if (ACPI_FAILURE (Status)) |
482 | { |
478 | { |
483 | return (Status); |
479 | return (Status); |
484 | } |
480 | } |
485 | 481 | ||
486 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer); |
482 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", TargetPath.Pointer); |
487 | ACPI_FREE (TargetPath.Pointer); |
483 | ACPI_FREE (TargetPath.Pointer); |
488 | 484 | ||
489 | return (AE_OK); |
485 | return (AE_OK); |
490 | } |
486 | } |
491 | 487 | ||
492 | 488 | ||
493 | /******************************************************************************* |
489 | /******************************************************************************* |
494 | * |
490 | * |
495 | * FUNCTION: LsDisplayNamespace |
491 | * FUNCTION: LsDisplayNamespace |
496 | * |
492 | * |
497 | * PARAMETERS: None |
493 | * PARAMETERS: None |
498 | * |
494 | * |
499 | * RETURN: Status |
495 | * RETURN: Status |
500 | * |
496 | * |
501 | * DESCRIPTION: Walk the namespace an display information about each node |
497 | * DESCRIPTION: Walk the namespace an display information about each node |
502 | * in the tree. Information is written to the optional |
498 | * in the tree. Information is written to the optional |
503 | * namespace output file. |
499 | * namespace output file. |
504 | * |
500 | * |
505 | ******************************************************************************/ |
501 | ******************************************************************************/ |
506 | 502 | ||
507 | ACPI_STATUS |
503 | ACPI_STATUS |
508 | LsDisplayNamespace ( |
504 | LsDisplayNamespace ( |
509 | void) |
505 | void) |
510 | { |
506 | { |
511 | ACPI_STATUS Status; |
507 | ACPI_STATUS Status; |
512 | 508 | ||
513 | 509 | ||
514 | if (!Gbl_NsOutputFlag) |
510 | if (!Gbl_NsOutputFlag) |
515 | { |
511 | { |
516 | return (AE_OK); |
512 | return (AE_OK); |
517 | } |
513 | } |
518 | 514 | ||
519 | Gbl_NumNamespaceObjects = 0; |
515 | Gbl_NumNamespaceObjects = 0; |
520 | 516 | ||
521 | /* File header */ |
517 | /* File header */ |
522 | 518 | ||
523 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n"); |
519 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n"); |
524 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count Depth Name - Type\n\n"); |
520 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count Depth Name - Type\n\n"); |
525 | 521 | ||
526 | /* Walk entire namespace from the root */ |
522 | /* Walk entire namespace from the root */ |
527 | 523 | ||
528 | Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
524 | Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
529 | ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, NULL, |
525 | ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, NULL, |
530 | NULL, NULL); |
526 | NULL, NULL); |
531 | 527 | ||
532 | /* Print the full pathname for each namespace node */ |
528 | /* Print the full pathname for each namespace node */ |
533 | 529 | ||
534 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n"); |
530 | FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n"); |
535 | 531 | ||
536 | Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
532 | Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
537 | ACPI_UINT32_MAX, FALSE, LsDoOnePathname, NULL, |
533 | ACPI_UINT32_MAX, FALSE, LsDoOnePathname, NULL, |
538 | NULL, NULL); |
534 | NULL, NULL); |
539 | 535 | ||
540 | return (Status); |
536 | return (Status); |
541 | } |
537 | } |
542 | 538 | ||
543 | 539 | ||
544 | /******************************************************************************* |
540 | /******************************************************************************* |
545 | * |
541 | * |
546 | * FUNCTION: LsCompareOneNamespaceObject |
542 | * FUNCTION: LsCompareOneNamespaceObject |
547 | * |
543 | * |
548 | * PARAMETERS: ACPI_WALK_CALLBACK |
544 | * PARAMETERS: ACPI_WALK_CALLBACK |
549 | * |
545 | * |
550 | * RETURN: Status |
546 | * RETURN: Status |
551 | * |
547 | * |
552 | * DESCRIPTION: Compare name of one object. |
548 | * DESCRIPTION: Compare name of one object. |
553 | * |
549 | * |
554 | ******************************************************************************/ |
550 | ******************************************************************************/ |
555 | 551 | ||
556 | static ACPI_STATUS |
552 | static ACPI_STATUS |
557 | LsCompareOneNamespaceObject ( |
553 | LsCompareOneNamespaceObject ( |
558 | ACPI_HANDLE ObjHandle, |
554 | ACPI_HANDLE ObjHandle, |
559 | UINT32 Level, |
555 | UINT32 Level, |
560 | void *Context, |
556 | void *Context, |
561 | void **ReturnValue) |
557 | void **ReturnValue) |
562 | { |
558 | { |
563 | ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; |
559 | ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; |
564 | 560 | ||
565 | 561 | ||
566 | /* Simply check the name */ |
562 | /* Simply check the name */ |
567 | 563 | ||
568 | if (*((UINT32 *) (Context)) == Node->Name.Integer) |
564 | if (*((UINT32 *) (Context)) == Node->Name.Integer) |
569 | { |
565 | { |
570 | /* Abort walk if we found one instance */ |
566 | /* Abort walk if we found one instance */ |
571 | 567 | ||
572 | return (AE_CTRL_TRUE); |
568 | return (AE_CTRL_TRUE); |
573 | } |
569 | } |
574 | 570 | ||
575 | return (AE_OK); |
571 | return (AE_OK); |
576 | } |
572 | } |
577 | 573 | ||
578 | 574 | ||
579 | /******************************************************************************* |
575 | /******************************************************************************* |
580 | * |
576 | * |
581 | * FUNCTION: LkObjectExists |
577 | * FUNCTION: LkObjectExists |
582 | * |
578 | * |
583 | * PARAMETERS: Name - 4 char ACPI name |
579 | * PARAMETERS: Name - 4 char ACPI name |
584 | * |
580 | * |
585 | * RETURN: TRUE if name exists in namespace |
581 | * RETURN: TRUE if name exists in namespace |
586 | * |
582 | * |
587 | * DESCRIPTION: Walk the namespace to find an object |
583 | * DESCRIPTION: Walk the namespace to find an object |
588 | * |
584 | * |
589 | ******************************************************************************/ |
585 | ******************************************************************************/ |
590 | 586 | ||
591 | static BOOLEAN |
587 | static BOOLEAN |
592 | LkObjectExists ( |
588 | LkObjectExists ( |
593 | char *Name) |
589 | char *Name) |
594 | { |
590 | { |
595 | ACPI_STATUS Status; |
591 | ACPI_STATUS Status; |
596 | 592 | ||
597 | 593 | ||
598 | /* Walk entire namespace from the supplied root */ |
594 | /* Walk entire namespace from the supplied root */ |
599 | 595 | ||
600 | Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
596 | Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
601 | ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject, NULL, |
597 | ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject, NULL, |
602 | Name, NULL); |
598 | Name, NULL); |
603 | if (Status == AE_CTRL_TRUE) |
599 | if (Status == AE_CTRL_TRUE) |
604 | { |
600 | { |
605 | /* At least one instance of the name was found */ |
601 | /* At least one instance of the name was found */ |
606 | 602 | ||
607 | return (TRUE); |
603 | return (TRUE); |
608 | } |
604 | } |
609 | 605 | ||
610 | return (FALSE); |
606 | return (FALSE); |
611 | } |
607 | } |
612 | 608 | ||
613 | 609 | ||
614 | /******************************************************************************* |
610 | /******************************************************************************* |
615 | * |
611 | * |
616 | * FUNCTION: LkGetNameOp |
612 | * FUNCTION: LkGetNameOp |
617 | * |
613 | * |
618 | * PARAMETERS: Op - Current Op |
614 | * PARAMETERS: Op - Current Op |
619 | * |
615 | * |
620 | * RETURN: NameOp associated with the input op |
616 | * RETURN: NameOp associated with the input op |
621 | * |
617 | * |
622 | * DESCRIPTION: Find the name declaration op associated with the operator |
618 | * DESCRIPTION: Find the name declaration op associated with the operator |
623 | * |
619 | * |
624 | ******************************************************************************/ |
620 | ******************************************************************************/ |
625 | 621 | ||
626 | ACPI_PARSE_OBJECT * |
622 | static ACPI_PARSE_OBJECT * |
627 | LkGetNameOp ( |
623 | LkGetNameOp ( |
628 | ACPI_PARSE_OBJECT *Op) |
624 | ACPI_PARSE_OBJECT *Op) |
629 | { |
625 | { |
630 | const ACPI_OPCODE_INFO *OpInfo; |
626 | const ACPI_OPCODE_INFO *OpInfo; |
631 | ACPI_PARSE_OBJECT *NameOp = Op; |
627 | ACPI_PARSE_OBJECT *NameOp = Op; |
632 | 628 | ||
633 | 629 | ||
634 | OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); |
630 | OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); |
635 | 631 | ||
636 | 632 | ||
637 | /* Get the NamePath from the appropriate place */ |
633 | /* Get the NamePath from the appropriate place */ |
638 | 634 | ||
639 | if (OpInfo->Flags & AML_NAMED) |
635 | if (OpInfo->Flags & AML_NAMED) |
640 | { |
636 | { |
641 | /* For nearly all NAMED operators, the name reference is the first child */ |
637 | /* For nearly all NAMED operators, the name reference is the first child */ |
642 | 638 | ||
643 | NameOp = Op->Asl.Child; |
639 | NameOp = Op->Asl.Child; |
644 | if (Op->Asl.AmlOpcode == AML_ALIAS_OP) |
640 | if (Op->Asl.AmlOpcode == AML_ALIAS_OP) |
645 | { |
641 | { |
646 | /* |
642 | /* |
647 | * ALIAS is the only oddball opcode, the name declaration |
643 | * ALIAS is the only oddball opcode, the name declaration |
648 | * (alias name) is the second operand |
644 | * (alias name) is the second operand |
649 | */ |
645 | */ |
650 | NameOp = Op->Asl.Child->Asl.Next; |
646 | NameOp = Op->Asl.Child->Asl.Next; |
651 | } |
647 | } |
652 | } |
648 | } |
653 | else if (OpInfo->Flags & AML_CREATE) |
649 | else if (OpInfo->Flags & AML_CREATE) |
654 | { |
650 | { |
655 | /* Name must appear as the last parameter */ |
651 | /* Name must appear as the last parameter */ |
656 | 652 | ||
657 | NameOp = Op->Asl.Child; |
653 | NameOp = Op->Asl.Child; |
658 | while (!(NameOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) |
654 | while (!(NameOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) |
659 | { |
655 | { |
660 | NameOp = NameOp->Asl.Next; |
656 | NameOp = NameOp->Asl.Next; |
661 | } |
657 | } |
662 | } |
658 | } |
663 | 659 | ||
664 | return (NameOp); |
660 | return (NameOp); |
665 | } |
661 | } |
666 | 662 | ||
667 | 663 | ||
668 | /******************************************************************************* |
664 | /******************************************************************************* |
669 | * |
665 | * |
670 | * FUNCTION: LkIsObjectUsed |
666 | * FUNCTION: LkIsObjectUsed |
671 | * |
667 | * |
672 | * PARAMETERS: ACPI_WALK_CALLBACK |
668 | * PARAMETERS: ACPI_WALK_CALLBACK |
673 | * |
669 | * |
674 | * RETURN: Status |
670 | * RETURN: Status |
675 | * |
671 | * |
676 | * DESCRIPTION: Check for an unreferenced namespace object and emit a warning. |
672 | * DESCRIPTION: Check for an unreferenced namespace object and emit a warning. |
677 | * We have to be careful, because some types and names are |
673 | * We have to be careful, because some types and names are |
678 | * typically or always unreferenced, we don't want to issue |
674 | * typically or always unreferenced, we don't want to issue |
679 | * excessive warnings. |
675 | * excessive warnings. |
680 | * |
676 | * |
681 | ******************************************************************************/ |
677 | ******************************************************************************/ |
682 | 678 | ||
683 | static ACPI_STATUS |
679 | static ACPI_STATUS |
684 | LkIsObjectUsed ( |
680 | LkIsObjectUsed ( |
685 | ACPI_HANDLE ObjHandle, |
681 | ACPI_HANDLE ObjHandle, |
686 | UINT32 Level, |
682 | UINT32 Level, |
687 | void *Context, |
683 | void *Context, |
688 | void **ReturnValue) |
684 | void **ReturnValue) |
689 | { |
685 | { |
690 | ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); |
686 | ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle); |
691 | 687 | ||
692 | 688 | ||
693 | /* Referenced flag is set during the namespace xref */ |
689 | /* Referenced flag is set during the namespace xref */ |
694 | 690 | ||
695 | if (Node->Flags & ANOBJ_IS_REFERENCED) |
691 | if (Node->Flags & ANOBJ_IS_REFERENCED) |
696 | { |
692 | { |
697 | return (AE_OK); |
693 | return (AE_OK); |
698 | } |
694 | } |
699 | 695 | ||
700 | /* |
696 | /* |
701 | * Ignore names that start with an underscore, |
697 | * Ignore names that start with an underscore, |
702 | * these are the reserved ACPI names and are typically not referenced, |
698 | * these are the reserved ACPI names and are typically not referenced, |
703 | * they are called by the host OS. |
699 | * they are called by the host OS. |
704 | */ |
700 | */ |
705 | if (Node->Name.Ascii[0] == '_') |
701 | if (Node->Name.Ascii[0] == '_') |
706 | { |
702 | { |
707 | return (AE_OK); |
703 | return (AE_OK); |
708 | } |
704 | } |
709 | 705 | ||
710 | /* There are some types that are typically not referenced, ignore them */ |
706 | /* There are some types that are typically not referenced, ignore them */ |
711 | 707 | ||
712 | switch (Node->Type) |
708 | switch (Node->Type) |
713 | { |
709 | { |
714 | case ACPI_TYPE_DEVICE: |
710 | case ACPI_TYPE_DEVICE: |
715 | case ACPI_TYPE_PROCESSOR: |
711 | case ACPI_TYPE_PROCESSOR: |
716 | case ACPI_TYPE_POWER: |
712 | case ACPI_TYPE_POWER: |
717 | case ACPI_TYPE_LOCAL_RESOURCE: |
713 | case ACPI_TYPE_LOCAL_RESOURCE: |
718 | return (AE_OK); |
714 | return (AE_OK); |
719 | 715 | ||
720 | default: |
716 | default: |
721 | break; |
717 | break; |
722 | } |
718 | } |
723 | 719 | ||
724 | /* All others are valid unreferenced namespace objects */ |
720 | /* All others are valid unreferenced namespace objects */ |
725 | 721 | ||
726 | if (Node->Op) |
722 | if (Node->Op) |
727 | { |
723 | { |
728 | AslError (ASL_WARNING2, ASL_MSG_NOT_REFERENCED, LkGetNameOp (Node->Op), NULL); |
724 | AslError (ASL_WARNING2, ASL_MSG_NOT_REFERENCED, LkGetNameOp (Node->Op), NULL); |
729 | } |
725 | } |
730 | return (AE_OK); |
726 | return (AE_OK); |
731 | } |
727 | } |
732 | 728 | ||
733 | 729 | ||
734 | /******************************************************************************* |
730 | /******************************************************************************* |
735 | * |
731 | * |
736 | * FUNCTION: LkFindUnreferencedObjects |
732 | * FUNCTION: LkFindUnreferencedObjects |
737 | * |
733 | * |
738 | * PARAMETERS: None |
734 | * PARAMETERS: None |
739 | * |
735 | * |
740 | * RETURN: None |
736 | * RETURN: None |
741 | * |
737 | * |
742 | * DESCRIPTION: Namespace walk to find objects that are not referenced in any |
738 | * DESCRIPTION: Namespace walk to find objects that are not referenced in any |
743 | * way. Must be called after the namespace has been cross |
739 | * way. Must be called after the namespace has been cross |
744 | * referenced. |
740 | * referenced. |
745 | * |
741 | * |
746 | ******************************************************************************/ |
742 | ******************************************************************************/ |
747 | 743 | ||
748 | void |
744 | void |
749 | LkFindUnreferencedObjects ( |
745 | LkFindUnreferencedObjects ( |
750 | void) |
746 | void) |
751 | { |
747 | { |
752 | 748 | ||
753 | /* Walk entire namespace from the supplied root */ |
749 | /* Walk entire namespace from the supplied root */ |
754 | 750 | ||
755 | (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
751 | (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, |
756 | ACPI_UINT32_MAX, FALSE, LkIsObjectUsed, NULL, |
752 | ACPI_UINT32_MAX, FALSE, LkIsObjectUsed, NULL, |
757 | NULL, NULL); |
753 | NULL, NULL); |
758 | } |
754 | } |
759 | 755 | ||
760 | 756 | ||
761 | /******************************************************************************* |
757 | /******************************************************************************* |
762 | * |
758 | * |
763 | * FUNCTION: LkCrossReferenceNamespace |
759 | * FUNCTION: LkCrossReferenceNamespace |
764 | * |
760 | * |
765 | * PARAMETERS: None |
761 | * PARAMETERS: None |
766 | * |
762 | * |
767 | * RETURN: Status |
763 | * RETURN: Status |
768 | * |
764 | * |
769 | * DESCRIPTION: Perform a cross reference check of the parse tree against the |
765 | * DESCRIPTION: Perform a cross reference check of the parse tree against the |
770 | * namespace. Every named referenced within the parse tree |
766 | * namespace. Every named referenced within the parse tree |
771 | * should be get resolved with a namespace lookup. If not, the |
767 | * should be get resolved with a namespace lookup. If not, the |
772 | * original reference in the ASL code is invalid -- i.e., refers |
768 | * original reference in the ASL code is invalid -- i.e., refers |
773 | * to a non-existent object. |
769 | * to a non-existent object. |
774 | * |
770 | * |
775 | * NOTE: The ASL "External" operator causes the name to be inserted into the |
771 | * NOTE: The ASL "External" operator causes the name to be inserted into the |
776 | * namespace so that references to the external name will be resolved |
772 | * namespace so that references to the external name will be resolved |
777 | * correctly here. |
773 | * correctly here. |
778 | * |
774 | * |
779 | ******************************************************************************/ |
775 | ******************************************************************************/ |
780 | 776 | ||
781 | ACPI_STATUS |
777 | ACPI_STATUS |
782 | LkCrossReferenceNamespace ( |
778 | LkCrossReferenceNamespace ( |
783 | void) |
779 | void) |
784 | { |
780 | { |
785 | ACPI_WALK_STATE *WalkState; |
781 | ACPI_WALK_STATE *WalkState; |
786 | 782 | ||
787 | 783 | ||
788 | DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n"); |
784 | DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n"); |
789 | 785 | ||
790 | /* |
786 | /* |
791 | * Create a new walk state for use when looking up names |
787 | * Create a new walk state for use when looking up names |
792 | * within the namespace (Passed as context to the callbacks) |
788 | * within the namespace (Passed as context to the callbacks) |
793 | */ |
789 | */ |
794 | WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); |
790 | WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); |
795 | if (!WalkState) |
791 | if (!WalkState) |
796 | { |
792 | { |
797 | return AE_NO_MEMORY; |
793 | return AE_NO_MEMORY; |
798 | } |
794 | } |
799 | 795 | ||
800 | /* Walk the entire parse tree */ |
796 | /* Walk the entire parse tree */ |
801 | 797 | ||
802 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LkNamespaceLocateBegin, |
798 | TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LkNamespaceLocateBegin, |
803 | LkNamespaceLocateEnd, WalkState); |
799 | LkNamespaceLocateEnd, WalkState); |
804 | return AE_OK; |
800 | return AE_OK; |
805 | } |
801 | } |
806 | 802 | ||
807 | 803 | ||
808 | /******************************************************************************* |
804 | /******************************************************************************* |
809 | * |
805 | * |
810 | * FUNCTION: LkCheckFieldRange |
806 | * FUNCTION: LkCheckFieldRange |
811 | * |
807 | * |
812 | * PARAMETERS: RegionBitLength - Length of entire parent region |
808 | * PARAMETERS: RegionBitLength - Length of entire parent region |
813 | * FieldBitOffset - Start of the field unit (within region) |
809 | * FieldBitOffset - Start of the field unit (within region) |
814 | * FieldBitLength - Entire length of field unit |
810 | * FieldBitLength - Entire length of field unit |
815 | * AccessBitWidth - Access width of the field unit |
811 | * AccessBitWidth - Access width of the field unit |
816 | * |
812 | * |
817 | * RETURN: None |
813 | * RETURN: None |
818 | * |
814 | * |
819 | * DESCRIPTION: Check one field unit to make sure it fits in the parent |
815 | * DESCRIPTION: Check one field unit to make sure it fits in the parent |
820 | * op region. |
816 | * op region. |
821 | * |
817 | * |
822 | * Note: AccessBitWidth must be either 8,16,32, or 64 |
818 | * Note: AccessBitWidth must be either 8,16,32, or 64 |
823 | * |
819 | * |
824 | ******************************************************************************/ |
820 | ******************************************************************************/ |
825 | 821 | ||
826 | static void |
822 | static void |
827 | LkCheckFieldRange ( |
823 | LkCheckFieldRange ( |
828 | ACPI_PARSE_OBJECT *Op, |
824 | ACPI_PARSE_OBJECT *Op, |
829 | UINT32 RegionBitLength, |
825 | UINT32 RegionBitLength, |
830 | UINT32 FieldBitOffset, |
826 | UINT32 FieldBitOffset, |
831 | UINT32 FieldBitLength, |
827 | UINT32 FieldBitLength, |
832 | UINT32 AccessBitWidth) |
828 | UINT32 AccessBitWidth) |
833 | { |
829 | { |
834 | UINT32 FieldEndBitOffset; |
830 | UINT32 FieldEndBitOffset; |
835 | 831 | ||
836 | 832 | ||
837 | /* |
833 | /* |
838 | * Check each field unit against the region size. The entire |
834 | * Check each field unit against the region size. The entire |
839 | * field unit (start offset plus length) must fit within the |
835 | * field unit (start offset plus length) must fit within the |
840 | * region. |
836 | * region. |
841 | */ |
837 | */ |
842 | FieldEndBitOffset = FieldBitOffset + FieldBitLength; |
838 | FieldEndBitOffset = FieldBitOffset + FieldBitLength; |
843 | 839 | ||
844 | if (FieldEndBitOffset > RegionBitLength) |
840 | if (FieldEndBitOffset > RegionBitLength) |
845 | { |
841 | { |
846 | /* Field definition itself is beyond the end-of-region */ |
842 | /* Field definition itself is beyond the end-of-region */ |
847 | 843 | ||
848 | AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL); |
844 | AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL); |
849 | return; |
845 | return; |
850 | } |
846 | } |
851 | 847 | ||
852 | /* |
848 | /* |
853 | * Now check that the field plus AccessWidth doesn't go beyond |
849 | * Now check that the field plus AccessWidth doesn't go beyond |
854 | * the end-of-region. Assumes AccessBitWidth is a power of 2 |
850 | * the end-of-region. Assumes AccessBitWidth is a power of 2 |
855 | */ |
851 | */ |
856 | FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth); |
852 | FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth); |
857 | 853 | ||
858 | if (FieldEndBitOffset > RegionBitLength) |
854 | if (FieldEndBitOffset > RegionBitLength) |
859 | { |
855 | { |
860 | /* Field definition combined with the access is beyond EOR */ |
856 | /* Field definition combined with the access is beyond EOR */ |
861 | 857 | ||
862 | AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL); |
858 | AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL); |
863 | } |
859 | } |
864 | } |
860 | } |
865 | 861 | ||
866 | /******************************************************************************* |
862 | /******************************************************************************* |
867 | * |
863 | * |
868 | * FUNCTION: LkNamespaceLocateBegin |
864 | * FUNCTION: LkNamespaceLocateBegin |
869 | * |
865 | * |
870 | * PARAMETERS: ASL_WALK_CALLBACK |
866 | * PARAMETERS: ASL_WALK_CALLBACK |
871 | * |
867 | * |
872 | * RETURN: Status |
868 | * RETURN: Status |
873 | * |
869 | * |
874 | * DESCRIPTION: Descending callback used during cross-reference. For named |
870 | * DESCRIPTION: Descending callback used during cross-reference. For named |
875 | * object references, attempt to locate the name in the |
871 | * object references, attempt to locate the name in the |
876 | * namespace. |
872 | * namespace. |
877 | * |
873 | * |
878 | * NOTE: ASL references to named fields within resource descriptors are |
874 | * NOTE: ASL references to named fields within resource descriptors are |
879 | * resolved to integer values here. Therefore, this step is an |
875 | * resolved to integer values here. Therefore, this step is an |
880 | * important part of the code generation. We don't know that the |
876 | * important part of the code generation. We don't know that the |
881 | * name refers to a resource descriptor until now. |
877 | * name refers to a resource descriptor until now. |
882 | * |
878 | * |
883 | ******************************************************************************/ |
879 | ******************************************************************************/ |
884 | 880 | ||
885 | static ACPI_STATUS |
881 | static ACPI_STATUS |
886 | LkNamespaceLocateBegin ( |
882 | LkNamespaceLocateBegin ( |
887 | ACPI_PARSE_OBJECT *Op, |
883 | ACPI_PARSE_OBJECT *Op, |
888 | UINT32 Level, |
884 | UINT32 Level, |
889 | void *Context) |
885 | void *Context) |
890 | { |
886 | { |
891 | ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; |
887 | ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; |
892 | ACPI_NAMESPACE_NODE *Node; |
888 | ACPI_NAMESPACE_NODE *Node; |
893 | ACPI_STATUS Status; |
889 | ACPI_STATUS Status; |
894 | ACPI_OBJECT_TYPE ObjectType; |
890 | ACPI_OBJECT_TYPE ObjectType; |
895 | char *Path; |
891 | char *Path; |
896 | UINT8 PassedArgs; |
892 | UINT8 PassedArgs; |
897 | ACPI_PARSE_OBJECT *NextOp; |
893 | ACPI_PARSE_OBJECT *NextOp; |
898 | ACPI_PARSE_OBJECT *OwningOp; |
894 | ACPI_PARSE_OBJECT *OwningOp; |
899 | ACPI_PARSE_OBJECT *SpaceIdOp; |
895 | ACPI_PARSE_OBJECT *SpaceIdOp; |
900 | UINT32 MinimumLength; |
896 | UINT32 MinimumLength; |
901 | UINT32 Temp; |
897 | UINT32 Temp; |
902 | const ACPI_OPCODE_INFO *OpInfo; |
898 | const ACPI_OPCODE_INFO *OpInfo; |
903 | UINT32 Flags; |
899 | UINT32 Flags; |
904 | 900 | ||
905 | 901 | ||
906 | ACPI_FUNCTION_TRACE_PTR (LkNamespaceLocateBegin, Op); |
902 | ACPI_FUNCTION_TRACE_PTR (LkNamespaceLocateBegin, Op); |
907 | 903 | ||
908 | /* |
904 | /* |
909 | * If this node is the actual declaration of a name |
905 | * If this node is the actual declaration of a name |
910 | * [such as the XXXX name in "Method (XXXX)"], |
906 | * [such as the XXXX name in "Method (XXXX)"], |
911 | * we are not interested in it here. We only care about names that are |
907 | * we are not interested in it here. We only care about names that are |
912 | * references to other objects within the namespace and the parent objects |
908 | * references to other objects within the namespace and the parent objects |
913 | * of name declarations |
909 | * of name declarations |
914 | */ |
910 | */ |
915 | if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) |
911 | if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) |
916 | { |
912 | { |
917 | return (AE_OK); |
913 | return (AE_OK); |
918 | } |
914 | } |
919 | 915 | ||
920 | /* We are only interested in opcodes that have an associated name */ |
916 | /* We are only interested in opcodes that have an associated name */ |
921 | 917 | ||
922 | OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); |
918 | OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); |
923 | 919 | ||
924 | if ((!(OpInfo->Flags & AML_NAMED)) && |
920 | if ((!(OpInfo->Flags & AML_NAMED)) && |
925 | (!(OpInfo->Flags & AML_CREATE)) && |
921 | (!(OpInfo->Flags & AML_CREATE)) && |
926 | (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && |
922 | (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && |
927 | (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && |
923 | (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && |
928 | (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) |
924 | (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) |
929 | { |
925 | { |
930 | return (AE_OK); |
926 | return (AE_OK); |
931 | } |
927 | } |
932 | 928 | ||
933 | /* |
929 | /* |
934 | * One special case: CondRefOf operator - we don't care if the name exists |
930 | * One special case: CondRefOf operator - we don't care if the name exists |
935 | * or not at this point, just ignore it, the point of the operator is to |
931 | * or not at this point, just ignore it, the point of the operator is to |
936 | * determine if the name exists at runtime. |
932 | * determine if the name exists at runtime. |
937 | */ |
933 | */ |
938 | if ((Op->Asl.Parent) && |
934 | if ((Op->Asl.Parent) && |
939 | (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) |
935 | (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) |
940 | { |
936 | { |
941 | return (AE_OK); |
937 | return (AE_OK); |
942 | } |
938 | } |
943 | 939 | ||
944 | /* |
940 | /* |
945 | * We must enable the "search-to-root" for single NameSegs, but |
941 | * We must enable the "search-to-root" for single NameSegs, but |
946 | * we have to be very careful about opening up scopes |
942 | * we have to be very careful about opening up scopes |
947 | */ |
943 | */ |
948 | Flags = ACPI_NS_SEARCH_PARENT; |
944 | Flags = ACPI_NS_SEARCH_PARENT; |
949 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || |
945 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || |
950 | (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
946 | (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
951 | (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) |
947 | (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) |
952 | { |
948 | { |
953 | /* |
949 | /* |
954 | * These are name references, do not push the scope stack |
950 | * These are name references, do not push the scope stack |
955 | * for them. |
951 | * for them. |
956 | */ |
952 | */ |
957 | Flags |= ACPI_NS_DONT_OPEN_SCOPE; |
953 | Flags |= ACPI_NS_DONT_OPEN_SCOPE; |
958 | } |
954 | } |
959 | 955 | ||
960 | /* Get the NamePath from the appropriate place */ |
956 | /* Get the NamePath from the appropriate place */ |
961 | 957 | ||
962 | if (OpInfo->Flags & AML_NAMED) |
958 | if (OpInfo->Flags & AML_NAMED) |
963 | { |
959 | { |
964 | /* For nearly all NAMED operators, the name reference is the first child */ |
960 | /* For nearly all NAMED operators, the name reference is the first child */ |
965 | 961 | ||
966 | Path = Op->Asl.Child->Asl.Value.String; |
962 | Path = Op->Asl.Child->Asl.Value.String; |
967 | if (Op->Asl.AmlOpcode == AML_ALIAS_OP) |
963 | if (Op->Asl.AmlOpcode == AML_ALIAS_OP) |
968 | { |
964 | { |
969 | /* |
965 | /* |
970 | * ALIAS is the only oddball opcode, the name declaration |
966 | * ALIAS is the only oddball opcode, the name declaration |
971 | * (alias name) is the second operand |
967 | * (alias name) is the second operand |
972 | */ |
968 | */ |
973 | Path = Op->Asl.Child->Asl.Next->Asl.Value.String; |
969 | Path = Op->Asl.Child->Asl.Next->Asl.Value.String; |
974 | } |
970 | } |
975 | } |
971 | } |
976 | else if (OpInfo->Flags & AML_CREATE) |
972 | else if (OpInfo->Flags & AML_CREATE) |
977 | { |
973 | { |
978 | /* Name must appear as the last parameter */ |
974 | /* Name must appear as the last parameter */ |
979 | 975 | ||
980 | NextOp = Op->Asl.Child; |
976 | NextOp = Op->Asl.Child; |
981 | while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) |
977 | while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) |
982 | { |
978 | { |
983 | NextOp = NextOp->Asl.Next; |
979 | NextOp = NextOp->Asl.Next; |
984 | } |
980 | } |
985 | Path = NextOp->Asl.Value.String; |
981 | Path = NextOp->Asl.Value.String; |
986 | } |
982 | } |
987 | else |
983 | else |
988 | { |
984 | { |
989 | Path = Op->Asl.Value.String; |
985 | Path = Op->Asl.Value.String; |
990 | } |
986 | } |
991 | 987 | ||
992 | ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); |
988 | ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); |
993 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
989 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
994 | "Type=%s\n", AcpiUtGetTypeName (ObjectType))); |
990 | "Type=%s\n", AcpiUtGetTypeName (ObjectType))); |
995 | 991 | ||
996 | /* |
992 | /* |
997 | * Lookup the name in the namespace. Name must exist at this point, or it |
993 | * Lookup the name in the namespace. Name must exist at this point, or it |
998 | * is an invalid reference. |
994 | * is an invalid reference. |
999 | * |
995 | * |
1000 | * The namespace is also used as a lookup table for references to resource |
996 | * The namespace is also used as a lookup table for references to resource |
1001 | * descriptors and the fields within them. |
997 | * descriptors and the fields within them. |
1002 | */ |
998 | */ |
1003 | Gbl_NsLookupCount++; |
999 | Gbl_NsLookupCount++; |
1004 | 1000 | ||
1005 | Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, |
1001 | Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, |
1006 | ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node)); |
1002 | ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node)); |
1007 | if (ACPI_FAILURE (Status)) |
1003 | if (ACPI_FAILURE (Status)) |
1008 | { |
1004 | { |
1009 | if (Status == AE_NOT_FOUND) |
1005 | if (Status == AE_NOT_FOUND) |
1010 | { |
1006 | { |
1011 | /* |
1007 | /* |
1012 | * We didn't find the name reference by path -- we can qualify this |
1008 | * We didn't find the name reference by path -- we can qualify this |
1013 | * a little better before we print an error message |
1009 | * a little better before we print an error message |
1014 | */ |
1010 | */ |
1015 | if (strlen (Path) == ACPI_NAME_SIZE) |
1011 | if (strlen (Path) == ACPI_NAME_SIZE) |
1016 | { |
1012 | { |
1017 | /* A simple, one-segment ACPI name */ |
1013 | /* A simple, one-segment ACPI name */ |
1018 | 1014 | ||
1019 | if (LkObjectExists (Path)) |
1015 | if (LkObjectExists (Path)) |
1020 | { |
1016 | { |
1021 | /* |
1017 | /* |
1022 | * There exists such a name, but we couldn't get to it |
1018 | * There exists such a name, but we couldn't get to it |
1023 | * from this scope |
1019 | * from this scope |
1024 | */ |
1020 | */ |
1025 | AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op, |
1021 | AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op, |
1026 | Op->Asl.ExternalName); |
1022 | Op->Asl.ExternalName); |
1027 | } |
1023 | } |
1028 | else |
1024 | else |
1029 | { |
1025 | { |
1030 | /* The name doesn't exist, period */ |
1026 | /* The name doesn't exist, period */ |
1031 | 1027 | ||
1032 | AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, |
1028 | AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, |
1033 | Op, Op->Asl.ExternalName); |
1029 | Op, Op->Asl.ExternalName); |
1034 | } |
1030 | } |
1035 | } |
1031 | } |
1036 | else |
1032 | else |
1037 | { |
1033 | { |
1038 | /* Check for a fully qualified path */ |
1034 | /* Check for a fully qualified path */ |
1039 | 1035 | ||
1040 | if (Path[0] == AML_ROOT_PREFIX) |
1036 | if (Path[0] == AML_ROOT_PREFIX) |
1041 | { |
1037 | { |
1042 | /* Gave full path, the object does not exist */ |
1038 | /* Gave full path, the object does not exist */ |
1043 | 1039 | ||
1044 | AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, |
1040 | AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, |
1045 | Op->Asl.ExternalName); |
1041 | Op->Asl.ExternalName); |
1046 | } |
1042 | } |
1047 | else |
1043 | else |
1048 | { |
1044 | { |
1049 | /* |
1045 | /* |
1050 | * We can't tell whether it doesn't exist or just |
1046 | * We can't tell whether it doesn't exist or just |
1051 | * can't be reached. |
1047 | * can't be reached. |
1052 | */ |
1048 | */ |
1053 | AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, |
1049 | AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, |
1054 | Op->Asl.ExternalName); |
1050 | Op->Asl.ExternalName); |
1055 | } |
1051 | } |
1056 | } |
1052 | } |
1057 | 1053 | ||
1058 | Status = AE_OK; |
1054 | Status = AE_OK; |
1059 | } |
1055 | } |
1060 | return (Status); |
1056 | return (Status); |
1061 | } |
1057 | } |
1062 | 1058 | ||
1063 | /* Check for a reference vs. name declaration */ |
1059 | /* Check for a reference vs. name declaration */ |
1064 | 1060 | ||
1065 | if (!(OpInfo->Flags & AML_NAMED) && |
1061 | if (!(OpInfo->Flags & AML_NAMED) && |
1066 | !(OpInfo->Flags & AML_CREATE)) |
1062 | !(OpInfo->Flags & AML_CREATE)) |
1067 | { |
1063 | { |
1068 | /* This node has been referenced, mark it for reference check */ |
1064 | /* This node has been referenced, mark it for reference check */ |
1069 | 1065 | ||
1070 | Node->Flags |= ANOBJ_IS_REFERENCED; |
1066 | Node->Flags |= ANOBJ_IS_REFERENCED; |
1071 | } |
1067 | } |
1072 | 1068 | ||
1073 | /* Attempt to optimize the NamePath */ |
1069 | /* Attempt to optimize the NamePath */ |
1074 | 1070 | ||
1075 | OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node); |
1071 | OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node); |
1076 | 1072 | ||
1077 | /* |
1073 | /* |
1078 | * 1) Dereference an alias (A name reference that is an alias) |
1074 | * 1) Dereference an alias (A name reference that is an alias) |
1079 | * Aliases are not nested, the alias always points to the final object |
1075 | * Aliases are not nested, the alias always points to the final object |
1080 | */ |
1076 | */ |
1081 | if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) && |
1077 | if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) && |
1082 | (Node->Type == ACPI_TYPE_LOCAL_ALIAS)) |
1078 | (Node->Type == ACPI_TYPE_LOCAL_ALIAS)) |
1083 | { |
1079 | { |
1084 | /* This node points back to the original PARSEOP_ALIAS */ |
1080 | /* This node points back to the original PARSEOP_ALIAS */ |
1085 | 1081 | ||
1086 | NextOp = Node->Op; |
1082 | NextOp = Node->Op; |
1087 | 1083 | ||
1088 | /* The first child is the alias target op */ |
1084 | /* The first child is the alias target op */ |
1089 | 1085 | ||
1090 | NextOp = NextOp->Asl.Child; |
1086 | NextOp = NextOp->Asl.Child; |
1091 | 1087 | ||
1092 | /* That in turn points back to original target alias node */ |
1088 | /* That in turn points back to original target alias node */ |
1093 | 1089 | ||
1094 | if (NextOp->Asl.Node) |
1090 | if (NextOp->Asl.Node) |
1095 | { |
1091 | { |
1096 | Node = NextOp->Asl.Node; |
1092 | Node = NextOp->Asl.Node; |
1097 | } |
1093 | } |
1098 | 1094 | ||
1099 | /* Else - forward reference to alias, will be resolved later */ |
1095 | /* Else - forward reference to alias, will be resolved later */ |
1100 | } |
1096 | } |
1101 | 1097 | ||
1102 | /* 2) Check for a reference to a resource descriptor */ |
1098 | /* 2) Check for a reference to a resource descriptor */ |
1103 | 1099 | ||
1104 | if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) || |
1100 | if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) || |
1105 | (Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) |
1101 | (Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) |
1106 | { |
1102 | { |
1107 | /* |
1103 | /* |
1108 | * This was a reference to a field within a resource descriptor. Extract |
1104 | * This was a reference to a field within a resource descriptor. Extract |
1109 | * the associated field offset (either a bit or byte offset depending on |
1105 | * the associated field offset (either a bit or byte offset depending on |
1110 | * the field type) and change the named reference into an integer for |
1106 | * the field type) and change the named reference into an integer for |
1111 | * AML code generation |
1107 | * AML code generation |
1112 | */ |
1108 | */ |
1113 | Temp = Node->Value; |
1109 | Temp = Node->Value; |
1114 | if (Node->Flags & ANOBJ_IS_BIT_OFFSET) |
1110 | if (Node->Flags & ANOBJ_IS_BIT_OFFSET) |
1115 | { |
1111 | { |
1116 | Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET; |
1112 | Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET; |
1117 | } |
1113 | } |
1118 | 1114 | ||
1119 | /* Perform BitOffset <--> ByteOffset conversion if necessary */ |
1115 | /* Perform BitOffset <--> ByteOffset conversion if necessary */ |
1120 | 1116 | ||
1121 | switch (Op->Asl.Parent->Asl.AmlOpcode) |
1117 | switch (Op->Asl.Parent->Asl.AmlOpcode) |
1122 | { |
1118 | { |
1123 | case AML_CREATE_FIELD_OP: |
1119 | case AML_CREATE_FIELD_OP: |
1124 | 1120 | ||
1125 | /* We allow a Byte offset to Bit Offset conversion for this op */ |
1121 | /* We allow a Byte offset to Bit Offset conversion for this op */ |
1126 | 1122 | ||
1127 | if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) |
1123 | if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) |
1128 | { |
1124 | { |
1129 | /* Simply multiply byte offset times 8 to get bit offset */ |
1125 | /* Simply multiply byte offset times 8 to get bit offset */ |
1130 | 1126 | ||
1131 | Temp = ACPI_MUL_8 (Temp); |
1127 | Temp = ACPI_MUL_8 (Temp); |
1132 | } |
1128 | } |
1133 | break; |
1129 | break; |
1134 | 1130 | ||
1135 | 1131 | ||
1136 | case AML_CREATE_BIT_FIELD_OP: |
1132 | case AML_CREATE_BIT_FIELD_OP: |
1137 | 1133 | ||
1138 | /* This op requires a Bit Offset */ |
1134 | /* This op requires a Bit Offset */ |
1139 | 1135 | ||
1140 | if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) |
1136 | if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) |
1141 | { |
1137 | { |
1142 | AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL); |
1138 | AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL); |
1143 | } |
1139 | } |
1144 | break; |
1140 | break; |
1145 | 1141 | ||
1146 | 1142 | ||
1147 | case AML_CREATE_BYTE_FIELD_OP: |
1143 | case AML_CREATE_BYTE_FIELD_OP: |
1148 | case AML_CREATE_WORD_FIELD_OP: |
1144 | case AML_CREATE_WORD_FIELD_OP: |
1149 | case AML_CREATE_DWORD_FIELD_OP: |
1145 | case AML_CREATE_DWORD_FIELD_OP: |
1150 | case AML_CREATE_QWORD_FIELD_OP: |
1146 | case AML_CREATE_QWORD_FIELD_OP: |
1151 | case AML_INDEX_OP: |
1147 | case AML_INDEX_OP: |
1152 | 1148 | ||
1153 | /* These Ops require Byte offsets */ |
1149 | /* These Ops require Byte offsets */ |
1154 | 1150 | ||
1155 | if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET) |
1151 | if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET) |
1156 | { |
1152 | { |
1157 | AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL); |
1153 | AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL); |
1158 | } |
1154 | } |
1159 | break; |
1155 | break; |
1160 | 1156 | ||
1161 | 1157 | ||
1162 | default: |
1158 | default: |
1163 | /* Nothing to do for other opcodes */ |
1159 | /* Nothing to do for other opcodes */ |
1164 | break; |
1160 | break; |
1165 | } |
1161 | } |
1166 | 1162 | ||
1167 | /* Now convert this node to an integer whose value is the field offset */ |
1163 | /* Now convert this node to an integer whose value is the field offset */ |
1168 | 1164 | ||
1169 | Op->Asl.AmlLength = 0; |
1165 | Op->Asl.AmlLength = 0; |
1170 | Op->Asl.ParseOpcode = PARSEOP_INTEGER; |
1166 | Op->Asl.ParseOpcode = PARSEOP_INTEGER; |
1171 | Op->Asl.Value.Integer = (UINT64) Temp; |
1167 | Op->Asl.Value.Integer = (UINT64) Temp; |
1172 | Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; |
1168 | Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; |
1173 | 1169 | ||
1174 | OpcGenerateAmlOpcode (Op); |
1170 | OpcGenerateAmlOpcode (Op); |
1175 | } |
1171 | } |
1176 | 1172 | ||
1177 | /* 3) Check for a method invocation */ |
1173 | /* 3) Check for a method invocation */ |
1178 | 1174 | ||
1179 | else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) && |
1175 | else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) && |
1180 | (Node->Type == ACPI_TYPE_METHOD) && |
1176 | (Node->Type == ACPI_TYPE_METHOD) && |
1181 | (Op->Asl.Parent) && |
1177 | (Op->Asl.Parent) && |
1182 | (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD)) || |
1178 | (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD)) || |
1183 | 1179 | ||
1184 | (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) |
1180 | (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) |
1185 | { |
1181 | { |
1186 | 1182 | ||
1187 | /* |
1183 | /* |
1188 | * A reference to a method within one of these opcodes is not an |
1184 | * A reference to a method within one of these opcodes is not an |
1189 | * invocation of the method, it is simply a reference to the method. |
1185 | * invocation of the method, it is simply a reference to the method. |
1190 | */ |
1186 | */ |
1191 | if ((Op->Asl.Parent) && |
1187 | if ((Op->Asl.Parent) && |
1192 | ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) || |
1188 | ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) || |
1193 | (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) || |
1189 | (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) || |
1194 | (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE))) |
1190 | (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE))) |
1195 | { |
1191 | { |
1196 | return (AE_OK); |
1192 | return (AE_OK); |
1197 | } |
1193 | } |
1198 | /* |
1194 | /* |
1199 | * There are two types of method invocation: |
1195 | * There are two types of method invocation: |
1200 | * 1) Invocation with arguments -- the parser recognizes this |
1196 | * 1) Invocation with arguments -- the parser recognizes this |
1201 | * as a METHODCALL. |
1197 | * as a METHODCALL. |
1202 | * 2) Invocation with no arguments --the parser cannot determine that |
1198 | * 2) Invocation with no arguments --the parser cannot determine that |
1203 | * this is a method invocation, therefore we have to figure it out |
1199 | * this is a method invocation, therefore we have to figure it out |
1204 | * here. |
1200 | * here. |
1205 | */ |
1201 | */ |
1206 | if (Node->Type != ACPI_TYPE_METHOD) |
1202 | if (Node->Type != ACPI_TYPE_METHOD) |
1207 | { |
1203 | { |
1208 | sprintf (MsgBuffer, "%s is a %s", |
1204 | sprintf (MsgBuffer, "%s is a %s", |
1209 | Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); |
1205 | Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); |
1210 | 1206 | ||
1211 | AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer); |
1207 | AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer); |
1212 | return (AE_OK); |
1208 | return (AE_OK); |
1213 | } |
1209 | } |
1214 | 1210 | ||
1215 | /* Save the method node in the caller's op */ |
1211 | /* Save the method node in the caller's op */ |
1216 | 1212 | ||
1217 | Op->Asl.Node = Node; |
1213 | Op->Asl.Node = Node; |
1218 | if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF) |
1214 | if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF) |
1219 | { |
1215 | { |
1220 | return (AE_OK); |
1216 | return (AE_OK); |
1221 | } |
1217 | } |
1222 | 1218 | ||
1223 | /* |
1219 | /* |
1224 | * This is a method invocation, with or without arguments. |
1220 | * This is a method invocation, with or without arguments. |
1225 | * Count the number of arguments, each appears as a child |
1221 | * Count the number of arguments, each appears as a child |
1226 | * under the parent node |
1222 | * under the parent node |
1227 | */ |
1223 | */ |
1228 | Op->Asl.ParseOpcode = PARSEOP_METHODCALL; |
1224 | Op->Asl.ParseOpcode = PARSEOP_METHODCALL; |
1229 | UtSetParseOpName (Op); |
1225 | UtSetParseOpName (Op); |
1230 | 1226 | ||
1231 | PassedArgs = 0; |
1227 | PassedArgs = 0; |
1232 | NextOp = Op->Asl.Child; |
1228 | NextOp = Op->Asl.Child; |
1233 | 1229 | ||
1234 | while (NextOp) |
1230 | while (NextOp) |
1235 | { |
1231 | { |
1236 | PassedArgs++; |
1232 | PassedArgs++; |
1237 | NextOp = NextOp->Asl.Next; |
1233 | NextOp = NextOp->Asl.Next; |
1238 | } |
1234 | } |
1239 | 1235 | ||
1240 | if (Node->Value != ASL_EXTERNAL_METHOD) |
1236 | if (Node->Value != ASL_EXTERNAL_METHOD) |
1241 | { |
1237 | { |
1242 | /* |
1238 | /* |
1243 | * Check the parsed arguments with the number expected by the |
1239 | * Check the parsed arguments with the number expected by the |
1244 | * method declaration itself |
1240 | * method declaration itself |
1245 | */ |
1241 | */ |
1246 | if (PassedArgs != Node->Value) |
1242 | if (PassedArgs != Node->Value) |
1247 | { |
1243 | { |
1248 | sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, |
1244 | sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, |
1249 | Node->Value); |
1245 | Node->Value); |
1250 | 1246 | ||
1251 | if (PassedArgs < Node->Value) |
1247 | if (PassedArgs < Node->Value) |
1252 | { |
1248 | { |
1253 | AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer); |
1249 | AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer); |
1254 | } |
1250 | } |
1255 | else |
1251 | else |
1256 | { |
1252 | { |
1257 | AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer); |
1253 | AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer); |
1258 | } |
1254 | } |
1259 | } |
1255 | } |
1260 | } |
1256 | } |
1261 | } |
1257 | } |
1262 | 1258 | ||
1263 | /* 4) Check for an ASL Field definition */ |
1259 | /* 4) Check for an ASL Field definition */ |
1264 | 1260 | ||
1265 | else if ((Op->Asl.Parent) && |
1261 | else if ((Op->Asl.Parent) && |
1266 | ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) || |
1262 | ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) || |
1267 | (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD))) |
1263 | (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD))) |
1268 | { |
1264 | { |
1269 | /* |
1265 | /* |
1270 | * Offset checking for fields. If the parent operation region has a |
1266 | * Offset checking for fields. If the parent operation region has a |
1271 | * constant length (known at compile time), we can check fields |
1267 | * constant length (known at compile time), we can check fields |
1272 | * defined in that region against the region length. This will catch |
1268 | * defined in that region against the region length. This will catch |
1273 | * fields and field units that cannot possibly fit within the region. |
1269 | * fields and field units that cannot possibly fit within the region. |
1274 | * |
1270 | * |
1275 | * Note: Index fields do not directly reference an operation region, |
1271 | * Note: Index fields do not directly reference an operation region, |
1276 | * thus they are not included in this check. |
1272 | * thus they are not included in this check. |
1277 | */ |
1273 | */ |
1278 | if (Op == Op->Asl.Parent->Asl.Child) |
1274 | if (Op == Op->Asl.Parent->Asl.Child) |
1279 | { |
1275 | { |
1280 | /* |
1276 | /* |
1281 | * This is the first child of the field node, which is |
1277 | * This is the first child of the field node, which is |
1282 | * the name of the region. Get the parse node for the |
1278 | * the name of the region. Get the parse node for the |
1283 | * region -- which contains the length of the region. |
1279 | * region -- which contains the length of the region. |
1284 | */ |
1280 | */ |
1285 | OwningOp = Node->Op; |
1281 | OwningOp = Node->Op; |
1286 | Op->Asl.Parent->Asl.ExtraValue = |
1282 | Op->Asl.Parent->Asl.ExtraValue = |
1287 | ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer); |
1283 | ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer); |
1288 | 1284 | ||
1289 | /* Examine the field access width */ |
1285 | /* Examine the field access width */ |
1290 | 1286 | ||
1291 | switch ((UINT8) Op->Asl.Parent->Asl.Value.Integer) |
1287 | switch ((UINT8) Op->Asl.Parent->Asl.Value.Integer) |
1292 | { |
1288 | { |
1293 | case AML_FIELD_ACCESS_ANY: |
1289 | case AML_FIELD_ACCESS_ANY: |
1294 | case AML_FIELD_ACCESS_BYTE: |
1290 | case AML_FIELD_ACCESS_BYTE: |
1295 | case AML_FIELD_ACCESS_BUFFER: |
1291 | case AML_FIELD_ACCESS_BUFFER: |
1296 | default: |
1292 | default: |
1297 | MinimumLength = 1; |
1293 | MinimumLength = 1; |
1298 | break; |
1294 | break; |
1299 | 1295 | ||
1300 | case AML_FIELD_ACCESS_WORD: |
1296 | case AML_FIELD_ACCESS_WORD: |
1301 | MinimumLength = 2; |
1297 | MinimumLength = 2; |
1302 | break; |
1298 | break; |
1303 | 1299 | ||
1304 | case AML_FIELD_ACCESS_DWORD: |
1300 | case AML_FIELD_ACCESS_DWORD: |
1305 | MinimumLength = 4; |
1301 | MinimumLength = 4; |
1306 | break; |
1302 | break; |
1307 | 1303 | ||
1308 | case AML_FIELD_ACCESS_QWORD: |
1304 | case AML_FIELD_ACCESS_QWORD: |
1309 | MinimumLength = 8; |
1305 | MinimumLength = 8; |
1310 | break; |
1306 | break; |
1311 | } |
1307 | } |
1312 | 1308 | ||
1313 | /* |
1309 | /* |
1314 | * Is the region at least as big as the access width? |
1310 | * Is the region at least as big as the access width? |
1315 | * Note: DataTableRegions have 0 length |
1311 | * Note: DataTableRegions have 0 length |
1316 | */ |
1312 | */ |
1317 | if (((UINT32) OwningOp->Asl.Value.Integer) && |
1313 | if (((UINT32) OwningOp->Asl.Value.Integer) && |
1318 | ((UINT32) OwningOp->Asl.Value.Integer < MinimumLength)) |
1314 | ((UINT32) OwningOp->Asl.Value.Integer < MinimumLength)) |
1319 | { |
1315 | { |
1320 | AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL); |
1316 | AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL); |
1321 | } |
1317 | } |
1322 | 1318 | ||
1323 | /* |
1319 | /* |
1324 | * Check EC/CMOS/SMBUS fields to make sure that the correct |
1320 | * Check EC/CMOS/SMBUS fields to make sure that the correct |
1325 | * access type is used (BYTE for EC/CMOS, BUFFER for SMBUS) |
1321 | * access type is used (BYTE for EC/CMOS, BUFFER for SMBUS) |
1326 | */ |
1322 | */ |
1327 | SpaceIdOp = OwningOp->Asl.Child->Asl.Next; |
1323 | SpaceIdOp = OwningOp->Asl.Child->Asl.Next; |
1328 | switch ((UINT32) SpaceIdOp->Asl.Value.Integer) |
1324 | switch ((UINT32) SpaceIdOp->Asl.Value.Integer) |
1329 | { |
1325 | { |
1330 | case REGION_EC: |
1326 | case ACPI_ADR_SPACE_EC: |
1331 | case REGION_CMOS: |
1327 | case ACPI_ADR_SPACE_CMOS: |
1332 | 1328 | ||
1333 | if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE) |
1329 | if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BYTE) |
1334 | { |
1330 | { |
1335 | AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL); |
1331 | AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL); |
1336 | } |
1332 | } |
1337 | break; |
1333 | break; |
1338 | 1334 | ||
1339 | case REGION_SMBUS: |
1335 | case ACPI_ADR_SPACE_SMBUS: |
1340 | case REGION_IPMI: |
1336 | case ACPI_ADR_SPACE_IPMI: |
1341 | 1337 | ||
1342 | if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER) |
1338 | if ((UINT8) Op->Asl.Parent->Asl.Value.Integer != AML_FIELD_ACCESS_BUFFER) |
1343 | { |
1339 | { |
1344 | AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL); |
1340 | AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL); |
1345 | } |
1341 | } |
1346 | break; |
1342 | break; |
1347 | 1343 | ||
1348 | default: |
1344 | default: |
1349 | 1345 | ||
1350 | /* Nothing to do for other address spaces */ |
1346 | /* Nothing to do for other address spaces */ |
1351 | break; |
1347 | break; |
1352 | } |
1348 | } |
1353 | } |
1349 | } |
1354 | else |
1350 | else |
1355 | { |
1351 | { |
1356 | /* |
1352 | /* |
1357 | * This is one element of the field list. Check to make sure |
1353 | * This is one element of the field list. Check to make sure |
1358 | * that it does not go beyond the end of the parent operation region. |
1354 | * that it does not go beyond the end of the parent operation region. |
1359 | * |
1355 | * |
1360 | * In the code below: |
1356 | * In the code below: |
1361 | * Op->Asl.Parent->Asl.ExtraValue - Region Length (bits) |
1357 | * Op->Asl.Parent->Asl.ExtraValue - Region Length (bits) |
1362 | * Op->Asl.ExtraValue - Field start offset (bits) |
1358 | * Op->Asl.ExtraValue - Field start offset (bits) |
1363 | * Op->Asl.Child->Asl.Value.Integer32 - Field length (bits) |
1359 | * Op->Asl.Child->Asl.Value.Integer32 - Field length (bits) |
1364 | * Op->Asl.Child->Asl.ExtraValue - Field access width (bits) |
1360 | * Op->Asl.Child->Asl.ExtraValue - Field access width (bits) |
1365 | */ |
1361 | */ |
1366 | if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child) |
1362 | if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child) |
1367 | { |
1363 | { |
1368 | LkCheckFieldRange (Op, |
1364 | LkCheckFieldRange (Op, |
1369 | Op->Asl.Parent->Asl.ExtraValue, |
1365 | Op->Asl.Parent->Asl.ExtraValue, |
1370 | Op->Asl.ExtraValue, |
1366 | Op->Asl.ExtraValue, |
1371 | (UINT32) Op->Asl.Child->Asl.Value.Integer, |
1367 | (UINT32) Op->Asl.Child->Asl.Value.Integer, |
1372 | Op->Asl.Child->Asl.ExtraValue); |
1368 | Op->Asl.Child->Asl.ExtraValue); |
1373 | } |
1369 | } |
1374 | } |
1370 | } |
1375 | } |
1371 | } |
1376 | 1372 | ||
1377 | Op->Asl.Node = Node; |
1373 | Op->Asl.Node = Node; |
1378 | return (Status); |
1374 | return (Status); |
1379 | } |
1375 | } |
1380 | 1376 | ||
1381 | 1377 | ||
1382 | /******************************************************************************* |
1378 | /******************************************************************************* |
1383 | * |
1379 | * |
1384 | * FUNCTION: LkNamespaceLocateEnd |
1380 | * FUNCTION: LkNamespaceLocateEnd |
1385 | * |
1381 | * |
1386 | * PARAMETERS: ASL_WALK_CALLBACK |
1382 | * PARAMETERS: ASL_WALK_CALLBACK |
1387 | * |
1383 | * |
1388 | * RETURN: Status |
1384 | * RETURN: Status |
1389 | * |
1385 | * |
1390 | * DESCRIPTION: Ascending callback used during cross reference. We only |
1386 | * DESCRIPTION: Ascending callback used during cross reference. We only |
1391 | * need to worry about scope management here. |
1387 | * need to worry about scope management here. |
1392 | * |
1388 | * |
1393 | ******************************************************************************/ |
1389 | ******************************************************************************/ |
1394 | 1390 | ||
1395 | static ACPI_STATUS |
1391 | static ACPI_STATUS |
1396 | LkNamespaceLocateEnd ( |
1392 | LkNamespaceLocateEnd ( |
1397 | ACPI_PARSE_OBJECT *Op, |
1393 | ACPI_PARSE_OBJECT *Op, |
1398 | UINT32 Level, |
1394 | UINT32 Level, |
1399 | void *Context) |
1395 | void *Context) |
1400 | { |
1396 | { |
1401 | ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; |
1397 | ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; |
1402 | const ACPI_OPCODE_INFO *OpInfo; |
1398 | const ACPI_OPCODE_INFO *OpInfo; |
1403 | 1399 | ||
1404 | 1400 | ||
1405 | ACPI_FUNCTION_TRACE (LkNamespaceLocateEnd); |
1401 | ACPI_FUNCTION_TRACE (LkNamespaceLocateEnd); |
1406 | 1402 | ||
1407 | 1403 | ||
1408 | /* We are only interested in opcodes that have an associated name */ |
1404 | /* We are only interested in opcodes that have an associated name */ |
1409 | 1405 | ||
1410 | OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); |
1406 | OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); |
1411 | if (!(OpInfo->Flags & AML_NAMED)) |
1407 | if (!(OpInfo->Flags & AML_NAMED)) |
1412 | { |
1408 | { |
1413 | return (AE_OK); |
1409 | return (AE_OK); |
1414 | } |
1410 | } |
1415 | 1411 | ||
1416 | /* Not interested in name references, we did not open a scope for them */ |
1412 | /* Not interested in name references, we did not open a scope for them */ |
1417 | 1413 | ||
1418 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || |
1414 | if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || |
1419 | (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
1415 | (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || |
1420 | (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) |
1416 | (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) |
1421 | { |
1417 | { |
1422 | return (AE_OK); |
1418 | return (AE_OK); |
1423 | } |
1419 | } |
1424 | 1420 | ||
1425 | /* Pop the scope stack if necessary */ |
1421 | /* Pop the scope stack if necessary */ |
1426 | 1422 | ||
1427 | if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode))) |
1423 | if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode))) |
1428 | { |
1424 | { |
1429 | 1425 | ||
1430 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
1426 | ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, |
1431 | "%s: Popping scope for Op %p\n", |
1427 | "%s: Popping scope for Op %p\n", |
1432 | AcpiUtGetTypeName (OpInfo->ObjectType), Op)); |
1428 | AcpiUtGetTypeName (OpInfo->ObjectType), Op)); |
1433 | 1429 | ||
1434 | (void) AcpiDsScopeStackPop (WalkState); |
1430 | (void) AcpiDsScopeStackPop (WalkState); |
1435 | } |
1431 | } |
1436 | 1432 | ||
1437 | return (AE_OK); |
1433 | return (AE_OK); |
1438 | }>>--> |
1434 | }>>--> |