1 /******************************************************************************
2 *
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2011, 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
50 /* Strings used by the disassembler and debugger resource dump routines */
51
52 #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
53
54 extern const char *AcpiGbl_BmDecode[];
55 extern const char *AcpiGbl_ConfigDecode[];
56 extern const char *AcpiGbl_ConsumeDecode[];
57 extern const char *AcpiGbl_DecDecode[];
58 extern const char *AcpiGbl_HeDecode[];
59 extern const char *AcpiGbl_IoDecode[];
60 extern const char *AcpiGbl_LlDecode[];
61 extern const char *AcpiGbl_MaxDecode[];
62 extern const char *AcpiGbl_MemDecode[];
63 extern const char *AcpiGbl_MinDecode[];
64 extern const char *AcpiGbl_MtpDecode[];
65 extern const char *AcpiGbl_RngDecode[];
66 extern const char *AcpiGbl_RwDecode[];
67 extern const char *AcpiGbl_ShrDecode[];
68 extern const char *AcpiGbl_SizDecode[];
69 extern const char *AcpiGbl_TrsDecode[];
70 extern const char *AcpiGbl_TtpDecode[];
71 extern const char *AcpiGbl_TypDecode[];
72 #endif
73
74 /* Types for Resource descriptor entries */
75
76 #define ACPI_INVALID_RESOURCE 0
77 #define ACPI_FIXED_LENGTH 1
78 #define ACPI_VARIABLE_LENGTH 2
79 #define ACPI_SMALL_VARIABLE_LENGTH 3
80
81 typedef
82 ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
83 UINT8 *Aml,
84 UINT32 Length,
85 UINT32 Offset,
86 UINT8 ResourceIndex,
87 void *Context);
88
89 typedef
90 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
91 UINT8 ObjectType,
92 ACPI_OPERAND_OBJECT *SourceObject,
93 ACPI_GENERIC_STATE *State,
94 void *Context);
95
96 typedef struct acpi_pkg_info
97 {
98 UINT8 *FreeSpace;
99 ACPI_SIZE Length;
100 UINT32 ObjectSpace;
101 UINT32 NumPackages;
102
103 } ACPI_PKG_INFO;
104
105 #define REF_INCREMENT (UINT16) 0
106 #define REF_DECREMENT (UINT16) 1
107 #define REF_FORCE_DELETE (UINT16) 2
108
109 /* AcpiUtDumpBuffer */
110
111 #define DB_BYTE_DISPLAY 1
112 #define DB_WORD_DISPLAY 2
113 #define DB_DWORD_DISPLAY 4
114 #define DB_QWORD_DISPLAY 8
115
116
117 /*
118 * utglobal - Global data structures and procedures
119 */
120 ACPI_STATUS
121 AcpiUtInitGlobals (
122 void);
123
124 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
125
126 char *
127 AcpiUtGetMutexName (
128 UINT32 MutexId);
129
130 const char *
131 AcpiUtGetNotifyName (
132 UINT32 NotifyValue);
133
134 #endif
135
136 char *
392 UINT32 ComponentId,
393 ACPI_STATUS Status);
394
395 void
396 AcpiUtValueExit (
397 UINT32 LineNumber,
398 const char *FunctionName,
399 const char *ModuleName,
400 UINT32 ComponentId,
401 UINT64 Value);
402
403 void
404 AcpiUtPtrExit (
405 UINT32 LineNumber,
406 const char *FunctionName,
407 const char *ModuleName,
408 UINT32 ComponentId,
409 UINT8 *Ptr);
410
411 void
412 AcpiUtDumpBuffer (
413 UINT8 *Buffer,
414 UINT32 Count,
415 UINT32 Display,
416 UINT32 componentId);
417
418 void
419 AcpiUtDumpBuffer2 (
420 UINT8 *Buffer,
421 UINT32 Count,
422 UINT32 Display);
423
424 void
425 AcpiUtReportError (
426 char *ModuleName,
427 UINT32 LineNumber);
428
429 void
430 AcpiUtReportInfo (
431 char *ModuleName,
432 UINT32 LineNumber);
433
434 void
435 AcpiUtReportWarning (
436 char *ModuleName,
437 UINT32 LineNumber);
438
439 /*
440 * utdelete - Object deletion and reference counts
441 */
442 void
478
479 ACPI_STATUS
480 AcpiUtExecute_STA (
481 ACPI_NAMESPACE_NODE *DeviceNode,
482 UINT32 *StatusFlags);
483
484 ACPI_STATUS
485 AcpiUtExecutePowerMethods (
486 ACPI_NAMESPACE_NODE *DeviceNode,
487 const char **MethodNames,
488 UINT8 MethodCount,
489 UINT8 *OutValues);
490
491
492 /*
493 * utids - device ID support
494 */
495 ACPI_STATUS
496 AcpiUtExecute_HID (
497 ACPI_NAMESPACE_NODE *DeviceNode,
498 ACPI_DEVICE_ID **ReturnId);
499
500 ACPI_STATUS
501 AcpiUtExecute_UID (
502 ACPI_NAMESPACE_NODE *DeviceNode,
503 ACPI_DEVICE_ID **ReturnId);
504
505 ACPI_STATUS
506 AcpiUtExecute_CID (
507 ACPI_NAMESPACE_NODE *DeviceNode,
508 ACPI_DEVICE_ID_LIST **ReturnCidList);
509
510
511 /*
512 * utlock - reader/writer locks
513 */
514 ACPI_STATUS
515 AcpiUtCreateRwLock (
516 ACPI_RW_LOCK *Lock);
517
518 void
519 AcpiUtDeleteRwLock (
520 ACPI_RW_LOCK *Lock);
521
522 ACPI_STATUS
523 AcpiUtAcquireReadLock (
524 ACPI_RW_LOCK *Lock);
525
526 ACPI_STATUS
527 AcpiUtReleaseReadLock (
528 ACPI_RW_LOCK *Lock);
575 AcpiUtCreateBufferObject (
576 ACPI_SIZE BufferSize);
577
578 ACPI_OPERAND_OBJECT *
579 AcpiUtCreateStringObject (
580 ACPI_SIZE StringSize);
581
582 ACPI_STATUS
583 AcpiUtGetObjectSize(
584 ACPI_OPERAND_OBJECT *Obj,
585 ACPI_SIZE *ObjLength);
586
587
588 /*
589 * utosi - Support for the _OSI predefined control method
590 */
591 ACPI_STATUS
592 AcpiUtInitializeInterfaces (
593 void);
594
595 void
596 AcpiUtInterfaceTerminate (
597 void);
598
599 ACPI_STATUS
600 AcpiUtInstallInterface (
601 ACPI_STRING InterfaceName);
602
603 ACPI_STATUS
604 AcpiUtRemoveInterface (
605 ACPI_STRING InterfaceName);
606
607 ACPI_INTERFACE_INFO *
608 AcpiUtGetInterface (
609 ACPI_STRING InterfaceName);
610
611 ACPI_STATUS
612 AcpiUtOsiImplementation (
613 ACPI_WALK_STATE *WalkState);
614
615
616 /*
617 * utstate - Generic state creation/cache routines
618 */
619 void
620 AcpiUtPushGenericState (
621 ACPI_GENERIC_STATE **ListHead,
622 ACPI_GENERIC_STATE *State);
623
624 ACPI_GENERIC_STATE *
625 AcpiUtPopGenericState (
626 ACPI_GENERIC_STATE **ListHead);
627
628
629 ACPI_GENERIC_STATE *
630 AcpiUtCreateGenericState (
631 void);
632
633 ACPI_THREAD_STATE *
634 AcpiUtCreateThreadState (
635 void);
636
667 ACPI_GENERIC_STATE *State);
668
669
670 /*
671 * utmath
672 */
673 ACPI_STATUS
674 AcpiUtDivide (
675 UINT64 InDividend,
676 UINT64 InDivisor,
677 UINT64 *OutQuotient,
678 UINT64 *OutRemainder);
679
680 ACPI_STATUS
681 AcpiUtShortDivide (
682 UINT64 InDividend,
683 UINT32 Divisor,
684 UINT64 *OutQuotient,
685 UINT32 *OutRemainder);
686
687 /*
688 * utmisc
689 */
690 const char *
691 AcpiUtValidateException (
692 ACPI_STATUS Status);
693
694 BOOLEAN
695 AcpiUtIsPciRootBridge (
696 char *Id);
697
698 BOOLEAN
699 AcpiUtIsAmlTable (
700 ACPI_TABLE_HEADER *Table);
701
702 ACPI_STATUS
703 AcpiUtAllocateOwnerId (
704 ACPI_OWNER_ID *OwnerId);
705
706 void
707 AcpiUtReleaseOwnerId (
708 ACPI_OWNER_ID *OwnerId);
709
710 ACPI_STATUS
711 AcpiUtWalkPackageTree (
712 ACPI_OPERAND_OBJECT *SourceObject,
713 void *TargetObject,
714 ACPI_PKG_CALLBACK WalkCallback,
715 void *Context);
716
717 void
718 AcpiUtStrupr (
719 char *SrcString);
720
721 void
722 AcpiUtStrlwr (
723 char *SrcString);
724
725 void
726 AcpiUtPrintString (
727 char *String,
728 UINT8 MaxLength);
729
730 BOOLEAN
731 AcpiUtValidAcpiName (
732 UINT32 Name);
733
734 void
735 AcpiUtRepairName (
736 char *Name);
737
738 BOOLEAN
739 AcpiUtValidAcpiChar (
740 char Character,
741 UINT32 Position);
742
743 ACPI_STATUS
744 AcpiUtStrtoul64 (
745 char *String,
746 UINT32 Base,
747 UINT64 *RetInteger);
748
749 /* Values for Base above (16=Hex, 10=Decimal) */
750
751 #define ACPI_ANY_BASE 0
752
753 UINT32
754 AcpiUtDwordByteSwap (
755 UINT32 Value);
756
757 void
758 AcpiUtSetIntegerWidth (
759 UINT8 Revision);
760
761 #ifdef ACPI_DEBUG_OUTPUT
762 void
763 AcpiUtDisplayInitPathname (
764 UINT8 Type,
765 ACPI_NAMESPACE_NODE *ObjHandle,
766 char *Path);
767 #endif
768
769
770 /*
771 * utresrc
772 */
773 ACPI_STATUS
774 AcpiUtWalkAmlResources (
775 UINT8 *Aml,
776 ACPI_SIZE AmlLength,
777 ACPI_WALK_AML_CALLBACK UserFunction,
778 void *Context);
779
780 ACPI_STATUS
781 AcpiUtValidateResource (
782 void *Aml,
783 UINT8 *ReturnIndex);
784
785 UINT32
786 AcpiUtGetDescriptorLength (
787 void *Aml);
788
789 UINT16
790 AcpiUtGetResourceLength (
791 void *Aml);
792
793 UINT8
794 AcpiUtGetResourceHeaderLength (
795 void *Aml);
796
797 UINT8
798 AcpiUtGetResourceType (
799 void *Aml);
800
801 ACPI_STATUS
802 AcpiUtGetResourceEndTag (
803 ACPI_OPERAND_OBJECT *ObjDesc,
804 UINT8 **EndTag);
805
806
807 /*
808 * utmutex - mutex support
809 */
810 ACPI_STATUS
811 AcpiUtMutexInitialize (
812 void);
813
814 void
815 AcpiUtMutexTerminate (
816 void);
817
818 ACPI_STATUS
819 AcpiUtAcquireMutex (
820 ACPI_MUTEX_HANDLE MutexId);
821
822 ACPI_STATUS
823 AcpiUtReleaseMutex (
824 ACPI_MUTEX_HANDLE MutexId);
825
826
827 /*
828 * utalloc - memory allocation and object caching
829 */
830 ACPI_STATUS
831 AcpiUtCreateCaches (
832 void);
833
834 ACPI_STATUS
835 AcpiUtDeleteCaches (
836 void);
837
838 ACPI_STATUS
839 AcpiUtValidateBuffer (
840 ACPI_BUFFER *Buffer);
841
842 ACPI_STATUS
843 AcpiUtInitializeBuffer (
844 ACPI_BUFFER *Buffer,
845 ACPI_SIZE RequiredLength);
846
847 void *
848 AcpiUtAllocate (
849 ACPI_SIZE Size,
850 UINT32 Component,
851 const char *Module,
852 UINT32 Line);
853
854 void *
855 AcpiUtAllocateZeroed (
856 ACPI_SIZE Size,
857 UINT32 Component,
858 const char *Module,
859 UINT32 Line);
860
861 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
862 void *
863 AcpiUtAllocateAndTrack (
864 ACPI_SIZE Size,
865 UINT32 Component,
866 const char *Module,
867 UINT32 Line);
868
869 void *
870 AcpiUtAllocateZeroedAndTrack (
871 ACPI_SIZE Size,
872 UINT32 Component,
873 const char *Module,
874 UINT32 Line);
875
876 void
877 AcpiUtFreeAndTrack (
878 void *Address,
879 UINT32 Component,
880 const char *Module,
881 UINT32 Line);
882
883 void
884 AcpiUtDumpAllocationInfo (
885 void);
886
887 void
888 AcpiUtDumpAllocations (
889 UINT32 Component,
890 const char *Module);
891
892 ACPI_STATUS
893 AcpiUtCreateList (
894 char *ListName,
895 UINT16 ObjectSize,
896 ACPI_MEMORY_LIST **ReturnCache);
897
898 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
899
900
901 /*
902 * utxferror - various error/warning output functions
903 */
904 void ACPI_INTERNAL_VAR_XFACE
905 AcpiUtPredefinedWarning (
906 const char *ModuleName,
907 UINT32 LineNumber,
908 char *Pathname,
909 UINT8 NodeFlags,
910 const char *Format,
911 ...);
912
913 void ACPI_INTERNAL_VAR_XFACE
914 AcpiUtPredefinedInfo (
915 const char *ModuleName,
916 UINT32 LineNumber,
917 char *Pathname,
918 UINT8 NodeFlags,
919 const char *Format,
920 ...);
921
922 void
923 AcpiUtNamespaceError (
924 const char *ModuleName,
925 UINT32 LineNumber,
926 const char *InternalName,
927 ACPI_STATUS LookupStatus);
928
929 void
930 AcpiUtMethodError (
931 const char *ModuleName,
932 UINT32 LineNumber,
933 const char *Message,
934 ACPI_NAMESPACE_NODE *Node,
935 const char *Path,
936 ACPI_STATUS LookupStatus);
|
1 /******************************************************************************
2 *
3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2014, 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 #endif
90
91 /*
92 * For the iASL compiler case, the output is redirected to stderr so that
93 * any of the various ACPI errors and warnings do not appear in the output
94 * files, for either the compiler or disassembler portions of the tool.
95 */
96 #ifdef ACPI_ASL_COMPILER
97
98 #include <stdio.h>
99 extern FILE *AcpiGbl_OutputFile;
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 #define ACPI_MSG_ERROR "ACPI Error: "
120 #define ACPI_MSG_EXCEPTION "ACPI Exception: "
121 #define ACPI_MSG_WARNING "ACPI Warning: "
122 #define ACPI_MSG_INFO "ACPI: "
123
124 #define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): "
125 #define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): "
126
127 /*
128 * Common message suffix
129 */
130 #define ACPI_MSG_SUFFIX \
131 AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber)
132
133
134 /* Types for Resource descriptor entries */
135
136 #define ACPI_INVALID_RESOURCE 0
137 #define ACPI_FIXED_LENGTH 1
138 #define ACPI_VARIABLE_LENGTH 2
139 #define ACPI_SMALL_VARIABLE_LENGTH 3
140
141 typedef
142 ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
143 UINT8 *Aml,
144 UINT32 Length,
145 UINT32 Offset,
146 UINT8 ResourceIndex,
147 void **Context);
148
149 typedef
150 ACPI_STATUS (*ACPI_PKG_CALLBACK) (
151 UINT8 ObjectType,
152 ACPI_OPERAND_OBJECT *SourceObject,
153 ACPI_GENERIC_STATE *State,
154 void *Context);
155
156 typedef struct acpi_pkg_info
157 {
158 UINT8 *FreeSpace;
159 ACPI_SIZE Length;
160 UINT32 ObjectSpace;
161 UINT32 NumPackages;
162
163 } ACPI_PKG_INFO;
164
165 /* Object reference counts */
166
167 #define REF_INCREMENT (UINT16) 0
168 #define REF_DECREMENT (UINT16) 1
169
170 /* AcpiUtDumpBuffer */
171
172 #define DB_BYTE_DISPLAY 1
173 #define DB_WORD_DISPLAY 2
174 #define DB_DWORD_DISPLAY 4
175 #define DB_QWORD_DISPLAY 8
176
177 /*
178 * utglobal - Global data structures and procedures
179 */
180 ACPI_STATUS
181 AcpiUtInitGlobals (
182 void);
183
184 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
185
186 char *
187 AcpiUtGetMutexName (
188 UINT32 MutexId);
189
190 const char *
191 AcpiUtGetNotifyName (
192 UINT32 NotifyValue);
193
194 #endif
195
196 char *
452 UINT32 ComponentId,
453 ACPI_STATUS Status);
454
455 void
456 AcpiUtValueExit (
457 UINT32 LineNumber,
458 const char *FunctionName,
459 const char *ModuleName,
460 UINT32 ComponentId,
461 UINT64 Value);
462
463 void
464 AcpiUtPtrExit (
465 UINT32 LineNumber,
466 const char *FunctionName,
467 const char *ModuleName,
468 UINT32 ComponentId,
469 UINT8 *Ptr);
470
471 void
472 AcpiUtDebugDumpBuffer (
473 UINT8 *Buffer,
474 UINT32 Count,
475 UINT32 Display,
476 UINT32 ComponentId);
477
478 void
479 AcpiUtDumpBuffer (
480 UINT8 *Buffer,
481 UINT32 Count,
482 UINT32 Display,
483 UINT32 Offset);
484
485 void
486 AcpiUtReportError (
487 char *ModuleName,
488 UINT32 LineNumber);
489
490 void
491 AcpiUtReportInfo (
492 char *ModuleName,
493 UINT32 LineNumber);
494
495 void
496 AcpiUtReportWarning (
497 char *ModuleName,
498 UINT32 LineNumber);
499
500 /*
501 * utdelete - Object deletion and reference counts
502 */
503 void
539
540 ACPI_STATUS
541 AcpiUtExecute_STA (
542 ACPI_NAMESPACE_NODE *DeviceNode,
543 UINT32 *StatusFlags);
544
545 ACPI_STATUS
546 AcpiUtExecutePowerMethods (
547 ACPI_NAMESPACE_NODE *DeviceNode,
548 const char **MethodNames,
549 UINT8 MethodCount,
550 UINT8 *OutValues);
551
552
553 /*
554 * utids - device ID support
555 */
556 ACPI_STATUS
557 AcpiUtExecute_HID (
558 ACPI_NAMESPACE_NODE *DeviceNode,
559 ACPI_PNP_DEVICE_ID **ReturnId);
560
561 ACPI_STATUS
562 AcpiUtExecute_UID (
563 ACPI_NAMESPACE_NODE *DeviceNode,
564 ACPI_PNP_DEVICE_ID **ReturnId);
565
566 ACPI_STATUS
567 AcpiUtExecute_SUB (
568 ACPI_NAMESPACE_NODE *DeviceNode,
569 ACPI_PNP_DEVICE_ID **ReturnId);
570
571 ACPI_STATUS
572 AcpiUtExecute_CID (
573 ACPI_NAMESPACE_NODE *DeviceNode,
574 ACPI_PNP_DEVICE_ID_LIST **ReturnCidList);
575
576
577 /*
578 * utlock - reader/writer locks
579 */
580 ACPI_STATUS
581 AcpiUtCreateRwLock (
582 ACPI_RW_LOCK *Lock);
583
584 void
585 AcpiUtDeleteRwLock (
586 ACPI_RW_LOCK *Lock);
587
588 ACPI_STATUS
589 AcpiUtAcquireReadLock (
590 ACPI_RW_LOCK *Lock);
591
592 ACPI_STATUS
593 AcpiUtReleaseReadLock (
594 ACPI_RW_LOCK *Lock);
641 AcpiUtCreateBufferObject (
642 ACPI_SIZE BufferSize);
643
644 ACPI_OPERAND_OBJECT *
645 AcpiUtCreateStringObject (
646 ACPI_SIZE StringSize);
647
648 ACPI_STATUS
649 AcpiUtGetObjectSize(
650 ACPI_OPERAND_OBJECT *Obj,
651 ACPI_SIZE *ObjLength);
652
653
654 /*
655 * utosi - Support for the _OSI predefined control method
656 */
657 ACPI_STATUS
658 AcpiUtInitializeInterfaces (
659 void);
660
661 ACPI_STATUS
662 AcpiUtInterfaceTerminate (
663 void);
664
665 ACPI_STATUS
666 AcpiUtInstallInterface (
667 ACPI_STRING InterfaceName);
668
669 ACPI_STATUS
670 AcpiUtRemoveInterface (
671 ACPI_STRING InterfaceName);
672
673 ACPI_STATUS
674 AcpiUtUpdateInterfaces (
675 UINT8 Action);
676
677 ACPI_INTERFACE_INFO *
678 AcpiUtGetInterface (
679 ACPI_STRING InterfaceName);
680
681 ACPI_STATUS
682 AcpiUtOsiImplementation (
683 ACPI_WALK_STATE *WalkState);
684
685
686 /*
687 * utpredef - support for predefined names
688 */
689 const ACPI_PREDEFINED_INFO *
690 AcpiUtGetNextPredefinedMethod (
691 const ACPI_PREDEFINED_INFO *ThisName);
692
693 const ACPI_PREDEFINED_INFO *
694 AcpiUtMatchPredefinedMethod (
695 char *Name);
696
697 const ACPI_PREDEFINED_INFO *
698 AcpiUtMatchResourceName (
699 char *Name);
700
701 void
702 AcpiUtDisplayPredefinedMethod (
703 char *Buffer,
704 const ACPI_PREDEFINED_INFO *ThisName,
705 BOOLEAN MultiLine);
706
707 void
708 AcpiUtGetExpectedReturnTypes (
709 char *Buffer,
710 UINT32 ExpectedBtypes);
711
712 UINT32
713 AcpiUtGetResourceBitWidth (
714 char *Buffer,
715 UINT16 Types);
716
717
718 /*
719 * utstate - Generic state creation/cache routines
720 */
721 void
722 AcpiUtPushGenericState (
723 ACPI_GENERIC_STATE **ListHead,
724 ACPI_GENERIC_STATE *State);
725
726 ACPI_GENERIC_STATE *
727 AcpiUtPopGenericState (
728 ACPI_GENERIC_STATE **ListHead);
729
730
731 ACPI_GENERIC_STATE *
732 AcpiUtCreateGenericState (
733 void);
734
735 ACPI_THREAD_STATE *
736 AcpiUtCreateThreadState (
737 void);
738
769 ACPI_GENERIC_STATE *State);
770
771
772 /*
773 * utmath
774 */
775 ACPI_STATUS
776 AcpiUtDivide (
777 UINT64 InDividend,
778 UINT64 InDivisor,
779 UINT64 *OutQuotient,
780 UINT64 *OutRemainder);
781
782 ACPI_STATUS
783 AcpiUtShortDivide (
784 UINT64 InDividend,
785 UINT32 Divisor,
786 UINT64 *OutQuotient,
787 UINT32 *OutRemainder);
788
789
790 /*
791 * utmisc
792 */
793 const ACPI_EXCEPTION_INFO *
794 AcpiUtValidateException (
795 ACPI_STATUS Status);
796
797 BOOLEAN
798 AcpiUtIsPciRootBridge (
799 char *Id);
800
801 BOOLEAN
802 AcpiUtIsAmlTable (
803 ACPI_TABLE_HEADER *Table);
804
805 ACPI_STATUS
806 AcpiUtWalkPackageTree (
807 ACPI_OPERAND_OBJECT *SourceObject,
808 void *TargetObject,
809 ACPI_PKG_CALLBACK WalkCallback,
810 void *Context);
811
812
813 /* Values for Base above (16=Hex, 10=Decimal) */
814
815 #define ACPI_ANY_BASE 0
816
817 UINT32
818 AcpiUtDwordByteSwap (
819 UINT32 Value);
820
821 void
822 AcpiUtSetIntegerWidth (
823 UINT8 Revision);
824
825 #ifdef ACPI_DEBUG_OUTPUT
826 void
827 AcpiUtDisplayInitPathname (
828 UINT8 Type,
829 ACPI_NAMESPACE_NODE *ObjHandle,
830 char *Path);
831 #endif
832
833
834 /*
835 * utownerid - Support for Table/Method Owner IDs
836 */
837 ACPI_STATUS
838 AcpiUtAllocateOwnerId (
839 ACPI_OWNER_ID *OwnerId);
840
841 void
842 AcpiUtReleaseOwnerId (
843 ACPI_OWNER_ID *OwnerId);
844
845
846 /*
847 * utresrc
848 */
849 ACPI_STATUS
850 AcpiUtWalkAmlResources (
851 ACPI_WALK_STATE *WalkState,
852 UINT8 *Aml,
853 ACPI_SIZE AmlLength,
854 ACPI_WALK_AML_CALLBACK UserFunction,
855 void **Context);
856
857 ACPI_STATUS
858 AcpiUtValidateResource (
859 ACPI_WALK_STATE *WalkState,
860 void *Aml,
861 UINT8 *ReturnIndex);
862
863 UINT32
864 AcpiUtGetDescriptorLength (
865 void *Aml);
866
867 UINT16
868 AcpiUtGetResourceLength (
869 void *Aml);
870
871 UINT8
872 AcpiUtGetResourceHeaderLength (
873 void *Aml);
874
875 UINT8
876 AcpiUtGetResourceType (
877 void *Aml);
878
879 ACPI_STATUS
880 AcpiUtGetResourceEndTag (
881 ACPI_OPERAND_OBJECT *ObjDesc,
882 UINT8 **EndTag);
883
884
885 /*
886 * utstring - String and character utilities
887 */
888 void
889 AcpiUtStrupr (
890 char *SrcString);
891
892 void
893 AcpiUtStrlwr (
894 char *SrcString);
895
896 int
897 AcpiUtStricmp (
898 char *String1,
899 char *String2);
900
901 ACPI_STATUS
902 AcpiUtStrtoul64 (
903 char *String,
904 UINT32 Base,
905 UINT64 *RetInteger);
906
907 void
908 AcpiUtPrintString (
909 char *String,
910 UINT16 MaxLength);
911
912 void
913 UtConvertBackslashes (
914 char *Pathname);
915
916 BOOLEAN
917 AcpiUtValidAcpiName (
918 char *Name);
919
920 BOOLEAN
921 AcpiUtValidAcpiChar (
922 char Character,
923 UINT32 Position);
924
925 void
926 AcpiUtRepairName (
927 char *Name);
928
929 #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
930 BOOLEAN
931 AcpiUtSafeStrcpy (
932 char *Dest,
933 ACPI_SIZE DestSize,
934 char *Source);
935
936 BOOLEAN
937 AcpiUtSafeStrcat (
938 char *Dest,
939 ACPI_SIZE DestSize,
940 char *Source);
941
942 BOOLEAN
943 AcpiUtSafeStrncat (
944 char *Dest,
945 ACPI_SIZE DestSize,
946 char *Source,
947 ACPI_SIZE MaxTransferLength);
948 #endif
949
950
951 /*
952 * utmutex - mutex support
953 */
954 ACPI_STATUS
955 AcpiUtMutexInitialize (
956 void);
957
958 void
959 AcpiUtMutexTerminate (
960 void);
961
962 ACPI_STATUS
963 AcpiUtAcquireMutex (
964 ACPI_MUTEX_HANDLE MutexId);
965
966 ACPI_STATUS
967 AcpiUtReleaseMutex (
968 ACPI_MUTEX_HANDLE MutexId);
969
970
971 /*
972 * utalloc - memory allocation and object caching
973 */
974 ACPI_STATUS
975 AcpiUtCreateCaches (
976 void);
977
978 ACPI_STATUS
979 AcpiUtDeleteCaches (
980 void);
981
982 ACPI_STATUS
983 AcpiUtValidateBuffer (
984 ACPI_BUFFER *Buffer);
985
986 ACPI_STATUS
987 AcpiUtInitializeBuffer (
988 ACPI_BUFFER *Buffer,
989 ACPI_SIZE RequiredLength);
990
991 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
992 void *
993 AcpiUtAllocateAndTrack (
994 ACPI_SIZE Size,
995 UINT32 Component,
996 const char *Module,
997 UINT32 Line);
998
999 void *
1000 AcpiUtAllocateZeroedAndTrack (
1001 ACPI_SIZE Size,
1002 UINT32 Component,
1003 const char *Module,
1004 UINT32 Line);
1005
1006 void
1007 AcpiUtFreeAndTrack (
1008 void *Address,
1009 UINT32 Component,
1010 const char *Module,
1011 UINT32 Line);
1012
1013 void
1014 AcpiUtDumpAllocationInfo (
1015 void);
1016
1017 void
1018 AcpiUtDumpAllocations (
1019 UINT32 Component,
1020 const char *Module);
1021
1022 ACPI_STATUS
1023 AcpiUtCreateList (
1024 char *ListName,
1025 UINT16 ObjectSize,
1026 ACPI_MEMORY_LIST **ReturnCache);
1027
1028 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
1029
1030 /*
1031 * utaddress - address range check
1032 */
1033 ACPI_STATUS
1034 AcpiUtAddAddressRange (
1035 ACPI_ADR_SPACE_TYPE SpaceId,
1036 ACPI_PHYSICAL_ADDRESS Address,
1037 UINT32 Length,
1038 ACPI_NAMESPACE_NODE *RegionNode);
1039
1040 void
1041 AcpiUtRemoveAddressRange (
1042 ACPI_ADR_SPACE_TYPE SpaceId,
1043 ACPI_NAMESPACE_NODE *RegionNode);
1044
1045 UINT32
1046 AcpiUtCheckAddressRange (
1047 ACPI_ADR_SPACE_TYPE SpaceId,
1048 ACPI_PHYSICAL_ADDRESS Address,
1049 UINT32 Length,
1050 BOOLEAN Warn);
1051
1052 void
1053 AcpiUtDeleteAddressLists (
1054 void);
1055
1056 /*
1057 * utxferror - various error/warning output functions
1058 */
1059 void ACPI_INTERNAL_VAR_XFACE
1060 AcpiUtPredefinedWarning (
1061 const char *ModuleName,
1062 UINT32 LineNumber,
1063 char *Pathname,
1064 UINT8 NodeFlags,
1065 const char *Format,
1066 ...);
1067
1068 void ACPI_INTERNAL_VAR_XFACE
1069 AcpiUtPredefinedInfo (
1070 const char *ModuleName,
1071 UINT32 LineNumber,
1072 char *Pathname,
1073 UINT8 NodeFlags,
1074 const char *Format,
1075 ...);
1076
1077 void ACPI_INTERNAL_VAR_XFACE
1078 AcpiUtPredefinedBiosError (
1079 const char *ModuleName,
1080 UINT32 LineNumber,
1081 char *Pathname,
1082 UINT8 NodeFlags,
1083 const char *Format,
1084 ...);
1085
1086 void
1087 AcpiUtNamespaceError (
1088 const char *ModuleName,
1089 UINT32 LineNumber,
1090 const char *InternalName,
1091 ACPI_STATUS LookupStatus);
1092
1093 void
1094 AcpiUtMethodError (
1095 const char *ModuleName,
1096 UINT32 LineNumber,
1097 const char *Message,
1098 ACPI_NAMESPACE_NODE *Node,
1099 const char *Path,
1100 ACPI_STATUS LookupStatus);
|