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