1 /****************************************************************************** 2 * 3 * Module Name: uteval - Object evaluation 4 * $Revision: 1.70 $ 5 * 6 *****************************************************************************/ 7 8 /****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. 13 * All rights reserved. 14 * 15 * 2. License 16 * 17 * 2.1. This is your license from Intel Corp. under its intellectual property 18 * rights. You may have additional license terms from the party that provided 19 * you this software, covering your right to use that party's intellectual 20 * property rights. 21 * 22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23 * copy of the source code appearing in this file ("Covered Code") an 24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25 * base code distributed originally by Intel ("Original Intel Code") to copy, 26 * make derivatives, distribute, use and display any portion of the Covered 27 * Code in any form, with the right to sublicense such rights; and 28 * 29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30 * license (with the right to sublicense), under only those claims of Intel 31 * patents that are infringed by the Original Intel Code, to make, use, sell, 32 * offer to sell, and import the Covered Code and derivative works thereof 33 * solely to the minimum extent necessary to exercise the above copyright 34 * license, and in no event shall the patent license extend to any additions 35 * to or modifications of the Original Intel Code. No other license or right 36 * is granted directly or by implication, estoppel or otherwise; 37 * 38 * The above copyright and patent license is granted only if the following 39 * conditions are met: 40 * 41 * 3. Conditions 42 * 43 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44 * Redistribution of source code of any substantial portion of the Covered 45 * Code or modification with rights to further distribute source must include 46 * the above Copyright Notice, the above License, this list of Conditions, 47 * and the following Disclaimer and Export Compliance provision. In addition, 48 * Licensee must cause all Covered Code to which Licensee contributes to 49 * contain a file documenting the changes Licensee made to create that Covered 50 * Code and the date of any change. Licensee must include in that file the 51 * documentation of any changes made by any predecessor Licensee. Licensee 52 * must include a prominent statement that the modification is derived, 53 * directly or indirectly, from Original Intel Code. 54 * 55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56 * Redistribution of source code of any substantial portion of the Covered 57 * Code or modification without rights to further distribute source must 58 * include the following Disclaimer and Export Compliance provision in the 59 * documentation and/or other materials provided with distribution. In 60 * addition, Licensee may not authorize further sublicense of source of any 61 * portion of the Covered Code, and must include terms to the effect that the 62 * license from Licensee to its licensee is limited to the intellectual 63 * property embodied in the software Licensee provides to its licensee, and 64 * not to intellectual property embodied in modifications its licensee may 65 * make. 66 * 67 * 3.3. Redistribution of Executable. Redistribution in executable form of any 68 * substantial portion of the Covered Code or modification must reproduce the 69 * above Copyright Notice, and the following Disclaimer and Export Compliance 70 * provision in the documentation and/or other materials provided with the 71 * distribution. 72 * 73 * 3.4. Intel retains all right, title, and interest in and to the Original 74 * Intel Code. 75 * 76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77 * Intel shall be used in advertising or otherwise to promote the sale, use or 78 * other dealings in products derived from or relating to the Covered Code 79 * without prior written authorization from Intel. 80 * 81 * 4. Disclaimer and Export Compliance 82 * 83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89 * PARTICULAR PURPOSE. 90 * 91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98 * LIMITED REMEDY. 99 * 100 * 4.3. Licensee shall not export, either directly or indirectly, any of this 101 * software or system incorporating such software without first obtaining any 102 * required license or other approval from the U. S. Department of Commerce or 103 * any other agency or department of the United States Government. In the 104 * event Licensee exports any such software from the United States or 105 * re-exports any such software from a foreign destination, Licensee shall 106 * ensure that the distribution and export/re-export of the software is in 107 * compliance with all laws, regulations, orders, or other restrictions of the 108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109 * any of its subsidiaries will export/re-export any technical data, process, 110 * software, or service, directly or indirectly, to any country for which the 111 * United States government or any agency thereof requires an export license, 112 * other governmental approval, or letter of assurance, without first obtaining 113 * such license, approval or letter. 114 * 115 *****************************************************************************/ 116 117 #define __UTEVAL_C__ 118 119 #include "acpi.h" 120 #include "acnamesp.h" 121 #include "acinterp.h" 122 123 124 #define _COMPONENT ACPI_UTILITIES 125 ACPI_MODULE_NAME ("uteval") 126 127 /* Local prototypes */ 128 129 static void 130 AcpiUtCopyIdString ( 131 char *Destination, 132 char *Source, 133 ACPI_SIZE MaxLength); 134 135 static ACPI_STATUS 136 AcpiUtTranslateOneCid ( 137 ACPI_OPERAND_OBJECT *ObjDesc, 138 ACPI_COMPATIBLE_ID *OneCid); 139 140 141 /* 142 * Strings supported by the _OSI predefined (internal) method. 143 */ 144 static const char *AcpiInterfacesSupported[] = 145 { 146 /* Operating System Vendor Strings */ 147 148 "Linux", 149 "Windows 2000", 150 "Windows 2001", 151 "Windows 2001 SP0", 152 "Windows 2001 SP1", 153 "Windows 2001 SP2", 154 "Windows 2001 SP3", 155 "Windows 2001 SP4", 156 "Windows 2001.1", 157 "Windows 2001.1 SP1", /* Added 03/2006 */ 158 "Windows 2006", /* Added 03/2006 */ 159 160 /* Feature Group Strings */ 161 162 "Extended Address Space Descriptor" 163 164 /* 165 * All "optional" feature group strings (features that are implemented 166 * by the host) should be implemented in the host version of 167 * AcpiOsValidateInterface and should not be added here. 168 */ 169 }; 170 171 172 /******************************************************************************* 173 * 174 * FUNCTION: AcpiUtOsiImplementation 175 * 176 * PARAMETERS: WalkState - Current walk state 177 * 178 * RETURN: Status 179 * 180 * DESCRIPTION: Implementation of the _OSI predefined control method 181 * 182 ******************************************************************************/ 183 184 ACPI_STATUS 185 AcpiUtOsiImplementation ( 186 ACPI_WALK_STATE *WalkState) 187 { 188 ACPI_STATUS Status; 189 ACPI_OPERAND_OBJECT *StringDesc; 190 ACPI_OPERAND_OBJECT *ReturnDesc; 191 ACPI_NATIVE_UINT i; 192 193 194 ACPI_FUNCTION_TRACE (UtOsiImplementation); 195 196 197 /* Validate the string input argument */ 198 199 StringDesc = WalkState->Arguments[0].Object; 200 if (!StringDesc || (StringDesc->Common.Type != ACPI_TYPE_STRING)) 201 { 202 return_ACPI_STATUS (AE_TYPE); 203 } 204 205 /* Create a return object */ 206 207 ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); 208 if (!ReturnDesc) 209 { 210 return_ACPI_STATUS (AE_NO_MEMORY); 211 } 212 213 /* Default return value is SUPPORTED */ 214 215 ReturnDesc->Integer.Value = ACPI_UINT32_MAX; 216 WalkState->ReturnDesc = ReturnDesc; 217 218 /* Compare input string to static table of supported interfaces */ 219 220 for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiInterfacesSupported); i++) 221 { 222 if (!ACPI_STRCMP (StringDesc->String.Pointer, AcpiInterfacesSupported[i])) 223 { 224 /* The interface is supported */ 225 226 return_ACPI_STATUS (AE_CTRL_TERMINATE); 227 } 228 } 229 230 /* 231 * Did not match the string in the static table, call the host OSL to 232 * check for a match with one of the optional strings (such as 233 * "Module Device", "3.0 Thermal Model", etc.) 234 */ 235 Status = AcpiOsValidateInterface (StringDesc->String.Pointer); 236 if (ACPI_SUCCESS (Status)) 237 { 238 /* The interface is supported */ 239 240 return_ACPI_STATUS (AE_CTRL_TERMINATE); 241 } 242 243 /* The interface is not supported */ 244 245 ReturnDesc->Integer.Value = 0; 246 return_ACPI_STATUS (AE_CTRL_TERMINATE); 247 } 248 249 250 /******************************************************************************* 251 * 252 * FUNCTION: AcpiUtEvaluateObject 253 * 254 * PARAMETERS: PrefixNode - Starting node 255 * Path - Path to object from starting node 256 * ExpectedReturnTypes - Bitmap of allowed return types 257 * ReturnDesc - Where a return value is stored 258 * 259 * RETURN: Status 260 * 261 * DESCRIPTION: Evaluates a namespace object and verifies the type of the 262 * return object. Common code that simplifies accessing objects 263 * that have required return objects of fixed types. 264 * 265 * NOTE: Internal function, no parameter validation 266 * 267 ******************************************************************************/ 268 269 ACPI_STATUS 270 AcpiUtEvaluateObject ( 271 ACPI_NAMESPACE_NODE *PrefixNode, 272 char *Path, 273 UINT32 ExpectedReturnBtypes, 274 ACPI_OPERAND_OBJECT **ReturnDesc) 275 { 276 ACPI_EVALUATE_INFO *Info; 277 ACPI_STATUS Status; 278 UINT32 ReturnBtype; 279 280 281 ACPI_FUNCTION_TRACE (UtEvaluateObject); 282 283 284 /* Allocate the evaluation information block */ 285 286 Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); 287 if (!Info) 288 { 289 return_ACPI_STATUS (AE_NO_MEMORY); 290 } 291 292 Info->PrefixNode = PrefixNode; 293 Info->Pathname = Path; 294 Info->ParameterType = ACPI_PARAM_ARGS; 295 296 /* Evaluate the object/method */ 297 298 Status = AcpiNsEvaluate (Info); 299 if (ACPI_FAILURE (Status)) 300 { 301 if (Status == AE_NOT_FOUND) 302 { 303 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n", 304 AcpiUtGetNodeName (PrefixNode), Path)); 305 } 306 else 307 { 308 ACPI_ERROR_METHOD ("Method execution failed", 309 PrefixNode, Path, Status); 310 } 311 312 goto Cleanup; 313 } 314 315 /* Did we get a return object? */ 316 317 if (!Info->ReturnObject) 318 { 319 if (ExpectedReturnBtypes) 320 { 321 ACPI_ERROR_METHOD ("No object was returned from", 322 PrefixNode, Path, AE_NOT_EXIST); 323 324 Status = AE_NOT_EXIST; 325 } 326 327 goto Cleanup; 328 } 329 330 /* Map the return object type to the bitmapped type */ 331 332 switch (ACPI_GET_OBJECT_TYPE (Info->ReturnObject)) 333 { 334 case ACPI_TYPE_INTEGER: 335 ReturnBtype = ACPI_BTYPE_INTEGER; 336 break; 337 338 case ACPI_TYPE_BUFFER: 339 ReturnBtype = ACPI_BTYPE_BUFFER; 340 break; 341 342 case ACPI_TYPE_STRING: 343 ReturnBtype = ACPI_BTYPE_STRING; 344 break; 345 346 case ACPI_TYPE_PACKAGE: 347 ReturnBtype = ACPI_BTYPE_PACKAGE; 348 break; 349 350 default: 351 ReturnBtype = 0; 352 break; 353 } 354 355 if ((AcpiGbl_EnableInterpreterSlack) && 356 (!ExpectedReturnBtypes)) 357 { 358 /* 359 * We received a return object, but one was not expected. This can 360 * happen frequently if the "implicit return" feature is enabled. 361 * Just delete the return object and return AE_OK. 362 */ 363 AcpiUtRemoveReference (Info->ReturnObject); 364 goto Cleanup; 365 } 366 367 /* Is the return object one of the expected types? */ 368 369 if (!(ExpectedReturnBtypes & ReturnBtype)) 370 { 371 ACPI_ERROR_METHOD ("Return object type is incorrect", 372 PrefixNode, Path, AE_TYPE); 373 374 ACPI_ERROR ((AE_INFO, 375 "Type returned from %s was incorrect: %s, expected Btypes: %X", 376 Path, AcpiUtGetObjectTypeName (Info->ReturnObject), 377 ExpectedReturnBtypes)); 378 379 /* On error exit, we must delete the return object */ 380 381 AcpiUtRemoveReference (Info->ReturnObject); 382 Status = AE_TYPE; 383 goto Cleanup; 384 } 385 386 /* Object type is OK, return it */ 387 388 *ReturnDesc = Info->ReturnObject; 389 390 Cleanup: 391 ACPI_FREE (Info); 392 return_ACPI_STATUS (Status); 393 } 394 395 396 /******************************************************************************* 397 * 398 * FUNCTION: AcpiUtEvaluateNumericObject 399 * 400 * PARAMETERS: ObjectName - Object name to be evaluated 401 * DeviceNode - Node for the device 402 * Address - Where the value is returned 403 * 404 * RETURN: Status 405 * 406 * DESCRIPTION: Evaluates a numeric namespace object for a selected device 407 * and stores result in *Address. 408 * 409 * NOTE: Internal function, no parameter validation 410 * 411 ******************************************************************************/ 412 413 ACPI_STATUS 414 AcpiUtEvaluateNumericObject ( 415 char *ObjectName, 416 ACPI_NAMESPACE_NODE *DeviceNode, 417 ACPI_INTEGER *Address) 418 { 419 ACPI_OPERAND_OBJECT *ObjDesc; 420 ACPI_STATUS Status; 421 422 423 ACPI_FUNCTION_TRACE (UtEvaluateNumericObject); 424 425 426 Status = AcpiUtEvaluateObject (DeviceNode, ObjectName, 427 ACPI_BTYPE_INTEGER, &ObjDesc); 428 if (ACPI_FAILURE (Status)) 429 { 430 return_ACPI_STATUS (Status); 431 } 432 433 /* Get the returned Integer */ 434 435 *Address = ObjDesc->Integer.Value; 436 437 /* On exit, we must delete the return object */ 438 439 AcpiUtRemoveReference (ObjDesc); 440 return_ACPI_STATUS (Status); 441 } 442 443 444 /******************************************************************************* 445 * 446 * FUNCTION: AcpiUtCopyIdString 447 * 448 * PARAMETERS: Destination - Where to copy the string 449 * Source - Source string 450 * MaxLength - Length of the destination buffer 451 * 452 * RETURN: None 453 * 454 * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. 455 * Performs removal of a leading asterisk if present -- workaround 456 * for a known issue on a bunch of machines. 457 * 458 ******************************************************************************/ 459 460 static void 461 AcpiUtCopyIdString ( 462 char *Destination, 463 char *Source, 464 ACPI_SIZE MaxLength) 465 { 466 467 /* 468 * Workaround for ID strings that have a leading asterisk. This construct 469 * is not allowed by the ACPI specification (ID strings must be 470 * alphanumeric), but enough existing machines have this embedded in their 471 * ID strings that the following code is useful. 472 */ 473 if (*Source == '*') 474 { 475 Source++; 476 } 477 478 /* Do the actual copy */ 479 480 ACPI_STRNCPY (Destination, Source, MaxLength); 481 } 482 483 484 /******************************************************************************* 485 * 486 * FUNCTION: AcpiUtExecute_HID 487 * 488 * PARAMETERS: DeviceNode - Node for the device 489 * Hid - Where the HID is returned 490 * 491 * RETURN: Status 492 * 493 * DESCRIPTION: Executes the _HID control method that returns the hardware 494 * ID of the device. 495 * 496 * NOTE: Internal function, no parameter validation 497 * 498 ******************************************************************************/ 499 500 ACPI_STATUS 501 AcpiUtExecute_HID ( 502 ACPI_NAMESPACE_NODE *DeviceNode, 503 ACPI_DEVICE_ID *Hid) 504 { 505 ACPI_OPERAND_OBJECT *ObjDesc; 506 ACPI_STATUS Status; 507 508 509 ACPI_FUNCTION_TRACE (UtExecute_HID); 510 511 512 Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID, 513 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); 514 if (ACPI_FAILURE (Status)) 515 { 516 return_ACPI_STATUS (Status); 517 } 518 519 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) 520 { 521 /* Convert the Numeric HID to string */ 522 523 AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Value); 524 } 525 else 526 { 527 /* Copy the String HID from the returned object */ 528 529 AcpiUtCopyIdString (Hid->Value, ObjDesc->String.Pointer, 530 sizeof (Hid->Value)); 531 } 532 533 /* On exit, we must delete the return object */ 534 535 AcpiUtRemoveReference (ObjDesc); 536 return_ACPI_STATUS (Status); 537 } 538 539 540 /******************************************************************************* 541 * 542 * FUNCTION: AcpiUtTranslateOneCid 543 * 544 * PARAMETERS: ObjDesc - _CID object, must be integer or string 545 * OneCid - Where the CID string is returned 546 * 547 * RETURN: Status 548 * 549 * DESCRIPTION: Return a numeric or string _CID value as a string. 550 * (Compatible ID) 551 * 552 * NOTE: Assumes a maximum _CID string length of 553 * ACPI_MAX_CID_LENGTH. 554 * 555 ******************************************************************************/ 556 557 static ACPI_STATUS 558 AcpiUtTranslateOneCid ( 559 ACPI_OPERAND_OBJECT *ObjDesc, 560 ACPI_COMPATIBLE_ID *OneCid) 561 { 562 563 564 switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) 565 { 566 case ACPI_TYPE_INTEGER: 567 568 /* Convert the Numeric CID to string */ 569 570 AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, OneCid->Value); 571 return (AE_OK); 572 573 case ACPI_TYPE_STRING: 574 575 if (ObjDesc->String.Length > ACPI_MAX_CID_LENGTH) 576 { 577 return (AE_AML_STRING_LIMIT); 578 } 579 580 /* Copy the String CID from the returned object */ 581 582 AcpiUtCopyIdString (OneCid->Value, ObjDesc->String.Pointer, 583 ACPI_MAX_CID_LENGTH); 584 return (AE_OK); 585 586 default: 587 588 return (AE_TYPE); 589 } 590 } 591 592 593 /******************************************************************************* 594 * 595 * FUNCTION: AcpiUtExecute_CID 596 * 597 * PARAMETERS: DeviceNode - Node for the device 598 * ReturnCidList - Where the CID list is returned 599 * 600 * RETURN: Status 601 * 602 * DESCRIPTION: Executes the _CID control method that returns one or more 603 * compatible hardware IDs for the device. 604 * 605 * NOTE: Internal function, no parameter validation 606 * 607 ******************************************************************************/ 608 609 ACPI_STATUS 610 AcpiUtExecute_CID ( 611 ACPI_NAMESPACE_NODE *DeviceNode, 612 ACPI_COMPATIBLE_ID_LIST **ReturnCidList) 613 { 614 ACPI_OPERAND_OBJECT *ObjDesc; 615 ACPI_STATUS Status; 616 UINT32 Count; 617 UINT32 Size; 618 ACPI_COMPATIBLE_ID_LIST *CidList; 619 ACPI_NATIVE_UINT i; 620 621 622 ACPI_FUNCTION_TRACE (UtExecute_CID); 623 624 625 /* Evaluate the _CID method for this device */ 626 627 Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID, 628 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, 629 &ObjDesc); 630 if (ACPI_FAILURE (Status)) 631 { 632 return_ACPI_STATUS (Status); 633 } 634 635 /* Get the number of _CIDs returned */ 636 637 Count = 1; 638 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE) 639 { 640 Count = ObjDesc->Package.Count; 641 } 642 643 /* Allocate a worst-case buffer for the _CIDs */ 644 645 Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) + 646 sizeof (ACPI_COMPATIBLE_ID_LIST)); 647 648 CidList = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Size); 649 if (!CidList) 650 { 651 return_ACPI_STATUS (AE_NO_MEMORY); 652 } 653 654 /* Init CID list */ 655 656 CidList->Count = Count; 657 CidList->Size = Size; 658 659 /* 660 * A _CID can return either a single compatible ID or a package of 661 * compatible IDs. Each compatible ID can be one of the following: 662 * 1) Integer (32 bit compressed EISA ID) or 663 * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") 664 */ 665 666 /* The _CID object can be either a single CID or a package (list) of CIDs */ 667 668 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE) 669 { 670 /* Translate each package element */ 671 672 for (i = 0; i < Count; i++) 673 { 674 Status = AcpiUtTranslateOneCid (ObjDesc->Package.Elements[i], 675 &CidList->Id[i]); 676 if (ACPI_FAILURE (Status)) 677 { 678 break; 679 } 680 } 681 } 682 else 683 { 684 /* Only one CID, translate to a string */ 685 686 Status = AcpiUtTranslateOneCid (ObjDesc, CidList->Id); 687 } 688 689 /* Cleanup on error */ 690 691 if (ACPI_FAILURE (Status)) 692 { 693 ACPI_FREE (CidList); 694 } 695 else 696 { 697 *ReturnCidList = CidList; 698 } 699 700 /* On exit, we must delete the _CID return object */ 701 702 AcpiUtRemoveReference (ObjDesc); 703 return_ACPI_STATUS (Status); 704 } 705 706 707 /******************************************************************************* 708 * 709 * FUNCTION: AcpiUtExecute_UID 710 * 711 * PARAMETERS: DeviceNode - Node for the device 712 * Uid - Where the UID is returned 713 * 714 * RETURN: Status 715 * 716 * DESCRIPTION: Executes the _UID control method that returns the hardware 717 * ID of the device. 718 * 719 * NOTE: Internal function, no parameter validation 720 * 721 ******************************************************************************/ 722 723 ACPI_STATUS 724 AcpiUtExecute_UID ( 725 ACPI_NAMESPACE_NODE *DeviceNode, 726 ACPI_DEVICE_ID *Uid) 727 { 728 ACPI_OPERAND_OBJECT *ObjDesc; 729 ACPI_STATUS Status; 730 731 732 ACPI_FUNCTION_TRACE (UtExecute_UID); 733 734 735 Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID, 736 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); 737 if (ACPI_FAILURE (Status)) 738 { 739 return_ACPI_STATUS (Status); 740 } 741 742 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) 743 { 744 /* Convert the Numeric UID to string */ 745 746 AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Value); 747 } 748 else 749 { 750 /* Copy the String UID from the returned object */ 751 752 AcpiUtCopyIdString (Uid->Value, ObjDesc->String.Pointer, 753 sizeof (Uid->Value)); 754 } 755 756 /* On exit, we must delete the return object */ 757 758 AcpiUtRemoveReference (ObjDesc); 759 return_ACPI_STATUS (Status); 760 } 761 762 763 /******************************************************************************* 764 * 765 * FUNCTION: AcpiUtExecute_STA 766 * 767 * PARAMETERS: DeviceNode - Node for the device 768 * Flags - Where the status flags are returned 769 * 770 * RETURN: Status 771 * 772 * DESCRIPTION: Executes _STA for selected device and stores results in 773 * *Flags. 774 * 775 * NOTE: Internal function, no parameter validation 776 * 777 ******************************************************************************/ 778 779 ACPI_STATUS 780 AcpiUtExecute_STA ( 781 ACPI_NAMESPACE_NODE *DeviceNode, 782 UINT32 *Flags) 783 { 784 ACPI_OPERAND_OBJECT *ObjDesc; 785 ACPI_STATUS Status; 786 787 788 ACPI_FUNCTION_TRACE (UtExecute_STA); 789 790 791 Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA, 792 ACPI_BTYPE_INTEGER, &ObjDesc); 793 if (ACPI_FAILURE (Status)) 794 { 795 if (AE_NOT_FOUND == Status) 796 { 797 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 798 "_STA on %4.4s was not found, assuming device is present\n", 799 AcpiUtGetNodeName (DeviceNode))); 800 801 *Flags = ACPI_UINT32_MAX; 802 Status = AE_OK; 803 } 804 805 return_ACPI_STATUS (Status); 806 } 807 808 /* Extract the status flags */ 809 810 *Flags = (UINT32) ObjDesc->Integer.Value; 811 812 /* On exit, we must delete the return object */ 813 814 AcpiUtRemoveReference (ObjDesc); 815 return_ACPI_STATUS (Status); 816 } 817 818 819 /******************************************************************************* 820 * 821 * FUNCTION: AcpiUtExecute_Sxds 822 * 823 * PARAMETERS: DeviceNode - Node for the device 824 * Flags - Where the status flags are returned 825 * 826 * RETURN: Status 827 * 828 * DESCRIPTION: Executes _STA for selected device and stores results in 829 * *Flags. 830 * 831 * NOTE: Internal function, no parameter validation 832 * 833 ******************************************************************************/ 834 835 ACPI_STATUS 836 AcpiUtExecute_Sxds ( 837 ACPI_NAMESPACE_NODE *DeviceNode, 838 UINT8 *Highest) 839 { 840 ACPI_OPERAND_OBJECT *ObjDesc; 841 ACPI_STATUS Status; 842 UINT32 i; 843 844 845 ACPI_FUNCTION_TRACE (UtExecute_Sxds); 846 847 848 for (i = 0; i < 4; i++) 849 { 850 Highest[i] = 0xFF; 851 Status = AcpiUtEvaluateObject (DeviceNode, 852 ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]), 853 ACPI_BTYPE_INTEGER, &ObjDesc); 854 if (ACPI_FAILURE (Status)) 855 { 856 if (Status != AE_NOT_FOUND) 857 { 858 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 859 "%s on Device %4.4s, %s\n", 860 ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]), 861 AcpiUtGetNodeName (DeviceNode), 862 AcpiFormatException (Status))); 863 864 return_ACPI_STATUS (Status); 865 } 866 } 867 else 868 { 869 /* Extract the Dstate value */ 870 871 Highest[i] = (UINT8) ObjDesc->Integer.Value; 872 873 /* Delete the return object */ 874 875 AcpiUtRemoveReference (ObjDesc); 876 } 877 } 878 879 return_ACPI_STATUS (AE_OK); 880 } 881