xref: /titanic_41/usr/src/uts/intel/sys/acpi/acdisasm.h (revision c2580b931007758eab8cb5ae8726ebe1588e259b)
1 /******************************************************************************
2  *
3  * Name: acdisasm.h - AML disassembler
4  *       $Revision: 1.35 $
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116 
117 #ifndef __ACDISASM_H__
118 #define __ACDISASM_H__
119 
120 #include "amlresrc.h"
121 
122 
123 #define BLOCK_NONE              0
124 #define BLOCK_PAREN             1
125 #define BLOCK_BRACE             2
126 #define BLOCK_COMMA_LIST        4
127 #define ACPI_DEFAULT_RESNAME    *(UINT32 *) "__RD"
128 
129 typedef struct acpi_external_list
130 {
131     char                        *Path;
132     char                        *InternalPath;
133     struct acpi_external_list   *Next;
134     UINT32                      Value;
135     UINT16                      Length;
136     UINT8                       Type;
137 
138 } ACPI_EXTERNAL_LIST;
139 
140 extern ACPI_EXTERNAL_LIST       *AcpiGbl_ExternalList;
141 
142 typedef const struct acpi_dmtable_info
143 {
144     UINT8                       Opcode;
145     UINT8                       Offset;
146     char                        *Name;
147 
148 } ACPI_DMTABLE_INFO;
149 
150 /*
151  * Values for Opcode above.
152  * Note: 0-7 must not change, used as a flag shift value
153  */
154 #define ACPI_DMT_FLAG0                  0
155 #define ACPI_DMT_FLAG1                  1
156 #define ACPI_DMT_FLAG2                  2
157 #define ACPI_DMT_FLAG3                  3
158 #define ACPI_DMT_FLAG4                  4
159 #define ACPI_DMT_FLAG5                  5
160 #define ACPI_DMT_FLAG6                  6
161 #define ACPI_DMT_FLAG7                  7
162 #define ACPI_DMT_FLAGS0                 8
163 #define ACPI_DMT_FLAGS2                 9
164 #define ACPI_DMT_UINT8                  10
165 #define ACPI_DMT_UINT16                 11
166 #define ACPI_DMT_UINT24                 12
167 #define ACPI_DMT_UINT32                 13
168 #define ACPI_DMT_UINT56                 14
169 #define ACPI_DMT_UINT64                 15
170 #define ACPI_DMT_STRING                 16
171 #define ACPI_DMT_NAME4                  17
172 #define ACPI_DMT_NAME6                  18
173 #define ACPI_DMT_NAME8                  19
174 #define ACPI_DMT_CHKSUM                 20
175 #define ACPI_DMT_SPACEID                21
176 #define ACPI_DMT_GAS                    22
177 #define ACPI_DMT_MADT                   23
178 #define ACPI_DMT_SRAT                   24
179 #define ACPI_DMT_EXIT                   25
180 
181 typedef
182 void (*ACPI_TABLE_HANDLER) (
183     ACPI_TABLE_HEADER       *Table);
184 
185 typedef struct acpi_dmtable_data
186 {
187     char                    *Signature;
188     ACPI_DMTABLE_INFO        *TableInfo;
189     ACPI_TABLE_HANDLER      TableHandler;
190 
191 } ACPI_DMTABLE_DATA;
192 
193 
194 typedef struct acpi_op_walk_info
195 {
196     UINT32                  Level;
197     UINT32                  LastLevel;
198     UINT32                  Count;
199     UINT32                  BitOffset;
200     UINT32                  Flags;
201     ACPI_WALK_STATE         *WalkState;
202 
203 } ACPI_OP_WALK_INFO;
204 
205 typedef
206 ACPI_STATUS (*ASL_WALK_CALLBACK) (
207     ACPI_PARSE_OBJECT           *Op,
208     UINT32                      Level,
209     void                        *Context);
210 
211 typedef struct acpi_resource_tag
212 {
213     UINT32                  BitIndex;
214     char                    *Tag;
215 
216 } ACPI_RESOURCE_TAG;
217 
218 /* Strings used for decoding flags to ASL keywords */
219 
220 extern const char               *AcpiGbl_WordDecode[];
221 extern const char               *AcpiGbl_IrqDecode[];
222 extern const char               *AcpiGbl_LockRule[];
223 extern const char               *AcpiGbl_AccessTypes[];
224 extern const char               *AcpiGbl_UpdateRules[];
225 extern const char               *AcpiGbl_MatchOps[];
226 
227 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoAsf0[];
228 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoAsf1[];
229 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoAsf2[];
230 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoAsf3[];
231 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoAsf4[];
232 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoAsfHdr[];
233 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoBoot[];
234 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCpep[];
235 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCpep0[];
236 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoDbgp[];
237 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoEcdt[];
238 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFacs[];
239 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFadt1[];
240 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoFadt2[];
241 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoGas[];
242 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHeader[];
243 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoHpet[];
244 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt[];
245 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt0[];
246 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt1[];
247 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt2[];
248 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt3[];
249 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt4[];
250 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt5[];
251 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt6[];
252 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt7[];
253 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadt8[];
254 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMadtHdr[];
255 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMcfg[];
256 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoMcfg0[];
257 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoRsdp1[];
258 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoRsdp2[];
259 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSbst[];
260 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSlit[];
261 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSpcr[];
262 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSpmi[];
263 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat[];
264 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat0[];
265 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoSrat1[];
266 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoTcpa[];
267 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoWdrt[];
268 
269 
270 /*
271  * dmtable
272  */
273 void
274 AcpiDmDumpDataTable (
275     ACPI_TABLE_HEADER       *Table);
276 
277 void
278 AcpiDmDumpTable (
279     UINT32                  TableLength,
280     UINT32                  TableOffset,
281     void                    *Table,
282     UINT32                  SubTableLength,
283     ACPI_DMTABLE_INFO        *Info);
284 
285 void
286 AcpiDmLineHeader (
287     UINT32                  Offset,
288     UINT32                  ByteLength,
289     char                    *Name);
290 
291 void
292 AcpiDmLineHeader2 (
293     UINT32                  Offset,
294     UINT32                  ByteLength,
295     char                    *Name,
296     UINT32                  Value);
297 
298 
299 /*
300  * dmtbdump
301  */
302 void
303 AcpiDmDumpAsf (
304     ACPI_TABLE_HEADER       *Table);
305 
306 void
307 AcpiDmDumpCpep (
308     ACPI_TABLE_HEADER       *Table);
309 
310 void
311 AcpiDmDumpFadt (
312     ACPI_TABLE_HEADER       *Table);
313 
314 void
315 AcpiDmDumpSrat (
316     ACPI_TABLE_HEADER       *Table);
317 
318 void
319 AcpiDmDumpMcfg (
320     ACPI_TABLE_HEADER       *Table);
321 
322 void
323 AcpiDmDumpMadt (
324     ACPI_TABLE_HEADER       *Table);
325 
326 UINT32
327 AcpiDmDumpRsdp (
328     ACPI_TABLE_HEADER       *Table);
329 
330 void
331 AcpiDmDumpRsdt (
332     ACPI_TABLE_HEADER       *Table);
333 
334 void
335 AcpiDmDumpSlit (
336     ACPI_TABLE_HEADER       *Table);
337 
338 void
339 AcpiDmDumpXsdt (
340     ACPI_TABLE_HEADER       *Table);
341 
342 
343 /*
344  * dmwalk
345  */
346 void
347 AcpiDmDisassemble (
348     ACPI_WALK_STATE         *WalkState,
349     ACPI_PARSE_OBJECT       *Origin,
350     UINT32                  NumOpcodes);
351 
352 void
353 AcpiDmWalkParseTree (
354     ACPI_PARSE_OBJECT       *Op,
355     ASL_WALK_CALLBACK       DescendingCallback,
356     ASL_WALK_CALLBACK       AscendingCallback,
357     void                    *Context);
358 
359 
360 /*
361  * dmopcode
362  */
363 void
364 AcpiDmDisassembleOneOp (
365     ACPI_WALK_STATE         *WalkState,
366     ACPI_OP_WALK_INFO       *Info,
367     ACPI_PARSE_OBJECT       *Op);
368 
369 void
370 AcpiDmDecodeInternalObject (
371     ACPI_OPERAND_OBJECT     *ObjDesc);
372 
373 UINT32
374 AcpiDmListType (
375     ACPI_PARSE_OBJECT       *Op);
376 
377 void
378 AcpiDmMethodFlags (
379     ACPI_PARSE_OBJECT       *Op);
380 
381 void
382 AcpiDmFieldFlags (
383     ACPI_PARSE_OBJECT       *Op);
384 
385 void
386 AcpiDmAddressSpace (
387     UINT8                   SpaceId);
388 
389 void
390 AcpiDmRegionFlags (
391     ACPI_PARSE_OBJECT       *Op);
392 
393 void
394 AcpiDmMatchOp (
395     ACPI_PARSE_OBJECT       *Op);
396 
397 BOOLEAN
398 AcpiDmCommaIfListMember (
399     ACPI_PARSE_OBJECT       *Op);
400 
401 void
402 AcpiDmCommaIfFieldMember (
403     ACPI_PARSE_OBJECT       *Op);
404 
405 
406 /*
407  * dmnames
408  */
409 UINT32
410 AcpiDmDumpName (
411     char                    *Name);
412 
413 ACPI_STATUS
414 AcpiPsDisplayObjectPathname (
415     ACPI_WALK_STATE         *WalkState,
416     ACPI_PARSE_OBJECT       *Op);
417 
418 void
419 AcpiDmNamestring (
420     char                    *Name);
421 
422 
423 /*
424  * dmobject
425  */
426 void
427 AcpiDmDisplayInternalObject (
428     ACPI_OPERAND_OBJECT     *ObjDesc,
429     ACPI_WALK_STATE         *WalkState);
430 
431 void
432 AcpiDmDisplayArguments (
433     ACPI_WALK_STATE         *WalkState);
434 
435 void
436 AcpiDmDisplayLocals (
437     ACPI_WALK_STATE         *WalkState);
438 
439 void
440 AcpiDmDumpMethodInfo (
441     ACPI_STATUS             Status,
442     ACPI_WALK_STATE         *WalkState,
443     ACPI_PARSE_OBJECT       *Op);
444 
445 
446 /*
447  * dmbuffer
448  */
449 void
450 AcpiDmDisasmByteList (
451     UINT32                  Level,
452     UINT8                   *ByteData,
453     UINT32                  ByteCount);
454 
455 void
456 AcpiDmByteList (
457     ACPI_OP_WALK_INFO       *Info,
458     ACPI_PARSE_OBJECT       *Op);
459 
460 void
461 AcpiDmIsEisaId (
462     ACPI_PARSE_OBJECT       *Op);
463 
464 void
465 AcpiDmEisaId (
466     UINT32                  EncodedId);
467 
468 BOOLEAN
469 AcpiDmIsUnicodeBuffer (
470     ACPI_PARSE_OBJECT       *Op);
471 
472 BOOLEAN
473 AcpiDmIsStringBuffer (
474     ACPI_PARSE_OBJECT       *Op);
475 
476 
477 /*
478  * dmresrc
479  */
480 void
481 AcpiDmDumpInteger8 (
482     UINT8                   Value,
483     char                    *Name);
484 
485 void
486 AcpiDmDumpInteger16 (
487     UINT16                  Value,
488     char                    *Name);
489 
490 void
491 AcpiDmDumpInteger32 (
492     UINT32                  Value,
493     char                    *Name);
494 
495 void
496 AcpiDmDumpInteger64 (
497     UINT64                  Value,
498     char                    *Name);
499 
500 void
501 AcpiDmResourceTemplate (
502     ACPI_OP_WALK_INFO       *Info,
503     ACPI_PARSE_OBJECT       *Op,
504     UINT8                   *ByteData,
505     UINT32                  ByteCount);
506 
507 BOOLEAN
508 AcpiDmIsResourceTemplate (
509     ACPI_PARSE_OBJECT       *Op);
510 
511 void
512 AcpiDmIndent (
513     UINT32                  Level);
514 
515 void
516 AcpiDmBitList (
517     UINT16                  Mask);
518 
519 void
520 AcpiDmDecodeAttribute (
521     UINT8                   Attribute);
522 
523 void
524 AcpiDmDescriptorName (
525     void);
526 
527 
528 /*
529  * dmresrcl
530  */
531 void
532 AcpiDmWordDescriptor (
533     AML_RESOURCE            *Resource,
534     UINT32                  Length,
535     UINT32                  Level);
536 
537 void
538 AcpiDmDwordDescriptor (
539     AML_RESOURCE            *Resource,
540     UINT32                  Length,
541     UINT32                  Level);
542 
543 void
544 AcpiDmExtendedDescriptor (
545     AML_RESOURCE            *Resource,
546     UINT32                  Length,
547     UINT32                  Level);
548 
549 void
550 AcpiDmQwordDescriptor (
551     AML_RESOURCE            *Resource,
552     UINT32                  Length,
553     UINT32                  Level);
554 
555 void
556 AcpiDmMemory24Descriptor (
557     AML_RESOURCE            *Resource,
558     UINT32                  Length,
559     UINT32                  Level);
560 
561 void
562 AcpiDmMemory32Descriptor (
563     AML_RESOURCE            *Resource,
564     UINT32                  Length,
565     UINT32                  Level);
566 
567 void
568 AcpiDmFixedMemory32Descriptor (
569     AML_RESOURCE            *Resource,
570     UINT32                  Length,
571     UINT32                  Level);
572 
573 void
574 AcpiDmGenericRegisterDescriptor (
575     AML_RESOURCE            *Resource,
576     UINT32                  Length,
577     UINT32                  Level);
578 
579 void
580 AcpiDmInterruptDescriptor (
581     AML_RESOURCE            *Resource,
582     UINT32                  Length,
583     UINT32                  Level);
584 
585 void
586 AcpiDmVendorLargeDescriptor (
587     AML_RESOURCE            *Resource,
588     UINT32                  Length,
589     UINT32                  Level);
590 
591 void
592 AcpiDmVendorCommon (
593     char                    *Name,
594     UINT8                   *ByteData,
595     UINT32                  Length,
596     UINT32                  Level);
597 
598 
599 /*
600  * dmresrcs
601  */
602 void
603 AcpiDmIrqDescriptor (
604     AML_RESOURCE            *Resource,
605     UINT32                  Length,
606     UINT32                  Level);
607 
608 void
609 AcpiDmDmaDescriptor (
610     AML_RESOURCE            *Resource,
611     UINT32                  Length,
612     UINT32                  Level);
613 
614 void
615 AcpiDmIoDescriptor (
616     AML_RESOURCE            *Resource,
617     UINT32                  Length,
618     UINT32                  Level);
619 
620 void
621 AcpiDmFixedIoDescriptor (
622     AML_RESOURCE            *Resource,
623     UINT32                  Length,
624     UINT32                  Level);
625 
626 void
627 AcpiDmStartDependentDescriptor (
628     AML_RESOURCE            *Resource,
629     UINT32                  Length,
630     UINT32                  Level);
631 
632 void
633 AcpiDmEndDependentDescriptor (
634     AML_RESOURCE            *Resource,
635     UINT32                  Length,
636     UINT32                  Level);
637 
638 void
639 AcpiDmVendorSmallDescriptor (
640     AML_RESOURCE            *Resource,
641     UINT32                  Length,
642     UINT32                  Level);
643 
644 
645 /*
646  * dmutils
647  */
648 void
649 AcpiDmAddToExternalList (
650     char                    *Path,
651     UINT8                   Type,
652     UINT32                  Value);
653 
654 /*
655  * dmrestag
656  */
657 void
658 AcpiDmFindResources (
659     ACPI_PARSE_OBJECT       *Root);
660 
661 void
662 AcpiDmCheckResourceReference (
663     ACPI_PARSE_OBJECT       *Op,
664     ACPI_WALK_STATE         *WalkState);
665 
666 #endif  /* __ACDISASM_H__ */
667