xref: /freebsd/sys/contrib/dev/acpica/include/acapps.h (revision 70e0bbedef95258a4dadc996d641a9bebd3f107d)
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\n%s\n\n", \
73     ACPICA_NAME, \
74     UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
75     ACPICA_COPYRIGHT
76 
77 #define ACPI_COMMON_HEADER(UtilityName, Prefix) \
78     "%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \
79     Prefix, ACPICA_NAME, \
80     Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, \
81     Prefix, ACPICA_COPYRIGHT, \
82     Prefix
83 
84 /* Macros for usage messages */
85 
86 #define ACPI_USAGE_HEADER(Usage) \
87     printf ("Usage: %s\nOptions:\n", Usage);
88 
89 #define ACPI_OPTION(Name, Description) \
90     printf ("  %-18s%s\n", Name, Description);
91 
92 
93 #define FILE_SUFFIX_DISASSEMBLY     "dsl"
94 #define ACPI_TABLE_FILE_SUFFIX      ".dat"
95 
96 
97 /*
98  * getopt
99  */
100 int
101 AcpiGetopt(
102     int                     argc,
103     char                    **argv,
104     char                    *opts);
105 
106 extern int                  AcpiGbl_Optind;
107 extern int                  AcpiGbl_Opterr;
108 extern char                 *AcpiGbl_Optarg;
109 
110 
111 /*
112  * adisasm
113  */
114 ACPI_STATUS
115 AdAmlDisassemble (
116     BOOLEAN                 OutToFile,
117     char                    *Filename,
118     char                    *Prefix,
119     char                    **OutFilename,
120     BOOLEAN                 GetAllTables);
121 
122 void
123 AdPrintStatistics (
124     void);
125 
126 ACPI_STATUS
127 AdFindDsdt(
128     UINT8                   **DsdtPtr,
129     UINT32                  *DsdtLength);
130 
131 void
132 AdDumpTables (
133     void);
134 
135 ACPI_STATUS
136 AdGetLocalTables (
137     char                    *Filename,
138     BOOLEAN                 GetAllTables);
139 
140 ACPI_STATUS
141 AdParseTable (
142     ACPI_TABLE_HEADER       *Table,
143     ACPI_OWNER_ID           *OwnerId,
144     BOOLEAN                 LoadTable,
145     BOOLEAN                 External);
146 
147 ACPI_STATUS
148 AdDisplayTables (
149     char                    *Filename,
150     ACPI_TABLE_HEADER       *Table);
151 
152 ACPI_STATUS
153 AdDisplayStatistics (
154     void);
155 
156 
157 /*
158  * adwalk
159  */
160 void
161 AcpiDmCrossReferenceNamespace (
162     ACPI_PARSE_OBJECT       *ParseTreeRoot,
163     ACPI_NAMESPACE_NODE     *NamespaceRoot,
164     ACPI_OWNER_ID           OwnerId);
165 
166 void
167 AcpiDmDumpTree (
168     ACPI_PARSE_OBJECT       *Origin);
169 
170 void
171 AcpiDmFindOrphanMethods (
172     ACPI_PARSE_OBJECT       *Origin);
173 
174 void
175 AcpiDmFinishNamespaceLoad (
176     ACPI_PARSE_OBJECT       *ParseTreeRoot,
177     ACPI_NAMESPACE_NODE     *NamespaceRoot,
178     ACPI_OWNER_ID           OwnerId);
179 
180 void
181 AcpiDmConvertResourceIndexes (
182     ACPI_PARSE_OBJECT       *ParseTreeRoot,
183     ACPI_NAMESPACE_NODE     *NamespaceRoot);
184 
185 
186 /*
187  * adfile
188  */
189 ACPI_STATUS
190 AdInitialize (
191     void);
192 
193 char *
194 FlGenerateFilename (
195     char                    *InputFilename,
196     char                    *Suffix);
197 
198 ACPI_STATUS
199 FlSplitInputPathname (
200     char                    *InputPath,
201     char                    **OutDirectoryPath,
202     char                    **OutFilename);
203 
204 char *
205 AdGenerateFilename (
206     char                    *Prefix,
207     char                    *TableId);
208 
209 void
210 AdWriteTable (
211     ACPI_TABLE_HEADER       *Table,
212     UINT32                  Length,
213     char                    *TableName,
214     char                    *OemTableId);
215 
216 #endif /* _ACAPPS */
217 
218