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