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