1 /****************************************************************************** 2 * 3 * Module Name: aslcompiler.h - common include file for iASL 4 * 5 *****************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2016, 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 FlIsFileAsciiSource ( 171 char *Filename, 172 BOOLEAN DisplayErrors); 173 174 175 /* 176 * aslwalks - semantic analysis and parse tree walks 177 */ 178 ACPI_STATUS 179 AnOtherSemanticAnalysisWalkBegin ( 180 ACPI_PARSE_OBJECT *Op, 181 UINT32 Level, 182 void *Context); 183 184 ACPI_STATUS 185 AnOtherSemanticAnalysisWalkEnd ( 186 ACPI_PARSE_OBJECT *Op, 187 UINT32 Level, 188 void *Context); 189 190 ACPI_STATUS 191 AnOperandTypecheckWalkEnd ( 192 ACPI_PARSE_OBJECT *Op, 193 UINT32 Level, 194 void *Context); 195 196 ACPI_STATUS 197 AnMethodTypingWalkEnd ( 198 ACPI_PARSE_OBJECT *Op, 199 UINT32 Level, 200 void *Context); 201 202 203 /* 204 * aslmethod - Control method analysis walk 205 */ 206 ACPI_STATUS 207 MtMethodAnalysisWalkBegin ( 208 ACPI_PARSE_OBJECT *Op, 209 UINT32 Level, 210 void *Context); 211 212 ACPI_STATUS 213 MtMethodAnalysisWalkEnd ( 214 ACPI_PARSE_OBJECT *Op, 215 UINT32 Level, 216 void *Context); 217 218 219 /* 220 * aslbtypes - bitfield data types 221 */ 222 UINT32 223 AnMapObjTypeToBtype ( 224 ACPI_PARSE_OBJECT *Op); 225 226 UINT32 227 AnMapArgTypeToBtype ( 228 UINT32 ArgType); 229 230 UINT32 231 AnGetBtype ( 232 ACPI_PARSE_OBJECT *Op); 233 234 void 235 AnFormatBtype ( 236 char *Buffer, 237 UINT32 Btype); 238 239 240 /* 241 * aslanalyze - Support functions for parse tree walks 242 */ 243 void 244 AnCheckId ( 245 ACPI_PARSE_OBJECT *Op, 246 ACPI_NAME Type); 247 248 /* Values for Type argument above */ 249 250 #define ASL_TYPE_HID 0 251 #define ASL_TYPE_CID 1 252 253 BOOLEAN 254 AnIsInternalMethod ( 255 ACPI_PARSE_OBJECT *Op); 256 257 UINT32 258 AnGetInternalMethodReturnType ( 259 ACPI_PARSE_OBJECT *Op); 260 261 BOOLEAN 262 AnLastStatementIsReturn ( 263 ACPI_PARSE_OBJECT *Op); 264 265 void 266 AnCheckMethodReturnValue ( 267 ACPI_PARSE_OBJECT *Op, 268 const ACPI_OPCODE_INFO *OpInfo, 269 ACPI_PARSE_OBJECT *ArgOp, 270 UINT32 RequiredBtypes, 271 UINT32 ThisNodeBtype); 272 273 BOOLEAN 274 AnIsResultUsed ( 275 ACPI_PARSE_OBJECT *Op); 276 277 void 278 ApCheckForGpeNameConflict ( 279 ACPI_PARSE_OBJECT *Op); 280 281 void 282 ApCheckRegMethod ( 283 ACPI_PARSE_OBJECT *Op); 284 285 BOOLEAN 286 ApFindNameInScope ( 287 char *Name, 288 ACPI_PARSE_OBJECT *Op); 289 290 BOOLEAN 291 ApFindNameInDeviceTree ( 292 char *Name, 293 ACPI_PARSE_OBJECT *Op); 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 * aslpld - ToPLD macro support 546 */ 547 void 548 OpcDoPld ( 549 ACPI_PARSE_OBJECT *Op); 550 551 552 /* 553 * aslprintf - Printf/Fprintf macros 554 */ 555 void 556 OpcDoPrintf ( 557 ACPI_PARSE_OBJECT *Op); 558 559 void 560 OpcDoFprintf ( 561 ACPI_PARSE_OBJECT *Op); 562 563 564 /* 565 * aslprune - parse tree pruner 566 */ 567 void 568 AslPruneParseTree ( 569 UINT32 PruneDepth, 570 UINT32 Type); 571 572 573 /* 574 * aslcodegen - code generation 575 */ 576 void 577 CgGenerateAmlOutput ( 578 void); 579 580 581 /* 582 * aslfile 583 */ 584 void 585 FlOpenFile ( 586 UINT32 FileId, 587 char *Filename, 588 char *Mode); 589 590 591 /* 592 * asllength - calculate/adjust AML package lengths 593 */ 594 ACPI_STATUS 595 LnPackageLengthWalk ( 596 ACPI_PARSE_OBJECT *Op, 597 UINT32 Level, 598 void *Context); 599 600 ACPI_STATUS 601 LnInitLengthsWalk ( 602 ACPI_PARSE_OBJECT *Op, 603 UINT32 Level, 604 void *Context); 605 606 void 607 CgGenerateAmlLengths ( 608 ACPI_PARSE_OBJECT *Op); 609 610 611 /* 612 * aslmap - opcode mappings and reserved method names 613 */ 614 ACPI_OBJECT_TYPE 615 AslMapNamedOpcodeToDataType ( 616 UINT16 Opcode); 617 618 619 /* 620 * aslpredef - ACPI predefined names support 621 */ 622 BOOLEAN 623 ApCheckForPredefinedMethod ( 624 ACPI_PARSE_OBJECT *Op, 625 ASL_METHOD_INFO *MethodInfo); 626 627 void 628 ApCheckPredefinedReturnValue ( 629 ACPI_PARSE_OBJECT *Op, 630 ASL_METHOD_INFO *MethodInfo); 631 632 UINT32 633 ApCheckForPredefinedName ( 634 ACPI_PARSE_OBJECT *Op, 635 char *Name); 636 637 void 638 ApCheckForPredefinedObject ( 639 ACPI_PARSE_OBJECT *Op, 640 char *Name); 641 642 ACPI_STATUS 643 ApCheckObjectType ( 644 const char *PredefinedName, 645 ACPI_PARSE_OBJECT *Op, 646 UINT32 ExpectedBtypes, 647 UINT32 PackageIndex); 648 649 void 650 ApDisplayReservedNames ( 651 void); 652 653 654 /* 655 * aslprepkg - ACPI predefined names support for packages 656 */ 657 void 658 ApCheckPackage ( 659 ACPI_PARSE_OBJECT *ParentOp, 660 const ACPI_PREDEFINED_INFO *Predefined); 661 662 663 /* 664 * asltransform - parse tree transformations 665 */ 666 ACPI_STATUS 667 TrAmlTransformWalkBegin ( 668 ACPI_PARSE_OBJECT *Op, 669 UINT32 Level, 670 void *Context); 671 672 ACPI_STATUS 673 TrAmlTransformWalkEnd ( 674 ACPI_PARSE_OBJECT *Op, 675 UINT32 Level, 676 void *Context); 677 678 679 /* 680 * asltree - parse tree support 681 */ 682 ACPI_STATUS 683 TrWalkParseTree ( 684 ACPI_PARSE_OBJECT *Op, 685 UINT32 Visitation, 686 ASL_WALK_CALLBACK DescendingCallback, 687 ASL_WALK_CALLBACK AscendingCallback, 688 void *Context); 689 690 /* 691 * aslexternal - External opcode support 692 */ 693 ACPI_STATUS 694 ExAmlExternalWalkBegin ( 695 ACPI_PARSE_OBJECT *Op, 696 UINT32 Level, 697 void *Context); 698 699 ACPI_STATUS 700 ExAmlExternalWalkEnd ( 701 ACPI_PARSE_OBJECT *Op, 702 UINT32 Level, 703 void *Context); 704 705 void 706 ExDoExternal ( 707 ACPI_PARSE_OBJECT *Op); 708 709 /* Values for "Visitation" parameter above */ 710 711 #define ASL_WALK_VISIT_DOWNWARD 0x01 712 #define ASL_WALK_VISIT_UPWARD 0x02 713 #define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD) 714 715 716 void 717 TrSetParent ( 718 ACPI_PARSE_OBJECT *Op, 719 ACPI_PARSE_OBJECT *ParentOp); 720 721 ACPI_PARSE_OBJECT * 722 TrAllocateNode ( 723 UINT32 ParseOpcode); 724 725 void 726 TrPrintNodeCompileFlags ( 727 UINT32 Flags); 728 729 void 730 TrReleaseNode ( 731 ACPI_PARSE_OBJECT *Op); 732 733 ACPI_PARSE_OBJECT * 734 TrUpdateNode ( 735 UINT32 ParseOpcode, 736 ACPI_PARSE_OBJECT *Op); 737 738 ACPI_PARSE_OBJECT * 739 TrCreateNode ( 740 UINT32 ParseOpcode, 741 UINT32 NumChildren, 742 ...); 743 744 ACPI_PARSE_OBJECT * 745 TrCreateLeafNode ( 746 UINT32 ParseOpcode); 747 748 ACPI_PARSE_OBJECT * 749 TrCreateNullTarget ( 750 void); 751 752 ACPI_PARSE_OBJECT * 753 TrCreateAssignmentNode ( 754 ACPI_PARSE_OBJECT *Target, 755 ACPI_PARSE_OBJECT *Source); 756 757 ACPI_PARSE_OBJECT * 758 TrCreateTargetOperand ( 759 ACPI_PARSE_OBJECT *OriginalOp, 760 ACPI_PARSE_OBJECT *ParentOp); 761 762 ACPI_PARSE_OBJECT * 763 TrCreateValuedLeafNode ( 764 UINT32 ParseOpcode, 765 UINT64 Value); 766 767 ACPI_PARSE_OBJECT * 768 TrCreateConstantLeafNode ( 769 UINT32 ParseOpcode); 770 771 ACPI_PARSE_OBJECT * 772 TrLinkChildren ( 773 ACPI_PARSE_OBJECT *Op, 774 UINT32 NumChildren, 775 ...); 776 777 void 778 TrSetEndLineNumber ( 779 ACPI_PARSE_OBJECT *Op); 780 781 void 782 TrSetCurrentFilename ( 783 ACPI_PARSE_OBJECT *Op); 784 785 void 786 TrWalkTree ( 787 void); 788 789 ACPI_PARSE_OBJECT * 790 TrLinkPeerNode ( 791 ACPI_PARSE_OBJECT *Op1, 792 ACPI_PARSE_OBJECT *Op2); 793 794 ACPI_PARSE_OBJECT * 795 TrLinkChildNode ( 796 ACPI_PARSE_OBJECT *Op1, 797 ACPI_PARSE_OBJECT *Op2); 798 799 ACPI_PARSE_OBJECT * 800 TrSetNodeFlags ( 801 ACPI_PARSE_OBJECT *Op, 802 UINT32 Flags); 803 804 ACPI_PARSE_OBJECT * 805 TrSetNodeAmlLength ( 806 ACPI_PARSE_OBJECT *Op, 807 UINT32 Length); 808 809 ACPI_PARSE_OBJECT * 810 TrLinkPeerNodes ( 811 UINT32 NumPeers, 812 ...); 813 814 815 /* 816 * aslfiles - File I/O support 817 */ 818 void 819 FlAddIncludeDirectory ( 820 char *Dir); 821 822 char * 823 FlMergePathnames ( 824 char *PrefixDir, 825 char *FilePathname); 826 827 void 828 FlOpenIncludeFile ( 829 ACPI_PARSE_OBJECT *Op); 830 831 void 832 FlFileError ( 833 UINT32 FileId, 834 UINT8 ErrorId); 835 836 UINT32 837 FlGetFileSize ( 838 UINT32 FileId); 839 840 ACPI_STATUS 841 FlReadFile ( 842 UINT32 FileId, 843 void *Buffer, 844 UINT32 Length); 845 846 void 847 FlWriteFile ( 848 UINT32 FileId, 849 void *Buffer, 850 UINT32 Length); 851 852 void 853 FlSeekFile ( 854 UINT32 FileId, 855 long Offset); 856 857 void 858 FlCloseFile ( 859 UINT32 FileId); 860 861 void 862 FlPrintFile ( 863 UINT32 FileId, 864 char *Format, 865 ...); 866 867 void 868 FlDeleteFile ( 869 UINT32 FileId); 870 871 void 872 FlSetLineNumber ( 873 UINT32 LineNumber); 874 875 void 876 FlSetFilename ( 877 char *Filename); 878 879 ACPI_STATUS 880 FlOpenInputFile ( 881 char *InputFilename); 882 883 ACPI_STATUS 884 FlOpenAmlOutputFile ( 885 char *InputFilename); 886 887 ACPI_STATUS 888 FlOpenMiscOutputFiles ( 889 char *InputFilename); 890 891 /* 892 * aslhwmap - hardware map summary 893 */ 894 void 895 MpEmitMappingInfo ( 896 void); 897 898 899 /* 900 * asload - load namespace in prep for cross reference 901 */ 902 ACPI_STATUS 903 LdLoadNamespace ( 904 ACPI_PARSE_OBJECT *RootOp); 905 906 907 /* 908 * asllookup - namespace lookup functions 909 */ 910 void 911 LkFindUnreferencedObjects ( 912 void); 913 914 /* 915 * aslmain - startup 916 */ 917 void 918 Usage ( 919 void); 920 921 void 922 AslFilenameHelp ( 923 void); 924 925 926 /* 927 * aslnamesp - namespace output file generation 928 */ 929 ACPI_STATUS 930 NsDisplayNamespace ( 931 void); 932 933 void 934 NsSetupNamespaceListing ( 935 void *Handle); 936 937 /* 938 * asloptions - command line processing 939 */ 940 int 941 AslCommandLine ( 942 int argc, 943 char **argv); 944 945 /* 946 * aslxref - namespace cross reference 947 */ 948 ACPI_STATUS 949 XfCrossReferenceNamespace ( 950 void); 951 952 953 /* 954 * aslxrefout 955 */ 956 void 957 OtPrintHeaders ( 958 char *Message); 959 960 void 961 OtCreateXrefFile ( 962 void); 963 964 void 965 OtXrefWalkPart1 ( 966 ACPI_PARSE_OBJECT *Op, 967 UINT32 Level, 968 ASL_METHOD_INFO *MethodInfo); 969 970 971 /* 972 * aslutils - common compiler utilites 973 */ 974 void 975 DbgPrint ( 976 UINT32 Type, 977 char *Format, 978 ...); 979 980 /* Type values for above */ 981 982 #define ASL_DEBUG_OUTPUT 0 983 #define ASL_PARSE_OUTPUT 1 984 #define ASL_TREE_OUTPUT 2 985 986 UINT8 987 UtIsBigEndianMachine ( 988 void); 989 990 BOOLEAN 991 UtQueryForOverwrite ( 992 char *Pathname); 993 994 void 995 UtDumpStringOp ( 996 ACPI_PARSE_OBJECT *Op, 997 UINT32 Level); 998 999 void 1000 UtDumpIntegerOp ( 1001 ACPI_PARSE_OBJECT *Op, 1002 UINT32 Level, 1003 UINT32 IntegerLength); 1004 1005 void 1006 UtDumpBasicOp ( 1007 ACPI_PARSE_OBJECT *Op, 1008 UINT32 Level); 1009 1010 void 1011 UtDisplaySupportedTables ( 1012 void); 1013 1014 void 1015 UtDisplayConstantOpcodes ( 1016 void); 1017 1018 UINT8 1019 UtBeginEvent ( 1020 char *Name); 1021 1022 void 1023 UtEndEvent ( 1024 UINT8 Event); 1025 1026 void * 1027 UtLocalCalloc ( 1028 UINT32 Size); 1029 1030 void 1031 UtDisplaySummary ( 1032 UINT32 FileId); 1033 1034 void 1035 UtConvertByteToHex ( 1036 UINT8 RawByte, 1037 UINT8 *Buffer); 1038 1039 void 1040 UtConvertByteToAsmHex ( 1041 UINT8 RawByte, 1042 UINT8 *Buffer); 1043 1044 char * 1045 UtGetOpName ( 1046 UINT32 ParseOpcode); 1047 1048 void 1049 UtSetParseOpName ( 1050 ACPI_PARSE_OBJECT *Op); 1051 1052 char * 1053 UtStringCacheCalloc ( 1054 UINT32 Length); 1055 1056 void 1057 UtExpandLineBuffers ( 1058 void); 1059 1060 void 1061 UtFreeLineBuffers ( 1062 void); 1063 1064 ACPI_STATUS 1065 UtInternalizeName ( 1066 char *ExternalName, 1067 char **ConvertedName); 1068 1069 void 1070 UtAttachNamepathToOwner ( 1071 ACPI_PARSE_OBJECT *Op, 1072 ACPI_PARSE_OBJECT *NameNode); 1073 1074 ACPI_PARSE_OBJECT * 1075 UtCheckIntegerRange ( 1076 ACPI_PARSE_OBJECT *Op, 1077 UINT32 LowValue, 1078 UINT32 HighValue); 1079 1080 UINT64 1081 UtDoConstant ( 1082 char *String); 1083 1084 1085 /* 1086 * asluuid - UUID support 1087 */ 1088 ACPI_STATUS 1089 AuValidateUuid ( 1090 char *InString); 1091 1092 ACPI_STATUS 1093 AuConvertUuidToString ( 1094 char *UuIdBuffer, 1095 char *OutString); 1096 1097 /* 1098 * aslresource - Resource template generation utilities 1099 */ 1100 void 1101 RsSmallAddressCheck ( 1102 UINT8 Type, 1103 UINT32 Minimum, 1104 UINT32 Maximum, 1105 UINT32 Length, 1106 UINT32 Alignment, 1107 ACPI_PARSE_OBJECT *MinOp, 1108 ACPI_PARSE_OBJECT *MaxOp, 1109 ACPI_PARSE_OBJECT *LengthOp, 1110 ACPI_PARSE_OBJECT *AlignOp, 1111 ACPI_PARSE_OBJECT *Op); 1112 1113 void 1114 RsLargeAddressCheck ( 1115 UINT64 Minimum, 1116 UINT64 Maximum, 1117 UINT64 Length, 1118 UINT64 Granularity, 1119 UINT8 Flags, 1120 ACPI_PARSE_OBJECT *MinOp, 1121 ACPI_PARSE_OBJECT *MaxOp, 1122 ACPI_PARSE_OBJECT *LengthOp, 1123 ACPI_PARSE_OBJECT *GranOp, 1124 ACPI_PARSE_OBJECT *Op); 1125 1126 UINT16 1127 RsGetStringDataLength ( 1128 ACPI_PARSE_OBJECT *InitializerOp); 1129 1130 ASL_RESOURCE_NODE * 1131 RsAllocateResourceNode ( 1132 UINT32 Size); 1133 1134 void 1135 RsCreateResourceField ( 1136 ACPI_PARSE_OBJECT *Op, 1137 char *Name, 1138 UINT32 ByteOffset, 1139 UINT32 BitOffset, 1140 UINT32 BitLength); 1141 1142 void 1143 RsSetFlagBits ( 1144 UINT8 *Flags, 1145 ACPI_PARSE_OBJECT *Op, 1146 UINT8 Position, 1147 UINT8 DefaultBit); 1148 1149 void 1150 RsSetFlagBits16 ( 1151 UINT16 *Flags, 1152 ACPI_PARSE_OBJECT *Op, 1153 UINT8 Position, 1154 UINT8 DefaultBit); 1155 1156 ACPI_PARSE_OBJECT * 1157 RsCompleteNodeAndGetNext ( 1158 ACPI_PARSE_OBJECT *Op); 1159 1160 void 1161 RsCheckListForDuplicates ( 1162 ACPI_PARSE_OBJECT *Op); 1163 1164 ASL_RESOURCE_NODE * 1165 RsDoOneResourceDescriptor ( 1166 ASL_RESOURCE_INFO *Info, 1167 UINT8 *State); 1168 1169 /* Values for State above */ 1170 1171 #define ACPI_RSTATE_NORMAL 0 1172 #define ACPI_RSTATE_START_DEPENDENT 1 1173 #define ACPI_RSTATE_DEPENDENT_LIST 2 1174 1175 UINT32 1176 RsLinkDescriptorChain ( 1177 ASL_RESOURCE_NODE **PreviousRnode, 1178 ASL_RESOURCE_NODE *Rnode); 1179 1180 void 1181 RsDoResourceTemplate ( 1182 ACPI_PARSE_OBJECT *Op); 1183 1184 1185 /* 1186 * aslrestype1 - Miscellaneous Small descriptors 1187 */ 1188 ASL_RESOURCE_NODE * 1189 RsDoEndTagDescriptor ( 1190 ASL_RESOURCE_INFO *Info); 1191 1192 ASL_RESOURCE_NODE * 1193 RsDoEndDependentDescriptor ( 1194 ASL_RESOURCE_INFO *Info); 1195 1196 ASL_RESOURCE_NODE * 1197 RsDoMemory24Descriptor ( 1198 ASL_RESOURCE_INFO *Info); 1199 1200 ASL_RESOURCE_NODE * 1201 RsDoMemory32Descriptor ( 1202 ASL_RESOURCE_INFO *Info); 1203 1204 ASL_RESOURCE_NODE * 1205 RsDoMemory32FixedDescriptor ( 1206 ASL_RESOURCE_INFO *Info); 1207 1208 ASL_RESOURCE_NODE * 1209 RsDoStartDependentDescriptor ( 1210 ASL_RESOURCE_INFO *Info); 1211 1212 ASL_RESOURCE_NODE * 1213 RsDoStartDependentNoPriDescriptor ( 1214 ASL_RESOURCE_INFO *Info); 1215 1216 ASL_RESOURCE_NODE * 1217 RsDoVendorSmallDescriptor ( 1218 ASL_RESOURCE_INFO *Info); 1219 1220 1221 /* 1222 * aslrestype1i - I/O-related Small descriptors 1223 */ 1224 ASL_RESOURCE_NODE * 1225 RsDoDmaDescriptor ( 1226 ASL_RESOURCE_INFO *Info); 1227 1228 ASL_RESOURCE_NODE * 1229 RsDoFixedDmaDescriptor ( 1230 ASL_RESOURCE_INFO *Info); 1231 1232 ASL_RESOURCE_NODE * 1233 RsDoFixedIoDescriptor ( 1234 ASL_RESOURCE_INFO *Info); 1235 1236 ASL_RESOURCE_NODE * 1237 RsDoIoDescriptor ( 1238 ASL_RESOURCE_INFO *Info); 1239 1240 ASL_RESOURCE_NODE * 1241 RsDoIrqDescriptor ( 1242 ASL_RESOURCE_INFO *Info); 1243 1244 ASL_RESOURCE_NODE * 1245 RsDoIrqNoFlagsDescriptor ( 1246 ASL_RESOURCE_INFO *Info); 1247 1248 1249 /* 1250 * aslrestype2 - Large resource descriptors 1251 */ 1252 ASL_RESOURCE_NODE * 1253 RsDoInterruptDescriptor ( 1254 ASL_RESOURCE_INFO *Info); 1255 1256 ASL_RESOURCE_NODE * 1257 RsDoVendorLargeDescriptor ( 1258 ASL_RESOURCE_INFO *Info); 1259 1260 ASL_RESOURCE_NODE * 1261 RsDoGeneralRegisterDescriptor ( 1262 ASL_RESOURCE_INFO *Info); 1263 1264 ASL_RESOURCE_NODE * 1265 RsDoGpioIntDescriptor ( 1266 ASL_RESOURCE_INFO *Info); 1267 1268 ASL_RESOURCE_NODE * 1269 RsDoGpioIoDescriptor ( 1270 ASL_RESOURCE_INFO *Info); 1271 1272 ASL_RESOURCE_NODE * 1273 RsDoI2cSerialBusDescriptor ( 1274 ASL_RESOURCE_INFO *Info); 1275 1276 ASL_RESOURCE_NODE * 1277 RsDoSpiSerialBusDescriptor ( 1278 ASL_RESOURCE_INFO *Info); 1279 1280 ASL_RESOURCE_NODE * 1281 RsDoUartSerialBusDescriptor ( 1282 ASL_RESOURCE_INFO *Info); 1283 1284 /* 1285 * aslrestype2d - DWord address descriptors 1286 */ 1287 ASL_RESOURCE_NODE * 1288 RsDoDwordIoDescriptor ( 1289 ASL_RESOURCE_INFO *Info); 1290 1291 ASL_RESOURCE_NODE * 1292 RsDoDwordMemoryDescriptor ( 1293 ASL_RESOURCE_INFO *Info); 1294 1295 ASL_RESOURCE_NODE * 1296 RsDoDwordSpaceDescriptor ( 1297 ASL_RESOURCE_INFO *Info); 1298 1299 1300 /* 1301 * aslrestype2e - Extended address descriptors 1302 */ 1303 ASL_RESOURCE_NODE * 1304 RsDoExtendedIoDescriptor ( 1305 ASL_RESOURCE_INFO *Info); 1306 1307 ASL_RESOURCE_NODE * 1308 RsDoExtendedMemoryDescriptor ( 1309 ASL_RESOURCE_INFO *Info); 1310 1311 ASL_RESOURCE_NODE * 1312 RsDoExtendedSpaceDescriptor ( 1313 ASL_RESOURCE_INFO *Info); 1314 1315 1316 /* 1317 * aslrestype2q - QWord address descriptors 1318 */ 1319 ASL_RESOURCE_NODE * 1320 RsDoQwordIoDescriptor ( 1321 ASL_RESOURCE_INFO *Info); 1322 1323 ASL_RESOURCE_NODE * 1324 RsDoQwordMemoryDescriptor ( 1325 ASL_RESOURCE_INFO *Info); 1326 1327 ASL_RESOURCE_NODE * 1328 RsDoQwordSpaceDescriptor ( 1329 ASL_RESOURCE_INFO *Info); 1330 1331 1332 /* 1333 * aslrestype2w - Word address descriptors 1334 */ 1335 ASL_RESOURCE_NODE * 1336 RsDoWordIoDescriptor ( 1337 ASL_RESOURCE_INFO *Info); 1338 1339 ASL_RESOURCE_NODE * 1340 RsDoWordSpaceDescriptor ( 1341 ASL_RESOURCE_INFO *Info); 1342 1343 ASL_RESOURCE_NODE * 1344 RsDoWordBusNumberDescriptor ( 1345 ASL_RESOURCE_INFO *Info); 1346 1347 1348 /* 1349 * Entry to data table compiler subsystem 1350 */ 1351 ACPI_STATUS 1352 DtDoCompile( 1353 void); 1354 1355 ACPI_STATUS 1356 DtCreateTemplates ( 1357 char **argv); 1358 1359 #endif /* __ASLCOMPILER_H */ 1360