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: aemain - Main routine for the AcpiExec utility |
3 | * Module Name: aemain - Main routine for the AcpiExec utility |
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 | #include "aecommon.h" |
116 | #include "aecommon.h" |
117 | 117 | ||
118 | #ifdef _DEBUG |
118 | #ifdef _DEBUG |
119 | #include |
119 | #include |
120 | #endif |
120 | #endif |
121 | 121 | ||
122 | #define _COMPONENT PARSER |
122 | #define _COMPONENT PARSER |
123 | ACPI_MODULE_NAME ("aemain") |
123 | ACPI_MODULE_NAME ("aemain") |
124 | - | ||
- | 124 | ||
125 | UINT8 AcpiGbl_BatchMode = 0; |
125 | |
126 | UINT8 AcpiGbl_RegionFillValue = 0; |
126 | UINT8 AcpiGbl_RegionFillValue = 0; |
127 | BOOLEAN AcpiGbl_IgnoreErrors = FALSE; |
127 | BOOLEAN AcpiGbl_IgnoreErrors = FALSE; |
128 | BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE; |
128 | BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE; |
129 | BOOLEAN AcpiGbl_DebugTimeout = FALSE; |
129 | BOOLEAN AcpiGbl_DebugTimeout = FALSE; |
- | 130 | ||
- | 131 | static UINT8 AcpiGbl_BatchMode = 0; |
|
130 | char BatchBuffer[128]; |
132 | static char BatchBuffer[128]; |
131 | AE_TABLE_DESC *AeTableListHead = NULL; |
133 | static AE_TABLE_DESC *AeTableListHead = NULL; |
132 | 134 | ||
133 | #define ASL_MAX_FILES 256 |
135 | #define ASL_MAX_FILES 256 |
134 | char *FileList[ASL_MAX_FILES]; |
- | |
135 | int FileCount; |
136 | static char *FileList[ASL_MAX_FILES]; |
136 | 137 | ||
137 | 138 | ||
138 | #define AE_SUPPORTED_OPTIONS "?b:d:e:f:gm^ovx:" |
139 | #define AE_SUPPORTED_OPTIONS "?b:d:e:f:gm^ovx:" |
139 | 140 | ||
140 | 141 | ||
141 | /****************************************************************************** |
142 | /****************************************************************************** |
142 | * |
143 | * |
143 | * FUNCTION: usage |
144 | * FUNCTION: usage |
144 | * |
145 | * |
145 | * PARAMETERS: None |
146 | * PARAMETERS: None |
146 | * |
147 | * |
147 | * RETURN: None |
148 | * RETURN: None |
148 | * |
149 | * |
149 | * DESCRIPTION: Print a usage message |
150 | * DESCRIPTION: Print a usage message |
150 | * |
151 | * |
151 | *****************************************************************************/ |
152 | *****************************************************************************/ |
152 | 153 | ||
153 | static void |
154 | static void |
154 | usage (void) |
155 | usage (void) |
155 | { |
156 | { |
156 | printf ("Usage: acpiexec [options] AMLfile1 AMLfile2 ...\n\n"); |
157 | printf ("Usage: acpiexec [options] AMLfile1 AMLfile2 ...\n\n"); |
157 | 158 | ||
158 | printf ("Where:\n"); |
159 | printf ("Where:\n"); |
159 | printf (" -? Display this message\n"); |
160 | printf (" -? Display this message\n"); |
160 | printf (" -b |
161 | printf (" -b |
161 | printf (" -m [Method] Batch mode method execution. Default=MAIN\n"); |
162 | printf (" -m [Method] Batch mode method execution. Default=MAIN\n"); |
162 | printf ("\n"); |
163 | printf ("\n"); |
163 | 164 | ||
164 | printf (" -da Disable method abort on error\n"); |
165 | printf (" -da Disable method abort on error\n"); |
165 | printf (" -di Disable execution of STA/INI methods during init\n"); |
166 | printf (" -di Disable execution of STA/INI methods during init\n"); |
166 | printf (" -do Disable Operation Region address simulation\n"); |
167 | printf (" -do Disable Operation Region address simulation\n"); |
- | 168 | printf (" -dr Disable repair of method return values\n"); |
|
167 | printf (" -dt Disable allocation tracking (performance)\n"); |
169 | printf (" -dt Disable allocation tracking (performance)\n"); |
168 | printf ("\n"); |
170 | printf ("\n"); |
169 | 171 | ||
170 | printf (" -ef Enable display of final memory statistics\n"); |
172 | printf (" -ef Enable display of final memory statistics\n"); |
171 | printf (" -em Enable Interpreter Serialized Mode\n"); |
173 | printf (" -em Enable Interpreter Serialized Mode\n"); |
172 | printf (" -es Enable Interpreter Slack Mode\n"); |
174 | printf (" -es Enable Interpreter Slack Mode\n"); |
173 | printf (" -et Enable debug semaphore timeout\n"); |
175 | printf (" -et Enable debug semaphore timeout\n"); |
174 | printf ("\n"); |
176 | printf ("\n"); |
175 | 177 | ||
176 | printf (" -f |
178 | printf (" -f |
177 | printf (" -v Verbose initialization output\n"); |
179 | printf (" -v Verbose initialization output\n"); |
178 | printf (" -x |
180 | printf (" -x |
179 | } |
181 | } |
180 | 182 | ||
181 | 183 | ||
182 | /****************************************************************************** |
184 | /****************************************************************************** |
183 | * |
185 | * |
184 | * FUNCTION: AcpiDbRunBatchMode |
186 | * FUNCTION: AcpiDbRunBatchMode |
185 | * |
187 | * |
186 | * PARAMETERS: BatchCommandLine - A semicolon separated list of commands |
188 | * PARAMETERS: BatchCommandLine - A semicolon separated list of commands |
187 | * to be executed. |
189 | * to be executed. |
188 | * Use only commas to separate elements of |
190 | * Use only commas to separate elements of |
189 | * particular command. |
191 | * particular command. |
190 | * RETURN: Status |
192 | * RETURN: Status |
191 | * |
193 | * |
192 | * DESCRIPTION: For each command of list separated by ';' prepare the command |
194 | * DESCRIPTION: For each command of list separated by ';' prepare the command |
193 | * buffer and pass it to AcpiDbCommandDispatch. |
195 | * buffer and pass it to AcpiDbCommandDispatch. |
194 | * |
196 | * |
195 | *****************************************************************************/ |
197 | *****************************************************************************/ |
196 | 198 | ||
197 | static ACPI_STATUS |
199 | static ACPI_STATUS |
198 | AcpiDbRunBatchMode ( |
200 | AcpiDbRunBatchMode ( |
199 | void) |
201 | void) |
200 | { |
202 | { |
201 | ACPI_STATUS Status; |
203 | ACPI_STATUS Status; |
202 | char *Ptr = BatchBuffer; |
204 | char *Ptr = BatchBuffer; |
203 | char *Cmd = Ptr; |
205 | char *Cmd = Ptr; |
204 | UINT8 Run = 0; |
206 | UINT8 Run = 0; |
- | 207 | ||
205 | 208 | ||
206 | AcpiGbl_MethodExecuting = FALSE; |
209 | AcpiGbl_MethodExecuting = FALSE; |
207 | AcpiGbl_StepToNextCall = FALSE; |
210 | AcpiGbl_StepToNextCall = FALSE; |
208 | 211 | ||
209 | while (*Ptr) |
212 | while (*Ptr) |
210 | { |
213 | { |
211 | if (*Ptr == ',') |
214 | if (*Ptr == ',') |
212 | { |
215 | { |
213 | /* Convert commas to spaces */ |
216 | /* Convert commas to spaces */ |
214 | *Ptr = ' '; |
217 | *Ptr = ' '; |
215 | } |
218 | } |
216 | else if (*Ptr == ';') |
219 | else if (*Ptr == ';') |
217 | { |
220 | { |
218 | *Ptr = '\0'; |
221 | *Ptr = '\0'; |
219 | Run = 1; |
222 | Run = 1; |
220 | } |
223 | } |
221 | 224 | ||
222 | Ptr++; |
225 | Ptr++; |
223 | 226 | ||
224 | if (Run || (*Ptr == '\0')) |
227 | if (Run || (*Ptr == '\0')) |
225 | { |
228 | { |
226 | (void) AcpiDbCommandDispatch (Cmd, NULL, NULL); |
229 | (void) AcpiDbCommandDispatch (Cmd, NULL, NULL); |
227 | Run = 0; |
230 | Run = 0; |
228 | Cmd = Ptr; |
231 | Cmd = Ptr; |
229 | } |
232 | } |
230 | } |
233 | } |
231 | 234 | ||
232 | Status = AcpiTerminate (); |
235 | Status = AcpiTerminate (); |
233 | return (Status); |
236 | return (Status); |
234 | } |
237 | } |
235 | 238 | ||
236 | 239 | ||
237 | /******************************************************************************* |
240 | /******************************************************************************* |
238 | * |
241 | * |
239 | * FUNCTION: FlStrdup |
242 | * FUNCTION: FlStrdup |
240 | * |
243 | * |
241 | * DESCRIPTION: Local strdup function |
244 | * DESCRIPTION: Local strdup function |
242 | * |
245 | * |
243 | ******************************************************************************/ |
246 | ******************************************************************************/ |
244 | 247 | ||
245 | static char * |
248 | static char * |
246 | FlStrdup ( |
249 | FlStrdup ( |
247 | char *String) |
250 | char *String) |
248 | { |
251 | { |
249 | char *NewString; |
252 | char *NewString; |
250 | 253 | ||
251 | 254 | ||
252 | NewString = AcpiOsAllocate (strlen (String) + 1); |
255 | NewString = AcpiOsAllocate (strlen (String) + 1); |
253 | if (!NewString) |
256 | if (!NewString) |
254 | { |
257 | { |
255 | return (NULL); |
258 | return (NULL); |
256 | } |
259 | } |
257 | 260 | ||
258 | strcpy (NewString, String); |
261 | strcpy (NewString, String); |
259 | return (NewString); |
262 | return (NewString); |
260 | } |
263 | } |
261 | 264 | ||
262 | 265 | ||
263 | /******************************************************************************* |
266 | /******************************************************************************* |
264 | * |
267 | * |
265 | * FUNCTION: FlSplitInputPathname |
268 | * FUNCTION: FlSplitInputPathname |
266 | * |
269 | * |
267 | * PARAMETERS: InputFilename - The user-specified ASL source file to be |
270 | * PARAMETERS: InputFilename - The user-specified ASL source file to be |
268 | * compiled |
271 | * compiled |
269 | * OutDirectoryPath - Where the directory path prefix is |
272 | * OutDirectoryPath - Where the directory path prefix is |
270 | * returned |
273 | * returned |
271 | * OutFilename - Where the filename part is returned |
274 | * OutFilename - Where the filename part is returned |
272 | * |
275 | * |
273 | * RETURN: Status |
276 | * RETURN: Status |
274 | * |
277 | * |
275 | * DESCRIPTION: Split the input path into a directory and filename part |
278 | * DESCRIPTION: Split the input path into a directory and filename part |
276 | * 1) Directory part used to open include files |
279 | * 1) Directory part used to open include files |
277 | * 2) Filename part used to generate output filenames |
280 | * 2) Filename part used to generate output filenames |
278 | * |
281 | * |
279 | ******************************************************************************/ |
282 | ******************************************************************************/ |
280 | 283 | ||
281 | ACPI_STATUS |
284 | ACPI_STATUS |
282 | FlSplitInputPathname ( |
285 | FlSplitInputPathname ( |
283 | char *InputPath, |
286 | char *InputPath, |
284 | char **OutDirectoryPath, |
287 | char **OutDirectoryPath, |
285 | char **OutFilename) |
288 | char **OutFilename) |
286 | { |
289 | { |
287 | char *Substring; |
290 | char *Substring; |
288 | char *DirectoryPath; |
291 | char *DirectoryPath; |
289 | char *Filename; |
292 | char *Filename; |
290 | 293 | ||
291 | 294 | ||
292 | *OutDirectoryPath = NULL; |
295 | *OutDirectoryPath = NULL; |
293 | *OutFilename = NULL; |
296 | *OutFilename = NULL; |
294 | 297 | ||
295 | if (!InputPath) |
298 | if (!InputPath) |
296 | { |
299 | { |
297 | return (AE_OK); |
300 | return (AE_OK); |
298 | } |
301 | } |
299 | 302 | ||
300 | /* Get the path to the input filename's directory */ |
303 | /* Get the path to the input filename's directory */ |
301 | 304 | ||
302 | DirectoryPath = FlStrdup (InputPath); |
305 | DirectoryPath = FlStrdup (InputPath); |
303 | if (!DirectoryPath) |
306 | if (!DirectoryPath) |
304 | { |
307 | { |
305 | return (AE_NO_MEMORY); |
308 | return (AE_NO_MEMORY); |
306 | } |
309 | } |
307 | 310 | ||
308 | Substring = strrchr (DirectoryPath, '\\'); |
311 | Substring = strrchr (DirectoryPath, '\\'); |
309 | if (!Substring) |
312 | if (!Substring) |
310 | { |
313 | { |
311 | Substring = strrchr (DirectoryPath, '/'); |
314 | Substring = strrchr (DirectoryPath, '/'); |
312 | if (!Substring) |
315 | if (!Substring) |
313 | { |
316 | { |
314 | Substring = strrchr (DirectoryPath, ':'); |
317 | Substring = strrchr (DirectoryPath, ':'); |
315 | } |
318 | } |
316 | } |
319 | } |
317 | 320 | ||
318 | if (!Substring) |
321 | if (!Substring) |
319 | { |
322 | { |
320 | DirectoryPath[0] = 0; |
323 | DirectoryPath[0] = 0; |
321 | Filename = FlStrdup (InputPath); |
324 | Filename = FlStrdup (InputPath); |
322 | } |
325 | } |
323 | else |
326 | else |
324 | { |
327 | { |
325 | Filename = FlStrdup (Substring + 1); |
328 | Filename = FlStrdup (Substring + 1); |
326 | *(Substring+1) = 0; |
329 | *(Substring+1) = 0; |
327 | } |
330 | } |
328 | 331 | ||
329 | if (!Filename) |
332 | if (!Filename) |
330 | { |
333 | { |
331 | return (AE_NO_MEMORY); |
334 | return (AE_NO_MEMORY); |
332 | } |
335 | } |
333 | 336 | ||
334 | *OutDirectoryPath = DirectoryPath; |
337 | *OutDirectoryPath = DirectoryPath; |
335 | *OutFilename = Filename; |
338 | *OutFilename = Filename; |
336 | 339 | ||
337 | return (AE_OK); |
340 | return (AE_OK); |
338 | } |
341 | } |
339 | 342 | ||
340 | 343 | ||
341 | /****************************************************************************** |
344 | /****************************************************************************** |
342 | * |
345 | * |
343 | * FUNCTION: AsDoWildcard |
346 | * FUNCTION: AsDoWildcard |
344 | * |
347 | * |
345 | * PARAMETERS: DirectoryPathname - Path to parent directory |
348 | * PARAMETERS: DirectoryPathname - Path to parent directory |
346 | * FileSpecifier - the wildcard specification (*.c, etc.) |
349 | * FileSpecifier - the wildcard specification (*.c, etc.) |
347 | * |
350 | * |
348 | * RETURN: Pointer to a list of filenames |
351 | * RETURN: Pointer to a list of filenames |
349 | * |
352 | * |
350 | * DESCRIPTION: Process files via wildcards. This function is for the Windows |
353 | * DESCRIPTION: Process files via wildcards. This function is for the Windows |
351 | * case only. |
354 | * case only. |
352 | * |
355 | * |
353 | ******************************************************************************/ |
356 | ******************************************************************************/ |
354 | 357 | ||
355 | static char ** |
358 | static char ** |
356 | AsDoWildcard ( |
359 | AsDoWildcard ( |
357 | char *DirectoryPathname, |
360 | char *DirectoryPathname, |
358 | char *FileSpecifier) |
361 | char *FileSpecifier) |
359 | { |
362 | { |
360 | #ifdef WIN32 |
363 | #ifdef WIN32 |
361 | void *DirInfo; |
364 | void *DirInfo; |
362 | char *Filename; |
365 | char *Filename; |
- | 366 | int FileCount; |
|
363 | 367 | ||
364 | 368 | ||
365 | FileCount = 0; |
369 | FileCount = 0; |
366 | 370 | ||
367 | /* Open parent directory */ |
371 | /* Open parent directory */ |
368 | 372 | ||
369 | DirInfo = AcpiOsOpenDirectory (DirectoryPathname, FileSpecifier, REQUEST_FILE_ONLY); |
373 | DirInfo = AcpiOsOpenDirectory (DirectoryPathname, FileSpecifier, REQUEST_FILE_ONLY); |
370 | if (!DirInfo) |
374 | if (!DirInfo) |
371 | { |
375 | { |
372 | /* Either the directory or file does not exist */ |
376 | /* Either the directory or file does not exist */ |
373 | 377 | ||
374 | printf ("File or directory %s%s does not exist\n", DirectoryPathname, FileSpecifier); |
378 | printf ("File or directory %s%s does not exist\n", DirectoryPathname, FileSpecifier); |
375 | return (NULL); |
379 | return (NULL); |
376 | } |
380 | } |
377 | 381 | ||
378 | /* Process each file that matches the wildcard specification */ |
382 | /* Process each file that matches the wildcard specification */ |
379 | 383 | ||
380 | while ((Filename = AcpiOsGetNextFilename (DirInfo))) |
384 | while ((Filename = AcpiOsGetNextFilename (DirInfo))) |
381 | { |
385 | { |
382 | /* Add the filename to the file list */ |
386 | /* Add the filename to the file list */ |
383 | 387 | ||
384 | FileList[FileCount] = AcpiOsAllocate (strlen (Filename) + 1); |
388 | FileList[FileCount] = AcpiOsAllocate (strlen (Filename) + 1); |
385 | strcpy (FileList[FileCount], Filename); |
389 | strcpy (FileList[FileCount], Filename); |
386 | FileCount++; |
390 | FileCount++; |
387 | 391 | ||
388 | if (FileCount >= ASL_MAX_FILES) |
392 | if (FileCount >= ASL_MAX_FILES) |
389 | { |
393 | { |
390 | printf ("Max files reached\n"); |
394 | printf ("Max files reached\n"); |
391 | FileList[0] = NULL; |
395 | FileList[0] = NULL; |
392 | return (FileList); |
396 | return (FileList); |
393 | } |
397 | } |
394 | } |
398 | } |
395 | 399 | ||
396 | /* Cleanup */ |
400 | /* Cleanup */ |
397 | 401 | ||
398 | AcpiOsCloseDirectory (DirInfo); |
402 | AcpiOsCloseDirectory (DirInfo); |
399 | FileList[FileCount] = NULL; |
403 | FileList[FileCount] = NULL; |
400 | return (FileList); |
404 | return (FileList); |
401 | 405 | ||
402 | #else |
406 | #else |
403 | if (!FileSpecifier) |
407 | if (!FileSpecifier) |
404 | { |
408 | { |
405 | return (NULL); |
409 | return (NULL); |
406 | } |
410 | } |
407 | 411 | ||
408 | /* |
412 | /* |
409 | * Linux/Unix cases - Wildcards are expanded by the shell automatically. |
413 | * Linux/Unix cases - Wildcards are expanded by the shell automatically. |
410 | * Just return the filename in a null terminated list |
414 | * Just return the filename in a null terminated list |
411 | */ |
415 | */ |
412 | FileList[0] = AcpiOsAllocate (strlen (FileSpecifier) + 1); |
416 | FileList[0] = AcpiOsAllocate (strlen (FileSpecifier) + 1); |
413 | strcpy (FileList[0], FileSpecifier); |
417 | strcpy (FileList[0], FileSpecifier); |
414 | FileList[1] = NULL; |
418 | FileList[1] = NULL; |
415 | 419 | ||
416 | return (FileList); |
420 | return (FileList); |
417 | #endif |
421 | #endif |
418 | } |
422 | } |
419 | 423 | ||
420 | 424 | ||
421 | /****************************************************************************** |
425 | /****************************************************************************** |
422 | * |
426 | * |
423 | * FUNCTION: main |
427 | * FUNCTION: main |
424 | * |
428 | * |
425 | * PARAMETERS: argc, argv |
429 | * PARAMETERS: argc, argv |
426 | * |
430 | * |
427 | * RETURN: Status |
431 | * RETURN: Status |
428 | * |
432 | * |
429 | * DESCRIPTION: Main routine for AcpiDump utility |
433 | * DESCRIPTION: Main routine for AcpiDump utility |
430 | * |
434 | * |
431 | *****************************************************************************/ |
435 | *****************************************************************************/ |
432 | 436 | ||
433 | int ACPI_SYSTEM_XFACE |
437 | int ACPI_SYSTEM_XFACE |
434 | main ( |
438 | main ( |
435 | int argc, |
439 | int argc, |
436 | char **argv) |
440 | char **argv) |
437 | { |
441 | { |
438 | int j; |
442 | int j; |
439 | ACPI_STATUS Status; |
443 | ACPI_STATUS Status; |
440 | UINT32 InitFlags; |
444 | UINT32 InitFlags; |
441 | ACPI_TABLE_HEADER *Table = NULL; |
445 | ACPI_TABLE_HEADER *Table = NULL; |
442 | UINT32 TableCount; |
446 | UINT32 TableCount; |
443 | AE_TABLE_DESC *TableDesc; |
447 | AE_TABLE_DESC *TableDesc; |
444 | char **FileList; |
448 | char **WildcardList; |
445 | char *Filename; |
449 | char *Filename; |
446 | char *Directory; |
450 | char *Directory; |
447 | char *FullPathname; |
451 | char *FullPathname; |
448 | 452 | ||
449 | 453 | ||
450 | #ifdef _DEBUG |
454 | #ifdef _DEBUG |
451 | _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | |
455 | _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF | |
452 | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); |
456 | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); |
453 | #endif |
457 | #endif |
454 | 458 | ||
455 | printf ("\nIntel ACPI Component Architecture\nAML Execution/Debug Utility"); |
- | |
456 | printf (" version %8.8X", ((UINT32) ACPI_CA_VERSION)); |
- | |
457 | printf (" [%s]\n\n", __DATE__); |
459 | printf (ACPI_COMMON_SIGNON ("AML Execution/Debug Utility")); |
458 | 460 | ||
459 | if (argc < 2) |
461 | if (argc < 2) |
460 | { |
462 | { |
461 | usage (); |
463 | usage (); |
462 | return 0; |
464 | return (0); |
463 | } |
465 | } |
464 | 466 | ||
465 | signal (SIGINT, AeCtrlCHandler); |
467 | signal (SIGINT, AeCtrlCHandler); |
466 | 468 | ||
467 | /* Init globals */ |
469 | /* Init globals */ |
468 | 470 | ||
469 | AcpiDbgLevel = ACPI_NORMAL_DEFAULT; |
471 | AcpiDbgLevel = ACPI_NORMAL_DEFAULT; |
470 | AcpiDbgLayer = 0xFFFFFFFF; |
472 | AcpiDbgLayer = 0xFFFFFFFF; |
471 | 473 | ||
472 | /* Init ACPI and start debugger thread */ |
474 | /* Init ACPI and start debugger thread */ |
473 | 475 | ||
- | 476 | Status = AcpiInitializeSubsystem (); |
|
474 | AcpiInitializeSubsystem (); |
477 | AE_CHECK_OK (AcpiInitializeSubsystem, Status); |
475 | 478 | ||
476 | /* Get the command line options */ |
479 | /* Get the command line options */ |
477 | 480 | ||
478 | while ((j = AcpiGetopt (argc, argv, AE_SUPPORTED_OPTIONS)) != EOF) switch(j) |
481 | while ((j = AcpiGetopt (argc, argv, AE_SUPPORTED_OPTIONS)) != EOF) switch(j) |
479 | { |
482 | { |
480 | case 'b': |
483 | case 'b': |
481 | if (strlen (AcpiGbl_Optarg) > 127) |
484 | if (strlen (AcpiGbl_Optarg) > 127) |
482 | { |
485 | { |
483 | printf ("**** The length of command line (%u) exceeded maximum (127)\n", |
486 | printf ("**** The length of command line (%u) exceeded maximum (127)\n", |
484 | (UINT32) strlen (AcpiGbl_Optarg)); |
487 | (UINT32) strlen (AcpiGbl_Optarg)); |
485 | return -1; |
488 | return (-1); |
486 | } |
489 | } |
487 | AcpiGbl_BatchMode = 1; |
490 | AcpiGbl_BatchMode = 1; |
488 | strcpy (BatchBuffer, AcpiGbl_Optarg); |
491 | strcpy (BatchBuffer, AcpiGbl_Optarg); |
489 | break; |
492 | break; |
490 | 493 | ||
491 | case 'd': |
494 | case 'd': |
492 | switch (AcpiGbl_Optarg[0]) |
495 | switch (AcpiGbl_Optarg[0]) |
493 | { |
496 | { |
494 | case 'a': |
497 | case 'a': |
495 | AcpiGbl_IgnoreErrors = TRUE; |
498 | AcpiGbl_IgnoreErrors = TRUE; |
496 | break; |
499 | break; |
497 | 500 | ||
498 | case 'i': |
501 | case 'i': |
499 | AcpiGbl_DbOpt_ini_methods = FALSE; |
502 | AcpiGbl_DbOpt_ini_methods = FALSE; |
500 | break; |
503 | break; |
501 | 504 | ||
502 | case 'o': |
505 | case 'o': |
503 | AcpiGbl_DbOpt_NoRegionSupport = TRUE; |
506 | AcpiGbl_DbOpt_NoRegionSupport = TRUE; |
504 | break; |
507 | break; |
- | 508 | ||
- | 509 | case 'r': |
|
- | 510 | AcpiGbl_DisableAutoRepair = TRUE; |
|
- | 511 | break; |
|
505 | 512 | ||
506 | case 't': |
513 | case 't': |
507 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
514 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
508 | AcpiGbl_DisableMemTracking = TRUE; |
515 | AcpiGbl_DisableMemTracking = TRUE; |
509 | #endif |
516 | #endif |
510 | break; |
517 | break; |
511 | 518 | ||
512 | default: |
519 | default: |
513 | printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); |
520 | printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); |
514 | return (-1); |
521 | return (-1); |
515 | } |
522 | } |
516 | break; |
523 | break; |
517 | 524 | ||
518 | case 'e': |
525 | case 'e': |
519 | switch (AcpiGbl_Optarg[0]) |
526 | switch (AcpiGbl_Optarg[0]) |
520 | { |
527 | { |
521 | case 'f': |
528 | case 'f': |
522 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
529 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
523 | AcpiGbl_DisplayFinalMemStats = TRUE; |
530 | AcpiGbl_DisplayFinalMemStats = TRUE; |
524 | #endif |
531 | #endif |
525 | break; |
532 | break; |
526 | 533 | ||
527 | case 'm': |
534 | case 'm': |
528 | AcpiGbl_AllMethodsSerialized = TRUE; |
535 | AcpiGbl_AllMethodsSerialized = TRUE; |
529 | printf ("Enabling AML Interpreter serialized mode\n"); |
536 | printf ("Enabling AML Interpreter serialized mode\n"); |
530 | break; |
537 | break; |
531 | 538 | ||
532 | case 's': |
539 | case 's': |
533 | AcpiGbl_EnableInterpreterSlack = TRUE; |
540 | AcpiGbl_EnableInterpreterSlack = TRUE; |
534 | printf ("Enabling AML Interpreter slack mode\n"); |
541 | printf ("Enabling AML Interpreter slack mode\n"); |
535 | break; |
542 | break; |
536 | 543 | ||
537 | case 't': |
544 | case 't': |
538 | AcpiGbl_DebugTimeout = TRUE; |
545 | AcpiGbl_DebugTimeout = TRUE; |
539 | break; |
546 | break; |
540 | 547 | ||
541 | default: |
548 | default: |
542 | printf ("Unknown option: -e%s\n", AcpiGbl_Optarg); |
549 | printf ("Unknown option: -e%s\n", AcpiGbl_Optarg); |
543 | return (-1); |
550 | return (-1); |
544 | } |
551 | } |
545 | break; |
552 | break; |
546 | 553 | ||
547 | case 'f': |
554 | case 'f': |
548 | AcpiGbl_RegionFillValue = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); |
555 | AcpiGbl_RegionFillValue = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); |
549 | break; |
556 | break; |
550 | 557 | ||
551 | case 'g': |
558 | case 'g': |
552 | AcpiGbl_DbOpt_tables = TRUE; |
559 | AcpiGbl_DbOpt_tables = TRUE; |
553 | AcpiGbl_DbFilename = NULL; |
560 | AcpiGbl_DbFilename = NULL; |
554 | break; |
561 | break; |
555 | 562 | ||
556 | case 'm': |
563 | case 'm': |
557 | AcpiGbl_BatchMode = 2; |
564 | AcpiGbl_BatchMode = 2; |
558 | switch (AcpiGbl_Optarg[0]) |
565 | switch (AcpiGbl_Optarg[0]) |
559 | { |
566 | { |
560 | case '^': |
567 | case '^': |
561 | strcpy (BatchBuffer, "MAIN"); |
568 | strcpy (BatchBuffer, "MAIN"); |
562 | break; |
569 | break; |
563 | 570 | ||
564 | default: |
571 | default: |
565 | strcpy (BatchBuffer, AcpiGbl_Optarg); |
572 | strcpy (BatchBuffer, AcpiGbl_Optarg); |
566 | break; |
573 | break; |
567 | } |
574 | } |
568 | break; |
575 | break; |
569 | 576 | ||
570 | case 'o': |
577 | case 'o': |
571 | AcpiGbl_DbOpt_disasm = TRUE; |
578 | AcpiGbl_DbOpt_disasm = TRUE; |
572 | AcpiGbl_DbOpt_stats = TRUE; |
579 | AcpiGbl_DbOpt_stats = TRUE; |
573 | break; |
580 | break; |
574 | 581 | ||
575 | case 'v': |
582 | case 'v': |
576 | AcpiDbgLevel |= ACPI_LV_INIT_NAMES; |
583 | AcpiDbgLevel |= ACPI_LV_INIT_NAMES; |
577 | break; |
584 | break; |
578 | 585 | ||
579 | case 'x': |
586 | case 'x': |
580 | AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 0); |
587 | AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 0); |
581 | AcpiGbl_DbConsoleDebugLevel = AcpiDbgLevel; |
588 | AcpiGbl_DbConsoleDebugLevel = AcpiDbgLevel; |
582 | printf ("Debug Level: 0x%8.8X\n", AcpiDbgLevel); |
589 | printf ("Debug Level: 0x%8.8X\n", AcpiDbgLevel); |
583 | break; |
590 | break; |
584 | 591 | ||
585 | case '?': |
592 | case '?': |
586 | case 'h': |
593 | case 'h': |
587 | default: |
594 | default: |
588 | usage(); |
595 | usage(); |
589 | return -1; |
596 | return (-1); |
590 | } |
597 | } |
591 | 598 | ||
592 | 599 | ||
593 | InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE); |
600 | InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE); |
594 | if (!AcpiGbl_DbOpt_ini_methods) |
601 | if (!AcpiGbl_DbOpt_ini_methods) |
595 | { |
602 | { |
596 | InitFlags |= (ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT); |
603 | InitFlags |= (ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT); |
597 | } |
604 | } |
598 | 605 | ||
599 | /* The remaining arguments are filenames for ACPI tables */ |
606 | /* The remaining arguments are filenames for ACPI tables */ |
600 | 607 | ||
601 | if (argv[AcpiGbl_Optind]) |
608 | if (argv[AcpiGbl_Optind]) |
602 | { |
609 | { |
603 | AcpiGbl_DbOpt_tables = TRUE; |
610 | AcpiGbl_DbOpt_tables = TRUE; |
604 | TableCount = 0; |
611 | TableCount = 0; |
605 | 612 | ||
606 | /* Get each of the ACPI table files on the command line */ |
613 | /* Get each of the ACPI table files on the command line */ |
607 | 614 | ||
608 | while (argv[AcpiGbl_Optind]) |
615 | while (argv[AcpiGbl_Optind]) |
609 | { |
616 | { |
610 | /* Split incoming path into a directory/filename combo */ |
617 | /* Split incoming path into a directory/filename combo */ |
611 | 618 | ||
612 | Status = FlSplitInputPathname (argv[AcpiGbl_Optind], &Directory, &Filename); |
619 | Status = FlSplitInputPathname (argv[AcpiGbl_Optind], &Directory, &Filename); |
613 | if (ACPI_FAILURE (Status)) |
620 | if (ACPI_FAILURE (Status)) |
614 | { |
621 | { |
615 | return (Status); |
622 | return (Status); |
616 | } |
623 | } |
617 | 624 | ||
618 | /* Expand wildcards (Windows only) */ |
625 | /* Expand wildcards (Windows only) */ |
619 | 626 | ||
620 | FileList = AsDoWildcard (Directory, Filename); |
627 | WildcardList = AsDoWildcard (Directory, Filename); |
621 | if (!FileList) |
628 | if (!WildcardList) |
622 | { |
629 | { |
623 | return -1; |
630 | return (-1); |
624 | } |
631 | } |
625 | 632 | ||
626 | while (*FileList) |
633 | while (*WildcardList) |
627 | { |
634 | { |
628 | FullPathname = AcpiOsAllocate ( |
635 | FullPathname = AcpiOsAllocate ( |
629 | strlen (Directory) + strlen (*FileList) + 1); |
636 | strlen (Directory) + strlen (*WildcardList) + 1); |
630 | 637 | ||
631 | /* Construct a full path to the file */ |
638 | /* Construct a full path to the file */ |
632 | 639 | ||
633 | strcpy (FullPathname, Directory); |
640 | strcpy (FullPathname, Directory); |
634 | strcat (FullPathname, *FileList); |
641 | strcat (FullPathname, *WildcardList); |
635 | 642 | ||
636 | /* Get one table */ |
643 | /* Get one table */ |
637 | 644 | ||
638 | Status = AcpiDbReadTableFromFile (FullPathname, &Table); |
645 | Status = AcpiDbReadTableFromFile (FullPathname, &Table); |
639 | if (ACPI_FAILURE (Status)) |
646 | if (ACPI_FAILURE (Status)) |
640 | { |
647 | { |
641 | printf ("**** Could not get input table %s, %s\n", FullPathname, |
648 | printf ("**** Could not get input table %s, %s\n", FullPathname, |
642 | AcpiFormatException (Status)); |
649 | AcpiFormatException (Status)); |
643 | goto enterloop; |
650 | goto enterloop; |
644 | } |
651 | } |
645 | 652 | ||
646 | AcpiOsFree (FullPathname); |
653 | AcpiOsFree (FullPathname); |
647 | AcpiOsFree (*FileList); |
654 | AcpiOsFree (*WildcardList); |
648 | *FileList = NULL; |
655 | *WildcardList = NULL; |
649 | FileList++; |
656 | WildcardList++; |
650 | 657 | ||
651 | /* |
658 | /* |
652 | * Ignore an FACS or RSDT, we can't use them. |
659 | * Ignore an FACS or RSDT, we can't use them. |
653 | */ |
660 | */ |
654 | if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS) || |
661 | if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS) || |
655 | ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDT)) |
662 | ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDT)) |
656 | { |
663 | { |
657 | AcpiOsFree (Table); |
664 | AcpiOsFree (Table); |
658 | continue; |
665 | continue; |
659 | } |
666 | } |
660 | 667 | ||
661 | /* Allocate and link a table descriptor */ |
668 | /* Allocate and link a table descriptor */ |
662 | 669 | ||
663 | TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC)); |
670 | TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC)); |
664 | TableDesc->Table = Table; |
671 | TableDesc->Table = Table; |
665 | TableDesc->Next = AeTableListHead; |
672 | TableDesc->Next = AeTableListHead; |
666 | AeTableListHead = TableDesc; |
673 | AeTableListHead = TableDesc; |
667 | 674 | ||
668 | TableCount++; |
675 | TableCount++; |
669 | } |
676 | } |
670 | 677 | ||
671 | AcpiGbl_Optind++; |
678 | AcpiGbl_Optind++; |
672 | } |
679 | } |
673 | 680 | ||
674 | /* Build a local RSDT with all tables and let ACPICA process the RSDT */ |
681 | /* Build a local RSDT with all tables and let ACPICA process the RSDT */ |
675 | 682 | ||
676 | Status = AeBuildLocalTables (TableCount, AeTableListHead); |
683 | Status = AeBuildLocalTables (TableCount, AeTableListHead); |
677 | if (ACPI_FAILURE (Status)) |
684 | if (ACPI_FAILURE (Status)) |
678 | { |
685 | { |
679 | return -1; |
686 | return (-1); |
680 | } |
687 | } |
681 | 688 | ||
682 | Status = AeInstallTables (); |
689 | Status = AeInstallTables (); |
683 | if (ACPI_FAILURE (Status)) |
690 | if (ACPI_FAILURE (Status)) |
684 | { |
691 | { |
685 | printf ("**** Could not load ACPI tables, %s\n", AcpiFormatException (Status)); |
692 | printf ("**** Could not load ACPI tables, %s\n", AcpiFormatException (Status)); |
686 | goto enterloop; |
693 | goto enterloop; |
687 | } |
694 | } |
- | 695 | ||
- | 696 | /* |
|
- | 697 | * Install most of the handlers. |
|
- | 698 | * Override some default region handlers, especially SystemMemory |
|
688 | 699 | */ |
|
689 | Status = AeInstallHandlers (); |
700 | Status = AeInstallEarlyHandlers (); |
690 | if (ACPI_FAILURE (Status)) |
701 | if (ACPI_FAILURE (Status)) |
691 | { |
702 | { |
692 | goto enterloop; |
703 | goto enterloop; |
693 | } |
704 | } |
694 | 705 | ||
695 | /* |
706 | /* |
696 | * TBD: |
- | |
697 | * Need a way to call this after the "LOAD" command |
707 | * TBD: Need a way to call this after the "LOAD" command |
698 | */ |
708 | */ |
699 | Status = AcpiEnableSubsystem (InitFlags); |
709 | Status = AcpiEnableSubsystem (InitFlags); |
700 | if (ACPI_FAILURE (Status)) |
710 | if (ACPI_FAILURE (Status)) |
701 | { |
711 | { |
702 | printf ("**** Could not EnableSubsystem, %s\n", AcpiFormatException (Status)); |
712 | printf ("**** Could not EnableSubsystem, %s\n", AcpiFormatException (Status)); |
703 | goto enterloop; |
713 | goto enterloop; |
704 | } |
714 | } |
705 | 715 | ||
706 | Status = AcpiInitializeObjects (InitFlags); |
716 | Status = AcpiInitializeObjects (InitFlags); |
707 | if (ACPI_FAILURE (Status)) |
717 | if (ACPI_FAILURE (Status)) |
708 | { |
718 | { |
709 | printf ("**** Could not InitializeObjects, %s\n", AcpiFormatException (Status)); |
719 | printf ("**** Could not InitializeObjects, %s\n", AcpiFormatException (Status)); |
710 | goto enterloop; |
720 | goto enterloop; |
711 | } |
721 | } |
- | 722 | ||
- | 723 | /* |
|
- | 724 | * Install handlers for "device driver" space IDs (EC,SMBus, etc.) |
|
- | 725 | * and fixed event handlers |
|
- | 726 | */ |
|
712 | 727 | AeInstallLateHandlers (); |
|
713 | AeMiscellaneousTests (); |
728 | AeMiscellaneousTests (); |
714 | } |
729 | } |
715 | 730 | ||
716 | enterloop: |
731 | enterloop: |
717 | 732 | ||
718 | if (AcpiGbl_BatchMode == 1) |
733 | if (AcpiGbl_BatchMode == 1) |
719 | { |
734 | { |
720 | AcpiDbRunBatchMode (); |
735 | AcpiDbRunBatchMode (); |
721 | } |
736 | } |
722 | else if (AcpiGbl_BatchMode == 2) |
737 | else if (AcpiGbl_BatchMode == 2) |
723 | { |
738 | { |
724 | AcpiDbExecute (BatchBuffer, NULL, EX_NO_SINGLE_STEP); |
739 | AcpiDbExecute (BatchBuffer, NULL, NULL, EX_NO_SINGLE_STEP); |
725 | } |
740 | } |
726 | else |
741 | else |
727 | { |
742 | { |
728 | /* Enter the debugger command loop */ |
743 | /* Enter the debugger command loop */ |
729 | 744 | ||
730 | AcpiDbUserCommands (ACPI_DEBUGGER_COMMAND_PROMPT, NULL); |
745 | AcpiDbUserCommands (ACPI_DEBUGGER_COMMAND_PROMPT, NULL); |
731 | } |
746 | } |
732 | 747 | ||
733 | return 0; |
748 | return (0); |
734 | }> |
749 | }> |