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