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