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