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