1 /******************************************************************************
2 *
3 * Module Name: aslcompiler.h - common include file for iASL
4 *
5 *****************************************************************************/
6
7 /******************************************************************************
8 *
9 * 1. Copyright Notice
10 *
11 * Some or all of this work - Copyright (c) 1999 - 2022, Intel Corp.
12 * All rights reserved.
13 *
14 * 2. License
15 *
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
18 * you this software, covering your right to use that party's intellectual
19 * property rights.
20 *
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
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
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
27 *
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
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
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
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
36 *
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
39 *
40 * 3. Conditions
41 *
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
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
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
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
53 *
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
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
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
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
64 * make.
65 *
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
70 * distribution.
71 *
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
74 *
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
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
79 *
80 * 4. Disclaimer and Export Compliance
81 *
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
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 * PARTICULAR PURPOSE.
89 *
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
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
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
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 * LIMITED REMEDY.
98 *
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
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
103 * event Licensee exports any such software from the United States or
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
106 * compliance with all laws, regulations, orders, or other restrictions of the
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,
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,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
113 *
114 *****************************************************************************
115 *
116 * Alternatively, you may choose to be licensed under the terms of the
117 * following license:
118 *
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
121 * are met:
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
133 *
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145 *
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
149 *
150 *****************************************************************************/
151
152 #ifndef __ASLCOMPILER_H
153 #define __ASLCOMPILER_H
154
155 #include <contrib/dev/acpica/include/acpi.h>
156 #include <contrib/dev/acpica/include/accommon.h>
157 #include <contrib/dev/acpica/include/amlresrc.h>
158 #include <contrib/dev/acpica/include/acdebug.h>
159
160 /* Microsoft-specific */
161
162 #if (defined WIN32 || defined WIN64)
163
164 /* warn : used #pragma pack */
165 #pragma warning(disable:4103)
166
167 /* warn : named type definition in parentheses */
168 #pragma warning(disable:4115)
169 #endif
170
171 #include <stdio.h>
172 #include <stdlib.h>
173 #include <string.h>
174 #include <errno.h>
175 #include <ctype.h>
176
177 /* Compiler headers */
178
179 #include <contrib/dev/acpica/compiler/asldefine.h>
180 #include <contrib/dev/acpica/compiler/asltypes.h>
181 #include <contrib/dev/acpica/compiler/aslmessages.h>
182 #include <contrib/dev/acpica/compiler/aslglobal.h>
183 #include <contrib/dev/acpica/compiler/preprocess.h>
184 #include <contrib/dev/acpica/compiler/dtcompiler.h>
185
186
187 /*******************************************************************************
188 *
189 * Compiler prototypes
190 *
191 ******************************************************************************/
192
193 /*
194 * Main ASL parser - generated from flex/bison, lex/yacc, etc.
195 */
196 ACPI_PARSE_OBJECT *
197 AslDoError (
198 void);
199
200 int
201 AslCompilerlex(
202 void);
203
204 void
205 AslResetCurrentLineBuffer (
206 void);
207
208 void
209 AslInsertLineBuffer (
210 int SourceChar);
211
212 int
213 AslPopInputFileStack (
214 void);
215
216 void
217 AslPushInputFileStack (
218 FILE *InputFile,
219 char *Filename);
220
221 void
222 AslParserCleanup (
223 void);
224
225
226 /*
227 * aslstartup - entered from main()
228 */
229 void
230 AslInitializeGlobals (
231 void);
232
233 typedef
234 ACPI_STATUS (*ASL_PATHNAME_CALLBACK) (
235 char *);
236
237 ACPI_STATUS
238 AslDoOneFile (
239 char *Filename);
240
241 ACPI_STATUS
242 AslCheckForErrorExit (
243 void);
244
245
246 /*
247 * aslcompile - compile mainline
248 */
249 void
250 AslCompilerSignon (
251 UINT32 FileId);
252
253 void
254 AslCompilerFileHeader (
255 UINT32 FileId);
256
257 ACPI_STATUS
258 CmDoCompile (
259 void);
260
261 int
262 CmDoAslMiddleAndBackEnd (
263 void);
264
265 void
266 CmDoOutputFiles (
267 void);
268
269 int
270 CmCleanupAndExit (
271 void);
272
273 ACPI_STATUS
274 AslDoDisassembly (
275 void);
276
277
278 /*
279 * aslallocate - memory allocation
280 */
281 void *
282 UtLocalCalloc (
283 UINT32 Size);
284
285 void
286 UtExpandLineBuffers (
287 void);
288
289 void
290 UtReallocLineBuffers (
291 char **Buffer,
292 UINT32 OldSize,
293 UINT32 NewSize);
294
295 void
296 UtFreeLineBuffers (
297 void);
298
299
300 /*
301 * aslcache - local cache support
302 */
303 char *
304 UtLocalCacheCalloc (
305 UINT32 Length);
306
307 ACPI_PARSE_OBJECT *
308 UtParseOpCacheCalloc (
309 void);
310
311 DT_SUBTABLE *
312 UtSubtableCacheCalloc (
313 void);
314
315 DT_FIELD *
316 UtFieldCacheCalloc (
317 void);
318
319 void
320 UtDeleteLocalCaches (
321 void);
322
323
324 /*
325 * aslascii - ascii support
326 */
327 ACPI_STATUS
328 FlIsFileAsciiSource (
329 char *Filename,
330 BOOLEAN DisplayErrors);
331
332
333 /*
334 * aslwalks - semantic analysis and parse tree walks
335 */
336 ACPI_STATUS
337 AnOtherSemanticAnalysisWalkBegin (
338 ACPI_PARSE_OBJECT *Op,
339 UINT32 Level,
340 void *Context);
341
342 ACPI_STATUS
343 AnOtherSemanticAnalysisWalkEnd (
344 ACPI_PARSE_OBJECT *Op,
345 UINT32 Level,
346 void *Context);
347
348 ACPI_STATUS
349 AnOperandTypecheckWalkEnd (
350 ACPI_PARSE_OBJECT *Op,
351 UINT32 Level,
352 void *Context);
353
354 ACPI_STATUS
355 AnMethodTypingWalkEnd (
356 ACPI_PARSE_OBJECT *Op,
357 UINT32 Level,
358 void *Context);
359
360
361 /*
362 * aslmethod - Control method analysis walk
363 */
364 ACPI_STATUS
365 MtMethodAnalysisWalkBegin (
366 ACPI_PARSE_OBJECT *Op,
367 UINT32 Level,
368 void *Context);
369
370 ACPI_STATUS
371 MtMethodAnalysisWalkEnd (
372 ACPI_PARSE_OBJECT *Op,
373 UINT32 Level,
374 void *Context);
375
376 UINT32
377 MtProcessTypeOp (
378 ACPI_PARSE_OBJECT *TypeOp);
379
380 UINT8
381 MtProcessParameterTypeList (
382 ACPI_PARSE_OBJECT *ParamTypeOp,
383 UINT32 *TypeList);
384
385
386 /*
387 * aslbtypes - bitfield data types
388 */
389 UINT32
390 AnMapObjTypeToBtype (
391 ACPI_PARSE_OBJECT *Op);
392
393 UINT32
394 AnMapArgTypeToBtype (
395 UINT32 ArgType);
396
397 UINT32
398 AnGetBtype (
399 ACPI_PARSE_OBJECT *Op);
400
401 void
402 AnFormatBtype (
403 char *Buffer,
404 UINT32 Btype);
405
406
407 /*
408 * aslanalyze - Support functions for parse tree walks
409 */
410 void
411 AnCheckId (
412 ACPI_PARSE_OBJECT *Op,
413 ACPI_NAME Type);
414
415 /* Values for Type argument above */
416
417 #define ASL_TYPE_HID 0
418 #define ASL_TYPE_CID 1
419
420 BOOLEAN
421 AnIsInternalMethod (
422 ACPI_PARSE_OBJECT *Op);
423
424 UINT32
425 AnGetInternalMethodReturnType (
426 ACPI_PARSE_OBJECT *Op);
427
428 BOOLEAN
429 AnLastStatementIsReturn (
430 ACPI_PARSE_OBJECT *Op);
431
432 void
433 AnCheckMethodReturnValue (
434 ACPI_PARSE_OBJECT *Op,
435 const ACPI_OPCODE_INFO *OpInfo,
436 ACPI_PARSE_OBJECT *ArgOp,
437 UINT32 RequiredBtypes,
438 UINT32 ThisNodeBtype);
439
440 BOOLEAN
441 AnIsResultUsed (
442 ACPI_PARSE_OBJECT *Op);
443
444 void
445 ApCheckForGpeNameConflict (
446 ACPI_PARSE_OBJECT *Op);
447
448 void
449 ApCheckRegMethod (
450 ACPI_PARSE_OBJECT *Op);
451
452 BOOLEAN
453 ApFindNameInScope (
454 char *Name,
455 ACPI_PARSE_OBJECT *Op);
456
457 BOOLEAN
458 ApFindNameInDeviceTree (
459 char *Name,
460 ACPI_PARSE_OBJECT *Op);
461
462 /*
463 * aslerror - error handling/reporting
464 */
465 void
466 AslAbort (
467 void);
468
469 void
470 AslDualParseOpError (
471 UINT8 Level,
472 UINT16 MainMessageId,
473 ACPI_PARSE_OBJECT *MainOp,
474 char *MainMessage,
475 UINT16 SecondMessageId,
476 ACPI_PARSE_OBJECT *SecondOp,
477 char *SecondaryMessage);
478
479 void
480 AslError (
481 UINT8 Level,
482 UINT16 MessageId,
483 ACPI_PARSE_OBJECT *Op,
484 char *ExtraMessage);
485
486 void
487 AslCheckExpectedExceptions (
488 void);
489
490 ACPI_STATUS
491 AslLogExpectedException (
492 char *MessageIdString);
493
494 ACPI_STATUS
495 AslElevateException (
496 char *MessageIdString);
497
498 ACPI_STATUS
499 AslDisableException (
500 char *MessageIdString);
501
502 BOOLEAN
503 AslIsExceptionIgnored (
504 char *Filename,
505 UINT32 LineNumber,
506 UINT8 Level,
507 UINT16 MessageId);
508
509 void
510 AslLogExpectedExceptionByLine (
511 char *MessageIdString);
512
513 void
514 AslCoreSubsystemError (
515 ACPI_PARSE_OBJECT *Op,
516 ACPI_STATUS Status,
517 char *ExtraMessage,
518 BOOLEAN Abort);
519
520 int
521 AslCompilererror(
522 const char *s);
523
524 void
525 AslCommonError (
526 UINT8 Level,
527 UINT16 MessageId,
528 UINT32 CurrentLineNumber,
529 UINT32 LogicalLineNumber,
530 UINT32 LogicalByteOffset,
531 UINT32 Column,
532 char *Filename,
533 char *ExtraMessage);
534
535 void
536 AslCommonError2 (
537 UINT8 Level,
538 UINT16 MessageId,
539 UINT32 LineNumber,
540 UINT32 Column,
541 char *SourceLine,
542 char *Filename,
543 char *ExtraMessage);
544
545 void
546 AePrintException (
547 UINT32 FileId,
548 ASL_ERROR_MSG *Enode,
549 char *Header);
550
551 void
552 AePrintErrorLog (
553 UINT32 FileId);
554
555 void
556 AeClearErrorLog (
557 void);
558
559
560 /*
561 * asllisting - generate all "listing" type files
562 */
563 void
564 LsDoListings (
565 void);
566
567 void
568 LsWriteNodeToAsmListing (
569 ACPI_PARSE_OBJECT *Op);
570
571 void
572 LsWriteNode (
573 ACPI_PARSE_OBJECT *Op,
574 UINT32 FileId);
575
576 void
577 LsDumpParseTree (
578 void);
579
580
581 /*
582 * asllistsup - Listing file support utilities
583 */
584 void
585 LsDumpAscii (
586 UINT32 FileId,
587 UINT32 Count,
588 UINT8 *Buffer);
589
590 void
591 LsDumpAsciiInComment (
592 UINT32 FileId,
593 UINT32 Count,
594 UINT8 *Buffer);
595
596 void
597 LsCheckException (
598 UINT32 LineNumber,
599 UINT32 FileId);
600
601 void
602 LsFlushListingBuffer (
603 UINT32 FileId);
604
605 void
606 LsWriteListingHexBytes (
607 UINT8 *Buffer,
608 UINT32 Length,
609 UINT32 FileId);
610
611 void
612 LsWriteSourceLines (
613 UINT32 ToLineNumber,
614 UINT32 ToLogicalLineNumber,
615 UINT32 FileId);
616
617 UINT32
618 LsWriteOneSourceLine (
619 UINT32 FileId);
620
621 void
622 LsPushNode (
623 char *Filename);
624
625 ASL_LISTING_NODE *
626 LsPopNode (
627 void);
628
629
630 /*
631 * aslhex - generate all "hex" output files (C, ASM, ASL)
632 */
633 void
634 HxDoHexOutput (
635 void);
636
637
638 /*
639 * aslfold - constant folding
640 */
641 ACPI_STATUS
642 OpcAmlConstantWalk (
643 ACPI_PARSE_OBJECT *Op,
644 UINT32 Level,
645 void *Context);
646
647
648 /*
649 * aslmessages - exception strings
650 */
651 const char *
652 AeDecodeMessageId (
653 UINT16 MessageId);
654
655 const char *
656 AeDecodeExceptionLevel (
657 UINT8 Level);
658
659 UINT16
660 AeBuildFullExceptionCode (
661 UINT8 Level,
662 UINT16 MessageId);
663
664 /*
665 * asloffset - generate C offset file for BIOS support
666 */
667 ACPI_STATUS
668 LsAmlOffsetWalk (
669 ACPI_PARSE_OBJECT *Op,
670 UINT32 Level,
671 void *Context);
672
673 void
674 LsDoOffsetTableHeader (
675 UINT32 FileId);
676
677 void
678 LsDoOffsetTableFooter (
679 UINT32 FileId);
680
681
682 /*
683 * aslopcodes - generate AML opcodes
684 */
685 ACPI_STATUS
686 OpcAmlOpcodeWalk (
687 ACPI_PARSE_OBJECT *Op,
688 UINT32 Level,
689 void *Context);
690
691 ACPI_STATUS
692 OpcAmlOpcodeUpdateWalk (
693 ACPI_PARSE_OBJECT *Op,
694 UINT32 Level,
695 void *Context);
696
697 void
698 OpcGenerateAmlOpcode (
699 ACPI_PARSE_OBJECT *Op);
700
701 UINT32
702 OpcSetOptimalIntegerSize (
703 ACPI_PARSE_OBJECT *Op);
704
705 void
706 OpcGetIntegerWidth (
707 ACPI_PARSE_OBJECT *Op);
708
709
710 /*
711 * asloperands - generate AML operands for the AML opcodes
712 */
713 ACPI_PARSE_OBJECT *
714 UtGetArg (
715 ACPI_PARSE_OBJECT *Op,
716 UINT32 Argn);
717
718 void
719 OpnGenerateAmlOperands (
720 ACPI_PARSE_OBJECT *Op);
721
722 void
723 OpnDoPackage (
724 ACPI_PARSE_OBJECT *Op);
725
726
727 /*
728 * aslopt - optimization
729 */
730 void
731 OptOptimizeNamePath (
732 ACPI_PARSE_OBJECT *Op,
733 UINT32 Flags,
734 ACPI_WALK_STATE *WalkState,
735 char *AmlNameString,
736 ACPI_NAMESPACE_NODE *TargetNode);
737
738
739 /*
740 * aslpld - ToPLD macro support
741 */
742 void
743 OpcDoPld (
744 ACPI_PARSE_OBJECT *Op);
745
746
747 /*
748 * aslprintf - Printf/Fprintf macros
749 */
750 void
751 OpcDoPrintf (
752 ACPI_PARSE_OBJECT *Op);
753
754 void
755 OpcDoFprintf (
756 ACPI_PARSE_OBJECT *Op);
757
758
759 /*
760 * aslprune - parse tree pruner
761 */
762 void
763 AslPruneParseTree (
764 UINT32 PruneDepth,
765 UINT32 Type);
766
767
768 /*
769 * aslcodegen - code generation
770 */
771 void
772 CgGenerateAmlOutput (
773 void);
774
775 void
776 CgLocalWriteAmlData (
777 ACPI_PARSE_OBJECT *Op,
778 void *Buffer,
779 UINT32 Length);
780
781
782 /*
783 * aslfile
784 */
785 void
786 FlOpenFile (
787 UINT32 FileId,
788 char *Filename,
789 char *Mode);
790
791
792 /*
793 * asllength - calculate/adjust AML package lengths
794 */
795 ACPI_STATUS
796 LnPackageLengthWalk (
797 ACPI_PARSE_OBJECT *Op,
798 UINT32 Level,
799 void *Context);
800
801 ACPI_STATUS
802 LnInitLengthsWalk (
803 ACPI_PARSE_OBJECT *Op,
804 UINT32 Level,
805 void *Context);
806
807 void
808 CgGenerateAmlLengths (
809 ACPI_PARSE_OBJECT *Op);
810
811
812 /*
813 * aslmap - opcode mappings and reserved method names
814 */
815 ACPI_OBJECT_TYPE
816 AslMapNamedOpcodeToDataType (
817 UINT16 Opcode);
818
819
820 /*
821 * aslpredef - ACPI predefined names support
822 */
823 BOOLEAN
824 ApCheckForPredefinedMethod (
825 ACPI_PARSE_OBJECT *Op,
826 ASL_METHOD_INFO *MethodInfo);
827
828 void
829 ApCheckPredefinedReturnValue (
830 ACPI_PARSE_OBJECT *Op,
831 ASL_METHOD_INFO *MethodInfo);
832
833 UINT32
834 ApCheckForPredefinedName (
835 ACPI_PARSE_OBJECT *Op,
836 char *Name);
837
838 void
839 ApCheckForPredefinedObject (
840 ACPI_PARSE_OBJECT *Op,
841 char *Name);
842
843 ACPI_STATUS
844 ApCheckObjectType (
845 const char *PredefinedName,
846 ACPI_PARSE_OBJECT *Op,
847 UINT32 ExpectedBtypes,
848 UINT32 PackageIndex);
849
850 void
851 ApDisplayReservedNames (
852 void);
853
854
855 /*
856 * aslprepkg - ACPI predefined names support for packages
857 */
858 void
859 ApCheckPackage (
860 ACPI_PARSE_OBJECT *ParentOp,
861 const ACPI_PREDEFINED_INFO *Predefined);
862
863
864 /*
865 * asltransform - parse tree transformations
866 */
867 ACPI_STATUS
868 TrAmlTransformWalkBegin (
869 ACPI_PARSE_OBJECT *Op,
870 UINT32 Level,
871 void *Context);
872
873 ACPI_STATUS
874 TrAmlTransformWalkEnd (
875 ACPI_PARSE_OBJECT *Op,
876 UINT32 Level,
877 void *Context);
878
879
880 /*
881 * aslexternal - External opcode support
882 */
883 ACPI_STATUS
884 ExAmlExternalWalkBegin (
885 ACPI_PARSE_OBJECT *Op,
886 UINT32 Level,
887 void *Context);
888
889 ACPI_STATUS
890 ExAmlExternalWalkEnd (
891 ACPI_PARSE_OBJECT *Op,
892 UINT32 Level,
893 void *Context);
894
895 void
896 ExDoExternal (
897 ACPI_PARSE_OBJECT *Op);
898
899 /* Values for "Visitation" parameter above */
900
901 #define ASL_WALK_VISIT_DOWNWARD 0x01
902 #define ASL_WALK_VISIT_UPWARD 0x02
903 #define ASL_WALK_VISIT_DB_SEPARATELY 0x04
904 #define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD)
905
906
907 /*
908 * aslparseop.c - Parse op create/allocate/cache
909 */
910 ACPI_PARSE_OBJECT *
911 TrCreateOp (
912 UINT32 ParseOpcode,
913 UINT32 NumChildren,
914 ...);
915
916 ACPI_PARSE_OBJECT *
917 TrCreateLeafOp (
918 UINT32 ParseOpcode);
919
920 ACPI_PARSE_OBJECT *
921 TrCreateNullTargetOp (
922 void);
923
924 ACPI_PARSE_OBJECT *
925 TrCreateAssignmentOp (
926 ACPI_PARSE_OBJECT *Target,
927 ACPI_PARSE_OBJECT *Source);
928
929 ACPI_PARSE_OBJECT *
930 TrCreateTargetOp (
931 ACPI_PARSE_OBJECT *OriginalOp,
932 ACPI_PARSE_OBJECT *ParentOp);
933
934 ACPI_PARSE_OBJECT *
935 TrCreateValuedLeafOp (
936 UINT32 ParseOpcode,
937 UINT64 Value);
938
939 ACPI_PARSE_OBJECT *
940 TrCreateConstantLeafOp (
941 UINT32 ParseOpcode);
942
943 ACPI_PARSE_OBJECT *
944 TrAllocateOp (
945 UINT32 ParseOpcode);
946
947 void
948 TrPrintOpFlags (
949 UINT32 Flags,
950 UINT32 OutputLevel);
951
952
953 /*
954 * asltree.c - Parse tree management
955 */
956 void
957 TrSetOpParent (
958 ACPI_PARSE_OBJECT *Op,
959 ACPI_PARSE_OBJECT *ParentOp);
960
961 ACPI_PARSE_OBJECT *
962 TrSetOpIntegerValue (
963 UINT32 ParseOpcode,
964 ACPI_PARSE_OBJECT *Op);
965
966 void
967 TrSetOpEndLineNumber (
968 ACPI_PARSE_OBJECT *Op);
969
970 void
971 TrSetOpCurrentFilename (
972 ACPI_PARSE_OBJECT *Op);
973
974 void
975 TrSetOpIntegerWidth (
976 ACPI_PARSE_OBJECT *TableSignature,
977 ACPI_PARSE_OBJECT *Revision);
978
979 ACPI_PARSE_OBJECT *
980 TrLinkOpChildren (
981 ACPI_PARSE_OBJECT *Op,
982 UINT32 NumChildren,
983 ...);
984
985 ACPI_PARSE_OBJECT *
986 TrLinkPeerOp (
987 ACPI_PARSE_OBJECT *Op1,
988 ACPI_PARSE_OBJECT *Op2);
989
990 ACPI_PARSE_OBJECT *
991 TrLinkChildOp (
992 ACPI_PARSE_OBJECT *Op1,
993 ACPI_PARSE_OBJECT *Op2);
994
995 ACPI_PARSE_OBJECT *
996 TrSetOpFlags (
997 ACPI_PARSE_OBJECT *Op,
998 UINT32 Flags);
999
1000 ACPI_PARSE_OBJECT *
1001 TrSetOpAmlLength (
1002 ACPI_PARSE_OBJECT *Op,
1003 UINT32 Length);
1004
1005 ACPI_PARSE_OBJECT *
1006 TrLinkPeerOps (
1007 UINT32 NumPeers,
1008 ...);
1009
1010 ACPI_STATUS
1011 TrWalkParseTree (
1012 ACPI_PARSE_OBJECT *Op,
1013 UINT32 Visitation,
1014 ASL_WALK_CALLBACK DescendingCallback,
1015 ASL_WALK_CALLBACK AscendingCallback,
1016 void *Context);
1017
1018
1019 /*
1020 * aslfiles - File I/O support
1021 */
1022 void
1023 FlAddIncludeDirectory (
1024 char *Dir);
1025
1026 char *
1027 FlMergePathnames (
1028 char *PrefixDir,
1029 char *FilePathname);
1030
1031 void
1032 FlOpenIncludeFile (
1033 ACPI_PARSE_OBJECT *Op);
1034
1035 void
1036 FlFileError (
1037 UINT32 FileId,
1038 UINT8 ErrorId);
1039
1040 UINT32
1041 FlGetFileSize (
1042 UINT32 FileId);
1043
1044 ACPI_STATUS
1045 FlReadFile (
1046 UINT32 FileId,
1047 void *Buffer,
1048 UINT32 Length);
1049
1050 void
1051 FlWriteFile (
1052 UINT32 FileId,
1053 void *Buffer,
1054 UINT32 Length);
1055
1056 void
1057 FlSeekFile (
1058 UINT32 FileId,
1059 long Offset);
1060
1061 void
1062 FlSeekFileSet (
1063 UINT32 FileId,
1064 long Offset);
1065
1066 void
1067 FlCloseFile (
1068 UINT32 FileId);
1069
1070 ACPI_PRINTF_LIKE (2)
1071 void
1072 FlPrintFile (
1073 UINT32 FileId,
1074 char *Format,
1075 ...);
1076
1077 void
1078 FlDeleteFile (
1079 UINT32 FileId);
1080
1081 void
1082 FlSetLineNumber (
1083 UINT32 LineNumber);
1084
1085 void
1086 FlSetFilename (
1087 char *Filename);
1088
1089 ACPI_STATUS
1090 FlOpenInputFile (
1091 char *InputFilename);
1092
1093 ACPI_STATUS
1094 FlOpenAmlOutputFile (
1095 char *InputFilename);
1096
1097 ACPI_STATUS
1098 FlOpenMiscOutputFiles (
1099 char *InputFilename);
1100
1101 ACPI_STATUS
1102 FlInitOneFile (
1103 char *InputFilename);
1104
1105 ASL_FILE_SWITCH_STATUS
1106 FlSwitchFileSet (
1107 char *InputFilename);
1108
1109 FILE *
1110 FlGetFileHandle (
1111 UINT32 OutFileId,
1112 UINT32 InFileId,
1113 char *Filename);
1114
1115 ASL_GLOBAL_FILE_NODE *
1116 FlGetFileNode (
1117 UINT32 FileId,
1118 char *Filename);
1119
1120 ASL_GLOBAL_FILE_NODE *
1121 FlGetCurrentFileNode (
1122 void);
1123
1124
1125 /*
1126 * aslhwmap - hardware map summary
1127 */
1128 void
1129 MpEmitMappingInfo (
1130 void);
1131
1132
1133 /*
1134 * asload - load namespace in prep for cross reference
1135 */
1136 ACPI_STATUS
1137 LdLoadNamespace (
1138 ACPI_PARSE_OBJECT *RootOp);
1139
1140 /*
1141 * asllookup - namespace lookup functions
1142 */
1143 void
1144 LkFindUnreferencedObjects (
1145 void);
1146
1147
1148 /*
1149 * aslhelp - help screens
1150 */
1151 void
1152 Usage (
1153 void);
1154
1155 void
1156 AslFilenameHelp (
1157 void);
1158
1159 void
1160 AslDisassemblyHelp (
1161 void);
1162
1163
1164 /*
1165 * aslnamesp - namespace output file generation
1166 */
1167 ACPI_STATUS
1168 NsDisplayNamespace (
1169 void);
1170
1171 void
1172 NsSetupNamespaceListing (
1173 void *Handle);
1174
1175
1176 /*
1177 * asloptions - command line processing
1178 */
1179 int
1180 AslCommandLine (
1181 int argc,
1182 char **argv);
1183
1184
1185 /*
1186 * aslxref - namespace cross reference
1187 */
1188 ACPI_STATUS
1189 XfCrossReferenceNamespace (
1190 void);
1191
1192
1193 /*
1194 * aslxrefout
1195 */
1196 void
1197 OtPrintHeaders (
1198 char *Message);
1199
1200 void
1201 OtCreateXrefFile (
1202 void);
1203
1204 void
1205 OtXrefWalkPart1 (
1206 ACPI_PARSE_OBJECT *Op,
1207 UINT32 Level,
1208 ASL_METHOD_INFO *MethodInfo);
1209
1210
1211 /*
1212 * aslutils - common compiler utilities
1213 */
1214 ACPI_PRINTF_LIKE(2)
1215 void
1216 DbgPrint (
1217 UINT32 Type,
1218 char *Format,
1219 ...);
1220
1221 /* Type values for above */
1222
1223 #define ASL_DEBUG_OUTPUT 0
1224 #define ASL_PARSE_OUTPUT 1
1225 #define ASL_TREE_OUTPUT 2
1226
1227 BOOLEAN
1228 UtIsIdInteger (
1229 UINT8 *Target);
1230
1231 UINT8
1232 UtIsBigEndianMachine (
1233 void);
1234
1235 BOOLEAN
1236 UtQueryForOverwrite (
1237 char *Pathname);
1238
1239 void
1240 UtDumpStringOp (
1241 ACPI_PARSE_OBJECT *Op,
1242 UINT32 Level);
1243
1244 void
1245 UtDumpIntegerOp (
1246 ACPI_PARSE_OBJECT *Op,
1247 UINT32 Level,
1248 UINT32 IntegerLength);
1249
1250 void
1251 UtDumpBasicOp (
1252 ACPI_PARSE_OBJECT *Op,
1253 UINT32 Level);
1254
1255 ACPI_NAMESPACE_NODE *
1256 UtGetParentMethodNode (
1257 ACPI_NAMESPACE_NODE *Node);
1258
1259 ACPI_PARSE_OBJECT *
1260 UtGetParentMethodOp (
1261 ACPI_PARSE_OBJECT *Op);
1262
1263 BOOLEAN
1264 UtNodeIsDescendantOf (
1265 ACPI_NAMESPACE_NODE *Node1,
1266 ACPI_NAMESPACE_NODE *Node2);
1267
1268 void
1269 UtDisplaySupportedTables (
1270 void);
1271
1272 void
1273 UtDisplayConstantOpcodes (
1274 void);
1275
1276 UINT8
1277 UtBeginEvent (
1278 char *Name);
1279
1280 void
1281 UtEndEvent (
1282 UINT8 Event);
1283
1284 void
1285 UtDisplaySummary (
1286 UINT32 FileId);
1287
1288 void
1289 UtDisplayOneSummary (
1290 UINT32 FileId,
1291 BOOLEAN DisplayErrorSummary);
1292
1293 void
1294 UtConvertByteToHex (
1295 UINT8 RawByte,
1296 UINT8 *Buffer);
1297
1298 void
1299 UtConvertByteToAsmHex (
1300 UINT8 RawByte,
1301 UINT8 *Buffer);
1302
1303 char *
1304 UtGetOpName (
1305 UINT32 ParseOpcode);
1306
1307 void
1308 UtSetParseOpName (
1309 ACPI_PARSE_OBJECT *Op);
1310
1311 ACPI_STATUS
1312 UtInternalizeName (
1313 char *ExternalName,
1314 char **ConvertedName);
1315
1316 BOOLEAN
1317 UtNameContainsAllPrefix (
1318 ACPI_PARSE_OBJECT *Op);
1319
1320 void
1321 UtAttachNamepathToOwner (
1322 ACPI_PARSE_OBJECT *Op,
1323 ACPI_PARSE_OBJECT *NameNode);
1324
1325 ACPI_PARSE_OBJECT *
1326 UtCheckIntegerRange (
1327 ACPI_PARSE_OBJECT *Op,
1328 UINT32 LowValue,
1329 UINT32 HighValue);
1330
1331 UINT64
1332 UtDoConstant (
1333 char *String);
1334
1335 char *
1336 AcpiUtStrdup (
1337 char *String);
1338
1339 char *
1340 AcpiUtStrcat (
1341 char *String1,
1342 char *String2);
1343
1344
1345 /*
1346 * asluuid - UUID support
1347 */
1348 ACPI_STATUS
1349 AuValidateUuid (
1350 char *InString);
1351
1352 ACPI_STATUS
1353 AuConvertUuidToString (
1354 char *UuIdBuffer,
1355 char *OutString);
1356
1357
1358 /*
1359 * aslresource - Resource template generation utilities
1360 */
1361 void
1362 RsSmallAddressCheck (
1363 UINT8 Type,
1364 UINT32 Minimum,
1365 UINT32 Maximum,
1366 UINT32 Length,
1367 UINT32 Alignment,
1368 ACPI_PARSE_OBJECT *MinOp,
1369 ACPI_PARSE_OBJECT *MaxOp,
1370 ACPI_PARSE_OBJECT *LengthOp,
1371 ACPI_PARSE_OBJECT *AlignOp,
1372 ACPI_PARSE_OBJECT *Op);
1373
1374 void
1375 RsLargeAddressCheck (
1376 UINT64 Minimum,
1377 UINT64 Maximum,
1378 UINT64 Length,
1379 UINT64 Granularity,
1380 UINT8 Flags,
1381 ACPI_PARSE_OBJECT *MinOp,
1382 ACPI_PARSE_OBJECT *MaxOp,
1383 ACPI_PARSE_OBJECT *LengthOp,
1384 ACPI_PARSE_OBJECT *GranOp,
1385 ACPI_PARSE_OBJECT *Op);
1386
1387 UINT16
1388 RsGetStringDataLength (
1389 ACPI_PARSE_OBJECT *InitializerOp);
1390
1391 ASL_RESOURCE_NODE *
1392 RsAllocateResourceNode (
1393 UINT32 Size);
1394
1395 void
1396 RsCreateResourceField (
1397 ACPI_PARSE_OBJECT *Op,
1398 char *Name,
1399 UINT32 ByteOffset,
1400 UINT32 BitOffset,
1401 UINT32 BitLength);
1402
1403 void
1404 RsSetFlagBits (
1405 UINT8 *Flags,
1406 ACPI_PARSE_OBJECT *Op,
1407 UINT8 Position,
1408 UINT8 DefaultBit);
1409
1410 void
1411 RsSetFlagBits16 (
1412 UINT16 *Flags,
1413 ACPI_PARSE_OBJECT *Op,
1414 UINT8 Position,
1415 UINT8 DefaultBit);
1416
1417 ACPI_PARSE_OBJECT *
1418 RsCompleteNodeAndGetNext (
1419 ACPI_PARSE_OBJECT *Op);
1420
1421 void
1422 RsCheckListForDuplicates (
1423 ACPI_PARSE_OBJECT *Op);
1424
1425 ASL_RESOURCE_NODE *
1426 RsDoOneResourceDescriptor (
1427 ASL_RESOURCE_INFO *Info,
1428 UINT8 *State);
1429
1430 /* Values for State above */
1431
1432 #define ACPI_RSTATE_NORMAL 0
1433 #define ACPI_RSTATE_START_DEPENDENT 1
1434 #define ACPI_RSTATE_DEPENDENT_LIST 2
1435
1436 UINT32
1437 RsLinkDescriptorChain (
1438 ASL_RESOURCE_NODE **PreviousRnode,
1439 ASL_RESOURCE_NODE *Rnode);
1440
1441 void
1442 RsDoResourceTemplate (
1443 ACPI_PARSE_OBJECT *Op);
1444
1445
1446 /*
1447 * aslrestype1 - Miscellaneous Small descriptors
1448 */
1449 ASL_RESOURCE_NODE *
1450 RsDoEndTagDescriptor (
1451 ASL_RESOURCE_INFO *Info);
1452
1453 ASL_RESOURCE_NODE *
1454 RsDoEndDependentDescriptor (
1455 ASL_RESOURCE_INFO *Info);
1456
1457 ASL_RESOURCE_NODE *
1458 RsDoMemory24Descriptor (
1459 ASL_RESOURCE_INFO *Info);
1460
1461 ASL_RESOURCE_NODE *
1462 RsDoMemory32Descriptor (
1463 ASL_RESOURCE_INFO *Info);
1464
1465 ASL_RESOURCE_NODE *
1466 RsDoMemory32FixedDescriptor (
1467 ASL_RESOURCE_INFO *Info);
1468
1469 ASL_RESOURCE_NODE *
1470 RsDoStartDependentDescriptor (
1471 ASL_RESOURCE_INFO *Info);
1472
1473 ASL_RESOURCE_NODE *
1474 RsDoStartDependentNoPriDescriptor (
1475 ASL_RESOURCE_INFO *Info);
1476
1477 ASL_RESOURCE_NODE *
1478 RsDoVendorSmallDescriptor (
1479 ASL_RESOURCE_INFO *Info);
1480
1481
1482 /*
1483 * aslrestype1i - I/O-related Small descriptors
1484 */
1485 ASL_RESOURCE_NODE *
1486 RsDoDmaDescriptor (
1487 ASL_RESOURCE_INFO *Info);
1488
1489 ASL_RESOURCE_NODE *
1490 RsDoFixedDmaDescriptor (
1491 ASL_RESOURCE_INFO *Info);
1492
1493 ASL_RESOURCE_NODE *
1494 RsDoFixedIoDescriptor (
1495 ASL_RESOURCE_INFO *Info);
1496
1497 ASL_RESOURCE_NODE *
1498 RsDoIoDescriptor (
1499 ASL_RESOURCE_INFO *Info);
1500
1501 ASL_RESOURCE_NODE *
1502 RsDoIrqDescriptor (
1503 ASL_RESOURCE_INFO *Info);
1504
1505 ASL_RESOURCE_NODE *
1506 RsDoIrqNoFlagsDescriptor (
1507 ASL_RESOURCE_INFO *Info);
1508
1509
1510 /*
1511 * aslrestype2 - Large resource descriptors
1512 */
1513 ASL_RESOURCE_NODE *
1514 RsDoInterruptDescriptor (
1515 ASL_RESOURCE_INFO *Info);
1516
1517 ASL_RESOURCE_NODE *
1518 RsDoVendorLargeDescriptor (
1519 ASL_RESOURCE_INFO *Info);
1520
1521 ASL_RESOURCE_NODE *
1522 RsDoGeneralRegisterDescriptor (
1523 ASL_RESOURCE_INFO *Info);
1524
1525 ASL_RESOURCE_NODE *
1526 RsDoGpioIntDescriptor (
1527 ASL_RESOURCE_INFO *Info);
1528
1529 ASL_RESOURCE_NODE *
1530 RsDoGpioIoDescriptor (
1531 ASL_RESOURCE_INFO *Info);
1532
1533 ASL_RESOURCE_NODE *
1534 RsDoI2cSerialBusDescriptor (
1535 ASL_RESOURCE_INFO *Info);
1536
1537 ASL_RESOURCE_NODE *
1538 RsDoSpiSerialBusDescriptor (
1539 ASL_RESOURCE_INFO *Info);
1540
1541 ASL_RESOURCE_NODE *
1542 RsDoUartSerialBusDescriptor (
1543 ASL_RESOURCE_INFO *Info);
1544
1545 ASL_RESOURCE_NODE *
1546 RsDoCsi2SerialBusDescriptor (
1547 ASL_RESOURCE_INFO *Info);
1548
1549 ASL_RESOURCE_NODE *
1550 RsDoPinFunctionDescriptor (
1551 ASL_RESOURCE_INFO *Info);
1552
1553 ASL_RESOURCE_NODE *
1554 RsDoPinConfigDescriptor (
1555 ASL_RESOURCE_INFO *Info);
1556
1557 ASL_RESOURCE_NODE *
1558 RsDoPinGroupDescriptor (
1559 ASL_RESOURCE_INFO *Info);
1560
1561 ASL_RESOURCE_NODE *
1562 RsDoPinGroupFunctionDescriptor (
1563 ASL_RESOURCE_INFO *Info);
1564
1565 ASL_RESOURCE_NODE *
1566 RsDoPinGroupConfigDescriptor (
1567 ASL_RESOURCE_INFO *Info);
1568
1569
1570 /*
1571 * aslrestype2d - DWord address descriptors
1572 */
1573 ASL_RESOURCE_NODE *
1574 RsDoDwordIoDescriptor (
1575 ASL_RESOURCE_INFO *Info);
1576
1577 ASL_RESOURCE_NODE *
1578 RsDoDwordMemoryDescriptor (
1579 ASL_RESOURCE_INFO *Info);
1580
1581 ASL_RESOURCE_NODE *
1582 RsDoDwordSpaceDescriptor (
1583 ASL_RESOURCE_INFO *Info);
1584
1585
1586 /*
1587 * aslrestype2e - Extended address descriptors
1588 */
1589 ASL_RESOURCE_NODE *
1590 RsDoExtendedIoDescriptor (
1591 ASL_RESOURCE_INFO *Info);
1592
1593 ASL_RESOURCE_NODE *
1594 RsDoExtendedMemoryDescriptor (
1595 ASL_RESOURCE_INFO *Info);
1596
1597 ASL_RESOURCE_NODE *
1598 RsDoExtendedSpaceDescriptor (
1599 ASL_RESOURCE_INFO *Info);
1600
1601
1602 /*
1603 * aslrestype2q - QWord address descriptors
1604 */
1605 ASL_RESOURCE_NODE *
1606 RsDoQwordIoDescriptor (
1607 ASL_RESOURCE_INFO *Info);
1608
1609 ASL_RESOURCE_NODE *
1610 RsDoQwordMemoryDescriptor (
1611 ASL_RESOURCE_INFO *Info);
1612
1613 ASL_RESOURCE_NODE *
1614 RsDoQwordSpaceDescriptor (
1615 ASL_RESOURCE_INFO *Info);
1616
1617
1618 /*
1619 * aslrestype2w - Word address descriptors
1620 */
1621 ASL_RESOURCE_NODE *
1622 RsDoWordIoDescriptor (
1623 ASL_RESOURCE_INFO *Info);
1624
1625 ASL_RESOURCE_NODE *
1626 RsDoWordSpaceDescriptor (
1627 ASL_RESOURCE_INFO *Info);
1628
1629 ASL_RESOURCE_NODE *
1630 RsDoWordBusNumberDescriptor (
1631 ASL_RESOURCE_INFO *Info);
1632
1633
1634 /*
1635 * Entry to data table compiler subsystem
1636 */
1637 ACPI_STATUS
1638 DtDoCompile(
1639 void);
1640
1641 ACPI_STATUS
1642 DtCreateTemplates (
1643 char **argv);
1644
1645
1646 /*
1647 * ASL/ASL+ converter debug
1648 */
1649 ACPI_PRINTF_LIKE (1)
1650 void
1651 CvDbgPrint (
1652 char *Fmt,
1653 ...);
1654
1655
1656 #endif /* __ASLCOMPILER_H */
Cache object: ae5b988d84ff431b447d94a3c2b4181f
|