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: aslopt- Compiler optimizations |
3 | * Module Name: aslopt- Compiler optimizations |
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 | 123 | ||
124 | 124 | ||
125 | #define _COMPONENT ACPI_COMPILER |
125 | #define _COMPONENT ACPI_COMPILER |
126 | ACPI_MODULE_NAME ("aslopt") |
126 | ACPI_MODULE_NAME ("aslopt") |
127 | 127 | ||
128 | 128 | ||
129 | static UINT32 OptTotal = 0; |
129 | static UINT32 OptTotal = 0; |
130 | 130 | ||
131 | /* Local prototypes */ |
131 | /* Local prototypes */ |
132 | 132 | ||
133 | static ACPI_STATUS |
133 | static ACPI_STATUS |
134 | OptSearchToRoot ( |
134 | OptSearchToRoot ( |
135 | ACPI_PARSE_OBJECT *Op, |
135 | ACPI_PARSE_OBJECT *Op, |
136 | ACPI_WALK_STATE *WalkState, |
136 | ACPI_WALK_STATE *WalkState, |
137 | ACPI_NAMESPACE_NODE *CurrentNode, |
137 | ACPI_NAMESPACE_NODE *CurrentNode, |
138 | ACPI_NAMESPACE_NODE *TargetNode, |
138 | ACPI_NAMESPACE_NODE *TargetNode, |
139 | ACPI_BUFFER *TargetPath, |
139 | ACPI_BUFFER *TargetPath, |
140 | char **NewPath); |
140 | char **NewPath); |
141 | 141 | ||
142 | static ACPI_STATUS |
142 | static ACPI_STATUS |
143 | OptBuildShortestPath ( |
143 | OptBuildShortestPath ( |
144 | ACPI_PARSE_OBJECT *Op, |
144 | ACPI_PARSE_OBJECT *Op, |
145 | ACPI_WALK_STATE *WalkState, |
145 | ACPI_WALK_STATE *WalkState, |
146 | ACPI_NAMESPACE_NODE *CurrentNode, |
146 | ACPI_NAMESPACE_NODE *CurrentNode, |
147 | ACPI_NAMESPACE_NODE *TargetNode, |
147 | ACPI_NAMESPACE_NODE *TargetNode, |
148 | ACPI_BUFFER *CurrentPath, |
148 | ACPI_BUFFER *CurrentPath, |
149 | ACPI_BUFFER *TargetPath, |
149 | ACPI_BUFFER *TargetPath, |
150 | ACPI_SIZE AmlNameStringLength, |
150 | ACPI_SIZE AmlNameStringLength, |
151 | UINT8 IsDeclaration, |
151 | UINT8 IsDeclaration, |
152 | char **ReturnNewPath); |
152 | char **ReturnNewPath); |
153 | 153 | ||
154 | static ACPI_STATUS |
154 | static ACPI_STATUS |
155 | OptOptimizeNameDeclaration ( |
155 | OptOptimizeNameDeclaration ( |
156 | ACPI_PARSE_OBJECT *Op, |
156 | ACPI_PARSE_OBJECT *Op, |
157 | ACPI_WALK_STATE *WalkState, |
157 | ACPI_WALK_STATE *WalkState, |
158 | ACPI_NAMESPACE_NODE *CurrentNode, |
158 | ACPI_NAMESPACE_NODE *CurrentNode, |
159 | ACPI_NAMESPACE_NODE *TargetNode, |
159 | ACPI_NAMESPACE_NODE *TargetNode, |
160 | char *AmlNameString, |
160 | char *AmlNameString, |
161 | char **NewPath); |
161 | char **NewPath); |
162 | 162 | ||
163 | 163 | ||
164 | /******************************************************************************* |
164 | /******************************************************************************* |
165 | * |
165 | * |
166 | * FUNCTION: OptSearchToRoot |
166 | * FUNCTION: OptSearchToRoot |
167 | * |
167 | * |
168 | * PARAMETERS: Op - Current parser op |
168 | * PARAMETERS: Op - Current parser op |
169 | * WalkState - Current state |
169 | * WalkState - Current state |
170 | * CurrentNode - Where we are in the namespace |
170 | * CurrentNode - Where we are in the namespace |
171 | * TargetNode - Node to which we are referring |
171 | * TargetNode - Node to which we are referring |
172 | * TargetPath - External full path to the target node |
172 | * TargetPath - External full path to the target node |
173 | * NewPath - Where the optimized path is returned |
173 | * NewPath - Where the optimized path is returned |
174 | * |
174 | * |
175 | * RETURN: Status |
175 | * RETURN: Status |
176 | * |
176 | * |
177 | * DESCRIPTION: Attempt to optimize a reference to a single 4-character ACPI |
177 | * DESCRIPTION: Attempt to optimize a reference to a single 4-character ACPI |
178 | * name utilizing the search-to-root name resolution algorithm |
178 | * name utilizing the search-to-root name resolution algorithm |
179 | * that is used by AML interpreters. |
179 | * that is used by AML interpreters. |
180 | * |
180 | * |
181 | ******************************************************************************/ |
181 | ******************************************************************************/ |
182 | 182 | ||
183 | static ACPI_STATUS |
183 | static ACPI_STATUS |
184 | OptSearchToRoot ( |
184 | OptSearchToRoot ( |
185 | ACPI_PARSE_OBJECT *Op, |
185 | ACPI_PARSE_OBJECT *Op, |
186 | ACPI_WALK_STATE *WalkState, |
186 | ACPI_WALK_STATE *WalkState, |
187 | ACPI_NAMESPACE_NODE *CurrentNode, |
187 | ACPI_NAMESPACE_NODE *CurrentNode, |
188 | ACPI_NAMESPACE_NODE *TargetNode, |
188 | ACPI_NAMESPACE_NODE *TargetNode, |
189 | ACPI_BUFFER *TargetPath, |
189 | ACPI_BUFFER *TargetPath, |
190 | char **NewPath) |
190 | char **NewPath) |
191 | { |
191 | { |
192 | ACPI_NAMESPACE_NODE *Node; |
192 | ACPI_NAMESPACE_NODE *Node; |
193 | ACPI_GENERIC_STATE ScopeInfo; |
193 | ACPI_GENERIC_STATE ScopeInfo; |
194 | ACPI_STATUS Status; |
194 | ACPI_STATUS Status; |
195 | char *Path; |
195 | char *Path; |
196 | 196 | ||
197 | 197 | ||
198 | ACPI_FUNCTION_NAME (OptSearchToRoot); |
198 | ACPI_FUNCTION_NAME (OptSearchToRoot); |
199 | 199 | ||
200 | 200 | ||
201 | /* |
201 | /* |
202 | * Check if search-to-root can be utilized. Use the last NameSeg of |
202 | * Check if search-to-root can be utilized. Use the last NameSeg of |
203 | * the NamePath and 1) See if can be found and 2) If found, make |
203 | * the NamePath and 1) See if can be found and 2) If found, make |
204 | * sure that it is the same node that we want. If there is another |
204 | * sure that it is the same node that we want. If there is another |
205 | * name in the search path before the one we want, the nodes will |
205 | * name in the search path before the one we want, the nodes will |
206 | * not match, and we cannot use this optimization. |
206 | * not match, and we cannot use this optimization. |
207 | */ |
207 | */ |
208 | Path = &(((char *) TargetPath->Pointer)[TargetPath->Length - |
208 | Path = &(((char *) TargetPath->Pointer)[TargetPath->Length - |
209 | ACPI_NAME_SIZE]), |
209 | ACPI_NAME_SIZE]), |
210 | ScopeInfo.Scope.Node = CurrentNode; |
210 | ScopeInfo.Scope.Node = CurrentNode; |
211 | 211 | ||
212 | /* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */ |
212 | /* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */ |
213 | 213 | ||
214 | Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
214 | Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
215 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, |
215 | ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, |
216 | WalkState, &(Node)); |
216 | WalkState, &(Node)); |
217 | if (ACPI_FAILURE (Status)) |
217 | if (ACPI_FAILURE (Status)) |
218 | { |
218 | { |
219 | return (Status); |
219 | return (Status); |
220 | } |
220 | } |
221 | 221 | ||
222 | /* |
222 | /* |
223 | * We found the name, but we must check to make sure that the node |
223 | * We found the name, but we must check to make sure that the node |
224 | * matches. Otherwise, there is another identical name in the search |
224 | * matches. Otherwise, there is another identical name in the search |
225 | * path that precludes the use of this optimization. |
225 | * path that precludes the use of this optimization. |
226 | */ |
226 | */ |
227 | if (Node != TargetNode) |
227 | if (Node != TargetNode) |
228 | { |
228 | { |
229 | /* |
229 | /* |
230 | * This means that another object with the same name was found first, |
230 | * This means that another object with the same name was found first, |
231 | * and we cannot use this optimization. |
231 | * and we cannot use this optimization. |
232 | */ |
232 | */ |
233 | return (AE_NOT_FOUND); |
233 | return (AE_NOT_FOUND); |
234 | } |
234 | } |
235 | 235 | ||
236 | /* Found the node, we can use this optimization */ |
236 | /* Found the node, we can use this optimization */ |
237 | 237 | ||
238 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
238 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
239 | "NAMESEG: %-24s", Path)); |
239 | "NAMESEG: %-24s", Path)); |
240 | 240 | ||
241 | /* We must allocate a new string for the name (TargetPath gets deleted) */ |
241 | /* We must allocate a new string for the name (TargetPath gets deleted) */ |
242 | 242 | ||
243 | *NewPath = ACPI_ALLOCATE_ZEROED (ACPI_NAME_SIZE + 1); |
243 | *NewPath = ACPI_ALLOCATE_ZEROED (ACPI_NAME_SIZE + 1); |
244 | ACPI_STRCPY (*NewPath, Path); |
244 | ACPI_STRCPY (*NewPath, Path); |
245 | 245 | ||
246 | if (ACPI_STRNCMP (*NewPath, "_T_", 3)) |
246 | if (ACPI_STRNCMP (*NewPath, "_T_", 3)) |
247 | { |
247 | { |
248 | AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, Op, |
248 | AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, Op, |
249 | *NewPath); |
249 | *NewPath); |
250 | } |
250 | } |
251 | 251 | ||
252 | return (AE_OK); |
252 | return (AE_OK); |
253 | } |
253 | } |
254 | 254 | ||
255 | 255 | ||
256 | /******************************************************************************* |
256 | /******************************************************************************* |
257 | * |
257 | * |
258 | * FUNCTION: OptBuildShortestPath |
258 | * FUNCTION: OptBuildShortestPath |
259 | * |
259 | * |
260 | * PARAMETERS: Op - Current parser op |
260 | * PARAMETERS: Op - Current parser op |
261 | * WalkState - Current state |
261 | * WalkState - Current state |
262 | * CurrentNode - Where we are in the namespace |
262 | * CurrentNode - Where we are in the namespace |
263 | * TargetNode - Node to which we are referring |
263 | * TargetNode - Node to which we are referring |
264 | * CurrentPath - External full path to the current node |
264 | * CurrentPath - External full path to the current node |
265 | * TargetPath - External full path to the target node |
265 | * TargetPath - External full path to the target node |
266 | * AmlNameStringLength - Length of the original namepath |
266 | * AmlNameStringLength - Length of the original namepath |
267 | * IsDeclaration - TRUE for declaration, FALSE for reference |
267 | * IsDeclaration - TRUE for declaration, FALSE for reference |
268 | * ReturnNewPath - Where the optimized path is returned |
268 | * ReturnNewPath - Where the optimized path is returned |
269 | * |
269 | * |
270 | * RETURN: Status |
270 | * RETURN: Status |
271 | * |
271 | * |
272 | * DESCRIPTION: Build an optimal NamePath using carats |
272 | * DESCRIPTION: Build an optimal NamePath using carats |
273 | * |
273 | * |
274 | ******************************************************************************/ |
274 | ******************************************************************************/ |
275 | 275 | ||
276 | static ACPI_STATUS |
276 | static ACPI_STATUS |
277 | OptBuildShortestPath ( |
277 | OptBuildShortestPath ( |
278 | ACPI_PARSE_OBJECT *Op, |
278 | ACPI_PARSE_OBJECT *Op, |
279 | ACPI_WALK_STATE *WalkState, |
279 | ACPI_WALK_STATE *WalkState, |
280 | ACPI_NAMESPACE_NODE *CurrentNode, |
280 | ACPI_NAMESPACE_NODE *CurrentNode, |
281 | ACPI_NAMESPACE_NODE *TargetNode, |
281 | ACPI_NAMESPACE_NODE *TargetNode, |
282 | ACPI_BUFFER *CurrentPath, |
282 | ACPI_BUFFER *CurrentPath, |
283 | ACPI_BUFFER *TargetPath, |
283 | ACPI_BUFFER *TargetPath, |
284 | ACPI_SIZE AmlNameStringLength, |
284 | ACPI_SIZE AmlNameStringLength, |
285 | UINT8 IsDeclaration, |
285 | UINT8 IsDeclaration, |
286 | char **ReturnNewPath) |
286 | char **ReturnNewPath) |
287 | { |
287 | { |
288 | UINT32 NumCommonSegments; |
288 | UINT32 NumCommonSegments; |
289 | UINT32 MaxCommonSegments; |
289 | UINT32 MaxCommonSegments; |
290 | UINT32 Index; |
290 | UINT32 Index; |
291 | UINT32 NumCarats; |
291 | UINT32 NumCarats; |
292 | UINT32 i; |
292 | UINT32 i; |
293 | char *NewPath; |
293 | char *NewPath; |
294 | char *NewPathExternal; |
294 | char *NewPathExternal; |
295 | ACPI_NAMESPACE_NODE *Node; |
295 | ACPI_NAMESPACE_NODE *Node; |
296 | ACPI_GENERIC_STATE ScopeInfo; |
296 | ACPI_GENERIC_STATE ScopeInfo; |
297 | ACPI_STATUS Status; |
297 | ACPI_STATUS Status; |
298 | BOOLEAN SubPath = FALSE; |
298 | BOOLEAN SubPath = FALSE; |
299 | 299 | ||
300 | 300 | ||
301 | ACPI_FUNCTION_NAME (OptBuildShortestPath); |
301 | ACPI_FUNCTION_NAME (OptBuildShortestPath); |
302 | 302 | ||
303 | 303 | ||
304 | ScopeInfo.Scope.Node = CurrentNode; |
304 | ScopeInfo.Scope.Node = CurrentNode; |
305 | 305 | ||
306 | /* |
306 | /* |
307 | * Determine the maximum number of NameSegs that the Target and Current paths |
307 | * Determine the maximum number of NameSegs that the Target and Current paths |
308 | * can possibly have in common. (To optimize, we have to have at least 1) |
308 | * can possibly have in common. (To optimize, we have to have at least 1) |
309 | * |
309 | * |
310 | * Note: The external NamePath string lengths are always a multiple of 5 |
310 | * Note: The external NamePath string lengths are always a multiple of 5 |
311 | * (ACPI_NAME_SIZE + separator) |
311 | * (ACPI_NAME_SIZE + separator) |
312 | */ |
312 | */ |
313 | MaxCommonSegments = TargetPath->Length / ACPI_PATH_SEGMENT_LENGTH; |
313 | MaxCommonSegments = TargetPath->Length / ACPI_PATH_SEGMENT_LENGTH; |
314 | if (CurrentPath->Length < TargetPath->Length) |
314 | if (CurrentPath->Length < TargetPath->Length) |
315 | { |
315 | { |
316 | MaxCommonSegments = CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH; |
316 | MaxCommonSegments = CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH; |
317 | } |
317 | } |
318 | 318 | ||
319 | /* |
319 | /* |
320 | * Determine how many NameSegs the two paths have in common. |
320 | * Determine how many NameSegs the two paths have in common. |
321 | * (Starting from the root) |
321 | * (Starting from the root) |
322 | */ |
322 | */ |
323 | for (NumCommonSegments = 0; |
323 | for (NumCommonSegments = 0; |
324 | NumCommonSegments < MaxCommonSegments; |
324 | NumCommonSegments < MaxCommonSegments; |
325 | NumCommonSegments++) |
325 | NumCommonSegments++) |
326 | { |
326 | { |
327 | /* Compare two single NameSegs */ |
327 | /* Compare two single NameSegs */ |
328 | 328 | ||
329 | if (ACPI_STRNCMP ( |
329 | if (ACPI_STRNCMP ( |
330 | &((char *) TargetPath->Pointer)[(NumCommonSegments * |
330 | &((char *) TargetPath->Pointer)[(NumCommonSegments * |
331 | ACPI_PATH_SEGMENT_LENGTH) + 1], |
331 | ACPI_PATH_SEGMENT_LENGTH) + 1], |
332 | &((char *) CurrentPath->Pointer)[(NumCommonSegments * |
332 | &((char *) CurrentPath->Pointer)[(NumCommonSegments * |
333 | ACPI_PATH_SEGMENT_LENGTH) + 1], |
333 | ACPI_PATH_SEGMENT_LENGTH) + 1], |
334 | ACPI_NAME_SIZE)) |
334 | ACPI_NAME_SIZE)) |
335 | { |
335 | { |
336 | /* Mismatch */ |
336 | /* Mismatch */ |
337 | 337 | ||
338 | break; |
338 | break; |
339 | } |
339 | } |
340 | } |
340 | } |
341 | 341 | ||
342 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %u", |
342 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %u", |
343 | NumCommonSegments)); |
343 | NumCommonSegments)); |
344 | 344 | ||
345 | /* There must be at least 1 common NameSeg in order to optimize */ |
345 | /* There must be at least 1 common NameSeg in order to optimize */ |
346 | 346 | ||
347 | if (NumCommonSegments == 0) |
347 | if (NumCommonSegments == 0) |
348 | { |
348 | { |
349 | return (AE_NOT_FOUND); |
349 | return (AE_NOT_FOUND); |
350 | } |
350 | } |
351 | 351 | ||
352 | if (NumCommonSegments == MaxCommonSegments) |
352 | if (NumCommonSegments == MaxCommonSegments) |
353 | { |
353 | { |
354 | if (CurrentPath->Length == TargetPath->Length) |
354 | if (CurrentPath->Length == TargetPath->Length) |
355 | { |
355 | { |
356 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SAME PATH")); |
356 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SAME PATH")); |
357 | return (AE_NOT_FOUND); |
357 | return (AE_NOT_FOUND); |
358 | } |
358 | } |
359 | else |
359 | else |
360 | { |
360 | { |
361 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SUBPATH")); |
361 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SUBPATH")); |
362 | SubPath = TRUE; |
362 | SubPath = TRUE; |
363 | } |
363 | } |
364 | } |
364 | } |
365 | 365 | ||
366 | /* Determine how many prefix Carats are required */ |
366 | /* Determine how many prefix Carats are required */ |
367 | 367 | ||
368 | NumCarats = (CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH) - |
368 | NumCarats = (CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH) - |
369 | NumCommonSegments; |
369 | NumCommonSegments; |
370 | 370 | ||
371 | /* |
371 | /* |
372 | * Construct a new target string |
372 | * Construct a new target string |
373 | */ |
373 | */ |
374 | NewPathExternal = ACPI_ALLOCATE_ZEROED ( |
374 | NewPathExternal = ACPI_ALLOCATE_ZEROED ( |
375 | TargetPath->Length + NumCarats + 1); |
375 | TargetPath->Length + NumCarats + 1); |
376 | 376 | ||
377 | /* Insert the Carats into the Target string */ |
377 | /* Insert the Carats into the Target string */ |
378 | 378 | ||
379 | for (i = 0; i < NumCarats; i++) |
379 | for (i = 0; i < NumCarats; i++) |
380 | { |
380 | { |
381 | NewPathExternal[i] = '^'; |
381 | NewPathExternal[i] = '^'; |
382 | } |
382 | } |
383 | 383 | ||
384 | /* |
384 | /* |
385 | * Copy only the necessary (optimal) segments from the original |
385 | * Copy only the necessary (optimal) segments from the original |
386 | * target string |
386 | * target string |
387 | */ |
387 | */ |
388 | Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1; |
388 | Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1; |
389 | 389 | ||
390 | /* Special handling for exact subpath in a name declaration */ |
390 | /* Special handling for exact subpath in a name declaration */ |
391 | 391 | ||
392 | if (IsDeclaration && SubPath && (CurrentPath->Length > TargetPath->Length)) |
392 | if (IsDeclaration && SubPath && (CurrentPath->Length > TargetPath->Length)) |
393 | { |
393 | { |
394 | /* |
394 | /* |
395 | * The current path is longer than the target, and the target is a |
395 | * The current path is longer than the target, and the target is a |
396 | * subpath of the current path. We must include one more NameSeg of |
396 | * subpath of the current path. We must include one more NameSeg of |
397 | * the target path |
397 | * the target path |
398 | */ |
398 | */ |
399 | Index -= ACPI_PATH_SEGMENT_LENGTH; |
399 | Index -= ACPI_PATH_SEGMENT_LENGTH; |
400 | 400 | ||
401 | /* Special handling for Scope() operator */ |
401 | /* Special handling for Scope() operator */ |
402 | 402 | ||
403 | if (Op->Asl.AmlOpcode == AML_SCOPE_OP) |
403 | if (Op->Asl.AmlOpcode == AML_SCOPE_OP) |
404 | { |
404 | { |
405 | NewPathExternal[i] = '^'; |
405 | NewPathExternal[i] = '^'; |
406 | i++; |
406 | i++; |
407 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "(EXTRA ^)")); |
407 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "(EXTRA ^)")); |
408 | } |
408 | } |
409 | } |
409 | } |
410 | 410 | ||
411 | /* Make sure we haven't gone off the end of the target path */ |
411 | /* Make sure we haven't gone off the end of the target path */ |
412 | 412 | ||
413 | if (Index > TargetPath->Length) |
413 | if (Index > TargetPath->Length) |
414 | { |
414 | { |
415 | Index = TargetPath->Length; |
415 | Index = TargetPath->Length; |
416 | } |
416 | } |
417 | 417 | ||
418 | ACPI_STRCPY (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]); |
418 | ACPI_STRCPY (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]); |
419 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal)); |
419 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal)); |
420 | 420 | ||
421 | /* |
421 | /* |
422 | * Internalize the new target string and check it against the original |
422 | * Internalize the new target string and check it against the original |
423 | * string to make sure that this is in fact an optimization. If the |
423 | * string to make sure that this is in fact an optimization. If the |
424 | * original string is already optimal, there is no point in continuing. |
424 | * original string is already optimal, there is no point in continuing. |
425 | */ |
425 | */ |
426 | Status = AcpiNsInternalizeName (NewPathExternal, &NewPath); |
426 | Status = AcpiNsInternalizeName (NewPathExternal, &NewPath); |
427 | if (ACPI_FAILURE (Status)) |
427 | if (ACPI_FAILURE (Status)) |
428 | { |
428 | { |
429 | AslCoreSubsystemError (Op, Status, "Internalizing new NamePath", |
429 | AslCoreSubsystemError (Op, Status, "Internalizing new NamePath", |
430 | ASL_NO_ABORT); |
430 | ASL_NO_ABORT); |
431 | ACPI_FREE (NewPathExternal); |
431 | ACPI_FREE (NewPathExternal); |
432 | return (Status); |
432 | return (Status); |
433 | } |
433 | } |
434 | 434 | ||
435 | if (ACPI_STRLEN (NewPath) >= AmlNameStringLength) |
435 | if (ACPI_STRLEN (NewPath) >= AmlNameStringLength) |
436 | { |
436 | { |
437 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
437 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
438 | " NOT SHORTER (New %u old %u)", |
438 | " NOT SHORTER (New %u old %u)", |
439 | (UINT32) ACPI_STRLEN (NewPath), (UINT32) AmlNameStringLength)); |
439 | (UINT32) ACPI_STRLEN (NewPath), (UINT32) AmlNameStringLength)); |
440 | ACPI_FREE (NewPathExternal); |
440 | ACPI_FREE (NewPathExternal); |
441 | return (AE_NOT_FOUND); |
441 | return (AE_NOT_FOUND); |
442 | } |
442 | } |
443 | 443 | ||
444 | /* |
444 | /* |
445 | * Check to make sure that the optimization finds the node we are |
445 | * Check to make sure that the optimization finds the node we are |
446 | * looking for. This is simply a sanity check on the new |
446 | * looking for. This is simply a sanity check on the new |
447 | * path that has been created. |
447 | * path that has been created. |
448 | */ |
448 | */ |
449 | Status = AcpiNsLookup (&ScopeInfo, NewPath, |
449 | Status = AcpiNsLookup (&ScopeInfo, NewPath, |
450 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
450 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
451 | ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); |
451 | ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); |
452 | if (ACPI_SUCCESS (Status)) |
452 | if (ACPI_SUCCESS (Status)) |
453 | { |
453 | { |
454 | /* Found the namepath, but make sure the node is correct */ |
454 | /* Found the namepath, but make sure the node is correct */ |
455 | 455 | ||
456 | if (Node == TargetNode) |
456 | if (Node == TargetNode) |
457 | { |
457 | { |
458 | /* The lookup matched the node, accept this optimization */ |
458 | /* The lookup matched the node, accept this optimization */ |
459 | 459 | ||
460 | AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, |
460 | AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, |
461 | Op, NewPathExternal); |
461 | Op, NewPathExternal); |
462 | *ReturnNewPath = NewPath; |
462 | *ReturnNewPath = NewPath; |
463 | } |
463 | } |
464 | else |
464 | else |
465 | { |
465 | { |
466 | /* Node is not correct, do not use this optimization */ |
466 | /* Node is not correct, do not use this optimization */ |
467 | 467 | ||
468 | Status = AE_NOT_FOUND; |
468 | Status = AE_NOT_FOUND; |
469 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE")); |
469 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE")); |
470 | AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, |
470 | AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, |
471 | "Not using optimized name - found wrong node"); |
471 | "Not using optimized name - found wrong node"); |
472 | } |
472 | } |
473 | } |
473 | } |
474 | else |
474 | else |
475 | { |
475 | { |
476 | /* The lookup failed, we obviously cannot use this optimization */ |
476 | /* The lookup failed, we obviously cannot use this optimization */ |
477 | 477 | ||
478 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND")); |
478 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND")); |
479 | AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, |
479 | AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, |
480 | "Not using optimized name - did not find node"); |
480 | "Not using optimized name - did not find node"); |
481 | } |
481 | } |
482 | 482 | ||
483 | ACPI_FREE (NewPathExternal); |
483 | ACPI_FREE (NewPathExternal); |
484 | return (Status); |
484 | return (Status); |
485 | } |
485 | } |
486 | 486 | ||
487 | 487 | ||
488 | /******************************************************************************* |
488 | /******************************************************************************* |
489 | * |
489 | * |
490 | * FUNCTION: OptOptimizeNameDeclaration |
490 | * FUNCTION: OptOptimizeNameDeclaration |
491 | * |
491 | * |
492 | * PARAMETERS: Op - Current parser op |
492 | * PARAMETERS: Op - Current parser op |
493 | * WalkState - Current state |
493 | * WalkState - Current state |
494 | * CurrentNode - Where we are in the namespace |
494 | * CurrentNode - Where we are in the namespace |
495 | * AmlNameString - Unoptimized namepath |
495 | * AmlNameString - Unoptimized namepath |
496 | * NewPath - Where the optimized path is returned |
496 | * NewPath - Where the optimized path is returned |
497 | * |
497 | * |
498 | * RETURN: Status. AE_OK If path is optimized |
498 | * RETURN: Status. AE_OK If path is optimized |
499 | * |
499 | * |
500 | * DESCRIPTION: Perform a simple optimization of removing an extraneous |
500 | * DESCRIPTION: Perform a simple optimization of removing an extraneous |
501 | * backslash prefix if we are already at the root scope. |
501 | * backslash prefix if we are already at the root scope. |
502 | * |
502 | * |
503 | ******************************************************************************/ |
503 | ******************************************************************************/ |
504 | 504 | ||
505 | static ACPI_STATUS |
505 | static ACPI_STATUS |
506 | OptOptimizeNameDeclaration ( |
506 | OptOptimizeNameDeclaration ( |
507 | ACPI_PARSE_OBJECT *Op, |
507 | ACPI_PARSE_OBJECT *Op, |
508 | ACPI_WALK_STATE *WalkState, |
508 | ACPI_WALK_STATE *WalkState, |
509 | ACPI_NAMESPACE_NODE *CurrentNode, |
509 | ACPI_NAMESPACE_NODE *CurrentNode, |
510 | ACPI_NAMESPACE_NODE *TargetNode, |
510 | ACPI_NAMESPACE_NODE *TargetNode, |
511 | char *AmlNameString, |
511 | char *AmlNameString, |
512 | char **NewPath) |
512 | char **NewPath) |
513 | { |
513 | { |
514 | ACPI_STATUS Status; |
514 | ACPI_STATUS Status; |
515 | char *NewPathExternal; |
515 | char *NewPathExternal; |
516 | ACPI_GENERIC_STATE ScopeInfo; |
516 | ACPI_GENERIC_STATE ScopeInfo; |
517 | ACPI_NAMESPACE_NODE *Node; |
517 | ACPI_NAMESPACE_NODE *Node; |
518 | 518 | ||
519 | 519 | ||
520 | ACPI_FUNCTION_TRACE (OptOptimizeNameDeclaration); |
520 | ACPI_FUNCTION_TRACE (OptOptimizeNameDeclaration); |
521 | 521 | ||
522 | 522 | ||
523 | if (((CurrentNode == AcpiGbl_RootNode) || |
523 | if (((CurrentNode == AcpiGbl_RootNode) || |
524 | (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) && |
524 | (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) && |
525 | (AmlNameString[0] == '\\')) |
525 | (AmlNameString[0] == '\\')) |
526 | { |
526 | { |
527 | /* |
527 | /* |
528 | * The current scope is the root, and the namepath has a root prefix |
528 | * The current scope is the root, and the namepath has a root prefix |
529 | * that is therefore extraneous. Remove it. |
529 | * that is therefore extraneous. Remove it. |
530 | */ |
530 | */ |
531 | *NewPath = &AmlNameString[1]; |
531 | *NewPath = &AmlNameString[1]; |
532 | 532 | ||
533 | /* Debug output */ |
533 | /* Debug output */ |
534 | 534 | ||
535 | Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, *NewPath, |
535 | Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, *NewPath, |
536 | NULL, &NewPathExternal); |
536 | NULL, &NewPathExternal); |
537 | if (ACPI_FAILURE (Status)) |
537 | if (ACPI_FAILURE (Status)) |
538 | { |
538 | { |
539 | AslCoreSubsystemError (Op, Status, "Externalizing NamePath", |
539 | AslCoreSubsystemError (Op, Status, "Externalizing NamePath", |
540 | ASL_NO_ABORT); |
540 | ASL_NO_ABORT); |
541 | return (Status); |
541 | return (Status); |
542 | } |
542 | } |
543 | 543 | ||
544 | /* |
544 | /* |
545 | * Check to make sure that the optimization finds the node we are |
545 | * Check to make sure that the optimization finds the node we are |
546 | * looking for. This is simply a sanity check on the new |
546 | * looking for. This is simply a sanity check on the new |
547 | * path that has been created. |
547 | * path that has been created. |
548 | */ |
548 | */ |
549 | ScopeInfo.Scope.Node = CurrentNode; |
549 | ScopeInfo.Scope.Node = CurrentNode; |
550 | Status = AcpiNsLookup (&ScopeInfo, *NewPath, |
550 | Status = AcpiNsLookup (&ScopeInfo, *NewPath, |
551 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
551 | ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, |
552 | ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); |
552 | ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); |
553 | if (ACPI_SUCCESS (Status)) |
553 | if (ACPI_SUCCESS (Status)) |
554 | { |
554 | { |
555 | /* Found the namepath, but make sure the node is correct */ |
555 | /* Found the namepath, but make sure the node is correct */ |
556 | 556 | ||
557 | if (Node == TargetNode) |
557 | if (Node == TargetNode) |
558 | { |
558 | { |
559 | /* The lookup matched the node, accept this optimization */ |
559 | /* The lookup matched the node, accept this optimization */ |
560 | 560 | ||
561 | AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, |
561 | AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, |
562 | Op, NewPathExternal); |
562 | Op, NewPathExternal); |
563 | 563 | ||
564 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
564 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
565 | "AT ROOT: %-24s", NewPathExternal)); |
565 | "AT ROOT: %-24s", NewPathExternal)); |
566 | } |
566 | } |
567 | else |
567 | else |
568 | { |
568 | { |
569 | /* Node is not correct, do not use this optimization */ |
569 | /* Node is not correct, do not use this optimization */ |
570 | 570 | ||
571 | Status = AE_NOT_FOUND; |
571 | Status = AE_NOT_FOUND; |
572 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
572 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
573 | " ***** WRONG NODE")); |
573 | " ***** WRONG NODE")); |
574 | AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, |
574 | AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, |
575 | "Not using optimized name - found wrong node"); |
575 | "Not using optimized name - found wrong node"); |
576 | } |
576 | } |
577 | } |
577 | } |
578 | else |
578 | else |
579 | { |
579 | { |
580 | /* The lookup failed, we obviously cannot use this optimization */ |
580 | /* The lookup failed, we obviously cannot use this optimization */ |
581 | 581 | ||
582 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
582 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
583 | " ***** NOT FOUND")); |
583 | " ***** NOT FOUND")); |
584 | AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, |
584 | AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, |
585 | "Not using optimized name - did not find node"); |
585 | "Not using optimized name - did not find node"); |
586 | } |
586 | } |
587 | 587 | ||
588 | ACPI_FREE (NewPathExternal); |
588 | ACPI_FREE (NewPathExternal); |
589 | return (Status); |
589 | return (Status); |
590 | } |
590 | } |
591 | 591 | ||
592 | /* Could not optimize */ |
592 | /* Could not optimize */ |
593 | 593 | ||
594 | return (AE_NOT_FOUND); |
594 | return (AE_NOT_FOUND); |
595 | } |
595 | } |
596 | 596 | ||
597 | 597 | ||
598 | /******************************************************************************* |
598 | /******************************************************************************* |
599 | * |
599 | * |
600 | * FUNCTION: OptOptimizeNamePath |
600 | * FUNCTION: OptOptimizeNamePath |
601 | * |
601 | * |
602 | * PARAMETERS: Op - Current parser op |
602 | * PARAMETERS: Op - Current parser op |
603 | * Flags - Opcode info flags |
603 | * Flags - Opcode info flags |
604 | * WalkState - Current state |
604 | * WalkState - Current state |
605 | * AmlNameString - Unoptimized namepath |
605 | * AmlNameString - Unoptimized namepath |
606 | * TargetNode - Node to which AmlNameString refers |
606 | * TargetNode - Node to which AmlNameString refers |
607 | * |
607 | * |
608 | * RETURN: None. If path is optimized, the Op is updated with new path |
608 | * RETURN: None. If path is optimized, the Op is updated with new path |
609 | * |
609 | * |
610 | * DESCRIPTION: Optimize a Named Declaration or Reference to the minimal length. |
610 | * DESCRIPTION: Optimize a Named Declaration or Reference to the minimal length. |
611 | * Must take into account both the current location in the |
611 | * Must take into account both the current location in the |
612 | * namespace and the actual reference path. |
612 | * namespace and the actual reference path. |
613 | * |
613 | * |
614 | ******************************************************************************/ |
614 | ******************************************************************************/ |
615 | 615 | ||
616 | void |
616 | void |
617 | OptOptimizeNamePath ( |
617 | OptOptimizeNamePath ( |
618 | ACPI_PARSE_OBJECT *Op, |
618 | ACPI_PARSE_OBJECT *Op, |
619 | UINT32 Flags, |
619 | UINT32 Flags, |
620 | ACPI_WALK_STATE *WalkState, |
620 | ACPI_WALK_STATE *WalkState, |
621 | char *AmlNameString, |
621 | char *AmlNameString, |
622 | ACPI_NAMESPACE_NODE *TargetNode) |
622 | ACPI_NAMESPACE_NODE *TargetNode) |
623 | { |
623 | { |
624 | ACPI_STATUS Status; |
624 | ACPI_STATUS Status; |
625 | ACPI_BUFFER TargetPath; |
625 | ACPI_BUFFER TargetPath; |
626 | ACPI_BUFFER CurrentPath; |
626 | ACPI_BUFFER CurrentPath; |
627 | ACPI_SIZE AmlNameStringLength; |
627 | ACPI_SIZE AmlNameStringLength; |
628 | ACPI_NAMESPACE_NODE *CurrentNode; |
628 | ACPI_NAMESPACE_NODE *CurrentNode; |
629 | char *ExternalNameString; |
629 | char *ExternalNameString; |
630 | char *NewPath = NULL; |
630 | char *NewPath = NULL; |
631 | ACPI_SIZE HowMuchShorter; |
631 | ACPI_SIZE HowMuchShorter; |
632 | ACPI_PARSE_OBJECT *NextOp; |
632 | ACPI_PARSE_OBJECT *NextOp; |
633 | 633 | ||
634 | 634 | ||
635 | ACPI_FUNCTION_TRACE (OptOptimizeNamePath); |
635 | ACPI_FUNCTION_TRACE (OptOptimizeNamePath); |
636 | 636 | ||
637 | 637 | ||
638 | /* This is an optional optimization */ |
638 | /* This is an optional optimization */ |
639 | 639 | ||
640 | if (!Gbl_ReferenceOptimizationFlag) |
640 | if (!Gbl_ReferenceOptimizationFlag) |
641 | { |
641 | { |
642 | return_VOID; |
642 | return_VOID; |
643 | } |
643 | } |
644 | 644 | ||
645 | /* Various required items */ |
645 | /* Various required items */ |
646 | 646 | ||
647 | if (!TargetNode || !WalkState || !AmlNameString || !Op->Common.Parent) |
647 | if (!TargetNode || !WalkState || !AmlNameString || !Op->Common.Parent) |
648 | { |
648 | { |
649 | return_VOID; |
649 | return_VOID; |
650 | } |
650 | } |
651 | 651 | ||
652 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "%5d [%12.12s] [%12.12s] ", |
652 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "%5d [%12.12s] [%12.12s] ", |
653 | Op->Asl.LogicalLineNumber, |
653 | Op->Asl.LogicalLineNumber, |
654 | AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), |
654 | AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), |
655 | AcpiPsGetOpcodeName (Op->Common.AmlOpcode))); |
655 | AcpiPsGetOpcodeName (Op->Common.AmlOpcode))); |
656 | 656 | ||
657 | if (!(Flags & (AML_NAMED | AML_CREATE))) |
657 | if (!(Flags & (AML_NAMED | AML_CREATE))) |
658 | { |
658 | { |
659 | if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) |
659 | if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) |
660 | { |
660 | { |
661 | /* We don't want to fuss with actual name declaration nodes here */ |
661 | /* We don't want to fuss with actual name declaration nodes here */ |
662 | 662 | ||
663 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
663 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
664 | "******* NAME DECLARATION\n")); |
664 | "******* NAME DECLARATION\n")); |
665 | return_VOID; |
665 | return_VOID; |
666 | } |
666 | } |
667 | } |
667 | } |
668 | 668 | ||
669 | /* |
669 | /* |
670 | * The original path must be longer than one NameSeg (4 chars) for there |
670 | * The original path must be longer than one NameSeg (4 chars) for there |
671 | * to be any possibility that it can be optimized to a shorter string |
671 | * to be any possibility that it can be optimized to a shorter string |
672 | */ |
672 | */ |
673 | AmlNameStringLength = ACPI_STRLEN (AmlNameString); |
673 | AmlNameStringLength = ACPI_STRLEN (AmlNameString); |
674 | if (AmlNameStringLength <= ACPI_NAME_SIZE) |
674 | if (AmlNameStringLength <= ACPI_NAME_SIZE) |
675 | { |
675 | { |
676 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
676 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
677 | "NAMESEG %4.4s\n", AmlNameString)); |
677 | "NAMESEG %4.4s\n", AmlNameString)); |
678 | return_VOID; |
678 | return_VOID; |
679 | } |
679 | } |
680 | 680 | ||
681 | /* |
681 | /* |
682 | * We need to obtain the node that represents the current scope -- where |
682 | * We need to obtain the node that represents the current scope -- where |
683 | * we are right now in the namespace. We will compare this path |
683 | * we are right now in the namespace. We will compare this path |
684 | * against the Namepath, looking for commonality. |
684 | * against the Namepath, looking for commonality. |
685 | */ |
685 | */ |
686 | CurrentNode = AcpiGbl_RootNode; |
686 | CurrentNode = AcpiGbl_RootNode; |
687 | if (WalkState->ScopeInfo) |
687 | if (WalkState->ScopeInfo) |
688 | { |
688 | { |
689 | CurrentNode = WalkState->ScopeInfo->Scope.Node; |
689 | CurrentNode = WalkState->ScopeInfo->Scope.Node; |
690 | } |
690 | } |
691 | 691 | ||
692 | if (Flags & (AML_NAMED | AML_CREATE)) |
692 | if (Flags & (AML_NAMED | AML_CREATE)) |
693 | { |
693 | { |
694 | /* This is the declaration of a new name */ |
694 | /* This is the declaration of a new name */ |
695 | 695 | ||
696 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "NAME")); |
696 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "NAME")); |
697 | 697 | ||
698 | /* |
698 | /* |
699 | * The node of interest is the parent of this node |
699 | * The node of interest is the parent of this node |
700 | * (the containing scope) |
700 | * (the containing scope) |
701 | */ |
701 | */ |
702 | CurrentNode = Op->Asl.Parent->Asl.Node; |
702 | CurrentNode = Op->Asl.Parent->Asl.Node; |
703 | if (!CurrentNode) |
703 | if (!CurrentNode) |
704 | { |
704 | { |
705 | CurrentNode = AcpiGbl_RootNode; |
705 | CurrentNode = AcpiGbl_RootNode; |
706 | } |
706 | } |
707 | } |
707 | } |
708 | else |
708 | else |
709 | { |
709 | { |
710 | /* This is a reference to an existing named object */ |
710 | /* This is a reference to an existing named object */ |
711 | 711 | ||
712 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "REF ")); |
712 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "REF ")); |
713 | } |
713 | } |
714 | 714 | ||
715 | /* |
715 | /* |
716 | * Obtain the full paths to the two nodes that we are interested in |
716 | * Obtain the full paths to the two nodes that we are interested in |
717 | * (Target and current namespace location) in external |
717 | * (Target and current namespace location) in external |
718 | * format -- something we can easily manipulate |
718 | * format -- something we can easily manipulate |
719 | */ |
719 | */ |
720 | TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; |
720 | TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; |
721 | Status = AcpiNsHandleToPathname (TargetNode, &TargetPath); |
721 | Status = AcpiNsHandleToPathname (TargetNode, &TargetPath); |
722 | if (ACPI_FAILURE (Status)) |
722 | if (ACPI_FAILURE (Status)) |
723 | { |
723 | { |
724 | AslCoreSubsystemError (Op, Status, "Getting Target NamePath", |
724 | AslCoreSubsystemError (Op, Status, "Getting Target NamePath", |
725 | ASL_NO_ABORT); |
725 | ASL_NO_ABORT); |
726 | return_VOID; |
726 | return_VOID; |
727 | } |
727 | } |
728 | TargetPath.Length--; /* Subtract one for null terminator */ |
728 | TargetPath.Length--; /* Subtract one for null terminator */ |
729 | 729 | ||
730 | /* CurrentPath is the path to this scope (where we are in the namespace) */ |
730 | /* CurrentPath is the path to this scope (where we are in the namespace) */ |
731 | 731 | ||
732 | CurrentPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; |
732 | CurrentPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; |
733 | Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath); |
733 | Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath); |
734 | if (ACPI_FAILURE (Status)) |
734 | if (ACPI_FAILURE (Status)) |
735 | { |
735 | { |
736 | AslCoreSubsystemError (Op, Status, "Getting Current NamePath", |
736 | AslCoreSubsystemError (Op, Status, "Getting Current NamePath", |
737 | ASL_NO_ABORT); |
737 | ASL_NO_ABORT); |
738 | return_VOID; |
738 | return_VOID; |
739 | } |
739 | } |
740 | CurrentPath.Length--; /* Subtract one for null terminator */ |
740 | CurrentPath.Length--; /* Subtract one for null terminator */ |
741 | 741 | ||
742 | /* Debug output only */ |
742 | /* Debug output only */ |
743 | 743 | ||
744 | Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, AmlNameString, |
744 | Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, AmlNameString, |
745 | NULL, &ExternalNameString); |
745 | NULL, &ExternalNameString); |
746 | if (ACPI_FAILURE (Status)) |
746 | if (ACPI_FAILURE (Status)) |
747 | { |
747 | { |
748 | AslCoreSubsystemError (Op, Status, "Externalizing NamePath", |
748 | AslCoreSubsystemError (Op, Status, "Externalizing NamePath", |
749 | ASL_NO_ABORT); |
749 | ASL_NO_ABORT); |
750 | return_VOID; |
750 | return_VOID; |
751 | } |
751 | } |
752 | 752 | ||
753 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
753 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, |
754 | "%37s (%2u) ==> %-32s(%2u) %-32s", |
754 | "%37s (%2u) ==> %-32s(%2u) %-32s", |
755 | (char *) CurrentPath.Pointer, (UINT32) CurrentPath.Length, |
755 | (char *) CurrentPath.Pointer, (UINT32) CurrentPath.Length, |
756 | (char *) TargetPath.Pointer, (UINT32) TargetPath.Length, ExternalNameString)); |
756 | (char *) TargetPath.Pointer, (UINT32) TargetPath.Length, ExternalNameString)); |
757 | 757 | ||
758 | ACPI_FREE (ExternalNameString); |
758 | ACPI_FREE (ExternalNameString); |
759 | 759 | ||
760 | /* |
760 | /* |
761 | * Attempt an optmization depending on the type of namepath |
761 | * Attempt an optmization depending on the type of namepath |
762 | */ |
762 | */ |
763 | if (Flags & (AML_NAMED | AML_CREATE)) |
763 | if (Flags & (AML_NAMED | AML_CREATE)) |
764 | { |
764 | { |
765 | /* |
765 | /* |
766 | * This is a named opcode and the namepath is a name declaration, not |
766 | * This is a named opcode and the namepath is a name declaration, not |
767 | * a reference. |
767 | * a reference. |
768 | */ |
768 | */ |
769 | Status = OptOptimizeNameDeclaration (Op, WalkState, CurrentNode, |
769 | Status = OptOptimizeNameDeclaration (Op, WalkState, CurrentNode, |
770 | TargetNode, AmlNameString, &NewPath); |
770 | TargetNode, AmlNameString, &NewPath); |
771 | if (ACPI_FAILURE (Status)) |
771 | if (ACPI_FAILURE (Status)) |
772 | { |
772 | { |
773 | /* |
773 | /* |
774 | * 2) now attempt to |
774 | * 2) now attempt to |
775 | * optimize the namestring with carats (up-arrow) |
775 | * optimize the namestring with carats (up-arrow) |
776 | */ |
776 | */ |
777 | Status = OptBuildShortestPath (Op, WalkState, CurrentNode, |
777 | Status = OptBuildShortestPath (Op, WalkState, CurrentNode, |
778 | TargetNode, &CurrentPath, &TargetPath, |
778 | TargetNode, &CurrentPath, &TargetPath, |
779 | AmlNameStringLength, 1, &NewPath); |
779 | AmlNameStringLength, 1, &NewPath); |
780 | } |
780 | } |
781 | } |
781 | } |
782 | else |
782 | else |
783 | { |
783 | { |
784 | /* |
784 | /* |
785 | * This is a reference to an existing named object |
785 | * This is a reference to an existing named object |
786 | * |
786 | * |
787 | * 1) Check if search-to-root can be utilized using the last |
787 | * 1) Check if search-to-root can be utilized using the last |
788 | * NameSeg of the NamePath |
788 | * NameSeg of the NamePath |
789 | */ |
789 | */ |
790 | Status = OptSearchToRoot (Op, WalkState, CurrentNode, |
790 | Status = OptSearchToRoot (Op, WalkState, CurrentNode, |
791 | TargetNode, &TargetPath, &NewPath); |
791 | TargetNode, &TargetPath, &NewPath); |
792 | if (ACPI_FAILURE (Status)) |
792 | if (ACPI_FAILURE (Status)) |
793 | { |
793 | { |
794 | /* |
794 | /* |
795 | * 2) Search-to-root could not be used, now attempt to |
795 | * 2) Search-to-root could not be used, now attempt to |
796 | * optimize the namestring with carats (up-arrow) |
796 | * optimize the namestring with carats (up-arrow) |
797 | */ |
797 | */ |
798 | Status = OptBuildShortestPath (Op, WalkState, CurrentNode, |
798 | Status = OptBuildShortestPath (Op, WalkState, CurrentNode, |
799 | TargetNode, &CurrentPath, &TargetPath, |
799 | TargetNode, &CurrentPath, &TargetPath, |
800 | AmlNameStringLength, 0, &NewPath); |
800 | AmlNameStringLength, 0, &NewPath); |
801 | } |
801 | } |
802 | } |
802 | } |
803 | 803 | ||
804 | /* |
804 | /* |
805 | * Success from above indicates that the NamePath was successfully |
805 | * Success from above indicates that the NamePath was successfully |
806 | * optimized. We need to update the parse op with the new name |
806 | * optimized. We need to update the parse op with the new name |
807 | */ |
807 | */ |
808 | if (ACPI_SUCCESS (Status)) |
808 | if (ACPI_SUCCESS (Status)) |
809 | { |
809 | { |
810 | HowMuchShorter = (AmlNameStringLength - ACPI_STRLEN (NewPath)); |
810 | HowMuchShorter = (AmlNameStringLength - ACPI_STRLEN (NewPath)); |
811 | OptTotal += HowMuchShorter; |
811 | OptTotal += HowMuchShorter; |
812 | 812 | ||
813 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2u (%u)", |
813 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2u (%u)", |
814 | (UINT32) HowMuchShorter, OptTotal)); |
814 | (UINT32) HowMuchShorter, OptTotal)); |
815 | 815 | ||
816 | if (Flags & AML_NAMED) |
816 | if (Flags & AML_NAMED) |
817 | { |
817 | { |
818 | if (Op->Asl.AmlOpcode == AML_ALIAS_OP) |
818 | if (Op->Asl.AmlOpcode == AML_ALIAS_OP) |
819 | { |
819 | { |
820 | /* |
820 | /* |
821 | * ALIAS is the only oddball opcode, the name declaration |
821 | * ALIAS is the only oddball opcode, the name declaration |
822 | * (alias name) is the second operand |
822 | * (alias name) is the second operand |
823 | */ |
823 | */ |
824 | Op->Asl.Child->Asl.Next->Asl.Value.String = NewPath; |
824 | Op->Asl.Child->Asl.Next->Asl.Value.String = NewPath; |
825 | Op->Asl.Child->Asl.Next->Asl.AmlLength = ACPI_STRLEN (NewPath); |
825 | Op->Asl.Child->Asl.Next->Asl.AmlLength = ACPI_STRLEN (NewPath); |
826 | } |
826 | } |
827 | else |
827 | else |
828 | { |
828 | { |
829 | Op->Asl.Child->Asl.Value.String = NewPath; |
829 | Op->Asl.Child->Asl.Value.String = NewPath; |
830 | Op->Asl.Child->Asl.AmlLength = ACPI_STRLEN (NewPath); |
830 | Op->Asl.Child->Asl.AmlLength = ACPI_STRLEN (NewPath); |
831 | } |
831 | } |
832 | } |
832 | } |
833 | else if (Flags & AML_CREATE) |
833 | else if (Flags & AML_CREATE) |
834 | { |
834 | { |
835 | /* Name must appear as the last parameter */ |
835 | /* Name must appear as the last parameter */ |
836 | 836 | ||
837 | NextOp = Op->Asl.Child; |
837 | NextOp = Op->Asl.Child; |
838 | while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) |
838 | while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) |
839 | { |
839 | { |
840 | NextOp = NextOp->Asl.Next; |
840 | NextOp = NextOp->Asl.Next; |
841 | } |
841 | } |
842 | /* Update the parse node with the new NamePath */ |
842 | /* Update the parse node with the new NamePath */ |
843 | 843 | ||
844 | NextOp->Asl.Value.String = NewPath; |
844 | NextOp->Asl.Value.String = NewPath; |
845 | NextOp->Asl.AmlLength = ACPI_STRLEN (NewPath); |
845 | NextOp->Asl.AmlLength = ACPI_STRLEN (NewPath); |
846 | } |
846 | } |
847 | else |
847 | else |
848 | { |
848 | { |
849 | /* Update the parse node with the new NamePath */ |
849 | /* Update the parse node with the new NamePath */ |
850 | 850 | ||
851 | Op->Asl.Value.String = NewPath; |
851 | Op->Asl.Value.String = NewPath; |
852 | Op->Asl.AmlLength = ACPI_STRLEN (NewPath); |
852 | Op->Asl.AmlLength = ACPI_STRLEN (NewPath); |
853 | } |
853 | } |
854 | } |
854 | } |
855 | else |
855 | else |
856 | { |
856 | { |
857 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ALREADY OPTIMAL")); |
857 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ALREADY OPTIMAL")); |
858 | } |
858 | } |
859 | 859 | ||
860 | /* Cleanup path buffers */ |
860 | /* Cleanup path buffers */ |
861 | 861 | ||
862 | ACPI_FREE (TargetPath.Pointer); |
862 | ACPI_FREE (TargetPath.Pointer); |
863 | ACPI_FREE (CurrentPath.Pointer); |
863 | ACPI_FREE (CurrentPath.Pointer); |
864 | 864 | ||
865 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "\n")); |
865 | ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "\n")); |
866 | return_VOID; |
866 | return_VOID; |
867 | }=>>>> |
867 | }=>>>> |