dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / acpi / acpixtract / acpixtract.h
blob14df786a41862184180bcf34a91967aef4d4ff00
1 /******************************************************************************
3 * Module Name: acpixtract.h - Include for acpixtract utility
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2016, Intel Corp.
9 * All rights reserved.
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.
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.
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.
44 #include "acpi.h"
45 #include "accommon.h"
46 #include "acapps.h"
47 #include <stdio.h>
50 #undef ACPI_GLOBAL
52 #ifdef DEFINE_ACPIXTRACT_GLOBALS
53 #define ACPI_GLOBAL(type,name) \
54 extern type name; \
55 type name
57 #else
58 #define ACPI_GLOBAL(type,name) \
59 extern type name
60 #endif
63 /* Options */
65 #define AX_EXTRACT_ALL 0
66 #define AX_LIST_ALL 1
67 #define AX_EXTRACT_SIGNATURE 2
68 #define AX_EXTRACT_AML_TABLES 3
69 #define AX_EXTRACT_MULTI_TABLE 4
71 #define AX_OPTIONAL_TABLES 0
72 #define AX_REQUIRED_TABLE 1
74 #define AX_UTILITY_NAME "ACPI Binary Table Extraction Utility"
75 #define AX_SUPPORTED_OPTIONS "ahlms:v"
76 #define AX_MULTI_TABLE_FILENAME "amltables.dat"
77 #define AX_TABLE_INFO_FORMAT "Acpi table [%4.4s] - %7u bytes written to %s\n"
79 /* Extraction states */
81 #define AX_STATE_FIND_HEADER 0
82 #define AX_STATE_EXTRACT_DATA 1
84 /* Miscellaneous constants */
86 #define AX_LINE_BUFFER_SIZE 256
87 #define AX_MIN_BLOCK_HEADER_LENGTH 6 /* strlen ("DSDT @") */
90 typedef struct AxTableInfo
92 UINT32 Signature;
93 unsigned int Instances;
94 unsigned int NextInstance;
95 struct AxTableInfo *Next;
97 } AX_TABLE_INFO;
100 /* Globals */
102 ACPI_GLOBAL (char, Gbl_LineBuffer[AX_LINE_BUFFER_SIZE]);
103 ACPI_GLOBAL (char, Gbl_HeaderBuffer[AX_LINE_BUFFER_SIZE]);
104 ACPI_GLOBAL (char, Gbl_InstanceBuffer[AX_LINE_BUFFER_SIZE]);
106 ACPI_GLOBAL (AX_TABLE_INFO, *Gbl_TableListHead);
107 ACPI_GLOBAL (char, Gbl_OutputFilename[32]);
108 ACPI_GLOBAL (unsigned char, Gbl_BinaryData[16]);
109 ACPI_GLOBAL (unsigned int, Gbl_TableCount);
112 * acpixtract.c
115 AxExtractTables (
116 char *InputPathname,
117 char *Signature,
118 unsigned int MinimumInstances);
121 AxExtractToMultiAmlFile (
122 char *InputPathname);
125 AxListTables (
126 char *InputPathname);
130 * axutils.c
132 size_t
133 AxGetTableHeader (
134 FILE *InputFile,
135 unsigned char *OutputData);
137 unsigned int
138 AxCountTableInstances (
139 char *InputPathname,
140 char *Signature);
142 unsigned int
143 AxGetNextInstance (
144 char *InputPathname,
145 char *Signature);
147 void
148 AxNormalizeSignature (
149 char *Signature);
151 void
152 AxCheckAscii (
153 char *Name,
154 int Count);
157 AxIsEmptyLine (
158 char *Buffer);
161 AxIsDataBlockHeader (
162 void);
164 long
165 AxProcessOneTextLine (
166 FILE *OutputFile,
167 char *ThisSignature,
168 unsigned int ThisTableBytesWritten);
170 size_t
171 AxConvertLine (
172 char *InputLine,
173 unsigned char *OutputData);