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: dbinput - user front-end to the AML debugger |
3 | * Module Name: dbinput - user front-end to the AML debugger |
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 "acpi.h" |
117 | #include "acpi.h" |
118 | #include "accommon.h" |
118 | #include "accommon.h" |
119 | #include "acdebug.h" |
119 | #include "acdebug.h" |
120 | 120 | ||
121 | 121 | ||
122 | #ifdef ACPI_DEBUGGER |
122 | #ifdef ACPI_DEBUGGER |
123 | 123 | ||
124 | #define _COMPONENT ACPI_CA_DEBUGGER |
124 | #define _COMPONENT ACPI_CA_DEBUGGER |
125 | ACPI_MODULE_NAME ("dbinput") |
125 | ACPI_MODULE_NAME ("dbinput") |
126 | 126 | ||
127 | /* Local prototypes */ |
127 | /* Local prototypes */ |
128 | - | ||
129 | static char * |
- | |
130 | AcpiDbGetNextToken ( |
- | |
131 | char *String, |
- | |
132 | char **Next); |
- | |
133 | 128 | ||
134 | static UINT32 |
129 | static UINT32 |
135 | AcpiDbGetLine ( |
130 | AcpiDbGetLine ( |
136 | char *InputBuffer); |
131 | char *InputBuffer); |
137 | 132 | ||
138 | static UINT32 |
133 | static UINT32 |
139 | AcpiDbMatchCommand ( |
134 | AcpiDbMatchCommand ( |
140 | char *UserCommand); |
135 | char *UserCommand); |
141 | 136 | ||
142 | static void |
137 | static void |
143 | AcpiDbSingleThread ( |
138 | AcpiDbSingleThread ( |
144 | void); |
139 | void); |
145 | 140 | ||
146 | static void |
141 | static void |
147 | AcpiDbDisplayHelp ( |
142 | AcpiDbDisplayHelp ( |
148 | char *HelpType); |
143 | void); |
149 | 144 | ||
150 | 145 | ||
151 | /* |
146 | /* |
152 | * Top-level debugger commands. |
147 | * Top-level debugger commands. |
153 | * |
148 | * |
154 | * This list of commands must match the string table below it |
149 | * This list of commands must match the string table below it |
155 | */ |
150 | */ |
156 | enum AcpiExDebuggerCommands |
151 | enum AcpiExDebuggerCommands |
157 | { |
152 | { |
158 | CMD_NOT_FOUND = 0, |
153 | CMD_NOT_FOUND = 0, |
159 | CMD_NULL, |
154 | CMD_NULL, |
160 | CMD_ALLOCATIONS, |
155 | CMD_ALLOCATIONS, |
161 | CMD_ARGS, |
156 | CMD_ARGS, |
162 | CMD_ARGUMENTS, |
157 | CMD_ARGUMENTS, |
163 | CMD_BATCH, |
158 | CMD_BATCH, |
164 | CMD_BREAKPOINT, |
159 | CMD_BREAKPOINT, |
165 | CMD_BUSINFO, |
160 | CMD_BUSINFO, |
166 | CMD_CALL, |
161 | CMD_CALL, |
167 | CMD_CLOSE, |
162 | CMD_CLOSE, |
168 | CMD_DEBUG, |
163 | CMD_DEBUG, |
169 | CMD_DISASSEMBLE, |
164 | CMD_DISASSEMBLE, |
170 | CMD_DUMP, |
165 | CMD_DUMP, |
171 | CMD_ENABLEACPI, |
166 | CMD_ENABLEACPI, |
172 | CMD_EVENT, |
167 | CMD_EVENT, |
173 | CMD_EXECUTE, |
168 | CMD_EXECUTE, |
174 | CMD_EXIT, |
169 | CMD_EXIT, |
175 | CMD_FIND, |
170 | CMD_FIND, |
176 | CMD_GO, |
171 | CMD_GO, |
177 | CMD_GPE, |
172 | CMD_GPE, |
178 | CMD_GPES, |
173 | CMD_GPES, |
- | 174 | CMD_HANDLERS, |
|
179 | CMD_HELP, |
175 | CMD_HELP, |
180 | CMD_HELP2, |
176 | CMD_HELP2, |
181 | CMD_HISTORY, |
177 | CMD_HISTORY, |
182 | CMD_HISTORY_EXE, |
178 | CMD_HISTORY_EXE, |
183 | CMD_HISTORY_LAST, |
179 | CMD_HISTORY_LAST, |
184 | CMD_INFORMATION, |
180 | CMD_INFORMATION, |
185 | CMD_INTEGRITY, |
181 | CMD_INTEGRITY, |
186 | CMD_INTO, |
182 | CMD_INTO, |
187 | CMD_LEVEL, |
183 | CMD_LEVEL, |
188 | CMD_LIST, |
184 | CMD_LIST, |
189 | CMD_LOAD, |
185 | CMD_LOAD, |
190 | CMD_LOCALS, |
186 | CMD_LOCALS, |
191 | CMD_LOCKS, |
187 | CMD_LOCKS, |
192 | CMD_METHODS, |
188 | CMD_METHODS, |
193 | CMD_NAMESPACE, |
189 | CMD_NAMESPACE, |
194 | CMD_NOTIFY, |
190 | CMD_NOTIFY, |
195 | CMD_OBJECT, |
191 | CMD_OBJECT, |
196 | CMD_OPEN, |
192 | CMD_OPEN, |
- | 193 | CMD_OSI, |
|
197 | CMD_OWNER, |
194 | CMD_OWNER, |
198 | CMD_PREDEFINED, |
195 | CMD_PREDEFINED, |
199 | CMD_PREFIX, |
196 | CMD_PREFIX, |
200 | CMD_QUIT, |
197 | CMD_QUIT, |
201 | CMD_REFERENCES, |
198 | CMD_REFERENCES, |
202 | CMD_RESOURCES, |
199 | CMD_RESOURCES, |
203 | CMD_RESULTS, |
200 | CMD_RESULTS, |
204 | CMD_SET, |
201 | CMD_SET, |
205 | CMD_SLEEP, |
202 | CMD_SLEEP, |
206 | CMD_STATS, |
203 | CMD_STATS, |
207 | CMD_STOP, |
204 | CMD_STOP, |
208 | CMD_TABLES, |
205 | CMD_TABLES, |
209 | CMD_TERMINATE, |
206 | CMD_TERMINATE, |
210 | CMD_THREADS, |
207 | CMD_THREADS, |
211 | CMD_TRACE, |
208 | CMD_TRACE, |
212 | CMD_TREE, |
209 | CMD_TREE, |
213 | CMD_TYPE, |
210 | CMD_TYPE, |
214 | CMD_UNLOAD |
211 | CMD_UNLOAD |
215 | }; |
212 | }; |
216 | 213 | ||
217 | #define CMD_FIRST_VALID 2 |
214 | #define CMD_FIRST_VALID 2 |
218 | 215 | ||
219 | 216 | ||
220 | /* Second parameter is the required argument count */ |
217 | /* Second parameter is the required argument count */ |
221 | 218 | ||
222 | static const COMMAND_INFO AcpiGbl_DbCommands[] = |
219 | static const COMMAND_INFO AcpiGbl_DbCommands[] = |
223 | { |
220 | { |
224 | {" |
221 | {" |
225 | {" |
222 | {" |
226 | {"ALLOCATIONS", 0}, |
223 | {"ALLOCATIONS", 0}, |
227 | {"ARGS", 0}, |
224 | {"ARGS", 0}, |
228 | {"ARGUMENTS", 0}, |
225 | {"ARGUMENTS", 0}, |
229 | {"BATCH", 0}, |
226 | {"BATCH", 0}, |
230 | {"BREAKPOINT", 1}, |
227 | {"BREAKPOINT", 1}, |
231 | {"BUSINFO", 0}, |
228 | {"BUSINFO", 0}, |
232 | {"CALL", 0}, |
229 | {"CALL", 0}, |
233 | {"CLOSE", 0}, |
230 | {"CLOSE", 0}, |
234 | {"DEBUG", 1}, |
231 | {"DEBUG", 1}, |
235 | {"DISASSEMBLE", 1}, |
232 | {"DISASSEMBLE", 1}, |
236 | {"DUMP", 1}, |
233 | {"DUMP", 1}, |
237 | {"ENABLEACPI", 0}, |
234 | {"ENABLEACPI", 0}, |
238 | {"EVENT", 1}, |
235 | {"EVENT", 1}, |
239 | {"EXECUTE", 1}, |
236 | {"EXECUTE", 1}, |
240 | {"EXIT", 0}, |
237 | {"EXIT", 0}, |
241 | {"FIND", 1}, |
238 | {"FIND", 1}, |
242 | {"GO", 0}, |
239 | {"GO", 0}, |
243 | {"GPE", 2}, |
240 | {"GPE", 2}, |
244 | {"GPES", 0}, |
241 | {"GPES", 0}, |
- | 242 | {"HANDLERS", 0}, |
|
245 | {"HELP", 0}, |
243 | {"HELP", 0}, |
246 | {"?", 0}, |
244 | {"?", 0}, |
247 | {"HISTORY", 0}, |
245 | {"HISTORY", 0}, |
248 | {"!", 1}, |
246 | {"!", 1}, |
249 | {"!!", 0}, |
247 | {"!!", 0}, |
250 | {"INFORMATION", 0}, |
248 | {"INFORMATION", 0}, |
251 | {"INTEGRITY", 0}, |
249 | {"INTEGRITY", 0}, |
252 | {"INTO", 0}, |
250 | {"INTO", 0}, |
253 | {"LEVEL", 0}, |
251 | {"LEVEL", 0}, |
254 | {"LIST", 0}, |
252 | {"LIST", 0}, |
255 | {"LOAD", 1}, |
253 | {"LOAD", 1}, |
256 | {"LOCALS", 0}, |
254 | {"LOCALS", 0}, |
257 | {"LOCKS", 0}, |
255 | {"LOCKS", 0}, |
258 | {"METHODS", 0}, |
256 | {"METHODS", 0}, |
259 | {"NAMESPACE", 0}, |
257 | {"NAMESPACE", 0}, |
260 | {"NOTIFY", 2}, |
258 | {"NOTIFY", 2}, |
261 | {"OBJECT", 1}, |
259 | {"OBJECT", 1}, |
262 | {"OPEN", 1}, |
260 | {"OPEN", 1}, |
- | 261 | {"OSI", 0}, |
|
263 | {"OWNER", 1}, |
262 | {"OWNER", 1}, |
264 | {"PREDEFINED", 0}, |
263 | {"PREDEFINED", 0}, |
265 | {"PREFIX", 0}, |
264 | {"PREFIX", 0}, |
266 | {"QUIT", 0}, |
265 | {"QUIT", 0}, |
267 | {"REFERENCES", 1}, |
266 | {"REFERENCES", 1}, |
268 | {"RESOURCES", 1}, |
267 | {"RESOURCES", 1}, |
269 | {"RESULTS", 0}, |
268 | {"RESULTS", 0}, |
270 | {"SET", 3}, |
269 | {"SET", 3}, |
271 | {"SLEEP", 1}, |
270 | {"SLEEP", 1}, |
272 | {"STATS", 0}, |
271 | {"STATS", 0}, |
273 | {"STOP", 0}, |
272 | {"STOP", 0}, |
274 | {"TABLES", 0}, |
273 | {"TABLES", 0}, |
275 | {"TERMINATE", 0}, |
274 | {"TERMINATE", 0}, |
276 | {"THREADS", 3}, |
275 | {"THREADS", 3}, |
277 | {"TRACE", 1}, |
276 | {"TRACE", 1}, |
278 | {"TREE", 0}, |
277 | {"TREE", 0}, |
279 | {"TYPE", 1}, |
278 | {"TYPE", 1}, |
280 | {"UNLOAD", 1}, |
279 | {"UNLOAD", 1}, |
281 | {NULL, 0} |
280 | {NULL, 0} |
282 | }; |
281 | }; |
283 | 282 | ||
284 | 283 | ||
285 | /******************************************************************************* |
284 | /******************************************************************************* |
286 | * |
285 | * |
287 | * FUNCTION: AcpiDbDisplayHelp |
286 | * FUNCTION: AcpiDbDisplayHelp |
288 | * |
287 | * |
289 | * PARAMETERS: HelpType - Subcommand (optional) |
288 | * PARAMETERS: None |
290 | * |
289 | * |
291 | * RETURN: None |
290 | * RETURN: None |
292 | * |
291 | * |
293 | * DESCRIPTION: Print a usage message. |
292 | * DESCRIPTION: Print a usage message. |
294 | * |
293 | * |
295 | ******************************************************************************/ |
294 | ******************************************************************************/ |
296 | 295 | ||
297 | static void |
296 | static void |
298 | AcpiDbDisplayHelp ( |
297 | AcpiDbDisplayHelp ( |
299 | char *HelpType) |
- | |
300 | { |
- | |
301 | - | ||
302 | AcpiUtStrupr (HelpType); |
- | |
303 | - | ||
304 | /* No parameter, just give the overview */ |
- | |
305 | - | ||
306 | if (!HelpType) |
298 | void) |
307 | { |
299 | { |
308 | AcpiOsPrintf ("ACPI CA Debugger Commands\n\n"); |
- | |
309 | AcpiOsPrintf ("The following classes of commands are available. Help is available for\n"); |
- | |
310 | AcpiOsPrintf ("each class by entering \"Help |
- | |
311 | AcpiOsPrintf (" [GENERAL] General-Purpose Commands\n"); |
- | |
312 | AcpiOsPrintf (" [NAMESPACE] Namespace Access Commands\n"); |
- | |
313 | AcpiOsPrintf (" [METHOD] Control Method Execution Commands\n"); |
- | |
314 | AcpiOsPrintf (" [STATISTICS] Statistical Information\n"); |
- | |
315 | AcpiOsPrintf (" [FILE] File I/O Commands\n"); |
- | |
316 | return; |
- | |
317 | } |
- | |
318 | - | ||
319 | /* |
- | |
320 | * Parameter is the command class |
- | |
321 | * |
- | |
322 | * The idea here is to keep each class of commands smaller than a screenful |
- | |
323 | */ |
- | |
324 | switch (HelpType[0]) |
- | |
325 | { |
- | |
326 | case 'G': |
300 | |
327 | AcpiOsPrintf ("\nGeneral-Purpose Commands\n\n"); |
301 | AcpiOsPrintf ("\nGeneral-Purpose Commands:\n"); |
328 | AcpiOsPrintf ("Allocations Display list of current memory allocations\n"); |
302 | AcpiOsPrintf (" Allocations Display list of current memory allocations\n"); |
329 | AcpiOsPrintf ("Dump | |
303 | AcpiOsPrintf (" Dump | |
330 | AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n"); |
304 | AcpiOsPrintf (" [Byte|Word|Dword|Qword] Display ACPI objects or memory\n"); |
331 | AcpiOsPrintf ("EnableAcpi Enable ACPI (hardware) mode\n"); |
305 | AcpiOsPrintf (" EnableAcpi Enable ACPI (hardware) mode\n"); |
- | 306 | AcpiOsPrintf (" Handlers Info about global handlers\n"); |
|
332 | AcpiOsPrintf ("Help This help screen\n"); |
307 | AcpiOsPrintf (" Help This help screen\n"); |
333 | AcpiOsPrintf ("History Display command history buffer\n"); |
308 | AcpiOsPrintf (" History Display command history buffer\n"); |
334 | AcpiOsPrintf ("Level [ |
309 | AcpiOsPrintf (" Level [ |
335 | AcpiOsPrintf ("Locks Current status of internal mutexes\n"); |
310 | AcpiOsPrintf (" Locks Current status of internal mutexes\n"); |
- | 311 | AcpiOsPrintf (" Osi [Install|Remove |
|
336 | AcpiOsPrintf ("Quit or Exit Exit this command\n"); |
312 | AcpiOsPrintf (" Quit or Exit Exit this command\n"); |
337 | AcpiOsPrintf ("Stats [Allocations|Memory|Misc\n"); |
313 | AcpiOsPrintf (" Stats [Allocations|Memory|Misc|\n"); |
338 | AcpiOsPrintf (" |Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n"); |
314 | AcpiOsPrintf (" Objects|Sizes|Stack|Tables] Display namespace and memory statistics\n"); |
339 | AcpiOsPrintf ("Tables Display info about loaded ACPI tables\n"); |
- | |
340 | AcpiOsPrintf ("Unload |
- | |
341 | AcpiOsPrintf ("! |
- | |
342 | AcpiOsPrintf ("!! Execute last command again\n"); |
- | |
343 | return; |
- | |
344 | - | ||
345 | case 'S': |
- | |
346 | AcpiOsPrintf ("\nStats Subcommands\n\n"); |
- | |
347 | AcpiOsPrintf ("Allocations Display list of current memory allocations\n"); |
315 | AcpiOsPrintf (" Allocations Display list of current memory allocations\n"); |
348 | AcpiOsPrintf ("Memory Dump internal memory lists\n"); |
316 | AcpiOsPrintf (" Memory Dump internal memory lists\n"); |
349 | AcpiOsPrintf ("Misc Namespace search and mutex stats\n"); |
317 | AcpiOsPrintf (" Misc Namespace search and mutex stats\n"); |
350 | AcpiOsPrintf ("Objects Summary of namespace objects\n"); |
318 | AcpiOsPrintf (" Objects Summary of namespace objects\n"); |
351 | AcpiOsPrintf ("Sizes Sizes for each of the internal objects\n"); |
319 | AcpiOsPrintf (" Sizes Sizes for each of the internal objects\n"); |
352 | AcpiOsPrintf ("Stack Display CPU stack usage\n"); |
320 | AcpiOsPrintf (" Stack Display CPU stack usage\n"); |
353 | AcpiOsPrintf ("Tables Info about current ACPI table(s)\n"); |
321 | AcpiOsPrintf (" Tables Info about current ACPI table(s)\n"); |
- | 322 | AcpiOsPrintf (" Tables Display info about loaded ACPI tables\n"); |
|
354 | return; |
323 | AcpiOsPrintf (" Unload |
- | 324 | AcpiOsPrintf (" ! |
|
- | 325 | AcpiOsPrintf (" !! Execute last command again\n"); |
|
355 | - | ||
356 | case 'N': |
326 | |
357 | AcpiOsPrintf ("\nNamespace Access Commands\n\n"); |
327 | AcpiOsPrintf ("\nNamespace Access Commands:\n"); |
358 | AcpiOsPrintf ("Businfo Display system bus info\n"); |
328 | AcpiOsPrintf (" Businfo Display system bus info\n"); |
359 | AcpiOsPrintf ("Disassemble |
329 | AcpiOsPrintf (" Disassemble |
360 | AcpiOsPrintf ("Event |
330 | AcpiOsPrintf (" Event |
361 | AcpiOsPrintf ("Find |
331 | AcpiOsPrintf (" Find |
362 | AcpiOsPrintf ("Gpe |
332 | AcpiOsPrintf (" Gpe |
363 | AcpiOsPrintf ("Gpes Display info on all GPEs\n"); |
333 | AcpiOsPrintf (" Gpes Display info on all GPEs\n"); |
364 | AcpiOsPrintf ("Integrity Validate namespace integrity\n"); |
334 | AcpiOsPrintf (" Integrity Validate namespace integrity\n"); |
365 | AcpiOsPrintf ("Methods Display list of loaded control methods\n"); |
335 | AcpiOsPrintf (" Methods Display list of loaded control methods\n"); |
366 | AcpiOsPrintf ("Namespace [Object] [Depth] Display loaded namespace tree/subtree\n"); |
336 | AcpiOsPrintf (" Namespace [Object] [Depth] Display loaded namespace tree/subtree\n"); |
367 | AcpiOsPrintf ("Notify |
337 | AcpiOsPrintf (" Notify |
368 | AcpiOsPrintf ("Objects |
338 | AcpiOsPrintf (" Objects |
369 | AcpiOsPrintf ("Owner |
339 | AcpiOsPrintf (" Owner |
370 | AcpiOsPrintf ("Predefined Check all predefined names\n"); |
340 | AcpiOsPrintf (" Predefined Check all predefined names\n"); |
371 | AcpiOsPrintf ("Prefix [ |
341 | AcpiOsPrintf (" Prefix [ |
372 | AcpiOsPrintf ("References |
342 | AcpiOsPrintf (" References |
373 | AcpiOsPrintf ("Resources |
343 | AcpiOsPrintf (" Resources |
374 | AcpiOsPrintf ("Set N |
344 | AcpiOsPrintf (" Set N |
375 | AcpiOsPrintf ("Sleep |
345 | AcpiOsPrintf (" Sleep |
376 | AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n"); |
346 | AcpiOsPrintf (" Terminate Delete namespace and all internal objects\n"); |
377 | AcpiOsPrintf ("Type |
347 | AcpiOsPrintf (" Type |
378 | return; |
- | |
379 | - | ||
380 | case 'M': |
348 | |
381 | AcpiOsPrintf ("\nControl Method Execution Commands\n\n"); |
349 | AcpiOsPrintf ("\nControl Method Execution Commands:\n"); |
382 | AcpiOsPrintf ("Arguments (or Args) Display method arguments\n"); |
350 | AcpiOsPrintf (" Arguments (or Args) Display method arguments\n"); |
383 | AcpiOsPrintf ("Breakpoint |
351 | AcpiOsPrintf (" Breakpoint |
384 | AcpiOsPrintf ("Call Run to next control method invocation\n"); |
352 | AcpiOsPrintf (" Call Run to next control method invocation\n"); |
385 | AcpiOsPrintf ("Debug |
353 | AcpiOsPrintf (" Debug |
386 | AcpiOsPrintf ("Execute |
354 | AcpiOsPrintf (" Execute |
- | 355 | AcpiOsPrintf (" Hex Integer Integer method argument\n"); |
|
- | 356 | AcpiOsPrintf (" \"Ascii String\" String method argument\n"); |
|
- | 357 | AcpiOsPrintf (" (Byte List) Buffer method argument\n"); |
|
- | 358 | AcpiOsPrintf (" [Package Element List] Package method argument\n"); |
|
387 | AcpiOsPrintf ("Go Allow method to run to completion\n"); |
359 | AcpiOsPrintf (" Go Allow method to run to completion\n"); |
388 | AcpiOsPrintf ("Information Display info about the current method\n"); |
360 | AcpiOsPrintf (" Information Display info about the current method\n"); |
389 | AcpiOsPrintf ("Into Step into (not over) a method call\n"); |
361 | AcpiOsPrintf (" Into Step into (not over) a method call\n"); |
390 | AcpiOsPrintf ("List [# of Aml Opcodes] Display method ASL statements\n"); |
362 | AcpiOsPrintf (" List [# of Aml Opcodes] Display method ASL statements\n"); |
391 | AcpiOsPrintf ("Locals Display method local variables\n"); |
363 | AcpiOsPrintf (" Locals Display method local variables\n"); |
392 | AcpiOsPrintf ("Results Display method result stack\n"); |
364 | AcpiOsPrintf (" Results Display method result stack\n"); |
393 | AcpiOsPrintf ("Set <#> |
365 | AcpiOsPrintf (" Set <#> |
394 | AcpiOsPrintf ("Stop Terminate control method\n"); |
366 | AcpiOsPrintf (" Stop Terminate control method\n"); |
395 | AcpiOsPrintf ("Thread |
367 | AcpiOsPrintf (" Thread |
396 | AcpiOsPrintf ("Trace |
368 | AcpiOsPrintf (" Trace |
397 | AcpiOsPrintf ("Tree Display control method calling tree\n"); |
369 | AcpiOsPrintf (" Tree Display control method calling tree\n"); |
398 | AcpiOsPrintf (" |
370 | AcpiOsPrintf (" |
399 | return; |
- | |
400 | - | ||
401 | case 'F': |
371 | |
402 | AcpiOsPrintf ("\nFile I/O Commands\n\n"); |
372 | AcpiOsPrintf ("\nFile I/O Commands:\n"); |
403 | AcpiOsPrintf ("Close Close debug output file\n"); |
- | |
404 | AcpiOsPrintf ("Open |
373 | AcpiOsPrintf (" Close Close debug output file\n"); |
405 | AcpiOsPrintf ("Load Load ACPI table from a file\n"); |
- | |
406 | return; |
- | |
407 | - | ||
408 | default: |
374 | AcpiOsPrintf (" Load Load ACPI table from a file\n"); |
409 | AcpiOsPrintf ("Unrecognized Command Class: %s\n", HelpType); |
- | |
410 | return; |
- | |
411 | } |
375 | AcpiOsPrintf (" Open |
412 | } |
376 | } |
413 | 377 | ||
414 | 378 | ||
415 | /******************************************************************************* |
379 | /******************************************************************************* |
416 | * |
380 | * |
417 | * FUNCTION: AcpiDbGetNextToken |
381 | * FUNCTION: AcpiDbGetNextToken |
418 | * |
382 | * |
419 | * PARAMETERS: String - Command buffer |
383 | * PARAMETERS: String - Command buffer |
420 | * Next - Return value, end of next token |
384 | * Next - Return value, end of next token |
421 | * |
385 | * |
422 | * RETURN: Pointer to the start of the next token. |
386 | * RETURN: Pointer to the start of the next token. |
423 | * |
387 | * |
424 | * DESCRIPTION: Command line parsing. Get the next token on the command line |
388 | * DESCRIPTION: Command line parsing. Get the next token on the command line |
425 | * |
389 | * |
426 | ******************************************************************************/ |
390 | ******************************************************************************/ |
427 | 391 | ||
428 | static char * |
392 | char * |
429 | AcpiDbGetNextToken ( |
393 | AcpiDbGetNextToken ( |
430 | char *String, |
394 | char *String, |
- | 395 | char **Next, |
|
431 | char **Next) |
396 | ACPI_OBJECT_TYPE *ReturnType) |
432 | { |
397 | { |
- | 398 | char *Start; |
|
- | 399 | UINT32 Depth; |
|
433 | char *Start; |
400 | ACPI_OBJECT_TYPE Type = ACPI_TYPE_INTEGER; |
434 | 401 | ||
435 | 402 | ||
436 | /* At end of buffer? */ |
403 | /* At end of buffer? */ |
437 | 404 | ||
438 | if (!String || !(*String)) |
405 | if (!String || !(*String)) |
439 | { |
406 | { |
440 | return (NULL); |
407 | return (NULL); |
441 | } |
408 | } |
442 | 409 | ||
443 | /* Get rid of any spaces at the beginning */ |
410 | /* Remove any spaces at the beginning */ |
444 | 411 | ||
445 | if (*String == ' ') |
412 | if (*String == ' ') |
446 | { |
413 | { |
447 | while (*String && (*String == ' ')) |
414 | while (*String && (*String == ' ')) |
448 | { |
415 | { |
449 | String++; |
416 | String++; |
450 | } |
417 | } |
451 | 418 | ||
452 | if (!(*String)) |
419 | if (!(*String)) |
453 | { |
420 | { |
454 | return (NULL); |
421 | return (NULL); |
455 | } |
422 | } |
456 | } |
423 | } |
- | 424 | ||
- | 425 | switch (*String) |
|
- | 426 | { |
|
- | 427 | case '"': |
|
- | 428 | ||
- | 429 | /* This is a quoted string, scan until closing quote */ |
|
- | 430 | ||
- | 431 | String++; |
|
- | 432 | Start = String; |
|
- | 433 | Type = ACPI_TYPE_STRING; |
|
- | 434 | ||
- | 435 | /* Find end of string */ |
|
- | 436 | ||
- | 437 | while (*String && (*String != '"')) |
|
- | 438 | { |
|
- | 439 | String++; |
|
- | 440 | } |
|
- | 441 | break; |
|
- | 442 | ||
- | 443 | case '(': |
|
- | 444 | ||
- | 445 | /* This is the start of a buffer, scan until closing paren */ |
|
- | 446 | ||
- | 447 | String++; |
|
- | 448 | Start = String; |
|
- | 449 | Type = ACPI_TYPE_BUFFER; |
|
- | 450 | ||
- | 451 | /* Find end of buffer */ |
|
- | 452 | ||
- | 453 | while (*String && (*String != ')')) |
|
- | 454 | { |
|
- | 455 | String++; |
|
- | 456 | } |
|
- | 457 | break; |
|
- | 458 | ||
- | 459 | case '[': |
|
- | 460 | ||
- | 461 | /* This is the start of a package, scan until closing bracket */ |
|
- | 462 | ||
- | 463 | String++; |
|
- | 464 | Depth = 1; |
|
- | 465 | Start = String; |
|
- | 466 | Type = ACPI_TYPE_PACKAGE; |
|
- | 467 | ||
- | 468 | /* Find end of package (closing bracket) */ |
|
- | 469 | ||
- | 470 | while (*String) |
|
- | 471 | { |
|
- | 472 | /* Handle String package elements */ |
|
- | 473 | ||
- | 474 | if (*String == '"') |
|
- | 475 | { |
|
- | 476 | /* Find end of string */ |
|
- | 477 | ||
- | 478 | String++; |
|
- | 479 | while (*String && (*String != '"')) |
|
- | 480 | { |
|
- | 481 | String++; |
|
- | 482 | } |
|
- | 483 | if (!(*String)) |
|
- | 484 | { |
|
- | 485 | break; |
|
- | 486 | } |
|
- | 487 | } |
|
- | 488 | else if (*String == '[') |
|
- | 489 | { |
|
- | 490 | Depth++; /* A nested package declaration */ |
|
- | 491 | } |
|
- | 492 | else if (*String == ']') |
|
- | 493 | { |
|
- | 494 | Depth--; |
|
- | 495 | if (Depth == 0) /* Found final package closing bracket */ |
|
- | 496 | { |
|
- | 497 | break; |
|
- | 498 | } |
|
- | 499 | } |
|
- | 500 | ||
- | 501 | String++; |
|
- | 502 | } |
|
- | 503 | break; |
|
- | 504 | ||
- | 505 | default: |
|
457 | 506 | ||
458 | Start = String; |
507 | Start = String; |
459 | 508 | ||
460 | /* Find end of token */ |
509 | /* Find end of token */ |
461 | 510 | ||
462 | while (*String && (*String != ' ')) |
511 | while (*String && (*String != ' ')) |
463 | { |
512 | { |
464 | String++; |
513 | String++; |
465 | } |
514 | } |
- | 515 | break; |
|
- | 516 | } |
|
466 | 517 | ||
467 | if (!(*String)) |
518 | if (!(*String)) |
468 | { |
519 | { |
469 | *Next = NULL; |
520 | *Next = NULL; |
470 | } |
521 | } |
471 | else |
522 | else |
472 | { |
523 | { |
473 | *String = 0; |
524 | *String = 0; |
474 | *Next = String + 1; |
525 | *Next = String + 1; |
475 | } |
526 | } |
- | 527 | ||
476 | 528 | *ReturnType = Type; |
|
477 | return (Start); |
529 | return (Start); |
478 | } |
530 | } |
479 | 531 | ||
480 | 532 | ||
481 | /******************************************************************************* |
533 | /******************************************************************************* |
482 | * |
534 | * |
483 | * FUNCTION: AcpiDbGetLine |
535 | * FUNCTION: AcpiDbGetLine |
484 | * |
536 | * |
485 | * PARAMETERS: InputBuffer - Command line buffer |
537 | * PARAMETERS: InputBuffer - Command line buffer |
486 | * |
538 | * |
487 | * RETURN: Count of arguments to the command |
539 | * RETURN: Count of arguments to the command |
488 | * |
540 | * |
489 | * DESCRIPTION: Get the next command line from the user. Gets entire line |
541 | * DESCRIPTION: Get the next command line from the user. Gets entire line |
490 | * up to the next newline |
542 | * up to the next newline |
491 | * |
543 | * |
492 | ******************************************************************************/ |
544 | ******************************************************************************/ |
493 | 545 | ||
494 | static UINT32 |
546 | static UINT32 |
495 | AcpiDbGetLine ( |
547 | AcpiDbGetLine ( |
496 | char *InputBuffer) |
548 | char *InputBuffer) |
497 | { |
549 | { |
498 | UINT32 i; |
550 | UINT32 i; |
499 | UINT32 Count; |
551 | UINT32 Count; |
500 | char *Next; |
552 | char *Next; |
501 | char *This; |
553 | char *This; |
502 | 554 | ||
503 | 555 | ||
504 | ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer); |
556 | ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer); |
505 | 557 | ||
506 | This = AcpiGbl_DbParsedBuf; |
558 | This = AcpiGbl_DbParsedBuf; |
507 | for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++) |
559 | for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++) |
508 | { |
560 | { |
509 | AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next); |
561 | AcpiGbl_DbArgs[i] = AcpiDbGetNextToken (This, &Next, |
- | 562 | &AcpiGbl_DbArgTypes[i]); |
|
510 | if (!AcpiGbl_DbArgs[i]) |
563 | if (!AcpiGbl_DbArgs[i]) |
511 | { |
564 | { |
512 | break; |
565 | break; |
513 | } |
566 | } |
514 | 567 | ||
515 | This = Next; |
568 | This = Next; |
516 | } |
569 | } |
517 | 570 | ||
518 | /* Uppercase the actual command */ |
571 | /* Uppercase the actual command */ |
519 | 572 | ||
520 | if (AcpiGbl_DbArgs[0]) |
573 | if (AcpiGbl_DbArgs[0]) |
521 | { |
574 | { |
522 | AcpiUtStrupr (AcpiGbl_DbArgs[0]); |
575 | AcpiUtStrupr (AcpiGbl_DbArgs[0]); |
523 | } |
576 | } |
524 | 577 | ||
525 | Count = i; |
578 | Count = i; |
526 | if (Count) |
579 | if (Count) |
527 | { |
580 | { |
528 | Count--; /* Number of args only */ |
581 | Count--; /* Number of args only */ |
529 | } |
582 | } |
530 | 583 | ||
531 | return (Count); |
584 | return (Count); |
532 | } |
585 | } |
533 | 586 | ||
534 | 587 | ||
535 | /******************************************************************************* |
588 | /******************************************************************************* |
536 | * |
589 | * |
537 | * FUNCTION: AcpiDbMatchCommand |
590 | * FUNCTION: AcpiDbMatchCommand |
538 | * |
591 | * |
539 | * PARAMETERS: UserCommand - User command line |
592 | * PARAMETERS: UserCommand - User command line |
540 | * |
593 | * |
541 | * RETURN: Index into command array, -1 if not found |
594 | * RETURN: Index into command array, -1 if not found |
542 | * |
595 | * |
543 | * DESCRIPTION: Search command array for a command match |
596 | * DESCRIPTION: Search command array for a command match |
544 | * |
597 | * |
545 | ******************************************************************************/ |
598 | ******************************************************************************/ |
546 | 599 | ||
547 | static UINT32 |
600 | static UINT32 |
548 | AcpiDbMatchCommand ( |
601 | AcpiDbMatchCommand ( |
549 | char *UserCommand) |
602 | char *UserCommand) |
550 | { |
603 | { |
551 | UINT32 i; |
604 | UINT32 i; |
552 | 605 | ||
553 | 606 | ||
554 | if (!UserCommand || UserCommand[0] == 0) |
607 | if (!UserCommand || UserCommand[0] == 0) |
555 | { |
608 | { |
556 | return (CMD_NULL); |
609 | return (CMD_NULL); |
557 | } |
610 | } |
558 | 611 | ||
559 | for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++) |
612 | for (i = CMD_FIRST_VALID; AcpiGbl_DbCommands[i].Name; i++) |
560 | { |
613 | { |
561 | if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) == |
614 | if (ACPI_STRSTR (AcpiGbl_DbCommands[i].Name, UserCommand) == |
562 | AcpiGbl_DbCommands[i].Name) |
615 | AcpiGbl_DbCommands[i].Name) |
563 | { |
616 | { |
564 | return (i); |
617 | return (i); |
565 | } |
618 | } |
566 | } |
619 | } |
567 | 620 | ||
568 | /* Command not recognized */ |
621 | /* Command not recognized */ |
569 | 622 | ||
570 | return (CMD_NOT_FOUND); |
623 | return (CMD_NOT_FOUND); |
571 | } |
624 | } |
572 | 625 | ||
573 | 626 | ||
574 | /******************************************************************************* |
627 | /******************************************************************************* |
575 | * |
628 | * |
576 | * FUNCTION: AcpiDbCommandDispatch |
629 | * FUNCTION: AcpiDbCommandDispatch |
577 | * |
630 | * |
578 | * PARAMETERS: InputBuffer - Command line buffer |
631 | * PARAMETERS: InputBuffer - Command line buffer |
579 | * WalkState - Current walk |
632 | * WalkState - Current walk |
580 | * Op - Current (executing) parse op |
633 | * Op - Current (executing) parse op |
581 | * |
634 | * |
582 | * RETURN: Status |
635 | * RETURN: Status |
583 | * |
636 | * |
584 | * DESCRIPTION: Command dispatcher. |
637 | * DESCRIPTION: Command dispatcher. |
585 | * |
638 | * |
586 | ******************************************************************************/ |
639 | ******************************************************************************/ |
587 | 640 | ||
588 | ACPI_STATUS |
641 | ACPI_STATUS |
589 | AcpiDbCommandDispatch ( |
642 | AcpiDbCommandDispatch ( |
590 | char *InputBuffer, |
643 | char *InputBuffer, |
591 | ACPI_WALK_STATE *WalkState, |
644 | ACPI_WALK_STATE *WalkState, |
592 | ACPI_PARSE_OBJECT *Op) |
645 | ACPI_PARSE_OBJECT *Op) |
593 | { |
646 | { |
594 | UINT32 Temp; |
647 | UINT32 Temp; |
595 | UINT32 CommandIndex; |
648 | UINT32 CommandIndex; |
596 | UINT32 ParamCount; |
649 | UINT32 ParamCount; |
597 | char *CommandLine; |
650 | char *CommandLine; |
598 | ACPI_STATUS Status = AE_CTRL_TRUE; |
651 | ACPI_STATUS Status = AE_CTRL_TRUE; |
599 | 652 | ||
600 | 653 | ||
601 | /* If AcpiTerminate has been called, terminate this thread */ |
654 | /* If AcpiTerminate has been called, terminate this thread */ |
602 | 655 | ||
603 | if (AcpiGbl_DbTerminateThreads) |
656 | if (AcpiGbl_DbTerminateThreads) |
604 | { |
657 | { |
605 | return (AE_CTRL_TERMINATE); |
658 | return (AE_CTRL_TERMINATE); |
606 | } |
659 | } |
607 | 660 | ||
608 | ParamCount = AcpiDbGetLine (InputBuffer); |
661 | ParamCount = AcpiDbGetLine (InputBuffer); |
609 | CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]); |
662 | CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]); |
610 | Temp = 0; |
663 | Temp = 0; |
611 | 664 | ||
612 | /* Verify that we have the minimum number of params */ |
665 | /* Verify that we have the minimum number of params */ |
613 | 666 | ||
614 | if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs) |
667 | if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs) |
615 | { |
668 | { |
616 | AcpiOsPrintf ("%u parameters entered, [%s] requires %u parameters\n", |
669 | AcpiOsPrintf ("%u parameters entered, [%s] requires %u parameters\n", |
617 | ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, |
670 | ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, |
618 | AcpiGbl_DbCommands[CommandIndex].MinArgs); |
671 | AcpiGbl_DbCommands[CommandIndex].MinArgs); |
619 | 672 | ||
620 | return (AE_CTRL_TRUE); |
673 | return (AE_CTRL_TRUE); |
621 | } |
674 | } |
622 | 675 | ||
623 | /* Decode and dispatch the command */ |
676 | /* Decode and dispatch the command */ |
624 | 677 | ||
625 | switch (CommandIndex) |
678 | switch (CommandIndex) |
626 | { |
679 | { |
627 | case CMD_NULL: |
680 | case CMD_NULL: |
628 | if (Op) |
681 | if (Op) |
629 | { |
682 | { |
630 | return (AE_OK); |
683 | return (AE_OK); |
631 | } |
684 | } |
632 | break; |
685 | break; |
633 | 686 | ||
634 | case CMD_ALLOCATIONS: |
687 | case CMD_ALLOCATIONS: |
635 | 688 | ||
636 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
689 | #ifdef ACPI_DBG_TRACK_ALLOCATIONS |
637 | AcpiUtDumpAllocations ((UINT32) -1, NULL); |
690 | AcpiUtDumpAllocations ((UINT32) -1, NULL); |
638 | #endif |
691 | #endif |
639 | break; |
692 | break; |
640 | 693 | ||
641 | case CMD_ARGS: |
694 | case CMD_ARGS: |
642 | case CMD_ARGUMENTS: |
695 | case CMD_ARGUMENTS: |
643 | AcpiDbDisplayArguments (); |
696 | AcpiDbDisplayArguments (); |
644 | break; |
697 | break; |
645 | 698 | ||
646 | case CMD_BATCH: |
699 | case CMD_BATCH: |
647 | AcpiDbBatchExecute (AcpiGbl_DbArgs[1]); |
700 | AcpiDbBatchExecute (AcpiGbl_DbArgs[1]); |
648 | break; |
701 | break; |
649 | 702 | ||
650 | case CMD_BREAKPOINT: |
703 | case CMD_BREAKPOINT: |
651 | AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op); |
704 | AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op); |
652 | break; |
705 | break; |
653 | 706 | ||
654 | case CMD_BUSINFO: |
707 | case CMD_BUSINFO: |
655 | AcpiDbGetBusInfo (); |
708 | AcpiDbGetBusInfo (); |
656 | break; |
709 | break; |
657 | 710 | ||
658 | case CMD_CALL: |
711 | case CMD_CALL: |
659 | AcpiDbSetMethodCallBreakpoint (Op); |
712 | AcpiDbSetMethodCallBreakpoint (Op); |
660 | Status = AE_OK; |
713 | Status = AE_OK; |
661 | break; |
714 | break; |
662 | 715 | ||
663 | case CMD_CLOSE: |
716 | case CMD_CLOSE: |
664 | AcpiDbCloseDebugFile (); |
717 | AcpiDbCloseDebugFile (); |
665 | break; |
718 | break; |
666 | 719 | ||
667 | case CMD_DEBUG: |
720 | case CMD_DEBUG: |
- | 721 | AcpiDbExecute (AcpiGbl_DbArgs[1], |
|
668 | AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_SINGLE_STEP); |
722 | &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_SINGLE_STEP); |
669 | break; |
723 | break; |
670 | 724 | ||
671 | case CMD_DISASSEMBLE: |
725 | case CMD_DISASSEMBLE: |
672 | (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]); |
726 | (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]); |
673 | break; |
727 | break; |
674 | 728 | ||
675 | case CMD_DUMP: |
729 | case CMD_DUMP: |
676 | AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
730 | AcpiDbDecodeAndDisplayObject (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
677 | break; |
731 | break; |
678 | 732 | ||
679 | case CMD_ENABLEACPI: |
733 | case CMD_ENABLEACPI: |
680 | Status = AcpiEnable(); |
734 | Status = AcpiEnable(); |
681 | if (ACPI_FAILURE(Status)) |
735 | if (ACPI_FAILURE(Status)) |
682 | { |
736 | { |
683 | AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status); |
737 | AcpiOsPrintf("AcpiEnable failed (Status=%X)\n", Status); |
684 | return (Status); |
738 | return (Status); |
685 | } |
739 | } |
686 | break; |
740 | break; |
687 | 741 | ||
688 | case CMD_EVENT: |
742 | case CMD_EVENT: |
689 | AcpiOsPrintf ("Event command not implemented\n"); |
743 | AcpiOsPrintf ("Event command not implemented\n"); |
690 | break; |
744 | break; |
691 | 745 | ||
692 | case CMD_EXECUTE: |
746 | case CMD_EXECUTE: |
693 | AcpiDbExecute (AcpiGbl_DbArgs[1], |
747 | AcpiDbExecute (AcpiGbl_DbArgs[1], |
694 | &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP); |
748 | &AcpiGbl_DbArgs[2], &AcpiGbl_DbArgTypes[2], EX_NO_SINGLE_STEP); |
695 | break; |
749 | break; |
696 | 750 | ||
697 | case CMD_FIND: |
751 | case CMD_FIND: |
698 | Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]); |
752 | Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]); |
699 | break; |
753 | break; |
700 | 754 | ||
701 | case CMD_GO: |
755 | case CMD_GO: |
702 | AcpiGbl_CmSingleStep = FALSE; |
756 | AcpiGbl_CmSingleStep = FALSE; |
703 | return (AE_OK); |
757 | return (AE_OK); |
704 | 758 | ||
705 | case CMD_GPE: |
759 | case CMD_GPE: |
706 | AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
760 | AcpiDbGenerateGpe (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
707 | break; |
761 | break; |
708 | 762 | ||
709 | case CMD_GPES: |
763 | case CMD_GPES: |
710 | AcpiDbDisplayGpes (); |
764 | AcpiDbDisplayGpes (); |
711 | break; |
765 | break; |
- | 766 | ||
- | 767 | case CMD_HANDLERS: |
|
- | 768 | AcpiDbDisplayHandlers (); |
|
- | 769 | break; |
|
712 | 770 | ||
713 | case CMD_HELP: |
771 | case CMD_HELP: |
714 | case CMD_HELP2: |
772 | case CMD_HELP2: |
715 | AcpiDbDisplayHelp (AcpiGbl_DbArgs[1]); |
773 | AcpiDbDisplayHelp (); |
716 | break; |
774 | break; |
717 | 775 | ||
718 | case CMD_HISTORY: |
776 | case CMD_HISTORY: |
719 | AcpiDbDisplayHistory (); |
777 | AcpiDbDisplayHistory (); |
720 | break; |
778 | break; |
721 | 779 | ||
722 | case CMD_HISTORY_EXE: |
780 | case CMD_HISTORY_EXE: |
723 | CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]); |
781 | CommandLine = AcpiDbGetFromHistory (AcpiGbl_DbArgs[1]); |
724 | if (!CommandLine) |
782 | if (!CommandLine) |
725 | { |
783 | { |
726 | return (AE_CTRL_TRUE); |
784 | return (AE_CTRL_TRUE); |
727 | } |
785 | } |
728 | 786 | ||
729 | Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); |
787 | Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); |
730 | return (Status); |
788 | return (Status); |
731 | 789 | ||
732 | case CMD_HISTORY_LAST: |
790 | case CMD_HISTORY_LAST: |
733 | CommandLine = AcpiDbGetFromHistory (NULL); |
791 | CommandLine = AcpiDbGetFromHistory (NULL); |
734 | if (!CommandLine) |
792 | if (!CommandLine) |
735 | { |
793 | { |
736 | return (AE_CTRL_TRUE); |
794 | return (AE_CTRL_TRUE); |
737 | } |
795 | } |
738 | 796 | ||
739 | Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); |
797 | Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); |
740 | return (Status); |
798 | return (Status); |
741 | 799 | ||
742 | case CMD_INFORMATION: |
800 | case CMD_INFORMATION: |
743 | AcpiDbDisplayMethodInfo (Op); |
801 | AcpiDbDisplayMethodInfo (Op); |
744 | break; |
802 | break; |
745 | 803 | ||
746 | case CMD_INTEGRITY: |
804 | case CMD_INTEGRITY: |
747 | AcpiDbCheckIntegrity (); |
805 | AcpiDbCheckIntegrity (); |
748 | break; |
806 | break; |
749 | 807 | ||
750 | case CMD_INTO: |
808 | case CMD_INTO: |
751 | if (Op) |
809 | if (Op) |
752 | { |
810 | { |
753 | AcpiGbl_CmSingleStep = TRUE; |
811 | AcpiGbl_CmSingleStep = TRUE; |
754 | return (AE_OK); |
812 | return (AE_OK); |
755 | } |
813 | } |
756 | break; |
814 | break; |
757 | 815 | ||
758 | case CMD_LEVEL: |
816 | case CMD_LEVEL: |
759 | if (ParamCount == 0) |
817 | if (ParamCount == 0) |
760 | { |
818 | { |
761 | AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n", |
819 | AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n", |
762 | AcpiGbl_DbDebugLevel); |
820 | AcpiGbl_DbDebugLevel); |
763 | AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n", |
821 | AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n", |
764 | AcpiGbl_DbConsoleDebugLevel); |
822 | AcpiGbl_DbConsoleDebugLevel); |
765 | } |
823 | } |
766 | else if (ParamCount == 2) |
824 | else if (ParamCount == 2) |
767 | { |
825 | { |
768 | Temp = AcpiGbl_DbConsoleDebugLevel; |
826 | Temp = AcpiGbl_DbConsoleDebugLevel; |
769 | AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], |
827 | AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], |
770 | NULL, 16); |
828 | NULL, 16); |
771 | AcpiOsPrintf ( |
829 | AcpiOsPrintf ( |
772 | "Debug Level for console output was %8.8lX, now %8.8lX\n", |
830 | "Debug Level for console output was %8.8lX, now %8.8lX\n", |
773 | Temp, AcpiGbl_DbConsoleDebugLevel); |
831 | Temp, AcpiGbl_DbConsoleDebugLevel); |
774 | } |
832 | } |
775 | else |
833 | else |
776 | { |
834 | { |
777 | Temp = AcpiGbl_DbDebugLevel; |
835 | Temp = AcpiGbl_DbDebugLevel; |
778 | AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16); |
836 | AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16); |
779 | AcpiOsPrintf ( |
837 | AcpiOsPrintf ( |
780 | "Debug Level for file output was %8.8lX, now %8.8lX\n", |
838 | "Debug Level for file output was %8.8lX, now %8.8lX\n", |
781 | Temp, AcpiGbl_DbDebugLevel); |
839 | Temp, AcpiGbl_DbDebugLevel); |
782 | } |
840 | } |
783 | break; |
841 | break; |
784 | 842 | ||
785 | case CMD_LIST: |
843 | case CMD_LIST: |
786 | AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op); |
844 | AcpiDbDisassembleAml (AcpiGbl_DbArgs[1], Op); |
787 | break; |
845 | break; |
788 | 846 | ||
789 | case CMD_LOAD: |
847 | case CMD_LOAD: |
790 | Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL); |
848 | Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL); |
791 | break; |
849 | break; |
792 | 850 | ||
793 | case CMD_LOCKS: |
851 | case CMD_LOCKS: |
794 | AcpiDbDisplayLocks (); |
852 | AcpiDbDisplayLocks (); |
795 | break; |
853 | break; |
796 | 854 | ||
797 | case CMD_LOCALS: |
855 | case CMD_LOCALS: |
798 | AcpiDbDisplayLocals (); |
856 | AcpiDbDisplayLocals (); |
799 | break; |
857 | break; |
800 | 858 | ||
801 | case CMD_METHODS: |
859 | case CMD_METHODS: |
802 | Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]); |
860 | Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]); |
803 | break; |
861 | break; |
804 | 862 | ||
805 | case CMD_NAMESPACE: |
863 | case CMD_NAMESPACE: |
806 | AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
864 | AcpiDbDumpNamespace (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
807 | break; |
865 | break; |
808 | 866 | ||
809 | case CMD_NOTIFY: |
867 | case CMD_NOTIFY: |
810 | Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0); |
868 | Temp = ACPI_STRTOUL (AcpiGbl_DbArgs[2], NULL, 0); |
811 | AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp); |
869 | AcpiDbSendNotify (AcpiGbl_DbArgs[1], Temp); |
812 | break; |
870 | break; |
813 | 871 | ||
814 | case CMD_OBJECT: |
872 | case CMD_OBJECT: |
815 | AcpiUtStrupr (AcpiGbl_DbArgs[1]); |
873 | AcpiUtStrupr (AcpiGbl_DbArgs[1]); |
816 | Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
874 | Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
817 | break; |
875 | break; |
818 | 876 | ||
819 | case CMD_OPEN: |
877 | case CMD_OPEN: |
820 | AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]); |
878 | AcpiDbOpenDebugFile (AcpiGbl_DbArgs[1]); |
821 | break; |
879 | break; |
- | 880 | ||
- | 881 | case CMD_OSI: |
|
- | 882 | AcpiDbDisplayInterfaces (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
|
- | 883 | break; |
|
822 | 884 | ||
823 | case CMD_OWNER: |
885 | case CMD_OWNER: |
824 | AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
886 | AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
825 | break; |
887 | break; |
826 | 888 | ||
827 | case CMD_PREDEFINED: |
889 | case CMD_PREDEFINED: |
828 | AcpiDbCheckPredefinedNames (); |
890 | AcpiDbCheckPredefinedNames (); |
829 | break; |
891 | break; |
830 | 892 | ||
831 | case CMD_PREFIX: |
893 | case CMD_PREFIX: |
832 | AcpiDbSetScope (AcpiGbl_DbArgs[1]); |
894 | AcpiDbSetScope (AcpiGbl_DbArgs[1]); |
833 | break; |
895 | break; |
834 | 896 | ||
835 | case CMD_REFERENCES: |
897 | case CMD_REFERENCES: |
836 | AcpiDbFindReferences (AcpiGbl_DbArgs[1]); |
898 | AcpiDbFindReferences (AcpiGbl_DbArgs[1]); |
837 | break; |
899 | break; |
838 | 900 | ||
839 | case CMD_RESOURCES: |
901 | case CMD_RESOURCES: |
840 | AcpiDbDisplayResources (AcpiGbl_DbArgs[1]); |
902 | AcpiDbDisplayResources (AcpiGbl_DbArgs[1]); |
841 | break; |
903 | break; |
842 | 904 | ||
843 | case CMD_RESULTS: |
905 | case CMD_RESULTS: |
844 | AcpiDbDisplayResults (); |
906 | AcpiDbDisplayResults (); |
845 | break; |
907 | break; |
846 | 908 | ||
847 | case CMD_SET: |
909 | case CMD_SET: |
848 | AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], |
910 | AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], |
849 | AcpiGbl_DbArgs[3]); |
911 | AcpiGbl_DbArgs[3]); |
850 | break; |
912 | break; |
851 | 913 | ||
852 | case CMD_SLEEP: |
914 | case CMD_SLEEP: |
853 | Status = AcpiDbSleep (AcpiGbl_DbArgs[1]); |
915 | Status = AcpiDbSleep (AcpiGbl_DbArgs[1]); |
854 | break; |
916 | break; |
855 | 917 | ||
856 | case CMD_STATS: |
918 | case CMD_STATS: |
857 | Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); |
919 | Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); |
858 | break; |
920 | break; |
859 | 921 | ||
860 | case CMD_STOP: |
922 | case CMD_STOP: |
861 | return (AE_NOT_IMPLEMENTED); |
923 | return (AE_NOT_IMPLEMENTED); |
862 | 924 | ||
863 | case CMD_TABLES: |
925 | case CMD_TABLES: |
864 | AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]); |
926 | AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]); |
865 | break; |
927 | break; |
866 | 928 | ||
867 | case CMD_TERMINATE: |
929 | case CMD_TERMINATE: |
868 | AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); |
930 | AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); |
869 | AcpiUtSubsystemShutdown (); |
931 | AcpiUtSubsystemShutdown (); |
870 | 932 | ||
871 | /* |
933 | /* |
872 | * TBD: [Restructure] Need some way to re-initialize without |
934 | * TBD: [Restructure] Need some way to re-initialize without |
873 | * re-creating the semaphores! |
935 | * re-creating the semaphores! |
874 | */ |
936 | */ |
875 | 937 | ||
876 | /* AcpiInitialize (NULL); */ |
938 | /* AcpiInitialize (NULL); */ |
877 | break; |
939 | break; |
878 | 940 | ||
879 | case CMD_THREADS: |
941 | case CMD_THREADS: |
880 | AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], |
942 | AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], |
881 | AcpiGbl_DbArgs[3]); |
943 | AcpiGbl_DbArgs[3]); |
882 | break; |
944 | break; |
883 | 945 | ||
884 | case CMD_TRACE: |
946 | case CMD_TRACE: |
885 | (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); |
947 | (void) AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1); |
886 | break; |
948 | break; |
887 | 949 | ||
888 | case CMD_TREE: |
950 | case CMD_TREE: |
889 | AcpiDbDisplayCallingTree (); |
951 | AcpiDbDisplayCallingTree (); |
890 | break; |
952 | break; |
891 | 953 | ||
892 | case CMD_TYPE: |
954 | case CMD_TYPE: |
893 | AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]); |
955 | AcpiDbDisplayObjectType (AcpiGbl_DbArgs[1]); |
894 | break; |
956 | break; |
895 | 957 | ||
896 | case CMD_UNLOAD: |
958 | case CMD_UNLOAD: |
897 | AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
959 | AcpiDbUnloadAcpiTable (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); |
898 | break; |
960 | break; |
899 | 961 | ||
900 | case CMD_EXIT: |
962 | case CMD_EXIT: |
901 | case CMD_QUIT: |
963 | case CMD_QUIT: |
902 | if (Op) |
964 | if (Op) |
903 | { |
965 | { |
904 | AcpiOsPrintf ("Method execution terminated\n"); |
966 | AcpiOsPrintf ("Method execution terminated\n"); |
905 | return (AE_CTRL_TERMINATE); |
967 | return (AE_CTRL_TERMINATE); |
906 | } |
968 | } |
907 | 969 | ||
908 | if (!AcpiGbl_DbOutputToFile) |
970 | if (!AcpiGbl_DbOutputToFile) |
909 | { |
971 | { |
910 | AcpiDbgLevel = ACPI_DEBUG_DEFAULT; |
972 | AcpiDbgLevel = ACPI_DEBUG_DEFAULT; |
911 | } |
973 | } |
912 | 974 | ||
913 | AcpiDbCloseDebugFile (); |
975 | AcpiDbCloseDebugFile (); |
914 | AcpiGbl_DbTerminateThreads = TRUE; |
976 | AcpiGbl_DbTerminateThreads = TRUE; |
915 | return (AE_CTRL_TERMINATE); |
977 | return (AE_CTRL_TERMINATE); |
916 | 978 | ||
917 | case CMD_NOT_FOUND: |
979 | case CMD_NOT_FOUND: |
918 | default: |
980 | default: |
919 | AcpiOsPrintf ("Unknown Command\n"); |
981 | AcpiOsPrintf ("Unknown Command\n"); |
920 | return (AE_CTRL_TRUE); |
982 | return (AE_CTRL_TRUE); |
921 | } |
983 | } |
922 | 984 | ||
923 | if (ACPI_SUCCESS (Status)) |
985 | if (ACPI_SUCCESS (Status)) |
924 | { |
986 | { |
925 | Status = AE_CTRL_TRUE; |
987 | Status = AE_CTRL_TRUE; |
926 | } |
988 | } |
927 | 989 | ||
928 | /* Add all commands that come here to the history buffer */ |
990 | /* Add all commands that come here to the history buffer */ |
929 | 991 | ||
930 | AcpiDbAddToHistory (InputBuffer); |
992 | AcpiDbAddToHistory (InputBuffer); |
931 | return (Status); |
993 | return (Status); |
932 | } |
994 | } |
933 | 995 | ||
934 | 996 | ||
935 | /******************************************************************************* |
997 | /******************************************************************************* |
936 | * |
998 | * |
937 | * FUNCTION: AcpiDbExecuteThread |
999 | * FUNCTION: AcpiDbExecuteThread |
938 | * |
1000 | * |
939 | * PARAMETERS: Context - Not used |
1001 | * PARAMETERS: Context - Not used |
940 | * |
1002 | * |
941 | * RETURN: None |
1003 | * RETURN: None |
942 | * |
1004 | * |
943 | * DESCRIPTION: Debugger execute thread. Waits for a command line, then |
1005 | * DESCRIPTION: Debugger execute thread. Waits for a command line, then |
944 | * simply dispatches it. |
1006 | * simply dispatches it. |
945 | * |
1007 | * |
946 | ******************************************************************************/ |
1008 | ******************************************************************************/ |
947 | 1009 | ||
948 | void ACPI_SYSTEM_XFACE |
1010 | void ACPI_SYSTEM_XFACE |
949 | AcpiDbExecuteThread ( |
1011 | AcpiDbExecuteThread ( |
950 | void *Context) |
1012 | void *Context) |
951 | { |
1013 | { |
952 | ACPI_STATUS Status = AE_OK; |
1014 | ACPI_STATUS Status = AE_OK; |
953 | ACPI_STATUS MStatus; |
1015 | ACPI_STATUS MStatus; |
954 | 1016 | ||
955 | 1017 | ||
956 | while (Status != AE_CTRL_TERMINATE) |
1018 | while (Status != AE_CTRL_TERMINATE) |
957 | { |
1019 | { |
958 | AcpiGbl_MethodExecuting = FALSE; |
1020 | AcpiGbl_MethodExecuting = FALSE; |
959 | AcpiGbl_StepToNextCall = FALSE; |
1021 | AcpiGbl_StepToNextCall = FALSE; |
960 | 1022 | ||
961 | MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); |
1023 | MStatus = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); |
962 | if (ACPI_FAILURE (MStatus)) |
1024 | if (ACPI_FAILURE (MStatus)) |
963 | { |
1025 | { |
964 | return; |
1026 | return; |
965 | } |
1027 | } |
966 | 1028 | ||
967 | Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); |
1029 | Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); |
968 | 1030 | ||
969 | MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); |
1031 | MStatus = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); |
970 | if (ACPI_FAILURE (MStatus)) |
1032 | if (ACPI_FAILURE (MStatus)) |
971 | { |
1033 | { |
972 | return; |
1034 | return; |
973 | } |
1035 | } |
974 | } |
1036 | } |
975 | } |
1037 | } |
976 | 1038 | ||
977 | 1039 | ||
978 | /******************************************************************************* |
1040 | /******************************************************************************* |
979 | * |
1041 | * |
980 | * FUNCTION: AcpiDbSingleThread |
1042 | * FUNCTION: AcpiDbSingleThread |
981 | * |
1043 | * |
982 | * PARAMETERS: None |
1044 | * PARAMETERS: None |
983 | * |
1045 | * |
984 | * RETURN: None |
1046 | * RETURN: None |
985 | * |
1047 | * |
986 | * DESCRIPTION: Debugger execute thread. Waits for a command line, then |
1048 | * DESCRIPTION: Debugger execute thread. Waits for a command line, then |
987 | * simply dispatches it. |
1049 | * simply dispatches it. |
988 | * |
1050 | * |
989 | ******************************************************************************/ |
1051 | ******************************************************************************/ |
990 | 1052 | ||
991 | static void |
1053 | static void |
992 | AcpiDbSingleThread ( |
1054 | AcpiDbSingleThread ( |
993 | void) |
1055 | void) |
994 | { |
1056 | { |
995 | 1057 | ||
996 | AcpiGbl_MethodExecuting = FALSE; |
1058 | AcpiGbl_MethodExecuting = FALSE; |
997 | AcpiGbl_StepToNextCall = FALSE; |
1059 | AcpiGbl_StepToNextCall = FALSE; |
998 | 1060 | ||
999 | (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); |
1061 | (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); |
1000 | } |
1062 | } |
1001 | 1063 | ||
1002 | 1064 | ||
1003 | /******************************************************************************* |
1065 | /******************************************************************************* |
1004 | * |
1066 | * |
1005 | * FUNCTION: AcpiDbUserCommands |
1067 | * FUNCTION: AcpiDbUserCommands |
1006 | * |
1068 | * |
1007 | * PARAMETERS: Prompt - User prompt (depends on mode) |
1069 | * PARAMETERS: Prompt - User prompt (depends on mode) |
1008 | * Op - Current executing parse op |
1070 | * Op - Current executing parse op |
1009 | * |
1071 | * |
1010 | * RETURN: None |
1072 | * RETURN: None |
1011 | * |
1073 | * |
1012 | * DESCRIPTION: Command line execution for the AML debugger. Commands are |
1074 | * DESCRIPTION: Command line execution for the AML debugger. Commands are |
1013 | * matched and dispatched here. |
1075 | * matched and dispatched here. |
1014 | * |
1076 | * |
1015 | ******************************************************************************/ |
1077 | ******************************************************************************/ |
1016 | 1078 | ||
1017 | ACPI_STATUS |
1079 | ACPI_STATUS |
1018 | AcpiDbUserCommands ( |
1080 | AcpiDbUserCommands ( |
1019 | char Prompt, |
1081 | char Prompt, |
1020 | ACPI_PARSE_OBJECT *Op) |
1082 | ACPI_PARSE_OBJECT *Op) |
1021 | { |
1083 | { |
1022 | ACPI_STATUS Status = AE_OK; |
1084 | ACPI_STATUS Status = AE_OK; |
1023 | 1085 | ||
1024 | 1086 | ||
1025 | /* TBD: [Restructure] Need a separate command line buffer for step mode */ |
1087 | /* TBD: [Restructure] Need a separate command line buffer for step mode */ |
1026 | 1088 | ||
1027 | while (!AcpiGbl_DbTerminateThreads) |
1089 | while (!AcpiGbl_DbTerminateThreads) |
1028 | { |
1090 | { |
1029 | /* Force output to console until a command is entered */ |
1091 | /* Force output to console until a command is entered */ |
1030 | 1092 | ||
1031 | AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); |
1093 | AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); |
1032 | 1094 | ||
1033 | /* Different prompt if method is executing */ |
1095 | /* Different prompt if method is executing */ |
1034 | 1096 | ||
1035 | if (!AcpiGbl_MethodExecuting) |
1097 | if (!AcpiGbl_MethodExecuting) |
1036 | { |
1098 | { |
1037 | AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); |
1099 | AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); |
1038 | } |
1100 | } |
1039 | else |
1101 | else |
1040 | { |
1102 | { |
1041 | AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); |
1103 | AcpiOsPrintf ("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); |
1042 | } |
1104 | } |
1043 | 1105 | ||
1044 | /* Get the user input line */ |
1106 | /* Get the user input line */ |
1045 | 1107 | ||
- | 1108 | Status = AcpiOsGetLine (AcpiGbl_DbLineBuf, |
|
- | 1109 | ACPI_DB_LINE_BUFFER_SIZE, NULL); |
|
- | 1110 | if (ACPI_FAILURE (Status)) |
|
- | 1111 | { |
|
- | 1112 | ACPI_EXCEPTION ((AE_INFO, Status, "While parsing command line")); |
|
- | 1113 | return (Status); |
|
1046 | (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); |
1114 | } |
1047 | 1115 | ||
1048 | /* Check for single or multithreaded debug */ |
1116 | /* Check for single or multithreaded debug */ |
1049 | 1117 | ||
1050 | if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED) |
1118 | if (AcpiGbl_DebuggerConfiguration & DEBUGGER_MULTI_THREADED) |
1051 | { |
1119 | { |
1052 | /* |
1120 | /* |
1053 | * Signal the debug thread that we have a command to execute, |
1121 | * Signal the debug thread that we have a command to execute, |
1054 | * and wait for the command to complete. |
1122 | * and wait for the command to complete. |
1055 | */ |
1123 | */ |
1056 | Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY); |
1124 | Status = AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY); |
1057 | if (ACPI_FAILURE (Status)) |
1125 | if (ACPI_FAILURE (Status)) |
1058 | { |
1126 | { |
1059 | return (Status); |
1127 | return (Status); |
1060 | } |
1128 | } |
1061 | 1129 | ||
1062 | Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); |
1130 | Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); |
1063 | if (ACPI_FAILURE (Status)) |
1131 | if (ACPI_FAILURE (Status)) |
1064 | { |
1132 | { |
1065 | return (Status); |
1133 | return (Status); |
1066 | } |
1134 | } |
1067 | } |
1135 | } |
1068 | else |
1136 | else |
1069 | { |
1137 | { |
1070 | /* Just call to the command line interpreter */ |
1138 | /* Just call to the command line interpreter */ |
1071 | 1139 | ||
1072 | AcpiDbSingleThread (); |
1140 | AcpiDbSingleThread (); |
1073 | } |
1141 | } |
1074 | } |
1142 | } |
1075 | 1143 | ||
1076 | /* |
1144 | /* |
1077 | * Only this thread (the original thread) should actually terminate the |
1145 | * Only this thread (the original thread) should actually terminate the |
1078 | * subsystem, because all the semaphores are deleted during termination |
1146 | * subsystem, because all the semaphores are deleted during termination |
1079 | */ |
1147 | */ |
1080 | Status = AcpiTerminate (); |
1148 | Status = AcpiTerminate (); |
1081 | return (Status); |
1149 | return (Status); |
1082 | } |
1150 | } |
1083 | 1151 | ||
1084 | #endif /* ACPI_DEBUGGER */>>#> |
1152 | #endif /* ACPI_DEBUGGER */>>#> |