[ACPICA]
[reactos.git] / reactos / 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_EXCEPTION
123 #define ACPI_MSG_EXCEPTION "ACPI Exception: "
124 #endif
125 #ifndef ACPI_MSG_WARNING
126 #define ACPI_MSG_WARNING "ACPI Warning: "
127 #endif
128 #ifndef ACPI_MSG_INFO
129 #define ACPI_MSG_INFO "ACPI: "
130 #endif
131
132 #ifndef ACPI_MSG_BIOS_ERROR
133 #define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): "
134 #endif
135 #ifndef ACPI_MSG_BIOS_WARNING
136 #define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): "
137 #endif
138
139 /*
140 * Common message suffix
141 */
142 #define ACPI_MSG_SUFFIX \
143 AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber)
144
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 /* Object reference counts */
178
179 #define REF_INCREMENT (UINT16) 0
180 #define REF_DECREMENT (UINT16) 1
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 * utascii - ASCII utilities
192 */
193 BOOLEAN
194 AcpiUtValidNameseg (
195 char *Signature);
196
197 BOOLEAN
198 AcpiUtValidNameChar (
199 char Character,
200 UINT32 Position);
201
202 void
203 AcpiUtCheckAndRepairAscii (
204 UINT8 *Name,
205 char *RepairedName,
206 UINT32 Count);
207
208
209 /*
210 * utnonansi - Non-ANSI C library functions
211 */
212 void
213 AcpiUtStrupr (
214 char *SrcString);
215
216 void
217 AcpiUtStrlwr (
218 char *SrcString);
219
220 int
221 AcpiUtStricmp (
222 char *String1,
223 char *String2);
224
225 ACPI_STATUS
226 AcpiUtStrtoul64 (
227 char *String,
228 UINT32 Flags,
229 UINT64 *RetInteger);
230
231 /*
232 * Values for Flags above
233 * Note: LIMIT values correspond to AcpiGbl_IntegerByteWidth values (4/8)
234 */
235 #define ACPI_STRTOUL_32BIT 0x04 /* 4 bytes */
236 #define ACPI_STRTOUL_64BIT 0x08 /* 8 bytes */
237 #define ACPI_STRTOUL_BASE16 0x10 /* Default: Base10/16 */
238
239
240 /*
241 * utglobal - Global data structures and procedures
242 */
243 ACPI_STATUS
244 AcpiUtInitGlobals (
245 void);
246
247 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
248
249 const char *
250 AcpiUtGetMutexName (
251 UINT32 MutexId);
252
253 const char *
254 AcpiUtGetNotifyName (
255 UINT32 NotifyValue,
256 ACPI_OBJECT_TYPE Type);
257 #endif
258
259 const char *
260 AcpiUtGetTypeName (
261 ACPI_OBJECT_TYPE Type);
262
263 const char *
264 AcpiUtGetNodeName (
265 void *Object);
266
267 const char *
268 AcpiUtGetDescriptorName (
269 void *Object);
270
271 const char *
272 AcpiUtGetReferenceName (
273 ACPI_OPERAND_OBJECT *Object);
274
275 const char *
276 AcpiUtGetObjectTypeName (
277 ACPI_OPERAND_OBJECT *ObjDesc);
278
279 const char *
280 AcpiUtGetRegionName (
281 UINT8 SpaceId);
282
283 const char *
284 AcpiUtGetEventName (
285 UINT32 EventId);
286
287 const char *
288 AcpiUtGetArgumentTypeName (
289 UINT32 ArgType);
290
291 char
292 AcpiUtHexToAsciiChar (
293 UINT64 Integer,
294 UINT32 Position);
295
296 ACPI_STATUS
297 AcpiUtAsciiToHexByte (
298 char *TwoAsciiChars,
299 UINT8 *ReturnByte);
300
301 UINT8
302 AcpiUtAsciiCharToHex (
303 int HexChar);
304
305 BOOLEAN
306 AcpiUtValidObjectType (
307 ACPI_OBJECT_TYPE Type);
308
309
310 /*
311 * utinit - miscellaneous initialization and shutdown
312 */
313 ACPI_STATUS
314 AcpiUtHardwareInitialize (
315 void);
316
317 void
318 AcpiUtSubsystemShutdown (
319 void);
320
321
322 /*
323 * utcopy - Object construction and conversion interfaces
324 */
325 ACPI_STATUS
326 AcpiUtBuildSimpleObject(
327 ACPI_OPERAND_OBJECT *Obj,
328 ACPI_OBJECT *UserObj,
329 UINT8 *DataSpace,
330 UINT32 *BufferSpaceUsed);
331
332 ACPI_STATUS
333 AcpiUtBuildPackageObject (
334 ACPI_OPERAND_OBJECT *Obj,
335 UINT8 *Buffer,
336 UINT32 *SpaceUsed);
337
338 ACPI_STATUS
339 AcpiUtCopyIobjectToEobject (
340 ACPI_OPERAND_OBJECT *Obj,
341 ACPI_BUFFER *RetBuffer);
342
343 ACPI_STATUS
344 AcpiUtCopyEobjectToIobject (
345 ACPI_OBJECT *Obj,
346 ACPI_OPERAND_OBJECT **InternalObj);
347
348 ACPI_STATUS
349 AcpiUtCopyISimpleToIsimple (
350 ACPI_OPERAND_OBJECT *SourceObj,
351 ACPI_OPERAND_OBJECT *DestObj);
352
353 ACPI_STATUS
354 AcpiUtCopyIobjectToIobject (
355 ACPI_OPERAND_OBJECT *SourceDesc,
356 ACPI_OPERAND_OBJECT **DestDesc,
357 ACPI_WALK_STATE *WalkState);
358
359
360 /*
361 * utcreate - Object creation
362 */
363 ACPI_STATUS
364 AcpiUtUpdateObjectReference (
365 ACPI_OPERAND_OBJECT *Object,
366 UINT16 Action);
367
368
369 /*
370 * utdebug - Debug interfaces
371 */
372 void
373 AcpiUtInitStackPtrTrace (
374 void);
375
376 void
377 AcpiUtTrackStackPtr (
378 void);
379
380 void
381 AcpiUtTrace (
382 UINT32 LineNumber,
383 const char *FunctionName,
384 const char *ModuleName,
385 UINT32 ComponentId);
386
387 void
388 AcpiUtTracePtr (
389 UINT32 LineNumber,
390 const char *FunctionName,
391 const char *ModuleName,
392 UINT32 ComponentId,
393 const void *Pointer);
394
395 void
396 AcpiUtTraceU32 (
397 UINT32 LineNumber,
398 const char *FunctionName,
399 const char *ModuleName,
400 UINT32 ComponentId,
401 UINT32 Integer);
402
403 void
404 AcpiUtTraceStr (
405 UINT32 LineNumber,
406 const char *FunctionName,
407 const char *ModuleName,
408 UINT32 ComponentId,
409 const char *String);
410
411 void
412 AcpiUtExit (
413 UINT32 LineNumber,
414 const char *FunctionName,
415 const char *ModuleName,
416 UINT32 ComponentId);
417
418 void
419 AcpiUtStatusExit (
420 UINT32 LineNumber,
421 const char *FunctionName,
422 const char *ModuleName,
423 UINT32 ComponentId,
424 ACPI_STATUS Status);
425
426 void
427 AcpiUtValueExit (
428 UINT32 LineNumber,
429 const char *FunctionName,
430 const char *ModuleName,
431 UINT32 ComponentId,
432 UINT64 Value);
433
434 void
435 AcpiUtPtrExit (
436 UINT32 LineNumber,
437 const char *FunctionName,
438 const char *ModuleName,
439 UINT32 ComponentId,
440 UINT8 *Ptr);
441
442 void
443 AcpiUtStrExit (
444 UINT32 LineNumber,
445 const char *FunctionName,
446 const char *ModuleName,
447 UINT32 ComponentId,
448 const char *String);
449
450 void
451 AcpiUtDebugDumpBuffer (
452 UINT8 *Buffer,
453 UINT32 Count,
454 UINT32 Display,
455 UINT32 ComponentId);
456
457 void
458 AcpiUtDumpBuffer (
459 UINT8 *Buffer,
460 UINT32 Count,
461 UINT32 Display,
462 UINT32 Offset);
463
464 #ifdef ACPI_APPLICATION
465 void
466 AcpiUtDumpBufferToFile (
467 ACPI_FILE File,
468 UINT8 *Buffer,
469 UINT32 Count,
470 UINT32 Display,
471 UINT32 BaseOffset);
472 #endif
473
474 void
475 AcpiUtReportError (
476 char *ModuleName,
477 UINT32 LineNumber);
478
479 void
480 AcpiUtReportInfo (
481 char *ModuleName,
482 UINT32 LineNumber);
483
484 void
485 AcpiUtReportWarning (
486 char *ModuleName,
487 UINT32 LineNumber);
488
489
490 /*
491 * utdelete - Object deletion and reference counts
492 */
493 void
494 AcpiUtAddReference (
495 ACPI_OPERAND_OBJECT *Object);
496
497 void
498 AcpiUtRemoveReference (
499 ACPI_OPERAND_OBJECT *Object);
500
501 void
502 AcpiUtDeleteInternalPackageObject (
503 ACPI_OPERAND_OBJECT *Object);
504
505 void
506 AcpiUtDeleteInternalSimpleObject (
507 ACPI_OPERAND_OBJECT *Object);
508
509 void
510 AcpiUtDeleteInternalObjectList (
511 ACPI_OPERAND_OBJECT **ObjList);
512
513
514 /*
515 * uteval - object evaluation
516 */
517 ACPI_STATUS
518 AcpiUtEvaluateObject (
519 ACPI_NAMESPACE_NODE *PrefixNode,
520 const char *Path,
521 UINT32 ExpectedReturnBtypes,
522 ACPI_OPERAND_OBJECT **ReturnDesc);
523
524 ACPI_STATUS
525 AcpiUtEvaluateNumericObject (
526 const char *ObjectName,
527 ACPI_NAMESPACE_NODE *DeviceNode,
528 UINT64 *Value);
529
530 ACPI_STATUS
531 AcpiUtExecute_STA (
532 ACPI_NAMESPACE_NODE *DeviceNode,
533 UINT32 *StatusFlags);
534
535 ACPI_STATUS
536 AcpiUtExecutePowerMethods (
537 ACPI_NAMESPACE_NODE *DeviceNode,
538 const char **MethodNames,
539 UINT8 MethodCount,
540 UINT8 *OutValues);
541
542
543 /*
544 * utids - device ID support
545 */
546 ACPI_STATUS
547 AcpiUtExecute_HID (
548 ACPI_NAMESPACE_NODE *DeviceNode,
549 ACPI_PNP_DEVICE_ID **ReturnId);
550
551 ACPI_STATUS
552 AcpiUtExecute_UID (
553 ACPI_NAMESPACE_NODE *DeviceNode,
554 ACPI_PNP_DEVICE_ID **ReturnId);
555
556 ACPI_STATUS
557 AcpiUtExecute_CID (
558 ACPI_NAMESPACE_NODE *DeviceNode,
559 ACPI_PNP_DEVICE_ID_LIST **ReturnCidList);
560
561 ACPI_STATUS
562 AcpiUtExecute_CLS (
563 ACPI_NAMESPACE_NODE *DeviceNode,
564 ACPI_PNP_DEVICE_ID **ReturnId);
565
566
567 /*
568 * utlock - reader/writer locks
569 */
570 ACPI_STATUS
571 AcpiUtCreateRwLock (
572 ACPI_RW_LOCK *Lock);
573
574 void
575 AcpiUtDeleteRwLock (
576 ACPI_RW_LOCK *Lock);
577
578 ACPI_STATUS
579 AcpiUtAcquireReadLock (
580 ACPI_RW_LOCK *Lock);
581
582 ACPI_STATUS
583 AcpiUtReleaseReadLock (
584 ACPI_RW_LOCK *Lock);
585
586 ACPI_STATUS
587 AcpiUtAcquireWriteLock (
588 ACPI_RW_LOCK *Lock);
589
590 void
591 AcpiUtReleaseWriteLock (
592 ACPI_RW_LOCK *Lock);
593
594
595 /*
596 * utobject - internal object create/delete/cache routines
597 */
598 ACPI_OPERAND_OBJECT *
599 AcpiUtCreateInternalObjectDbg (
600 const char *ModuleName,
601 UINT32 LineNumber,
602 UINT32 ComponentId,
603 ACPI_OBJECT_TYPE Type);
604
605 void *
606 AcpiUtAllocateObjectDescDbg (
607 const char *ModuleName,
608 UINT32 LineNumber,
609 UINT32 ComponentId);
610
611 #define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
612 #define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
613
614 void
615 AcpiUtDeleteObjectDesc (
616 ACPI_OPERAND_OBJECT *Object);
617
618 BOOLEAN
619 AcpiUtValidInternalObject (
620 void *Object);
621
622 ACPI_OPERAND_OBJECT *
623 AcpiUtCreatePackageObject (
624 UINT32 Count);
625
626 ACPI_OPERAND_OBJECT *
627 AcpiUtCreateIntegerObject (
628 UINT64 Value);
629
630 ACPI_OPERAND_OBJECT *
631 AcpiUtCreateBufferObject (
632 ACPI_SIZE BufferSize);
633
634 ACPI_OPERAND_OBJECT *
635 AcpiUtCreateStringObject (
636 ACPI_SIZE StringSize);
637
638 ACPI_STATUS
639 AcpiUtGetObjectSize(
640 ACPI_OPERAND_OBJECT *Obj,
641 ACPI_SIZE *ObjLength);
642
643
644 /*
645 * utosi - Support for the _OSI predefined control method
646 */
647 ACPI_STATUS
648 AcpiUtInitializeInterfaces (
649 void);
650
651 ACPI_STATUS
652 AcpiUtInterfaceTerminate (
653 void);
654
655 ACPI_STATUS
656 AcpiUtInstallInterface (
657 ACPI_STRING InterfaceName);
658
659 ACPI_STATUS
660 AcpiUtRemoveInterface (
661 ACPI_STRING InterfaceName);
662
663 ACPI_STATUS
664 AcpiUtUpdateInterfaces (
665 UINT8 Action);
666
667 ACPI_INTERFACE_INFO *
668 AcpiUtGetInterface (
669 ACPI_STRING InterfaceName);
670
671 ACPI_STATUS
672 AcpiUtOsiImplementation (
673 ACPI_WALK_STATE *WalkState);
674
675
676 /*
677 * utpredef - support for predefined names
678 */
679 const ACPI_PREDEFINED_INFO *
680 AcpiUtGetNextPredefinedMethod (
681 const ACPI_PREDEFINED_INFO *ThisName);
682
683 const ACPI_PREDEFINED_INFO *
684 AcpiUtMatchPredefinedMethod (
685 char *Name);
686
687 void
688 AcpiUtGetExpectedReturnTypes (
689 char *Buffer,
690 UINT32 ExpectedBtypes);
691
692 #if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP)
693 const ACPI_PREDEFINED_INFO *
694 AcpiUtMatchResourceName (
695 char *Name);
696
697 void
698 AcpiUtDisplayPredefinedMethod (
699 char *Buffer,
700 const ACPI_PREDEFINED_INFO *ThisName,
701 BOOLEAN MultiLine);
702
703 UINT32
704 AcpiUtGetResourceBitWidth (
705 char *Buffer,
706 UINT16 Types);
707 #endif
708
709
710 /*
711 * utstate - Generic state creation/cache routines
712 */
713 void
714 AcpiUtPushGenericState (
715 ACPI_GENERIC_STATE **ListHead,
716 ACPI_GENERIC_STATE *State);
717
718 ACPI_GENERIC_STATE *
719 AcpiUtPopGenericState (
720 ACPI_GENERIC_STATE **ListHead);
721
722
723 ACPI_GENERIC_STATE *
724 AcpiUtCreateGenericState (
725 void);
726
727 ACPI_THREAD_STATE *
728 AcpiUtCreateThreadState (
729 void);
730
731 ACPI_GENERIC_STATE *
732 AcpiUtCreateUpdateState (
733 ACPI_OPERAND_OBJECT *Object,
734 UINT16 Action);
735
736 ACPI_GENERIC_STATE *
737 AcpiUtCreatePkgState (
738 void *InternalObject,
739 void *ExternalObject,
740 UINT32 Index);
741
742 ACPI_STATUS
743 AcpiUtCreateUpdateStateAndPush (
744 ACPI_OPERAND_OBJECT *Object,
745 UINT16 Action,
746 ACPI_GENERIC_STATE **StateList);
747
748 ACPI_GENERIC_STATE *
749 AcpiUtCreateControlState (
750 void);
751
752 void
753 AcpiUtDeleteGenericState (
754 ACPI_GENERIC_STATE *State);
755
756
757 /*
758 * utmath
759 */
760 ACPI_STATUS
761 AcpiUtDivide (
762 UINT64 InDividend,
763 UINT64 InDivisor,
764 UINT64 *OutQuotient,
765 UINT64 *OutRemainder);
766
767 ACPI_STATUS
768 AcpiUtShortDivide (
769 UINT64 InDividend,
770 UINT32 Divisor,
771 UINT64 *OutQuotient,
772 UINT32 *OutRemainder);
773
774 ACPI_STATUS
775 AcpiUtShortMultiply (
776 UINT64 InMultiplicand,
777 UINT32 Multiplier,
778 UINT64 *Outproduct);
779
780 ACPI_STATUS
781 AcpiUtShortShiftLeft (
782 UINT64 Operand,
783 UINT32 Count,
784 UINT64 *OutResult);
785
786 ACPI_STATUS
787 AcpiUtShortShiftRight (
788 UINT64 Operand,
789 UINT32 Count,
790 UINT64 *OutResult);
791
792
793 /*
794 * utmisc
795 */
796 const ACPI_EXCEPTION_INFO *
797 AcpiUtValidateException (
798 ACPI_STATUS Status);
799
800 BOOLEAN
801 AcpiUtIsPciRootBridge (
802 char *Id);
803
804 #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
805 BOOLEAN
806 AcpiUtIsAmlTable (
807 ACPI_TABLE_HEADER *Table);
808 #endif
809
810 ACPI_STATUS
811 AcpiUtWalkPackageTree (
812 ACPI_OPERAND_OBJECT *SourceObject,
813 void *TargetObject,
814 ACPI_PKG_CALLBACK WalkCallback,
815 void *Context);
816
817 /* Values for Base above (16=Hex, 10=Decimal) */
818
819 #define ACPI_ANY_BASE 0
820
821
822 UINT32
823 AcpiUtDwordByteSwap (
824 UINT32 Value);
825
826 void
827 AcpiUtSetIntegerWidth (
828 UINT8 Revision);
829
830 #ifdef ACPI_DEBUG_OUTPUT
831 void
832 AcpiUtDisplayInitPathname (
833 UINT8 Type,
834 ACPI_NAMESPACE_NODE *ObjHandle,
835 const char *Path);
836 #endif
837
838
839 /*
840 * utownerid - Support for Table/Method Owner IDs
841 */
842 ACPI_STATUS
843 AcpiUtAllocateOwnerId (
844 ACPI_OWNER_ID *OwnerId);
845
846 void
847 AcpiUtReleaseOwnerId (
848 ACPI_OWNER_ID *OwnerId);
849
850
851 /*
852 * utresrc
853 */
854 ACPI_STATUS
855 AcpiUtWalkAmlResources (
856 ACPI_WALK_STATE *WalkState,
857 UINT8 *Aml,
858 ACPI_SIZE AmlLength,
859 ACPI_WALK_AML_CALLBACK UserFunction,
860 void **Context);
861
862 ACPI_STATUS
863 AcpiUtValidateResource (
864 ACPI_WALK_STATE *WalkState,
865 void *Aml,
866 UINT8 *ReturnIndex);
867
868 UINT32
869 AcpiUtGetDescriptorLength (
870 void *Aml);
871
872 UINT16
873 AcpiUtGetResourceLength (
874 void *Aml);
875
876 UINT8
877 AcpiUtGetResourceHeaderLength (
878 void *Aml);
879
880 UINT8
881 AcpiUtGetResourceType (
882 void *Aml);
883
884 ACPI_STATUS
885 AcpiUtGetResourceEndTag (
886 ACPI_OPERAND_OBJECT *ObjDesc,
887 UINT8 **EndTag);
888
889
890 /*
891 * utstring - String and character utilities
892 */
893 void
894 AcpiUtPrintString (
895 char *String,
896 UINT16 MaxLength);
897
898 #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
899 void
900 UtConvertBackslashes (
901 char *Pathname);
902 #endif
903
904 void
905 AcpiUtRepairName (
906 char *Name);
907
908 #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
909 BOOLEAN
910 AcpiUtSafeStrcpy (
911 char *Dest,
912 ACPI_SIZE DestSize,
913 char *Source);
914
915 BOOLEAN
916 AcpiUtSafeStrcat (
917 char *Dest,
918 ACPI_SIZE DestSize,
919 char *Source);
920
921 BOOLEAN
922 AcpiUtSafeStrncat (
923 char *Dest,
924 ACPI_SIZE DestSize,
925 char *Source,
926 ACPI_SIZE MaxTransferLength);
927 #endif
928
929
930 /*
931 * utmutex - mutex support
932 */
933 ACPI_STATUS
934 AcpiUtMutexInitialize (
935 void);
936
937 void
938 AcpiUtMutexTerminate (
939 void);
940
941 ACPI_STATUS
942 AcpiUtAcquireMutex (
943 ACPI_MUTEX_HANDLE MutexId);
944
945 ACPI_STATUS
946 AcpiUtReleaseMutex (
947 ACPI_MUTEX_HANDLE MutexId);
948
949
950 /*
951 * utalloc - memory allocation and object caching
952 */
953 ACPI_STATUS
954 AcpiUtCreateCaches (
955 void);
956
957 ACPI_STATUS
958 AcpiUtDeleteCaches (
959 void);
960
961 ACPI_STATUS
962 AcpiUtValidateBuffer (
963 ACPI_BUFFER *Buffer);
964
965 ACPI_STATUS
966 AcpiUtInitializeBuffer (
967 ACPI_BUFFER *Buffer,
968 ACPI_SIZE RequiredLength);
969
970 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
971 void *
972 AcpiUtAllocateAndTrack (
973 ACPI_SIZE Size,
974 UINT32 Component,
975 const char *Module,
976 UINT32 Line);
977
978 void *
979 AcpiUtAllocateZeroedAndTrack (
980 ACPI_SIZE Size,
981 UINT32 Component,
982 const char *Module,
983 UINT32 Line);
984
985 void
986 AcpiUtFreeAndTrack (
987 void *Address,
988 UINT32 Component,
989 const char *Module,
990 UINT32 Line);
991
992 void
993 AcpiUtDumpAllocationInfo (
994 void);
995
996 void
997 AcpiUtDumpAllocations (
998 UINT32 Component,
999 const char *Module);
1000
1001 ACPI_STATUS
1002 AcpiUtCreateList (
1003 const char *ListName,
1004 UINT16 ObjectSize,
1005 ACPI_MEMORY_LIST **ReturnCache);
1006
1007 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
1008
1009
1010 /*
1011 * utaddress - address range check
1012 */
1013 ACPI_STATUS
1014 AcpiUtAddAddressRange (
1015 ACPI_ADR_SPACE_TYPE SpaceId,
1016 ACPI_PHYSICAL_ADDRESS Address,
1017 UINT32 Length,
1018 ACPI_NAMESPACE_NODE *RegionNode);
1019
1020 void
1021 AcpiUtRemoveAddressRange (
1022 ACPI_ADR_SPACE_TYPE SpaceId,
1023 ACPI_NAMESPACE_NODE *RegionNode);
1024
1025 UINT32
1026 AcpiUtCheckAddressRange (
1027 ACPI_ADR_SPACE_TYPE SpaceId,
1028 ACPI_PHYSICAL_ADDRESS Address,
1029 UINT32 Length,
1030 BOOLEAN Warn);
1031
1032 void
1033 AcpiUtDeleteAddressLists (
1034 void);
1035
1036
1037 /*
1038 * utxferror - various error/warning output functions
1039 */
1040 void ACPI_INTERNAL_VAR_XFACE
1041 AcpiUtPredefinedWarning (
1042 const char *ModuleName,
1043 UINT32 LineNumber,
1044 char *Pathname,
1045 UINT8 NodeFlags,
1046 const char *Format,
1047 ...);
1048
1049 void ACPI_INTERNAL_VAR_XFACE
1050 AcpiUtPredefinedInfo (
1051 const char *ModuleName,
1052 UINT32 LineNumber,
1053 char *Pathname,
1054 UINT8 NodeFlags,
1055 const char *Format,
1056 ...);
1057
1058 void ACPI_INTERNAL_VAR_XFACE
1059 AcpiUtPredefinedBiosError (
1060 const char *ModuleName,
1061 UINT32 LineNumber,
1062 char *Pathname,
1063 UINT8 NodeFlags,
1064 const char *Format,
1065 ...);
1066
1067 void
1068 AcpiUtNamespaceError (
1069 const char *ModuleName,
1070 UINT32 LineNumber,
1071 const char *InternalName,
1072 ACPI_STATUS LookupStatus);
1073
1074 void
1075 AcpiUtMethodError (
1076 const char *ModuleName,
1077 UINT32 LineNumber,
1078 const char *Message,
1079 ACPI_NAMESPACE_NODE *Node,
1080 const char *Path,
1081 ACPI_STATUS LookupStatus);
1082
1083
1084 /*
1085 * Utility functions for ACPI names and IDs
1086 */
1087 const AH_PREDEFINED_NAME *
1088 AcpiAhMatchPredefinedName (
1089 char *Nameseg);
1090
1091 const AH_DEVICE_ID *
1092 AcpiAhMatchHardwareId (
1093 char *Hid);
1094
1095 const char *
1096 AcpiAhMatchUuid (
1097 UINT8 *Data);
1098
1099
1100 /*
1101 * utuuid -- UUID support functions
1102 */
1103 #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP)
1104 void
1105 AcpiUtConvertStringToUuid (
1106 char *InString,
1107 UINT8 *UuidBuffer);
1108 #endif
1109
1110 #endif /* _ACUTILS_H */