xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/include/acutils.h (revision 6eafb4b041ad79cb936b2041fdb9c56b1209cc10)
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 - 2014, 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_DEBUG_OUTPUT) || 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 
172 #define ACPI_MSG_REDIRECT_BEGIN \
173     FILE                    *OutputFile = AcpiGbl_OutputFile; \
174     AcpiOsRedirectOutput (stderr);
175 
176 #define ACPI_MSG_REDIRECT_END \
177     AcpiOsRedirectOutput (OutputFile);
178 
179 #else
180 /*
181  * non-iASL case - no redirection, nothing to do
182  */
183 #define ACPI_MSG_REDIRECT_BEGIN
184 #define ACPI_MSG_REDIRECT_END
185 #endif
186 
187 /*
188  * Common error message prefixes
189  */
190 #define ACPI_MSG_ERROR          "ACPI Error: "
191 #define ACPI_MSG_EXCEPTION      "ACPI Exception: "
192 #define ACPI_MSG_WARNING        "ACPI Warning: "
193 #define ACPI_MSG_INFO           "ACPI: "
194 
195 #define ACPI_MSG_BIOS_ERROR     "ACPI BIOS Error (bug): "
196 #define ACPI_MSG_BIOS_WARNING   "ACPI BIOS Warning (bug): "
197 
198 /*
199  * Common message suffix
200  */
201 #define ACPI_MSG_SUFFIX \
202     AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber)
203 
204 
205 /* Types for Resource descriptor entries */
206 
207 #define ACPI_INVALID_RESOURCE           0
208 #define ACPI_FIXED_LENGTH               1
209 #define ACPI_VARIABLE_LENGTH            2
210 #define ACPI_SMALL_VARIABLE_LENGTH      3
211 
212 typedef
213 ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
214     UINT8                   *Aml,
215     UINT32                  Length,
216     UINT32                  Offset,
217     UINT8                   ResourceIndex,
218     void                    **Context);
219 
220 typedef
221 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
222     UINT8                   ObjectType,
223     ACPI_OPERAND_OBJECT     *SourceObject,
224     ACPI_GENERIC_STATE      *State,
225     void                    *Context);
226 
227 typedef struct acpi_pkg_info
228 {
229     UINT8                   *FreeSpace;
230     ACPI_SIZE               Length;
231     UINT32                  ObjectSpace;
232     UINT32                  NumPackages;
233 
234 } ACPI_PKG_INFO;
235 
236 /* Object reference counts */
237 
238 #define REF_INCREMENT       (UINT16) 0
239 #define REF_DECREMENT       (UINT16) 1
240 
241 /* AcpiUtDumpBuffer */
242 
243 #define DB_BYTE_DISPLAY     1
244 #define DB_WORD_DISPLAY     2
245 #define DB_DWORD_DISPLAY    4
246 #define DB_QWORD_DISPLAY    8
247 
248 /*
249  * utglobal - Global data structures and procedures
250  */
251 ACPI_STATUS
252 AcpiUtInitGlobals (
253     void);
254 
255 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
256 
257 char *
258 AcpiUtGetMutexName (
259     UINT32                  MutexId);
260 
261 const char *
262 AcpiUtGetNotifyName (
263     UINT32                  NotifyValue,
264     ACPI_OBJECT_TYPE        Type);
265 #endif
266 
267 char *
268 AcpiUtGetTypeName (
269     ACPI_OBJECT_TYPE        Type);
270 
271 char *
272 AcpiUtGetNodeName (
273     void                    *Object);
274 
275 char *
276 AcpiUtGetDescriptorName (
277     void                    *Object);
278 
279 const char *
280 AcpiUtGetReferenceName (
281     ACPI_OPERAND_OBJECT     *Object);
282 
283 char *
284 AcpiUtGetObjectTypeName (
285     ACPI_OPERAND_OBJECT     *ObjDesc);
286 
287 char *
288 AcpiUtGetRegionName (
289     UINT8                   SpaceId);
290 
291 char *
292 AcpiUtGetEventName (
293     UINT32                  EventId);
294 
295 char
296 AcpiUtHexToAsciiChar (
297     UINT64                  Integer,
298     UINT32                  Position);
299 
300 UINT8
301 AcpiUtAsciiCharToHex (
302     int                     HexChar);
303 
304 BOOLEAN
305 AcpiUtValidObjectType (
306     ACPI_OBJECT_TYPE        Type);
307 
308 
309 /*
310  * utinit - miscellaneous initialization and shutdown
311  */
312 ACPI_STATUS
313 AcpiUtHardwareInitialize (
314     void);
315 
316 void
317 AcpiUtSubsystemShutdown (
318     void);
319 
320 
321 /*
322  * utclib - Local implementations of C library functions
323  */
324 #ifndef ACPI_USE_SYSTEM_CLIBRARY
325 
326 ACPI_SIZE
327 AcpiUtStrlen (
328     const char              *String);
329 
330 char *
331 AcpiUtStrchr (
332     const char              *String,
333     int                     ch);
334 
335 char *
336 AcpiUtStrcpy (
337     char                    *DstString,
338     const char              *SrcString);
339 
340 char *
341 AcpiUtStrncpy (
342     char                    *DstString,
343     const char              *SrcString,
344     ACPI_SIZE               Count);
345 
346 int
347 AcpiUtMemcmp (
348     const char              *Buffer1,
349     const char              *Buffer2,
350     ACPI_SIZE               Count);
351 
352 int
353 AcpiUtStrncmp (
354     const char              *String1,
355     const char              *String2,
356     ACPI_SIZE               Count);
357 
358 int
359 AcpiUtStrcmp (
360     const char              *String1,
361     const char              *String2);
362 
363 char *
364 AcpiUtStrcat (
365     char                    *DstString,
366     const char              *SrcString);
367 
368 char *
369 AcpiUtStrncat (
370     char                    *DstString,
371     const char              *SrcString,
372     ACPI_SIZE               Count);
373 
374 UINT32
375 AcpiUtStrtoul (
376     const char              *String,
377     char                    **Terminator,
378     UINT32                  Base);
379 
380 char *
381 AcpiUtStrstr (
382     char                    *String1,
383     char                    *String2);
384 
385 void *
386 AcpiUtMemcpy (
387     void                    *Dest,
388     const void              *Src,
389     ACPI_SIZE               Count);
390 
391 void *
392 AcpiUtMemset (
393     void                    *Dest,
394     UINT8                   Value,
395     ACPI_SIZE               Count);
396 
397 int
398 AcpiUtToUpper (
399     int                     c);
400 
401 int
402 AcpiUtToLower (
403     int                     c);
404 
405 extern const UINT8 _acpi_ctype[];
406 
407 #define _ACPI_XA     0x00    /* extra alphabetic - not supported */
408 #define _ACPI_XS     0x40    /* extra space */
409 #define _ACPI_BB     0x00    /* BEL, BS, etc. - not supported */
410 #define _ACPI_CN     0x20    /* CR, FF, HT, NL, VT */
411 #define _ACPI_DI     0x04    /* '0'-'9' */
412 #define _ACPI_LO     0x02    /* 'a'-'z' */
413 #define _ACPI_PU     0x10    /* punctuation */
414 #define _ACPI_SP     0x08    /* space */
415 #define _ACPI_UP     0x01    /* 'A'-'Z' */
416 #define _ACPI_XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
417 
418 #define ACPI_IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
419 #define ACPI_IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
420 #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
421 #define ACPI_IS_UPPER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
422 #define ACPI_IS_LOWER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
423 #define ACPI_IS_PRINT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_XS | _ACPI_PU))
424 #define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
425 
426 #endif /* !ACPI_USE_SYSTEM_CLIBRARY */
427 
428 #define ACPI_IS_ASCII(c)  ((c) < 0x80)
429 
430 
431 /*
432  * utcopy - Object construction and conversion interfaces
433  */
434 ACPI_STATUS
435 AcpiUtBuildSimpleObject(
436     ACPI_OPERAND_OBJECT     *Obj,
437     ACPI_OBJECT             *UserObj,
438     UINT8                   *DataSpace,
439     UINT32                  *BufferSpaceUsed);
440 
441 ACPI_STATUS
442 AcpiUtBuildPackageObject (
443     ACPI_OPERAND_OBJECT     *Obj,
444     UINT8                   *Buffer,
445     UINT32                  *SpaceUsed);
446 
447 ACPI_STATUS
448 AcpiUtCopyIobjectToEobject (
449     ACPI_OPERAND_OBJECT     *Obj,
450     ACPI_BUFFER             *RetBuffer);
451 
452 ACPI_STATUS
453 AcpiUtCopyEobjectToIobject (
454     ACPI_OBJECT             *Obj,
455     ACPI_OPERAND_OBJECT     **InternalObj);
456 
457 ACPI_STATUS
458 AcpiUtCopyISimpleToIsimple (
459     ACPI_OPERAND_OBJECT     *SourceObj,
460     ACPI_OPERAND_OBJECT     *DestObj);
461 
462 ACPI_STATUS
463 AcpiUtCopyIobjectToIobject (
464     ACPI_OPERAND_OBJECT     *SourceDesc,
465     ACPI_OPERAND_OBJECT     **DestDesc,
466     ACPI_WALK_STATE         *WalkState);
467 
468 
469 /*
470  * utcreate - Object creation
471  */
472 ACPI_STATUS
473 AcpiUtUpdateObjectReference (
474     ACPI_OPERAND_OBJECT     *Object,
475     UINT16                  Action);
476 
477 
478 /*
479  * utdebug - Debug interfaces
480  */
481 void
482 AcpiUtInitStackPtrTrace (
483     void);
484 
485 void
486 AcpiUtTrackStackPtr (
487     void);
488 
489 void
490 AcpiUtTrace (
491     UINT32                  LineNumber,
492     const char              *FunctionName,
493     const char              *ModuleName,
494     UINT32                  ComponentId);
495 
496 void
497 AcpiUtTracePtr (
498     UINT32                  LineNumber,
499     const char              *FunctionName,
500     const char              *ModuleName,
501     UINT32                  ComponentId,
502     void                    *Pointer);
503 
504 void
505 AcpiUtTraceU32 (
506     UINT32                  LineNumber,
507     const char              *FunctionName,
508     const char              *ModuleName,
509     UINT32                  ComponentId,
510     UINT32                  Integer);
511 
512 void
513 AcpiUtTraceStr (
514     UINT32                  LineNumber,
515     const char              *FunctionName,
516     const char              *ModuleName,
517     UINT32                  ComponentId,
518     char                    *String);
519 
520 void
521 AcpiUtExit (
522     UINT32                  LineNumber,
523     const char              *FunctionName,
524     const char              *ModuleName,
525     UINT32                  ComponentId);
526 
527 void
528 AcpiUtStatusExit (
529     UINT32                  LineNumber,
530     const char              *FunctionName,
531     const char              *ModuleName,
532     UINT32                  ComponentId,
533     ACPI_STATUS             Status);
534 
535 void
536 AcpiUtValueExit (
537     UINT32                  LineNumber,
538     const char              *FunctionName,
539     const char              *ModuleName,
540     UINT32                  ComponentId,
541     UINT64                  Value);
542 
543 void
544 AcpiUtPtrExit (
545     UINT32                  LineNumber,
546     const char              *FunctionName,
547     const char              *ModuleName,
548     UINT32                  ComponentId,
549     UINT8                   *Ptr);
550 
551 void
552 AcpiUtDebugDumpBuffer (
553     UINT8                   *Buffer,
554     UINT32                  Count,
555     UINT32                  Display,
556     UINT32                  ComponentId);
557 
558 void
559 AcpiUtDumpBuffer (
560     UINT8                   *Buffer,
561     UINT32                  Count,
562     UINT32                  Display,
563     UINT32                  Offset);
564 
565 #ifdef ACPI_APPLICATION
566 void
567 AcpiUtDumpBufferToFile (
568     ACPI_FILE               File,
569     UINT8                   *Buffer,
570     UINT32                  Count,
571     UINT32                  Display,
572     UINT32                  BaseOffset);
573 #endif
574 
575 void
576 AcpiUtReportError (
577     char                    *ModuleName,
578     UINT32                  LineNumber);
579 
580 void
581 AcpiUtReportInfo (
582     char                    *ModuleName,
583     UINT32                  LineNumber);
584 
585 void
586 AcpiUtReportWarning (
587     char                    *ModuleName,
588     UINT32                  LineNumber);
589 
590 /*
591  * utdelete - Object deletion and reference counts
592  */
593 void
594 AcpiUtAddReference (
595     ACPI_OPERAND_OBJECT     *Object);
596 
597 void
598 AcpiUtRemoveReference (
599     ACPI_OPERAND_OBJECT     *Object);
600 
601 void
602 AcpiUtDeleteInternalPackageObject (
603     ACPI_OPERAND_OBJECT     *Object);
604 
605 void
606 AcpiUtDeleteInternalSimpleObject (
607     ACPI_OPERAND_OBJECT     *Object);
608 
609 void
610 AcpiUtDeleteInternalObjectList (
611     ACPI_OPERAND_OBJECT     **ObjList);
612 
613 
614 /*
615  * uteval - object evaluation
616  */
617 ACPI_STATUS
618 AcpiUtEvaluateObject (
619     ACPI_NAMESPACE_NODE     *PrefixNode,
620     char                    *Path,
621     UINT32                  ExpectedReturnBtypes,
622     ACPI_OPERAND_OBJECT     **ReturnDesc);
623 
624 ACPI_STATUS
625 AcpiUtEvaluateNumericObject (
626     char                    *ObjectName,
627     ACPI_NAMESPACE_NODE     *DeviceNode,
628     UINT64                  *Value);
629 
630 ACPI_STATUS
631 AcpiUtExecute_STA (
632     ACPI_NAMESPACE_NODE     *DeviceNode,
633     UINT32                  *StatusFlags);
634 
635 ACPI_STATUS
636 AcpiUtExecutePowerMethods (
637     ACPI_NAMESPACE_NODE     *DeviceNode,
638     const char              **MethodNames,
639     UINT8                   MethodCount,
640     UINT8                   *OutValues);
641 
642 
643 /*
644  * utfileio - file operations
645  */
646 #ifdef ACPI_APPLICATION
647 ACPI_STATUS
648 AcpiUtReadTableFromFile (
649     char                    *Filename,
650     ACPI_TABLE_HEADER       **Table);
651 #endif
652 
653 
654 /*
655  * utids - device ID support
656  */
657 ACPI_STATUS
658 AcpiUtExecute_HID (
659     ACPI_NAMESPACE_NODE     *DeviceNode,
660     ACPI_PNP_DEVICE_ID      **ReturnId);
661 
662 ACPI_STATUS
663 AcpiUtExecute_UID (
664     ACPI_NAMESPACE_NODE     *DeviceNode,
665     ACPI_PNP_DEVICE_ID      **ReturnId);
666 
667 ACPI_STATUS
668 AcpiUtExecute_SUB (
669     ACPI_NAMESPACE_NODE     *DeviceNode,
670     ACPI_PNP_DEVICE_ID      **ReturnId);
671 
672 ACPI_STATUS
673 AcpiUtExecute_CID (
674     ACPI_NAMESPACE_NODE     *DeviceNode,
675     ACPI_PNP_DEVICE_ID_LIST **ReturnCidList);
676 
677 
678 /*
679  * utlock - reader/writer locks
680  */
681 ACPI_STATUS
682 AcpiUtCreateRwLock (
683     ACPI_RW_LOCK            *Lock);
684 
685 void
686 AcpiUtDeleteRwLock (
687     ACPI_RW_LOCK            *Lock);
688 
689 ACPI_STATUS
690 AcpiUtAcquireReadLock (
691     ACPI_RW_LOCK            *Lock);
692 
693 ACPI_STATUS
694 AcpiUtReleaseReadLock (
695     ACPI_RW_LOCK            *Lock);
696 
697 ACPI_STATUS
698 AcpiUtAcquireWriteLock (
699     ACPI_RW_LOCK            *Lock);
700 
701 void
702 AcpiUtReleaseWriteLock (
703     ACPI_RW_LOCK            *Lock);
704 
705 
706 /*
707  * utobject - internal object create/delete/cache routines
708  */
709 ACPI_OPERAND_OBJECT  *
710 AcpiUtCreateInternalObjectDbg (
711     const char              *ModuleName,
712     UINT32                  LineNumber,
713     UINT32                  ComponentId,
714     ACPI_OBJECT_TYPE        Type);
715 
716 void *
717 AcpiUtAllocateObjectDescDbg (
718     const char              *ModuleName,
719     UINT32                  LineNumber,
720     UINT32                  ComponentId);
721 
722 #define AcpiUtCreateInternalObject(t)   AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
723 #define AcpiUtAllocateObjectDesc()      AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
724 
725 void
726 AcpiUtDeleteObjectDesc (
727     ACPI_OPERAND_OBJECT     *Object);
728 
729 BOOLEAN
730 AcpiUtValidInternalObject (
731     void                    *Object);
732 
733 ACPI_OPERAND_OBJECT *
734 AcpiUtCreatePackageObject (
735     UINT32                  Count);
736 
737 ACPI_OPERAND_OBJECT *
738 AcpiUtCreateIntegerObject (
739     UINT64                  Value);
740 
741 ACPI_OPERAND_OBJECT *
742 AcpiUtCreateBufferObject (
743     ACPI_SIZE               BufferSize);
744 
745 ACPI_OPERAND_OBJECT *
746 AcpiUtCreateStringObject (
747     ACPI_SIZE               StringSize);
748 
749 ACPI_STATUS
750 AcpiUtGetObjectSize(
751     ACPI_OPERAND_OBJECT     *Obj,
752     ACPI_SIZE               *ObjLength);
753 
754 
755 /*
756  * utosi - Support for the _OSI predefined control method
757  */
758 ACPI_STATUS
759 AcpiUtInitializeInterfaces (
760     void);
761 
762 ACPI_STATUS
763 AcpiUtInterfaceTerminate (
764     void);
765 
766 ACPI_STATUS
767 AcpiUtInstallInterface (
768     ACPI_STRING             InterfaceName);
769 
770 ACPI_STATUS
771 AcpiUtRemoveInterface (
772     ACPI_STRING             InterfaceName);
773 
774 ACPI_STATUS
775 AcpiUtUpdateInterfaces (
776     UINT8                   Action);
777 
778 ACPI_INTERFACE_INFO *
779 AcpiUtGetInterface (
780     ACPI_STRING             InterfaceName);
781 
782 ACPI_STATUS
783 AcpiUtOsiImplementation (
784     ACPI_WALK_STATE         *WalkState);
785 
786 
787 /*
788  * utpredef - support for predefined names
789  */
790 const ACPI_PREDEFINED_INFO *
791 AcpiUtGetNextPredefinedMethod (
792     const ACPI_PREDEFINED_INFO  *ThisName);
793 
794 const ACPI_PREDEFINED_INFO *
795 AcpiUtMatchPredefinedMethod (
796     char                        *Name);
797 
798 const ACPI_PREDEFINED_INFO *
799 AcpiUtMatchResourceName (
800     char                        *Name);
801 
802 void
803 AcpiUtDisplayPredefinedMethod (
804     char                        *Buffer,
805     const ACPI_PREDEFINED_INFO  *ThisName,
806     BOOLEAN                     MultiLine);
807 
808 void
809 AcpiUtGetExpectedReturnTypes (
810     char                    *Buffer,
811     UINT32                  ExpectedBtypes);
812 
813 UINT32
814 AcpiUtGetResourceBitWidth (
815     char                    *Buffer,
816     UINT16                  Types);
817 
818 
819 /*
820  * utstate - Generic state creation/cache routines
821  */
822 void
823 AcpiUtPushGenericState (
824     ACPI_GENERIC_STATE      **ListHead,
825     ACPI_GENERIC_STATE      *State);
826 
827 ACPI_GENERIC_STATE *
828 AcpiUtPopGenericState (
829     ACPI_GENERIC_STATE      **ListHead);
830 
831 
832 ACPI_GENERIC_STATE *
833 AcpiUtCreateGenericState (
834     void);
835 
836 ACPI_THREAD_STATE *
837 AcpiUtCreateThreadState (
838     void);
839 
840 ACPI_GENERIC_STATE *
841 AcpiUtCreateUpdateState (
842     ACPI_OPERAND_OBJECT     *Object,
843     UINT16                  Action);
844 
845 ACPI_GENERIC_STATE *
846 AcpiUtCreatePkgState (
847     void                    *InternalObject,
848     void                    *ExternalObject,
849     UINT16                  Index);
850 
851 ACPI_STATUS
852 AcpiUtCreateUpdateStateAndPush (
853     ACPI_OPERAND_OBJECT     *Object,
854     UINT16                  Action,
855     ACPI_GENERIC_STATE      **StateList);
856 
857 ACPI_STATUS
858 AcpiUtCreatePkgStateAndPush (
859     void                    *InternalObject,
860     void                    *ExternalObject,
861     UINT16                  Index,
862     ACPI_GENERIC_STATE      **StateList);
863 
864 ACPI_GENERIC_STATE *
865 AcpiUtCreateControlState (
866     void);
867 
868 void
869 AcpiUtDeleteGenericState (
870     ACPI_GENERIC_STATE      *State);
871 
872 
873 /*
874  * utmath
875  */
876 ACPI_STATUS
877 AcpiUtDivide (
878     UINT64                  InDividend,
879     UINT64                  InDivisor,
880     UINT64                  *OutQuotient,
881     UINT64                  *OutRemainder);
882 
883 ACPI_STATUS
884 AcpiUtShortDivide (
885     UINT64                  InDividend,
886     UINT32                  Divisor,
887     UINT64                  *OutQuotient,
888     UINT32                  *OutRemainder);
889 
890 
891 /*
892  * utmisc
893  */
894 const ACPI_EXCEPTION_INFO *
895 AcpiUtValidateException (
896     ACPI_STATUS             Status);
897 
898 BOOLEAN
899 AcpiUtIsPciRootBridge (
900     char                    *Id);
901 
902 BOOLEAN
903 AcpiUtIsAmlTable (
904     ACPI_TABLE_HEADER       *Table);
905 
906 ACPI_STATUS
907 AcpiUtWalkPackageTree (
908     ACPI_OPERAND_OBJECT     *SourceObject,
909     void                    *TargetObject,
910     ACPI_PKG_CALLBACK       WalkCallback,
911     void                    *Context);
912 
913 
914 /* Values for Base above (16=Hex, 10=Decimal) */
915 
916 #define ACPI_ANY_BASE        0
917 
918 UINT32
919 AcpiUtDwordByteSwap (
920     UINT32                  Value);
921 
922 void
923 AcpiUtSetIntegerWidth (
924     UINT8                   Revision);
925 
926 #ifdef ACPI_DEBUG_OUTPUT
927 void
928 AcpiUtDisplayInitPathname (
929     UINT8                   Type,
930     ACPI_NAMESPACE_NODE     *ObjHandle,
931     char                    *Path);
932 #endif
933 
934 
935 /*
936  * utownerid - Support for Table/Method Owner IDs
937  */
938 ACPI_STATUS
939 AcpiUtAllocateOwnerId (
940     ACPI_OWNER_ID           *OwnerId);
941 
942 void
943 AcpiUtReleaseOwnerId (
944     ACPI_OWNER_ID           *OwnerId);
945 
946 
947 /*
948  * utresrc
949  */
950 ACPI_STATUS
951 AcpiUtWalkAmlResources (
952     ACPI_WALK_STATE         *WalkState,
953     UINT8                   *Aml,
954     ACPI_SIZE               AmlLength,
955     ACPI_WALK_AML_CALLBACK  UserFunction,
956     void                    **Context);
957 
958 ACPI_STATUS
959 AcpiUtValidateResource (
960     ACPI_WALK_STATE         *WalkState,
961     void                    *Aml,
962     UINT8                   *ReturnIndex);
963 
964 UINT32
965 AcpiUtGetDescriptorLength (
966     void                    *Aml);
967 
968 UINT16
969 AcpiUtGetResourceLength (
970     void                    *Aml);
971 
972 UINT8
973 AcpiUtGetResourceHeaderLength (
974     void                    *Aml);
975 
976 UINT8
977 AcpiUtGetResourceType (
978     void                    *Aml);
979 
980 ACPI_STATUS
981 AcpiUtGetResourceEndTag (
982     ACPI_OPERAND_OBJECT     *ObjDesc,
983     UINT8                   **EndTag);
984 
985 
986 /*
987  * utstring - String and character utilities
988  */
989 void
990 AcpiUtStrupr (
991     char                    *SrcString);
992 
993 void
994 AcpiUtStrlwr (
995     char                    *SrcString);
996 
997 int
998 AcpiUtStricmp (
999     char                    *String1,
1000     char                    *String2);
1001 
1002 ACPI_STATUS
1003 AcpiUtStrtoul64 (
1004     char                    *String,
1005     UINT32                  Base,
1006     UINT64                  *RetInteger);
1007 
1008 void
1009 AcpiUtPrintString (
1010     char                    *String,
1011     UINT16                  MaxLength);
1012 
1013 void
1014 UtConvertBackslashes (
1015     char                    *Pathname);
1016 
1017 BOOLEAN
1018 AcpiUtValidAcpiName (
1019     char                    *Name);
1020 
1021 BOOLEAN
1022 AcpiUtValidAcpiChar (
1023     char                    Character,
1024     UINT32                  Position);
1025 
1026 void
1027 AcpiUtRepairName (
1028     char                    *Name);
1029 
1030 #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
1031 BOOLEAN
1032 AcpiUtSafeStrcpy (
1033     char                    *Dest,
1034     ACPI_SIZE               DestSize,
1035     char                    *Source);
1036 
1037 BOOLEAN
1038 AcpiUtSafeStrcat (
1039     char                    *Dest,
1040     ACPI_SIZE               DestSize,
1041     char                    *Source);
1042 
1043 BOOLEAN
1044 AcpiUtSafeStrncat (
1045     char                    *Dest,
1046     ACPI_SIZE               DestSize,
1047     char                    *Source,
1048     ACPI_SIZE               MaxTransferLength);
1049 #endif
1050 
1051 
1052 /*
1053  * utmutex - mutex support
1054  */
1055 ACPI_STATUS
1056 AcpiUtMutexInitialize (
1057     void);
1058 
1059 void
1060 AcpiUtMutexTerminate (
1061     void);
1062 
1063 ACPI_STATUS
1064 AcpiUtAcquireMutex (
1065     ACPI_MUTEX_HANDLE       MutexId);
1066 
1067 ACPI_STATUS
1068 AcpiUtReleaseMutex (
1069     ACPI_MUTEX_HANDLE       MutexId);
1070 
1071 
1072 /*
1073  * utalloc - memory allocation and object caching
1074  */
1075 ACPI_STATUS
1076 AcpiUtCreateCaches (
1077     void);
1078 
1079 ACPI_STATUS
1080 AcpiUtDeleteCaches (
1081     void);
1082 
1083 ACPI_STATUS
1084 AcpiUtValidateBuffer (
1085     ACPI_BUFFER             *Buffer);
1086 
1087 ACPI_STATUS
1088 AcpiUtInitializeBuffer (
1089     ACPI_BUFFER             *Buffer,
1090     ACPI_SIZE               RequiredLength);
1091 
1092 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1093 void *
1094 AcpiUtAllocateAndTrack (
1095     ACPI_SIZE               Size,
1096     UINT32                  Component,
1097     const char              *Module,
1098     UINT32                  Line);
1099 
1100 void *
1101 AcpiUtAllocateZeroedAndTrack (
1102     ACPI_SIZE               Size,
1103     UINT32                  Component,
1104     const char              *Module,
1105     UINT32                  Line);
1106 
1107 void
1108 AcpiUtFreeAndTrack (
1109     void                    *Address,
1110     UINT32                  Component,
1111     const char              *Module,
1112     UINT32                  Line);
1113 
1114 void
1115 AcpiUtDumpAllocationInfo (
1116     void);
1117 
1118 void
1119 AcpiUtDumpAllocations (
1120     UINT32                  Component,
1121     const char              *Module);
1122 
1123 ACPI_STATUS
1124 AcpiUtCreateList (
1125     char                    *ListName,
1126     UINT16                  ObjectSize,
1127     ACPI_MEMORY_LIST        **ReturnCache);
1128 
1129 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
1130 
1131 /*
1132  * utaddress - address range check
1133  */
1134 ACPI_STATUS
1135 AcpiUtAddAddressRange (
1136     ACPI_ADR_SPACE_TYPE     SpaceId,
1137     ACPI_PHYSICAL_ADDRESS   Address,
1138     UINT32                  Length,
1139     ACPI_NAMESPACE_NODE     *RegionNode);
1140 
1141 void
1142 AcpiUtRemoveAddressRange (
1143     ACPI_ADR_SPACE_TYPE     SpaceId,
1144     ACPI_NAMESPACE_NODE     *RegionNode);
1145 
1146 UINT32
1147 AcpiUtCheckAddressRange (
1148     ACPI_ADR_SPACE_TYPE     SpaceId,
1149     ACPI_PHYSICAL_ADDRESS   Address,
1150     UINT32                  Length,
1151     BOOLEAN                 Warn);
1152 
1153 void
1154 AcpiUtDeleteAddressLists (
1155     void);
1156 
1157 /*
1158  * utxferror - various error/warning output functions
1159  */
1160 void ACPI_INTERNAL_VAR_XFACE
1161 AcpiUtPredefinedWarning (
1162     const char              *ModuleName,
1163     UINT32                  LineNumber,
1164     char                    *Pathname,
1165     UINT8                   NodeFlags,
1166     const char              *Format,
1167     ...);
1168 
1169 void ACPI_INTERNAL_VAR_XFACE
1170 AcpiUtPredefinedInfo (
1171     const char              *ModuleName,
1172     UINT32                  LineNumber,
1173     char                    *Pathname,
1174     UINT8                   NodeFlags,
1175     const char              *Format,
1176     ...);
1177 
1178 void ACPI_INTERNAL_VAR_XFACE
1179 AcpiUtPredefinedBiosError (
1180     const char              *ModuleName,
1181     UINT32                  LineNumber,
1182     char                    *Pathname,
1183     UINT8                   NodeFlags,
1184     const char              *Format,
1185     ...);
1186 
1187 void
1188 AcpiUtNamespaceError (
1189     const char              *ModuleName,
1190     UINT32                  LineNumber,
1191     const char              *InternalName,
1192     ACPI_STATUS             LookupStatus);
1193 
1194 void
1195 AcpiUtMethodError (
1196     const char              *ModuleName,
1197     UINT32                  LineNumber,
1198     const char              *Message,
1199     ACPI_NAMESPACE_NODE     *Node,
1200     const char              *Path,
1201     ACPI_STATUS             LookupStatus);
1202 
1203 /*
1204  * Utility functions for ACPI names and IDs
1205  */
1206 const AH_PREDEFINED_NAME *
1207 AcpiAhMatchPredefinedName (
1208     char                    *Nameseg);
1209 
1210 const AH_DEVICE_ID *
1211 AcpiAhMatchHardwareId (
1212     char                    *Hid);
1213 
1214 const char *
1215 AcpiAhMatchUuid (
1216     UINT8                   *Data);
1217 
1218 /*
1219  * utprint - printf/vprintf output functions
1220  */
1221 const char *
1222 AcpiUtScanNumber (
1223     const char              *String,
1224     UINT64                  *NumberPtr);
1225 
1226 const char *
1227 AcpiUtPrintNumber (
1228     char                    *String,
1229     UINT64                  Number);
1230 
1231 int
1232 AcpiUtVsnprintf (
1233     char                    *String,
1234     ACPI_SIZE               Size,
1235     const char              *Format,
1236     va_list                 Args);
1237 
1238 int
1239 AcpiUtSnprintf (
1240     char                    *String,
1241     ACPI_SIZE               Size,
1242     const char              *Format,
1243     ...);
1244 
1245 #ifdef ACPI_APPLICATION
1246 int
1247 AcpiUtFileVprintf (
1248     ACPI_FILE               File,
1249     const char              *Format,
1250     va_list                 Args);
1251 
1252 int
1253 AcpiUtFilePrintf (
1254     ACPI_FILE               File,
1255     const char              *Format,
1256     ...);
1257 #endif
1258 
1259 /*
1260  * utuuid -- UUID support functions
1261  */
1262 void
1263 AcpiUtConvertStringToUuid (
1264     char                    *InString,
1265     UINT8                   *UuidBuffer);
1266 
1267 #endif /* _ACUTILS_H */
1268