xref: /titanic_50/usr/src/uts/intel/sys/acpi/acapps.h (revision 45818ee124adeaaf947698996b4f4c722afc6d1f)
1 /******************************************************************************
2  *
3  * Module Name: acapps - common include for ACPI applications/tools
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2011, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions, and the following disclaimer,
16  *    without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  *    substantially similar to the "NO WARRANTY" disclaimer below
19  *    ("Disclaimer") and any redistribution must be conditioned upon
20  *    including a substantially similar Disclaimer requirement for further
21  *    binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  *    of any contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #ifndef _ACAPPS
45 #define _ACAPPS
46 
47 
48 #ifdef _MSC_VER                 /* disable some level-4 warnings */
49 #pragma warning(disable:4100)   /* warning C4100: unreferenced formal parameter */
50 #endif
51 
52 /* Common info for tool signons */
53 
54 #define ACPICA_NAME                 "Intel ACPI Component Architecture"
55 #define ACPICA_COPYRIGHT            "Copyright (c) 2000 - 2011 Intel Corporation"
56 
57 #if ACPI_MACHINE_WIDTH == 64
58 #define ACPI_WIDTH          "-64"
59 
60 #elif ACPI_MACHINE_WIDTH == 32
61 #define ACPI_WIDTH          "-32"
62 
63 #else
64 #error unknown ACPI_MACHINE_WIDTH
65 #define ACPI_WIDTH          "-??"
66 
67 #endif
68 
69 /* Macros for signons and file headers */
70 
71 #define ACPI_COMMON_SIGNON(UtilityName) \
72     "\n%s\n%s version %8.8X%s [%s]\n%s\n\n", \
73     ACPICA_NAME, \
74     UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \
75     ACPICA_COPYRIGHT
76 
77 #define ACPI_COMMON_HEADER(UtilityName, Prefix) \
78     "%s%s\n%s%s version %8.8X%s [%s]\n%s%s\n%s\n", \
79     Prefix, ACPICA_NAME, \
80     Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \
81     Prefix, ACPICA_COPYRIGHT, \
82     Prefix
83 
84 #define FILE_SUFFIX_DISASSEMBLY     "dsl"
85 #define ACPI_TABLE_FILE_SUFFIX      ".dat"
86 
87 
88 /*
89  * getopt
90  */
91 int
92 AcpiGetopt(
93     int                     argc,
94     char                    **argv,
95     char                    *opts);
96 
97 extern int                  AcpiGbl_Optind;
98 extern int                  AcpiGbl_Opterr;
99 extern char                 *AcpiGbl_Optarg;
100 
101 
102 /*
103  * adisasm
104  */
105 ACPI_STATUS
106 AdAmlDisassemble (
107     BOOLEAN                 OutToFile,
108     char                    *Filename,
109     char                    *Prefix,
110     char                    **OutFilename,
111     BOOLEAN                 GetAllTables);
112 
113 void
114 AdPrintStatistics (
115     void);
116 
117 ACPI_STATUS
118 AdFindDsdt(
119     UINT8                   **DsdtPtr,
120     UINT32                  *DsdtLength);
121 
122 void
123 AdDumpTables (
124     void);
125 
126 ACPI_STATUS
127 AdGetLocalTables (
128     char                    *Filename,
129     BOOLEAN                 GetAllTables);
130 
131 ACPI_STATUS
132 AdParseTable (
133     ACPI_TABLE_HEADER       *Table,
134     ACPI_OWNER_ID           *OwnerId,
135     BOOLEAN                 LoadTable,
136     BOOLEAN                 External);
137 
138 ACPI_STATUS
139 AdDisplayTables (
140     char                    *Filename,
141     ACPI_TABLE_HEADER       *Table);
142 
143 ACPI_STATUS
144 AdDisplayStatistics (
145     void);
146 
147 
148 /*
149  * adwalk
150  */
151 void
152 AcpiDmCrossReferenceNamespace (
153     ACPI_PARSE_OBJECT       *ParseTreeRoot,
154     ACPI_NAMESPACE_NODE     *NamespaceRoot,
155     ACPI_OWNER_ID           OwnerId);
156 
157 void
158 AcpiDmDumpTree (
159     ACPI_PARSE_OBJECT       *Origin);
160 
161 void
162 AcpiDmFindOrphanMethods (
163     ACPI_PARSE_OBJECT       *Origin);
164 
165 void
166 AcpiDmFinishNamespaceLoad (
167     ACPI_PARSE_OBJECT       *ParseTreeRoot,
168     ACPI_NAMESPACE_NODE     *NamespaceRoot,
169     ACPI_OWNER_ID           OwnerId);
170 
171 void
172 AcpiDmConvertResourceIndexes (
173     ACPI_PARSE_OBJECT       *ParseTreeRoot,
174     ACPI_NAMESPACE_NODE     *NamespaceRoot);
175 
176 
177 /*
178  * adfile
179  */
180 ACPI_STATUS
181 AdInitialize (
182     void);
183 
184 char *
185 FlGenerateFilename (
186     char                    *InputFilename,
187     char                    *Suffix);
188 
189 ACPI_STATUS
190 FlSplitInputPathname (
191     char                    *InputPath,
192     char                    **OutDirectoryPath,
193     char                    **OutFilename);
194 
195 char *
196 AdGenerateFilename (
197     char                    *Prefix,
198     char                    *TableId);
199 
200 void
201 AdWriteTable (
202     ACPI_TABLE_HEADER       *Table,
203     UINT32                  Length,
204     char                    *TableName,
205     char                    *OemTableId);
206 
207 #endif /* _ACAPPS */
208 
209