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