xref: /titanic_50/usr/src/uts/intel/sys/acpi/acutils.h (revision b6c3f7863936abeae522e48a13887dddeb691a45)
1 /******************************************************************************
2  *
3  * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
4  *       $Revision: 1.196 $
5  *
6  *****************************************************************************/
7 
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
13  * All rights reserved.
14  *
15  * 2. License
16  *
17  * 2.1. This is your license from Intel Corp. under its intellectual property
18  * rights.  You may have additional license terms from the party that provided
19  * you this software, covering your right to use that party's intellectual
20  * property rights.
21  *
22  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23  * copy of the source code appearing in this file ("Covered Code") an
24  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25  * base code distributed originally by Intel ("Original Intel Code") to copy,
26  * make derivatives, distribute, use and display any portion of the Covered
27  * Code in any form, with the right to sublicense such rights; and
28  *
29  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30  * license (with the right to sublicense), under only those claims of Intel
31  * patents that are infringed by the Original Intel Code, to make, use, sell,
32  * offer to sell, and import the Covered Code and derivative works thereof
33  * solely to the minimum extent necessary to exercise the above copyright
34  * license, and in no event shall the patent license extend to any additions
35  * to or modifications of the Original Intel Code.  No other license or right
36  * is granted directly or by implication, estoppel or otherwise;
37  *
38  * The above copyright and patent license is granted only if the following
39  * conditions are met:
40  *
41  * 3. Conditions
42  *
43  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44  * Redistribution of source code of any substantial portion of the Covered
45  * Code or modification with rights to further distribute source must include
46  * the above Copyright Notice, the above License, this list of Conditions,
47  * and the following Disclaimer and Export Compliance provision.  In addition,
48  * Licensee must cause all Covered Code to which Licensee contributes to
49  * contain a file documenting the changes Licensee made to create that Covered
50  * Code and the date of any change.  Licensee must include in that file the
51  * documentation of any changes made by any predecessor Licensee.  Licensee
52  * must include a prominent statement that the modification is derived,
53  * directly or indirectly, from Original Intel Code.
54  *
55  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56  * Redistribution of source code of any substantial portion of the Covered
57  * Code or modification without rights to further distribute source must
58  * include the following Disclaimer and Export Compliance provision in the
59  * documentation and/or other materials provided with distribution.  In
60  * addition, Licensee may not authorize further sublicense of source of any
61  * portion of the Covered Code, and must include terms to the effect that the
62  * license from Licensee to its licensee is limited to the intellectual
63  * property embodied in the software Licensee provides to its licensee, and
64  * not to intellectual property embodied in modifications its licensee may
65  * make.
66  *
67  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68  * substantial portion of the Covered Code or modification must reproduce the
69  * above Copyright Notice, and the following Disclaimer and Export Compliance
70  * provision in the documentation and/or other materials provided with the
71  * distribution.
72  *
73  * 3.4. Intel retains all right, title, and interest in and to the Original
74  * Intel Code.
75  *
76  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77  * Intel shall be used in advertising or otherwise to promote the sale, use or
78  * other dealings in products derived from or relating to the Covered Code
79  * without prior written authorization from Intel.
80  *
81  * 4. Disclaimer and Export Compliance
82  *
83  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89  * PARTICULAR PURPOSE.
90  *
91  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98  * LIMITED REMEDY.
99  *
100  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101  * software or system incorporating such software without first obtaining any
102  * required license or other approval from the U. S. Department of Commerce or
103  * any other agency or department of the United States Government.  In the
104  * event Licensee exports any such software from the United States or
105  * re-exports any such software from a foreign destination, Licensee shall
106  * ensure that the distribution and export/re-export of the software is in
107  * compliance with all laws, regulations, orders, or other restrictions of the
108  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109  * any of its subsidiaries will export/re-export any technical data, process,
110  * software, or service, directly or indirectly, to any country for which the
111  * United States government or any agency thereof requires an export license,
112  * other governmental approval, or letter of assurance, without first obtaining
113  * such license, approval or letter.
114  *
115  *****************************************************************************/
116 
117 #ifndef _ACUTILS_H
118 #define _ACUTILS_H
119 
120 
121 extern const UINT8                      AcpiGbl_ResourceAmlSizes[];
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 #endif
146 
147 /* Types for Resource descriptor entries */
148 
149 #define ACPI_INVALID_RESOURCE           0
150 #define ACPI_FIXED_LENGTH               1
151 #define ACPI_VARIABLE_LENGTH            2
152 #define ACPI_SMALL_VARIABLE_LENGTH      3
153 
154 typedef
155 ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
156     UINT8                   *Aml,
157     UINT32                  Length,
158     UINT32                  Offset,
159     UINT8                   ResourceIndex,
160     void                    *Context);
161 
162 typedef
163 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
164     UINT8                   ObjectType,
165     ACPI_OPERAND_OBJECT     *SourceObject,
166     ACPI_GENERIC_STATE      *State,
167     void                    *Context);
168 
169 typedef struct acpi_pkg_info
170 {
171     UINT8                   *FreeSpace;
172     ACPI_SIZE               Length;
173     UINT32                  ObjectSpace;
174     UINT32                  NumPackages;
175 
176 } ACPI_PKG_INFO;
177 
178 #define REF_INCREMENT       (UINT16) 0
179 #define REF_DECREMENT       (UINT16) 1
180 #define REF_FORCE_DELETE    (UINT16) 2
181 
182 /* AcpiUtDumpBuffer */
183 
184 #define DB_BYTE_DISPLAY     1
185 #define DB_WORD_DISPLAY     2
186 #define DB_DWORD_DISPLAY    4
187 #define DB_QWORD_DISPLAY    8
188 
189 
190 /*
191  * utglobal - Global data structures and procedures
192  */
193 void
194 AcpiUtInitGlobals (
195     void);
196 
197 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
198 
199 char *
200 AcpiUtGetMutexName (
201     UINT32                  MutexId);
202 
203 #endif
204 
205 char *
206 AcpiUtGetTypeName (
207     ACPI_OBJECT_TYPE        Type);
208 
209 char *
210 AcpiUtGetNodeName (
211     void                    *Object);
212 
213 char *
214 AcpiUtGetDescriptorName (
215     void                    *Object);
216 
217 char *
218 AcpiUtGetObjectTypeName (
219     ACPI_OPERAND_OBJECT     *ObjDesc);
220 
221 char *
222 AcpiUtGetRegionName (
223     UINT8                   SpaceId);
224 
225 char *
226 AcpiUtGetEventName (
227     UINT32                  EventId);
228 
229 char
230 AcpiUtHexToAsciiChar (
231     ACPI_INTEGER            Integer,
232     UINT32                  Position);
233 
234 BOOLEAN
235 AcpiUtValidObjectType (
236     ACPI_OBJECT_TYPE        Type);
237 
238 
239 /*
240  * utinit - miscellaneous initialization and shutdown
241  */
242 ACPI_STATUS
243 AcpiUtHardwareInitialize (
244     void);
245 
246 void
247 AcpiUtSubsystemShutdown (
248     void);
249 
250 ACPI_STATUS
251 AcpiUtValidateFadt (
252     void);
253 
254 
255 /*
256  * utclib - Local implementations of C library functions
257  */
258 #ifndef ACPI_USE_SYSTEM_CLIBRARY
259 
260 ACPI_SIZE
261 AcpiUtStrlen (
262     const char              *String);
263 
264 char *
265 AcpiUtStrcpy (
266     char                    *DstString,
267     const char              *SrcString);
268 
269 char *
270 AcpiUtStrncpy (
271     char                    *DstString,
272     const char              *SrcString,
273     ACPI_SIZE               Count);
274 
275 int
276 AcpiUtMemcmp (
277     const char              *Buffer1,
278     const char              *Buffer2,
279     ACPI_SIZE               Count);
280 
281 int
282 AcpiUtStrncmp (
283     const char              *String1,
284     const char              *String2,
285     ACPI_SIZE               Count);
286 
287 int
288 AcpiUtStrcmp (
289     const char              *String1,
290     const char              *String2);
291 
292 char *
293 AcpiUtStrcat (
294     char                    *DstString,
295     const char              *SrcString);
296 
297 char *
298 AcpiUtStrncat (
299     char                    *DstString,
300     const char              *SrcString,
301     ACPI_SIZE               Count);
302 
303 UINT32
304 AcpiUtStrtoul (
305     const char              *String,
306     char                    **Terminator,
307     UINT32                  Base);
308 
309 char *
310 AcpiUtStrstr (
311     char                    *String1,
312     char                    *String2);
313 
314 void *
315 AcpiUtMemcpy (
316     void                    *Dest,
317     const void              *Src,
318     ACPI_SIZE               Count);
319 
320 void *
321 AcpiUtMemset (
322     void                    *Dest,
323     ACPI_NATIVE_UINT        Value,
324     ACPI_SIZE               Count);
325 
326 int
327 AcpiUtToUpper (
328     int                     c);
329 
330 int
331 AcpiUtToLower (
332     int                     c);
333 
334 extern const UINT8 _acpi_ctype[];
335 
336 #define _ACPI_XA     0x00    /* extra alphabetic - not supported */
337 #define _ACPI_XS     0x40    /* extra space */
338 #define _ACPI_BB     0x00    /* BEL, BS, etc. - not supported */
339 #define _ACPI_CN     0x20    /* CR, FF, HT, NL, VT */
340 #define _ACPI_DI     0x04    /* '0'-'9' */
341 #define _ACPI_LO     0x02    /* 'a'-'z' */
342 #define _ACPI_PU     0x10    /* punctuation */
343 #define _ACPI_SP     0x08    /* space */
344 #define _ACPI_UP     0x01    /* 'A'-'Z' */
345 #define _ACPI_XD     0x80    /* '0'-'9', 'A'-'F', 'a'-'f' */
346 
347 #define ACPI_IS_DIGIT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
348 #define ACPI_IS_SPACE(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
349 #define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
350 #define ACPI_IS_UPPER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
351 #define ACPI_IS_LOWER(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
352 #define ACPI_IS_PRINT(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
353 #define ACPI_IS_ALPHA(c)  (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
354 
355 #endif /* ACPI_USE_SYSTEM_CLIBRARY */
356 
357 
358 /*
359  * utcopy - Object construction and conversion interfaces
360  */
361 ACPI_STATUS
362 AcpiUtBuildSimpleObject(
363     ACPI_OPERAND_OBJECT     *Obj,
364     ACPI_OBJECT             *UserObj,
365     UINT8                   *DataSpace,
366     UINT32                  *BufferSpaceUsed);
367 
368 ACPI_STATUS
369 AcpiUtBuildPackageObject (
370     ACPI_OPERAND_OBJECT     *Obj,
371     UINT8                   *Buffer,
372     UINT32                  *SpaceUsed);
373 
374 ACPI_STATUS
375 AcpiUtCopyIobjectToEobject (
376     ACPI_OPERAND_OBJECT     *Obj,
377     ACPI_BUFFER             *RetBuffer);
378 
379 ACPI_STATUS
380 AcpiUtCopyEobjectToIobject (
381     ACPI_OBJECT             *Obj,
382     ACPI_OPERAND_OBJECT     **InternalObj);
383 
384 ACPI_STATUS
385 AcpiUtCopyISimpleToIsimple (
386     ACPI_OPERAND_OBJECT     *SourceObj,
387     ACPI_OPERAND_OBJECT     *DestObj);
388 
389 ACPI_STATUS
390 AcpiUtCopyIobjectToIobject (
391     ACPI_OPERAND_OBJECT     *SourceDesc,
392     ACPI_OPERAND_OBJECT     **DestDesc,
393     ACPI_WALK_STATE         *WalkState);
394 
395 
396 /*
397  * utcreate - Object creation
398  */
399 ACPI_STATUS
400 AcpiUtUpdateObjectReference (
401     ACPI_OPERAND_OBJECT     *Object,
402     UINT16                  Action);
403 
404 
405 /*
406  * utdebug - Debug interfaces
407  */
408 void
409 AcpiUtInitStackPtrTrace (
410     void);
411 
412 void
413 AcpiUtTrackStackPtr (
414     void);
415 
416 void
417 AcpiUtTrace (
418     UINT32                  LineNumber,
419     const char              *FunctionName,
420     char                    *ModuleName,
421     UINT32                  ComponentId);
422 
423 void
424 AcpiUtTracePtr (
425     UINT32                  LineNumber,
426     const char              *FunctionName,
427     char                    *ModuleName,
428     UINT32                  ComponentId,
429     void                    *Pointer);
430 
431 void
432 AcpiUtTraceU32 (
433     UINT32                  LineNumber,
434     const char              *FunctionName,
435     char                    *ModuleName,
436     UINT32                  ComponentId,
437     UINT32                  Integer);
438 
439 void
440 AcpiUtTraceStr (
441     UINT32                  LineNumber,
442     const char              *FunctionName,
443     char                    *ModuleName,
444     UINT32                  ComponentId,
445     char                    *String);
446 
447 void
448 AcpiUtExit (
449     UINT32                  LineNumber,
450     const char              *FunctionName,
451     char                    *ModuleName,
452     UINT32                  ComponentId);
453 
454 void
455 AcpiUtStatusExit (
456     UINT32                  LineNumber,
457     const char              *FunctionName,
458     char                    *ModuleName,
459     UINT32                  ComponentId,
460     ACPI_STATUS             Status);
461 
462 void
463 AcpiUtValueExit (
464     UINT32                  LineNumber,
465     const char              *FunctionName,
466     char                    *ModuleName,
467     UINT32                  ComponentId,
468     ACPI_INTEGER            Value);
469 
470 void
471 AcpiUtPtrExit (
472     UINT32                  LineNumber,
473     const char              *FunctionName,
474     char                    *ModuleName,
475     UINT32                  ComponentId,
476     UINT8                   *Ptr);
477 
478 void
479 AcpiUtDumpBuffer (
480     UINT8                   *Buffer,
481     UINT32                  Count,
482     UINT32                  Display,
483     UINT32                  componentId);
484 
485 void
486 AcpiUtDumpBuffer2 (
487     UINT8                   *Buffer,
488     UINT32                  Count,
489     UINT32                  Display);
490 
491 void
492 AcpiUtReportError (
493     char                    *ModuleName,
494     UINT32                  LineNumber);
495 
496 void
497 AcpiUtReportInfo (
498     char                    *ModuleName,
499     UINT32                  LineNumber);
500 
501 void
502 AcpiUtReportWarning (
503     char                    *ModuleName,
504     UINT32                  LineNumber);
505 
506 /* Error and message reporting interfaces */
507 
508 void ACPI_INTERNAL_VAR_XFACE
509 AcpiUtDebugPrint (
510     UINT32                  RequestedDebugLevel,
511     UINT32                  LineNumber,
512     const char              *FunctionName,
513     char                    *ModuleName,
514     UINT32                  ComponentId,
515     char                    *Format,
516     ...) ACPI_PRINTF_LIKE(6);
517 
518 void ACPI_INTERNAL_VAR_XFACE
519 AcpiUtDebugPrintRaw (
520     UINT32                  RequestedDebugLevel,
521     UINT32                  LineNumber,
522     const char              *FunctionName,
523     char                    *ModuleName,
524     UINT32                  ComponentId,
525     char                    *Format,
526     ...) ACPI_PRINTF_LIKE(6);
527 
528 void ACPI_INTERNAL_VAR_XFACE
529 AcpiUtError (
530     char                    *ModuleName,
531     UINT32                  LineNumber,
532     char                    *Format,
533     ...) ACPI_PRINTF_LIKE(3);
534 
535 void  ACPI_INTERNAL_VAR_XFACE
536 AcpiUtException (
537     char                    *ModuleName,
538     UINT32                  LineNumber,
539     ACPI_STATUS             Status,
540     char                    *Format,
541     ...) ACPI_PRINTF_LIKE(4);
542 
543 void ACPI_INTERNAL_VAR_XFACE
544 AcpiUtWarning (
545     char                    *ModuleName,
546     UINT32                  LineNumber,
547     char                    *Format,
548     ...) ACPI_PRINTF_LIKE(3);
549 
550 void ACPI_INTERNAL_VAR_XFACE
551 AcpiUtInfo (
552     char                    *ModuleName,
553     UINT32                  LineNumber,
554     char                    *Format,
555     ...) ACPI_PRINTF_LIKE(3);
556 
557 
558 /*
559  * utdelete - Object deletion and reference counts
560  */
561 void
562 AcpiUtAddReference (
563     ACPI_OPERAND_OBJECT     *Object);
564 
565 void
566 AcpiUtRemoveReference (
567     ACPI_OPERAND_OBJECT     *Object);
568 
569 void
570 AcpiUtDeleteInternalPackageObject (
571     ACPI_OPERAND_OBJECT     *Object);
572 
573 void
574 AcpiUtDeleteInternalSimpleObject (
575     ACPI_OPERAND_OBJECT     *Object);
576 
577 void
578 AcpiUtDeleteInternalObjectList (
579     ACPI_OPERAND_OBJECT     **ObjList);
580 
581 
582 /*
583  * uteval - object evaluation
584  */
585 ACPI_STATUS
586 AcpiUtOsiImplementation (
587     ACPI_WALK_STATE         *WalkState);
588 
589 ACPI_STATUS
590 AcpiUtEvaluateObject (
591     ACPI_NAMESPACE_NODE     *PrefixNode,
592     char                    *Path,
593     UINT32                  ExpectedReturnBtypes,
594     ACPI_OPERAND_OBJECT     **ReturnDesc);
595 
596 ACPI_STATUS
597 AcpiUtEvaluateNumericObject (
598     char                    *ObjectName,
599     ACPI_NAMESPACE_NODE     *DeviceNode,
600     ACPI_INTEGER            *Address);
601 
602 ACPI_STATUS
603 AcpiUtExecute_HID (
604     ACPI_NAMESPACE_NODE     *DeviceNode,
605     ACPI_DEVICE_ID          *Hid);
606 
607 ACPI_STATUS
608 AcpiUtExecute_CID (
609     ACPI_NAMESPACE_NODE     *DeviceNode,
610     ACPI_COMPATIBLE_ID_LIST **ReturnCidList);
611 
612 ACPI_STATUS
613 AcpiUtExecute_STA (
614     ACPI_NAMESPACE_NODE     *DeviceNode,
615     UINT32                  *StatusFlags);
616 
617 ACPI_STATUS
618 AcpiUtExecute_UID (
619     ACPI_NAMESPACE_NODE     *DeviceNode,
620     ACPI_DEVICE_ID          *Uid);
621 
622 ACPI_STATUS
623 AcpiUtExecute_Sxds (
624     ACPI_NAMESPACE_NODE     *DeviceNode,
625     UINT8                   *Highest);
626 
627 
628 /*
629  * utobject - internal object create/delete/cache routines
630  */
631 ACPI_OPERAND_OBJECT  *
632 AcpiUtCreateInternalObjectDbg (
633     char                    *ModuleName,
634     UINT32                  LineNumber,
635     UINT32                  ComponentId,
636     ACPI_OBJECT_TYPE        Type);
637 
638 void *
639 AcpiUtAllocateObjectDescDbg (
640     char                    *ModuleName,
641     UINT32                  LineNumber,
642     UINT32                  ComponentId);
643 
644 #define AcpiUtCreateInternalObject(t)   AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
645 #define AcpiUtAllocateObjectDesc()      AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
646 
647 void
648 AcpiUtDeleteObjectDesc (
649     ACPI_OPERAND_OBJECT     *Object);
650 
651 BOOLEAN
652 AcpiUtValidInternalObject (
653     void                    *Object);
654 
655 ACPI_OPERAND_OBJECT *
656 AcpiUtCreateBufferObject (
657     ACPI_SIZE               BufferSize);
658 
659 ACPI_OPERAND_OBJECT *
660 AcpiUtCreateStringObject (
661     ACPI_SIZE               StringSize);
662 
663 ACPI_STATUS
664 AcpiUtGetObjectSize(
665     ACPI_OPERAND_OBJECT     *Obj,
666     ACPI_SIZE               *ObjLength);
667 
668 
669 /*
670  * utstate - Generic state creation/cache routines
671  */
672 void
673 AcpiUtPushGenericState (
674     ACPI_GENERIC_STATE      **ListHead,
675     ACPI_GENERIC_STATE      *State);
676 
677 ACPI_GENERIC_STATE *
678 AcpiUtPopGenericState (
679     ACPI_GENERIC_STATE      **ListHead);
680 
681 
682 ACPI_GENERIC_STATE *
683 AcpiUtCreateGenericState (
684     void);
685 
686 ACPI_THREAD_STATE *
687 AcpiUtCreateThreadState (
688     void);
689 
690 ACPI_GENERIC_STATE *
691 AcpiUtCreateUpdateState (
692     ACPI_OPERAND_OBJECT     *Object,
693     UINT16                  Action);
694 
695 ACPI_GENERIC_STATE *
696 AcpiUtCreatePkgState (
697     void                    *InternalObject,
698     void                    *ExternalObject,
699     UINT16                  Index);
700 
701 ACPI_STATUS
702 AcpiUtCreateUpdateStateAndPush (
703     ACPI_OPERAND_OBJECT     *Object,
704     UINT16                  Action,
705     ACPI_GENERIC_STATE      **StateList);
706 
707 ACPI_STATUS
708 AcpiUtCreatePkgStateAndPush (
709     void                    *InternalObject,
710     void                    *ExternalObject,
711     UINT16                  Index,
712     ACPI_GENERIC_STATE      **StateList);
713 
714 ACPI_GENERIC_STATE *
715 AcpiUtCreateControlState (
716     void);
717 
718 void
719 AcpiUtDeleteGenericState (
720     ACPI_GENERIC_STATE      *State);
721 
722 
723 /*
724  * utmath
725  */
726 ACPI_STATUS
727 AcpiUtDivide (
728     ACPI_INTEGER            InDividend,
729     ACPI_INTEGER            InDivisor,
730     ACPI_INTEGER            *OutQuotient,
731     ACPI_INTEGER            *OutRemainder);
732 
733 ACPI_STATUS
734 AcpiUtShortDivide (
735     ACPI_INTEGER            InDividend,
736     UINT32                  Divisor,
737     ACPI_INTEGER            *OutQuotient,
738     UINT32                  *OutRemainder);
739 
740 /*
741  * utmisc
742  */
743 BOOLEAN
744 AcpiUtIsAmlTable (
745     ACPI_TABLE_HEADER       *Table);
746 
747 ACPI_STATUS
748 AcpiUtAllocateOwnerId (
749     ACPI_OWNER_ID           *OwnerId);
750 
751 void
752 AcpiUtReleaseOwnerId (
753     ACPI_OWNER_ID           *OwnerId);
754 
755 ACPI_STATUS
756 AcpiUtWalkPackageTree (
757     ACPI_OPERAND_OBJECT     *SourceObject,
758     void                    *TargetObject,
759     ACPI_PKG_CALLBACK       WalkCallback,
760     void                    *Context);
761 
762 void
763 AcpiUtStrupr (
764     char                    *SrcString);
765 
766 void
767 AcpiUtPrintString (
768     char                    *String,
769     UINT8                   MaxLength);
770 
771 BOOLEAN
772 AcpiUtValidAcpiName (
773     UINT32                  Name);
774 
775 ACPI_NAME
776 AcpiUtRepairName (
777     ACPI_NAME               Name);
778 
779 BOOLEAN
780 AcpiUtValidAcpiChar (
781     char                    Character,
782     ACPI_NATIVE_UINT        Position);
783 
784 ACPI_STATUS
785 AcpiUtStrtoul64 (
786     char                    *String,
787     UINT32                  Base,
788     ACPI_INTEGER            *RetInteger);
789 
790 /* Values for Base above (16=Hex, 10=Decimal) */
791 
792 #define ACPI_ANY_BASE        0
793 
794 UINT32
795 AcpiUtDwordByteSwap (
796     UINT32                  Value);
797 
798 void
799 AcpiUtSetIntegerWidth (
800     UINT8                   Revision);
801 
802 #ifdef ACPI_DEBUG_OUTPUT
803 void
804 AcpiUtDisplayInitPathname (
805     UINT8                   Type,
806     ACPI_NAMESPACE_NODE     *ObjHandle,
807     char                    *Path);
808 #endif
809 
810 
811 /*
812  * utresrc
813  */
814 ACPI_STATUS
815 AcpiUtWalkAmlResources (
816     UINT8                   *Aml,
817     ACPI_SIZE               AmlLength,
818     ACPI_WALK_AML_CALLBACK  UserFunction,
819     void                    *Context);
820 
821 ACPI_STATUS
822 AcpiUtValidateResource (
823     void                    *Aml,
824     UINT8                   *ReturnIndex);
825 
826 UINT32
827 AcpiUtGetDescriptorLength (
828     void                    *Aml);
829 
830 UINT16
831 AcpiUtGetResourceLength (
832     void                    *Aml);
833 
834 UINT8
835 AcpiUtGetResourceHeaderLength (
836     void                    *Aml);
837 
838 UINT8
839 AcpiUtGetResourceType (
840     void                    *Aml);
841 
842 ACPI_STATUS
843 AcpiUtGetResourceEndTag (
844     ACPI_OPERAND_OBJECT     *ObjDesc,
845     UINT8                   **EndTag);
846 
847 
848 /*
849  * utmutex - mutex support
850  */
851 ACPI_STATUS
852 AcpiUtMutexInitialize (
853     void);
854 
855 void
856 AcpiUtMutexTerminate (
857     void);
858 
859 ACPI_STATUS
860 AcpiUtAcquireMutex (
861     ACPI_MUTEX_HANDLE       MutexId);
862 
863 ACPI_STATUS
864 AcpiUtReleaseMutex (
865     ACPI_MUTEX_HANDLE       MutexId);
866 
867 
868 /*
869  * utalloc - memory allocation and object caching
870  */
871 ACPI_STATUS
872 AcpiUtCreateCaches (
873     void);
874 
875 ACPI_STATUS
876 AcpiUtDeleteCaches (
877     void);
878 
879 ACPI_STATUS
880 AcpiUtValidateBuffer (
881     ACPI_BUFFER             *Buffer);
882 
883 ACPI_STATUS
884 AcpiUtInitializeBuffer (
885     ACPI_BUFFER             *Buffer,
886     ACPI_SIZE               RequiredLength);
887 
888 void *
889 AcpiUtAllocate (
890     ACPI_SIZE               Size,
891     UINT32                  Component,
892     char                    *Module,
893     UINT32                  Line);
894 
895 void *
896 AcpiUtAllocateZeroed (
897     ACPI_SIZE               Size,
898     UINT32                  Component,
899     char                    *Module,
900     UINT32                  Line);
901 
902 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
903 void *
904 AcpiUtAllocateAndTrack (
905     ACPI_SIZE               Size,
906     UINT32                  Component,
907     char                    *Module,
908     UINT32                  Line);
909 
910 void *
911 AcpiUtAllocateZeroedAndTrack (
912     ACPI_SIZE               Size,
913     UINT32                  Component,
914     char                    *Module,
915     UINT32                  Line);
916 
917 void
918 AcpiUtFreeAndTrack (
919     void                    *Address,
920     UINT32                  Component,
921     char                    *Module,
922     UINT32                  Line);
923 
924 void
925 AcpiUtDumpAllocationInfo (
926     void);
927 
928 void
929 AcpiUtDumpAllocations (
930     UINT32                  Component,
931     char                    *Module);
932 
933 ACPI_STATUS
934 AcpiUtCreateList (
935     char                    *ListName,
936     UINT16                  ObjectSize,
937     ACPI_MEMORY_LIST        **ReturnCache);
938 
939 
940 #endif
941 
942 #endif /* _ACUTILS_H */
943