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