xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/include/acutils.h (revision 986e4abce4efeccd9418eb8cdc7a710487f093b9)
1 /******************************************************************************
2  *
3  * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************/
115 
116 #ifndef _ACUTILS_H
117 #define _ACUTILS_H
118 
119 
120 extern const UINT8                      AcpiGbl_ResourceAmlSizes[];
121 extern const UINT8                      AcpiGbl_ResourceAmlSerialBusSizes[];
122 
123 /* Strings used by the disassembler and debugger resource dump routines */
124 
125 #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
126 
127 extern const char                       *AcpiGbl_BmDecode[];
128 extern const char                       *AcpiGbl_ConfigDecode[];
129 extern const char                       *AcpiGbl_ConsumeDecode[];
130 extern const char                       *AcpiGbl_DecDecode[];
131 extern const char                       *AcpiGbl_HeDecode[];
132 extern const char                       *AcpiGbl_IoDecode[];
133 extern const char                       *AcpiGbl_LlDecode[];
134 extern const char                       *AcpiGbl_MaxDecode[];
135 extern const char                       *AcpiGbl_MemDecode[];
136 extern const char                       *AcpiGbl_MinDecode[];
137 extern const char                       *AcpiGbl_MtpDecode[];
138 extern const char                       *AcpiGbl_RngDecode[];
139 extern const char                       *AcpiGbl_RwDecode[];
140 extern const char                       *AcpiGbl_ShrDecode[];
141 extern const char                       *AcpiGbl_SizDecode[];
142 extern const char                       *AcpiGbl_TrsDecode[];
143 extern const char                       *AcpiGbl_TtpDecode[];
144 extern const char                       *AcpiGbl_TypDecode[];
145 extern const char                       *AcpiGbl_PpcDecode[];
146 extern const char                       *AcpiGbl_IorDecode[];
147 extern const char                       *AcpiGbl_DtsDecode[];
148 extern const char                       *AcpiGbl_CtDecode[];
149 extern const char                       *AcpiGbl_SbtDecode[];
150 extern const char                       *AcpiGbl_AmDecode[];
151 extern const char                       *AcpiGbl_SmDecode[];
152 extern const char                       *AcpiGbl_WmDecode[];
153 extern const char                       *AcpiGbl_CphDecode[];
154 extern const char                       *AcpiGbl_CpoDecode[];
155 extern const char                       *AcpiGbl_DpDecode[];
156 extern const char                       *AcpiGbl_EdDecode[];
157 extern const char                       *AcpiGbl_BpbDecode[];
158 extern const char                       *AcpiGbl_SbDecode[];
159 extern const char                       *AcpiGbl_FcDecode[];
160 extern const char                       *AcpiGbl_PtDecode[];
161 #endif
162 
163 /*
164  * For the iASL compiler case, the output is redirected to stderr so that
165  * any of the various ACPI errors and warnings do not appear in the output
166  * files, for either the compiler or disassembler portions of the tool.
167  */
168 #ifdef ACPI_ASL_COMPILER
169 
170 #include <stdio.h>
171 extern FILE                 *AcpiGbl_OutputFile;
172 
173 #define ACPI_MSG_REDIRECT_BEGIN \
174     FILE                    *OutputFile = AcpiGbl_OutputFile; \
175     AcpiOsRedirectOutput (stderr);
176 
177 #define ACPI_MSG_REDIRECT_END \
178     AcpiOsRedirectOutput (OutputFile);
179 
180 #else
181 /*
182  * non-iASL case - no redirection, nothing to do
183  */
184 #define ACPI_MSG_REDIRECT_BEGIN
185 #define ACPI_MSG_REDIRECT_END
186 #endif
187 
188 /*
189  * Common error message prefixes
190  */
191 #define ACPI_MSG_ERROR          "ACPI Error: "
192 #define ACPI_MSG_EXCEPTION      "ACPI Exception: "
193 #define ACPI_MSG_WARNING        "ACPI Warning: "
194 #define ACPI_MSG_INFO           "ACPI: "
195 
196 #define ACPI_MSG_BIOS_ERROR     "ACPI BIOS Error (bug): "
197 #define ACPI_MSG_BIOS_WARNING   "ACPI BIOS Warning (bug): "
198 
199 /*
200  * Common message suffix
201  */
202 #define ACPI_MSG_SUFFIX \
203     AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber)
204 
205 
206 /* Types for Resource descriptor entries */
207 
208 #define ACPI_INVALID_RESOURCE           0
209 #define ACPI_FIXED_LENGTH               1
210 #define ACPI_VARIABLE_LENGTH            2
211 #define ACPI_SMALL_VARIABLE_LENGTH      3
212 
213 typedef
214 ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
215     UINT8                   *Aml,
216     UINT32                  Length,
217     UINT32                  Offset,
218     UINT8                   ResourceIndex,
219     void                    **Context);
220 
221 typedef
222 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
223     UINT8                   ObjectType,
224     ACPI_OPERAND_OBJECT     *SourceObject,
225     ACPI_GENERIC_STATE      *State,
226     void                    *Context);
227 
228 typedef struct acpi_pkg_info
229 {
230     UINT8                   *FreeSpace;
231     ACPI_SIZE               Length;
232     UINT32                  ObjectSpace;
233     UINT32                  NumPackages;
234 
235 } ACPI_PKG_INFO;
236 
237 /* Object reference counts */
238 
239 #define REF_INCREMENT       (UINT16) 0
240 #define REF_DECREMENT       (UINT16) 1
241 
242 /* AcpiUtDumpBuffer */
243 
244 #define DB_BYTE_DISPLAY     1
245 #define DB_WORD_DISPLAY     2
246 #define DB_DWORD_DISPLAY    4
247 #define DB_QWORD_DISPLAY    8
248 
249 /*
250  * utglobal - Global data structures and procedures
251  */
252 ACPI_STATUS
253 AcpiUtInitGlobals (
254     void);
255 
256 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
257 
258 char *
259 AcpiUtGetMutexName (
260     UINT32                  MutexId);
261 
262 const char *
263 AcpiUtGetNotifyName (
264     UINT32                  NotifyValue);
265 
266 #endif
267 
268 char *
269 AcpiUtGetTypeName (
270     ACPI_OBJECT_TYPE        Type);
271 
272 char *
273 AcpiUtGetNodeName (
274     void                    *Object);
275 
276 char *
277 AcpiUtGetDescriptorName (
278     void                    *Object);
279 
280 const char *
281 AcpiUtGetReferenceName (
282     ACPI_OPERAND_OBJECT     *Object);
283 
284 char *
285 AcpiUtGetObjectTypeName (
286     ACPI_OPERAND_OBJECT     *ObjDesc);
287 
288 char *
289 AcpiUtGetRegionName (
290     UINT8                   SpaceId);
291 
292 char *
293 AcpiUtGetEventName (
294     UINT32                  EventId);
295 
296 char
297 AcpiUtHexToAsciiChar (
298     UINT64                  Integer,
299     UINT32                  Position);
300 
301 BOOLEAN
302 AcpiUtValidObjectType (
303     ACPI_OBJECT_TYPE        Type);
304 
305 
306 /*
307  * utinit - miscellaneous initialization and shutdown
308  */
309 ACPI_STATUS
310 AcpiUtHardwareInitialize (
311     void);
312 
313 void
314 AcpiUtSubsystemShutdown (
315     void);
316 
317 
318 /*
319  * utclib - Local implementations of C library functions
320  */
321 #ifndef ACPI_USE_SYSTEM_CLIBRARY
322 
323 ACPI_SIZE
324 AcpiUtStrlen (
325     const char              *String);
326 
327 char *
328 AcpiUtStrcpy (
329     char                    *DstString,
330     const char              *SrcString);
331 
332 char *
333 AcpiUtStrncpy (
334     char                    *DstString,
335     const char              *SrcString,
336     ACPI_SIZE               Count);
337 
338 int
339 AcpiUtMemcmp (
340     const char              *Buffer1,
341     const char              *Buffer2,
342     ACPI_SIZE               Count);
343 
344 int
345 AcpiUtStrncmp (
346     const char              *String1,
347     const char              *String2,
348     ACPI_SIZE               Count);
349 
350 int
351 AcpiUtStrcmp (
352     const char              *String1,
353     const char              *String2);
354 
355 char *
356 AcpiUtStrcat (
357     char                    *DstString,
358     const char              *SrcString);
359 
360 char *
361 AcpiUtStrncat (
362     char                    *DstString,
363     const char              *SrcString,
364     ACPI_SIZE               Count);
365 
366 UINT32
367 AcpiUtStrtoul (
368     const char              *String,
369     char                    **Terminator,
370     UINT32                  Base);
371 
372 char *
373 AcpiUtStrstr (
374     char                    *String1,
375     char                    *String2);
376 
377 void *
378 AcpiUtMemcpy (
379     void                    *Dest,
380     const void              *Src,
381     ACPI_SIZE               Count);
382 
383 void *
384 AcpiUtMemset (
385     void                    *Dest,
386     UINT8                   Value,
387     ACPI_SIZE               Count);
388 
389 int
390 AcpiUtToUpper (
391     int                     c);
392 
393 int
394 AcpiUtToLower (
395     int                     c);
396 
397 extern const UINT8 _acpi_ctype[];
398 
399 #define _ACPI_XA     0x00    /* extra alphabetic - not supported */
400 #define _ACPI_XS     0x40    /* extra space */
401 #define _ACPI_BB     0x00    /* BEL, BS, etc. - not supported */
402 #define _ACPI_CN     0x20    /* CR, FF, HT, NL, VT */
403 #define _ACPI_DI     0x04    /* '0'-'9' */
404 #define _ACPI_LO     0x02    /* 'a'-'z' */
405 #define _ACPI_PU     0x10    /* punctuation */
406 #define _ACPI_SP     0x08    /* space */
407 #define _ACPI_UP     0x01    /* 'A'-'Z' */
408 #define _ACPI_XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
409 
410 #define ACPI_IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
411 #define ACPI_IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
412 #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
413 #define ACPI_IS_UPPER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
414 #define ACPI_IS_LOWER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
415 #define ACPI_IS_PRINT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
416 #define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
417 
418 #endif /* !ACPI_USE_SYSTEM_CLIBRARY */
419 
420 #define ACPI_IS_ASCII(c)  ((c) < 0x80)
421 
422 
423 /*
424  * utcopy - Object construction and conversion interfaces
425  */
426 ACPI_STATUS
427 AcpiUtBuildSimpleObject(
428     ACPI_OPERAND_OBJECT     *Obj,
429     ACPI_OBJECT             *UserObj,
430     UINT8                   *DataSpace,
431     UINT32                  *BufferSpaceUsed);
432 
433 ACPI_STATUS
434 AcpiUtBuildPackageObject (
435     ACPI_OPERAND_OBJECT     *Obj,
436     UINT8                   *Buffer,
437     UINT32                  *SpaceUsed);
438 
439 ACPI_STATUS
440 AcpiUtCopyIobjectToEobject (
441     ACPI_OPERAND_OBJECT     *Obj,
442     ACPI_BUFFER             *RetBuffer);
443 
444 ACPI_STATUS
445 AcpiUtCopyEobjectToIobject (
446     ACPI_OBJECT             *Obj,
447     ACPI_OPERAND_OBJECT     **InternalObj);
448 
449 ACPI_STATUS
450 AcpiUtCopyISimpleToIsimple (
451     ACPI_OPERAND_OBJECT     *SourceObj,
452     ACPI_OPERAND_OBJECT     *DestObj);
453 
454 ACPI_STATUS
455 AcpiUtCopyIobjectToIobject (
456     ACPI_OPERAND_OBJECT     *SourceDesc,
457     ACPI_OPERAND_OBJECT     **DestDesc,
458     ACPI_WALK_STATE         *WalkState);
459 
460 
461 /*
462  * utcreate - Object creation
463  */
464 ACPI_STATUS
465 AcpiUtUpdateObjectReference (
466     ACPI_OPERAND_OBJECT     *Object,
467     UINT16                  Action);
468 
469 
470 /*
471  * utdebug - Debug interfaces
472  */
473 void
474 AcpiUtInitStackPtrTrace (
475     void);
476 
477 void
478 AcpiUtTrackStackPtr (
479     void);
480 
481 void
482 AcpiUtTrace (
483     UINT32                  LineNumber,
484     const char              *FunctionName,
485     const char              *ModuleName,
486     UINT32                  ComponentId);
487 
488 void
489 AcpiUtTracePtr (
490     UINT32                  LineNumber,
491     const char              *FunctionName,
492     const char              *ModuleName,
493     UINT32                  ComponentId,
494     void                    *Pointer);
495 
496 void
497 AcpiUtTraceU32 (
498     UINT32                  LineNumber,
499     const char              *FunctionName,
500     const char              *ModuleName,
501     UINT32                  ComponentId,
502     UINT32                  Integer);
503 
504 void
505 AcpiUtTraceStr (
506     UINT32                  LineNumber,
507     const char              *FunctionName,
508     const char              *ModuleName,
509     UINT32                  ComponentId,
510     char                    *String);
511 
512 void
513 AcpiUtExit (
514     UINT32                  LineNumber,
515     const char              *FunctionName,
516     const char              *ModuleName,
517     UINT32                  ComponentId);
518 
519 void
520 AcpiUtStatusExit (
521     UINT32                  LineNumber,
522     const char              *FunctionName,
523     const char              *ModuleName,
524     UINT32                  ComponentId,
525     ACPI_STATUS             Status);
526 
527 void
528 AcpiUtValueExit (
529     UINT32                  LineNumber,
530     const char              *FunctionName,
531     const char              *ModuleName,
532     UINT32                  ComponentId,
533     UINT64                  Value);
534 
535 void
536 AcpiUtPtrExit (
537     UINT32                  LineNumber,
538     const char              *FunctionName,
539     const char              *ModuleName,
540     UINT32                  ComponentId,
541     UINT8                   *Ptr);
542 
543 void
544 AcpiUtDebugDumpBuffer (
545     UINT8                   *Buffer,
546     UINT32                  Count,
547     UINT32                  Display,
548     UINT32                  ComponentId);
549 
550 void
551 AcpiUtDumpBuffer (
552     UINT8                   *Buffer,
553     UINT32                  Count,
554     UINT32                  Display,
555     UINT32                  Offset);
556 
557 void
558 AcpiUtReportError (
559     char                    *ModuleName,
560     UINT32                  LineNumber);
561 
562 void
563 AcpiUtReportInfo (
564     char                    *ModuleName,
565     UINT32                  LineNumber);
566 
567 void
568 AcpiUtReportWarning (
569     char                    *ModuleName,
570     UINT32                  LineNumber);
571 
572 /*
573  * utdelete - Object deletion and reference counts
574  */
575 void
576 AcpiUtAddReference (
577     ACPI_OPERAND_OBJECT     *Object);
578 
579 void
580 AcpiUtRemoveReference (
581     ACPI_OPERAND_OBJECT     *Object);
582 
583 void
584 AcpiUtDeleteInternalPackageObject (
585     ACPI_OPERAND_OBJECT     *Object);
586 
587 void
588 AcpiUtDeleteInternalSimpleObject (
589     ACPI_OPERAND_OBJECT     *Object);
590 
591 void
592 AcpiUtDeleteInternalObjectList (
593     ACPI_OPERAND_OBJECT     **ObjList);
594 
595 
596 /*
597  * uteval - object evaluation
598  */
599 ACPI_STATUS
600 AcpiUtEvaluateObject (
601     ACPI_NAMESPACE_NODE     *PrefixNode,
602     char                    *Path,
603     UINT32                  ExpectedReturnBtypes,
604     ACPI_OPERAND_OBJECT     **ReturnDesc);
605 
606 ACPI_STATUS
607 AcpiUtEvaluateNumericObject (
608     char                    *ObjectName,
609     ACPI_NAMESPACE_NODE     *DeviceNode,
610     UINT64                  *Value);
611 
612 ACPI_STATUS
613 AcpiUtExecute_STA (
614     ACPI_NAMESPACE_NODE     *DeviceNode,
615     UINT32                  *StatusFlags);
616 
617 ACPI_STATUS
618 AcpiUtExecutePowerMethods (
619     ACPI_NAMESPACE_NODE     *DeviceNode,
620     const char              **MethodNames,
621     UINT8                   MethodCount,
622     UINT8                   *OutValues);
623 
624 
625 /*
626  * utids - device ID support
627  */
628 ACPI_STATUS
629 AcpiUtExecute_HID (
630     ACPI_NAMESPACE_NODE     *DeviceNode,
631     ACPI_PNP_DEVICE_ID      **ReturnId);
632 
633 ACPI_STATUS
634 AcpiUtExecute_UID (
635     ACPI_NAMESPACE_NODE     *DeviceNode,
636     ACPI_PNP_DEVICE_ID      **ReturnId);
637 
638 ACPI_STATUS
639 AcpiUtExecute_SUB (
640     ACPI_NAMESPACE_NODE     *DeviceNode,
641     ACPI_PNP_DEVICE_ID      **ReturnId);
642 
643 ACPI_STATUS
644 AcpiUtExecute_CID (
645     ACPI_NAMESPACE_NODE     *DeviceNode,
646     ACPI_PNP_DEVICE_ID_LIST **ReturnCidList);
647 
648 
649 /*
650  * utlock - reader/writer locks
651  */
652 ACPI_STATUS
653 AcpiUtCreateRwLock (
654     ACPI_RW_LOCK            *Lock);
655 
656 void
657 AcpiUtDeleteRwLock (
658     ACPI_RW_LOCK            *Lock);
659 
660 ACPI_STATUS
661 AcpiUtAcquireReadLock (
662     ACPI_RW_LOCK            *Lock);
663 
664 ACPI_STATUS
665 AcpiUtReleaseReadLock (
666     ACPI_RW_LOCK            *Lock);
667 
668 ACPI_STATUS
669 AcpiUtAcquireWriteLock (
670     ACPI_RW_LOCK            *Lock);
671 
672 void
673 AcpiUtReleaseWriteLock (
674     ACPI_RW_LOCK            *Lock);
675 
676 
677 /*
678  * utobject - internal object create/delete/cache routines
679  */
680 ACPI_OPERAND_OBJECT  *
681 AcpiUtCreateInternalObjectDbg (
682     const char              *ModuleName,
683     UINT32                  LineNumber,
684     UINT32                  ComponentId,
685     ACPI_OBJECT_TYPE        Type);
686 
687 void *
688 AcpiUtAllocateObjectDescDbg (
689     const char              *ModuleName,
690     UINT32                  LineNumber,
691     UINT32                  ComponentId);
692 
693 #define AcpiUtCreateInternalObject(t)   AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
694 #define AcpiUtAllocateObjectDesc()      AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
695 
696 void
697 AcpiUtDeleteObjectDesc (
698     ACPI_OPERAND_OBJECT     *Object);
699 
700 BOOLEAN
701 AcpiUtValidInternalObject (
702     void                    *Object);
703 
704 ACPI_OPERAND_OBJECT *
705 AcpiUtCreatePackageObject (
706     UINT32                  Count);
707 
708 ACPI_OPERAND_OBJECT *
709 AcpiUtCreateIntegerObject (
710     UINT64                  Value);
711 
712 ACPI_OPERAND_OBJECT *
713 AcpiUtCreateBufferObject (
714     ACPI_SIZE               BufferSize);
715 
716 ACPI_OPERAND_OBJECT *
717 AcpiUtCreateStringObject (
718     ACPI_SIZE               StringSize);
719 
720 ACPI_STATUS
721 AcpiUtGetObjectSize(
722     ACPI_OPERAND_OBJECT     *Obj,
723     ACPI_SIZE               *ObjLength);
724 
725 
726 /*
727  * utosi - Support for the _OSI predefined control method
728  */
729 ACPI_STATUS
730 AcpiUtInitializeInterfaces (
731     void);
732 
733 ACPI_STATUS
734 AcpiUtInterfaceTerminate (
735     void);
736 
737 ACPI_STATUS
738 AcpiUtInstallInterface (
739     ACPI_STRING             InterfaceName);
740 
741 ACPI_STATUS
742 AcpiUtRemoveInterface (
743     ACPI_STRING             InterfaceName);
744 
745 ACPI_STATUS
746 AcpiUtUpdateInterfaces (
747     UINT8                   Action);
748 
749 ACPI_INTERFACE_INFO *
750 AcpiUtGetInterface (
751     ACPI_STRING             InterfaceName);
752 
753 ACPI_STATUS
754 AcpiUtOsiImplementation (
755     ACPI_WALK_STATE         *WalkState);
756 
757 
758 /*
759  * utpredef - support for predefined names
760  */
761 const ACPI_PREDEFINED_INFO *
762 AcpiUtGetNextPredefinedMethod (
763     const ACPI_PREDEFINED_INFO  *ThisName);
764 
765 const ACPI_PREDEFINED_INFO *
766 AcpiUtMatchPredefinedMethod (
767     char                        *Name);
768 
769 const ACPI_PREDEFINED_INFO *
770 AcpiUtMatchResourceName (
771     char                        *Name);
772 
773 void
774 AcpiUtDisplayPredefinedMethod (
775     char                        *Buffer,
776     const ACPI_PREDEFINED_INFO  *ThisName,
777     BOOLEAN                     MultiLine);
778 
779 void
780 AcpiUtGetExpectedReturnTypes (
781     char                    *Buffer,
782     UINT32                  ExpectedBtypes);
783 
784 UINT32
785 AcpiUtGetResourceBitWidth (
786     char                    *Buffer,
787     UINT16                  Types);
788 
789 
790 /*
791  * utstate - Generic state creation/cache routines
792  */
793 void
794 AcpiUtPushGenericState (
795     ACPI_GENERIC_STATE      **ListHead,
796     ACPI_GENERIC_STATE      *State);
797 
798 ACPI_GENERIC_STATE *
799 AcpiUtPopGenericState (
800     ACPI_GENERIC_STATE      **ListHead);
801 
802 
803 ACPI_GENERIC_STATE *
804 AcpiUtCreateGenericState (
805     void);
806 
807 ACPI_THREAD_STATE *
808 AcpiUtCreateThreadState (
809     void);
810 
811 ACPI_GENERIC_STATE *
812 AcpiUtCreateUpdateState (
813     ACPI_OPERAND_OBJECT     *Object,
814     UINT16                  Action);
815 
816 ACPI_GENERIC_STATE *
817 AcpiUtCreatePkgState (
818     void                    *InternalObject,
819     void                    *ExternalObject,
820     UINT16                  Index);
821 
822 ACPI_STATUS
823 AcpiUtCreateUpdateStateAndPush (
824     ACPI_OPERAND_OBJECT     *Object,
825     UINT16                  Action,
826     ACPI_GENERIC_STATE      **StateList);
827 
828 ACPI_STATUS
829 AcpiUtCreatePkgStateAndPush (
830     void                    *InternalObject,
831     void                    *ExternalObject,
832     UINT16                  Index,
833     ACPI_GENERIC_STATE      **StateList);
834 
835 ACPI_GENERIC_STATE *
836 AcpiUtCreateControlState (
837     void);
838 
839 void
840 AcpiUtDeleteGenericState (
841     ACPI_GENERIC_STATE      *State);
842 
843 
844 /*
845  * utmath
846  */
847 ACPI_STATUS
848 AcpiUtDivide (
849     UINT64                  InDividend,
850     UINT64                  InDivisor,
851     UINT64                  *OutQuotient,
852     UINT64                  *OutRemainder);
853 
854 ACPI_STATUS
855 AcpiUtShortDivide (
856     UINT64                  InDividend,
857     UINT32                  Divisor,
858     UINT64                  *OutQuotient,
859     UINT32                  *OutRemainder);
860 
861 
862 /*
863  * utmisc
864  */
865 const ACPI_EXCEPTION_INFO *
866 AcpiUtValidateException (
867     ACPI_STATUS             Status);
868 
869 BOOLEAN
870 AcpiUtIsPciRootBridge (
871     char                    *Id);
872 
873 BOOLEAN
874 AcpiUtIsAmlTable (
875     ACPI_TABLE_HEADER       *Table);
876 
877 ACPI_STATUS
878 AcpiUtWalkPackageTree (
879     ACPI_OPERAND_OBJECT     *SourceObject,
880     void                    *TargetObject,
881     ACPI_PKG_CALLBACK       WalkCallback,
882     void                    *Context);
883 
884 
885 /* Values for Base above (16=Hex, 10=Decimal) */
886 
887 #define ACPI_ANY_BASE        0
888 
889 UINT32
890 AcpiUtDwordByteSwap (
891     UINT32                  Value);
892 
893 void
894 AcpiUtSetIntegerWidth (
895     UINT8                   Revision);
896 
897 #ifdef ACPI_DEBUG_OUTPUT
898 void
899 AcpiUtDisplayInitPathname (
900     UINT8                   Type,
901     ACPI_NAMESPACE_NODE     *ObjHandle,
902     char                    *Path);
903 #endif
904 
905 
906 /*
907  * utownerid - Support for Table/Method Owner IDs
908  */
909 ACPI_STATUS
910 AcpiUtAllocateOwnerId (
911     ACPI_OWNER_ID           *OwnerId);
912 
913 void
914 AcpiUtReleaseOwnerId (
915     ACPI_OWNER_ID           *OwnerId);
916 
917 
918 /*
919  * utresrc
920  */
921 ACPI_STATUS
922 AcpiUtWalkAmlResources (
923     ACPI_WALK_STATE         *WalkState,
924     UINT8                   *Aml,
925     ACPI_SIZE               AmlLength,
926     ACPI_WALK_AML_CALLBACK  UserFunction,
927     void                    **Context);
928 
929 ACPI_STATUS
930 AcpiUtValidateResource (
931     ACPI_WALK_STATE         *WalkState,
932     void                    *Aml,
933     UINT8                   *ReturnIndex);
934 
935 UINT32
936 AcpiUtGetDescriptorLength (
937     void                    *Aml);
938 
939 UINT16
940 AcpiUtGetResourceLength (
941     void                    *Aml);
942 
943 UINT8
944 AcpiUtGetResourceHeaderLength (
945     void                    *Aml);
946 
947 UINT8
948 AcpiUtGetResourceType (
949     void                    *Aml);
950 
951 ACPI_STATUS
952 AcpiUtGetResourceEndTag (
953     ACPI_OPERAND_OBJECT     *ObjDesc,
954     UINT8                   **EndTag);
955 
956 
957 /*
958  * utstring - String and character utilities
959  */
960 void
961 AcpiUtStrupr (
962     char                    *SrcString);
963 
964 void
965 AcpiUtStrlwr (
966     char                    *SrcString);
967 
968 int
969 AcpiUtStricmp (
970     char                    *String1,
971     char                    *String2);
972 
973 ACPI_STATUS
974 AcpiUtStrtoul64 (
975     char                    *String,
976     UINT32                  Base,
977     UINT64                  *RetInteger);
978 
979 void
980 AcpiUtPrintString (
981     char                    *String,
982     UINT16                  MaxLength);
983 
984 void
985 UtConvertBackslashes (
986     char                    *Pathname);
987 
988 BOOLEAN
989 AcpiUtValidAcpiName (
990     char                    *Name);
991 
992 BOOLEAN
993 AcpiUtValidAcpiChar (
994     char                    Character,
995     UINT32                  Position);
996 
997 void
998 AcpiUtRepairName (
999     char                    *Name);
1000 
1001 
1002 /*
1003  * utmutex - mutex support
1004  */
1005 ACPI_STATUS
1006 AcpiUtMutexInitialize (
1007     void);
1008 
1009 void
1010 AcpiUtMutexTerminate (
1011     void);
1012 
1013 ACPI_STATUS
1014 AcpiUtAcquireMutex (
1015     ACPI_MUTEX_HANDLE       MutexId);
1016 
1017 ACPI_STATUS
1018 AcpiUtReleaseMutex (
1019     ACPI_MUTEX_HANDLE       MutexId);
1020 
1021 
1022 /*
1023  * utalloc - memory allocation and object caching
1024  */
1025 ACPI_STATUS
1026 AcpiUtCreateCaches (
1027     void);
1028 
1029 ACPI_STATUS
1030 AcpiUtDeleteCaches (
1031     void);
1032 
1033 ACPI_STATUS
1034 AcpiUtValidateBuffer (
1035     ACPI_BUFFER             *Buffer);
1036 
1037 ACPI_STATUS
1038 AcpiUtInitializeBuffer (
1039     ACPI_BUFFER             *Buffer,
1040     ACPI_SIZE               RequiredLength);
1041 
1042 void *
1043 AcpiUtAllocate (
1044     ACPI_SIZE               Size,
1045     UINT32                  Component,
1046     const char              *Module,
1047     UINT32                  Line);
1048 
1049 void *
1050 AcpiUtAllocateZeroed (
1051     ACPI_SIZE               Size,
1052     UINT32                  Component,
1053     const char              *Module,
1054     UINT32                  Line);
1055 
1056 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1057 void *
1058 AcpiUtAllocateAndTrack (
1059     ACPI_SIZE               Size,
1060     UINT32                  Component,
1061     const char              *Module,
1062     UINT32                  Line);
1063 
1064 void *
1065 AcpiUtAllocateZeroedAndTrack (
1066     ACPI_SIZE               Size,
1067     UINT32                  Component,
1068     const char              *Module,
1069     UINT32                  Line);
1070 
1071 void
1072 AcpiUtFreeAndTrack (
1073     void                    *Address,
1074     UINT32                  Component,
1075     const char              *Module,
1076     UINT32                  Line);
1077 
1078 void
1079 AcpiUtDumpAllocationInfo (
1080     void);
1081 
1082 void
1083 AcpiUtDumpAllocations (
1084     UINT32                  Component,
1085     const char              *Module);
1086 
1087 ACPI_STATUS
1088 AcpiUtCreateList (
1089     char                    *ListName,
1090     UINT16                  ObjectSize,
1091     ACPI_MEMORY_LIST        **ReturnCache);
1092 
1093 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
1094 
1095 /*
1096  * utaddress - address range check
1097  */
1098 ACPI_STATUS
1099 AcpiUtAddAddressRange (
1100     ACPI_ADR_SPACE_TYPE     SpaceId,
1101     ACPI_PHYSICAL_ADDRESS   Address,
1102     UINT32                  Length,
1103     ACPI_NAMESPACE_NODE     *RegionNode);
1104 
1105 void
1106 AcpiUtRemoveAddressRange (
1107     ACPI_ADR_SPACE_TYPE     SpaceId,
1108     ACPI_NAMESPACE_NODE     *RegionNode);
1109 
1110 UINT32
1111 AcpiUtCheckAddressRange (
1112     ACPI_ADR_SPACE_TYPE     SpaceId,
1113     ACPI_PHYSICAL_ADDRESS   Address,
1114     UINT32                  Length,
1115     BOOLEAN                 Warn);
1116 
1117 void
1118 AcpiUtDeleteAddressLists (
1119     void);
1120 
1121 /*
1122  * utxferror - various error/warning output functions
1123  */
1124 void ACPI_INTERNAL_VAR_XFACE
1125 AcpiUtPredefinedWarning (
1126     const char              *ModuleName,
1127     UINT32                  LineNumber,
1128     char                    *Pathname,
1129     UINT8                   NodeFlags,
1130     const char              *Format,
1131     ...);
1132 
1133 void ACPI_INTERNAL_VAR_XFACE
1134 AcpiUtPredefinedInfo (
1135     const char              *ModuleName,
1136     UINT32                  LineNumber,
1137     char                    *Pathname,
1138     UINT8                   NodeFlags,
1139     const char              *Format,
1140     ...);
1141 
1142 void ACPI_INTERNAL_VAR_XFACE
1143 AcpiUtPredefinedBiosError (
1144     const char              *ModuleName,
1145     UINT32                  LineNumber,
1146     char                    *Pathname,
1147     UINT8                   NodeFlags,
1148     const char              *Format,
1149     ...);
1150 
1151 void
1152 AcpiUtNamespaceError (
1153     const char              *ModuleName,
1154     UINT32                  LineNumber,
1155     const char              *InternalName,
1156     ACPI_STATUS             LookupStatus);
1157 
1158 void
1159 AcpiUtMethodError (
1160     const char              *ModuleName,
1161     UINT32                  LineNumber,
1162     const char              *Message,
1163     ACPI_NAMESPACE_NODE     *Node,
1164     const char              *Path,
1165     ACPI_STATUS             LookupStatus);
1166 
1167 #endif /* _ACUTILS_H */
1168