aslcompiler.h revision 167802
1118611Snjl 2118611Snjl/****************************************************************************** 3118611Snjl * 4151937Sjkim * Module Name: aslcompiler.h - common include file for iASL 5167802Sjkim * $Revision: 1.148 $ 6118611Snjl * 7118611Snjl *****************************************************************************/ 8118611Snjl 9118611Snjl/****************************************************************************** 10118611Snjl * 11118611Snjl * 1. Copyright Notice 12118611Snjl * 13167802Sjkim * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. 14118611Snjl * All rights reserved. 15118611Snjl * 16118611Snjl * 2. License 17118611Snjl * 18118611Snjl * 2.1. This is your license from Intel Corp. under its intellectual property 19118611Snjl * rights. You may have additional license terms from the party that provided 20118611Snjl * you this software, covering your right to use that party's intellectual 21118611Snjl * property rights. 22118611Snjl * 23118611Snjl * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 24118611Snjl * copy of the source code appearing in this file ("Covered Code") an 25118611Snjl * irrevocable, perpetual, worldwide license under Intel's copyrights in the 26118611Snjl * base code distributed originally by Intel ("Original Intel Code") to copy, 27118611Snjl * make derivatives, distribute, use and display any portion of the Covered 28118611Snjl * Code in any form, with the right to sublicense such rights; and 29118611Snjl * 30118611Snjl * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 31118611Snjl * license (with the right to sublicense), under only those claims of Intel 32118611Snjl * patents that are infringed by the Original Intel Code, to make, use, sell, 33118611Snjl * offer to sell, and import the Covered Code and derivative works thereof 34118611Snjl * solely to the minimum extent necessary to exercise the above copyright 35118611Snjl * license, and in no event shall the patent license extend to any additions 36118611Snjl * to or modifications of the Original Intel Code. No other license or right 37118611Snjl * is granted directly or by implication, estoppel or otherwise; 38118611Snjl * 39118611Snjl * The above copyright and patent license is granted only if the following 40118611Snjl * conditions are met: 41118611Snjl * 42118611Snjl * 3. Conditions 43118611Snjl * 44118611Snjl * 3.1. Redistribution of Source with Rights to Further Distribute Source. 45118611Snjl * Redistribution of source code of any substantial portion of the Covered 46118611Snjl * Code or modification with rights to further distribute source must include 47118611Snjl * the above Copyright Notice, the above License, this list of Conditions, 48118611Snjl * and the following Disclaimer and Export Compliance provision. In addition, 49118611Snjl * Licensee must cause all Covered Code to which Licensee contributes to 50118611Snjl * contain a file documenting the changes Licensee made to create that Covered 51118611Snjl * Code and the date of any change. Licensee must include in that file the 52118611Snjl * documentation of any changes made by any predecessor Licensee. Licensee 53118611Snjl * must include a prominent statement that the modification is derived, 54118611Snjl * directly or indirectly, from Original Intel Code. 55118611Snjl * 56118611Snjl * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 57118611Snjl * Redistribution of source code of any substantial portion of the Covered 58118611Snjl * Code or modification without rights to further distribute source must 59118611Snjl * include the following Disclaimer and Export Compliance provision in the 60118611Snjl * documentation and/or other materials provided with distribution. In 61118611Snjl * addition, Licensee may not authorize further sublicense of source of any 62118611Snjl * portion of the Covered Code, and must include terms to the effect that the 63118611Snjl * license from Licensee to its licensee is limited to the intellectual 64118611Snjl * property embodied in the software Licensee provides to its licensee, and 65118611Snjl * not to intellectual property embodied in modifications its licensee may 66118611Snjl * make. 67118611Snjl * 68118611Snjl * 3.3. Redistribution of Executable. Redistribution in executable form of any 69118611Snjl * substantial portion of the Covered Code or modification must reproduce the 70118611Snjl * above Copyright Notice, and the following Disclaimer and Export Compliance 71118611Snjl * provision in the documentation and/or other materials provided with the 72118611Snjl * distribution. 73118611Snjl * 74118611Snjl * 3.4. Intel retains all right, title, and interest in and to the Original 75118611Snjl * Intel Code. 76118611Snjl * 77118611Snjl * 3.5. Neither the name Intel nor any other trademark owned or controlled by 78118611Snjl * Intel shall be used in advertising or otherwise to promote the sale, use or 79118611Snjl * other dealings in products derived from or relating to the Covered Code 80118611Snjl * without prior written authorization from Intel. 81118611Snjl * 82118611Snjl * 4. Disclaimer and Export Compliance 83118611Snjl * 84118611Snjl * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 85118611Snjl * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 86118611Snjl * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 87118611Snjl * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 88118611Snjl * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 89118611Snjl * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 90118611Snjl * PARTICULAR PURPOSE. 91118611Snjl * 92118611Snjl * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 93118611Snjl * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 94118611Snjl * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 95118611Snjl * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 96118611Snjl * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 97118611Snjl * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 98118611Snjl * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 99118611Snjl * LIMITED REMEDY. 100118611Snjl * 101118611Snjl * 4.3. Licensee shall not export, either directly or indirectly, any of this 102118611Snjl * software or system incorporating such software without first obtaining any 103118611Snjl * required license or other approval from the U. S. Department of Commerce or 104118611Snjl * any other agency or department of the United States Government. In the 105118611Snjl * event Licensee exports any such software from the United States or 106118611Snjl * re-exports any such software from a foreign destination, Licensee shall 107118611Snjl * ensure that the distribution and export/re-export of the software is in 108118611Snjl * compliance with all laws, regulations, orders, or other restrictions of the 109118611Snjl * U.S. Export Administration Regulations. Licensee agrees that neither it nor 110118611Snjl * any of its subsidiaries will export/re-export any technical data, process, 111118611Snjl * software, or service, directly or indirectly, to any country for which the 112118611Snjl * United States government or any agency thereof requires an export license, 113118611Snjl * other governmental approval, or letter of assurance, without first obtaining 114118611Snjl * such license, approval or letter. 115118611Snjl * 116118611Snjl *****************************************************************************/ 117118611Snjl 118118611Snjl 119118611Snjl#ifndef __ASLCOMPILER_H 120118611Snjl#define __ASLCOMPILER_H 121118611Snjl 122118611Snjl 123118611Snjl/* Microsoft-specific */ 124118611Snjl 125118611Snjl#if (defined WIN32 || defined WIN64) 126118611Snjl 127118611Snjl/* warn : used #pragma pack */ 128118611Snjl#pragma warning(disable:4103) 129118611Snjl 130118611Snjl/* warn : named type definition in parentheses */ 131118611Snjl#pragma warning(disable:4115) 132118611Snjl#endif 133118611Snjl 134118611Snjl#include <stdio.h> 135118611Snjl#include <stdlib.h> 136118611Snjl#include <stdarg.h> 137118611Snjl#include <string.h> 138118611Snjl#include <errno.h> 139118611Snjl#include <ctype.h> 140118611Snjl 141118611Snjl 142151937Sjkim#include <contrib/dev/acpica/acpi.h> 143151937Sjkim#include <contrib/dev/acpica/amlresrc.h> 144151937Sjkim#include <contrib/dev/acpica/acdebug.h> 145118611Snjl 146151937Sjkim/* Compiler headers */ 147118611Snjl 148151937Sjkim#include <contrib/dev/acpica/compiler/asldefine.h> 149151937Sjkim#include <contrib/dev/acpica/compiler/asltypes.h> 150151937Sjkim#include <contrib/dev/acpica/compiler/aslglobal.h> 151118611Snjl 152118611Snjl 153118611Snjl/******************************************************************************* 154118611Snjl * 155118611Snjl * Compiler prototypes 156118611Snjl * 157118611Snjl ******************************************************************************/ 158118611Snjl 159151937Sjkim/* 160151937Sjkim * parser - generated from flex/bison, lex/yacc, etc. 161151937Sjkim */ 162118611Snjlint 163118611SnjlAslCompilerparse( 164118611Snjl void); 165118611Snjl 166118611SnjlACPI_PARSE_OBJECT * 167118611SnjlAslDoError ( 168118611Snjl void); 169118611Snjl 170118611Snjlint 171118611SnjlAslCompilerlex( 172118611Snjl void); 173118611Snjl 174118611Snjlvoid 175118611SnjlResetCurrentLineBuffer ( 176118611Snjl void); 177118611Snjl 178118611Snjlvoid 179118611SnjlInsertLineBuffer ( 180118611Snjl int SourceChar); 181118611Snjl 182118611Snjlint 183118611SnjlAslPopInputFileStack ( 184118611Snjl void); 185118611Snjl 186118611Snjlvoid 187118611SnjlAslPushInputFileStack ( 188118611Snjl FILE *InputFile, 189118611Snjl char *Filename); 190118611Snjl 191118611Snjl 192151937Sjkim/* 193151937Sjkim * aslcompile - compile mainline 194151937Sjkim */ 195118611Snjlvoid 196118611SnjlAslCompilerSignon ( 197118611Snjl UINT32 FileId); 198118611Snjl 199118611Snjlvoid 200118611SnjlAslCompilerFileHeader ( 201118611Snjl UINT32 FileId); 202118611Snjl 203151937Sjkimint 204151937SjkimCmDoCompile ( 205151937Sjkim void); 206151937Sjkim 207118611Snjlvoid 208151937SjkimCmDoOutputFiles ( 209151937Sjkim void); 210118611Snjl 211151937Sjkimvoid 212151937SjkimCmCleanupAndExit ( 213151937Sjkim void); 214118611Snjl 215118611Snjl 216151937Sjkim/* 217151937Sjkim * aslanalyze - semantic analysis 218151937Sjkim */ 219151937SjkimACPI_STATUS 220151937SjkimAnOtherSemanticAnalysisWalkBegin ( 221151937Sjkim ACPI_PARSE_OBJECT *Op, 222151937Sjkim UINT32 Level, 223151937Sjkim void *Context); 224118611Snjl 225151937SjkimACPI_STATUS 226151937SjkimAnOtherSemanticAnalysisWalkEnd ( 227151937Sjkim ACPI_PARSE_OBJECT *Op, 228151937Sjkim UINT32 Level, 229151937Sjkim void *Context); 230118611Snjl 231151937SjkimACPI_STATUS 232151937SjkimAnOperandTypecheckWalkBegin ( 233151937Sjkim ACPI_PARSE_OBJECT *Op, 234151937Sjkim UINT32 Level, 235151937Sjkim void *Context); 236118611Snjl 237151937SjkimACPI_STATUS 238151937SjkimAnOperandTypecheckWalkEnd ( 239151937Sjkim ACPI_PARSE_OBJECT *Op, 240151937Sjkim UINT32 Level, 241151937Sjkim void *Context); 242118611Snjl 243151937SjkimACPI_STATUS 244151937SjkimAnMethodAnalysisWalkBegin ( 245151937Sjkim ACPI_PARSE_OBJECT *Op, 246151937Sjkim UINT32 Level, 247151937Sjkim void *Context); 248118611Snjl 249151937SjkimACPI_STATUS 250151937SjkimAnMethodAnalysisWalkEnd ( 251151937Sjkim ACPI_PARSE_OBJECT *Op, 252151937Sjkim UINT32 Level, 253151937Sjkim void *Context); 254118611Snjl 255151937SjkimACPI_STATUS 256151937SjkimAnMethodTypingWalkBegin ( 257151937Sjkim ACPI_PARSE_OBJECT *Op, 258151937Sjkim UINT32 Level, 259151937Sjkim void *Context); 260118611Snjl 261151937SjkimACPI_STATUS 262151937SjkimAnMethodTypingWalkEnd ( 263151937Sjkim ACPI_PARSE_OBJECT *Op, 264151937Sjkim UINT32 Level, 265151937Sjkim void *Context); 266118611Snjl 267151937Sjkim 268151937Sjkim/* 269151937Sjkim * aslerror - error handling/reporting 270151937Sjkim */ 271118611Snjlvoid 272118611SnjlAslError ( 273118611Snjl UINT8 Level, 274118611Snjl UINT8 MessageId, 275118611Snjl ACPI_PARSE_OBJECT *Op, 276118611Snjl char *ExtraMessage); 277118611Snjl 278118611Snjlvoid 279118611SnjlAslCoreSubsystemError ( 280118611Snjl ACPI_PARSE_OBJECT *Op, 281118611Snjl ACPI_STATUS Status, 282118611Snjl char *ExtraMessage, 283118611Snjl BOOLEAN Abort); 284118611Snjl 285151937Sjkimint 286151937SjkimAslCompilererror( 287151937Sjkim char *s); 288151937Sjkim 289118611Snjlvoid 290118611SnjlAslCommonError ( 291118611Snjl UINT8 Level, 292118611Snjl UINT8 MessageId, 293118611Snjl UINT32 CurrentLineNumber, 294118611Snjl UINT32 LogicalLineNumber, 295118611Snjl UINT32 LogicalByteOffset, 296118611Snjl UINT32 Column, 297118611Snjl char *Filename, 298118611Snjl char *ExtraMessage); 299118611Snjl 300118611Snjlvoid 301118611SnjlAePrintException ( 302118611Snjl UINT32 FileId, 303118611Snjl ASL_ERROR_MSG *Enode, 304118611Snjl char *Header); 305118611Snjl 306118611Snjlvoid 307118611SnjlAePrintErrorLog ( 308118611Snjl UINT32 FileId); 309118611Snjl 310167802SjkimACPI_PHYSICAL_ADDRESS 311118611SnjlAeLocalGetRootPointer ( 312167802Sjkim void); 313118611Snjl 314118611Snjl 315151937Sjkim/* 316151937Sjkim * asllisting - generate all "listing" type files 317151937Sjkim */ 318118611Snjlvoid 319151937SjkimLsDoListings ( 320151937Sjkim void); 321118611Snjl 322118611Snjlvoid 323118611SnjlLsWriteNodeToAsmListing ( 324118611Snjl ACPI_PARSE_OBJECT *Op); 325118611Snjl 326118611Snjlvoid 327118611SnjlLsWriteNode ( 328118611Snjl ACPI_PARSE_OBJECT *Op, 329118611Snjl UINT32 FileId); 330118611Snjl 331118611Snjlvoid 332118611SnjlLsDoHexOutput ( 333118611Snjl void); 334118611Snjl 335167802Sjkimvoid 336167802SjkimLsDumpParseTree ( 337167802Sjkim void); 338118611Snjl 339151937Sjkim/* 340151937Sjkim * aslfold - constant folding 341151937Sjkim */ 342151937SjkimACPI_STATUS 343151937SjkimOpcAmlConstantWalk ( 344151937Sjkim ACPI_PARSE_OBJECT *Op, 345151937Sjkim UINT32 Level, 346151937Sjkim void *Context); 347118611Snjl 348118611Snjl 349118611Snjl/* 350118611Snjl * aslopcodes - generate AML opcodes 351118611Snjl */ 352118611SnjlACPI_STATUS 353118611SnjlOpcAmlOpcodeWalk ( 354118611Snjl ACPI_PARSE_OBJECT *Op, 355118611Snjl UINT32 Level, 356118611Snjl void *Context); 357118611Snjl 358118611SnjlACPI_STATUS 359151937SjkimOpcAmlOpcodeUpdateWalk ( 360118611Snjl ACPI_PARSE_OBJECT *Op, 361118611Snjl UINT32 Level, 362118611Snjl void *Context); 363118611Snjl 364118611Snjlvoid 365118611SnjlOpcGenerateAmlOpcode ( 366118611Snjl ACPI_PARSE_OBJECT *Op); 367118611Snjl 368118611SnjlUINT32 369118611SnjlOpcSetOptimalIntegerSize ( 370118611Snjl ACPI_PARSE_OBJECT *Op); 371118611Snjl 372118611Snjlvoid 373118611SnjlOpcGetIntegerWidth ( 374118611Snjl ACPI_PARSE_OBJECT *Op); 375118611Snjl 376151937Sjkim 377118611Snjl/* 378118611Snjl * asloperands - generate AML operands for the AML opcodes 379118611Snjl */ 380151937SjkimACPI_PARSE_OBJECT * 381151937SjkimUtGetArg ( 382151937Sjkim ACPI_PARSE_OBJECT *Op, 383151937Sjkim UINT32 Argn); 384118611Snjl 385118611Snjlvoid 386118611SnjlOpnGenerateAmlOperands ( 387118611Snjl ACPI_PARSE_OBJECT *Op); 388118611Snjl 389118611Snjlvoid 390118611SnjlOpnDoPackage ( 391118611Snjl ACPI_PARSE_OBJECT *Op); 392118611Snjl 393118611Snjl 394118611Snjl/* 395118611Snjl * aslopt - optmization 396118611Snjl */ 397118611Snjlvoid 398118611SnjlOptOptimizeNamePath ( 399118611Snjl ACPI_PARSE_OBJECT *Op, 400118611Snjl UINT32 Flags, 401118611Snjl ACPI_WALK_STATE *WalkState, 402118611Snjl char *AmlNameString, 403118611Snjl ACPI_NAMESPACE_NODE *TargetNode); 404118611Snjl 405118611Snjl 406118611Snjl/* 407151937Sjkim * aslcodegen - code generation 408118611Snjl */ 409118611Snjlvoid 410151937SjkimCgGenerateAmlOutput ( 411151937Sjkim void); 412118611Snjl 413118611Snjl 414151937Sjkim/* 415151937Sjkim * asllength - calculate/adjust AML package lengths 416151937Sjkim */ 417118611SnjlACPI_STATUS 418118611SnjlLnPackageLengthWalk ( 419118611Snjl ACPI_PARSE_OBJECT *Op, 420118611Snjl UINT32 Level, 421118611Snjl void *Context); 422118611Snjl 423118611SnjlACPI_STATUS 424118611SnjlLnInitLengthsWalk ( 425118611Snjl ACPI_PARSE_OBJECT *Op, 426118611Snjl UINT32 Level, 427118611Snjl void *Context); 428118611Snjl 429118611Snjlvoid 430151937SjkimCgGenerateAmlLengths ( 431151937Sjkim ACPI_PARSE_OBJECT *Op); 432118611Snjl 433118611Snjl 434118611Snjl/* 435151937Sjkim * aslmap - opcode mappings and reserved method names 436118611Snjl */ 437118611SnjlACPI_OBJECT_TYPE 438118611SnjlAslMapNamedOpcodeToDataType ( 439118611Snjl UINT16 Opcode); 440118611Snjl 441151937Sjkimvoid 442151937SjkimMpDisplayReservedNames ( 443151937Sjkim void); 444151937Sjkim 445151937Sjkim 446118611Snjl/* 447118611Snjl * asltransform - parse tree transformations 448118611Snjl */ 449118611SnjlACPI_STATUS 450118611SnjlTrAmlTransformWalk ( 451118611Snjl ACPI_PARSE_OBJECT *Op, 452118611Snjl UINT32 Level, 453118611Snjl void *Context); 454118611Snjl 455118611Snjl 456118611Snjl/* 457118611Snjl * asltree - parse tree support 458118611Snjl */ 459118611SnjlACPI_STATUS 460118611SnjlTrWalkParseTree ( 461118611Snjl ACPI_PARSE_OBJECT *Op, 462118611Snjl UINT32 Visitation, 463118611Snjl ASL_WALK_CALLBACK DescendingCallback, 464118611Snjl ASL_WALK_CALLBACK AscendingCallback, 465118611Snjl void *Context); 466118611Snjl 467118611Snjl/* Values for "Visitation" parameter above */ 468118611Snjl 469118611Snjl#define ASL_WALK_VISIT_DOWNWARD 0x01 470118611Snjl#define ASL_WALK_VISIT_UPWARD 0x02 471118611Snjl#define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD) 472118611Snjl 473118611Snjl 474151937SjkimACPI_PARSE_OBJECT * 475151937SjkimTrAllocateNode ( 476151937Sjkim UINT32 ParseOpcode); 477118611Snjl 478151937Sjkimvoid 479151937SjkimTrReleaseNode ( 480151937Sjkim ACPI_PARSE_OBJECT *Op); 481151937Sjkim 482118611SnjlACPI_PARSE_OBJECT * 483118611SnjlTrUpdateNode ( 484118611Snjl UINT32 ParseOpcode, 485118611Snjl ACPI_PARSE_OBJECT *Op); 486118611Snjl 487118611SnjlACPI_PARSE_OBJECT * 488118611SnjlTrCreateNode ( 489118611Snjl UINT32 ParseOpcode, 490118611Snjl UINT32 NumChildren, 491118611Snjl ...); 492118611Snjl 493118611SnjlACPI_PARSE_OBJECT * 494118611SnjlTrCreateLeafNode ( 495118611Snjl UINT32 ParseOpcode); 496118611Snjl 497118611SnjlACPI_PARSE_OBJECT * 498118611SnjlTrCreateValuedLeafNode ( 499118611Snjl UINT32 ParseOpcode, 500118611Snjl ACPI_INTEGER Value); 501118611Snjl 502118611SnjlACPI_PARSE_OBJECT * 503118611SnjlTrLinkChildren ( 504118611Snjl ACPI_PARSE_OBJECT *Op, 505118611Snjl UINT32 NumChildren, 506118611Snjl ...); 507118611Snjl 508118611Snjlvoid 509118611SnjlTrSetEndLineNumber ( 510118611Snjl ACPI_PARSE_OBJECT *Op); 511118611Snjl 512118611Snjlvoid 513151937SjkimTrWalkTree ( 514151937Sjkim void); 515118611Snjl 516118611SnjlACPI_PARSE_OBJECT * 517118611SnjlTrLinkPeerNode ( 518118611Snjl ACPI_PARSE_OBJECT *Op1, 519118611Snjl ACPI_PARSE_OBJECT *Op2); 520118611Snjl 521118611SnjlACPI_PARSE_OBJECT * 522118611SnjlTrLinkChildNode ( 523118611Snjl ACPI_PARSE_OBJECT *Op1, 524118611Snjl ACPI_PARSE_OBJECT *Op2); 525118611Snjl 526118611SnjlACPI_PARSE_OBJECT * 527118611SnjlTrSetNodeFlags ( 528118611Snjl ACPI_PARSE_OBJECT *Op, 529118611Snjl UINT32 Flags); 530118611Snjl 531118611SnjlACPI_PARSE_OBJECT * 532118611SnjlTrLinkPeerNodes ( 533118611Snjl UINT32 NumPeers, 534118611Snjl ...); 535118611Snjl 536118611Snjl 537118611Snjl/* 538118611Snjl * aslfiles - File I/O support 539118611Snjl */ 540118611Snjlvoid 541151937SjkimAslAbort ( 542151937Sjkim void); 543118611Snjl 544118611Snjlvoid 545118611SnjlFlOpenIncludeFile ( 546118611Snjl ACPI_PARSE_OBJECT *Op); 547118611Snjl 548118611Snjlvoid 549118611SnjlFlFileError ( 550118611Snjl UINT32 FileId, 551118611Snjl UINT8 ErrorId); 552118611Snjl 553118611SnjlACPI_STATUS 554118611SnjlFlReadFile ( 555118611Snjl UINT32 FileId, 556118611Snjl void *Buffer, 557118611Snjl UINT32 Length); 558118611Snjl 559118611Snjlvoid 560118611SnjlFlWriteFile ( 561118611Snjl UINT32 FileId, 562118611Snjl void *Buffer, 563118611Snjl UINT32 Length); 564118611Snjl 565118611Snjlvoid 566118611SnjlFlSeekFile ( 567118611Snjl UINT32 FileId, 568118611Snjl long Offset); 569118611Snjl 570118611Snjlvoid 571118611SnjlFlCloseFile ( 572118611Snjl UINT32 FileId); 573118611Snjl 574118611Snjlvoid 575118611SnjlFlPrintFile ( 576118611Snjl UINT32 FileId, 577118611Snjl char *Format, 578118611Snjl ...); 579118611Snjl 580118611Snjlvoid 581118611SnjlFlSetLineNumber ( 582118611Snjl ACPI_PARSE_OBJECT *Op); 583118611Snjl 584118611SnjlACPI_STATUS 585118611SnjlFlOpenInputFile ( 586118611Snjl char *InputFilename); 587118611Snjl 588118611SnjlACPI_STATUS 589118611SnjlFlOpenAmlOutputFile ( 590118611Snjl char *InputFilename); 591118611Snjl 592118611SnjlACPI_STATUS 593118611SnjlFlOpenMiscOutputFiles ( 594118611Snjl char *InputFilename); 595118611Snjl 596118611Snjl 597151937Sjkim/* 598151937Sjkim * asload - load namespace in prep for cross reference 599151937Sjkim */ 600118611SnjlACPI_STATUS 601118611SnjlLdLoadNamespace ( 602118611Snjl ACPI_PARSE_OBJECT *RootOp); 603118611Snjl 604118611Snjl 605151937Sjkim/* 606151937Sjkim * asllookup - namespace cross reference 607151937Sjkim */ 608118611SnjlACPI_STATUS 609151937SjkimLkCrossReferenceNamespace ( 610151937Sjkim void); 611118611Snjl 612167802Sjkimvoid 613167802SjkimLkFindUnreferencedObjects ( 614167802Sjkim void); 615167802Sjkim 616118611SnjlACPI_STATUS 617118611SnjlLsDisplayNamespace ( 618118611Snjl void); 619118611Snjl 620118611Snjl 621151937Sjkim/* 622151937Sjkim * aslutils - common compiler utilites 623151937Sjkim */ 624151937Sjkimvoid 625151937SjkimDbgPrint ( 626151937Sjkim UINT32 Type, 627151937Sjkim char *Format, 628151937Sjkim ...); 629118611Snjl 630151937Sjkim/* Type values for above */ 631118611Snjl 632151937Sjkim#define ASL_DEBUG_OUTPUT 0 633151937Sjkim#define ASL_PARSE_OUTPUT 1 634151937Sjkim#define ASL_TREE_OUTPUT 2 635151937Sjkim 636118611Snjlvoid 637118611SnjlUtDisplayConstantOpcodes ( 638118611Snjl void); 639118611Snjl 640151937SjkimUINT8 641118611SnjlUtBeginEvent ( 642118611Snjl char *Name); 643118611Snjl 644118611Snjlvoid 645118611SnjlUtEndEvent ( 646151937Sjkim UINT8 Event); 647118611Snjl 648118611Snjlvoid * 649118611SnjlUtLocalCalloc ( 650118611Snjl UINT32 Size); 651118611Snjl 652118611Snjlvoid 653118611SnjlUtPrintFormattedName ( 654118611Snjl UINT16 ParseOpcode, 655118611Snjl UINT32 Level); 656118611Snjl 657118611Snjlvoid 658118611SnjlUtDisplaySummary ( 659118611Snjl UINT32 FileId); 660118611Snjl 661118611SnjlUINT8 662118611SnjlUtHexCharToValue ( 663151937Sjkim int HexChar); 664118611Snjl 665118611Snjlvoid 666118611SnjlUtConvertByteToHex ( 667118611Snjl UINT8 RawByte, 668118611Snjl UINT8 *Buffer); 669118611Snjl 670118611Snjlvoid 671118611SnjlUtConvertByteToAsmHex ( 672118611Snjl UINT8 RawByte, 673118611Snjl UINT8 *Buffer); 674118611Snjl 675118611Snjlchar * 676118611SnjlUtGetOpName ( 677118611Snjl UINT32 ParseOpcode); 678118611Snjl 679118611Snjlvoid 680118611SnjlUtSetParseOpName ( 681118611Snjl ACPI_PARSE_OBJECT *Op); 682118611Snjl 683118611Snjlchar * 684118611SnjlUtGetStringBuffer ( 685118611Snjl UINT32 Length); 686118611Snjl 687118611SnjlACPI_STATUS 688118611SnjlUtInternalizeName ( 689118611Snjl char *ExternalName, 690118611Snjl char **ConvertedName); 691118611Snjl 692118611Snjlvoid 693118611SnjlUtAttachNamepathToOwner ( 694118611Snjl ACPI_PARSE_OBJECT *Op, 695118611Snjl ACPI_PARSE_OBJECT *NameNode); 696118611Snjl 697118611SnjlACPI_PARSE_OBJECT * 698118611SnjlUtCheckIntegerRange ( 699118611Snjl ACPI_PARSE_OBJECT *Op, 700118611Snjl UINT32 LowValue, 701118611Snjl UINT32 HighValue); 702118611Snjl 703118611SnjlACPI_INTEGER 704118611SnjlUtDoConstant ( 705118611Snjl char *String); 706118611Snjl 707118611Snjl 708118611Snjl/* 709151937Sjkim * aslresource - Resource template generation utilities 710118611Snjl */ 711118611SnjlASL_RESOURCE_NODE * 712118611SnjlRsAllocateResourceNode ( 713118611Snjl UINT32 Size); 714118611Snjl 715151937Sjkimvoid 716118611SnjlRsCreateBitField ( 717118611Snjl ACPI_PARSE_OBJECT *Op, 718118611Snjl char *Name, 719118611Snjl UINT32 ByteOffset, 720118611Snjl UINT32 BitOffset); 721118611Snjl 722118611Snjlvoid 723118611SnjlRsCreateByteField ( 724118611Snjl ACPI_PARSE_OBJECT *Op, 725118611Snjl char *Name, 726118611Snjl UINT32 ByteOffset); 727118611Snjl 728118611Snjlvoid 729118611SnjlRsSetFlagBits ( 730118611Snjl UINT8 *Flags, 731118611Snjl ACPI_PARSE_OBJECT *Op, 732118611Snjl UINT8 Position, 733118611Snjl UINT8 DefaultBit); 734118611Snjl 735118611SnjlACPI_PARSE_OBJECT * 736118611SnjlRsCompleteNodeAndGetNext ( 737118611Snjl ACPI_PARSE_OBJECT *Op); 738118611Snjl 739151937Sjkimvoid 740151937SjkimRsCheckListForDuplicates ( 741151937Sjkim ACPI_PARSE_OBJECT *Op); 742151937Sjkim 743118611SnjlASL_RESOURCE_NODE * 744118611SnjlRsDoOneResourceDescriptor ( 745118611Snjl ACPI_PARSE_OBJECT *DescriptorTypeOp, 746118611Snjl UINT32 CurrentByteOffset, 747118611Snjl UINT8 *State); 748118611Snjl 749151937Sjkim/* Values for State above */ 750151937Sjkim 751118611Snjl#define ACPI_RSTATE_NORMAL 0 752118611Snjl#define ACPI_RSTATE_START_DEPENDENT 1 753118611Snjl#define ACPI_RSTATE_DEPENDENT_LIST 2 754118611Snjl 755118611SnjlUINT32 756118611SnjlRsLinkDescriptorChain ( 757118611Snjl ASL_RESOURCE_NODE **PreviousRnode, 758118611Snjl ASL_RESOURCE_NODE *Rnode); 759118611Snjl 760151937Sjkimvoid 761151937SjkimRsDoResourceTemplate ( 762151937Sjkim ACPI_PARSE_OBJECT *Op); 763118611Snjl 764151937Sjkim 765118611Snjl/* 766151937Sjkim * aslrestype1 - generate Small descriptors 767118611Snjl */ 768118611SnjlASL_RESOURCE_NODE * 769167802SjkimRsDoEndTagDescriptor ( 770167802Sjkim ACPI_PARSE_OBJECT *Op, 771167802Sjkim UINT32 CurrentByteOffset); 772167802Sjkim 773167802SjkimASL_RESOURCE_NODE * 774118611SnjlRsDoDmaDescriptor ( 775118611Snjl ACPI_PARSE_OBJECT *Op, 776118611Snjl UINT32 CurrentByteOffset); 777118611Snjl 778118611SnjlASL_RESOURCE_NODE * 779118611SnjlRsDoEndDependentDescriptor ( 780118611Snjl ACPI_PARSE_OBJECT *Op, 781118611Snjl UINT32 CurrentByteOffset); 782118611Snjl 783118611SnjlASL_RESOURCE_NODE * 784118611SnjlRsDoFixedIoDescriptor ( 785118611Snjl ACPI_PARSE_OBJECT *Op, 786118611Snjl UINT32 CurrentByteOffset); 787118611Snjl 788118611SnjlASL_RESOURCE_NODE * 789118611SnjlRsDoIoDescriptor ( 790118611Snjl ACPI_PARSE_OBJECT *Op, 791118611Snjl UINT32 CurrentByteOffset); 792118611Snjl 793118611SnjlASL_RESOURCE_NODE * 794118611SnjlRsDoIrqDescriptor ( 795118611Snjl ACPI_PARSE_OBJECT *Op, 796118611Snjl UINT32 CurrentByteOffset); 797118611Snjl 798118611SnjlASL_RESOURCE_NODE * 799118611SnjlRsDoIrqNoFlagsDescriptor ( 800118611Snjl ACPI_PARSE_OBJECT *Op, 801118611Snjl UINT32 CurrentByteOffset); 802118611Snjl 803118611SnjlASL_RESOURCE_NODE * 804118611SnjlRsDoMemory24Descriptor ( 805118611Snjl ACPI_PARSE_OBJECT *Op, 806118611Snjl UINT32 CurrentByteOffset); 807118611Snjl 808118611SnjlASL_RESOURCE_NODE * 809118611SnjlRsDoMemory32Descriptor ( 810118611Snjl ACPI_PARSE_OBJECT *Op, 811118611Snjl UINT32 CurrentByteOffset); 812118611Snjl 813118611SnjlASL_RESOURCE_NODE * 814118611SnjlRsDoMemory32FixedDescriptor ( 815118611Snjl ACPI_PARSE_OBJECT *Op, 816118611Snjl UINT32 CurrentByteOffset); 817118611Snjl 818118611SnjlASL_RESOURCE_NODE * 819118611SnjlRsDoStartDependentDescriptor ( 820118611Snjl ACPI_PARSE_OBJECT *Op, 821118611Snjl UINT32 CurrentByteOffset); 822118611Snjl 823118611SnjlASL_RESOURCE_NODE * 824118611SnjlRsDoStartDependentNoPriDescriptor ( 825118611Snjl ACPI_PARSE_OBJECT *Op, 826118611Snjl UINT32 CurrentByteOffset); 827118611Snjl 828118611SnjlASL_RESOURCE_NODE * 829118611SnjlRsDoVendorSmallDescriptor ( 830118611Snjl ACPI_PARSE_OBJECT *Op, 831118611Snjl UINT32 CurrentByteOffset); 832118611Snjl 833118611Snjl 834118611Snjl/* 835151937Sjkim * aslrestype2 - generate Large descriptors 836118611Snjl */ 837151937SjkimASL_RESOURCE_NODE * 838151937SjkimRsDoInterruptDescriptor ( 839151937Sjkim ACPI_PARSE_OBJECT *Op, 840151937Sjkim UINT32 CurrentByteOffset); 841118611Snjl 842118611SnjlASL_RESOURCE_NODE * 843118611SnjlRsDoDwordIoDescriptor ( 844118611Snjl ACPI_PARSE_OBJECT *Op, 845118611Snjl UINT32 CurrentByteOffset); 846118611Snjl 847118611SnjlASL_RESOURCE_NODE * 848118611SnjlRsDoDwordMemoryDescriptor ( 849118611Snjl ACPI_PARSE_OBJECT *Op, 850118611Snjl UINT32 CurrentByteOffset); 851118611Snjl 852118611SnjlASL_RESOURCE_NODE * 853151937SjkimRsDoDwordSpaceDescriptor ( 854151937Sjkim ACPI_PARSE_OBJECT *Op, 855151937Sjkim UINT32 CurrentByteOffset); 856151937Sjkim 857151937SjkimASL_RESOURCE_NODE * 858151937SjkimRsDoExtendedIoDescriptor ( 859151937Sjkim ACPI_PARSE_OBJECT *Op, 860151937Sjkim UINT32 CurrentByteOffset); 861151937Sjkim 862151937SjkimASL_RESOURCE_NODE * 863151937SjkimRsDoExtendedMemoryDescriptor ( 864151937Sjkim ACPI_PARSE_OBJECT *Op, 865151937Sjkim UINT32 CurrentByteOffset); 866151937Sjkim 867151937SjkimASL_RESOURCE_NODE * 868151937SjkimRsDoExtendedSpaceDescriptor ( 869151937Sjkim ACPI_PARSE_OBJECT *Op, 870151937Sjkim UINT32 CurrentByteOffset); 871151937Sjkim 872151937SjkimASL_RESOURCE_NODE * 873118611SnjlRsDoQwordIoDescriptor ( 874118611Snjl ACPI_PARSE_OBJECT *Op, 875118611Snjl UINT32 CurrentByteOffset); 876118611Snjl 877118611SnjlASL_RESOURCE_NODE * 878118611SnjlRsDoQwordMemoryDescriptor ( 879118611Snjl ACPI_PARSE_OBJECT *Op, 880118611Snjl UINT32 CurrentByteOffset); 881118611Snjl 882118611SnjlASL_RESOURCE_NODE * 883151937SjkimRsDoQwordSpaceDescriptor ( 884151937Sjkim ACPI_PARSE_OBJECT *Op, 885151937Sjkim UINT32 CurrentByteOffset); 886151937Sjkim 887151937SjkimASL_RESOURCE_NODE * 888118611SnjlRsDoWordIoDescriptor ( 889118611Snjl ACPI_PARSE_OBJECT *Op, 890118611Snjl UINT32 CurrentByteOffset); 891118611Snjl 892118611SnjlASL_RESOURCE_NODE * 893151937SjkimRsDoWordSpaceDescriptor ( 894151937Sjkim ACPI_PARSE_OBJECT *Op, 895151937Sjkim UINT32 CurrentByteOffset); 896151937Sjkim 897151937SjkimASL_RESOURCE_NODE * 898118611SnjlRsDoWordBusNumberDescriptor ( 899118611Snjl ACPI_PARSE_OBJECT *Op, 900118611Snjl UINT32 CurrentByteOffset); 901118611Snjl 902118611SnjlASL_RESOURCE_NODE * 903118611SnjlRsDoVendorLargeDescriptor ( 904118611Snjl ACPI_PARSE_OBJECT *Op, 905118611Snjl UINT32 CurrentByteOffset); 906118611Snjl 907118611SnjlASL_RESOURCE_NODE * 908118611SnjlRsDoGeneralRegisterDescriptor ( 909118611Snjl ACPI_PARSE_OBJECT *Op, 910118611Snjl UINT32 CurrentByteOffset); 911118611Snjl 912118611Snjl#endif /* __ASLCOMPILER_H */ 913118611Snjl 914