acapps.h revision 198237
1100894Srwatson/******************************************************************************
2100894Srwatson *
3100894Srwatson * Module Name: acapps - common include for ACPI applications/tools
4100894Srwatson *
5100894Srwatson *****************************************************************************/
6100894Srwatson
7100894Srwatson/******************************************************************************
8100894Srwatson *
9100894Srwatson * 1. Copyright Notice
10100894Srwatson *
11100894Srwatson * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
12100894Srwatson * All rights reserved.
13100894Srwatson *
14100894Srwatson * 2. License
15100894Srwatson *
16100894Srwatson * 2.1. This is your license from Intel Corp. under its intellectual property
17100894Srwatson * rights.  You may have additional license terms from the party that provided
18100894Srwatson * you this software, covering your right to use that party's intellectual
19100894Srwatson * property rights.
20100894Srwatson *
21100894Srwatson * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22100894Srwatson * copy of the source code appearing in this file ("Covered Code") an
23100894Srwatson * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24100894Srwatson * base code distributed originally by Intel ("Original Intel Code") to copy,
25100894Srwatson * make derivatives, distribute, use and display any portion of the Covered
26100894Srwatson * Code in any form, with the right to sublicense such rights; and
27100894Srwatson *
28100894Srwatson * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29100894Srwatson * license (with the right to sublicense), under only those claims of Intel
30100894Srwatson * patents that are infringed by the Original Intel Code, to make, use, sell,
31100894Srwatson * offer to sell, and import the Covered Code and derivative works thereof
32100894Srwatson * solely to the minimum extent necessary to exercise the above copyright
33100894Srwatson * license, and in no event shall the patent license extend to any additions
34100894Srwatson * to or modifications of the Original Intel Code.  No other license or right
35100894Srwatson * is granted directly or by implication, estoppel or otherwise;
36100894Srwatson *
37100894Srwatson * The above copyright and patent license is granted only if the following
38100894Srwatson * conditions are met:
39100894Srwatson *
40100894Srwatson * 3. Conditions
41100894Srwatson *
42100894Srwatson * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43100894Srwatson * Redistribution of source code of any substantial portion of the Covered
44100894Srwatson * Code or modification with rights to further distribute source must include
45100894Srwatson * the above Copyright Notice, the above License, this list of Conditions,
46100894Srwatson * and the following Disclaimer and Export Compliance provision.  In addition,
47100894Srwatson * Licensee must cause all Covered Code to which Licensee contributes to
48100894Srwatson * contain a file documenting the changes Licensee made to create that Covered
49101173Srwatson * Code and the date of any change.  Licensee must include in that file the
50100894Srwatson * documentation of any changes made by any predecessor Licensee.  Licensee
51100979Srwatson * must include a prominent statement that the modification is derived,
52100979Srwatson * directly or indirectly, from Original Intel Code.
53100979Srwatson *
54100979Srwatson * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55100979Srwatson * Redistribution of source code of any substantial portion of the Covered
56100979Srwatson * Code or modification without rights to further distribute source must
57101712Srwatson * include the following Disclaimer and Export Compliance provision in the
58100979Srwatson * documentation and/or other materials provided with distribution.  In
59100979Srwatson * addition, Licensee may not authorize further sublicense of source of any
60100894Srwatson * portion of the Covered Code, and must include terms to the effect that the
61100894Srwatson * license from Licensee to its licensee is limited to the intellectual
62100979Srwatson * property embodied in the software Licensee provides to its licensee, and
63100979Srwatson * not to intellectual property embodied in modifications its licensee may
64100979Srwatson * make.
65100979Srwatson *
66100979Srwatson * 3.3. Redistribution of Executable. Redistribution in executable form of any
67100979Srwatson * substantial portion of the Covered Code or modification must reproduce the
68100979Srwatson * above Copyright Notice, and the following Disclaimer and Export Compliance
69100979Srwatson * provision in the documentation and/or other materials provided with the
70100979Srwatson * distribution.
71100894Srwatson *
72100979Srwatson * 3.4. Intel retains all right, title, and interest in and to the Original
73100979Srwatson * Intel Code.
74100979Srwatson *
75100979Srwatson * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76100979Srwatson * Intel shall be used in advertising or otherwise to promote the sale, use or
77100979Srwatson * other dealings in products derived from or relating to the Covered Code
78100979Srwatson * without prior written authorization from Intel.
79100979Srwatson *
80100979Srwatson * 4. Disclaimer and Export Compliance
81100979Srwatson *
82100979Srwatson * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83100979Srwatson * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84100979Srwatson * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85100979Srwatson * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86100979Srwatson * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87100979Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88100979Srwatson * PARTICULAR PURPOSE.
89100979Srwatson *
90100979Srwatson * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91101712Srwatson * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92101712Srwatson * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93101712Srwatson * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94101712Srwatson * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95101712Srwatson * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96101712Srwatson * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97101712Srwatson * LIMITED REMEDY.
98100979Srwatson *
99100979Srwatson * 4.3. Licensee shall not export, either directly or indirectly, any of this
100100979Srwatson * software or system incorporating such software without first obtaining any
101100979Srwatson * required license or other approval from the U. S. Department of Commerce or
102100979Srwatson * any other agency or department of the United States Government.  In the
103100979Srwatson * event Licensee exports any such software from the United States or
104100979Srwatson * re-exports any such software from a foreign destination, Licensee shall
105100979Srwatson * ensure that the distribution and export/re-export of the software is in
106100979Srwatson * compliance with all laws, regulations, orders, or other restrictions of the
107100979Srwatson * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108100979Srwatson * any of its subsidiaries will export/re-export any technical data, process,
109100979Srwatson * software, or service, directly or indirectly, to any country for which the
110100979Srwatson * United States government or any agency thereof requires an export license,
111100979Srwatson * other governmental approval, or letter of assurance, without first obtaining
112100979Srwatson * such license, approval or letter.
113100979Srwatson *
114100979Srwatson *****************************************************************************/
115100979Srwatson
116100979Srwatson#ifndef _ACAPPS
117100979Srwatson#define _ACAPPS
118100979Srwatson
119100979Srwatson
120100979Srwatson#ifdef _MSC_VER                 /* disable some level-4 warnings */
121100979Srwatson#pragma warning(disable:4100)   /* warning C4100: unreferenced formal parameter */
122100979Srwatson#endif
123100979Srwatson
124100979Srwatson#define FILE_SUFFIX_DISASSEMBLY     "dsl"
125100979Srwatson#define ACPI_TABLE_FILE_SUFFIX      ".dat"
126100979Srwatson
127100979Srwatson
128100979Srwatson/*
129100979Srwatson * getopt
130100979Srwatson */
131100979Srwatsonint
132100979SrwatsonAcpiGetopt(
133100979Srwatson    int                     argc,
134100979Srwatson    char                    **argv,
135100979Srwatson    char                    *opts);
136100979Srwatson
137100979Srwatsonextern int                  AcpiGbl_Optind;
138100979Srwatsonextern char                 *AcpiGbl_Optarg;
139100979Srwatson
140100979Srwatson
141100979Srwatson/*
142100979Srwatson * adisasm
143100979Srwatson */
144100979SrwatsonACPI_STATUS
145100979SrwatsonAdAmlDisassemble (
146100979Srwatson    BOOLEAN                 OutToFile,
147100979Srwatson    char                    *Filename,
148100979Srwatson    char                    *Prefix,
149100979Srwatson    char                    **OutFilename,
150100979Srwatson    BOOLEAN                 GetAllTables);
151100979Srwatson
152100979Srwatsonvoid
153100979SrwatsonAdPrintStatistics (
154100979Srwatson    void);
155100979Srwatson
156100979SrwatsonACPI_STATUS
157100979SrwatsonAdFindDsdt(
158100979Srwatson    UINT8                   **DsdtPtr,
159100979Srwatson    UINT32                  *DsdtLength);
160100979Srwatson
161100979Srwatsonvoid
162100979SrwatsonAdDumpTables (
163100979Srwatson    void);
164100979Srwatson
165100979SrwatsonACPI_STATUS
166100979SrwatsonAdGetLocalTables (
167100979Srwatson    char                    *Filename,
168100979Srwatson    BOOLEAN                 GetAllTables);
169100979Srwatson
170100979SrwatsonACPI_STATUS
171100979SrwatsonAdParseTable (
172100979Srwatson    ACPI_TABLE_HEADER       *Table,
173100979Srwatson    ACPI_OWNER_ID           *OwnerId,
174100979Srwatson    BOOLEAN                 LoadTable,
175100979Srwatson    BOOLEAN                 External);
176100979Srwatson
177100979SrwatsonACPI_STATUS
178100979SrwatsonAdDisplayTables (
179100979Srwatson    char                    *Filename,
180100979Srwatson    ACPI_TABLE_HEADER       *Table);
181100979Srwatson
182100979SrwatsonACPI_STATUS
183100979SrwatsonAdDisplayStatistics (
184100979Srwatson    void);
185100979Srwatson
186100979Srwatson
187100979Srwatson/*
188100979Srwatson * adwalk
189100979Srwatson */
190100979Srwatsonvoid
191100979SrwatsonAcpiDmCrossReferenceNamespace (
192100979Srwatson    ACPI_PARSE_OBJECT       *ParseTreeRoot,
193100979Srwatson    ACPI_NAMESPACE_NODE     *NamespaceRoot,
194100979Srwatson    ACPI_OWNER_ID           OwnerId);
195100979Srwatson
196100979Srwatsonvoid
197100979SrwatsonAcpiDmDumpTree (
198100979Srwatson    ACPI_PARSE_OBJECT       *Origin);
199100979Srwatson
200100979Srwatsonvoid
201100979SrwatsonAcpiDmFindOrphanMethods (
202100979Srwatson    ACPI_PARSE_OBJECT       *Origin);
203100979Srwatson
204100979Srwatsonvoid
205100979SrwatsonAcpiDmFinishNamespaceLoad (
206100979Srwatson    ACPI_PARSE_OBJECT       *ParseTreeRoot,
207100979Srwatson    ACPI_NAMESPACE_NODE     *NamespaceRoot,
208100979Srwatson    ACPI_OWNER_ID           OwnerId);
209100979Srwatson
210100979Srwatsonvoid
211100979SrwatsonAcpiDmConvertResourceIndexes (
212100979Srwatson    ACPI_PARSE_OBJECT       *ParseTreeRoot,
213100979Srwatson    ACPI_NAMESPACE_NODE     *NamespaceRoot);
214100979Srwatson
215100979Srwatson
216100979Srwatson/*
217100979Srwatson * adfile
218100979Srwatson */
219100979SrwatsonACPI_STATUS
220100979SrwatsonAdInitialize (
221100979Srwatson    void);
222100979Srwatson
223100979Srwatsonchar *
224100979SrwatsonFlGenerateFilename (
225100979Srwatson    char                    *InputFilename,
226100979Srwatson    char                    *Suffix);
227100979Srwatson
228100979SrwatsonACPI_STATUS
229100979SrwatsonFlSplitInputPathname (
230100979Srwatson    char                    *InputPath,
231100979Srwatson    char                    **OutDirectoryPath,
232100979Srwatson    char                    **OutFilename);
233100979Srwatson
234100979Srwatsonchar *
235100979SrwatsonFlGenerateFilename (
236100979Srwatson    char                    *InputFilename,
237100979Srwatson    char                    *Suffix);
238100979Srwatson
239100979Srwatsonchar *
240100979SrwatsonAdGenerateFilename (
241100979Srwatson    char                    *Prefix,
242100979Srwatson    char                    *TableId);
243100979Srwatson
244100979Srwatsonvoid
245100979SrwatsonAdWriteTable (
246100979Srwatson    ACPI_TABLE_HEADER       *Table,
247100979Srwatson    UINT32                  Length,
248100979Srwatson    char                    *TableName,
249100979Srwatson    char                    *OemTableId);
250100979Srwatson
251100979Srwatson#endif /* _ACAPPS */
252100979Srwatson
253100979Srwatson