acpihelp.h revision 1.1.1.12
1/******************************************************************************
2 *
3 * Module Name: acpihelp.h - Include file for AcpiHelp utility
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2020, 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 __ACPIHELP_H
45#define __ACPIHELP_H
46
47
48#include "acpi.h"
49#include "accommon.h"
50#include "acapps.h"
51
52#include <sys/types.h>
53#ifdef WIN32
54#include <io.h>
55#include <direct.h>
56#endif
57
58
59/*
60 * Global variables. Defined in ahmain.c only, externed in all other files
61 */
62#undef ACPI_GLOBAL
63#undef ACPI_INIT_GLOBAL
64
65#ifdef DEFINE_AHELP_GLOBALS
66#define ACPI_GLOBAL(type,name) \
67    extern type name; \
68    type name
69
70#define ACPI_INIT_GLOBAL(type,name,value) \
71    type name=value
72
73#else
74#ifndef ACPI_GLOBAL
75#define ACPI_GLOBAL(type,name) \
76    extern type name
77#endif
78
79#ifndef ACPI_INIT_GLOBAL
80#define ACPI_INIT_GLOBAL(type,name,value) \
81    extern type name
82#endif
83#endif
84
85
86#define AH_BUFFER_LENGTH                128
87#define AH_LINE_BUFFER_LENGTH           512
88#define AH_MAX_ASL_LINE_LENGTH          70
89#define AH_MAX_AML_LINE_LENGTH          100
90
91ACPI_GLOBAL (char,                      Gbl_Buffer[AH_BUFFER_LENGTH]);
92ACPI_GLOBAL (char,                      Gbl_LineBuffer[AH_LINE_BUFFER_LENGTH]);
93extern const AH_PREDEFINED_NAME         AslPredefinedInfo[];
94extern const AH_DEVICE_ID               AslDeviceIds[];
95
96
97#define AH_DISPLAY_EXCEPTION(Status, Name) \
98    printf ("%.4X: %s\n", Status, Name)
99
100#define AH_DISPLAY_EXCEPTION_TEXT(Status, Exception) \
101    printf ("%.4X: %-28s (%s)\n", Status,\
102    Exception->Name, Exception->Description)
103
104
105typedef enum
106{
107    AH_DECODE_DEFAULT           = 0,
108    AH_DECODE_ASL,
109    AH_DECODE_ASL_KEYWORD,
110    AH_DECODE_PREDEFINED_NAME,
111    AH_DECODE_AML,
112    AH_DECODE_AML_OPCODE,
113    AH_DECODE_AML_TYPE,
114    AH_DECODE_ASL_AML,
115    AH_DECODE_EXCEPTION,
116
117    AH_DISPLAY_DEVICE_IDS,
118    AH_DISPLAY_UUIDS,
119    AH_DISPLAY_TABLES,
120    AH_DISPLAY_DIRECTIVES
121
122} AH_OPTION_TYPES;
123
124typedef struct ah_aml_opcode
125{
126    UINT16          OpcodeRangeStart;
127    UINT16          OpcodeRangeEnd;
128    char            *OpcodeString;
129    char            *OpcodeName;
130    char            *Type;
131    char            *FixedArguments;
132    char            *VariableArguments;
133    char            *Grammar;
134
135} AH_AML_OPCODE;
136
137typedef struct ah_aml_type
138{
139    char            *Name;
140    char            *Description;
141
142} AH_AML_TYPE;
143
144typedef struct ah_asl_operator
145{
146    char            *Name;
147    char            *Syntax;
148    char            *Description;
149
150} AH_ASL_OPERATOR;
151
152typedef struct ah_asl_keyword
153{
154    char            *Name;
155    char            *Description;
156    char            *KeywordList;
157
158} AH_ASL_KEYWORD;
159
160typedef struct ah_directive_info
161{
162    char            *Name;
163    char            *Description;
164
165} AH_DIRECTIVE_INFO;
166
167
168/* Externals for various data tables */
169
170extern const AH_AML_OPCODE          Gbl_AmlOpcodeInfo[];
171extern const AH_AML_TYPE            Gbl_AmlTypesInfo[];
172extern const AH_ASL_OPERATOR        Gbl_AslOperatorInfo[];
173extern const AH_ASL_KEYWORD         Gbl_AslKeywordInfo[];
174extern const AH_UUID                Gbl_AcpiUuids[];
175extern const AH_DIRECTIVE_INFO      Gbl_PreprocessorDirectives[];
176extern const AH_TABLE               AcpiGbl_SupportedTables[];
177
178
179void
180AhFindAmlOpcode (
181    char                    *Name);
182
183void
184AhDecodeAmlOpcode (
185    char                    *Name);
186
187void
188AhDecodeException (
189    char                    *Name);
190
191void
192AhFindPredefinedNames (
193    char                    *Name);
194
195void
196AhFindAslAndAmlOperators (
197    char                    *Name);
198
199UINT32
200AhFindAslOperators (
201    char                    *Name);
202
203void
204AhFindAslKeywords (
205    char                    *Name);
206
207void
208AhFindAmlTypes (
209    char                    *Name);
210
211void
212AhDisplayDeviceIds (
213    char                    *Name);
214
215void
216AhDisplayTables (
217    void);
218
219const AH_TABLE *
220AcpiAhGetTableInfo (
221    char                    *Signature);
222
223void
224AhDisplayUuids (
225    void);
226
227void
228AhDisplayDirectives (
229    void);
230
231void
232AhPrintOneField (
233    UINT32                  Indent,
234    UINT32                  CurrentPosition,
235    UINT32                  MaxPosition,
236    const char              *Field);
237
238#endif /* __ACPIHELP_H */
239