1c2c66affSColin Finck /******************************************************************************
2c2c66affSColin Finck  *
3c2c66affSColin Finck  * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
4c2c66affSColin Finck  *
5c2c66affSColin Finck  *****************************************************************************/
6c2c66affSColin Finck 
7c2c66affSColin Finck /*
803b24380SThomas Faber  * Copyright (C) 2000 - 2022, Intel Corp.
9c2c66affSColin Finck  * All rights reserved.
10c2c66affSColin Finck  *
11c2c66affSColin Finck  * Redistribution and use in source and binary forms, with or without
12c2c66affSColin Finck  * modification, are permitted provided that the following conditions
13c2c66affSColin Finck  * are met:
14c2c66affSColin Finck  * 1. Redistributions of source code must retain the above copyright
15c2c66affSColin Finck  *    notice, this list of conditions, and the following disclaimer,
16c2c66affSColin Finck  *    without modification.
17c2c66affSColin Finck  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18c2c66affSColin Finck  *    substantially similar to the "NO WARRANTY" disclaimer below
19c2c66affSColin Finck  *    ("Disclaimer") and any redistribution must be conditioned upon
20c2c66affSColin Finck  *    including a substantially similar Disclaimer requirement for further
21c2c66affSColin Finck  *    binary redistribution.
22c2c66affSColin Finck  * 3. Neither the names of the above-listed copyright holders nor the names
23c2c66affSColin Finck  *    of any contributors may be used to endorse or promote products derived
24c2c66affSColin Finck  *    from this software without specific prior written permission.
25c2c66affSColin Finck  *
26c2c66affSColin Finck  * Alternatively, this software may be distributed under the terms of the
27c2c66affSColin Finck  * GNU General Public License ("GPL") version 2 as published by the Free
28c2c66affSColin Finck  * Software Foundation.
29c2c66affSColin Finck  *
30c2c66affSColin Finck  * NO WARRANTY
31c2c66affSColin Finck  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32c2c66affSColin Finck  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
336eb8cc49SThomas Faber  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34c2c66affSColin Finck  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35c2c66affSColin Finck  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36c2c66affSColin Finck  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37c2c66affSColin Finck  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38c2c66affSColin Finck  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39c2c66affSColin Finck  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40c2c66affSColin Finck  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41c2c66affSColin Finck  * POSSIBILITY OF SUCH DAMAGES.
42c2c66affSColin Finck  */
43c2c66affSColin Finck 
44c2c66affSColin Finck #ifndef _ACUTILS_H
45c2c66affSColin Finck #define _ACUTILS_H
46c2c66affSColin Finck 
47c2c66affSColin Finck 
48c2c66affSColin Finck extern const UINT8                      AcpiGbl_ResourceAmlSizes[];
49c2c66affSColin Finck extern const UINT8                      AcpiGbl_ResourceAmlSerialBusSizes[];
50c2c66affSColin Finck 
51c2c66affSColin Finck /* Strings used by the disassembler and debugger resource dump routines */
52c2c66affSColin Finck 
53c2c66affSColin Finck #if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
54c2c66affSColin Finck 
55c2c66affSColin Finck extern const char                       *AcpiGbl_BmDecode[];
56c2c66affSColin Finck extern const char                       *AcpiGbl_ConfigDecode[];
57c2c66affSColin Finck extern const char                       *AcpiGbl_ConsumeDecode[];
58c2c66affSColin Finck extern const char                       *AcpiGbl_DecDecode[];
59c2c66affSColin Finck extern const char                       *AcpiGbl_HeDecode[];
60c2c66affSColin Finck extern const char                       *AcpiGbl_IoDecode[];
61c2c66affSColin Finck extern const char                       *AcpiGbl_LlDecode[];
62c2c66affSColin Finck extern const char                       *AcpiGbl_MaxDecode[];
63c2c66affSColin Finck extern const char                       *AcpiGbl_MemDecode[];
64c2c66affSColin Finck extern const char                       *AcpiGbl_MinDecode[];
65c2c66affSColin Finck extern const char                       *AcpiGbl_MtpDecode[];
666eb8cc49SThomas Faber extern const char                       *AcpiGbl_PhyDecode[];
67c2c66affSColin Finck extern const char                       *AcpiGbl_RngDecode[];
68c2c66affSColin Finck extern const char                       *AcpiGbl_RwDecode[];
69c2c66affSColin Finck extern const char                       *AcpiGbl_ShrDecode[];
70c2c66affSColin Finck extern const char                       *AcpiGbl_SizDecode[];
71c2c66affSColin Finck extern const char                       *AcpiGbl_TrsDecode[];
72c2c66affSColin Finck extern const char                       *AcpiGbl_TtpDecode[];
73c2c66affSColin Finck extern const char                       *AcpiGbl_TypDecode[];
74c2c66affSColin Finck extern const char                       *AcpiGbl_PpcDecode[];
75c2c66affSColin Finck extern const char                       *AcpiGbl_IorDecode[];
76c2c66affSColin Finck extern const char                       *AcpiGbl_DtsDecode[];
77c2c66affSColin Finck extern const char                       *AcpiGbl_CtDecode[];
78c2c66affSColin Finck extern const char                       *AcpiGbl_SbtDecode[];
79c2c66affSColin Finck extern const char                       *AcpiGbl_AmDecode[];
80c2c66affSColin Finck extern const char                       *AcpiGbl_SmDecode[];
81c2c66affSColin Finck extern const char                       *AcpiGbl_WmDecode[];
82c2c66affSColin Finck extern const char                       *AcpiGbl_CphDecode[];
83c2c66affSColin Finck extern const char                       *AcpiGbl_CpoDecode[];
84c2c66affSColin Finck extern const char                       *AcpiGbl_DpDecode[];
85c2c66affSColin Finck extern const char                       *AcpiGbl_EdDecode[];
86c2c66affSColin Finck extern const char                       *AcpiGbl_BpbDecode[];
87c2c66affSColin Finck extern const char                       *AcpiGbl_SbDecode[];
88c2c66affSColin Finck extern const char                       *AcpiGbl_FcDecode[];
89c2c66affSColin Finck extern const char                       *AcpiGbl_PtDecode[];
90c2c66affSColin Finck extern const char                       *AcpiGbl_PtypDecode[];
91c2c66affSColin Finck #endif
92c2c66affSColin Finck 
93c2c66affSColin Finck /*
94c2c66affSColin Finck  * For the iASL compiler case, the output is redirected to stderr so that
95c2c66affSColin Finck  * any of the various ACPI errors and warnings do not appear in the output
96c2c66affSColin Finck  * files, for either the compiler or disassembler portions of the tool.
97c2c66affSColin Finck  */
98c2c66affSColin Finck #ifdef ACPI_ASL_COMPILER
99c2c66affSColin Finck 
100c2c66affSColin Finck #include <stdio.h>
101c2c66affSColin Finck 
102c2c66affSColin Finck #define ACPI_MSG_REDIRECT_BEGIN \
103c2c66affSColin Finck     FILE                    *OutputFile = AcpiGbl_OutputFile; \
104c2c66affSColin Finck     AcpiOsRedirectOutput (stderr);
105c2c66affSColin Finck 
106c2c66affSColin Finck #define ACPI_MSG_REDIRECT_END \
107c2c66affSColin Finck     AcpiOsRedirectOutput (OutputFile);
108c2c66affSColin Finck 
109c2c66affSColin Finck #else
110c2c66affSColin Finck /*
111c2c66affSColin Finck  * non-iASL case - no redirection, nothing to do
112c2c66affSColin Finck  */
113c2c66affSColin Finck #define ACPI_MSG_REDIRECT_BEGIN
114c2c66affSColin Finck #define ACPI_MSG_REDIRECT_END
115c2c66affSColin Finck #endif
116c2c66affSColin Finck 
117c2c66affSColin Finck /*
118c2c66affSColin Finck  * Common error message prefixes
119c2c66affSColin Finck  */
120c2c66affSColin Finck #ifndef ACPI_MSG_ERROR
121c2c66affSColin Finck #define ACPI_MSG_ERROR          "ACPI Error: "
122c2c66affSColin Finck #endif
123c2c66affSColin Finck #ifndef ACPI_MSG_WARNING
124c2c66affSColin Finck #define ACPI_MSG_WARNING        "ACPI Warning: "
125c2c66affSColin Finck #endif
126c2c66affSColin Finck #ifndef ACPI_MSG_INFO
127c2c66affSColin Finck #define ACPI_MSG_INFO           "ACPI: "
128c2c66affSColin Finck #endif
129c2c66affSColin Finck 
130c2c66affSColin Finck #ifndef ACPI_MSG_BIOS_ERROR
131ec55f0ebSThomas Faber #define ACPI_MSG_BIOS_ERROR     "Firmware Error (ACPI): "
132c2c66affSColin Finck #endif
133c2c66affSColin Finck #ifndef ACPI_MSG_BIOS_WARNING
134ec55f0ebSThomas Faber #define ACPI_MSG_BIOS_WARNING   "Firmware Warning (ACPI): "
135c2c66affSColin Finck #endif
136c2c66affSColin Finck 
137c2c66affSColin Finck /*
138c2c66affSColin Finck  * Common message suffix
139c2c66affSColin Finck  */
140c2c66affSColin Finck #define ACPI_MSG_SUFFIX \
141c2c66affSColin Finck     AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber)
142c2c66affSColin Finck 
143ec55f0ebSThomas Faber /* Flags to indicate implicit or explicit string-to-integer conversion */
144ec55f0ebSThomas Faber 
145ec55f0ebSThomas Faber #define ACPI_IMPLICIT_CONVERSION        TRUE
146ec55f0ebSThomas Faber #define ACPI_NO_IMPLICIT_CONVERSION     FALSE
147c2c66affSColin Finck 
148c2c66affSColin Finck /* Types for Resource descriptor entries */
149c2c66affSColin Finck 
150c2c66affSColin Finck #define ACPI_INVALID_RESOURCE           0
151c2c66affSColin Finck #define ACPI_FIXED_LENGTH               1
152c2c66affSColin Finck #define ACPI_VARIABLE_LENGTH            2
153c2c66affSColin Finck #define ACPI_SMALL_VARIABLE_LENGTH      3
154c2c66affSColin Finck 
155c2c66affSColin Finck typedef
156c2c66affSColin Finck ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
157c2c66affSColin Finck     UINT8                   *Aml,
158c2c66affSColin Finck     UINT32                  Length,
159c2c66affSColin Finck     UINT32                  Offset,
160c2c66affSColin Finck     UINT8                   ResourceIndex,
161c2c66affSColin Finck     void                    **Context);
162c2c66affSColin Finck 
163c2c66affSColin Finck typedef
164c2c66affSColin Finck ACPI_STATUS (*ACPI_PKG_CALLBACK) (
165c2c66affSColin Finck     UINT8                   ObjectType,
166c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *SourceObject,
167c2c66affSColin Finck     ACPI_GENERIC_STATE      *State,
168c2c66affSColin Finck     void                    *Context);
169c2c66affSColin Finck 
170c2c66affSColin Finck typedef struct acpi_pkg_info
171c2c66affSColin Finck {
172c2c66affSColin Finck     UINT8                   *FreeSpace;
173c2c66affSColin Finck     ACPI_SIZE               Length;
174c2c66affSColin Finck     UINT32                  ObjectSpace;
175c2c66affSColin Finck     UINT32                  NumPackages;
176c2c66affSColin Finck 
177c2c66affSColin Finck } ACPI_PKG_INFO;
178c2c66affSColin Finck 
179c2c66affSColin Finck /* Object reference counts */
180c2c66affSColin Finck 
181c2c66affSColin Finck #define REF_INCREMENT       (UINT16) 0
182c2c66affSColin Finck #define REF_DECREMENT       (UINT16) 1
183c2c66affSColin Finck 
184c2c66affSColin Finck /* AcpiUtDumpBuffer */
185c2c66affSColin Finck 
186d170b6abSThomas Faber #define DB_BYTE_DISPLAY      0x01
187d170b6abSThomas Faber #define DB_WORD_DISPLAY      0x02
188d170b6abSThomas Faber #define DB_DWORD_DISPLAY     0x04
189d170b6abSThomas Faber #define DB_QWORD_DISPLAY     0x08
190d170b6abSThomas Faber #define DB_DISPLAY_DATA_ONLY 0x10
191c2c66affSColin Finck 
192c2c66affSColin Finck 
193c2c66affSColin Finck /*
194c2c66affSColin Finck  * utascii - ASCII utilities
195c2c66affSColin Finck  */
196c2c66affSColin Finck BOOLEAN
197c2c66affSColin Finck AcpiUtValidNameseg (
198c2c66affSColin Finck     char                    *Signature);
199c2c66affSColin Finck 
200c2c66affSColin Finck BOOLEAN
201c2c66affSColin Finck AcpiUtValidNameChar (
202c2c66affSColin Finck     char                    Character,
203c2c66affSColin Finck     UINT32                  Position);
204c2c66affSColin Finck 
205c2c66affSColin Finck void
206c2c66affSColin Finck AcpiUtCheckAndRepairAscii (
207c2c66affSColin Finck     UINT8                   *Name,
208c2c66affSColin Finck     char                    *RepairedName,
209c2c66affSColin Finck     UINT32                  Count);
210c2c66affSColin Finck 
211c2c66affSColin Finck 
212c2c66affSColin Finck /*
213*f0dd1e7bSThomas Faber  * utcksum - Checksum utilities
214*f0dd1e7bSThomas Faber  */
215*f0dd1e7bSThomas Faber UINT8
216*f0dd1e7bSThomas Faber AcpiUtGenerateChecksum (
217*f0dd1e7bSThomas Faber     void                    *Table,
218*f0dd1e7bSThomas Faber     UINT32                  Length,
219*f0dd1e7bSThomas Faber     UINT8                   OriginalChecksum);
220*f0dd1e7bSThomas Faber 
221*f0dd1e7bSThomas Faber UINT8
222*f0dd1e7bSThomas Faber AcpiUtChecksum (
223*f0dd1e7bSThomas Faber     UINT8                   *Buffer,
224*f0dd1e7bSThomas Faber     UINT32                  Length);
225*f0dd1e7bSThomas Faber 
226*f0dd1e7bSThomas Faber ACPI_STATUS
227*f0dd1e7bSThomas Faber AcpiUtVerifyCdatChecksum (
228*f0dd1e7bSThomas Faber     ACPI_TABLE_CDAT         *CdatTable,
229*f0dd1e7bSThomas Faber     UINT32                  Length);
230*f0dd1e7bSThomas Faber 
231*f0dd1e7bSThomas Faber ACPI_STATUS
232*f0dd1e7bSThomas Faber AcpiUtVerifyChecksum (
233*f0dd1e7bSThomas Faber     ACPI_TABLE_HEADER       *Table,
234*f0dd1e7bSThomas Faber     UINT32                  Length);
235*f0dd1e7bSThomas Faber 
236*f0dd1e7bSThomas Faber 
237*f0dd1e7bSThomas Faber /*
238c2c66affSColin Finck  * utnonansi - Non-ANSI C library functions
239c2c66affSColin Finck  */
240c2c66affSColin Finck void
241c2c66affSColin Finck AcpiUtStrupr (
242c2c66affSColin Finck     char                    *SrcString);
243c2c66affSColin Finck 
244c2c66affSColin Finck void
245c2c66affSColin Finck AcpiUtStrlwr (
246c2c66affSColin Finck     char                    *SrcString);
247c2c66affSColin Finck 
248c2c66affSColin Finck int
249c2c66affSColin Finck AcpiUtStricmp (
250c2c66affSColin Finck     char                    *String1,
251c2c66affSColin Finck     char                    *String2);
252c2c66affSColin Finck 
253ec55f0ebSThomas Faber 
254ec55f0ebSThomas Faber /*
255ec55f0ebSThomas Faber  * utstrsuppt - string-to-integer conversion support functions
256ec55f0ebSThomas Faber  */
257ec55f0ebSThomas Faber ACPI_STATUS
258ec55f0ebSThomas Faber AcpiUtConvertOctalString (
259ec55f0ebSThomas Faber     char                    *String,
260ec55f0ebSThomas Faber     UINT64                  *ReturnValue);
261ec55f0ebSThomas Faber 
262ec55f0ebSThomas Faber ACPI_STATUS
263ec55f0ebSThomas Faber AcpiUtConvertDecimalString (
264ec55f0ebSThomas Faber     char                    *String,
265ec55f0ebSThomas Faber     UINT64                  *ReturnValuePtr);
266ec55f0ebSThomas Faber 
267ec55f0ebSThomas Faber ACPI_STATUS
268ec55f0ebSThomas Faber AcpiUtConvertHexString (
269ec55f0ebSThomas Faber     char                    *String,
270ec55f0ebSThomas Faber     UINT64                  *ReturnValuePtr);
271ec55f0ebSThomas Faber 
272ec55f0ebSThomas Faber char
273ec55f0ebSThomas Faber AcpiUtRemoveWhitespace (
274ec55f0ebSThomas Faber     char                    **String);
275ec55f0ebSThomas Faber 
276ec55f0ebSThomas Faber char
277ec55f0ebSThomas Faber AcpiUtRemoveLeadingZeros (
278ec55f0ebSThomas Faber     char                    **String);
279ec55f0ebSThomas Faber 
280ec55f0ebSThomas Faber BOOLEAN
281ec55f0ebSThomas Faber AcpiUtDetectHexPrefix (
282ec55f0ebSThomas Faber     char                    **String);
283ec55f0ebSThomas Faber 
284b062d28bSThomas Faber void
285b062d28bSThomas Faber AcpiUtRemoveHexPrefix (
286b062d28bSThomas Faber     char                    **String);
287b062d28bSThomas Faber 
288ec55f0ebSThomas Faber BOOLEAN
289ec55f0ebSThomas Faber AcpiUtDetectOctalPrefix (
290ec55f0ebSThomas Faber     char                    **String);
291ec55f0ebSThomas Faber 
292ec55f0ebSThomas Faber 
293ec55f0ebSThomas Faber /*
294ec55f0ebSThomas Faber  * utstrtoul64 - string-to-integer conversion functions
295ec55f0ebSThomas Faber  */
296c2c66affSColin Finck ACPI_STATUS
297c2c66affSColin Finck AcpiUtStrtoul64 (
298c2c66affSColin Finck     char                    *String,
299c2c66affSColin Finck     UINT64                  *RetInteger);
300c2c66affSColin Finck 
301ec55f0ebSThomas Faber UINT64
302ec55f0ebSThomas Faber AcpiUtExplicitStrtoul64 (
303ec55f0ebSThomas Faber     char                    *String);
304ec55f0ebSThomas Faber 
305ec55f0ebSThomas Faber UINT64
306ec55f0ebSThomas Faber AcpiUtImplicitStrtoul64 (
307ec55f0ebSThomas Faber     char                    *String);
308c2c66affSColin Finck 
309c2c66affSColin Finck 
310c2c66affSColin Finck /*
311c2c66affSColin Finck  * utglobal - Global data structures and procedures
312c2c66affSColin Finck  */
313c2c66affSColin Finck ACPI_STATUS
314c2c66affSColin Finck AcpiUtInitGlobals (
315c2c66affSColin Finck     void);
316c2c66affSColin Finck 
317c2c66affSColin Finck const char *
318c2c66affSColin Finck AcpiUtGetMutexName (
319c2c66affSColin Finck     UINT32                  MutexId);
320c2c66affSColin Finck 
321ec55f0ebSThomas Faber #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
322ec55f0ebSThomas Faber 
323c2c66affSColin Finck const char *
324c2c66affSColin Finck AcpiUtGetNotifyName (
325c2c66affSColin Finck     UINT32                  NotifyValue,
326c2c66affSColin Finck     ACPI_OBJECT_TYPE        Type);
327c2c66affSColin Finck #endif
328c2c66affSColin Finck 
329c2c66affSColin Finck const char *
330c2c66affSColin Finck AcpiUtGetTypeName (
331c2c66affSColin Finck     ACPI_OBJECT_TYPE        Type);
332c2c66affSColin Finck 
333c2c66affSColin Finck const char *
334c2c66affSColin Finck AcpiUtGetNodeName (
335c2c66affSColin Finck     void                    *Object);
336c2c66affSColin Finck 
337c2c66affSColin Finck const char *
338c2c66affSColin Finck AcpiUtGetDescriptorName (
339c2c66affSColin Finck     void                    *Object);
340c2c66affSColin Finck 
341c2c66affSColin Finck const char *
342c2c66affSColin Finck AcpiUtGetReferenceName (
343c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Object);
344c2c66affSColin Finck 
345c2c66affSColin Finck const char *
346c2c66affSColin Finck AcpiUtGetObjectTypeName (
347c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *ObjDesc);
348c2c66affSColin Finck 
349c2c66affSColin Finck const char *
350c2c66affSColin Finck AcpiUtGetRegionName (
351c2c66affSColin Finck     UINT8                   SpaceId);
352c2c66affSColin Finck 
353c2c66affSColin Finck const char *
354c2c66affSColin Finck AcpiUtGetEventName (
355c2c66affSColin Finck     UINT32                  EventId);
356c2c66affSColin Finck 
357c2c66affSColin Finck const char *
358c2c66affSColin Finck AcpiUtGetArgumentTypeName (
359c2c66affSColin Finck     UINT32                  ArgType);
360c2c66affSColin Finck 
361c2c66affSColin Finck char
362c2c66affSColin Finck AcpiUtHexToAsciiChar (
363c2c66affSColin Finck     UINT64                  Integer,
364c2c66affSColin Finck     UINT32                  Position);
365c2c66affSColin Finck 
366c2c66affSColin Finck ACPI_STATUS
367c2c66affSColin Finck AcpiUtAsciiToHexByte (
368c2c66affSColin Finck     char                    *TwoAsciiChars,
369c2c66affSColin Finck     UINT8                   *ReturnByte);
370c2c66affSColin Finck 
371c2c66affSColin Finck UINT8
372c2c66affSColin Finck AcpiUtAsciiCharToHex (
373c2c66affSColin Finck     int                     HexChar);
374c2c66affSColin Finck 
375c2c66affSColin Finck BOOLEAN
376c2c66affSColin Finck AcpiUtValidObjectType (
377c2c66affSColin Finck     ACPI_OBJECT_TYPE        Type);
378c2c66affSColin Finck 
379c2c66affSColin Finck 
380c2c66affSColin Finck /*
381c2c66affSColin Finck  * utinit - miscellaneous initialization and shutdown
382c2c66affSColin Finck  */
383c2c66affSColin Finck ACPI_STATUS
384c2c66affSColin Finck AcpiUtHardwareInitialize (
385c2c66affSColin Finck     void);
386c2c66affSColin Finck 
387c2c66affSColin Finck void
388c2c66affSColin Finck AcpiUtSubsystemShutdown (
389c2c66affSColin Finck     void);
390c2c66affSColin Finck 
391c2c66affSColin Finck 
392c2c66affSColin Finck /*
393c2c66affSColin Finck  * utcopy - Object construction and conversion interfaces
394c2c66affSColin Finck  */
395c2c66affSColin Finck ACPI_STATUS
396c2c66affSColin Finck AcpiUtBuildSimpleObject(
397c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Obj,
398c2c66affSColin Finck     ACPI_OBJECT             *UserObj,
399c2c66affSColin Finck     UINT8                   *DataSpace,
400c2c66affSColin Finck     UINT32                  *BufferSpaceUsed);
401c2c66affSColin Finck 
402c2c66affSColin Finck ACPI_STATUS
403c2c66affSColin Finck AcpiUtBuildPackageObject (
404c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Obj,
405c2c66affSColin Finck     UINT8                   *Buffer,
406c2c66affSColin Finck     UINT32                  *SpaceUsed);
407c2c66affSColin Finck 
408c2c66affSColin Finck ACPI_STATUS
409c2c66affSColin Finck AcpiUtCopyIobjectToEobject (
410c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Obj,
411c2c66affSColin Finck     ACPI_BUFFER             *RetBuffer);
412c2c66affSColin Finck 
413c2c66affSColin Finck ACPI_STATUS
414c2c66affSColin Finck AcpiUtCopyEobjectToIobject (
415c2c66affSColin Finck     ACPI_OBJECT             *Obj,
416c2c66affSColin Finck     ACPI_OPERAND_OBJECT     **InternalObj);
417c2c66affSColin Finck 
418c2c66affSColin Finck ACPI_STATUS
419c2c66affSColin Finck AcpiUtCopyISimpleToIsimple (
420c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *SourceObj,
421c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *DestObj);
422c2c66affSColin Finck 
423c2c66affSColin Finck ACPI_STATUS
424c2c66affSColin Finck AcpiUtCopyIobjectToIobject (
425c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *SourceDesc,
426c2c66affSColin Finck     ACPI_OPERAND_OBJECT     **DestDesc,
427c2c66affSColin Finck     ACPI_WALK_STATE         *WalkState);
428c2c66affSColin Finck 
429c2c66affSColin Finck 
430c2c66affSColin Finck /*
431c2c66affSColin Finck  * utcreate - Object creation
432c2c66affSColin Finck  */
433c2c66affSColin Finck ACPI_STATUS
434c2c66affSColin Finck AcpiUtUpdateObjectReference (
435c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Object,
436c2c66affSColin Finck     UINT16                  Action);
437c2c66affSColin Finck 
438c2c66affSColin Finck 
439c2c66affSColin Finck /*
440c2c66affSColin Finck  * utdebug - Debug interfaces
441c2c66affSColin Finck  */
442c2c66affSColin Finck void
443c2c66affSColin Finck AcpiUtInitStackPtrTrace (
444c2c66affSColin Finck     void);
445c2c66affSColin Finck 
446c2c66affSColin Finck void
447c2c66affSColin Finck AcpiUtTrackStackPtr (
448c2c66affSColin Finck     void);
449c2c66affSColin Finck 
450c2c66affSColin Finck void
451c2c66affSColin Finck AcpiUtTrace (
452c2c66affSColin Finck     UINT32                  LineNumber,
453c2c66affSColin Finck     const char              *FunctionName,
454c2c66affSColin Finck     const char              *ModuleName,
455c2c66affSColin Finck     UINT32                  ComponentId);
456c2c66affSColin Finck 
457c2c66affSColin Finck void
458c2c66affSColin Finck AcpiUtTracePtr (
459c2c66affSColin Finck     UINT32                  LineNumber,
460c2c66affSColin Finck     const char              *FunctionName,
461c2c66affSColin Finck     const char              *ModuleName,
462c2c66affSColin Finck     UINT32                  ComponentId,
463c2c66affSColin Finck     const void              *Pointer);
464c2c66affSColin Finck 
465c2c66affSColin Finck void
466c2c66affSColin Finck AcpiUtTraceU32 (
467c2c66affSColin Finck     UINT32                  LineNumber,
468c2c66affSColin Finck     const char              *FunctionName,
469c2c66affSColin Finck     const char              *ModuleName,
470c2c66affSColin Finck     UINT32                  ComponentId,
471c2c66affSColin Finck     UINT32                  Integer);
472c2c66affSColin Finck 
473c2c66affSColin Finck void
474c2c66affSColin Finck AcpiUtTraceStr (
475c2c66affSColin Finck     UINT32                  LineNumber,
476c2c66affSColin Finck     const char              *FunctionName,
477c2c66affSColin Finck     const char              *ModuleName,
478c2c66affSColin Finck     UINT32                  ComponentId,
479c2c66affSColin Finck     const char              *String);
480c2c66affSColin Finck 
481c2c66affSColin Finck void
482c2c66affSColin Finck AcpiUtExit (
483c2c66affSColin Finck     UINT32                  LineNumber,
484c2c66affSColin Finck     const char              *FunctionName,
485c2c66affSColin Finck     const char              *ModuleName,
486c2c66affSColin Finck     UINT32                  ComponentId);
487c2c66affSColin Finck 
488c2c66affSColin Finck void
489c2c66affSColin Finck AcpiUtStatusExit (
490c2c66affSColin Finck     UINT32                  LineNumber,
491c2c66affSColin Finck     const char              *FunctionName,
492c2c66affSColin Finck     const char              *ModuleName,
493c2c66affSColin Finck     UINT32                  ComponentId,
494c2c66affSColin Finck     ACPI_STATUS             Status);
495c2c66affSColin Finck 
496c2c66affSColin Finck void
497c2c66affSColin Finck AcpiUtValueExit (
498c2c66affSColin Finck     UINT32                  LineNumber,
499c2c66affSColin Finck     const char              *FunctionName,
500c2c66affSColin Finck     const char              *ModuleName,
501c2c66affSColin Finck     UINT32                  ComponentId,
502c2c66affSColin Finck     UINT64                  Value);
503c2c66affSColin Finck 
504c2c66affSColin Finck void
505c2c66affSColin Finck AcpiUtPtrExit (
506c2c66affSColin Finck     UINT32                  LineNumber,
507c2c66affSColin Finck     const char              *FunctionName,
508c2c66affSColin Finck     const char              *ModuleName,
509c2c66affSColin Finck     UINT32                  ComponentId,
510c2c66affSColin Finck     UINT8                   *Ptr);
511c2c66affSColin Finck 
512c2c66affSColin Finck void
513c2c66affSColin Finck AcpiUtStrExit (
514c2c66affSColin Finck     UINT32                  LineNumber,
515c2c66affSColin Finck     const char              *FunctionName,
516c2c66affSColin Finck     const char              *ModuleName,
517c2c66affSColin Finck     UINT32                  ComponentId,
518c2c66affSColin Finck     const char              *String);
519c2c66affSColin Finck 
520c2c66affSColin Finck void
521c2c66affSColin Finck AcpiUtDebugDumpBuffer (
522c2c66affSColin Finck     UINT8                   *Buffer,
523c2c66affSColin Finck     UINT32                  Count,
524c2c66affSColin Finck     UINT32                  Display,
525c2c66affSColin Finck     UINT32                  ComponentId);
526c2c66affSColin Finck 
527c2c66affSColin Finck void
528c2c66affSColin Finck AcpiUtDumpBuffer (
529c2c66affSColin Finck     UINT8                   *Buffer,
530c2c66affSColin Finck     UINT32                  Count,
531c2c66affSColin Finck     UINT32                  Display,
532c2c66affSColin Finck     UINT32                  Offset);
533c2c66affSColin Finck 
534c2c66affSColin Finck #ifdef ACPI_APPLICATION
535c2c66affSColin Finck void
536c2c66affSColin Finck AcpiUtDumpBufferToFile (
537c2c66affSColin Finck     ACPI_FILE               File,
538c2c66affSColin Finck     UINT8                   *Buffer,
539c2c66affSColin Finck     UINT32                  Count,
540c2c66affSColin Finck     UINT32                  Display,
541c2c66affSColin Finck     UINT32                  BaseOffset);
542c2c66affSColin Finck #endif
543c2c66affSColin Finck 
544c2c66affSColin Finck void
545c2c66affSColin Finck AcpiUtReportError (
546c2c66affSColin Finck     char                    *ModuleName,
547c2c66affSColin Finck     UINT32                  LineNumber);
548c2c66affSColin Finck 
549c2c66affSColin Finck void
550c2c66affSColin Finck AcpiUtReportInfo (
551c2c66affSColin Finck     char                    *ModuleName,
552c2c66affSColin Finck     UINT32                  LineNumber);
553c2c66affSColin Finck 
554c2c66affSColin Finck void
555c2c66affSColin Finck AcpiUtReportWarning (
556c2c66affSColin Finck     char                    *ModuleName,
557c2c66affSColin Finck     UINT32                  LineNumber);
558c2c66affSColin Finck 
559c2c66affSColin Finck 
560c2c66affSColin Finck /*
561c2c66affSColin Finck  * utdelete - Object deletion and reference counts
562c2c66affSColin Finck  */
563c2c66affSColin Finck void
564c2c66affSColin Finck AcpiUtAddReference (
565c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Object);
566c2c66affSColin Finck 
567c2c66affSColin Finck void
568c2c66affSColin Finck AcpiUtRemoveReference (
569c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Object);
570c2c66affSColin Finck 
571c2c66affSColin Finck void
572c2c66affSColin Finck AcpiUtDeleteInternalPackageObject (
573c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Object);
574c2c66affSColin Finck 
575c2c66affSColin Finck void
576c2c66affSColin Finck AcpiUtDeleteInternalSimpleObject (
577c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Object);
578c2c66affSColin Finck 
579c2c66affSColin Finck void
580c2c66affSColin Finck AcpiUtDeleteInternalObjectList (
581c2c66affSColin Finck     ACPI_OPERAND_OBJECT     **ObjList);
582c2c66affSColin Finck 
583c2c66affSColin Finck 
584c2c66affSColin Finck /*
585c2c66affSColin Finck  * uteval - object evaluation
586c2c66affSColin Finck  */
587c2c66affSColin Finck ACPI_STATUS
588c2c66affSColin Finck AcpiUtEvaluateObject (
589c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *PrefixNode,
590c2c66affSColin Finck     const char              *Path,
591c2c66affSColin Finck     UINT32                  ExpectedReturnBtypes,
592c2c66affSColin Finck     ACPI_OPERAND_OBJECT     **ReturnDesc);
593c2c66affSColin Finck 
594c2c66affSColin Finck ACPI_STATUS
595c2c66affSColin Finck AcpiUtEvaluateNumericObject (
596c2c66affSColin Finck     const char              *ObjectName,
597c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *DeviceNode,
598c2c66affSColin Finck     UINT64                  *Value);
599c2c66affSColin Finck 
600c2c66affSColin Finck ACPI_STATUS
601c2c66affSColin Finck AcpiUtExecute_STA (
602c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *DeviceNode,
603c2c66affSColin Finck     UINT32                  *StatusFlags);
604c2c66affSColin Finck 
605c2c66affSColin Finck ACPI_STATUS
606c2c66affSColin Finck AcpiUtExecutePowerMethods (
607c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *DeviceNode,
608c2c66affSColin Finck     const char              **MethodNames,
609c2c66affSColin Finck     UINT8                   MethodCount,
610c2c66affSColin Finck     UINT8                   *OutValues);
611c2c66affSColin Finck 
612c2c66affSColin Finck 
613c2c66affSColin Finck /*
614c2c66affSColin Finck  * utids - device ID support
615c2c66affSColin Finck  */
616c2c66affSColin Finck ACPI_STATUS
617c2c66affSColin Finck AcpiUtExecute_HID (
618c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *DeviceNode,
619c2c66affSColin Finck     ACPI_PNP_DEVICE_ID      **ReturnId);
620c2c66affSColin Finck 
621c2c66affSColin Finck ACPI_STATUS
622c2c66affSColin Finck AcpiUtExecute_UID (
623c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *DeviceNode,
624c2c66affSColin Finck     ACPI_PNP_DEVICE_ID      **ReturnId);
625c2c66affSColin Finck 
626c2c66affSColin Finck ACPI_STATUS
627c2c66affSColin Finck AcpiUtExecute_CID (
628c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *DeviceNode,
629c2c66affSColin Finck     ACPI_PNP_DEVICE_ID_LIST **ReturnCidList);
630c2c66affSColin Finck 
631c2c66affSColin Finck ACPI_STATUS
632c2c66affSColin Finck AcpiUtExecute_CLS (
633c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *DeviceNode,
634c2c66affSColin Finck     ACPI_PNP_DEVICE_ID      **ReturnId);
635c2c66affSColin Finck 
636c2c66affSColin Finck 
637c2c66affSColin Finck /*
638c2c66affSColin Finck  * utlock - reader/writer locks
639c2c66affSColin Finck  */
640c2c66affSColin Finck ACPI_STATUS
641c2c66affSColin Finck AcpiUtCreateRwLock (
642c2c66affSColin Finck     ACPI_RW_LOCK            *Lock);
643c2c66affSColin Finck 
644c2c66affSColin Finck void
645c2c66affSColin Finck AcpiUtDeleteRwLock (
646c2c66affSColin Finck     ACPI_RW_LOCK            *Lock);
647c2c66affSColin Finck 
648c2c66affSColin Finck ACPI_STATUS
649c2c66affSColin Finck AcpiUtAcquireReadLock (
650c2c66affSColin Finck     ACPI_RW_LOCK            *Lock);
651c2c66affSColin Finck 
652c2c66affSColin Finck ACPI_STATUS
653c2c66affSColin Finck AcpiUtReleaseReadLock (
654c2c66affSColin Finck     ACPI_RW_LOCK            *Lock);
655c2c66affSColin Finck 
656c2c66affSColin Finck ACPI_STATUS
657c2c66affSColin Finck AcpiUtAcquireWriteLock (
658c2c66affSColin Finck     ACPI_RW_LOCK            *Lock);
659c2c66affSColin Finck 
660c2c66affSColin Finck void
661c2c66affSColin Finck AcpiUtReleaseWriteLock (
662c2c66affSColin Finck     ACPI_RW_LOCK            *Lock);
663c2c66affSColin Finck 
664c2c66affSColin Finck 
665c2c66affSColin Finck /*
666c2c66affSColin Finck  * utobject - internal object create/delete/cache routines
667c2c66affSColin Finck  */
668c2c66affSColin Finck ACPI_OPERAND_OBJECT  *
669c2c66affSColin Finck AcpiUtCreateInternalObjectDbg (
670c2c66affSColin Finck     const char              *ModuleName,
671c2c66affSColin Finck     UINT32                  LineNumber,
672c2c66affSColin Finck     UINT32                  ComponentId,
673c2c66affSColin Finck     ACPI_OBJECT_TYPE        Type);
674c2c66affSColin Finck 
675c2c66affSColin Finck void *
676c2c66affSColin Finck AcpiUtAllocateObjectDescDbg (
677c2c66affSColin Finck     const char              *ModuleName,
678c2c66affSColin Finck     UINT32                  LineNumber,
679c2c66affSColin Finck     UINT32                  ComponentId);
680c2c66affSColin Finck 
681c2c66affSColin Finck #define AcpiUtCreateInternalObject(t)   AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
682c2c66affSColin Finck #define AcpiUtAllocateObjectDesc()      AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
683c2c66affSColin Finck 
684c2c66affSColin Finck void
685c2c66affSColin Finck AcpiUtDeleteObjectDesc (
686c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Object);
687c2c66affSColin Finck 
688c2c66affSColin Finck BOOLEAN
689c2c66affSColin Finck AcpiUtValidInternalObject (
690c2c66affSColin Finck     void                    *Object);
691c2c66affSColin Finck 
692c2c66affSColin Finck ACPI_OPERAND_OBJECT *
693c2c66affSColin Finck AcpiUtCreatePackageObject (
694c2c66affSColin Finck     UINT32                  Count);
695c2c66affSColin Finck 
696c2c66affSColin Finck ACPI_OPERAND_OBJECT *
697c2c66affSColin Finck AcpiUtCreateIntegerObject (
698c2c66affSColin Finck     UINT64                  Value);
699c2c66affSColin Finck 
700c2c66affSColin Finck ACPI_OPERAND_OBJECT *
701c2c66affSColin Finck AcpiUtCreateBufferObject (
702c2c66affSColin Finck     ACPI_SIZE               BufferSize);
703c2c66affSColin Finck 
704c2c66affSColin Finck ACPI_OPERAND_OBJECT *
705c2c66affSColin Finck AcpiUtCreateStringObject (
706c2c66affSColin Finck     ACPI_SIZE               StringSize);
707c2c66affSColin Finck 
708c2c66affSColin Finck ACPI_STATUS
709c2c66affSColin Finck AcpiUtGetObjectSize(
710c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Obj,
711c2c66affSColin Finck     ACPI_SIZE               *ObjLength);
712c2c66affSColin Finck 
713c2c66affSColin Finck 
714c2c66affSColin Finck /*
715c2c66affSColin Finck  * utosi - Support for the _OSI predefined control method
716c2c66affSColin Finck  */
717c2c66affSColin Finck ACPI_STATUS
718c2c66affSColin Finck AcpiUtInitializeInterfaces (
719c2c66affSColin Finck     void);
720c2c66affSColin Finck 
721c2c66affSColin Finck ACPI_STATUS
722c2c66affSColin Finck AcpiUtInterfaceTerminate (
723c2c66affSColin Finck     void);
724c2c66affSColin Finck 
725c2c66affSColin Finck ACPI_STATUS
726c2c66affSColin Finck AcpiUtInstallInterface (
727c2c66affSColin Finck     ACPI_STRING             InterfaceName);
728c2c66affSColin Finck 
729c2c66affSColin Finck ACPI_STATUS
730c2c66affSColin Finck AcpiUtRemoveInterface (
731c2c66affSColin Finck     ACPI_STRING             InterfaceName);
732c2c66affSColin Finck 
733c2c66affSColin Finck ACPI_STATUS
734c2c66affSColin Finck AcpiUtUpdateInterfaces (
735c2c66affSColin Finck     UINT8                   Action);
736c2c66affSColin Finck 
737c2c66affSColin Finck ACPI_INTERFACE_INFO *
738c2c66affSColin Finck AcpiUtGetInterface (
739c2c66affSColin Finck     ACPI_STRING             InterfaceName);
740c2c66affSColin Finck 
741c2c66affSColin Finck ACPI_STATUS
742c2c66affSColin Finck AcpiUtOsiImplementation (
743c2c66affSColin Finck     ACPI_WALK_STATE         *WalkState);
744c2c66affSColin Finck 
745c2c66affSColin Finck 
746c2c66affSColin Finck /*
747c2c66affSColin Finck  * utpredef - support for predefined names
748c2c66affSColin Finck  */
749c2c66affSColin Finck const ACPI_PREDEFINED_INFO *
750c2c66affSColin Finck AcpiUtGetNextPredefinedMethod (
751c2c66affSColin Finck     const ACPI_PREDEFINED_INFO  *ThisName);
752c2c66affSColin Finck 
753c2c66affSColin Finck const ACPI_PREDEFINED_INFO *
754c2c66affSColin Finck AcpiUtMatchPredefinedMethod (
755c2c66affSColin Finck     char                        *Name);
756c2c66affSColin Finck 
757c2c66affSColin Finck void
758c2c66affSColin Finck AcpiUtGetExpectedReturnTypes (
759c2c66affSColin Finck     char                    *Buffer,
760c2c66affSColin Finck     UINT32                  ExpectedBtypes);
761c2c66affSColin Finck 
762c2c66affSColin Finck #if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP)
763c2c66affSColin Finck const ACPI_PREDEFINED_INFO *
764c2c66affSColin Finck AcpiUtMatchResourceName (
765c2c66affSColin Finck     char                        *Name);
766c2c66affSColin Finck 
767c2c66affSColin Finck void
768c2c66affSColin Finck AcpiUtDisplayPredefinedMethod (
769c2c66affSColin Finck     char                        *Buffer,
770c2c66affSColin Finck     const ACPI_PREDEFINED_INFO  *ThisName,
771c2c66affSColin Finck     BOOLEAN                     MultiLine);
772c2c66affSColin Finck 
773c2c66affSColin Finck UINT32
774c2c66affSColin Finck AcpiUtGetResourceBitWidth (
775c2c66affSColin Finck     char                    *Buffer,
776c2c66affSColin Finck     UINT16                  Types);
777c2c66affSColin Finck #endif
778c2c66affSColin Finck 
779c2c66affSColin Finck 
780c2c66affSColin Finck /*
781c2c66affSColin Finck  * utstate - Generic state creation/cache routines
782c2c66affSColin Finck  */
783c2c66affSColin Finck void
784c2c66affSColin Finck AcpiUtPushGenericState (
785c2c66affSColin Finck     ACPI_GENERIC_STATE      **ListHead,
786c2c66affSColin Finck     ACPI_GENERIC_STATE      *State);
787c2c66affSColin Finck 
788c2c66affSColin Finck ACPI_GENERIC_STATE *
789c2c66affSColin Finck AcpiUtPopGenericState (
790c2c66affSColin Finck     ACPI_GENERIC_STATE      **ListHead);
791c2c66affSColin Finck 
792c2c66affSColin Finck 
793c2c66affSColin Finck ACPI_GENERIC_STATE *
794c2c66affSColin Finck AcpiUtCreateGenericState (
795c2c66affSColin Finck     void);
796c2c66affSColin Finck 
797c2c66affSColin Finck ACPI_THREAD_STATE *
798c2c66affSColin Finck AcpiUtCreateThreadState (
799c2c66affSColin Finck     void);
800c2c66affSColin Finck 
801c2c66affSColin Finck ACPI_GENERIC_STATE *
802c2c66affSColin Finck AcpiUtCreateUpdateState (
803c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Object,
804c2c66affSColin Finck     UINT16                  Action);
805c2c66affSColin Finck 
806c2c66affSColin Finck ACPI_GENERIC_STATE *
807c2c66affSColin Finck AcpiUtCreatePkgState (
808c2c66affSColin Finck     void                    *InternalObject,
809c2c66affSColin Finck     void                    *ExternalObject,
810c2c66affSColin Finck     UINT32                  Index);
811c2c66affSColin Finck 
812c2c66affSColin Finck ACPI_STATUS
813c2c66affSColin Finck AcpiUtCreateUpdateStateAndPush (
814c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *Object,
815c2c66affSColin Finck     UINT16                  Action,
816c2c66affSColin Finck     ACPI_GENERIC_STATE      **StateList);
817c2c66affSColin Finck 
818c2c66affSColin Finck ACPI_GENERIC_STATE *
819c2c66affSColin Finck AcpiUtCreateControlState (
820c2c66affSColin Finck     void);
821c2c66affSColin Finck 
822c2c66affSColin Finck void
823c2c66affSColin Finck AcpiUtDeleteGenericState (
824c2c66affSColin Finck     ACPI_GENERIC_STATE      *State);
825c2c66affSColin Finck 
826c2c66affSColin Finck 
827c2c66affSColin Finck /*
828c2c66affSColin Finck  * utmath
829c2c66affSColin Finck  */
830c2c66affSColin Finck ACPI_STATUS
831c2c66affSColin Finck AcpiUtDivide (
832c2c66affSColin Finck     UINT64                  InDividend,
833c2c66affSColin Finck     UINT64                  InDivisor,
834c2c66affSColin Finck     UINT64                  *OutQuotient,
835c2c66affSColin Finck     UINT64                  *OutRemainder);
836c2c66affSColin Finck 
837c2c66affSColin Finck ACPI_STATUS
838c2c66affSColin Finck AcpiUtShortDivide (
839c2c66affSColin Finck     UINT64                  InDividend,
840c2c66affSColin Finck     UINT32                  Divisor,
841c2c66affSColin Finck     UINT64                  *OutQuotient,
842c2c66affSColin Finck     UINT32                  *OutRemainder);
843c2c66affSColin Finck 
844c2c66affSColin Finck ACPI_STATUS
845c2c66affSColin Finck AcpiUtShortMultiply (
846c2c66affSColin Finck     UINT64                  InMultiplicand,
847c2c66affSColin Finck     UINT32                  Multiplier,
848c2c66affSColin Finck     UINT64                  *Outproduct);
849c2c66affSColin Finck 
850c2c66affSColin Finck ACPI_STATUS
851c2c66affSColin Finck AcpiUtShortShiftLeft (
852c2c66affSColin Finck     UINT64                  Operand,
853c2c66affSColin Finck     UINT32                  Count,
854c2c66affSColin Finck     UINT64                  *OutResult);
855c2c66affSColin Finck 
856c2c66affSColin Finck ACPI_STATUS
857c2c66affSColin Finck AcpiUtShortShiftRight (
858c2c66affSColin Finck     UINT64                  Operand,
859c2c66affSColin Finck     UINT32                  Count,
860c2c66affSColin Finck     UINT64                  *OutResult);
861c2c66affSColin Finck 
862c2c66affSColin Finck 
863c2c66affSColin Finck /*
864c2c66affSColin Finck  * utmisc
865c2c66affSColin Finck  */
866c2c66affSColin Finck const ACPI_EXCEPTION_INFO *
867c2c66affSColin Finck AcpiUtValidateException (
868c2c66affSColin Finck     ACPI_STATUS             Status);
869c2c66affSColin Finck 
870c2c66affSColin Finck BOOLEAN
871c2c66affSColin Finck AcpiUtIsPciRootBridge (
872c2c66affSColin Finck     char                    *Id);
873c2c66affSColin Finck 
874c2c66affSColin Finck #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
875c2c66affSColin Finck BOOLEAN
876c2c66affSColin Finck AcpiUtIsAmlTable (
877c2c66affSColin Finck     ACPI_TABLE_HEADER       *Table);
878c2c66affSColin Finck #endif
879c2c66affSColin Finck 
880c2c66affSColin Finck ACPI_STATUS
881c2c66affSColin Finck AcpiUtWalkPackageTree (
882c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *SourceObject,
883c2c66affSColin Finck     void                    *TargetObject,
884c2c66affSColin Finck     ACPI_PKG_CALLBACK       WalkCallback,
885c2c66affSColin Finck     void                    *Context);
886c2c66affSColin Finck 
887c2c66affSColin Finck /* Values for Base above (16=Hex, 10=Decimal) */
888c2c66affSColin Finck 
889c2c66affSColin Finck #define ACPI_ANY_BASE        0
890c2c66affSColin Finck 
891c2c66affSColin Finck 
892c2c66affSColin Finck UINT32
893c2c66affSColin Finck AcpiUtDwordByteSwap (
894c2c66affSColin Finck     UINT32                  Value);
895c2c66affSColin Finck 
896c2c66affSColin Finck void
897c2c66affSColin Finck AcpiUtSetIntegerWidth (
898c2c66affSColin Finck     UINT8                   Revision);
899c2c66affSColin Finck 
900c2c66affSColin Finck #ifdef ACPI_DEBUG_OUTPUT
901c2c66affSColin Finck void
902c2c66affSColin Finck AcpiUtDisplayInitPathname (
903c2c66affSColin Finck     UINT8                   Type,
904c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *ObjHandle,
905c2c66affSColin Finck     const char              *Path);
906c2c66affSColin Finck #endif
907c2c66affSColin Finck 
908c2c66affSColin Finck 
909c2c66affSColin Finck /*
910c2c66affSColin Finck  * utownerid - Support for Table/Method Owner IDs
911c2c66affSColin Finck  */
912c2c66affSColin Finck ACPI_STATUS
913c2c66affSColin Finck AcpiUtAllocateOwnerId (
914c2c66affSColin Finck     ACPI_OWNER_ID           *OwnerId);
915c2c66affSColin Finck 
916c2c66affSColin Finck void
917c2c66affSColin Finck AcpiUtReleaseOwnerId (
918c2c66affSColin Finck     ACPI_OWNER_ID           *OwnerId);
919c2c66affSColin Finck 
920c2c66affSColin Finck 
921c2c66affSColin Finck /*
922c2c66affSColin Finck  * utresrc
923c2c66affSColin Finck  */
924c2c66affSColin Finck ACPI_STATUS
925c2c66affSColin Finck AcpiUtWalkAmlResources (
926c2c66affSColin Finck     ACPI_WALK_STATE         *WalkState,
927c2c66affSColin Finck     UINT8                   *Aml,
928c2c66affSColin Finck     ACPI_SIZE               AmlLength,
929c2c66affSColin Finck     ACPI_WALK_AML_CALLBACK  UserFunction,
930c2c66affSColin Finck     void                    **Context);
931c2c66affSColin Finck 
932c2c66affSColin Finck ACPI_STATUS
933c2c66affSColin Finck AcpiUtValidateResource (
934c2c66affSColin Finck     ACPI_WALK_STATE         *WalkState,
935c2c66affSColin Finck     void                    *Aml,
936c2c66affSColin Finck     UINT8                   *ReturnIndex);
937c2c66affSColin Finck 
938c2c66affSColin Finck UINT32
939c2c66affSColin Finck AcpiUtGetDescriptorLength (
940c2c66affSColin Finck     void                    *Aml);
941c2c66affSColin Finck 
942c2c66affSColin Finck UINT16
943c2c66affSColin Finck AcpiUtGetResourceLength (
944c2c66affSColin Finck     void                    *Aml);
945c2c66affSColin Finck 
946c2c66affSColin Finck UINT8
947c2c66affSColin Finck AcpiUtGetResourceHeaderLength (
948c2c66affSColin Finck     void                    *Aml);
949c2c66affSColin Finck 
950c2c66affSColin Finck UINT8
951c2c66affSColin Finck AcpiUtGetResourceType (
952c2c66affSColin Finck     void                    *Aml);
953c2c66affSColin Finck 
954c2c66affSColin Finck ACPI_STATUS
955c2c66affSColin Finck AcpiUtGetResourceEndTag (
956c2c66affSColin Finck     ACPI_OPERAND_OBJECT     *ObjDesc,
957c2c66affSColin Finck     UINT8                   **EndTag);
958c2c66affSColin Finck 
959c2c66affSColin Finck 
960c2c66affSColin Finck /*
961c2c66affSColin Finck  * utstring - String and character utilities
962c2c66affSColin Finck  */
963c2c66affSColin Finck void
964c2c66affSColin Finck AcpiUtPrintString (
965c2c66affSColin Finck     char                    *String,
966c2c66affSColin Finck     UINT16                  MaxLength);
967c2c66affSColin Finck 
968c2c66affSColin Finck #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
969c2c66affSColin Finck void
970c2c66affSColin Finck UtConvertBackslashes (
971c2c66affSColin Finck     char                    *Pathname);
972c2c66affSColin Finck #endif
973c2c66affSColin Finck 
974c2c66affSColin Finck void
975c2c66affSColin Finck AcpiUtRepairName (
976c2c66affSColin Finck     char                    *Name);
977c2c66affSColin Finck 
9782deb69c1SThomas Faber #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT)
979c2c66affSColin Finck BOOLEAN
980c2c66affSColin Finck AcpiUtSafeStrcpy (
981c2c66affSColin Finck     char                    *Dest,
982c2c66affSColin Finck     ACPI_SIZE               DestSize,
983c2c66affSColin Finck     char                    *Source);
984c2c66affSColin Finck 
985ec55f0ebSThomas Faber void
986ec55f0ebSThomas Faber AcpiUtSafeStrncpy (
987ec55f0ebSThomas Faber     char                    *Dest,
988ec55f0ebSThomas Faber     char                    *Source,
989ec55f0ebSThomas Faber     ACPI_SIZE               DestSize);
990ec55f0ebSThomas Faber 
991c2c66affSColin Finck BOOLEAN
992c2c66affSColin Finck AcpiUtSafeStrcat (
993c2c66affSColin Finck     char                    *Dest,
994c2c66affSColin Finck     ACPI_SIZE               DestSize,
995c2c66affSColin Finck     char                    *Source);
996c2c66affSColin Finck 
997c2c66affSColin Finck BOOLEAN
998c2c66affSColin Finck AcpiUtSafeStrncat (
999c2c66affSColin Finck     char                    *Dest,
1000c2c66affSColin Finck     ACPI_SIZE               DestSize,
1001c2c66affSColin Finck     char                    *Source,
1002c2c66affSColin Finck     ACPI_SIZE               MaxTransferLength);
1003c2c66affSColin Finck #endif
1004c2c66affSColin Finck 
1005c2c66affSColin Finck 
1006c2c66affSColin Finck /*
1007c2c66affSColin Finck  * utmutex - mutex support
1008c2c66affSColin Finck  */
1009c2c66affSColin Finck ACPI_STATUS
1010c2c66affSColin Finck AcpiUtMutexInitialize (
1011c2c66affSColin Finck     void);
1012c2c66affSColin Finck 
1013c2c66affSColin Finck void
1014c2c66affSColin Finck AcpiUtMutexTerminate (
1015c2c66affSColin Finck     void);
1016c2c66affSColin Finck 
1017c2c66affSColin Finck ACPI_STATUS
1018c2c66affSColin Finck AcpiUtAcquireMutex (
1019c2c66affSColin Finck     ACPI_MUTEX_HANDLE       MutexId);
1020c2c66affSColin Finck 
1021c2c66affSColin Finck ACPI_STATUS
1022c2c66affSColin Finck AcpiUtReleaseMutex (
1023c2c66affSColin Finck     ACPI_MUTEX_HANDLE       MutexId);
1024c2c66affSColin Finck 
1025c2c66affSColin Finck 
1026c2c66affSColin Finck /*
1027c2c66affSColin Finck  * utalloc - memory allocation and object caching
1028c2c66affSColin Finck  */
1029c2c66affSColin Finck ACPI_STATUS
1030c2c66affSColin Finck AcpiUtCreateCaches (
1031c2c66affSColin Finck     void);
1032c2c66affSColin Finck 
1033c2c66affSColin Finck ACPI_STATUS
1034c2c66affSColin Finck AcpiUtDeleteCaches (
1035c2c66affSColin Finck     void);
1036c2c66affSColin Finck 
1037c2c66affSColin Finck ACPI_STATUS
1038c2c66affSColin Finck AcpiUtValidateBuffer (
1039c2c66affSColin Finck     ACPI_BUFFER             *Buffer);
1040c2c66affSColin Finck 
1041c2c66affSColin Finck ACPI_STATUS
1042c2c66affSColin Finck AcpiUtInitializeBuffer (
1043c2c66affSColin Finck     ACPI_BUFFER             *Buffer,
1044c2c66affSColin Finck     ACPI_SIZE               RequiredLength);
1045c2c66affSColin Finck 
1046c2c66affSColin Finck #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1047c2c66affSColin Finck void *
1048c2c66affSColin Finck AcpiUtAllocateAndTrack (
1049c2c66affSColin Finck     ACPI_SIZE               Size,
1050c2c66affSColin Finck     UINT32                  Component,
1051c2c66affSColin Finck     const char              *Module,
1052c2c66affSColin Finck     UINT32                  Line);
1053c2c66affSColin Finck 
1054c2c66affSColin Finck void *
1055c2c66affSColin Finck AcpiUtAllocateZeroedAndTrack (
1056c2c66affSColin Finck     ACPI_SIZE               Size,
1057c2c66affSColin Finck     UINT32                  Component,
1058c2c66affSColin Finck     const char              *Module,
1059c2c66affSColin Finck     UINT32                  Line);
1060c2c66affSColin Finck 
1061c2c66affSColin Finck void
1062c2c66affSColin Finck AcpiUtFreeAndTrack (
1063c2c66affSColin Finck     void                    *Address,
1064c2c66affSColin Finck     UINT32                  Component,
1065c2c66affSColin Finck     const char              *Module,
1066c2c66affSColin Finck     UINT32                  Line);
1067c2c66affSColin Finck 
1068c2c66affSColin Finck void
1069c2c66affSColin Finck AcpiUtDumpAllocationInfo (
1070c2c66affSColin Finck     void);
1071c2c66affSColin Finck 
1072c2c66affSColin Finck void
1073c2c66affSColin Finck AcpiUtDumpAllocations (
1074c2c66affSColin Finck     UINT32                  Component,
1075c2c66affSColin Finck     const char              *Module);
1076c2c66affSColin Finck 
1077c2c66affSColin Finck ACPI_STATUS
1078c2c66affSColin Finck AcpiUtCreateList (
1079c2c66affSColin Finck     const char              *ListName,
1080c2c66affSColin Finck     UINT16                  ObjectSize,
1081c2c66affSColin Finck     ACPI_MEMORY_LIST        **ReturnCache);
1082c2c66affSColin Finck 
1083c2c66affSColin Finck #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
1084c2c66affSColin Finck 
1085c2c66affSColin Finck 
1086c2c66affSColin Finck /*
1087c2c66affSColin Finck  * utaddress - address range check
1088c2c66affSColin Finck  */
1089c2c66affSColin Finck ACPI_STATUS
1090c2c66affSColin Finck AcpiUtAddAddressRange (
1091c2c66affSColin Finck     ACPI_ADR_SPACE_TYPE     SpaceId,
1092c2c66affSColin Finck     ACPI_PHYSICAL_ADDRESS   Address,
1093c2c66affSColin Finck     UINT32                  Length,
1094c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *RegionNode);
1095c2c66affSColin Finck 
1096c2c66affSColin Finck void
1097c2c66affSColin Finck AcpiUtRemoveAddressRange (
1098c2c66affSColin Finck     ACPI_ADR_SPACE_TYPE     SpaceId,
1099c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *RegionNode);
1100c2c66affSColin Finck 
1101c2c66affSColin Finck UINT32
1102c2c66affSColin Finck AcpiUtCheckAddressRange (
1103c2c66affSColin Finck     ACPI_ADR_SPACE_TYPE     SpaceId,
1104c2c66affSColin Finck     ACPI_PHYSICAL_ADDRESS   Address,
1105c2c66affSColin Finck     UINT32                  Length,
1106c2c66affSColin Finck     BOOLEAN                 Warn);
1107c2c66affSColin Finck 
1108c2c66affSColin Finck void
1109c2c66affSColin Finck AcpiUtDeleteAddressLists (
1110c2c66affSColin Finck     void);
1111c2c66affSColin Finck 
1112c2c66affSColin Finck 
1113c2c66affSColin Finck /*
1114c2c66affSColin Finck  * utxferror - various error/warning output functions
1115c2c66affSColin Finck  */
11165d4f13f6SThomas Faber ACPI_PRINTF_LIKE(5)
1117c2c66affSColin Finck void ACPI_INTERNAL_VAR_XFACE
1118c2c66affSColin Finck AcpiUtPredefinedWarning (
1119c2c66affSColin Finck     const char              *ModuleName,
1120c2c66affSColin Finck     UINT32                  LineNumber,
1121c2c66affSColin Finck     char                    *Pathname,
11225d4f13f6SThomas Faber     UINT16                  NodeFlags,
1123c2c66affSColin Finck     const char              *Format,
1124c2c66affSColin Finck     ...);
1125c2c66affSColin Finck 
11265d4f13f6SThomas Faber ACPI_PRINTF_LIKE(5)
1127c2c66affSColin Finck void ACPI_INTERNAL_VAR_XFACE
1128c2c66affSColin Finck AcpiUtPredefinedInfo (
1129c2c66affSColin Finck     const char              *ModuleName,
1130c2c66affSColin Finck     UINT32                  LineNumber,
1131c2c66affSColin Finck     char                    *Pathname,
11325d4f13f6SThomas Faber     UINT16                  NodeFlags,
1133c2c66affSColin Finck     const char              *Format,
1134c2c66affSColin Finck     ...);
1135c2c66affSColin Finck 
11365d4f13f6SThomas Faber ACPI_PRINTF_LIKE(5)
1137c2c66affSColin Finck void ACPI_INTERNAL_VAR_XFACE
1138c2c66affSColin Finck AcpiUtPredefinedBiosError (
1139c2c66affSColin Finck     const char              *ModuleName,
1140c2c66affSColin Finck     UINT32                  LineNumber,
1141c2c66affSColin Finck     char                    *Pathname,
11425d4f13f6SThomas Faber     UINT16                  NodeFlags,
1143c2c66affSColin Finck     const char              *Format,
1144c2c66affSColin Finck     ...);
1145c2c66affSColin Finck 
1146c2c66affSColin Finck void
1147ec55f0ebSThomas Faber AcpiUtPrefixedNamespaceError (
1148c2c66affSColin Finck     const char              *ModuleName,
1149c2c66affSColin Finck     UINT32                  LineNumber,
1150ec55f0ebSThomas Faber     ACPI_GENERIC_STATE      *PrefixScope,
1151c2c66affSColin Finck     const char              *InternalName,
1152c2c66affSColin Finck     ACPI_STATUS             LookupStatus);
1153c2c66affSColin Finck 
1154c2c66affSColin Finck void
1155c2c66affSColin Finck AcpiUtMethodError (
1156c2c66affSColin Finck     const char              *ModuleName,
1157c2c66affSColin Finck     UINT32                  LineNumber,
1158c2c66affSColin Finck     const char              *Message,
1159c2c66affSColin Finck     ACPI_NAMESPACE_NODE     *Node,
1160c2c66affSColin Finck     const char              *Path,
1161c2c66affSColin Finck     ACPI_STATUS             LookupStatus);
1162c2c66affSColin Finck 
1163c2c66affSColin Finck 
1164c2c66affSColin Finck /*
1165c2c66affSColin Finck  * Utility functions for ACPI names and IDs
1166c2c66affSColin Finck  */
1167c2c66affSColin Finck const AH_PREDEFINED_NAME *
1168c2c66affSColin Finck AcpiAhMatchPredefinedName (
1169c2c66affSColin Finck     char                    *Nameseg);
1170c2c66affSColin Finck 
1171c2c66affSColin Finck const AH_DEVICE_ID *
1172c2c66affSColin Finck AcpiAhMatchHardwareId (
1173c2c66affSColin Finck     char                    *Hid);
1174c2c66affSColin Finck 
1175c2c66affSColin Finck const char *
1176c2c66affSColin Finck AcpiAhMatchUuid (
1177c2c66affSColin Finck     UINT8                   *Data);
1178c2c66affSColin Finck 
1179c2c66affSColin Finck 
1180c2c66affSColin Finck /*
1181c2c66affSColin Finck  * utuuid -- UUID support functions
1182c2c66affSColin Finck  */
1183c2c66affSColin Finck #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP)
1184c2c66affSColin Finck void
1185c2c66affSColin Finck AcpiUtConvertStringToUuid (
1186c2c66affSColin Finck     char                    *InString,
1187c2c66affSColin Finck     UINT8                   *UuidBuffer);
11883c284560SThomas Faber 
11893c284560SThomas Faber ACPI_STATUS
11903c284560SThomas Faber AcpiUtConvertUuidToString (
11913c284560SThomas Faber     char                    *UuidBuffer,
11923c284560SThomas Faber     char                    *OutString);
1193c2c66affSColin Finck #endif
1194c2c66affSColin Finck 
1195c2c66affSColin Finck #endif /* _ACUTILS_H */
1196