dmopcode.c revision 1.1.1.4.2.8 1 1.1 jruoho /*******************************************************************************
2 1.1 jruoho *
3 1.1 jruoho * Module Name: dmopcode - AML disassembler, specific AML opcodes
4 1.1 jruoho *
5 1.1 jruoho ******************************************************************************/
6 1.1 jruoho
7 1.1.1.2 jruoho /*
8 1.1.1.4.2.7 skrll * Copyright (C) 2000 - 2017, Intel Corp.
9 1.1 jruoho * All rights reserved.
10 1.1 jruoho *
11 1.1.1.2 jruoho * Redistribution and use in source and binary forms, with or without
12 1.1.1.2 jruoho * modification, are permitted provided that the following conditions
13 1.1.1.2 jruoho * are met:
14 1.1.1.2 jruoho * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2 jruoho * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2 jruoho * without modification.
17 1.1.1.2 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2 jruoho * including a substantially similar Disclaimer requirement for further
21 1.1.1.2 jruoho * binary redistribution.
22 1.1.1.2 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2 jruoho * of any contributors may be used to endorse or promote products derived
24 1.1.1.2 jruoho * from this software without specific prior written permission.
25 1.1.1.2 jruoho *
26 1.1.1.2 jruoho * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2 jruoho * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2 jruoho * Software Foundation.
29 1.1.1.2 jruoho *
30 1.1.1.2 jruoho * NO WARRANTY
31 1.1.1.2 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.2 jruoho * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.2 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2 jruoho * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2 jruoho * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2 jruoho * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2 jruoho * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2 jruoho * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2 jruoho * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2 jruoho * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2 jruoho */
43 1.1 jruoho
44 1.1 jruoho #include "acpi.h"
45 1.1 jruoho #include "accommon.h"
46 1.1 jruoho #include "acparser.h"
47 1.1 jruoho #include "amlcode.h"
48 1.1.1.4 christos #include "acinterp.h"
49 1.1.1.4 christos #include "acnamesp.h"
50 1.1.1.4.2.2 skrll #include "acdebug.h"
51 1.1.1.4.2.8 skrll #include "acconvert.h"
52 1.1 jruoho
53 1.1 jruoho
54 1.1 jruoho #define _COMPONENT ACPI_CA_DEBUGGER
55 1.1 jruoho ACPI_MODULE_NAME ("dmopcode")
56 1.1 jruoho
57 1.1.1.4.2.1 skrll
58 1.1 jruoho /* Local prototypes */
59 1.1 jruoho
60 1.1 jruoho static void
61 1.1 jruoho AcpiDmMatchKeyword (
62 1.1 jruoho ACPI_PARSE_OBJECT *Op);
63 1.1 jruoho
64 1.1.1.4.2.3 skrll static void
65 1.1.1.4.2.3 skrll AcpiDmConvertToElseIf (
66 1.1.1.4.2.3 skrll ACPI_PARSE_OBJECT *Op);
67 1.1.1.4.2.3 skrll
68 1.1.1.4.2.6 skrll static void
69 1.1.1.4.2.6 skrll AcpiDmPromoteSubtree (
70 1.1.1.4.2.6 skrll ACPI_PARSE_OBJECT *StartOp);
71 1.1.1.4.2.6 skrll
72 1.1.1.4.2.7 skrll static BOOLEAN
73 1.1.1.4.2.7 skrll AcpiDmIsSwitchBlock (
74 1.1.1.4.2.8 skrll ACPI_PARSE_OBJECT *Op,
75 1.1.1.4.2.8 skrll char *Temp);
76 1.1.1.4.2.7 skrll
77 1.1.1.4.2.7 skrll static BOOLEAN
78 1.1.1.4.2.7 skrll AcpiDmIsCaseBlock (
79 1.1.1.4.2.7 skrll ACPI_PARSE_OBJECT *Op);
80 1.1 jruoho
81 1.1 jruoho /*******************************************************************************
82 1.1 jruoho *
83 1.1.1.4 christos * FUNCTION: AcpiDmDisplayTargetPathname
84 1.1.1.4 christos *
85 1.1.1.4 christos * PARAMETERS: Op - Parse object
86 1.1.1.4 christos *
87 1.1.1.4 christos * RETURN: None
88 1.1.1.4 christos *
89 1.1.1.4 christos * DESCRIPTION: For AML opcodes that have a target operand, display the full
90 1.1.1.4 christos * pathname for the target, in a comment field. Handles Return()
91 1.1.1.4 christos * statements also.
92 1.1.1.4 christos *
93 1.1.1.4 christos ******************************************************************************/
94 1.1.1.4 christos
95 1.1.1.4 christos void
96 1.1.1.4 christos AcpiDmDisplayTargetPathname (
97 1.1.1.4 christos ACPI_PARSE_OBJECT *Op)
98 1.1.1.4 christos {
99 1.1.1.4 christos ACPI_PARSE_OBJECT *NextOp;
100 1.1.1.4 christos ACPI_PARSE_OBJECT *PrevOp = NULL;
101 1.1.1.4 christos char *Pathname;
102 1.1.1.4 christos const ACPI_OPCODE_INFO *OpInfo;
103 1.1.1.4 christos
104 1.1.1.4 christos
105 1.1.1.4 christos if (Op->Common.AmlOpcode == AML_RETURN_OP)
106 1.1.1.4 christos {
107 1.1.1.4 christos PrevOp = Op->Asl.Value.Arg;
108 1.1.1.4 christos }
109 1.1.1.4 christos else
110 1.1.1.4 christos {
111 1.1.1.4 christos OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
112 1.1.1.4 christos if (!(OpInfo->Flags & AML_HAS_TARGET))
113 1.1.1.4 christos {
114 1.1.1.4 christos return;
115 1.1.1.4 christos }
116 1.1.1.4 christos
117 1.1.1.4 christos /* Target is the last Op in the arg list */
118 1.1.1.4 christos
119 1.1.1.4 christos NextOp = Op->Asl.Value.Arg;
120 1.1.1.4 christos while (NextOp)
121 1.1.1.4 christos {
122 1.1.1.4 christos PrevOp = NextOp;
123 1.1.1.4 christos NextOp = PrevOp->Asl.Next;
124 1.1.1.4 christos }
125 1.1.1.4 christos }
126 1.1.1.4 christos
127 1.1.1.4 christos if (!PrevOp)
128 1.1.1.4 christos {
129 1.1.1.4 christos return;
130 1.1.1.4 christos }
131 1.1.1.4 christos
132 1.1.1.4 christos /* We must have a namepath AML opcode */
133 1.1.1.4 christos
134 1.1.1.4 christos if (PrevOp->Asl.AmlOpcode != AML_INT_NAMEPATH_OP)
135 1.1.1.4 christos {
136 1.1.1.4 christos return;
137 1.1.1.4 christos }
138 1.1.1.4 christos
139 1.1.1.4 christos /* A null string is the "no target specified" case */
140 1.1.1.4 christos
141 1.1.1.4 christos if (!PrevOp->Asl.Value.String)
142 1.1.1.4 christos {
143 1.1.1.4 christos return;
144 1.1.1.4 christos }
145 1.1.1.4 christos
146 1.1.1.4 christos /* No node means "unresolved external reference" */
147 1.1.1.4 christos
148 1.1.1.4 christos if (!PrevOp->Asl.Node)
149 1.1.1.4 christos {
150 1.1.1.4 christos AcpiOsPrintf (" /* External reference */");
151 1.1.1.4 christos return;
152 1.1.1.4 christos }
153 1.1.1.4 christos
154 1.1.1.4 christos /* Ignore if path is already from the root */
155 1.1.1.4 christos
156 1.1.1.4 christos if (*PrevOp->Asl.Value.String == '\\')
157 1.1.1.4 christos {
158 1.1.1.4 christos return;
159 1.1.1.4 christos }
160 1.1.1.4 christos
161 1.1.1.4 christos /* Now: we can get the full pathname */
162 1.1.1.4 christos
163 1.1.1.4 christos Pathname = AcpiNsGetExternalPathname (PrevOp->Asl.Node);
164 1.1.1.4 christos if (!Pathname)
165 1.1.1.4 christos {
166 1.1.1.4 christos return;
167 1.1.1.4 christos }
168 1.1.1.4 christos
169 1.1.1.4 christos AcpiOsPrintf (" /* %s */", Pathname);
170 1.1.1.4 christos ACPI_FREE (Pathname);
171 1.1.1.4 christos }
172 1.1.1.4 christos
173 1.1.1.4 christos
174 1.1.1.4 christos /*******************************************************************************
175 1.1.1.4 christos *
176 1.1.1.4 christos * FUNCTION: AcpiDmNotifyDescription
177 1.1.1.4 christos *
178 1.1.1.4 christos * PARAMETERS: Op - Name() parse object
179 1.1.1.4 christos *
180 1.1.1.4 christos * RETURN: None
181 1.1.1.4 christos *
182 1.1.1.4 christos * DESCRIPTION: Emit a description comment for the value associated with a
183 1.1.1.4 christos * Notify() operator.
184 1.1.1.4 christos *
185 1.1.1.4 christos ******************************************************************************/
186 1.1.1.4 christos
187 1.1.1.4 christos void
188 1.1.1.4 christos AcpiDmNotifyDescription (
189 1.1.1.4 christos ACPI_PARSE_OBJECT *Op)
190 1.1.1.4 christos {
191 1.1.1.4 christos ACPI_PARSE_OBJECT *NextOp;
192 1.1.1.4 christos ACPI_NAMESPACE_NODE *Node;
193 1.1.1.4 christos UINT8 NotifyValue;
194 1.1.1.4 christos UINT8 Type = ACPI_TYPE_ANY;
195 1.1.1.4 christos
196 1.1.1.4 christos
197 1.1.1.4 christos /* The notify value is the second argument */
198 1.1.1.4 christos
199 1.1.1.4 christos NextOp = Op->Asl.Value.Arg;
200 1.1.1.4 christos NextOp = NextOp->Asl.Next;
201 1.1.1.4 christos
202 1.1.1.4 christos switch (NextOp->Common.AmlOpcode)
203 1.1.1.4 christos {
204 1.1.1.4 christos case AML_ZERO_OP:
205 1.1.1.4 christos case AML_ONE_OP:
206 1.1.1.4 christos
207 1.1.1.4 christos NotifyValue = (UINT8) NextOp->Common.AmlOpcode;
208 1.1.1.4 christos break;
209 1.1.1.4 christos
210 1.1.1.4 christos case AML_BYTE_OP:
211 1.1.1.4 christos
212 1.1.1.4 christos NotifyValue = (UINT8) NextOp->Asl.Value.Integer;
213 1.1.1.4 christos break;
214 1.1.1.4 christos
215 1.1.1.4 christos default:
216 1.1.1.4 christos return;
217 1.1.1.4 christos }
218 1.1.1.4 christos
219 1.1.1.4 christos /*
220 1.1.1.4 christos * Attempt to get the namespace node so we can determine the object type.
221 1.1.1.4 christos * Some notify values are dependent on the object type (Device, Thermal,
222 1.1.1.4 christos * or Processor).
223 1.1.1.4 christos */
224 1.1.1.4 christos Node = Op->Asl.Node;
225 1.1.1.4 christos if (Node)
226 1.1.1.4 christos {
227 1.1.1.4 christos Type = Node->Type;
228 1.1.1.4 christos }
229 1.1.1.4 christos
230 1.1.1.4 christos AcpiOsPrintf (" // %s", AcpiUtGetNotifyName (NotifyValue, Type));
231 1.1.1.4 christos }
232 1.1.1.4 christos
233 1.1.1.4 christos
234 1.1.1.4 christos /*******************************************************************************
235 1.1.1.4 christos *
236 1.1.1.3 christos * FUNCTION: AcpiDmPredefinedDescription
237 1.1.1.3 christos *
238 1.1.1.3 christos * PARAMETERS: Op - Name() parse object
239 1.1.1.3 christos *
240 1.1.1.3 christos * RETURN: None
241 1.1.1.3 christos *
242 1.1.1.3 christos * DESCRIPTION: Emit a description comment for a predefined ACPI name.
243 1.1.1.3 christos * Used for iASL compiler only.
244 1.1.1.3 christos *
245 1.1.1.3 christos ******************************************************************************/
246 1.1.1.3 christos
247 1.1.1.3 christos void
248 1.1.1.3 christos AcpiDmPredefinedDescription (
249 1.1.1.3 christos ACPI_PARSE_OBJECT *Op)
250 1.1.1.3 christos {
251 1.1.1.3 christos #ifdef ACPI_ASL_COMPILER
252 1.1.1.3 christos const AH_PREDEFINED_NAME *Info;
253 1.1.1.3 christos char *NameString;
254 1.1.1.3 christos int LastCharIsDigit;
255 1.1.1.3 christos int LastCharsAreHex;
256 1.1.1.3 christos
257 1.1.1.3 christos
258 1.1.1.3 christos if (!Op)
259 1.1.1.3 christos {
260 1.1.1.3 christos return;
261 1.1.1.3 christos }
262 1.1.1.3 christos
263 1.1.1.3 christos /* Ensure that the comment field is emitted only once */
264 1.1.1.3 christos
265 1.1.1.4.2.4 skrll if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEFINED_CHECKED)
266 1.1.1.3 christos {
267 1.1.1.3 christos return;
268 1.1.1.3 christos }
269 1.1.1.4.2.4 skrll Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEFINED_CHECKED;
270 1.1.1.3 christos
271 1.1.1.3 christos /* Predefined name must start with an underscore */
272 1.1.1.3 christos
273 1.1.1.3 christos NameString = ACPI_CAST_PTR (char, &Op->Named.Name);
274 1.1.1.3 christos if (NameString[0] != '_')
275 1.1.1.3 christos {
276 1.1.1.3 christos return;
277 1.1.1.3 christos }
278 1.1.1.3 christos
279 1.1.1.3 christos /*
280 1.1.1.3 christos * Check for the special ACPI names:
281 1.1.1.3 christos * _ACd, _ALd, _EJd, _Exx, _Lxx, _Qxx, _Wxx, _T_a
282 1.1.1.3 christos * (where d=decimal_digit, x=hex_digit, a=anything)
283 1.1.1.3 christos *
284 1.1.1.3 christos * Convert these to the generic name for table lookup.
285 1.1.1.3 christos * Note: NameString is guaranteed to be upper case here.
286 1.1.1.3 christos */
287 1.1.1.3 christos LastCharIsDigit =
288 1.1.1.4.2.2 skrll (isdigit ((int) NameString[3])); /* d */
289 1.1.1.3 christos LastCharsAreHex =
290 1.1.1.4.2.2 skrll (isxdigit ((int) NameString[2]) && /* xx */
291 1.1.1.4.2.2 skrll isxdigit ((int) NameString[3]));
292 1.1.1.3 christos
293 1.1.1.3 christos switch (NameString[1])
294 1.1.1.3 christos {
295 1.1.1.3 christos case 'A':
296 1.1.1.3 christos
297 1.1.1.3 christos if ((NameString[2] == 'C') && (LastCharIsDigit))
298 1.1.1.3 christos {
299 1.1.1.3 christos NameString = "_ACx";
300 1.1.1.3 christos }
301 1.1.1.3 christos else if ((NameString[2] == 'L') && (LastCharIsDigit))
302 1.1.1.3 christos {
303 1.1.1.3 christos NameString = "_ALx";
304 1.1.1.3 christos }
305 1.1.1.3 christos break;
306 1.1.1.3 christos
307 1.1.1.3 christos case 'E':
308 1.1.1.3 christos
309 1.1.1.3 christos if ((NameString[2] == 'J') && (LastCharIsDigit))
310 1.1.1.3 christos {
311 1.1.1.3 christos NameString = "_EJx";
312 1.1.1.3 christos }
313 1.1.1.3 christos else if (LastCharsAreHex)
314 1.1.1.3 christos {
315 1.1.1.3 christos NameString = "_Exx";
316 1.1.1.3 christos }
317 1.1.1.3 christos break;
318 1.1.1.3 christos
319 1.1.1.3 christos case 'L':
320 1.1.1.3 christos
321 1.1.1.3 christos if (LastCharsAreHex)
322 1.1.1.3 christos {
323 1.1.1.3 christos NameString = "_Lxx";
324 1.1.1.3 christos }
325 1.1.1.3 christos break;
326 1.1.1.3 christos
327 1.1.1.3 christos case 'Q':
328 1.1.1.3 christos
329 1.1.1.3 christos if (LastCharsAreHex)
330 1.1.1.3 christos {
331 1.1.1.3 christos NameString = "_Qxx";
332 1.1.1.3 christos }
333 1.1.1.3 christos break;
334 1.1.1.3 christos
335 1.1.1.3 christos case 'T':
336 1.1.1.3 christos
337 1.1.1.3 christos if (NameString[2] == '_')
338 1.1.1.3 christos {
339 1.1.1.3 christos NameString = "_T_x";
340 1.1.1.3 christos }
341 1.1.1.3 christos break;
342 1.1.1.3 christos
343 1.1.1.3 christos case 'W':
344 1.1.1.3 christos
345 1.1.1.3 christos if (LastCharsAreHex)
346 1.1.1.3 christos {
347 1.1.1.3 christos NameString = "_Wxx";
348 1.1.1.3 christos }
349 1.1.1.3 christos break;
350 1.1.1.3 christos
351 1.1.1.3 christos default:
352 1.1.1.3 christos
353 1.1.1.3 christos break;
354 1.1.1.3 christos }
355 1.1.1.3 christos
356 1.1.1.3 christos /* Match the name in the info table */
357 1.1.1.3 christos
358 1.1.1.4 christos Info = AcpiAhMatchPredefinedName (NameString);
359 1.1.1.4 christos if (Info)
360 1.1.1.3 christos {
361 1.1.1.4 christos AcpiOsPrintf (" // %4.4s: %s",
362 1.1.1.4 christos NameString, ACPI_CAST_PTR (char, Info->Description));
363 1.1.1.3 christos }
364 1.1.1.3 christos
365 1.1.1.3 christos #endif
366 1.1.1.3 christos return;
367 1.1.1.3 christos }
368 1.1.1.3 christos
369 1.1.1.3 christos
370 1.1.1.3 christos /*******************************************************************************
371 1.1.1.3 christos *
372 1.1.1.3 christos * FUNCTION: AcpiDmFieldPredefinedDescription
373 1.1.1.3 christos *
374 1.1.1.3 christos * PARAMETERS: Op - Parse object
375 1.1.1.3 christos *
376 1.1.1.3 christos * RETURN: None
377 1.1.1.3 christos *
378 1.1.1.3 christos * DESCRIPTION: Emit a description comment for a resource descriptor tag
379 1.1.1.3 christos * (which is a predefined ACPI name.) Used for iASL compiler only.
380 1.1.1.3 christos *
381 1.1.1.3 christos ******************************************************************************/
382 1.1.1.3 christos
383 1.1.1.3 christos void
384 1.1.1.3 christos AcpiDmFieldPredefinedDescription (
385 1.1.1.3 christos ACPI_PARSE_OBJECT *Op)
386 1.1.1.3 christos {
387 1.1.1.3 christos #ifdef ACPI_ASL_COMPILER
388 1.1.1.3 christos ACPI_PARSE_OBJECT *IndexOp;
389 1.1.1.3 christos char *Tag;
390 1.1.1.3 christos const ACPI_OPCODE_INFO *OpInfo;
391 1.1.1.3 christos const AH_PREDEFINED_NAME *Info;
392 1.1.1.3 christos
393 1.1.1.3 christos
394 1.1.1.3 christos if (!Op)
395 1.1.1.3 christos {
396 1.1.1.3 christos return;
397 1.1.1.3 christos }
398 1.1.1.3 christos
399 1.1.1.3 christos /* Ensure that the comment field is emitted only once */
400 1.1.1.3 christos
401 1.1.1.4.2.4 skrll if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEFINED_CHECKED)
402 1.1.1.3 christos {
403 1.1.1.3 christos return;
404 1.1.1.3 christos }
405 1.1.1.4.2.4 skrll Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEFINED_CHECKED;
406 1.1.1.3 christos
407 1.1.1.3 christos /*
408 1.1.1.3 christos * Op must be one of the Create* operators: CreateField, CreateBitField,
409 1.1.1.3 christos * CreateByteField, CreateWordField, CreateDwordField, CreateQwordField
410 1.1.1.3 christos */
411 1.1.1.3 christos OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
412 1.1.1.3 christos if (!(OpInfo->Flags & AML_CREATE))
413 1.1.1.3 christos {
414 1.1.1.3 christos return;
415 1.1.1.3 christos }
416 1.1.1.3 christos
417 1.1.1.3 christos /* Second argument is the Index argument */
418 1.1.1.3 christos
419 1.1.1.3 christos IndexOp = Op->Common.Value.Arg;
420 1.1.1.3 christos IndexOp = IndexOp->Common.Next;
421 1.1.1.3 christos
422 1.1.1.3 christos /* Index argument must be a namepath */
423 1.1.1.3 christos
424 1.1.1.3 christos if (IndexOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)
425 1.1.1.3 christos {
426 1.1.1.3 christos return;
427 1.1.1.3 christos }
428 1.1.1.3 christos
429 1.1.1.3 christos /* Major cheat: We previously put the Tag ptr in the Node field */
430 1.1.1.3 christos
431 1.1.1.3 christos Tag = ACPI_CAST_PTR (char, IndexOp->Common.Node);
432 1.1.1.3 christos if (!Tag)
433 1.1.1.3 christos {
434 1.1.1.3 christos return;
435 1.1.1.3 christos }
436 1.1.1.3 christos
437 1.1.1.3 christos /* Match the name in the info table */
438 1.1.1.3 christos
439 1.1.1.4 christos Info = AcpiAhMatchPredefinedName (Tag);
440 1.1.1.4 christos if (Info)
441 1.1.1.3 christos {
442 1.1.1.4 christos AcpiOsPrintf (" // %4.4s: %s", Tag,
443 1.1.1.4 christos ACPI_CAST_PTR (char, Info->Description));
444 1.1.1.3 christos }
445 1.1.1.3 christos
446 1.1.1.4.2.8 skrll /* AML buffer (String) was allocated in AcpiGetTagPathname */
447 1.1.1.4.2.8 skrll
448 1.1.1.4.2.8 skrll ACPI_FREE (IndexOp->Common.Value.String);
449 1.1.1.4.2.8 skrll
450 1.1.1.3 christos #endif
451 1.1.1.3 christos return;
452 1.1.1.3 christos }
453 1.1.1.3 christos
454 1.1.1.3 christos
455 1.1.1.3 christos /*******************************************************************************
456 1.1.1.3 christos *
457 1.1 jruoho * FUNCTION: AcpiDmMethodFlags
458 1.1 jruoho *
459 1.1 jruoho * PARAMETERS: Op - Method Object to be examined
460 1.1 jruoho *
461 1.1 jruoho * RETURN: None
462 1.1 jruoho *
463 1.1 jruoho * DESCRIPTION: Decode control method flags
464 1.1 jruoho *
465 1.1 jruoho ******************************************************************************/
466 1.1 jruoho
467 1.1 jruoho void
468 1.1 jruoho AcpiDmMethodFlags (
469 1.1 jruoho ACPI_PARSE_OBJECT *Op)
470 1.1 jruoho {
471 1.1 jruoho UINT32 Flags;
472 1.1 jruoho UINT32 Args;
473 1.1 jruoho
474 1.1 jruoho
475 1.1 jruoho /* The next Op contains the flags */
476 1.1 jruoho
477 1.1 jruoho Op = AcpiPsGetDepthNext (NULL, Op);
478 1.1 jruoho Flags = (UINT8) Op->Common.Value.Integer;
479 1.1 jruoho Args = Flags & 0x07;
480 1.1 jruoho
481 1.1 jruoho /* Mark the Op as completed */
482 1.1 jruoho
483 1.1 jruoho Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
484 1.1 jruoho
485 1.1 jruoho /* 1) Method argument count */
486 1.1 jruoho
487 1.1 jruoho AcpiOsPrintf (", %u, ", Args);
488 1.1 jruoho
489 1.1 jruoho /* 2) Serialize rule */
490 1.1 jruoho
491 1.1 jruoho if (!(Flags & 0x08))
492 1.1 jruoho {
493 1.1 jruoho AcpiOsPrintf ("Not");
494 1.1 jruoho }
495 1.1 jruoho
496 1.1 jruoho AcpiOsPrintf ("Serialized");
497 1.1 jruoho
498 1.1 jruoho /* 3) SyncLevel */
499 1.1 jruoho
500 1.1 jruoho if (Flags & 0xF0)
501 1.1 jruoho {
502 1.1 jruoho AcpiOsPrintf (", %u", Flags >> 4);
503 1.1 jruoho }
504 1.1 jruoho }
505 1.1 jruoho
506 1.1 jruoho
507 1.1 jruoho /*******************************************************************************
508 1.1 jruoho *
509 1.1 jruoho * FUNCTION: AcpiDmFieldFlags
510 1.1 jruoho *
511 1.1 jruoho * PARAMETERS: Op - Field Object to be examined
512 1.1 jruoho *
513 1.1 jruoho * RETURN: None
514 1.1 jruoho *
515 1.1 jruoho * DESCRIPTION: Decode Field definition flags
516 1.1 jruoho *
517 1.1 jruoho ******************************************************************************/
518 1.1 jruoho
519 1.1 jruoho void
520 1.1 jruoho AcpiDmFieldFlags (
521 1.1 jruoho ACPI_PARSE_OBJECT *Op)
522 1.1 jruoho {
523 1.1 jruoho UINT32 Flags;
524 1.1 jruoho
525 1.1 jruoho
526 1.1 jruoho Op = Op->Common.Next;
527 1.1 jruoho Flags = (UINT8) Op->Common.Value.Integer;
528 1.1 jruoho
529 1.1 jruoho /* Mark the Op as completed */
530 1.1 jruoho
531 1.1 jruoho Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
532 1.1 jruoho
533 1.1 jruoho AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x07]);
534 1.1 jruoho AcpiOsPrintf ("%s, ", AcpiGbl_LockRule [(Flags & 0x10) >> 4]);
535 1.1 jruoho AcpiOsPrintf ("%s)", AcpiGbl_UpdateRules [(Flags & 0x60) >> 5]);
536 1.1 jruoho }
537 1.1 jruoho
538 1.1 jruoho
539 1.1 jruoho /*******************************************************************************
540 1.1 jruoho *
541 1.1 jruoho * FUNCTION: AcpiDmAddressSpace
542 1.1 jruoho *
543 1.1 jruoho * PARAMETERS: SpaceId - ID to be translated
544 1.1 jruoho *
545 1.1 jruoho * RETURN: None
546 1.1 jruoho *
547 1.1 jruoho * DESCRIPTION: Decode a SpaceId to an AddressSpaceKeyword
548 1.1 jruoho *
549 1.1 jruoho ******************************************************************************/
550 1.1 jruoho
551 1.1 jruoho void
552 1.1 jruoho AcpiDmAddressSpace (
553 1.1 jruoho UINT8 SpaceId)
554 1.1 jruoho {
555 1.1 jruoho
556 1.1 jruoho if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
557 1.1 jruoho {
558 1.1 jruoho if (SpaceId == 0x7F)
559 1.1 jruoho {
560 1.1 jruoho AcpiOsPrintf ("FFixedHW, ");
561 1.1 jruoho }
562 1.1 jruoho else
563 1.1 jruoho {
564 1.1 jruoho AcpiOsPrintf ("0x%.2X, ", SpaceId);
565 1.1 jruoho }
566 1.1 jruoho }
567 1.1 jruoho else
568 1.1 jruoho {
569 1.1 jruoho AcpiOsPrintf ("%s, ", AcpiGbl_RegionTypes [SpaceId]);
570 1.1 jruoho }
571 1.1 jruoho }
572 1.1 jruoho
573 1.1 jruoho
574 1.1 jruoho /*******************************************************************************
575 1.1 jruoho *
576 1.1 jruoho * FUNCTION: AcpiDmRegionFlags
577 1.1 jruoho *
578 1.1 jruoho * PARAMETERS: Op - Object to be examined
579 1.1 jruoho *
580 1.1 jruoho * RETURN: None
581 1.1 jruoho *
582 1.1 jruoho * DESCRIPTION: Decode OperationRegion flags
583 1.1 jruoho *
584 1.1 jruoho ******************************************************************************/
585 1.1 jruoho
586 1.1 jruoho void
587 1.1 jruoho AcpiDmRegionFlags (
588 1.1 jruoho ACPI_PARSE_OBJECT *Op)
589 1.1 jruoho {
590 1.1 jruoho
591 1.1 jruoho /* The next Op contains the SpaceId */
592 1.1 jruoho
593 1.1 jruoho Op = AcpiPsGetDepthNext (NULL, Op);
594 1.1 jruoho
595 1.1 jruoho /* Mark the Op as completed */
596 1.1 jruoho
597 1.1 jruoho Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
598 1.1 jruoho
599 1.1 jruoho AcpiOsPrintf (", ");
600 1.1 jruoho AcpiDmAddressSpace ((UINT8) Op->Common.Value.Integer);
601 1.1 jruoho }
602 1.1 jruoho
603 1.1 jruoho
604 1.1 jruoho /*******************************************************************************
605 1.1 jruoho *
606 1.1 jruoho * FUNCTION: AcpiDmMatchOp
607 1.1 jruoho *
608 1.1 jruoho * PARAMETERS: Op - Match Object to be examined
609 1.1 jruoho *
610 1.1 jruoho * RETURN: None
611 1.1 jruoho *
612 1.1 jruoho * DESCRIPTION: Decode Match opcode operands
613 1.1 jruoho *
614 1.1 jruoho ******************************************************************************/
615 1.1 jruoho
616 1.1 jruoho void
617 1.1 jruoho AcpiDmMatchOp (
618 1.1 jruoho ACPI_PARSE_OBJECT *Op)
619 1.1 jruoho {
620 1.1 jruoho ACPI_PARSE_OBJECT *NextOp;
621 1.1 jruoho
622 1.1 jruoho
623 1.1 jruoho NextOp = AcpiPsGetDepthNext (NULL, Op);
624 1.1 jruoho NextOp = NextOp->Common.Next;
625 1.1 jruoho
626 1.1 jruoho if (!NextOp)
627 1.1 jruoho {
628 1.1 jruoho /* Handle partial tree during single-step */
629 1.1 jruoho
630 1.1 jruoho return;
631 1.1 jruoho }
632 1.1 jruoho
633 1.1 jruoho /* Mark the two nodes that contain the encoding for the match keywords */
634 1.1 jruoho
635 1.1 jruoho NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
636 1.1 jruoho
637 1.1 jruoho NextOp = NextOp->Common.Next;
638 1.1 jruoho NextOp = NextOp->Common.Next;
639 1.1 jruoho NextOp->Common.DisasmOpcode = ACPI_DASM_MATCHOP;
640 1.1 jruoho }
641 1.1 jruoho
642 1.1 jruoho
643 1.1 jruoho /*******************************************************************************
644 1.1 jruoho *
645 1.1 jruoho * FUNCTION: AcpiDmMatchKeyword
646 1.1 jruoho *
647 1.1 jruoho * PARAMETERS: Op - Match Object to be examined
648 1.1 jruoho *
649 1.1 jruoho * RETURN: None
650 1.1 jruoho *
651 1.1 jruoho * DESCRIPTION: Decode Match opcode operands
652 1.1 jruoho *
653 1.1 jruoho ******************************************************************************/
654 1.1 jruoho
655 1.1 jruoho static void
656 1.1 jruoho AcpiDmMatchKeyword (
657 1.1 jruoho ACPI_PARSE_OBJECT *Op)
658 1.1 jruoho {
659 1.1 jruoho
660 1.1 jruoho if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE)
661 1.1 jruoho {
662 1.1 jruoho AcpiOsPrintf ("/* Unknown Match Keyword encoding */");
663 1.1 jruoho }
664 1.1 jruoho else
665 1.1 jruoho {
666 1.1.1.4.2.4 skrll AcpiOsPrintf ("%s",
667 1.1.1.4.2.4 skrll AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]);
668 1.1 jruoho }
669 1.1 jruoho }
670 1.1 jruoho
671 1.1 jruoho
672 1.1 jruoho /*******************************************************************************
673 1.1 jruoho *
674 1.1 jruoho * FUNCTION: AcpiDmDisassembleOneOp
675 1.1 jruoho *
676 1.1 jruoho * PARAMETERS: WalkState - Current walk info
677 1.1 jruoho * Info - Parse tree walk info
678 1.1 jruoho * Op - Op that is to be printed
679 1.1 jruoho *
680 1.1 jruoho * RETURN: None
681 1.1 jruoho *
682 1.1 jruoho * DESCRIPTION: Disassemble a single AML opcode
683 1.1 jruoho *
684 1.1 jruoho ******************************************************************************/
685 1.1 jruoho
686 1.1 jruoho void
687 1.1 jruoho AcpiDmDisassembleOneOp (
688 1.1 jruoho ACPI_WALK_STATE *WalkState,
689 1.1 jruoho ACPI_OP_WALK_INFO *Info,
690 1.1 jruoho ACPI_PARSE_OBJECT *Op)
691 1.1 jruoho {
692 1.1 jruoho const ACPI_OPCODE_INFO *OpInfo = NULL;
693 1.1 jruoho UINT32 Offset;
694 1.1 jruoho UINT32 Length;
695 1.1 jruoho ACPI_PARSE_OBJECT *Child;
696 1.1 jruoho ACPI_STATUS Status;
697 1.1.1.3 christos UINT8 *Aml;
698 1.1.1.4 christos const AH_DEVICE_ID *IdInfo;
699 1.1 jruoho
700 1.1 jruoho
701 1.1 jruoho if (!Op)
702 1.1 jruoho {
703 1.1 jruoho AcpiOsPrintf ("<NULL OP PTR>");
704 1.1 jruoho return;
705 1.1 jruoho }
706 1.1 jruoho
707 1.1.1.4.2.3 skrll if (Op->Common.DisasmFlags & ACPI_PARSEOP_ELSEIF)
708 1.1.1.4.2.3 skrll {
709 1.1.1.4.2.3 skrll return; /* ElseIf macro was already emitted */
710 1.1.1.4.2.3 skrll }
711 1.1.1.4.2.3 skrll
712 1.1 jruoho switch (Op->Common.DisasmOpcode)
713 1.1 jruoho {
714 1.1 jruoho case ACPI_DASM_MATCHOP:
715 1.1 jruoho
716 1.1 jruoho AcpiDmMatchKeyword (Op);
717 1.1 jruoho return;
718 1.1 jruoho
719 1.1 jruoho case ACPI_DASM_LNOT_SUFFIX:
720 1.1.1.3 christos
721 1.1.1.4.2.1 skrll if (!AcpiGbl_CstyleDisassembly)
722 1.1 jruoho {
723 1.1.1.4.2.1 skrll switch (Op->Common.AmlOpcode)
724 1.1.1.4.2.1 skrll {
725 1.1.1.4.2.8 skrll case AML_LOGICAL_EQUAL_OP:
726 1.1.1.4.2.1 skrll AcpiOsPrintf ("LNotEqual");
727 1.1.1.4.2.1 skrll break;
728 1.1.1.3 christos
729 1.1.1.4.2.8 skrll case AML_LOGICAL_GREATER_OP:
730 1.1.1.4.2.1 skrll AcpiOsPrintf ("LLessEqual");
731 1.1.1.4.2.1 skrll break;
732 1.1 jruoho
733 1.1.1.4.2.8 skrll case AML_LOGICAL_LESS_OP:
734 1.1.1.4.2.1 skrll AcpiOsPrintf ("LGreaterEqual");
735 1.1.1.4.2.1 skrll break;
736 1.1.1.3 christos
737 1.1.1.4.2.1 skrll default:
738 1.1.1.4.2.1 skrll break;
739 1.1.1.4.2.1 skrll }
740 1.1 jruoho }
741 1.1.1.4.2.1 skrll
742 1.1 jruoho Op->Common.DisasmOpcode = 0;
743 1.1 jruoho Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
744 1.1 jruoho return;
745 1.1 jruoho
746 1.1 jruoho default:
747 1.1 jruoho break;
748 1.1 jruoho }
749 1.1 jruoho
750 1.1 jruoho OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
751 1.1 jruoho
752 1.1 jruoho /* The op and arguments */
753 1.1 jruoho
754 1.1 jruoho switch (Op->Common.AmlOpcode)
755 1.1 jruoho {
756 1.1.1.4.2.8 skrll case AML_LOGICAL_NOT_OP:
757 1.1 jruoho
758 1.1 jruoho Child = Op->Common.Value.Arg;
759 1.1.1.4.2.8 skrll if ((Child->Common.AmlOpcode == AML_LOGICAL_EQUAL_OP) ||
760 1.1.1.4.2.8 skrll (Child->Common.AmlOpcode == AML_LOGICAL_GREATER_OP) ||
761 1.1.1.4.2.8 skrll (Child->Common.AmlOpcode == AML_LOGICAL_LESS_OP))
762 1.1 jruoho {
763 1.1 jruoho Child->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX;
764 1.1 jruoho Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX;
765 1.1 jruoho }
766 1.1 jruoho else
767 1.1 jruoho {
768 1.1 jruoho AcpiOsPrintf ("%s", OpInfo->Name);
769 1.1 jruoho }
770 1.1 jruoho break;
771 1.1 jruoho
772 1.1 jruoho case AML_BYTE_OP:
773 1.1 jruoho
774 1.1 jruoho AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer);
775 1.1 jruoho break;
776 1.1 jruoho
777 1.1 jruoho case AML_WORD_OP:
778 1.1 jruoho
779 1.1 jruoho if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
780 1.1 jruoho {
781 1.1.1.4 christos AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer);
782 1.1 jruoho }
783 1.1 jruoho else
784 1.1 jruoho {
785 1.1 jruoho AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer);
786 1.1 jruoho }
787 1.1 jruoho break;
788 1.1 jruoho
789 1.1 jruoho case AML_DWORD_OP:
790 1.1 jruoho
791 1.1 jruoho if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
792 1.1 jruoho {
793 1.1.1.4 christos AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer);
794 1.1 jruoho }
795 1.1 jruoho else
796 1.1 jruoho {
797 1.1 jruoho AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer);
798 1.1 jruoho }
799 1.1 jruoho break;
800 1.1 jruoho
801 1.1 jruoho case AML_QWORD_OP:
802 1.1 jruoho
803 1.1 jruoho AcpiOsPrintf ("0x%8.8X%8.8X",
804 1.1 jruoho ACPI_FORMAT_UINT64 (Op->Common.Value.Integer));
805 1.1 jruoho break;
806 1.1 jruoho
807 1.1 jruoho case AML_STRING_OP:
808 1.1 jruoho
809 1.1.1.3 christos AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT16_MAX);
810 1.1.1.4 christos
811 1.1.1.4 christos /* For _HID/_CID strings, attempt to output a descriptive comment */
812 1.1.1.4 christos
813 1.1.1.4 christos if (Op->Common.DisasmOpcode == ACPI_DASM_HID_STRING)
814 1.1.1.4 christos {
815 1.1.1.4 christos /* If we know about the ID, emit the description */
816 1.1.1.4 christos
817 1.1.1.4 christos IdInfo = AcpiAhMatchHardwareId (Op->Common.Value.String);
818 1.1.1.4 christos if (IdInfo)
819 1.1.1.4 christos {
820 1.1.1.4 christos AcpiOsPrintf (" /* %s */", IdInfo->Description);
821 1.1.1.4 christos }
822 1.1.1.4 christos }
823 1.1 jruoho break;
824 1.1 jruoho
825 1.1 jruoho case AML_BUFFER_OP:
826 1.1 jruoho /*
827 1.1.1.3 christos * Determine the type of buffer. We can have one of the following:
828 1.1 jruoho *
829 1.1 jruoho * 1) ResourceTemplate containing Resource Descriptors.
830 1.1 jruoho * 2) Unicode String buffer
831 1.1 jruoho * 3) ASCII String buffer
832 1.1 jruoho * 4) Raw data buffer (if none of the above)
833 1.1 jruoho *
834 1.1 jruoho * Since there are no special AML opcodes to differentiate these
835 1.1 jruoho * types of buffers, we have to closely look at the data in the
836 1.1 jruoho * buffer to determine the type.
837 1.1 jruoho */
838 1.1.1.3 christos if (!AcpiGbl_NoResourceDisassembly)
839 1.1 jruoho {
840 1.1.1.3 christos Status = AcpiDmIsResourceTemplate (WalkState, Op);
841 1.1.1.3 christos if (ACPI_SUCCESS (Status))
842 1.1.1.3 christos {
843 1.1.1.3 christos Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
844 1.1.1.3 christos AcpiOsPrintf ("ResourceTemplate");
845 1.1.1.3 christos break;
846 1.1.1.3 christos }
847 1.1.1.3 christos else if (Status == AE_AML_NO_RESOURCE_END_TAG)
848 1.1.1.3 christos {
849 1.1.1.4.2.3 skrll AcpiOsPrintf (
850 1.1.1.4.2.3 skrll "/**** Is ResourceTemplate, "
851 1.1.1.4.2.3 skrll "but EndTag not at buffer end ****/ ");
852 1.1.1.3 christos }
853 1.1 jruoho }
854 1.1 jruoho
855 1.1.1.4 christos if (AcpiDmIsUuidBuffer (Op))
856 1.1.1.4 christos {
857 1.1.1.4 christos Op->Common.DisasmOpcode = ACPI_DASM_UUID;
858 1.1.1.4 christos AcpiOsPrintf ("ToUUID (");
859 1.1.1.4 christos }
860 1.1.1.4 christos else if (AcpiDmIsUnicodeBuffer (Op))
861 1.1 jruoho {
862 1.1 jruoho Op->Common.DisasmOpcode = ACPI_DASM_UNICODE;
863 1.1 jruoho AcpiOsPrintf ("Unicode (");
864 1.1 jruoho }
865 1.1 jruoho else if (AcpiDmIsStringBuffer (Op))
866 1.1 jruoho {
867 1.1 jruoho Op->Common.DisasmOpcode = ACPI_DASM_STRING;
868 1.1 jruoho AcpiOsPrintf ("Buffer");
869 1.1 jruoho }
870 1.1.1.3 christos else if (AcpiDmIsPldBuffer (Op))
871 1.1.1.3 christos {
872 1.1.1.3 christos Op->Common.DisasmOpcode = ACPI_DASM_PLD_METHOD;
873 1.1.1.4.2.1 skrll AcpiOsPrintf ("ToPLD (");
874 1.1.1.3 christos }
875 1.1 jruoho else
876 1.1 jruoho {
877 1.1 jruoho Op->Common.DisasmOpcode = ACPI_DASM_BUFFER;
878 1.1 jruoho AcpiOsPrintf ("Buffer");
879 1.1 jruoho }
880 1.1 jruoho break;
881 1.1 jruoho
882 1.1 jruoho case AML_INT_NAMEPATH_OP:
883 1.1 jruoho
884 1.1 jruoho AcpiDmNamestring (Op->Common.Value.Name);
885 1.1 jruoho break;
886 1.1 jruoho
887 1.1 jruoho case AML_INT_NAMEDFIELD_OP:
888 1.1 jruoho
889 1.1 jruoho Length = AcpiDmDumpName (Op->Named.Name);
890 1.1.1.4.2.8 skrll
891 1.1.1.4.2.8 skrll AcpiOsPrintf (",");
892 1.1.1.4.2.8 skrll ASL_CV_PRINT_ONE_COMMENT (Op, AML_NAMECOMMENT, NULL, 0);
893 1.1.1.4.2.8 skrll AcpiOsPrintf ("%*.s %u", (unsigned) (5 - Length), " ",
894 1.1 jruoho (UINT32) Op->Common.Value.Integer);
895 1.1.1.4.2.8 skrll
896 1.1 jruoho AcpiDmCommaIfFieldMember (Op);
897 1.1 jruoho
898 1.1 jruoho Info->BitOffset += (UINT32) Op->Common.Value.Integer;
899 1.1 jruoho break;
900 1.1 jruoho
901 1.1 jruoho case AML_INT_RESERVEDFIELD_OP:
902 1.1 jruoho
903 1.1 jruoho /* Offset() -- Must account for previous offsets */
904 1.1 jruoho
905 1.1 jruoho Offset = (UINT32) Op->Common.Value.Integer;
906 1.1 jruoho Info->BitOffset += Offset;
907 1.1 jruoho
908 1.1 jruoho if (Info->BitOffset % 8 == 0)
909 1.1 jruoho {
910 1.1.1.3 christos AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
911 1.1 jruoho }
912 1.1 jruoho else
913 1.1 jruoho {
914 1.1 jruoho AcpiOsPrintf (" , %u", Offset);
915 1.1 jruoho }
916 1.1 jruoho
917 1.1 jruoho AcpiDmCommaIfFieldMember (Op);
918 1.1 jruoho break;
919 1.1 jruoho
920 1.1 jruoho case AML_INT_ACCESSFIELD_OP:
921 1.1.1.3 christos case AML_INT_EXTACCESSFIELD_OP:
922 1.1.1.3 christos
923 1.1.1.3 christos AcpiOsPrintf ("AccessAs (%s, ",
924 1.1.1.3 christos AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer & 0x7)]);
925 1.1.1.3 christos
926 1.1.1.3 christos AcpiDmDecodeAttribute ((UINT8) (Op->Common.Value.Integer >> 8));
927 1.1 jruoho
928 1.1.1.3 christos if (Op->Common.AmlOpcode == AML_INT_EXTACCESSFIELD_OP)
929 1.1.1.3 christos {
930 1.1.1.4.2.3 skrll AcpiOsPrintf (" (0x%2.2X)", (unsigned)
931 1.1.1.4.2.3 skrll ((Op->Common.Value.Integer >> 16) & 0xFF));
932 1.1.1.3 christos }
933 1.1 jruoho
934 1.1 jruoho AcpiOsPrintf (")");
935 1.1 jruoho AcpiDmCommaIfFieldMember (Op);
936 1.1.1.4.2.8 skrll ASL_CV_PRINT_ONE_COMMENT (Op, AML_COMMENT_END_NODE, NULL, 0);
937 1.1 jruoho break;
938 1.1 jruoho
939 1.1.1.3 christos case AML_INT_CONNECTION_OP:
940 1.1.1.3 christos /*
941 1.1.1.3 christos * Two types of Connection() - one with a buffer object, the
942 1.1.1.3 christos * other with a namestring that points to a buffer object.
943 1.1.1.3 christos */
944 1.1.1.3 christos AcpiOsPrintf ("Connection (");
945 1.1.1.3 christos Child = Op->Common.Value.Arg;
946 1.1.1.3 christos
947 1.1.1.3 christos if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP)
948 1.1.1.3 christos {
949 1.1.1.3 christos AcpiOsPrintf ("\n");
950 1.1.1.3 christos
951 1.1.1.3 christos Aml = Child->Named.Data;
952 1.1.1.3 christos Length = (UINT32) Child->Common.Value.Integer;
953 1.1.1.3 christos
954 1.1.1.3 christos Info->Level += 1;
955 1.1.1.4 christos Info->MappingOp = Op;
956 1.1.1.3 christos Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
957 1.1.1.4 christos
958 1.1.1.3 christos AcpiDmResourceTemplate (Info, Op->Common.Parent, Aml, Length);
959 1.1.1.3 christos
960 1.1.1.3 christos Info->Level -= 1;
961 1.1.1.3 christos AcpiDmIndent (Info->Level);
962 1.1.1.3 christos }
963 1.1.1.3 christos else
964 1.1.1.3 christos {
965 1.1.1.3 christos AcpiDmNamestring (Child->Common.Value.Name);
966 1.1.1.3 christos }
967 1.1.1.3 christos
968 1.1.1.3 christos AcpiOsPrintf (")");
969 1.1.1.3 christos AcpiDmCommaIfFieldMember (Op);
970 1.1.1.4.2.8 skrll ASL_CV_PRINT_ONE_COMMENT (Op, AML_COMMENT_END_NODE, NULL, 0);
971 1.1.1.4.2.8 skrll ASL_CV_PRINT_ONE_COMMENT (Op, AMLCOMMENT_INLINE, NULL, 0);
972 1.1.1.3 christos AcpiOsPrintf ("\n");
973 1.1.1.3 christos
974 1.1.1.3 christos Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; /* for now, ignore in AcpiDmAscendingOp */
975 1.1.1.3 christos Child->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
976 1.1.1.3 christos break;
977 1.1 jruoho
978 1.1 jruoho case AML_INT_BYTELIST_OP:
979 1.1 jruoho
980 1.1 jruoho AcpiDmByteList (Info, Op);
981 1.1 jruoho break;
982 1.1 jruoho
983 1.1 jruoho case AML_INT_METHODCALL_OP:
984 1.1 jruoho
985 1.1 jruoho Op = AcpiPsGetDepthNext (NULL, Op);
986 1.1 jruoho Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
987 1.1 jruoho
988 1.1 jruoho AcpiDmNamestring (Op->Common.Value.Name);
989 1.1 jruoho break;
990 1.1 jruoho
991 1.1.1.4.2.7 skrll case AML_WHILE_OP:
992 1.1.1.4.2.7 skrll
993 1.1.1.4.2.8 skrll if (Op->Common.DisasmOpcode == ACPI_DASM_SWITCH)
994 1.1.1.4.2.7 skrll {
995 1.1.1.4.2.7 skrll AcpiOsPrintf ("%s", "Switch");
996 1.1.1.4.2.7 skrll break;
997 1.1.1.4.2.7 skrll }
998 1.1.1.4.2.7 skrll
999 1.1.1.4.2.7 skrll AcpiOsPrintf ("%s", OpInfo->Name);
1000 1.1.1.4.2.7 skrll break;
1001 1.1.1.4.2.7 skrll
1002 1.1.1.4.2.7 skrll case AML_IF_OP:
1003 1.1.1.4.2.7 skrll
1004 1.1.1.4.2.7 skrll if (Op->Common.DisasmOpcode == ACPI_DASM_CASE)
1005 1.1.1.4.2.7 skrll {
1006 1.1.1.4.2.7 skrll AcpiOsPrintf ("%s", "Case");
1007 1.1.1.4.2.7 skrll break;
1008 1.1.1.4.2.7 skrll }
1009 1.1.1.4.2.7 skrll
1010 1.1.1.4.2.7 skrll AcpiOsPrintf ("%s", OpInfo->Name);
1011 1.1.1.4.2.7 skrll break;
1012 1.1.1.4.2.7 skrll
1013 1.1.1.4.2.3 skrll case AML_ELSE_OP:
1014 1.1.1.4.2.3 skrll
1015 1.1.1.4.2.3 skrll AcpiDmConvertToElseIf (Op);
1016 1.1.1.4.2.3 skrll break;
1017 1.1.1.4.2.3 skrll
1018 1.1.1.4.2.4 skrll case AML_EXTERNAL_OP:
1019 1.1.1.4.2.4 skrll
1020 1.1.1.4.2.5 skrll if (AcpiGbl_DmEmitExternalOpcodes)
1021 1.1.1.4.2.5 skrll {
1022 1.1.1.4.2.8 skrll AcpiDmEmitExternal (AcpiPsGetArg(Op, 0),
1023 1.1.1.4.2.8 skrll AcpiPsGetArg(Op, 1));
1024 1.1.1.4.2.5 skrll break;
1025 1.1.1.4.2.5 skrll }
1026 1.1.1.4.2.4 skrll
1027 1.1.1.4.2.8 skrll break;
1028 1.1.1.4.2.8 skrll
1029 1.1 jruoho default:
1030 1.1 jruoho
1031 1.1 jruoho /* Just get the opcode name and print it */
1032 1.1 jruoho
1033 1.1 jruoho AcpiOsPrintf ("%s", OpInfo->Name);
1034 1.1 jruoho
1035 1.1 jruoho
1036 1.1 jruoho #ifdef ACPI_DEBUGGER
1037 1.1 jruoho
1038 1.1 jruoho if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) &&
1039 1.1 jruoho (WalkState) &&
1040 1.1 jruoho (WalkState->Results) &&
1041 1.1 jruoho (WalkState->ResultCount))
1042 1.1 jruoho {
1043 1.1.1.4.2.2 skrll AcpiDbDecodeInternalObject (
1044 1.1 jruoho WalkState->Results->Results.ObjDesc [
1045 1.1 jruoho (WalkState->ResultCount - 1) %
1046 1.1 jruoho ACPI_RESULTS_FRAME_OBJ_NUM]);
1047 1.1 jruoho }
1048 1.1 jruoho #endif
1049 1.1 jruoho
1050 1.1 jruoho break;
1051 1.1 jruoho }
1052 1.1 jruoho }
1053 1.1 jruoho
1054 1.1.1.4.2.3 skrll
1055 1.1.1.4.2.3 skrll /*******************************************************************************
1056 1.1.1.4.2.3 skrll *
1057 1.1.1.4.2.3 skrll * FUNCTION: AcpiDmConvertToElseIf
1058 1.1.1.4.2.3 skrll *
1059 1.1.1.4.2.3 skrll * PARAMETERS: OriginalElseOp - ELSE Object to be examined
1060 1.1.1.4.2.3 skrll *
1061 1.1.1.4.2.3 skrll * RETURN: None. Emits either an "Else" or an "ElseIf" ASL operator.
1062 1.1.1.4.2.3 skrll *
1063 1.1.1.4.2.3 skrll * DESCRIPTION: Detect and convert an If..Else..If sequence to If..ElseIf
1064 1.1.1.4.2.3 skrll *
1065 1.1.1.4.2.3 skrll * EXAMPLE:
1066 1.1.1.4.2.3 skrll *
1067 1.1.1.4.2.3 skrll * This If..Else..If nested sequence:
1068 1.1.1.4.2.3 skrll *
1069 1.1.1.4.2.3 skrll * If (Arg0 == 1)
1070 1.1.1.4.2.3 skrll * {
1071 1.1.1.4.2.3 skrll * Local0 = 4
1072 1.1.1.4.2.3 skrll * }
1073 1.1.1.4.2.3 skrll * Else
1074 1.1.1.4.2.3 skrll * {
1075 1.1.1.4.2.3 skrll * If (Arg0 == 2)
1076 1.1.1.4.2.3 skrll * {
1077 1.1.1.4.2.3 skrll * Local0 = 5
1078 1.1.1.4.2.3 skrll * }
1079 1.1.1.4.2.3 skrll * }
1080 1.1.1.4.2.3 skrll *
1081 1.1.1.4.2.3 skrll * Is converted to this simpler If..ElseIf sequence:
1082 1.1.1.4.2.3 skrll *
1083 1.1.1.4.2.3 skrll * If (Arg0 == 1)
1084 1.1.1.4.2.3 skrll * {
1085 1.1.1.4.2.3 skrll * Local0 = 4
1086 1.1.1.4.2.3 skrll * }
1087 1.1.1.4.2.3 skrll * ElseIf (Arg0 == 2)
1088 1.1.1.4.2.3 skrll * {
1089 1.1.1.4.2.3 skrll * Local0 = 5
1090 1.1.1.4.2.3 skrll * }
1091 1.1.1.4.2.3 skrll *
1092 1.1.1.4.2.3 skrll * NOTE: There is no actual ElseIf AML opcode. ElseIf is essentially an ASL
1093 1.1.1.4.2.3 skrll * macro that emits an Else opcode followed by an If opcode. This function
1094 1.1.1.4.2.3 skrll * reverses these AML sequences back to an ElseIf macro where possible. This
1095 1.1.1.4.2.3 skrll * can make the disassembled ASL code simpler and more like the original code.
1096 1.1.1.4.2.3 skrll *
1097 1.1.1.4.2.3 skrll ******************************************************************************/
1098 1.1.1.4.2.3 skrll
1099 1.1.1.4.2.3 skrll static void
1100 1.1.1.4.2.3 skrll AcpiDmConvertToElseIf (
1101 1.1.1.4.2.3 skrll ACPI_PARSE_OBJECT *OriginalElseOp)
1102 1.1.1.4.2.3 skrll {
1103 1.1.1.4.2.3 skrll ACPI_PARSE_OBJECT *IfOp;
1104 1.1.1.4.2.3 skrll ACPI_PARSE_OBJECT *ElseOp;
1105 1.1.1.4.2.3 skrll
1106 1.1.1.4.2.3 skrll
1107 1.1.1.4.2.4 skrll /*
1108 1.1.1.4.2.4 skrll * To be able to perform the conversion, two conditions must be satisfied:
1109 1.1.1.4.2.4 skrll * 1) The first child of the Else must be an If statement.
1110 1.1.1.4.2.4 skrll * 2) The If block can only be followed by an Else block and these must
1111 1.1.1.4.2.4 skrll * be the only blocks under the original Else.
1112 1.1.1.4.2.4 skrll */
1113 1.1.1.4.2.3 skrll IfOp = OriginalElseOp->Common.Value.Arg;
1114 1.1.1.4.2.6 skrll
1115 1.1.1.4.2.4 skrll if (!IfOp ||
1116 1.1.1.4.2.4 skrll (IfOp->Common.AmlOpcode != AML_IF_OP) ||
1117 1.1.1.4.2.4 skrll (IfOp->Asl.Next && (IfOp->Asl.Next->Common.AmlOpcode != AML_ELSE_OP)))
1118 1.1.1.4.2.3 skrll {
1119 1.1.1.4.2.6 skrll /* Not a proper Else..If sequence, cannot convert to ElseIf */
1120 1.1.1.4.2.6 skrll
1121 1.1.1.4.2.7 skrll if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT)
1122 1.1.1.4.2.7 skrll {
1123 1.1.1.4.2.7 skrll AcpiOsPrintf ("%s", "Default");
1124 1.1.1.4.2.7 skrll return;
1125 1.1.1.4.2.7 skrll }
1126 1.1.1.4.2.7 skrll
1127 1.1.1.4.2.6 skrll AcpiOsPrintf ("%s", "Else");
1128 1.1.1.4.2.6 skrll return;
1129 1.1.1.4.2.6 skrll }
1130 1.1.1.4.2.6 skrll
1131 1.1.1.4.2.6 skrll /* Cannot have anything following the If...Else block */
1132 1.1.1.4.2.3 skrll
1133 1.1.1.4.2.6 skrll ElseOp = IfOp->Common.Next;
1134 1.1.1.4.2.6 skrll if (ElseOp && ElseOp->Common.Next)
1135 1.1.1.4.2.6 skrll {
1136 1.1.1.4.2.7 skrll if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT)
1137 1.1.1.4.2.7 skrll {
1138 1.1.1.4.2.7 skrll AcpiOsPrintf ("%s", "Default");
1139 1.1.1.4.2.7 skrll return;
1140 1.1.1.4.2.7 skrll }
1141 1.1.1.4.2.7 skrll
1142 1.1.1.4.2.3 skrll AcpiOsPrintf ("%s", "Else");
1143 1.1.1.4.2.3 skrll return;
1144 1.1.1.4.2.3 skrll }
1145 1.1.1.4.2.3 skrll
1146 1.1.1.4.2.7 skrll if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_DEFAULT)
1147 1.1.1.4.2.7 skrll {
1148 1.1.1.4.2.7 skrll /*
1149 1.1.1.4.2.7 skrll * There is an ElseIf but in this case the Else is actually
1150 1.1.1.4.2.7 skrll * a Default block for a Switch/Case statement. No conversion.
1151 1.1.1.4.2.7 skrll */
1152 1.1.1.4.2.7 skrll AcpiOsPrintf ("%s", "Default");
1153 1.1.1.4.2.7 skrll return;
1154 1.1.1.4.2.7 skrll }
1155 1.1.1.4.2.7 skrll
1156 1.1.1.4.2.7 skrll if (OriginalElseOp->Common.DisasmOpcode == ACPI_DASM_CASE)
1157 1.1.1.4.2.7 skrll {
1158 1.1.1.4.2.7 skrll /*
1159 1.1.1.4.2.7 skrll * This ElseIf is actually a Case block for a Switch/Case
1160 1.1.1.4.2.7 skrll * statement. Print Case but do not return so that we can
1161 1.1.1.4.2.7 skrll * promote the subtree and keep the indentation level.
1162 1.1.1.4.2.7 skrll */
1163 1.1.1.4.2.7 skrll AcpiOsPrintf ("%s", "Case");
1164 1.1.1.4.2.7 skrll }
1165 1.1.1.4.2.7 skrll else
1166 1.1.1.4.2.7 skrll {
1167 1.1.1.4.2.7 skrll /* Emit ElseIf, mark the IF as now an ELSEIF */
1168 1.1.1.4.2.7 skrll
1169 1.1.1.4.2.7 skrll AcpiOsPrintf ("%s", "ElseIf");
1170 1.1.1.4.2.7 skrll }
1171 1.1.1.4.2.3 skrll
1172 1.1.1.4.2.3 skrll IfOp->Common.DisasmFlags |= ACPI_PARSEOP_ELSEIF;
1173 1.1.1.4.2.3 skrll
1174 1.1.1.4.2.3 skrll /* The IF parent will now be the same as the original ELSE parent */
1175 1.1.1.4.2.3 skrll
1176 1.1.1.4.2.3 skrll IfOp->Common.Parent = OriginalElseOp->Common.Parent;
1177 1.1.1.4.2.3 skrll
1178 1.1.1.4.2.3 skrll /*
1179 1.1.1.4.2.3 skrll * Update the NEXT pointers to restructure the parse tree, essentially
1180 1.1.1.4.2.3 skrll * promoting an If..Else block up to the same level as the original
1181 1.1.1.4.2.3 skrll * Else.
1182 1.1.1.4.2.3 skrll *
1183 1.1.1.4.2.3 skrll * Check if the IF has a corresponding ELSE peer
1184 1.1.1.4.2.3 skrll */
1185 1.1.1.4.2.3 skrll ElseOp = IfOp->Common.Next;
1186 1.1.1.4.2.3 skrll if (ElseOp &&
1187 1.1.1.4.2.3 skrll (ElseOp->Common.AmlOpcode == AML_ELSE_OP))
1188 1.1.1.4.2.3 skrll {
1189 1.1.1.4.2.3 skrll /* If an ELSE matches the IF, promote it also */
1190 1.1.1.4.2.3 skrll
1191 1.1.1.4.2.3 skrll ElseOp->Common.Parent = OriginalElseOp->Common.Parent;
1192 1.1.1.4.2.6 skrll
1193 1.1.1.4.2.6 skrll /* Promote the entire block under the ElseIf (All Next OPs) */
1194 1.1.1.4.2.6 skrll
1195 1.1.1.4.2.6 skrll AcpiDmPromoteSubtree (OriginalElseOp);
1196 1.1.1.4.2.3 skrll }
1197 1.1.1.4.2.3 skrll else
1198 1.1.1.4.2.3 skrll {
1199 1.1.1.4.2.3 skrll /* Otherwise, set the IF NEXT to the original ELSE NEXT */
1200 1.1.1.4.2.3 skrll
1201 1.1.1.4.2.3 skrll IfOp->Common.Next = OriginalElseOp->Common.Next;
1202 1.1.1.4.2.3 skrll }
1203 1.1.1.4.2.3 skrll
1204 1.1.1.4.2.3 skrll /* Detach the child IF block from the original ELSE */
1205 1.1.1.4.2.3 skrll
1206 1.1.1.4.2.3 skrll OriginalElseOp->Common.Value.Arg = NULL;
1207 1.1.1.4.2.3 skrll
1208 1.1.1.4.2.3 skrll /* Ignore the original ELSE from now on */
1209 1.1.1.4.2.3 skrll
1210 1.1.1.4.2.3 skrll OriginalElseOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
1211 1.1.1.4.2.3 skrll OriginalElseOp->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX;
1212 1.1.1.4.2.3 skrll
1213 1.1.1.4.2.3 skrll /* Insert IF (now ELSEIF) as next peer of the original ELSE */
1214 1.1.1.4.2.3 skrll
1215 1.1.1.4.2.3 skrll OriginalElseOp->Common.Next = IfOp;
1216 1.1.1.4.2.3 skrll }
1217 1.1.1.4.2.6 skrll
1218 1.1.1.4.2.6 skrll
1219 1.1.1.4.2.6 skrll /*******************************************************************************
1220 1.1.1.4.2.6 skrll *
1221 1.1.1.4.2.6 skrll * FUNCTION: AcpiDmPromoteSubtree
1222 1.1.1.4.2.6 skrll *
1223 1.1.1.4.2.6 skrll * PARAMETERS: StartOpOp - Original parent of the entire subtree
1224 1.1.1.4.2.6 skrll *
1225 1.1.1.4.2.6 skrll * RETURN: None
1226 1.1.1.4.2.6 skrll *
1227 1.1.1.4.2.6 skrll * DESCRIPTION: Promote an entire parse subtree up one level.
1228 1.1.1.4.2.6 skrll *
1229 1.1.1.4.2.6 skrll ******************************************************************************/
1230 1.1.1.4.2.6 skrll
1231 1.1.1.4.2.6 skrll static void
1232 1.1.1.4.2.6 skrll AcpiDmPromoteSubtree (
1233 1.1.1.4.2.6 skrll ACPI_PARSE_OBJECT *StartOp)
1234 1.1.1.4.2.6 skrll {
1235 1.1.1.4.2.6 skrll ACPI_PARSE_OBJECT *Op;
1236 1.1.1.4.2.6 skrll ACPI_PARSE_OBJECT *ParentOp;
1237 1.1.1.4.2.6 skrll
1238 1.1.1.4.2.6 skrll
1239 1.1.1.4.2.6 skrll /* New parent for subtree elements */
1240 1.1.1.4.2.6 skrll
1241 1.1.1.4.2.6 skrll ParentOp = StartOp->Common.Parent;
1242 1.1.1.4.2.6 skrll
1243 1.1.1.4.2.6 skrll /* First child starts the subtree */
1244 1.1.1.4.2.6 skrll
1245 1.1.1.4.2.6 skrll Op = StartOp->Common.Value.Arg;
1246 1.1.1.4.2.6 skrll
1247 1.1.1.4.2.6 skrll /* Walk the top-level elements of the subtree */
1248 1.1.1.4.2.6 skrll
1249 1.1.1.4.2.6 skrll while (Op)
1250 1.1.1.4.2.6 skrll {
1251 1.1.1.4.2.6 skrll Op->Common.Parent = ParentOp;
1252 1.1.1.4.2.6 skrll if (!Op->Common.Next)
1253 1.1.1.4.2.6 skrll {
1254 1.1.1.4.2.6 skrll /* Last Op in list, update its next field */
1255 1.1.1.4.2.6 skrll
1256 1.1.1.4.2.6 skrll Op->Common.Next = StartOp->Common.Next;
1257 1.1.1.4.2.6 skrll break;
1258 1.1.1.4.2.6 skrll }
1259 1.1.1.4.2.6 skrll Op = Op->Common.Next;
1260 1.1.1.4.2.6 skrll }
1261 1.1.1.4.2.6 skrll }
1262 1.1.1.4.2.7 skrll
1263 1.1.1.4.2.7 skrll /*******************************************************************************
1264 1.1.1.4.2.7 skrll *
1265 1.1.1.4.2.7 skrll * FUNCTION: AcpiDmIsTempName
1266 1.1.1.4.2.7 skrll *
1267 1.1.1.4.2.7 skrll * PARAMETERS: Op - Object to be examined
1268 1.1.1.4.2.7 skrll *
1269 1.1.1.4.2.8 skrll * RETURN: TRUE if object is a temporary (_T_x) name for a matching While
1270 1.1.1.4.2.8 skrll * loop that can be converted to a Switch.
1271 1.1.1.4.2.7 skrll *
1272 1.1.1.4.2.8 skrll * DESCRIPTION: _T_X objects are only used for Switch statements. If a temporary
1273 1.1.1.4.2.8 skrll * name exists, search the siblings for a matching While (One) loop
1274 1.1.1.4.2.8 skrll * that can be converted to a Switch. Return TRUE if a match was
1275 1.1.1.4.2.8 skrll * found, FALSE otherwise.
1276 1.1.1.4.2.7 skrll *
1277 1.1.1.4.2.7 skrll ******************************************************************************/
1278 1.1.1.4.2.7 skrll
1279 1.1.1.4.2.7 skrll BOOLEAN
1280 1.1.1.4.2.7 skrll AcpiDmIsTempName (
1281 1.1.1.4.2.7 skrll ACPI_PARSE_OBJECT *Op)
1282 1.1.1.4.2.7 skrll {
1283 1.1.1.4.2.8 skrll ACPI_PARSE_OBJECT *CurrentOp;
1284 1.1.1.4.2.7 skrll char *Temp;
1285 1.1.1.4.2.7 skrll
1286 1.1.1.4.2.7 skrll if (Op->Common.AmlOpcode != AML_NAME_OP)
1287 1.1.1.4.2.7 skrll {
1288 1.1.1.4.2.7 skrll return (FALSE);
1289 1.1.1.4.2.7 skrll }
1290 1.1.1.4.2.7 skrll
1291 1.1.1.4.2.7 skrll Temp = (char *)(Op->Common.Aml);
1292 1.1.1.4.2.7 skrll ++Temp;
1293 1.1.1.4.2.7 skrll
1294 1.1.1.4.2.7 skrll if (strncmp(Temp, "_T_", 3))
1295 1.1.1.4.2.7 skrll {
1296 1.1.1.4.2.7 skrll return (FALSE);
1297 1.1.1.4.2.7 skrll }
1298 1.1.1.4.2.7 skrll
1299 1.1.1.4.2.8 skrll CurrentOp = Op->Common.Next;
1300 1.1.1.4.2.8 skrll while (CurrentOp)
1301 1.1.1.4.2.8 skrll {
1302 1.1.1.4.2.8 skrll if (CurrentOp->Common.AmlOpcode == AML_WHILE_OP &&
1303 1.1.1.4.2.8 skrll AcpiDmIsSwitchBlock(CurrentOp, Temp))
1304 1.1.1.4.2.8 skrll {
1305 1.1.1.4.2.8 skrll Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
1306 1.1.1.4.2.8 skrll CurrentOp->Common.DisasmOpcode = ACPI_DASM_SWITCH;
1307 1.1.1.4.2.7 skrll
1308 1.1.1.4.2.8 skrll return (TRUE);
1309 1.1.1.4.2.8 skrll }
1310 1.1.1.4.2.8 skrll CurrentOp = CurrentOp->Common.Next;
1311 1.1.1.4.2.8 skrll }
1312 1.1.1.4.2.7 skrll
1313 1.1.1.4.2.8 skrll return (FALSE);
1314 1.1.1.4.2.7 skrll }
1315 1.1.1.4.2.7 skrll
1316 1.1.1.4.2.7 skrll /*******************************************************************************
1317 1.1.1.4.2.7 skrll *
1318 1.1.1.4.2.7 skrll * FUNCTION: AcpiDmIsSwitchBlock
1319 1.1.1.4.2.7 skrll *
1320 1.1.1.4.2.7 skrll * PARAMETERS: Op - While Object
1321 1.1.1.4.2.7 skrll *
1322 1.1.1.4.2.7 skrll * RETURN: TRUE if While block can be converted to a Switch/Case block
1323 1.1.1.4.2.7 skrll *
1324 1.1.1.4.2.7 skrll * DESCRIPTION: Determines if While block is a Switch/Case statement. Modifies
1325 1.1.1.4.2.7 skrll * parse tree to allow for Switch/Case disassembly during walk.
1326 1.1.1.4.2.7 skrll *
1327 1.1.1.4.2.7 skrll * EXAMPLE: Example of parse tree to be converted
1328 1.1.1.4.2.7 skrll *
1329 1.1.1.4.2.7 skrll * While
1330 1.1.1.4.2.7 skrll * One
1331 1.1.1.4.2.7 skrll * Store
1332 1.1.1.4.2.7 skrll * ByteConst
1333 1.1.1.4.2.7 skrll * -NamePath-
1334 1.1.1.4.2.7 skrll * If
1335 1.1.1.4.2.7 skrll * LEqual
1336 1.1.1.4.2.7 skrll * -NamePath-
1337 1.1.1.4.2.7 skrll * Zero
1338 1.1.1.4.2.7 skrll * Return
1339 1.1.1.4.2.7 skrll * One
1340 1.1.1.4.2.7 skrll * Else
1341 1.1.1.4.2.7 skrll * Return
1342 1.1.1.4.2.7 skrll * WordConst
1343 1.1.1.4.2.7 skrll * Break
1344 1.1.1.4.2.7 skrll *
1345 1.1.1.4.2.7 skrll ******************************************************************************/
1346 1.1.1.4.2.7 skrll
1347 1.1.1.4.2.7 skrll static BOOLEAN
1348 1.1.1.4.2.7 skrll AcpiDmIsSwitchBlock (
1349 1.1.1.4.2.8 skrll ACPI_PARSE_OBJECT *Op,
1350 1.1.1.4.2.8 skrll char *Temp)
1351 1.1.1.4.2.7 skrll {
1352 1.1.1.4.2.7 skrll ACPI_PARSE_OBJECT *OneOp;
1353 1.1.1.4.2.7 skrll ACPI_PARSE_OBJECT *StoreOp;
1354 1.1.1.4.2.7 skrll ACPI_PARSE_OBJECT *NamePathOp;
1355 1.1.1.4.2.7 skrll ACPI_PARSE_OBJECT *PredicateOp;
1356 1.1.1.4.2.7 skrll ACPI_PARSE_OBJECT *CurrentOp;
1357 1.1.1.4.2.7 skrll ACPI_PARSE_OBJECT *TempOp;
1358 1.1.1.4.2.7 skrll
1359 1.1.1.4.2.7 skrll /* Check for One Op Predicate */
1360 1.1.1.4.2.7 skrll
1361 1.1.1.4.2.7 skrll OneOp = AcpiPsGetArg (Op, 0);
1362 1.1.1.4.2.7 skrll if (!OneOp || (OneOp->Common.AmlOpcode != AML_ONE_OP))
1363 1.1.1.4.2.7 skrll {
1364 1.1.1.4.2.7 skrll return (FALSE);
1365 1.1.1.4.2.7 skrll }
1366 1.1.1.4.2.7 skrll
1367 1.1.1.4.2.7 skrll /* Check for Store Op */
1368 1.1.1.4.2.7 skrll
1369 1.1.1.4.2.7 skrll StoreOp = OneOp->Common.Next;
1370 1.1.1.4.2.7 skrll if (!StoreOp || (StoreOp->Common.AmlOpcode != AML_STORE_OP))
1371 1.1.1.4.2.7 skrll {
1372 1.1.1.4.2.7 skrll return (FALSE);
1373 1.1.1.4.2.7 skrll }
1374 1.1.1.4.2.7 skrll
1375 1.1.1.4.2.7 skrll /* Check for Name Op with _T_ string */
1376 1.1.1.4.2.7 skrll
1377 1.1.1.4.2.7 skrll NamePathOp = AcpiPsGetArg (StoreOp, 1);
1378 1.1.1.4.2.7 skrll if (!NamePathOp || (NamePathOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
1379 1.1.1.4.2.7 skrll {
1380 1.1.1.4.2.7 skrll return (FALSE);
1381 1.1.1.4.2.7 skrll }
1382 1.1.1.4.2.7 skrll
1383 1.1.1.4.2.8 skrll if (strncmp((char *)(NamePathOp->Common.Aml), Temp, 4))
1384 1.1.1.4.2.7 skrll {
1385 1.1.1.4.2.7 skrll return (FALSE);
1386 1.1.1.4.2.7 skrll }
1387 1.1.1.4.2.7 skrll
1388 1.1.1.4.2.7 skrll /* This is a Switch/Case control block */
1389 1.1.1.4.2.7 skrll
1390 1.1.1.4.2.7 skrll /* Ignore the One Op Predicate */
1391 1.1.1.4.2.7 skrll
1392 1.1.1.4.2.7 skrll OneOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
1393 1.1.1.4.2.7 skrll
1394 1.1.1.4.2.7 skrll /* Ignore the Store Op, but not the children */
1395 1.1.1.4.2.7 skrll
1396 1.1.1.4.2.7 skrll StoreOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE;
1397 1.1.1.4.2.7 skrll
1398 1.1.1.4.2.7 skrll /*
1399 1.1.1.4.2.7 skrll * First arg of Store Op is the Switch condition.
1400 1.1.1.4.2.7 skrll * Mark it as a Switch predicate and as a parameter list for paren
1401 1.1.1.4.2.7 skrll * closing and correct indentation.
1402 1.1.1.4.2.7 skrll */
1403 1.1.1.4.2.7 skrll PredicateOp = AcpiPsGetArg (StoreOp, 0);
1404 1.1.1.4.2.7 skrll PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE;
1405 1.1.1.4.2.7 skrll PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
1406 1.1.1.4.2.7 skrll
1407 1.1.1.4.2.7 skrll /* Ignore the Name Op */
1408 1.1.1.4.2.7 skrll
1409 1.1.1.4.2.7 skrll NamePathOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE;
1410 1.1.1.4.2.7 skrll
1411 1.1.1.4.2.7 skrll /* Remaining opcodes are the Case statements (If/ElseIf's) */
1412 1.1.1.4.2.7 skrll
1413 1.1.1.4.2.7 skrll CurrentOp = StoreOp->Common.Next;
1414 1.1.1.4.2.7 skrll while (AcpiDmIsCaseBlock (CurrentOp))
1415 1.1.1.4.2.7 skrll {
1416 1.1.1.4.2.7 skrll /* Block is a Case structure */
1417 1.1.1.4.2.7 skrll
1418 1.1.1.4.2.7 skrll if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
1419 1.1.1.4.2.7 skrll {
1420 1.1.1.4.2.7 skrll /* ElseIf */
1421 1.1.1.4.2.7 skrll
1422 1.1.1.4.2.7 skrll CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE;
1423 1.1.1.4.2.7 skrll CurrentOp = AcpiPsGetArg (CurrentOp, 0);
1424 1.1.1.4.2.7 skrll }
1425 1.1.1.4.2.7 skrll
1426 1.1.1.4.2.7 skrll /* If */
1427 1.1.1.4.2.7 skrll
1428 1.1.1.4.2.7 skrll CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE;
1429 1.1.1.4.2.7 skrll
1430 1.1.1.4.2.7 skrll /*
1431 1.1.1.4.2.7 skrll * Mark the parse tree for Case disassembly. There are two
1432 1.1.1.4.2.7 skrll * types of Case statements. The first type of statement begins with
1433 1.1.1.4.2.7 skrll * an LEqual. The second starts with an LNot and uses a Match statement
1434 1.1.1.4.2.7 skrll * on a Package of constants.
1435 1.1.1.4.2.7 skrll */
1436 1.1.1.4.2.7 skrll TempOp = AcpiPsGetArg (CurrentOp, 0);
1437 1.1.1.4.2.7 skrll switch (TempOp->Common.AmlOpcode)
1438 1.1.1.4.2.7 skrll {
1439 1.1.1.4.2.8 skrll case (AML_LOGICAL_EQUAL_OP):
1440 1.1.1.4.2.7 skrll
1441 1.1.1.4.2.7 skrll /* Ignore just the LEqual Op */
1442 1.1.1.4.2.7 skrll
1443 1.1.1.4.2.7 skrll TempOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE;
1444 1.1.1.4.2.7 skrll
1445 1.1.1.4.2.7 skrll /* Ignore the NamePath Op */
1446 1.1.1.4.2.7 skrll
1447 1.1.1.4.2.7 skrll TempOp = AcpiPsGetArg (TempOp, 0);
1448 1.1.1.4.2.7 skrll TempOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE;
1449 1.1.1.4.2.7 skrll
1450 1.1.1.4.2.7 skrll /*
1451 1.1.1.4.2.7 skrll * Second arg of LEqual will be the Case predicate.
1452 1.1.1.4.2.7 skrll * Mark it as a predicate and also as a parameter list for paren
1453 1.1.1.4.2.7 skrll * closing and correct indentation.
1454 1.1.1.4.2.7 skrll */
1455 1.1.1.4.2.7 skrll PredicateOp = TempOp->Common.Next;
1456 1.1.1.4.2.7 skrll PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE;
1457 1.1.1.4.2.7 skrll PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
1458 1.1.1.4.2.7 skrll
1459 1.1.1.4.2.7 skrll break;
1460 1.1.1.4.2.7 skrll
1461 1.1.1.4.2.8 skrll case (AML_LOGICAL_NOT_OP):
1462 1.1.1.4.2.7 skrll
1463 1.1.1.4.2.7 skrll /*
1464 1.1.1.4.2.7 skrll * The Package will be the predicate of the Case statement.
1465 1.1.1.4.2.7 skrll * It's under:
1466 1.1.1.4.2.7 skrll * LNOT
1467 1.1.1.4.2.7 skrll * LEQUAL
1468 1.1.1.4.2.7 skrll * MATCH
1469 1.1.1.4.2.7 skrll * PACKAGE
1470 1.1.1.4.2.7 skrll */
1471 1.1.1.4.2.7 skrll
1472 1.1.1.4.2.7 skrll /* Get the LEqual Op from LNot */
1473 1.1.1.4.2.7 skrll
1474 1.1.1.4.2.7 skrll TempOp = AcpiPsGetArg (TempOp, 0);
1475 1.1.1.4.2.7 skrll
1476 1.1.1.4.2.7 skrll /* Get the Match Op from LEqual */
1477 1.1.1.4.2.7 skrll
1478 1.1.1.4.2.7 skrll TempOp = AcpiPsGetArg (TempOp, 0);
1479 1.1.1.4.2.7 skrll
1480 1.1.1.4.2.7 skrll /* Get the Package Op from Match */
1481 1.1.1.4.2.7 skrll
1482 1.1.1.4.2.7 skrll PredicateOp = AcpiPsGetArg (TempOp, 0);
1483 1.1.1.4.2.7 skrll
1484 1.1.1.4.2.7 skrll /* Mark as parameter list for paren closing */
1485 1.1.1.4.2.7 skrll
1486 1.1.1.4.2.7 skrll PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST;
1487 1.1.1.4.2.7 skrll
1488 1.1.1.4.2.7 skrll /*
1489 1.1.1.4.2.7 skrll * The Package list would be too deeply indented if we
1490 1.1.1.4.2.7 skrll * chose to simply ignore the all the parent opcodes, so
1491 1.1.1.4.2.7 skrll * we rearrange the parse tree instead.
1492 1.1.1.4.2.7 skrll */
1493 1.1.1.4.2.7 skrll
1494 1.1.1.4.2.7 skrll /*
1495 1.1.1.4.2.7 skrll * Save the second arg of the If/Else Op which is the
1496 1.1.1.4.2.7 skrll * block code of code for this Case statement.
1497 1.1.1.4.2.7 skrll */
1498 1.1.1.4.2.7 skrll TempOp = AcpiPsGetArg (CurrentOp, 1);
1499 1.1.1.4.2.7 skrll
1500 1.1.1.4.2.7 skrll /*
1501 1.1.1.4.2.7 skrll * Move the Package Op to the child (predicate) of the
1502 1.1.1.4.2.7 skrll * Case statement.
1503 1.1.1.4.2.7 skrll */
1504 1.1.1.4.2.7 skrll CurrentOp->Common.Value.Arg = PredicateOp;
1505 1.1.1.4.2.7 skrll PredicateOp->Common.Parent = CurrentOp;
1506 1.1.1.4.2.7 skrll
1507 1.1.1.4.2.7 skrll /* Add the block code */
1508 1.1.1.4.2.7 skrll
1509 1.1.1.4.2.7 skrll PredicateOp->Common.Next = TempOp;
1510 1.1.1.4.2.7 skrll
1511 1.1.1.4.2.7 skrll break;
1512 1.1.1.4.2.7 skrll
1513 1.1.1.4.2.7 skrll default:
1514 1.1.1.4.2.7 skrll
1515 1.1.1.4.2.7 skrll /* Should never get here */
1516 1.1.1.4.2.7 skrll
1517 1.1.1.4.2.7 skrll break;
1518 1.1.1.4.2.7 skrll }
1519 1.1.1.4.2.7 skrll
1520 1.1.1.4.2.7 skrll /* Advance to next Case block */
1521 1.1.1.4.2.7 skrll
1522 1.1.1.4.2.7 skrll CurrentOp = CurrentOp->Common.Next;
1523 1.1.1.4.2.7 skrll }
1524 1.1.1.4.2.7 skrll
1525 1.1.1.4.2.7 skrll /* If CurrentOp is now an Else, then this is a Default block */
1526 1.1.1.4.2.7 skrll
1527 1.1.1.4.2.7 skrll if (CurrentOp && CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
1528 1.1.1.4.2.7 skrll {
1529 1.1.1.4.2.7 skrll CurrentOp->Common.DisasmOpcode = ACPI_DASM_DEFAULT;
1530 1.1.1.4.2.7 skrll }
1531 1.1.1.4.2.7 skrll
1532 1.1.1.4.2.7 skrll /*
1533 1.1.1.4.2.7 skrll * From the first If advance to the Break op. It's possible to
1534 1.1.1.4.2.7 skrll * have an Else (Default) op here when there is only one Case
1535 1.1.1.4.2.7 skrll * statement, so check for it.
1536 1.1.1.4.2.7 skrll */
1537 1.1.1.4.2.7 skrll CurrentOp = StoreOp->Common.Next->Common.Next;
1538 1.1.1.4.2.7 skrll if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
1539 1.1.1.4.2.7 skrll {
1540 1.1.1.4.2.7 skrll CurrentOp = CurrentOp->Common.Next;
1541 1.1.1.4.2.7 skrll }
1542 1.1.1.4.2.7 skrll
1543 1.1.1.4.2.7 skrll /* Ignore the Break Op */
1544 1.1.1.4.2.7 skrll
1545 1.1.1.4.2.7 skrll CurrentOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
1546 1.1.1.4.2.7 skrll
1547 1.1.1.4.2.7 skrll return (TRUE);
1548 1.1.1.4.2.7 skrll }
1549 1.1.1.4.2.7 skrll
1550 1.1.1.4.2.7 skrll /*******************************************************************************
1551 1.1.1.4.2.7 skrll *
1552 1.1.1.4.2.7 skrll * FUNCTION: AcpiDmIsCaseBlock
1553 1.1.1.4.2.7 skrll *
1554 1.1.1.4.2.7 skrll * PARAMETERS: Op - Object to test
1555 1.1.1.4.2.7 skrll *
1556 1.1.1.4.2.7 skrll * RETURN: TRUE if Object is beginning of a Case block.
1557 1.1.1.4.2.7 skrll *
1558 1.1.1.4.2.7 skrll * DESCRIPTION: Determines if an Object is the beginning of a Case block for a
1559 1.1.1.4.2.7 skrll * Switch/Case statement. Parse tree must be one of the following
1560 1.1.1.4.2.7 skrll * forms:
1561 1.1.1.4.2.7 skrll *
1562 1.1.1.4.2.7 skrll * Else (Optional)
1563 1.1.1.4.2.7 skrll * If
1564 1.1.1.4.2.7 skrll * LEqual
1565 1.1.1.4.2.7 skrll * -NamePath- _T_x
1566 1.1.1.4.2.7 skrll *
1567 1.1.1.4.2.7 skrll * Else (Optional)
1568 1.1.1.4.2.7 skrll * If
1569 1.1.1.4.2.7 skrll * LNot
1570 1.1.1.4.2.7 skrll * LEqual
1571 1.1.1.4.2.7 skrll * Match
1572 1.1.1.4.2.7 skrll * Package
1573 1.1.1.4.2.7 skrll * ByteConst
1574 1.1.1.4.2.7 skrll * -NamePath- _T_x
1575 1.1.1.4.2.7 skrll *
1576 1.1.1.4.2.7 skrll ******************************************************************************/
1577 1.1.1.4.2.7 skrll
1578 1.1.1.4.2.7 skrll static BOOLEAN
1579 1.1.1.4.2.7 skrll AcpiDmIsCaseBlock (
1580 1.1.1.4.2.7 skrll ACPI_PARSE_OBJECT *Op)
1581 1.1.1.4.2.7 skrll {
1582 1.1.1.4.2.7 skrll ACPI_PARSE_OBJECT *CurrentOp;
1583 1.1.1.4.2.7 skrll
1584 1.1.1.4.2.7 skrll if (!Op)
1585 1.1.1.4.2.7 skrll {
1586 1.1.1.4.2.7 skrll return (FALSE);
1587 1.1.1.4.2.7 skrll }
1588 1.1.1.4.2.7 skrll
1589 1.1.1.4.2.7 skrll /* Look for an If or ElseIf */
1590 1.1.1.4.2.7 skrll
1591 1.1.1.4.2.7 skrll CurrentOp = Op;
1592 1.1.1.4.2.7 skrll if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP)
1593 1.1.1.4.2.7 skrll {
1594 1.1.1.4.2.7 skrll CurrentOp = AcpiPsGetArg (CurrentOp, 0);
1595 1.1.1.4.2.7 skrll if (!CurrentOp)
1596 1.1.1.4.2.7 skrll {
1597 1.1.1.4.2.7 skrll return (FALSE);
1598 1.1.1.4.2.7 skrll }
1599 1.1.1.4.2.7 skrll }
1600 1.1.1.4.2.7 skrll
1601 1.1.1.4.2.7 skrll if (!CurrentOp || CurrentOp->Common.AmlOpcode != AML_IF_OP)
1602 1.1.1.4.2.7 skrll {
1603 1.1.1.4.2.7 skrll return (FALSE);
1604 1.1.1.4.2.7 skrll }
1605 1.1.1.4.2.7 skrll
1606 1.1.1.4.2.7 skrll /* Child must be LEqual or LNot */
1607 1.1.1.4.2.7 skrll
1608 1.1.1.4.2.7 skrll CurrentOp = AcpiPsGetArg (CurrentOp, 0);
1609 1.1.1.4.2.7 skrll if (!CurrentOp)
1610 1.1.1.4.2.7 skrll {
1611 1.1.1.4.2.7 skrll return (FALSE);
1612 1.1.1.4.2.7 skrll }
1613 1.1.1.4.2.7 skrll
1614 1.1.1.4.2.7 skrll switch (CurrentOp->Common.AmlOpcode)
1615 1.1.1.4.2.7 skrll {
1616 1.1.1.4.2.8 skrll case (AML_LOGICAL_EQUAL_OP):
1617 1.1.1.4.2.7 skrll
1618 1.1.1.4.2.7 skrll /* Next child must be NamePath with string _T_ */
1619 1.1.1.4.2.7 skrll
1620 1.1.1.4.2.7 skrll CurrentOp = AcpiPsGetArg (CurrentOp, 0);
1621 1.1.1.4.2.7 skrll if (!CurrentOp || !CurrentOp->Common.Value.Name ||
1622 1.1.1.4.2.7 skrll strncmp(CurrentOp->Common.Value.Name, "_T_", 3))
1623 1.1.1.4.2.7 skrll {
1624 1.1.1.4.2.7 skrll return (FALSE);
1625 1.1.1.4.2.7 skrll }
1626 1.1.1.4.2.7 skrll
1627 1.1.1.4.2.7 skrll break;
1628 1.1.1.4.2.7 skrll
1629 1.1.1.4.2.8 skrll case (AML_LOGICAL_NOT_OP):
1630 1.1.1.4.2.7 skrll
1631 1.1.1.4.2.7 skrll /* Child of LNot must be LEqual op */
1632 1.1.1.4.2.7 skrll
1633 1.1.1.4.2.7 skrll CurrentOp = AcpiPsGetArg (CurrentOp, 0);
1634 1.1.1.4.2.8 skrll if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_LOGICAL_EQUAL_OP))
1635 1.1.1.4.2.7 skrll {
1636 1.1.1.4.2.7 skrll return (FALSE);
1637 1.1.1.4.2.7 skrll }
1638 1.1.1.4.2.7 skrll
1639 1.1.1.4.2.7 skrll /* Child of LNot must be Match op */
1640 1.1.1.4.2.7 skrll
1641 1.1.1.4.2.7 skrll CurrentOp = AcpiPsGetArg (CurrentOp, 0);
1642 1.1.1.4.2.7 skrll if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_MATCH_OP))
1643 1.1.1.4.2.7 skrll {
1644 1.1.1.4.2.7 skrll return (FALSE);
1645 1.1.1.4.2.7 skrll }
1646 1.1.1.4.2.7 skrll
1647 1.1.1.4.2.7 skrll /* First child of Match must be Package op */
1648 1.1.1.4.2.7 skrll
1649 1.1.1.4.2.7 skrll CurrentOp = AcpiPsGetArg (CurrentOp, 0);
1650 1.1.1.4.2.7 skrll if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_PACKAGE_OP))
1651 1.1.1.4.2.7 skrll {
1652 1.1.1.4.2.7 skrll return (FALSE);
1653 1.1.1.4.2.7 skrll }
1654 1.1.1.4.2.7 skrll
1655 1.1.1.4.2.7 skrll /* Third child of Match must be NamePath with string _T_ */
1656 1.1.1.4.2.7 skrll
1657 1.1.1.4.2.7 skrll CurrentOp = AcpiPsGetArg (CurrentOp->Common.Parent, 2);
1658 1.1.1.4.2.7 skrll if (!CurrentOp || !CurrentOp->Common.Value.Name ||
1659 1.1.1.4.2.7 skrll strncmp(CurrentOp->Common.Value.Name, "_T_", 3))
1660 1.1.1.4.2.7 skrll {
1661 1.1.1.4.2.7 skrll return (FALSE);
1662 1.1.1.4.2.7 skrll }
1663 1.1.1.4.2.7 skrll
1664 1.1.1.4.2.7 skrll break;
1665 1.1.1.4.2.7 skrll
1666 1.1.1.4.2.7 skrll default:
1667 1.1.1.4.2.7 skrll
1668 1.1.1.4.2.7 skrll return (FALSE);
1669 1.1.1.4.2.7 skrll }
1670 1.1.1.4.2.7 skrll
1671 1.1.1.4.2.7 skrll return (TRUE);
1672 1.1.1.4.2.7 skrll }
1673