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