xref: /minix/minix/drivers/power/acpi/include/acutils.h (revision 83133719)
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 - 2010, 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 
122 /* Strings used by the disassembler and debugger resource dump routines */
123 
124 #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
125 
126 extern const char                       *AcpiGbl_BmDecode[];
127 extern const char                       *AcpiGbl_ConfigDecode[];
128 extern const char                       *AcpiGbl_ConsumeDecode[];
129 extern const char                       *AcpiGbl_DecDecode[];
130 extern const char                       *AcpiGbl_HeDecode[];
131 extern const char                       *AcpiGbl_IoDecode[];
132 extern const char                       *AcpiGbl_LlDecode[];
133 extern const char                       *AcpiGbl_MaxDecode[];
134 extern const char                       *AcpiGbl_MemDecode[];
135 extern const char                       *AcpiGbl_MinDecode[];
136 extern const char                       *AcpiGbl_MtpDecode[];
137 extern const char                       *AcpiGbl_RngDecode[];
138 extern const char                       *AcpiGbl_RwDecode[];
139 extern const char                       *AcpiGbl_ShrDecode[];
140 extern const char                       *AcpiGbl_SizDecode[];
141 extern const char                       *AcpiGbl_TrsDecode[];
142 extern const char                       *AcpiGbl_TtpDecode[];
143 extern const char                       *AcpiGbl_TypDecode[];
144 #endif
145 
146 /* Types for Resource descriptor entries */
147 
148 #define ACPI_INVALID_RESOURCE           0
149 #define ACPI_FIXED_LENGTH               1
150 #define ACPI_VARIABLE_LENGTH            2
151 #define ACPI_SMALL_VARIABLE_LENGTH      3
152 
153 typedef
154 ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
155     UINT8                   *Aml,
156     UINT32                  Length,
157     UINT32                  Offset,
158     UINT8                   ResourceIndex,
159     void                    *Context);
160 
161 typedef
162 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
163     UINT8                   ObjectType,
164     ACPI_OPERAND_OBJECT     *SourceObject,
165     ACPI_GENERIC_STATE      *State,
166     void                    *Context);
167 
168 typedef struct acpi_pkg_info
169 {
170     UINT8                   *FreeSpace;
171     ACPI_SIZE               Length;
172     UINT32                  ObjectSpace;
173     UINT32                  NumPackages;
174 
175 } ACPI_PKG_INFO;
176 
177 #define REF_INCREMENT       (UINT16) 0
178 #define REF_DECREMENT       (UINT16) 1
179 #define REF_FORCE_DELETE    (UINT16) 2
180 
181 /* AcpiUtDumpBuffer */
182 
183 #define DB_BYTE_DISPLAY     1
184 #define DB_WORD_DISPLAY     2
185 #define DB_DWORD_DISPLAY    4
186 #define DB_QWORD_DISPLAY    8
187 
188 
189 /*
190  * utglobal - Global data structures and procedures
191  */
192 ACPI_STATUS
193 AcpiUtInitGlobals (
194     void);
195 
196 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
197 
198 char *
199 AcpiUtGetMutexName (
200     UINT32                  MutexId);
201 
202 const char *
203 AcpiUtGetNotifyName (
204     UINT32                  NotifyValue);
205 
206 #endif
207 
208 char *
209 AcpiUtGetTypeName (
210     ACPI_OBJECT_TYPE        Type);
211 
212 char *
213 AcpiUtGetNodeName (
214     void                    *Object);
215 
216 char *
217 AcpiUtGetDescriptorName (
218     void                    *Object);
219 
220 const char *
221 AcpiUtGetReferenceName (
222     ACPI_OPERAND_OBJECT     *Object);
223 
224 char *
225 AcpiUtGetObjectTypeName (
226     ACPI_OPERAND_OBJECT     *ObjDesc);
227 
228 char *
229 AcpiUtGetRegionName (
230     UINT8                   SpaceId);
231 
232 char *
233 AcpiUtGetEventName (
234     UINT32                  EventId);
235 
236 char
237 AcpiUtHexToAsciiChar (
238     UINT64                  Integer,
239     UINT32                  Position);
240 
241 BOOLEAN
242 AcpiUtValidObjectType (
243     ACPI_OBJECT_TYPE        Type);
244 
245 
246 /*
247  * utinit - miscellaneous initialization and shutdown
248  */
249 ACPI_STATUS
250 AcpiUtHardwareInitialize (
251     void);
252 
253 void
254 AcpiUtSubsystemShutdown (
255     void);
256 
257 
258 /*
259  * utclib - Local implementations of C library functions
260  */
261 #ifndef ACPI_USE_SYSTEM_CLIBRARY
262 
263 ACPI_SIZE
264 AcpiUtStrlen (
265     const char              *String);
266 
267 char *
268 AcpiUtStrcpy (
269     char                    *DstString,
270     const char              *SrcString);
271 
272 char *
273 AcpiUtStrncpy (
274     char                    *DstString,
275     const char              *SrcString,
276     ACPI_SIZE               Count);
277 
278 int
279 AcpiUtMemcmp (
280     const char              *Buffer1,
281     const char              *Buffer2,
282     ACPI_SIZE               Count);
283 
284 int
285 AcpiUtStrncmp (
286     const char              *String1,
287     const char              *String2,
288     ACPI_SIZE               Count);
289 
290 int
291 AcpiUtStrcmp (
292     const char              *String1,
293     const char              *String2);
294 
295 char *
296 AcpiUtStrcat (
297     char                    *DstString,
298     const char              *SrcString);
299 
300 char *
301 AcpiUtStrncat (
302     char                    *DstString,
303     const char              *SrcString,
304     ACPI_SIZE               Count);
305 
306 UINT32
307 AcpiUtStrtoul (
308     const char              *String,
309     char                    **Terminator,
310     UINT32                  Base);
311 
312 char *
313 AcpiUtStrstr (
314     char                    *String1,
315     char                    *String2);
316 
317 void *
318 AcpiUtMemcpy (
319     void                    *Dest,
320     const void              *Src,
321     ACPI_SIZE               Count);
322 
323 void *
324 AcpiUtMemset (
325     void                    *Dest,
326     UINT8                   Value,
327     ACPI_SIZE               Count);
328 
329 int
330 AcpiUtToUpper (
331     int                     c);
332 
333 int
334 AcpiUtToLower (
335     int                     c);
336 
337 extern const UINT8 _acpi_ctype[];
338 
339 #define _ACPI_XA     0x00    /* extra alphabetic - not supported */
340 #define _ACPI_XS     0x40    /* extra space */
341 #define _ACPI_BB     0x00    /* BEL, BS, etc. - not supported */
342 #define _ACPI_CN     0x20    /* CR, FF, HT, NL, VT */
343 #define _ACPI_DI     0x04    /* '0'-'9' */
344 #define _ACPI_LO     0x02    /* 'a'-'z' */
345 #define _ACPI_PU     0x10    /* punctuation */
346 #define _ACPI_SP     0x08    /* space */
347 #define _ACPI_UP     0x01    /* 'A'-'Z' */
348 #define _ACPI_XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
349 
350 #define ACPI_IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
351 #define ACPI_IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
352 #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
353 #define ACPI_IS_UPPER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
354 #define ACPI_IS_LOWER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
355 #define ACPI_IS_PRINT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
356 #define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
357 
358 #endif /* !ACPI_USE_SYSTEM_CLIBRARY */
359 
360 #define ACPI_IS_ASCII(c)  ((c) < 0x80)
361 
362 
363 /*
364  * utcopy - Object construction and conversion interfaces
365  */
366 ACPI_STATUS
367 AcpiUtBuildSimpleObject(
368     ACPI_OPERAND_OBJECT     *Obj,
369     ACPI_OBJECT             *UserObj,
370     UINT8                   *DataSpace,
371     UINT32                  *BufferSpaceUsed);
372 
373 ACPI_STATUS
374 AcpiUtBuildPackageObject (
375     ACPI_OPERAND_OBJECT     *Obj,
376     UINT8                   *Buffer,
377     UINT32                  *SpaceUsed);
378 
379 ACPI_STATUS
380 AcpiUtCopyIobjectToEobject (
381     ACPI_OPERAND_OBJECT     *Obj,
382     ACPI_BUFFER             *RetBuffer);
383 
384 ACPI_STATUS
385 AcpiUtCopyEobjectToIobject (
386     ACPI_OBJECT             *Obj,
387     ACPI_OPERAND_OBJECT     **InternalObj);
388 
389 ACPI_STATUS
390 AcpiUtCopyISimpleToIsimple (
391     ACPI_OPERAND_OBJECT     *SourceObj,
392     ACPI_OPERAND_OBJECT     *DestObj);
393 
394 ACPI_STATUS
395 AcpiUtCopyIobjectToIobject (
396     ACPI_OPERAND_OBJECT     *SourceDesc,
397     ACPI_OPERAND_OBJECT     **DestDesc,
398     ACPI_WALK_STATE         *WalkState);
399 
400 
401 /*
402  * utcreate - Object creation
403  */
404 ACPI_STATUS
405 AcpiUtUpdateObjectReference (
406     ACPI_OPERAND_OBJECT     *Object,
407     UINT16                  Action);
408 
409 
410 /*
411  * utdebug - Debug interfaces
412  */
413 void
414 AcpiUtInitStackPtrTrace (
415     void);
416 
417 void
418 AcpiUtTrackStackPtr (
419     void);
420 
421 void
422 AcpiUtTrace (
423     UINT32                  LineNumber,
424     const char              *FunctionName,
425     const char              *ModuleName,
426     UINT32                  ComponentId);
427 
428 void
429 AcpiUtTracePtr (
430     UINT32                  LineNumber,
431     const char              *FunctionName,
432     const char              *ModuleName,
433     UINT32                  ComponentId,
434     void                    *Pointer);
435 
436 void
437 AcpiUtTraceU32 (
438     UINT32                  LineNumber,
439     const char              *FunctionName,
440     const char              *ModuleName,
441     UINT32                  ComponentId,
442     UINT32                  Integer);
443 
444 void
445 AcpiUtTraceStr (
446     UINT32                  LineNumber,
447     const char              *FunctionName,
448     const char              *ModuleName,
449     UINT32                  ComponentId,
450     char                    *String);
451 
452 void
453 AcpiUtExit (
454     UINT32                  LineNumber,
455     const char              *FunctionName,
456     const char              *ModuleName,
457     UINT32                  ComponentId);
458 
459 void
460 AcpiUtStatusExit (
461     UINT32                  LineNumber,
462     const char              *FunctionName,
463     const char              *ModuleName,
464     UINT32                  ComponentId,
465     ACPI_STATUS             Status);
466 
467 void
468 AcpiUtValueExit (
469     UINT32                  LineNumber,
470     const char              *FunctionName,
471     const char              *ModuleName,
472     UINT32                  ComponentId,
473     UINT64                  Value);
474 
475 void
476 AcpiUtPtrExit (
477     UINT32                  LineNumber,
478     const char              *FunctionName,
479     const char              *ModuleName,
480     UINT32                  ComponentId,
481     UINT8                   *Ptr);
482 
483 void
484 AcpiUtDumpBuffer (
485     UINT8                   *Buffer,
486     UINT32                  Count,
487     UINT32                  Display,
488     UINT32                  componentId);
489 
490 void
491 AcpiUtDumpBuffer2 (
492     UINT8                   *Buffer,
493     UINT32                  Count,
494     UINT32                  Display);
495 
496 void
497 AcpiUtReportError (
498     char                    *ModuleName,
499     UINT32                  LineNumber);
500 
501 void
502 AcpiUtReportInfo (
503     char                    *ModuleName,
504     UINT32                  LineNumber);
505 
506 void
507 AcpiUtReportWarning (
508     char                    *ModuleName,
509     UINT32                  LineNumber);
510 
511 /*
512  * utdelete - Object deletion and reference counts
513  */
514 void
515 AcpiUtAddReference (
516     ACPI_OPERAND_OBJECT     *Object);
517 
518 void
519 AcpiUtRemoveReference (
520     ACPI_OPERAND_OBJECT     *Object);
521 
522 void
523 AcpiUtDeleteInternalPackageObject (
524     ACPI_OPERAND_OBJECT     *Object);
525 
526 void
527 AcpiUtDeleteInternalSimpleObject (
528     ACPI_OPERAND_OBJECT     *Object);
529 
530 void
531 AcpiUtDeleteInternalObjectList (
532     ACPI_OPERAND_OBJECT     **ObjList);
533 
534 
535 /*
536  * uteval - object evaluation
537  */
538 ACPI_STATUS
539 AcpiUtOsiImplementation (
540     ACPI_WALK_STATE         *WalkState);
541 
542 ACPI_STATUS
543 AcpiUtEvaluateObject (
544     ACPI_NAMESPACE_NODE     *PrefixNode,
545     char                    *Path,
546     UINT32                  ExpectedReturnBtypes,
547     ACPI_OPERAND_OBJECT     **ReturnDesc);
548 
549 ACPI_STATUS
550 AcpiUtEvaluateNumericObject (
551     char                    *ObjectName,
552     ACPI_NAMESPACE_NODE     *DeviceNode,
553     UINT64                  *Value);
554 
555 ACPI_STATUS
556 AcpiUtExecute_STA (
557     ACPI_NAMESPACE_NODE     *DeviceNode,
558     UINT32                  *StatusFlags);
559 
560 ACPI_STATUS
561 AcpiUtExecutePowerMethods (
562     ACPI_NAMESPACE_NODE     *DeviceNode,
563     const char              **MethodNames,
564     UINT8                   MethodCount,
565     UINT8                   *OutValues);
566 
567 
568 /*
569  * utids - device ID support
570  */
571 ACPI_STATUS
572 AcpiUtExecute_HID (
573     ACPI_NAMESPACE_NODE     *DeviceNode,
574     ACPI_DEVICE_ID          **ReturnId);
575 
576 ACPI_STATUS
577 AcpiUtExecute_UID (
578     ACPI_NAMESPACE_NODE     *DeviceNode,
579     ACPI_DEVICE_ID          **ReturnId);
580 
581 ACPI_STATUS
582 AcpiUtExecute_CID (
583     ACPI_NAMESPACE_NODE     *DeviceNode,
584     ACPI_DEVICE_ID_LIST     **ReturnCidList);
585 
586 
587 /*
588  * utlock - reader/writer locks
589  */
590 ACPI_STATUS
591 AcpiUtCreateRwLock (
592     ACPI_RW_LOCK            *Lock);
593 
594 void
595 AcpiUtDeleteRwLock (
596     ACPI_RW_LOCK            *Lock);
597 
598 ACPI_STATUS
599 AcpiUtAcquireReadLock (
600     ACPI_RW_LOCK            *Lock);
601 
602 ACPI_STATUS
603 AcpiUtReleaseReadLock (
604     ACPI_RW_LOCK            *Lock);
605 
606 ACPI_STATUS
607 AcpiUtAcquireWriteLock (
608     ACPI_RW_LOCK            *Lock);
609 
610 void
611 AcpiUtReleaseWriteLock (
612     ACPI_RW_LOCK            *Lock);
613 
614 
615 /*
616  * utobject - internal object create/delete/cache routines
617  */
618 ACPI_OPERAND_OBJECT  *
619 AcpiUtCreateInternalObjectDbg (
620     const char              *ModuleName,
621     UINT32                  LineNumber,
622     UINT32                  ComponentId,
623     ACPI_OBJECT_TYPE        Type);
624 
625 void *
626 AcpiUtAllocateObjectDescDbg (
627     const char              *ModuleName,
628     UINT32                  LineNumber,
629     UINT32                  ComponentId);
630 
631 #define AcpiUtCreateInternalObject(t)   AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
632 #define AcpiUtAllocateObjectDesc()      AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
633 
634 void
635 AcpiUtDeleteObjectDesc (
636     ACPI_OPERAND_OBJECT     *Object);
637 
638 BOOLEAN
639 AcpiUtValidInternalObject (
640     void                    *Object);
641 
642 ACPI_OPERAND_OBJECT *
643 AcpiUtCreatePackageObject (
644     UINT32                  Count);
645 
646 ACPI_OPERAND_OBJECT *
647 AcpiUtCreateIntegerObject (
648     UINT64                  Value);
649 
650 ACPI_OPERAND_OBJECT *
651 AcpiUtCreateBufferObject (
652     ACPI_SIZE               BufferSize);
653 
654 ACPI_OPERAND_OBJECT *
655 AcpiUtCreateStringObject (
656     ACPI_SIZE               StringSize);
657 
658 ACPI_STATUS
659 AcpiUtGetObjectSize(
660     ACPI_OPERAND_OBJECT     *Obj,
661     ACPI_SIZE               *ObjLength);
662 
663 
664 /*
665  * utstate - Generic state creation/cache routines
666  */
667 void
668 AcpiUtPushGenericState (
669     ACPI_GENERIC_STATE      **ListHead,
670     ACPI_GENERIC_STATE      *State);
671 
672 ACPI_GENERIC_STATE *
673 AcpiUtPopGenericState (
674     ACPI_GENERIC_STATE      **ListHead);
675 
676 
677 ACPI_GENERIC_STATE *
678 AcpiUtCreateGenericState (
679     void);
680 
681 ACPI_THREAD_STATE *
682 AcpiUtCreateThreadState (
683     void);
684 
685 ACPI_GENERIC_STATE *
686 AcpiUtCreateUpdateState (
687     ACPI_OPERAND_OBJECT     *Object,
688     UINT16                  Action);
689 
690 ACPI_GENERIC_STATE *
691 AcpiUtCreatePkgState (
692     void                    *InternalObject,
693     void                    *ExternalObject,
694     UINT16                  Index);
695 
696 ACPI_STATUS
697 AcpiUtCreateUpdateStateAndPush (
698     ACPI_OPERAND_OBJECT     *Object,
699     UINT16                  Action,
700     ACPI_GENERIC_STATE      **StateList);
701 
702 ACPI_STATUS
703 AcpiUtCreatePkgStateAndPush (
704     void                    *InternalObject,
705     void                    *ExternalObject,
706     UINT16                  Index,
707     ACPI_GENERIC_STATE      **StateList);
708 
709 ACPI_GENERIC_STATE *
710 AcpiUtCreateControlState (
711     void);
712 
713 void
714 AcpiUtDeleteGenericState (
715     ACPI_GENERIC_STATE      *State);
716 
717 
718 /*
719  * utmath
720  */
721 ACPI_STATUS
722 AcpiUtDivide (
723     UINT64                  InDividend,
724     UINT64                  InDivisor,
725     UINT64                  *OutQuotient,
726     UINT64                  *OutRemainder);
727 
728 ACPI_STATUS
729 AcpiUtShortDivide (
730     UINT64                  InDividend,
731     UINT32                  Divisor,
732     UINT64                  *OutQuotient,
733     UINT32                  *OutRemainder);
734 
735 /*
736  * utmisc
737  */
738 const char *
739 AcpiUtValidateException (
740     ACPI_STATUS             Status);
741 
742 BOOLEAN
743 AcpiUtIsPciRootBridge (
744     char                    *Id);
745 
746 BOOLEAN
747 AcpiUtIsAmlTable (
748     ACPI_TABLE_HEADER       *Table);
749 
750 ACPI_STATUS
751 AcpiUtAllocateOwnerId (
752     ACPI_OWNER_ID           *OwnerId);
753 
754 void
755 AcpiUtReleaseOwnerId (
756     ACPI_OWNER_ID           *OwnerId);
757 
758 ACPI_STATUS
759 AcpiUtWalkPackageTree (
760     ACPI_OPERAND_OBJECT     *SourceObject,
761     void                    *TargetObject,
762     ACPI_PKG_CALLBACK       WalkCallback,
763     void                    *Context);
764 
765 void
766 AcpiUtStrupr (
767     char                    *SrcString);
768 
769 void
770 AcpiUtStrlwr (
771     char                    *SrcString);
772 
773 void
774 AcpiUtPrintString (
775     char                    *String,
776     UINT8                   MaxLength);
777 
778 BOOLEAN
779 AcpiUtValidAcpiName (
780     UINT32                  Name);
781 
782 void
783 AcpiUtRepairName (
784     char                    *Name);
785 
786 BOOLEAN
787 AcpiUtValidAcpiChar (
788     char                    Character,
789     UINT32                  Position);
790 
791 ACPI_STATUS
792 AcpiUtStrtoul64 (
793     char                    *String,
794     UINT32                  Base,
795     UINT64                  *RetInteger);
796 
797 void ACPI_INTERNAL_VAR_XFACE
798 AcpiUtPredefinedWarning (
799     const char              *ModuleName,
800     UINT32                  LineNumber,
801     char                    *Pathname,
802     UINT8                   NodeFlags,
803     const char              *Format,
804     ...);
805 
806 void ACPI_INTERNAL_VAR_XFACE
807 AcpiUtPredefinedInfo (
808     const char              *ModuleName,
809     UINT32                  LineNumber,
810     char                    *Pathname,
811     UINT8                   NodeFlags,
812     const char              *Format,
813     ...);
814 
815 /* Values for Base above (16=Hex, 10=Decimal) */
816 
817 #define ACPI_ANY_BASE        0
818 
819 UINT32
820 AcpiUtDwordByteSwap (
821     UINT32                  Value);
822 
823 void
824 AcpiUtSetIntegerWidth (
825     UINT8                   Revision);
826 
827 #ifdef ACPI_DEBUG_OUTPUT
828 void
829 AcpiUtDisplayInitPathname (
830     UINT8                   Type,
831     ACPI_NAMESPACE_NODE     *ObjHandle,
832     char                    *Path);
833 #endif
834 
835 
836 /*
837  * utresrc
838  */
839 ACPI_STATUS
840 AcpiUtWalkAmlResources (
841     UINT8                   *Aml,
842     ACPI_SIZE               AmlLength,
843     ACPI_WALK_AML_CALLBACK  UserFunction,
844     void                    *Context);
845 
846 ACPI_STATUS
847 AcpiUtValidateResource (
848     void                    *Aml,
849     UINT8                   *ReturnIndex);
850 
851 UINT32
852 AcpiUtGetDescriptorLength (
853     void                    *Aml);
854 
855 UINT16
856 AcpiUtGetResourceLength (
857     void                    *Aml);
858 
859 UINT8
860 AcpiUtGetResourceHeaderLength (
861     void                    *Aml);
862 
863 UINT8
864 AcpiUtGetResourceType (
865     void                    *Aml);
866 
867 ACPI_STATUS
868 AcpiUtGetResourceEndTag (
869     ACPI_OPERAND_OBJECT     *ObjDesc,
870     UINT8                   **EndTag);
871 
872 
873 /*
874  * utmutex - mutex support
875  */
876 ACPI_STATUS
877 AcpiUtMutexInitialize (
878     void);
879 
880 void
881 AcpiUtMutexTerminate (
882     void);
883 
884 ACPI_STATUS
885 AcpiUtAcquireMutex (
886     ACPI_MUTEX_HANDLE       MutexId);
887 
888 ACPI_STATUS
889 AcpiUtReleaseMutex (
890     ACPI_MUTEX_HANDLE       MutexId);
891 
892 
893 /*
894  * utalloc - memory allocation and object caching
895  */
896 ACPI_STATUS
897 AcpiUtCreateCaches (
898     void);
899 
900 ACPI_STATUS
901 AcpiUtDeleteCaches (
902     void);
903 
904 ACPI_STATUS
905 AcpiUtValidateBuffer (
906     ACPI_BUFFER             *Buffer);
907 
908 ACPI_STATUS
909 AcpiUtInitializeBuffer (
910     ACPI_BUFFER             *Buffer,
911     ACPI_SIZE               RequiredLength);
912 
913 void *
914 AcpiUtAllocate (
915     ACPI_SIZE               Size,
916     UINT32                  Component,
917     const char              *Module,
918     UINT32                  Line);
919 
920 void *
921 AcpiUtAllocateZeroed (
922     ACPI_SIZE               Size,
923     UINT32                  Component,
924     const char              *Module,
925     UINT32                  Line);
926 
927 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
928 void *
929 AcpiUtAllocateAndTrack (
930     ACPI_SIZE               Size,
931     UINT32                  Component,
932     const char              *Module,
933     UINT32                  Line);
934 
935 void *
936 AcpiUtAllocateZeroedAndTrack (
937     ACPI_SIZE               Size,
938     UINT32                  Component,
939     const char              *Module,
940     UINT32                  Line);
941 
942 void
943 AcpiUtFreeAndTrack (
944     void                    *Address,
945     UINT32                  Component,
946     const char              *Module,
947     UINT32                  Line);
948 
949 void
950 AcpiUtDumpAllocationInfo (
951     void);
952 
953 void
954 AcpiUtDumpAllocations (
955     UINT32                  Component,
956     const char              *Module);
957 
958 ACPI_STATUS
959 AcpiUtCreateList (
960     char                    *ListName,
961     UINT16                  ObjectSize,
962     ACPI_MEMORY_LIST        **ReturnCache);
963 
964 
965 #endif
966 
967 #endif /* _ACUTILS_H */
968