acapps.h revision 1.6 1 /******************************************************************************
2 *
3 * Module Name: acapps - common include for ACPI applications/tools
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 #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 - 2014 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 #ifdef ACPI_REPRO
71 #define ACPI_DATE "18 Dec 2013"
72 #else
73 #define ACPI_DATE __DATE__
74 #endif
75
76 #define ACPI_COMMON_SIGNON(UtilityName) \
77 "\n%s\n%s version %8.8X%s [%s]\n%s\n\n", \
78 ACPICA_NAME, \
79 UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, ACPI_DATE, \
80 ACPICA_COPYRIGHT
81
82 #define ACPI_COMMON_HEADER(UtilityName, Prefix) \
83 "%s%s\n%s%s version %8.8X%s [%s]\n%s%s\n%s\n", \
84 Prefix, ACPICA_NAME, \
85 Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, ACPI_DATE, \
86 Prefix, ACPICA_COPYRIGHT, \
87 Prefix
88
89 /* Macros for usage messages */
90
91 #define ACPI_USAGE_HEADER(Usage) \
92 AcpiOsPrintf ("Usage: %s\nOptions:\n", Usage);
93
94 #define ACPI_USAGE_TEXT(Description) \
95 AcpiOsPrintf (Description);
96
97 #define ACPI_OPTION(Name, Description) \
98 AcpiOsPrintf (" %-18s%s\n", Name, Description);
99
100
101 #define FILE_SUFFIX_DISASSEMBLY "dsl"
102 #define ACPI_TABLE_FILE_SUFFIX ".dat"
103
104
105 /*
106 * getopt
107 */
108 int
109 AcpiGetopt(
110 int argc,
111 char **argv,
112 char *opts);
113
114 int
115 AcpiGetoptArgument (
116 int argc,
117 char **argv);
118
119 extern int AcpiGbl_Optind;
120 extern int AcpiGbl_Opterr;
121 extern int AcpiGbl_SubOptChar;
122 extern char *AcpiGbl_Optarg;
123
124
125 /*
126 * cmfsize - Common get file size function
127 */
128 UINT32
129 CmGetFileSize (
130 ACPI_FILE File);
131
132
133 #ifndef ACPI_DUMP_APP
134 /*
135 * adisasm
136 */
137 ACPI_STATUS
138 AdAmlDisassemble (
139 BOOLEAN OutToFile,
140 char *Filename,
141 char *Prefix,
142 char **OutFilename);
143
144 void
145 AdPrintStatistics (
146 void);
147
148 ACPI_STATUS
149 AdFindDsdt(
150 UINT8 **DsdtPtr,
151 UINT32 *DsdtLength);
152
153 void
154 AdDumpTables (
155 void);
156
157 ACPI_STATUS
158 AdGetLocalTables (
159 void);
160
161 ACPI_STATUS
162 AdParseTable (
163 ACPI_TABLE_HEADER *Table,
164 ACPI_OWNER_ID *OwnerId,
165 BOOLEAN LoadTable,
166 BOOLEAN External);
167
168 ACPI_STATUS
169 AdDisplayTables (
170 char *Filename,
171 ACPI_TABLE_HEADER *Table);
172
173 ACPI_STATUS
174 AdDisplayStatistics (
175 void);
176
177
178 /*
179 * adwalk
180 */
181 void
182 AcpiDmCrossReferenceNamespace (
183 ACPI_PARSE_OBJECT *ParseTreeRoot,
184 ACPI_NAMESPACE_NODE *NamespaceRoot,
185 ACPI_OWNER_ID OwnerId);
186
187 void
188 AcpiDmDumpTree (
189 ACPI_PARSE_OBJECT *Origin);
190
191 void
192 AcpiDmFindOrphanMethods (
193 ACPI_PARSE_OBJECT *Origin);
194
195 void
196 AcpiDmFinishNamespaceLoad (
197 ACPI_PARSE_OBJECT *ParseTreeRoot,
198 ACPI_NAMESPACE_NODE *NamespaceRoot,
199 ACPI_OWNER_ID OwnerId);
200
201 void
202 AcpiDmConvertResourceIndexes (
203 ACPI_PARSE_OBJECT *ParseTreeRoot,
204 ACPI_NAMESPACE_NODE *NamespaceRoot);
205
206
207 /*
208 * adfile
209 */
210 ACPI_STATUS
211 AdInitialize (
212 void);
213
214 char *
215 FlGenerateFilename (
216 char *InputFilename,
217 char *Suffix);
218
219 ACPI_STATUS
220 FlSplitInputPathname (
221 char *InputPath,
222 char **OutDirectoryPath,
223 char **OutFilename);
224
225 char *
226 AdGenerateFilename (
227 char *Prefix,
228 char *TableId);
229
230 void
231 AdWriteTable (
232 ACPI_TABLE_HEADER *Table,
233 UINT32 Length,
234 char *TableName,
235 char *OemTableId);
236 #endif
237
238 #endif /* _ACAPPS */
239