xref: /freebsd/sys/contrib/dev/acpica/compiler/aslcompiler.h (revision 59e2ff550c448126b988150ce800cdf73bb5103e)
1 /******************************************************************************
2  *
3  * Module Name: aslcompiler.h - common include file for iASL
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2015, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #ifndef __ASLCOMPILER_H
45 #define __ASLCOMPILER_H
46 
47 #include <contrib/dev/acpica/include/acpi.h>
48 #include <contrib/dev/acpica/include/accommon.h>
49 #include <contrib/dev/acpica/include/amlresrc.h>
50 #include <contrib/dev/acpica/include/acdebug.h>
51 
52 /* Microsoft-specific */
53 
54 #if (defined WIN32 || defined WIN64)
55 
56 /* warn : used #pragma pack */
57 #pragma warning(disable:4103)
58 
59 /* warn : named type definition in parentheses */
60 #pragma warning(disable:4115)
61 #endif
62 
63 #include <stdio.h>
64 #include <stdlib.h>
65 #include <stdarg.h>
66 #include <string.h>
67 #include <errno.h>
68 #include <ctype.h>
69 
70 /* Compiler headers */
71 
72 #include <contrib/dev/acpica/compiler/asldefine.h>
73 #include <contrib/dev/acpica/compiler/asltypes.h>
74 #include <contrib/dev/acpica/compiler/aslmessages.h>
75 #include <contrib/dev/acpica/compiler/aslglobal.h>
76 #include <contrib/dev/acpica/compiler/preprocess.h>
77 
78 
79 /*******************************************************************************
80  *
81  * Compiler prototypes
82  *
83  ******************************************************************************/
84 
85 /*
86  * Main ASL parser - generated from flex/bison, lex/yacc, etc.
87  */
88 ACPI_PARSE_OBJECT *
89 AslDoError (
90     void);
91 
92 int
93 AslCompilerlex(
94     void);
95 
96 void
97 AslResetCurrentLineBuffer (
98     void);
99 
100 void
101 AslInsertLineBuffer (
102     int                     SourceChar);
103 
104 int
105 AslPopInputFileStack (
106     void);
107 
108 void
109 AslPushInputFileStack (
110     FILE                    *InputFile,
111     char                    *Filename);
112 
113 void
114 AslParserCleanup (
115     void);
116 
117 
118 /*
119  * aslstartup - entered from main()
120  */
121 void
122 AslInitializeGlobals (
123     void);
124 
125 typedef
126 ACPI_STATUS (*ASL_PATHNAME_CALLBACK) (
127     char *);
128 
129 ACPI_STATUS
130 AslDoOneFile (
131     char                    *Filename);
132 
133 ACPI_STATUS
134 AslCheckForErrorExit (
135     void);
136 
137 
138 /*
139  * aslcompile - compile mainline
140  */
141 void
142 AslCompilerSignon (
143     UINT32                  FileId);
144 
145 void
146 AslCompilerFileHeader (
147     UINT32                  FileId);
148 
149 int
150 CmDoCompile (
151     void);
152 
153 void
154 CmDoOutputFiles (
155     void);
156 
157 void
158 CmCleanupAndExit (
159     void);
160 
161 void
162 CmDeleteCaches (
163     void);
164 
165 
166 /*
167  * aslascii - ascii support
168  */
169 ACPI_STATUS
170 FlCheckForAcpiTable (
171     FILE                    *Handle);
172 
173 ACPI_STATUS
174 FlCheckForAscii (
175     char                    *Filename,
176     BOOLEAN                 DisplayErrors);
177 
178 
179 /*
180  * aslwalks - semantic analysis and parse tree walks
181  */
182 ACPI_STATUS
183 AnOtherSemanticAnalysisWalkBegin (
184     ACPI_PARSE_OBJECT       *Op,
185     UINT32                  Level,
186     void                    *Context);
187 
188 ACPI_STATUS
189 AnOtherSemanticAnalysisWalkEnd (
190     ACPI_PARSE_OBJECT       *Op,
191     UINT32                  Level,
192     void                    *Context);
193 
194 ACPI_STATUS
195 AnOperandTypecheckWalkEnd (
196     ACPI_PARSE_OBJECT       *Op,
197     UINT32                  Level,
198     void                    *Context);
199 
200 ACPI_STATUS
201 AnMethodTypingWalkEnd (
202     ACPI_PARSE_OBJECT       *Op,
203     UINT32                  Level,
204     void                    *Context);
205 
206 
207 /*
208  * aslmethod - Control method analysis walk
209  */
210 ACPI_STATUS
211 MtMethodAnalysisWalkBegin (
212     ACPI_PARSE_OBJECT       *Op,
213     UINT32                  Level,
214     void                    *Context);
215 
216 ACPI_STATUS
217 MtMethodAnalysisWalkEnd (
218     ACPI_PARSE_OBJECT       *Op,
219     UINT32                  Level,
220     void                    *Context);
221 
222 
223 /*
224  * aslbtypes - bitfield data types
225  */
226 UINT32
227 AnMapObjTypeToBtype (
228     ACPI_PARSE_OBJECT       *Op);
229 
230 UINT32
231 AnMapArgTypeToBtype (
232     UINT32                  ArgType);
233 
234 UINT32
235 AnGetBtype (
236     ACPI_PARSE_OBJECT       *Op);
237 
238 void
239 AnFormatBtype (
240     char                    *Buffer,
241     UINT32                  Btype);
242 
243 
244 /*
245  * aslanalyze - Support functions for parse tree walks
246  */
247 void
248 AnCheckId (
249     ACPI_PARSE_OBJECT       *Op,
250     ACPI_NAME               Type);
251 
252 /* Values for Type argument above */
253 
254 #define ASL_TYPE_HID        0
255 #define ASL_TYPE_CID        1
256 
257 BOOLEAN
258 AnIsInternalMethod (
259     ACPI_PARSE_OBJECT       *Op);
260 
261 UINT32
262 AnGetInternalMethodReturnType (
263     ACPI_PARSE_OBJECT       *Op);
264 
265 BOOLEAN
266 AnLastStatementIsReturn (
267     ACPI_PARSE_OBJECT       *Op);
268 
269 void
270 AnCheckMethodReturnValue (
271     ACPI_PARSE_OBJECT       *Op,
272     const ACPI_OPCODE_INFO  *OpInfo,
273     ACPI_PARSE_OBJECT       *ArgOp,
274     UINT32                  RequiredBtypes,
275     UINT32                  ThisNodeBtype);
276 
277 BOOLEAN
278 AnIsResultUsed (
279     ACPI_PARSE_OBJECT       *Op);
280 
281 void
282 ApCheckForGpeNameConflict (
283     ACPI_PARSE_OBJECT       *Op);
284 
285 void
286 ApCheckRegMethod (
287     ACPI_PARSE_OBJECT       *Op);
288 
289 BOOLEAN
290 ApFindNameInScope (
291     char                    *Name,
292     ACPI_PARSE_OBJECT       *Op);
293 
294 
295 /*
296  * aslerror - error handling/reporting
297  */
298 void
299 AslAbort (
300     void);
301 
302 void
303 AslError (
304     UINT8                   Level,
305     UINT16                  MessageId,
306     ACPI_PARSE_OBJECT       *Op,
307     char                    *ExtraMessage);
308 
309 ACPI_STATUS
310 AslDisableException (
311     char                    *MessageIdString);
312 
313 BOOLEAN
314 AslIsExceptionDisabled (
315     UINT8                   Level,
316     UINT16                  MessageId);
317 
318 void
319 AslCoreSubsystemError (
320     ACPI_PARSE_OBJECT       *Op,
321     ACPI_STATUS             Status,
322     char                    *ExtraMessage,
323     BOOLEAN                 Abort);
324 
325 int
326 AslCompilererror(
327     const char              *s);
328 
329 void
330 AslCommonError (
331     UINT8                   Level,
332     UINT16                  MessageId,
333     UINT32                  CurrentLineNumber,
334     UINT32                  LogicalLineNumber,
335     UINT32                  LogicalByteOffset,
336     UINT32                  Column,
337     char                    *Filename,
338     char                    *ExtraMessage);
339 
340 void
341 AslCommonError2 (
342     UINT8                   Level,
343     UINT16                  MessageId,
344     UINT32                  LineNumber,
345     UINT32                  Column,
346     char                    *SourceLine,
347     char                    *Filename,
348     char                    *ExtraMessage);
349 
350 void
351 AePrintException (
352     UINT32                  FileId,
353     ASL_ERROR_MSG           *Enode,
354     char                    *Header);
355 
356 void
357 AePrintErrorLog (
358     UINT32                  FileId);
359 
360 void
361 AeClearErrorLog (
362     void);
363 
364 
365 /*
366  * asllisting - generate all "listing" type files
367  */
368 void
369 LsDoListings (
370     void);
371 
372 void
373 LsWriteNodeToAsmListing (
374     ACPI_PARSE_OBJECT       *Op);
375 
376 void
377 LsWriteNode (
378     ACPI_PARSE_OBJECT       *Op,
379     UINT32                  FileId);
380 
381 void
382 LsDumpParseTree (
383     void);
384 
385 
386 /*
387  * asllistsup - Listing file support utilities
388  */
389 void
390 LsDumpAscii (
391     UINT32                  FileId,
392     UINT32                  Count,
393     UINT8                   *Buffer);
394 
395 void
396 LsDumpAsciiInComment (
397     UINT32                  FileId,
398     UINT32                  Count,
399     UINT8                   *Buffer);
400 
401 void
402 LsCheckException (
403     UINT32                  LineNumber,
404     UINT32                  FileId);
405 
406 void
407 LsFlushListingBuffer (
408     UINT32                  FileId);
409 
410 void
411 LsWriteListingHexBytes (
412     UINT8                   *Buffer,
413     UINT32                  Length,
414     UINT32                  FileId);
415 
416 void
417 LsWriteSourceLines (
418     UINT32                  ToLineNumber,
419     UINT32                  ToLogicalLineNumber,
420     UINT32                  FileId);
421 
422 UINT32
423 LsWriteOneSourceLine (
424     UINT32                  FileId);
425 
426 void
427 LsPushNode (
428     char                    *Filename);
429 
430 ASL_LISTING_NODE *
431 LsPopNode (
432     void);
433 
434 
435 /*
436  * aslhex - generate all "hex" output files (C, ASM, ASL)
437  */
438 void
439 HxDoHexOutput (
440     void);
441 
442 
443 /*
444  * aslfold - constant folding
445  */
446 ACPI_STATUS
447 OpcAmlConstantWalk (
448     ACPI_PARSE_OBJECT       *Op,
449     UINT32                  Level,
450     void                    *Context);
451 
452 
453 /*
454  * aslmessages - exception strings
455  */
456 const char *
457 AeDecodeMessageId (
458     UINT16                  MessageId);
459 
460 const char *
461 AeDecodeExceptionLevel (
462     UINT8                   Level);
463 
464 UINT16
465 AeBuildFullExceptionCode (
466     UINT8                   Level,
467     UINT16                  MessageId);
468 
469 /*
470  * asloffset - generate C offset file for BIOS support
471  */
472 ACPI_STATUS
473 LsAmlOffsetWalk (
474     ACPI_PARSE_OBJECT       *Op,
475     UINT32                  Level,
476     void                    *Context);
477 
478 void
479 LsDoOffsetTableHeader (
480     UINT32                  FileId);
481 
482 void
483 LsDoOffsetTableFooter (
484     UINT32                  FileId);
485 
486 
487 /*
488  * aslopcodes - generate AML opcodes
489  */
490 ACPI_STATUS
491 OpcAmlOpcodeWalk (
492     ACPI_PARSE_OBJECT       *Op,
493     UINT32                  Level,
494     void                    *Context);
495 
496 ACPI_STATUS
497 OpcAmlOpcodeUpdateWalk (
498     ACPI_PARSE_OBJECT       *Op,
499     UINT32                  Level,
500     void                    *Context);
501 
502 void
503 OpcGenerateAmlOpcode (
504     ACPI_PARSE_OBJECT       *Op);
505 
506 UINT32
507 OpcSetOptimalIntegerSize (
508     ACPI_PARSE_OBJECT       *Op);
509 
510 void
511 OpcGetIntegerWidth (
512     ACPI_PARSE_OBJECT       *Op);
513 
514 
515 /*
516  * asloperands - generate AML operands for the AML opcodes
517  */
518 ACPI_PARSE_OBJECT  *
519 UtGetArg (
520     ACPI_PARSE_OBJECT       *Op,
521     UINT32                  Argn);
522 
523 void
524 OpnGenerateAmlOperands (
525     ACPI_PARSE_OBJECT       *Op);
526 
527 void
528 OpnDoPackage (
529     ACPI_PARSE_OBJECT       *Op);
530 
531 
532 /*
533  * aslopt - optmization
534  */
535 void
536 OptOptimizeNamePath (
537     ACPI_PARSE_OBJECT       *Op,
538     UINT32                  Flags,
539     ACPI_WALK_STATE         *WalkState,
540     char                    *AmlNameString,
541     ACPI_NAMESPACE_NODE     *TargetNode);
542 
543 
544 /*
545  * aslprintf - Printf/Fprintf macros
546  */
547 void
548 OpcDoPrintf (
549     ACPI_PARSE_OBJECT       *Op);
550 
551 void
552 OpcDoFprintf (
553     ACPI_PARSE_OBJECT       *Op);
554 
555 
556 /*
557  * aslprune - parse tree pruner
558  */
559 void
560 AslPruneParseTree (
561     UINT32                  PruneDepth,
562     UINT32                  Type);
563 
564 
565 /*
566  * aslcodegen - code generation
567  */
568 void
569 CgGenerateAmlOutput (
570     void);
571 
572 
573 /*
574  * aslfile
575  */
576 void
577 FlOpenFile (
578     UINT32                  FileId,
579     char                    *Filename,
580     char                    *Mode);
581 
582 
583 /*
584  * asllength - calculate/adjust AML package lengths
585  */
586 ACPI_STATUS
587 LnPackageLengthWalk (
588     ACPI_PARSE_OBJECT       *Op,
589     UINT32                  Level,
590     void                    *Context);
591 
592 ACPI_STATUS
593 LnInitLengthsWalk (
594     ACPI_PARSE_OBJECT       *Op,
595     UINT32                  Level,
596     void                    *Context);
597 
598 void
599 CgGenerateAmlLengths (
600     ACPI_PARSE_OBJECT       *Op);
601 
602 
603 /*
604  * aslmap - opcode mappings and reserved method names
605  */
606 ACPI_OBJECT_TYPE
607 AslMapNamedOpcodeToDataType (
608     UINT16                  Opcode);
609 
610 
611 /*
612  * aslpredef - ACPI predefined names support
613  */
614 BOOLEAN
615 ApCheckForPredefinedMethod (
616     ACPI_PARSE_OBJECT       *Op,
617     ASL_METHOD_INFO         *MethodInfo);
618 
619 void
620 ApCheckPredefinedReturnValue (
621     ACPI_PARSE_OBJECT       *Op,
622     ASL_METHOD_INFO         *MethodInfo);
623 
624 UINT32
625 ApCheckForPredefinedName (
626     ACPI_PARSE_OBJECT       *Op,
627     char                    *Name);
628 
629 void
630 ApCheckForPredefinedObject (
631     ACPI_PARSE_OBJECT       *Op,
632     char                    *Name);
633 
634 ACPI_STATUS
635 ApCheckObjectType (
636     const char              *PredefinedName,
637     ACPI_PARSE_OBJECT       *Op,
638     UINT32                  ExpectedBtypes,
639     UINT32                  PackageIndex);
640 
641 void
642 ApDisplayReservedNames (
643     void);
644 
645 
646 /*
647  * aslprepkg - ACPI predefined names support for packages
648  */
649 void
650 ApCheckPackage (
651     ACPI_PARSE_OBJECT           *ParentOp,
652     const ACPI_PREDEFINED_INFO  *Predefined);
653 
654 
655 /*
656  * asltransform - parse tree transformations
657  */
658 ACPI_STATUS
659 TrAmlTransformWalk (
660     ACPI_PARSE_OBJECT       *Op,
661     UINT32                  Level,
662     void                    *Context);
663 
664 
665 /*
666  * asltree - parse tree support
667  */
668 ACPI_STATUS
669 TrWalkParseTree (
670     ACPI_PARSE_OBJECT       *Op,
671     UINT32                  Visitation,
672     ASL_WALK_CALLBACK       DescendingCallback,
673     ASL_WALK_CALLBACK       AscendingCallback,
674     void                    *Context);
675 
676 /* Values for "Visitation" parameter above */
677 
678 #define ASL_WALK_VISIT_DOWNWARD     0x01
679 #define ASL_WALK_VISIT_UPWARD       0x02
680 #define ASL_WALK_VISIT_TWICE        (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD)
681 
682 
683 ACPI_PARSE_OBJECT *
684 TrAllocateNode (
685     UINT32                  ParseOpcode);
686 
687 void
688 TrPrintNodeCompileFlags (
689     UINT32                  Flags);
690 
691 void
692 TrReleaseNode (
693     ACPI_PARSE_OBJECT       *Op);
694 
695 ACPI_PARSE_OBJECT *
696 TrUpdateNode (
697     UINT32                  ParseOpcode,
698     ACPI_PARSE_OBJECT       *Op);
699 
700 ACPI_PARSE_OBJECT *
701 TrCreateNode (
702     UINT32                  ParseOpcode,
703     UINT32                  NumChildren,
704     ...);
705 
706 ACPI_PARSE_OBJECT *
707 TrCreateLeafNode (
708     UINT32                  ParseOpcode);
709 
710 ACPI_PARSE_OBJECT *
711 TrCreateNullTarget (
712     void);
713 
714 ACPI_PARSE_OBJECT *
715 TrCreateAssignmentNode (
716     ACPI_PARSE_OBJECT       *Target,
717     ACPI_PARSE_OBJECT       *Source);
718 
719 ACPI_PARSE_OBJECT *
720 TrCreateTargetOperand (
721     ACPI_PARSE_OBJECT       *OriginalOp,
722     ACPI_PARSE_OBJECT       *ParentOp);
723 
724 ACPI_PARSE_OBJECT *
725 TrCreateValuedLeafNode (
726     UINT32                  ParseOpcode,
727     UINT64                  Value);
728 
729 ACPI_PARSE_OBJECT *
730 TrCreateConstantLeafNode (
731     UINT32                  ParseOpcode);
732 
733 ACPI_PARSE_OBJECT *
734 TrLinkChildren (
735     ACPI_PARSE_OBJECT       *Op,
736     UINT32                  NumChildren,
737     ...);
738 
739 void
740 TrSetEndLineNumber (
741     ACPI_PARSE_OBJECT       *Op);
742 
743 void
744 TrWalkTree (
745     void);
746 
747 ACPI_PARSE_OBJECT *
748 TrLinkPeerNode (
749     ACPI_PARSE_OBJECT       *Op1,
750     ACPI_PARSE_OBJECT       *Op2);
751 
752 ACPI_PARSE_OBJECT *
753 TrLinkChildNode (
754     ACPI_PARSE_OBJECT       *Op1,
755     ACPI_PARSE_OBJECT       *Op2);
756 
757 ACPI_PARSE_OBJECT *
758 TrSetNodeFlags (
759     ACPI_PARSE_OBJECT       *Op,
760     UINT32                  Flags);
761 
762 ACPI_PARSE_OBJECT *
763 TrSetNodeAmlLength (
764     ACPI_PARSE_OBJECT       *Op,
765     UINT32                  Length);
766 
767 ACPI_PARSE_OBJECT *
768 TrLinkPeerNodes (
769     UINT32                  NumPeers,
770     ...);
771 
772 
773 /*
774  * aslfiles - File I/O support
775  */
776 void
777 FlAddIncludeDirectory (
778     char                    *Dir);
779 
780 char *
781 FlMergePathnames (
782     char                    *PrefixDir,
783     char                    *FilePathname);
784 
785 void
786 FlOpenIncludeFile (
787     ACPI_PARSE_OBJECT       *Op);
788 
789 void
790 FlFileError (
791     UINT32                  FileId,
792     UINT8                   ErrorId);
793 
794 UINT32
795 FlGetFileSize (
796     UINT32                  FileId);
797 
798 ACPI_STATUS
799 FlReadFile (
800     UINT32                  FileId,
801     void                    *Buffer,
802     UINT32                  Length);
803 
804 void
805 FlWriteFile (
806     UINT32                  FileId,
807     void                    *Buffer,
808     UINT32                  Length);
809 
810 void
811 FlSeekFile (
812     UINT32                  FileId,
813     long                    Offset);
814 
815 void
816 FlCloseFile (
817     UINT32                  FileId);
818 
819 void
820 FlPrintFile (
821     UINT32                  FileId,
822     char                    *Format,
823     ...);
824 
825 void
826 FlDeleteFile (
827     UINT32                  FileId);
828 
829 void
830 FlSetLineNumber (
831     UINT32                  LineNumber);
832 
833 void
834 FlSetFilename (
835     char                    *Filename);
836 
837 ACPI_STATUS
838 FlOpenInputFile (
839     char                    *InputFilename);
840 
841 ACPI_STATUS
842 FlOpenAmlOutputFile (
843     char                    *InputFilename);
844 
845 ACPI_STATUS
846 FlOpenMiscOutputFiles (
847     char                    *InputFilename);
848 
849 /*
850  * aslhwmap - hardware map summary
851  */
852 void
853 MpEmitMappingInfo (
854     void);
855 
856 
857 /*
858  * asload - load namespace in prep for cross reference
859  */
860 ACPI_STATUS
861 LdLoadNamespace (
862     ACPI_PARSE_OBJECT       *RootOp);
863 
864 
865 /*
866  * asllookup - namespace lookup functions
867  */
868 void
869 LkFindUnreferencedObjects (
870     void);
871 
872 /*
873  * aslmain - startup
874  */
875 void
876 Usage (
877     void);
878 
879 void
880 AslFilenameHelp (
881     void);
882 
883 
884 /*
885  * aslnamesp - namespace output file generation
886  */
887 ACPI_STATUS
888 NsDisplayNamespace (
889     void);
890 
891 void
892 NsSetupNamespaceListing (
893     void                    *Handle);
894 
895 /*
896  * asloptions - command line processing
897  */
898 int
899 AslCommandLine (
900     int                     argc,
901     char                    **argv);
902 
903 /*
904  * aslxref - namespace cross reference
905  */
906 ACPI_STATUS
907 XfCrossReferenceNamespace (
908     void);
909 
910 
911 /*
912  * aslutils - common compiler utilites
913  */
914 void
915 DbgPrint (
916     UINT32                  Type,
917     char                    *Format,
918     ...);
919 
920 /* Type values for above */
921 
922 #define ASL_DEBUG_OUTPUT    0
923 #define ASL_PARSE_OUTPUT    1
924 #define ASL_TREE_OUTPUT     2
925 
926 void
927 UtDisplaySupportedTables (
928     void);
929 
930 void
931 UtDisplayConstantOpcodes (
932     void);
933 
934 UINT8
935 UtBeginEvent (
936     char                    *Name);
937 
938 void
939 UtEndEvent (
940     UINT8                   Event);
941 
942 void *
943 UtLocalCalloc (
944     UINT32                  Size);
945 
946 void
947 UtPrintFormattedName (
948     UINT16                  ParseOpcode,
949     UINT32                  Level);
950 
951 void
952 UtDisplaySummary (
953     UINT32                  FileId);
954 
955 void
956 UtConvertByteToHex (
957     UINT8                   RawByte,
958     UINT8                   *Buffer);
959 
960 void
961 UtConvertByteToAsmHex (
962     UINT8                   RawByte,
963     UINT8                   *Buffer);
964 
965 char *
966 UtGetOpName (
967     UINT32                  ParseOpcode);
968 
969 void
970 UtSetParseOpName (
971     ACPI_PARSE_OBJECT       *Op);
972 
973 char *
974 UtStringCacheCalloc (
975     UINT32                  Length);
976 
977 void
978 UtExpandLineBuffers (
979     void);
980 
981 void
982 UtFreeLineBuffers (
983     void);
984 
985 ACPI_STATUS
986 UtInternalizeName (
987     char                    *ExternalName,
988     char                    **ConvertedName);
989 
990 void
991 UtAttachNamepathToOwner (
992     ACPI_PARSE_OBJECT       *Op,
993     ACPI_PARSE_OBJECT       *NameNode);
994 
995 ACPI_PARSE_OBJECT *
996 UtCheckIntegerRange (
997     ACPI_PARSE_OBJECT       *Op,
998     UINT32                  LowValue,
999     UINT32                  HighValue);
1000 
1001 UINT64
1002 UtDoConstant (
1003     char                    *String);
1004 
1005 ACPI_STATUS
1006 stroul64 (
1007     char                    *String,
1008     UINT32                  Base,
1009     UINT64                  *RetInteger);
1010 
1011 
1012 /*
1013  * asluuid - UUID support
1014  */
1015 ACPI_STATUS
1016 AuValidateUuid (
1017     char                    *InString);
1018 
1019 ACPI_STATUS
1020 AuConvertUuidToString (
1021     char                    *UuIdBuffer,
1022     char                    *OutString);
1023 
1024 /*
1025  * aslresource - Resource template generation utilities
1026  */
1027 void
1028 RsSmallAddressCheck (
1029     UINT8                   Type,
1030     UINT32                  Minimum,
1031     UINT32                  Maximum,
1032     UINT32                  Length,
1033     UINT32                  Alignment,
1034     ACPI_PARSE_OBJECT       *MinOp,
1035     ACPI_PARSE_OBJECT       *MaxOp,
1036     ACPI_PARSE_OBJECT       *LengthOp,
1037     ACPI_PARSE_OBJECT       *AlignOp,
1038     ACPI_PARSE_OBJECT       *Op);
1039 
1040 void
1041 RsLargeAddressCheck (
1042     UINT64                  Minimum,
1043     UINT64                  Maximum,
1044     UINT64                  Length,
1045     UINT64                  Granularity,
1046     UINT8                   Flags,
1047     ACPI_PARSE_OBJECT       *MinOp,
1048     ACPI_PARSE_OBJECT       *MaxOp,
1049     ACPI_PARSE_OBJECT       *LengthOp,
1050     ACPI_PARSE_OBJECT       *GranOp,
1051     ACPI_PARSE_OBJECT       *Op);
1052 
1053 UINT16
1054 RsGetStringDataLength (
1055     ACPI_PARSE_OBJECT       *InitializerOp);
1056 
1057 ASL_RESOURCE_NODE *
1058 RsAllocateResourceNode (
1059     UINT32                  Size);
1060 
1061 void
1062 RsCreateResourceField (
1063     ACPI_PARSE_OBJECT       *Op,
1064     char                    *Name,
1065     UINT32                  ByteOffset,
1066     UINT32                  BitOffset,
1067     UINT32                  BitLength);
1068 
1069 void
1070 RsSetFlagBits (
1071     UINT8                   *Flags,
1072     ACPI_PARSE_OBJECT       *Op,
1073     UINT8                   Position,
1074     UINT8                   DefaultBit);
1075 
1076 void
1077 RsSetFlagBits16 (
1078     UINT16                  *Flags,
1079     ACPI_PARSE_OBJECT       *Op,
1080     UINT8                   Position,
1081     UINT8                   DefaultBit);
1082 
1083 ACPI_PARSE_OBJECT *
1084 RsCompleteNodeAndGetNext (
1085     ACPI_PARSE_OBJECT       *Op);
1086 
1087 void
1088 RsCheckListForDuplicates (
1089     ACPI_PARSE_OBJECT       *Op);
1090 
1091 ASL_RESOURCE_NODE *
1092 RsDoOneResourceDescriptor (
1093     ASL_RESOURCE_INFO       *Info,
1094     UINT8                   *State);
1095 
1096 /* Values for State above */
1097 
1098 #define ACPI_RSTATE_NORMAL              0
1099 #define ACPI_RSTATE_START_DEPENDENT     1
1100 #define ACPI_RSTATE_DEPENDENT_LIST      2
1101 
1102 UINT32
1103 RsLinkDescriptorChain (
1104     ASL_RESOURCE_NODE       **PreviousRnode,
1105     ASL_RESOURCE_NODE       *Rnode);
1106 
1107 void
1108 RsDoResourceTemplate (
1109     ACPI_PARSE_OBJECT       *Op);
1110 
1111 
1112 /*
1113  * aslrestype1 - Miscellaneous Small descriptors
1114  */
1115 ASL_RESOURCE_NODE *
1116 RsDoEndTagDescriptor (
1117     ASL_RESOURCE_INFO       *Info);
1118 
1119 ASL_RESOURCE_NODE *
1120 RsDoEndDependentDescriptor (
1121     ASL_RESOURCE_INFO       *Info);
1122 
1123 ASL_RESOURCE_NODE *
1124 RsDoMemory24Descriptor (
1125     ASL_RESOURCE_INFO       *Info);
1126 
1127 ASL_RESOURCE_NODE *
1128 RsDoMemory32Descriptor (
1129     ASL_RESOURCE_INFO       *Info);
1130 
1131 ASL_RESOURCE_NODE *
1132 RsDoMemory32FixedDescriptor (
1133     ASL_RESOURCE_INFO       *Info);
1134 
1135 ASL_RESOURCE_NODE *
1136 RsDoStartDependentDescriptor (
1137     ASL_RESOURCE_INFO       *Info);
1138 
1139 ASL_RESOURCE_NODE *
1140 RsDoStartDependentNoPriDescriptor (
1141     ASL_RESOURCE_INFO       *Info);
1142 
1143 ASL_RESOURCE_NODE *
1144 RsDoVendorSmallDescriptor (
1145     ASL_RESOURCE_INFO       *Info);
1146 
1147 
1148 /*
1149  * aslrestype1i - I/O-related Small descriptors
1150  */
1151 ASL_RESOURCE_NODE *
1152 RsDoDmaDescriptor (
1153     ASL_RESOURCE_INFO       *Info);
1154 
1155 ASL_RESOURCE_NODE *
1156 RsDoFixedDmaDescriptor (
1157     ASL_RESOURCE_INFO       *Info);
1158 
1159 ASL_RESOURCE_NODE *
1160 RsDoFixedIoDescriptor (
1161     ASL_RESOURCE_INFO       *Info);
1162 
1163 ASL_RESOURCE_NODE *
1164 RsDoIoDescriptor (
1165     ASL_RESOURCE_INFO       *Info);
1166 
1167 ASL_RESOURCE_NODE *
1168 RsDoIrqDescriptor (
1169     ASL_RESOURCE_INFO       *Info);
1170 
1171 ASL_RESOURCE_NODE *
1172 RsDoIrqNoFlagsDescriptor (
1173     ASL_RESOURCE_INFO       *Info);
1174 
1175 
1176 /*
1177  * aslrestype2 - Large resource descriptors
1178  */
1179 ASL_RESOURCE_NODE *
1180 RsDoInterruptDescriptor (
1181     ASL_RESOURCE_INFO       *Info);
1182 
1183 ASL_RESOURCE_NODE *
1184 RsDoVendorLargeDescriptor (
1185     ASL_RESOURCE_INFO       *Info);
1186 
1187 ASL_RESOURCE_NODE *
1188 RsDoGeneralRegisterDescriptor (
1189     ASL_RESOURCE_INFO       *Info);
1190 
1191 ASL_RESOURCE_NODE *
1192 RsDoGpioIntDescriptor (
1193     ASL_RESOURCE_INFO       *Info);
1194 
1195 ASL_RESOURCE_NODE *
1196 RsDoGpioIoDescriptor (
1197     ASL_RESOURCE_INFO       *Info);
1198 
1199 ASL_RESOURCE_NODE *
1200 RsDoI2cSerialBusDescriptor (
1201     ASL_RESOURCE_INFO       *Info);
1202 
1203 ASL_RESOURCE_NODE *
1204 RsDoSpiSerialBusDescriptor (
1205     ASL_RESOURCE_INFO       *Info);
1206 
1207 ASL_RESOURCE_NODE *
1208 RsDoUartSerialBusDescriptor (
1209     ASL_RESOURCE_INFO       *Info);
1210 
1211 /*
1212  * aslrestype2d - DWord address descriptors
1213  */
1214 ASL_RESOURCE_NODE *
1215 RsDoDwordIoDescriptor (
1216     ASL_RESOURCE_INFO       *Info);
1217 
1218 ASL_RESOURCE_NODE *
1219 RsDoDwordMemoryDescriptor (
1220     ASL_RESOURCE_INFO       *Info);
1221 
1222 ASL_RESOURCE_NODE *
1223 RsDoDwordSpaceDescriptor (
1224     ASL_RESOURCE_INFO       *Info);
1225 
1226 
1227 /*
1228  * aslrestype2e - Extended address descriptors
1229  */
1230 ASL_RESOURCE_NODE *
1231 RsDoExtendedIoDescriptor (
1232     ASL_RESOURCE_INFO       *Info);
1233 
1234 ASL_RESOURCE_NODE *
1235 RsDoExtendedMemoryDescriptor (
1236     ASL_RESOURCE_INFO       *Info);
1237 
1238 ASL_RESOURCE_NODE *
1239 RsDoExtendedSpaceDescriptor (
1240     ASL_RESOURCE_INFO       *Info);
1241 
1242 
1243 /*
1244  * aslrestype2q - QWord address descriptors
1245  */
1246 ASL_RESOURCE_NODE *
1247 RsDoQwordIoDescriptor (
1248     ASL_RESOURCE_INFO       *Info);
1249 
1250 ASL_RESOURCE_NODE *
1251 RsDoQwordMemoryDescriptor (
1252     ASL_RESOURCE_INFO       *Info);
1253 
1254 ASL_RESOURCE_NODE *
1255 RsDoQwordSpaceDescriptor (
1256     ASL_RESOURCE_INFO       *Info);
1257 
1258 
1259 /*
1260  * aslrestype2w - Word address descriptors
1261  */
1262 ASL_RESOURCE_NODE *
1263 RsDoWordIoDescriptor (
1264     ASL_RESOURCE_INFO       *Info);
1265 
1266 ASL_RESOURCE_NODE *
1267 RsDoWordSpaceDescriptor (
1268     ASL_RESOURCE_INFO       *Info);
1269 
1270 ASL_RESOURCE_NODE *
1271 RsDoWordBusNumberDescriptor (
1272     ASL_RESOURCE_INFO       *Info);
1273 
1274 
1275 /*
1276  * Entry to data table compiler subsystem
1277  */
1278 ACPI_STATUS
1279 DtDoCompile(
1280     void);
1281 
1282 ACPI_STATUS
1283 DtCreateTemplates (
1284     char                    *Signature);
1285 
1286 #endif /*  __ASLCOMPILER_H */
1287