1 /****************************************************************************** 2 * 3 * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures 4 * 5 *****************************************************************************/ 6 7 /****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2020, Intel Corp. 12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. 20 * 21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 * copy of the source code appearing in this file ("Covered Code") an 23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 * base code distributed originally by Intel ("Original Intel Code") to copy, 25 * make derivatives, distribute, use and display any portion of the Covered 26 * Code in any form, with the right to sublicense such rights; and 27 * 28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 * license (with the right to sublicense), under only those claims of Intel 30 * patents that are infringed by the Original Intel Code, to make, use, sell, 31 * offer to sell, and import the Covered Code and derivative works thereof 32 * solely to the minimum extent necessary to exercise the above copyright 33 * license, and in no event shall the patent license extend to any additions 34 * to or modifications of the Original Intel Code. No other license or right 35 * is granted directly or by implication, estoppel or otherwise; 36 * 37 * The above copyright and patent license is granted only if the following 38 * conditions are met: 39 * 40 * 3. Conditions 41 * 42 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 * Redistribution of source code of any substantial portion of the Covered 44 * Code or modification with rights to further distribute source must include 45 * the above Copyright Notice, the above License, this list of Conditions, 46 * and the following Disclaimer and Export Compliance provision. In addition, 47 * Licensee must cause all Covered Code to which Licensee contributes to 48 * contain a file documenting the changes Licensee made to create that Covered 49 * Code and the date of any change. Licensee must include in that file the 50 * documentation of any changes made by any predecessor Licensee. Licensee 51 * must include a prominent statement that the modification is derived, 52 * directly or indirectly, from Original Intel Code. 53 * 54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 * Redistribution of source code of any substantial portion of the Covered 56 * Code or modification without rights to further distribute source must 57 * include the following Disclaimer and Export Compliance provision in the 58 * documentation and/or other materials provided with distribution. In 59 * addition, Licensee may not authorize further sublicense of source of any 60 * portion of the Covered Code, and must include terms to the effect that the 61 * license from Licensee to its licensee is limited to the intellectual 62 * property embodied in the software Licensee provides to its licensee, and 63 * not to intellectual property embodied in modifications its licensee may 64 * make. 65 * 66 * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 * substantial portion of the Covered Code or modification must reproduce the 68 * above Copyright Notice, and the following Disclaimer and Export Compliance 69 * provision in the documentation and/or other materials provided with the 70 * distribution. 71 * 72 * 3.4. Intel retains all right, title, and interest in and to the Original 73 * Intel Code. 74 * 75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 * Intel shall be used in advertising or otherwise to promote the sale, use or 77 * other dealings in products derived from or relating to the Covered Code 78 * without prior written authorization from Intel. 79 * 80 * 4. Disclaimer and Export Compliance 81 * 82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 * PARTICULAR PURPOSE. 89 * 90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 * LIMITED REMEDY. 98 * 99 * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 * software or system incorporating such software without first obtaining any 101 * required license or other approval from the U. S. Department of Commerce or 102 * any other agency or department of the United States Government. In the 103 * event Licensee exports any such software from the United States or 104 * re-exports any such software from a foreign destination, Licensee shall 105 * ensure that the distribution and export/re-export of the software is in 106 * compliance with all laws, regulations, orders, or other restrictions of the 107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 * any of its subsidiaries will export/re-export any technical data, process, 109 * software, or service, directly or indirectly, to any country for which the 110 * United States government or any agency thereof requires an export license, 111 * other governmental approval, or letter of assurance, without first obtaining 112 * such license, approval or letter. 113 * 114 ***************************************************************************** 115 * 116 * Alternatively, you may choose to be licensed under the terms of the 117 * following license: 118 * 119 * Redistribution and use in source and binary forms, with or without 120 * modification, are permitted provided that the following conditions 121 * are met: 122 * 1. Redistributions of source code must retain the above copyright 123 * notice, this list of conditions, and the following disclaimer, 124 * without modification. 125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126 * substantially similar to the "NO WARRANTY" disclaimer below 127 * ("Disclaimer") and any redistribution must be conditioned upon 128 * including a substantially similar Disclaimer requirement for further 129 * binary redistribution. 130 * 3. Neither the names of the above-listed copyright holders nor the names 131 * of any contributors may be used to endorse or promote products derived 132 * from this software without specific prior written permission. 133 * 134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 145 * 146 * Alternatively, you may choose to be licensed under the terms of the 147 * GNU General Public License ("GPL") version 2 as published by the Free 148 * Software Foundation. 149 * 150 *****************************************************************************/ 151 152 #ifndef _ACUTILS_H 153 #define _ACUTILS_H 154 155 156 extern const UINT8 AcpiGbl_ResourceAmlSizes[]; 157 extern const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[]; 158 159 /* Strings used by the disassembler and debugger resource dump routines */ 160 161 #if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) 162 163 extern const char *AcpiGbl_BmDecode[]; 164 extern const char *AcpiGbl_ConfigDecode[]; 165 extern const char *AcpiGbl_ConsumeDecode[]; 166 extern const char *AcpiGbl_DecDecode[]; 167 extern const char *AcpiGbl_HeDecode[]; 168 extern const char *AcpiGbl_IoDecode[]; 169 extern const char *AcpiGbl_LlDecode[]; 170 extern const char *AcpiGbl_MaxDecode[]; 171 extern const char *AcpiGbl_MemDecode[]; 172 extern const char *AcpiGbl_MinDecode[]; 173 extern const char *AcpiGbl_MtpDecode[]; 174 extern const char *AcpiGbl_RngDecode[]; 175 extern const char *AcpiGbl_RwDecode[]; 176 extern const char *AcpiGbl_ShrDecode[]; 177 extern const char *AcpiGbl_SizDecode[]; 178 extern const char *AcpiGbl_TrsDecode[]; 179 extern const char *AcpiGbl_TtpDecode[]; 180 extern const char *AcpiGbl_TypDecode[]; 181 extern const char *AcpiGbl_PpcDecode[]; 182 extern const char *AcpiGbl_IorDecode[]; 183 extern const char *AcpiGbl_DtsDecode[]; 184 extern const char *AcpiGbl_CtDecode[]; 185 extern const char *AcpiGbl_SbtDecode[]; 186 extern const char *AcpiGbl_AmDecode[]; 187 extern const char *AcpiGbl_SmDecode[]; 188 extern const char *AcpiGbl_WmDecode[]; 189 extern const char *AcpiGbl_CphDecode[]; 190 extern const char *AcpiGbl_CpoDecode[]; 191 extern const char *AcpiGbl_DpDecode[]; 192 extern const char *AcpiGbl_EdDecode[]; 193 extern const char *AcpiGbl_BpbDecode[]; 194 extern const char *AcpiGbl_SbDecode[]; 195 extern const char *AcpiGbl_FcDecode[]; 196 extern const char *AcpiGbl_PtDecode[]; 197 extern const char *AcpiGbl_PtypDecode[]; 198 #endif 199 200 /* 201 * For the iASL compiler case, the output is redirected to stderr so that 202 * any of the various ACPI errors and warnings do not appear in the output 203 * files, for either the compiler or disassembler portions of the tool. 204 */ 205 #ifdef ACPI_ASL_COMPILER 206 207 #include <stdio.h> 208 209 #define ACPI_MSG_REDIRECT_BEGIN \ 210 FILE *OutputFile = AcpiGbl_OutputFile; \ 211 AcpiOsRedirectOutput (stderr); 212 213 #define ACPI_MSG_REDIRECT_END \ 214 AcpiOsRedirectOutput (OutputFile); 215 216 #else 217 /* 218 * non-iASL case - no redirection, nothing to do 219 */ 220 #define ACPI_MSG_REDIRECT_BEGIN 221 #define ACPI_MSG_REDIRECT_END 222 #endif 223 224 /* 225 * Common error message prefixes 226 */ 227 #ifndef ACPI_MSG_ERROR 228 #define ACPI_MSG_ERROR "ACPI Error: " 229 #endif 230 #ifndef ACPI_MSG_WARNING 231 #define ACPI_MSG_WARNING "ACPI Warning: " 232 #endif 233 #ifndef ACPI_MSG_INFO 234 #define ACPI_MSG_INFO "ACPI: " 235 #endif 236 237 #ifndef ACPI_MSG_BIOS_ERROR 238 #define ACPI_MSG_BIOS_ERROR "Firmware Error (ACPI): " 239 #endif 240 #ifndef ACPI_MSG_BIOS_WARNING 241 #define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): " 242 #endif 243 244 /* 245 * Common message suffix 246 */ 247 #define ACPI_MSG_SUFFIX \ 248 AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber) 249 250 /* Flags to indicate implicit or explicit string-to-integer conversion */ 251 252 #define ACPI_IMPLICIT_CONVERSION TRUE 253 #define ACPI_NO_IMPLICIT_CONVERSION FALSE 254 255 /* Types for Resource descriptor entries */ 256 257 #define ACPI_INVALID_RESOURCE 0 258 #define ACPI_FIXED_LENGTH 1 259 #define ACPI_VARIABLE_LENGTH 2 260 #define ACPI_SMALL_VARIABLE_LENGTH 3 261 262 typedef 263 ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) ( 264 UINT8 *Aml, 265 UINT32 Length, 266 UINT32 Offset, 267 UINT8 ResourceIndex, 268 void **Context); 269 270 typedef 271 ACPI_STATUS (*ACPI_PKG_CALLBACK) ( 272 UINT8 ObjectType, 273 ACPI_OPERAND_OBJECT *SourceObject, 274 ACPI_GENERIC_STATE *State, 275 void *Context); 276 277 typedef struct acpi_pkg_info 278 { 279 UINT8 *FreeSpace; 280 ACPI_SIZE Length; 281 UINT32 ObjectSpace; 282 UINT32 NumPackages; 283 284 } ACPI_PKG_INFO; 285 286 /* Object reference counts */ 287 288 #define REF_INCREMENT (UINT16) 0 289 #define REF_DECREMENT (UINT16) 1 290 291 /* AcpiUtDumpBuffer */ 292 293 #define DB_BYTE_DISPLAY 0x01 294 #define DB_WORD_DISPLAY 0x02 295 #define DB_DWORD_DISPLAY 0x04 296 #define DB_QWORD_DISPLAY 0x08 297 #define DB_DISPLAY_DATA_ONLY 0x10 298 299 300 /* 301 * utascii - ASCII utilities 302 */ 303 BOOLEAN 304 AcpiUtValidNameseg ( 305 char *Signature); 306 307 BOOLEAN 308 AcpiUtValidNameChar ( 309 char Character, 310 UINT32 Position); 311 312 void 313 AcpiUtCheckAndRepairAscii ( 314 UINT8 *Name, 315 char *RepairedName, 316 UINT32 Count); 317 318 319 /* 320 * utnonansi - Non-ANSI C library functions 321 */ 322 void 323 AcpiUtStrupr ( 324 char *SrcString); 325 326 void 327 AcpiUtStrlwr ( 328 char *SrcString); 329 330 int 331 AcpiUtStricmp ( 332 char *String1, 333 char *String2); 334 335 336 /* 337 * utstrsuppt - string-to-integer conversion support functions 338 */ 339 ACPI_STATUS 340 AcpiUtConvertOctalString ( 341 char *String, 342 UINT64 *ReturnValue); 343 344 ACPI_STATUS 345 AcpiUtConvertDecimalString ( 346 char *String, 347 UINT64 *ReturnValuePtr); 348 349 ACPI_STATUS 350 AcpiUtConvertHexString ( 351 char *String, 352 UINT64 *ReturnValuePtr); 353 354 char 355 AcpiUtRemoveWhitespace ( 356 char **String); 357 358 char 359 AcpiUtRemoveLeadingZeros ( 360 char **String); 361 362 BOOLEAN 363 AcpiUtDetectHexPrefix ( 364 char **String); 365 366 void 367 AcpiUtRemoveHexPrefix ( 368 char **String); 369 370 BOOLEAN 371 AcpiUtDetectOctalPrefix ( 372 char **String); 373 374 375 /* 376 * utstrtoul64 - string-to-integer conversion functions 377 */ 378 ACPI_STATUS 379 AcpiUtStrtoul64 ( 380 char *String, 381 UINT64 *RetInteger); 382 383 UINT64 384 AcpiUtExplicitStrtoul64 ( 385 char *String); 386 387 UINT64 388 AcpiUtImplicitStrtoul64 ( 389 char *String); 390 391 392 /* 393 * utglobal - Global data structures and procedures 394 */ 395 ACPI_STATUS 396 AcpiUtInitGlobals ( 397 void); 398 399 const char * 400 AcpiUtGetMutexName ( 401 UINT32 MutexId); 402 403 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 404 405 const char * 406 AcpiUtGetNotifyName ( 407 UINT32 NotifyValue, 408 ACPI_OBJECT_TYPE Type); 409 #endif 410 411 const char * 412 AcpiUtGetTypeName ( 413 ACPI_OBJECT_TYPE Type); 414 415 const char * 416 AcpiUtGetNodeName ( 417 void *Object); 418 419 const char * 420 AcpiUtGetDescriptorName ( 421 void *Object); 422 423 const char * 424 AcpiUtGetReferenceName ( 425 ACPI_OPERAND_OBJECT *Object); 426 427 const char * 428 AcpiUtGetObjectTypeName ( 429 ACPI_OPERAND_OBJECT *ObjDesc); 430 431 const char * 432 AcpiUtGetRegionName ( 433 UINT8 SpaceId); 434 435 const char * 436 AcpiUtGetEventName ( 437 UINT32 EventId); 438 439 const char * 440 AcpiUtGetArgumentTypeName ( 441 UINT32 ArgType); 442 443 char 444 AcpiUtHexToAsciiChar ( 445 UINT64 Integer, 446 UINT32 Position); 447 448 ACPI_STATUS 449 AcpiUtAsciiToHexByte ( 450 char *TwoAsciiChars, 451 UINT8 *ReturnByte); 452 453 UINT8 454 AcpiUtAsciiCharToHex ( 455 int HexChar); 456 457 BOOLEAN 458 AcpiUtValidObjectType ( 459 ACPI_OBJECT_TYPE Type); 460 461 462 /* 463 * utinit - miscellaneous initialization and shutdown 464 */ 465 ACPI_STATUS 466 AcpiUtHardwareInitialize ( 467 void); 468 469 void 470 AcpiUtSubsystemShutdown ( 471 void); 472 473 474 /* 475 * utcopy - Object construction and conversion interfaces 476 */ 477 ACPI_STATUS 478 AcpiUtBuildSimpleObject( 479 ACPI_OPERAND_OBJECT *Obj, 480 ACPI_OBJECT *UserObj, 481 UINT8 *DataSpace, 482 UINT32 *BufferSpaceUsed); 483 484 ACPI_STATUS 485 AcpiUtBuildPackageObject ( 486 ACPI_OPERAND_OBJECT *Obj, 487 UINT8 *Buffer, 488 UINT32 *SpaceUsed); 489 490 ACPI_STATUS 491 AcpiUtCopyIobjectToEobject ( 492 ACPI_OPERAND_OBJECT *Obj, 493 ACPI_BUFFER *RetBuffer); 494 495 ACPI_STATUS 496 AcpiUtCopyEobjectToIobject ( 497 ACPI_OBJECT *Obj, 498 ACPI_OPERAND_OBJECT **InternalObj); 499 500 ACPI_STATUS 501 AcpiUtCopyISimpleToIsimple ( 502 ACPI_OPERAND_OBJECT *SourceObj, 503 ACPI_OPERAND_OBJECT *DestObj); 504 505 ACPI_STATUS 506 AcpiUtCopyIobjectToIobject ( 507 ACPI_OPERAND_OBJECT *SourceDesc, 508 ACPI_OPERAND_OBJECT **DestDesc, 509 ACPI_WALK_STATE *WalkState); 510 511 512 /* 513 * utcreate - Object creation 514 */ 515 ACPI_STATUS 516 AcpiUtUpdateObjectReference ( 517 ACPI_OPERAND_OBJECT *Object, 518 UINT16 Action); 519 520 521 /* 522 * utdebug - Debug interfaces 523 */ 524 void 525 AcpiUtInitStackPtrTrace ( 526 void); 527 528 void 529 AcpiUtTrackStackPtr ( 530 void); 531 532 void 533 AcpiUtTrace ( 534 UINT32 LineNumber, 535 const char *FunctionName, 536 const char *ModuleName, 537 UINT32 ComponentId); 538 539 void 540 AcpiUtTracePtr ( 541 UINT32 LineNumber, 542 const char *FunctionName, 543 const char *ModuleName, 544 UINT32 ComponentId, 545 const void *Pointer); 546 547 void 548 AcpiUtTraceU32 ( 549 UINT32 LineNumber, 550 const char *FunctionName, 551 const char *ModuleName, 552 UINT32 ComponentId, 553 UINT32 Integer); 554 555 void 556 AcpiUtTraceStr ( 557 UINT32 LineNumber, 558 const char *FunctionName, 559 const char *ModuleName, 560 UINT32 ComponentId, 561 const char *String); 562 563 void 564 AcpiUtExit ( 565 UINT32 LineNumber, 566 const char *FunctionName, 567 const char *ModuleName, 568 UINT32 ComponentId); 569 570 void 571 AcpiUtStatusExit ( 572 UINT32 LineNumber, 573 const char *FunctionName, 574 const char *ModuleName, 575 UINT32 ComponentId, 576 ACPI_STATUS Status); 577 578 void 579 AcpiUtValueExit ( 580 UINT32 LineNumber, 581 const char *FunctionName, 582 const char *ModuleName, 583 UINT32 ComponentId, 584 UINT64 Value); 585 586 void 587 AcpiUtPtrExit ( 588 UINT32 LineNumber, 589 const char *FunctionName, 590 const char *ModuleName, 591 UINT32 ComponentId, 592 UINT8 *Ptr); 593 594 void 595 AcpiUtStrExit ( 596 UINT32 LineNumber, 597 const char *FunctionName, 598 const char *ModuleName, 599 UINT32 ComponentId, 600 const char *String); 601 602 void 603 AcpiUtDebugDumpBuffer ( 604 UINT8 *Buffer, 605 UINT32 Count, 606 UINT32 Display, 607 UINT32 ComponentId); 608 609 void 610 AcpiUtDumpBuffer ( 611 UINT8 *Buffer, 612 UINT32 Count, 613 UINT32 Display, 614 UINT32 Offset); 615 616 #ifdef ACPI_APPLICATION 617 void 618 AcpiUtDumpBufferToFile ( 619 ACPI_FILE File, 620 UINT8 *Buffer, 621 UINT32 Count, 622 UINT32 Display, 623 UINT32 BaseOffset); 624 #endif 625 626 void 627 AcpiUtReportError ( 628 char *ModuleName, 629 UINT32 LineNumber); 630 631 void 632 AcpiUtReportInfo ( 633 char *ModuleName, 634 UINT32 LineNumber); 635 636 void 637 AcpiUtReportWarning ( 638 char *ModuleName, 639 UINT32 LineNumber); 640 641 642 /* 643 * utdelete - Object deletion and reference counts 644 */ 645 void 646 AcpiUtAddReference ( 647 ACPI_OPERAND_OBJECT *Object); 648 649 void 650 AcpiUtRemoveReference ( 651 ACPI_OPERAND_OBJECT *Object); 652 653 void 654 AcpiUtDeleteInternalPackageObject ( 655 ACPI_OPERAND_OBJECT *Object); 656 657 void 658 AcpiUtDeleteInternalSimpleObject ( 659 ACPI_OPERAND_OBJECT *Object); 660 661 void 662 AcpiUtDeleteInternalObjectList ( 663 ACPI_OPERAND_OBJECT **ObjList); 664 665 666 /* 667 * uteval - object evaluation 668 */ 669 ACPI_STATUS 670 AcpiUtEvaluateObject ( 671 ACPI_NAMESPACE_NODE *PrefixNode, 672 const char *Path, 673 UINT32 ExpectedReturnBtypes, 674 ACPI_OPERAND_OBJECT **ReturnDesc); 675 676 ACPI_STATUS 677 AcpiUtEvaluateNumericObject ( 678 const char *ObjectName, 679 ACPI_NAMESPACE_NODE *DeviceNode, 680 UINT64 *Value); 681 682 ACPI_STATUS 683 AcpiUtExecute_STA ( 684 ACPI_NAMESPACE_NODE *DeviceNode, 685 UINT32 *StatusFlags); 686 687 ACPI_STATUS 688 AcpiUtExecutePowerMethods ( 689 ACPI_NAMESPACE_NODE *DeviceNode, 690 const char **MethodNames, 691 UINT8 MethodCount, 692 UINT8 *OutValues); 693 694 695 /* 696 * utids - device ID support 697 */ 698 ACPI_STATUS 699 AcpiUtExecute_HID ( 700 ACPI_NAMESPACE_NODE *DeviceNode, 701 ACPI_PNP_DEVICE_ID **ReturnId); 702 703 ACPI_STATUS 704 AcpiUtExecute_UID ( 705 ACPI_NAMESPACE_NODE *DeviceNode, 706 ACPI_PNP_DEVICE_ID **ReturnId); 707 708 ACPI_STATUS 709 AcpiUtExecute_CID ( 710 ACPI_NAMESPACE_NODE *DeviceNode, 711 ACPI_PNP_DEVICE_ID_LIST **ReturnCidList); 712 713 ACPI_STATUS 714 AcpiUtExecute_CLS ( 715 ACPI_NAMESPACE_NODE *DeviceNode, 716 ACPI_PNP_DEVICE_ID **ReturnId); 717 718 719 /* 720 * utlock - reader/writer locks 721 */ 722 ACPI_STATUS 723 AcpiUtCreateRwLock ( 724 ACPI_RW_LOCK *Lock); 725 726 void 727 AcpiUtDeleteRwLock ( 728 ACPI_RW_LOCK *Lock); 729 730 ACPI_STATUS 731 AcpiUtAcquireReadLock ( 732 ACPI_RW_LOCK *Lock); 733 734 ACPI_STATUS 735 AcpiUtReleaseReadLock ( 736 ACPI_RW_LOCK *Lock); 737 738 ACPI_STATUS 739 AcpiUtAcquireWriteLock ( 740 ACPI_RW_LOCK *Lock); 741 742 void 743 AcpiUtReleaseWriteLock ( 744 ACPI_RW_LOCK *Lock); 745 746 747 /* 748 * utobject - internal object create/delete/cache routines 749 */ 750 ACPI_OPERAND_OBJECT * 751 AcpiUtCreateInternalObjectDbg ( 752 const char *ModuleName, 753 UINT32 LineNumber, 754 UINT32 ComponentId, 755 ACPI_OBJECT_TYPE Type); 756 757 void * 758 AcpiUtAllocateObjectDescDbg ( 759 const char *ModuleName, 760 UINT32 LineNumber, 761 UINT32 ComponentId); 762 763 #define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t) 764 #define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT) 765 766 void 767 AcpiUtDeleteObjectDesc ( 768 ACPI_OPERAND_OBJECT *Object); 769 770 BOOLEAN 771 AcpiUtValidInternalObject ( 772 void *Object); 773 774 ACPI_OPERAND_OBJECT * 775 AcpiUtCreatePackageObject ( 776 UINT32 Count); 777 778 ACPI_OPERAND_OBJECT * 779 AcpiUtCreateIntegerObject ( 780 UINT64 Value); 781 782 ACPI_OPERAND_OBJECT * 783 AcpiUtCreateBufferObject ( 784 ACPI_SIZE BufferSize); 785 786 ACPI_OPERAND_OBJECT * 787 AcpiUtCreateStringObject ( 788 ACPI_SIZE StringSize); 789 790 ACPI_STATUS 791 AcpiUtGetObjectSize( 792 ACPI_OPERAND_OBJECT *Obj, 793 ACPI_SIZE *ObjLength); 794 795 796 /* 797 * utosi - Support for the _OSI predefined control method 798 */ 799 ACPI_STATUS 800 AcpiUtInitializeInterfaces ( 801 void); 802 803 ACPI_STATUS 804 AcpiUtInterfaceTerminate ( 805 void); 806 807 ACPI_STATUS 808 AcpiUtInstallInterface ( 809 ACPI_STRING InterfaceName); 810 811 ACPI_STATUS 812 AcpiUtRemoveInterface ( 813 ACPI_STRING InterfaceName); 814 815 ACPI_STATUS 816 AcpiUtUpdateInterfaces ( 817 UINT8 Action); 818 819 ACPI_INTERFACE_INFO * 820 AcpiUtGetInterface ( 821 ACPI_STRING InterfaceName); 822 823 ACPI_STATUS 824 AcpiUtOsiImplementation ( 825 ACPI_WALK_STATE *WalkState); 826 827 828 /* 829 * utpredef - support for predefined names 830 */ 831 const ACPI_PREDEFINED_INFO * 832 AcpiUtGetNextPredefinedMethod ( 833 const ACPI_PREDEFINED_INFO *ThisName); 834 835 const ACPI_PREDEFINED_INFO * 836 AcpiUtMatchPredefinedMethod ( 837 char *Name); 838 839 void 840 AcpiUtGetExpectedReturnTypes ( 841 char *Buffer, 842 UINT32 ExpectedBtypes); 843 844 #if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP) 845 const ACPI_PREDEFINED_INFO * 846 AcpiUtMatchResourceName ( 847 char *Name); 848 849 void 850 AcpiUtDisplayPredefinedMethod ( 851 char *Buffer, 852 const ACPI_PREDEFINED_INFO *ThisName, 853 BOOLEAN MultiLine); 854 855 UINT32 856 AcpiUtGetResourceBitWidth ( 857 char *Buffer, 858 UINT16 Types); 859 #endif 860 861 862 /* 863 * utstate - Generic state creation/cache routines 864 */ 865 void 866 AcpiUtPushGenericState ( 867 ACPI_GENERIC_STATE **ListHead, 868 ACPI_GENERIC_STATE *State); 869 870 ACPI_GENERIC_STATE * 871 AcpiUtPopGenericState ( 872 ACPI_GENERIC_STATE **ListHead); 873 874 875 ACPI_GENERIC_STATE * 876 AcpiUtCreateGenericState ( 877 void); 878 879 ACPI_THREAD_STATE * 880 AcpiUtCreateThreadState ( 881 void); 882 883 ACPI_GENERIC_STATE * 884 AcpiUtCreateUpdateState ( 885 ACPI_OPERAND_OBJECT *Object, 886 UINT16 Action); 887 888 ACPI_GENERIC_STATE * 889 AcpiUtCreatePkgState ( 890 void *InternalObject, 891 void *ExternalObject, 892 UINT32 Index); 893 894 ACPI_STATUS 895 AcpiUtCreateUpdateStateAndPush ( 896 ACPI_OPERAND_OBJECT *Object, 897 UINT16 Action, 898 ACPI_GENERIC_STATE **StateList); 899 900 ACPI_GENERIC_STATE * 901 AcpiUtCreateControlState ( 902 void); 903 904 void 905 AcpiUtDeleteGenericState ( 906 ACPI_GENERIC_STATE *State); 907 908 909 /* 910 * utmath 911 */ 912 ACPI_STATUS 913 AcpiUtDivide ( 914 UINT64 InDividend, 915 UINT64 InDivisor, 916 UINT64 *OutQuotient, 917 UINT64 *OutRemainder); 918 919 ACPI_STATUS 920 AcpiUtShortDivide ( 921 UINT64 InDividend, 922 UINT32 Divisor, 923 UINT64 *OutQuotient, 924 UINT32 *OutRemainder); 925 926 ACPI_STATUS 927 AcpiUtShortMultiply ( 928 UINT64 InMultiplicand, 929 UINT32 Multiplier, 930 UINT64 *Outproduct); 931 932 ACPI_STATUS 933 AcpiUtShortShiftLeft ( 934 UINT64 Operand, 935 UINT32 Count, 936 UINT64 *OutResult); 937 938 ACPI_STATUS 939 AcpiUtShortShiftRight ( 940 UINT64 Operand, 941 UINT32 Count, 942 UINT64 *OutResult); 943 944 945 /* 946 * utmisc 947 */ 948 const ACPI_EXCEPTION_INFO * 949 AcpiUtValidateException ( 950 ACPI_STATUS Status); 951 952 BOOLEAN 953 AcpiUtIsPciRootBridge ( 954 char *Id); 955 956 #if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP) 957 BOOLEAN 958 AcpiUtIsAmlTable ( 959 ACPI_TABLE_HEADER *Table); 960 #endif 961 962 ACPI_STATUS 963 AcpiUtWalkPackageTree ( 964 ACPI_OPERAND_OBJECT *SourceObject, 965 void *TargetObject, 966 ACPI_PKG_CALLBACK WalkCallback, 967 void *Context); 968 969 /* Values for Base above (16=Hex, 10=Decimal) */ 970 971 #define ACPI_ANY_BASE 0 972 973 974 UINT32 975 AcpiUtDwordByteSwap ( 976 UINT32 Value); 977 978 void 979 AcpiUtSetIntegerWidth ( 980 UINT8 Revision); 981 982 #ifdef ACPI_DEBUG_OUTPUT 983 void 984 AcpiUtDisplayInitPathname ( 985 UINT8 Type, 986 ACPI_NAMESPACE_NODE *ObjHandle, 987 const char *Path); 988 #endif 989 990 991 /* 992 * utownerid - Support for Table/Method Owner IDs 993 */ 994 ACPI_STATUS 995 AcpiUtAllocateOwnerId ( 996 ACPI_OWNER_ID *OwnerId); 997 998 void 999 AcpiUtReleaseOwnerId ( 1000 ACPI_OWNER_ID *OwnerId); 1001 1002 1003 /* 1004 * utresrc 1005 */ 1006 ACPI_STATUS 1007 AcpiUtWalkAmlResources ( 1008 ACPI_WALK_STATE *WalkState, 1009 UINT8 *Aml, 1010 ACPI_SIZE AmlLength, 1011 ACPI_WALK_AML_CALLBACK UserFunction, 1012 void **Context); 1013 1014 ACPI_STATUS 1015 AcpiUtValidateResource ( 1016 ACPI_WALK_STATE *WalkState, 1017 void *Aml, 1018 UINT8 *ReturnIndex); 1019 1020 UINT32 1021 AcpiUtGetDescriptorLength ( 1022 void *Aml); 1023 1024 UINT16 1025 AcpiUtGetResourceLength ( 1026 void *Aml); 1027 1028 UINT8 1029 AcpiUtGetResourceHeaderLength ( 1030 void *Aml); 1031 1032 UINT8 1033 AcpiUtGetResourceType ( 1034 void *Aml); 1035 1036 ACPI_STATUS 1037 AcpiUtGetResourceEndTag ( 1038 ACPI_OPERAND_OBJECT *ObjDesc, 1039 UINT8 **EndTag); 1040 1041 1042 /* 1043 * utstring - String and character utilities 1044 */ 1045 void 1046 AcpiUtPrintString ( 1047 char *String, 1048 UINT16 MaxLength); 1049 1050 #if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP 1051 void 1052 UtConvertBackslashes ( 1053 char *Pathname); 1054 #endif 1055 1056 void 1057 AcpiUtRepairName ( 1058 char *Name); 1059 1060 #if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) || defined (ACPI_DEBUG_OUTPUT) 1061 BOOLEAN 1062 AcpiUtSafeStrcpy ( 1063 char *Dest, 1064 ACPI_SIZE DestSize, 1065 char *Source); 1066 1067 void 1068 AcpiUtSafeStrncpy ( 1069 char *Dest, 1070 char *Source, 1071 ACPI_SIZE DestSize); 1072 1073 BOOLEAN 1074 AcpiUtSafeStrcat ( 1075 char *Dest, 1076 ACPI_SIZE DestSize, 1077 char *Source); 1078 1079 BOOLEAN 1080 AcpiUtSafeStrncat ( 1081 char *Dest, 1082 ACPI_SIZE DestSize, 1083 char *Source, 1084 ACPI_SIZE MaxTransferLength); 1085 #endif 1086 1087 1088 /* 1089 * utmutex - mutex support 1090 */ 1091 ACPI_STATUS 1092 AcpiUtMutexInitialize ( 1093 void); 1094 1095 void 1096 AcpiUtMutexTerminate ( 1097 void); 1098 1099 ACPI_STATUS 1100 AcpiUtAcquireMutex ( 1101 ACPI_MUTEX_HANDLE MutexId); 1102 1103 ACPI_STATUS 1104 AcpiUtReleaseMutex ( 1105 ACPI_MUTEX_HANDLE MutexId); 1106 1107 1108 /* 1109 * utalloc - memory allocation and object caching 1110 */ 1111 ACPI_STATUS 1112 AcpiUtCreateCaches ( 1113 void); 1114 1115 ACPI_STATUS 1116 AcpiUtDeleteCaches ( 1117 void); 1118 1119 ACPI_STATUS 1120 AcpiUtValidateBuffer ( 1121 ACPI_BUFFER *Buffer); 1122 1123 ACPI_STATUS 1124 AcpiUtInitializeBuffer ( 1125 ACPI_BUFFER *Buffer, 1126 ACPI_SIZE RequiredLength); 1127 1128 #ifdef ACPI_DBG_TRACK_ALLOCATIONS 1129 void * 1130 AcpiUtAllocateAndTrack ( 1131 ACPI_SIZE Size, 1132 UINT32 Component, 1133 const char *Module, 1134 UINT32 Line); 1135 1136 void * 1137 AcpiUtAllocateZeroedAndTrack ( 1138 ACPI_SIZE Size, 1139 UINT32 Component, 1140 const char *Module, 1141 UINT32 Line); 1142 1143 void 1144 AcpiUtFreeAndTrack ( 1145 void *Address, 1146 UINT32 Component, 1147 const char *Module, 1148 UINT32 Line); 1149 1150 void 1151 AcpiUtDumpAllocationInfo ( 1152 void); 1153 1154 void 1155 AcpiUtDumpAllocations ( 1156 UINT32 Component, 1157 const char *Module); 1158 1159 ACPI_STATUS 1160 AcpiUtCreateList ( 1161 const char *ListName, 1162 UINT16 ObjectSize, 1163 ACPI_MEMORY_LIST **ReturnCache); 1164 1165 #endif /* ACPI_DBG_TRACK_ALLOCATIONS */ 1166 1167 1168 /* 1169 * utaddress - address range check 1170 */ 1171 ACPI_STATUS 1172 AcpiUtAddAddressRange ( 1173 ACPI_ADR_SPACE_TYPE SpaceId, 1174 ACPI_PHYSICAL_ADDRESS Address, 1175 UINT32 Length, 1176 ACPI_NAMESPACE_NODE *RegionNode); 1177 1178 void 1179 AcpiUtRemoveAddressRange ( 1180 ACPI_ADR_SPACE_TYPE SpaceId, 1181 ACPI_NAMESPACE_NODE *RegionNode); 1182 1183 UINT32 1184 AcpiUtCheckAddressRange ( 1185 ACPI_ADR_SPACE_TYPE SpaceId, 1186 ACPI_PHYSICAL_ADDRESS Address, 1187 UINT32 Length, 1188 BOOLEAN Warn); 1189 1190 void 1191 AcpiUtDeleteAddressLists ( 1192 void); 1193 1194 1195 /* 1196 * utxferror - various error/warning output functions 1197 */ 1198 ACPI_PRINTF_LIKE(5) 1199 void ACPI_INTERNAL_VAR_XFACE 1200 AcpiUtPredefinedWarning ( 1201 const char *ModuleName, 1202 UINT32 LineNumber, 1203 char *Pathname, 1204 UINT16 NodeFlags, 1205 const char *Format, 1206 ...); 1207 1208 ACPI_PRINTF_LIKE(5) 1209 void ACPI_INTERNAL_VAR_XFACE 1210 AcpiUtPredefinedInfo ( 1211 const char *ModuleName, 1212 UINT32 LineNumber, 1213 char *Pathname, 1214 UINT16 NodeFlags, 1215 const char *Format, 1216 ...); 1217 1218 ACPI_PRINTF_LIKE(5) 1219 void ACPI_INTERNAL_VAR_XFACE 1220 AcpiUtPredefinedBiosError ( 1221 const char *ModuleName, 1222 UINT32 LineNumber, 1223 char *Pathname, 1224 UINT16 NodeFlags, 1225 const char *Format, 1226 ...); 1227 1228 void 1229 AcpiUtPrefixedNamespaceError ( 1230 const char *ModuleName, 1231 UINT32 LineNumber, 1232 ACPI_GENERIC_STATE *PrefixScope, 1233 const char *InternalName, 1234 ACPI_STATUS LookupStatus); 1235 1236 void 1237 AcpiUtMethodError ( 1238 const char *ModuleName, 1239 UINT32 LineNumber, 1240 const char *Message, 1241 ACPI_NAMESPACE_NODE *Node, 1242 const char *Path, 1243 ACPI_STATUS LookupStatus); 1244 1245 1246 /* 1247 * Utility functions for ACPI names and IDs 1248 */ 1249 const AH_PREDEFINED_NAME * 1250 AcpiAhMatchPredefinedName ( 1251 char *Nameseg); 1252 1253 const AH_DEVICE_ID * 1254 AcpiAhMatchHardwareId ( 1255 char *Hid); 1256 1257 const char * 1258 AcpiAhMatchUuid ( 1259 UINT8 *Data); 1260 1261 1262 /* 1263 * utuuid -- UUID support functions 1264 */ 1265 #if (defined ACPI_ASL_COMPILER || defined ACPI_DISASSEMBLER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP) 1266 void 1267 AcpiUtConvertStringToUuid ( 1268 char *InString, 1269 UINT8 *UuidBuffer); 1270 #endif 1271 1272 #endif /* _ACUTILS_H */ 1273