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