uteval.c revision 151937
1/****************************************************************************** 2 * 3 * Module Name: uteval - Object evaluation 4 * $Revision: 1.59 $ 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2005, 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 <contrib/dev/acpica/acpi.h> 120#include <contrib/dev/acpica/acnamesp.h> 121#include <contrib/dev/acpica/acinterp.h> 122 123 124#define _COMPONENT ACPI_UTILITIES 125 ACPI_MODULE_NAME ("uteval") 126 127/* Local prototypes */ 128 129static void 130AcpiUtCopyIdString ( 131 char *Destination, 132 char *Source, 133 ACPI_SIZE MaxLength); 134 135static ACPI_STATUS 136AcpiUtTranslateOneCid ( 137 ACPI_OPERAND_OBJECT *ObjDesc, 138 ACPI_COMPATIBLE_ID *OneCid); 139 140 141/******************************************************************************* 142 * 143 * FUNCTION: AcpiUtOsiImplementation 144 * 145 * PARAMETERS: WalkState - Current walk state 146 * 147 * RETURN: Status 148 * 149 * DESCRIPTION: Implementation of _OSI predefined control method 150 * Supported = _OSI (String) 151 * 152 ******************************************************************************/ 153 154ACPI_STATUS 155AcpiUtOsiImplementation ( 156 ACPI_WALK_STATE *WalkState) 157{ 158 ACPI_OPERAND_OBJECT *StringDesc; 159 ACPI_OPERAND_OBJECT *ReturnDesc; 160 ACPI_NATIVE_UINT i; 161 162 163 ACPI_FUNCTION_TRACE ("UtOsiImplementation"); 164 165 166 /* Validate the string input argument */ 167 168 StringDesc = WalkState->Arguments[0].Object; 169 if (!StringDesc || (StringDesc->Common.Type != ACPI_TYPE_STRING)) 170 { 171 return_ACPI_STATUS (AE_TYPE); 172 } 173 174 /* Create a return object (Default value = 0) */ 175 176 ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); 177 if (!ReturnDesc) 178 { 179 return_ACPI_STATUS (AE_NO_MEMORY); 180 } 181 182 /* Compare input string to table of supported strings */ 183 184 for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) 185 { 186 if (!ACPI_STRCMP (StringDesc->String.Pointer, 187 (char *) AcpiGbl_ValidOsiStrings[i])) 188 { 189 /* This string is supported */ 190 191 ReturnDesc->Integer.Value = 0xFFFFFFFF; 192 break; 193 } 194 } 195 196 WalkState->ReturnDesc = ReturnDesc; 197 return_ACPI_STATUS (AE_CTRL_TERMINATE); 198} 199 200 201/******************************************************************************* 202 * 203 * FUNCTION: AcpiUtEvaluateObject 204 * 205 * PARAMETERS: PrefixNode - Starting node 206 * Path - Path to object from starting node 207 * ExpectedReturnTypes - Bitmap of allowed return types 208 * ReturnDesc - Where a return value is stored 209 * 210 * RETURN: Status 211 * 212 * DESCRIPTION: Evaluates a namespace object and verifies the type of the 213 * return object. Common code that simplifies accessing objects 214 * that have required return objects of fixed types. 215 * 216 * NOTE: Internal function, no parameter validation 217 * 218 ******************************************************************************/ 219 220ACPI_STATUS 221AcpiUtEvaluateObject ( 222 ACPI_NAMESPACE_NODE *PrefixNode, 223 char *Path, 224 UINT32 ExpectedReturnBtypes, 225 ACPI_OPERAND_OBJECT **ReturnDesc) 226{ 227 ACPI_PARAMETER_INFO Info; 228 ACPI_STATUS Status; 229 UINT32 ReturnBtype; 230 231 232 ACPI_FUNCTION_TRACE ("UtEvaluateObject"); 233 234 235 Info.Node = PrefixNode; 236 Info.Parameters = NULL; 237 Info.ParameterType = ACPI_PARAM_ARGS; 238 239 /* Evaluate the object/method */ 240 241 Status = AcpiNsEvaluateRelative (Path, &Info); 242 if (ACPI_FAILURE (Status)) 243 { 244 if (Status == AE_NOT_FOUND) 245 { 246 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s.%s] was not found\n", 247 AcpiUtGetNodeName (PrefixNode), Path)); 248 } 249 else 250 { 251 ACPI_REPORT_METHOD_ERROR ("Method execution failed", 252 PrefixNode, Path, Status); 253 } 254 255 return_ACPI_STATUS (Status); 256 } 257 258 /* Did we get a return object? */ 259 260 if (!Info.ReturnObject) 261 { 262 if (ExpectedReturnBtypes) 263 { 264 ACPI_REPORT_METHOD_ERROR ("No object was returned from", 265 PrefixNode, Path, AE_NOT_EXIST); 266 267 return_ACPI_STATUS (AE_NOT_EXIST); 268 } 269 270 return_ACPI_STATUS (AE_OK); 271 } 272 273 /* Map the return object type to the bitmapped type */ 274 275 switch (ACPI_GET_OBJECT_TYPE (Info.ReturnObject)) 276 { 277 case ACPI_TYPE_INTEGER: 278 ReturnBtype = ACPI_BTYPE_INTEGER; 279 break; 280 281 case ACPI_TYPE_BUFFER: 282 ReturnBtype = ACPI_BTYPE_BUFFER; 283 break; 284 285 case ACPI_TYPE_STRING: 286 ReturnBtype = ACPI_BTYPE_STRING; 287 break; 288 289 case ACPI_TYPE_PACKAGE: 290 ReturnBtype = ACPI_BTYPE_PACKAGE; 291 break; 292 293 default: 294 ReturnBtype = 0; 295 break; 296 } 297 298 if ((AcpiGbl_EnableInterpreterSlack) && 299 (!ExpectedReturnBtypes)) 300 { 301 /* 302 * We received a return object, but one was not expected. This can 303 * happen frequently if the "implicit return" feature is enabled. 304 * Just delete the return object and return AE_OK. 305 */ 306 AcpiUtRemoveReference (Info.ReturnObject); 307 return_ACPI_STATUS (AE_OK); 308 } 309 310 /* Is the return object one of the expected types? */ 311 312 if (!(ExpectedReturnBtypes & ReturnBtype)) 313 { 314 ACPI_REPORT_METHOD_ERROR ("Return object type is incorrect", 315 PrefixNode, Path, AE_TYPE); 316 317 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 318 "Type returned from %s was incorrect: %s, expected Btypes: %X\n", 319 Path, AcpiUtGetObjectTypeName (Info.ReturnObject), 320 ExpectedReturnBtypes)); 321 322 /* On error exit, we must delete the return object */ 323 324 AcpiUtRemoveReference (Info.ReturnObject); 325 return_ACPI_STATUS (AE_TYPE); 326 } 327 328 /* Object type is OK, return it */ 329 330 *ReturnDesc = Info.ReturnObject; 331 return_ACPI_STATUS (AE_OK); 332} 333 334 335/******************************************************************************* 336 * 337 * FUNCTION: AcpiUtEvaluateNumericObject 338 * 339 * PARAMETERS: ObjectName - Object name to be evaluated 340 * DeviceNode - Node for the device 341 * Address - Where the value is returned 342 * 343 * RETURN: Status 344 * 345 * DESCRIPTION: Evaluates a numeric namespace object for a selected device 346 * and stores result in *Address. 347 * 348 * NOTE: Internal function, no parameter validation 349 * 350 ******************************************************************************/ 351 352ACPI_STATUS 353AcpiUtEvaluateNumericObject ( 354 char *ObjectName, 355 ACPI_NAMESPACE_NODE *DeviceNode, 356 ACPI_INTEGER *Address) 357{ 358 ACPI_OPERAND_OBJECT *ObjDesc; 359 ACPI_STATUS Status; 360 361 362 ACPI_FUNCTION_TRACE ("UtEvaluateNumericObject"); 363 364 365 Status = AcpiUtEvaluateObject (DeviceNode, ObjectName, 366 ACPI_BTYPE_INTEGER, &ObjDesc); 367 if (ACPI_FAILURE (Status)) 368 { 369 return_ACPI_STATUS (Status); 370 } 371 372 /* Get the returned Integer */ 373 374 *Address = ObjDesc->Integer.Value; 375 376 /* On exit, we must delete the return object */ 377 378 AcpiUtRemoveReference (ObjDesc); 379 return_ACPI_STATUS (Status); 380} 381 382 383/******************************************************************************* 384 * 385 * FUNCTION: AcpiUtCopyIdString 386 * 387 * PARAMETERS: Destination - Where to copy the string 388 * Source - Source string 389 * MaxLength - Length of the destination buffer 390 * 391 * RETURN: None 392 * 393 * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. 394 * Performs removal of a leading asterisk if present -- workaround 395 * for a known issue on a bunch of machines. 396 * 397 ******************************************************************************/ 398 399static void 400AcpiUtCopyIdString ( 401 char *Destination, 402 char *Source, 403 ACPI_SIZE MaxLength) 404{ 405 406 /* 407 * Workaround for ID strings that have a leading asterisk. This construct 408 * is not allowed by the ACPI specification (ID strings must be 409 * alphanumeric), but enough existing machines have this embedded in their 410 * ID strings that the following code is useful. 411 */ 412 if (*Source == '*') 413 { 414 Source++; 415 } 416 417 /* Do the actual copy */ 418 419 ACPI_STRNCPY (Destination, Source, MaxLength); 420} 421 422 423/******************************************************************************* 424 * 425 * FUNCTION: AcpiUtExecute_HID 426 * 427 * PARAMETERS: DeviceNode - Node for the device 428 * Hid - Where the HID is returned 429 * 430 * RETURN: Status 431 * 432 * DESCRIPTION: Executes the _HID control method that returns the hardware 433 * ID of the device. 434 * 435 * NOTE: Internal function, no parameter validation 436 * 437 ******************************************************************************/ 438 439ACPI_STATUS 440AcpiUtExecute_HID ( 441 ACPI_NAMESPACE_NODE *DeviceNode, 442 ACPI_DEVICE_ID *Hid) 443{ 444 ACPI_OPERAND_OBJECT *ObjDesc; 445 ACPI_STATUS Status; 446 447 448 ACPI_FUNCTION_TRACE ("UtExecute_HID"); 449 450 451 Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID, 452 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); 453 if (ACPI_FAILURE (Status)) 454 { 455 return_ACPI_STATUS (Status); 456 } 457 458 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) 459 { 460 /* Convert the Numeric HID to string */ 461 462 AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Value); 463 } 464 else 465 { 466 /* Copy the String HID from the returned object */ 467 468 AcpiUtCopyIdString (Hid->Value, ObjDesc->String.Pointer, 469 sizeof (Hid->Value)); 470 } 471 472 /* On exit, we must delete the return object */ 473 474 AcpiUtRemoveReference (ObjDesc); 475 return_ACPI_STATUS (Status); 476} 477 478 479/******************************************************************************* 480 * 481 * FUNCTION: AcpiUtTranslateOneCid 482 * 483 * PARAMETERS: ObjDesc - _CID object, must be integer or string 484 * OneCid - Where the CID string is returned 485 * 486 * RETURN: Status 487 * 488 * DESCRIPTION: Return a numeric or string _CID value as a string. 489 * (Compatible ID) 490 * 491 * NOTE: Assumes a maximum _CID string length of 492 * ACPI_MAX_CID_LENGTH. 493 * 494 ******************************************************************************/ 495 496static ACPI_STATUS 497AcpiUtTranslateOneCid ( 498 ACPI_OPERAND_OBJECT *ObjDesc, 499 ACPI_COMPATIBLE_ID *OneCid) 500{ 501 502 503 switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) 504 { 505 case ACPI_TYPE_INTEGER: 506 507 /* Convert the Numeric CID to string */ 508 509 AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, OneCid->Value); 510 return (AE_OK); 511 512 case ACPI_TYPE_STRING: 513 514 if (ObjDesc->String.Length > ACPI_MAX_CID_LENGTH) 515 { 516 return (AE_AML_STRING_LIMIT); 517 } 518 519 /* Copy the String CID from the returned object */ 520 521 AcpiUtCopyIdString (OneCid->Value, ObjDesc->String.Pointer, 522 ACPI_MAX_CID_LENGTH); 523 return (AE_OK); 524 525 default: 526 527 return (AE_TYPE); 528 } 529} 530 531 532/******************************************************************************* 533 * 534 * FUNCTION: AcpiUtExecute_CID 535 * 536 * PARAMETERS: DeviceNode - Node for the device 537 * ReturnCidList - Where the CID list is returned 538 * 539 * RETURN: Status 540 * 541 * DESCRIPTION: Executes the _CID control method that returns one or more 542 * compatible hardware IDs for the device. 543 * 544 * NOTE: Internal function, no parameter validation 545 * 546 ******************************************************************************/ 547 548ACPI_STATUS 549AcpiUtExecute_CID ( 550 ACPI_NAMESPACE_NODE *DeviceNode, 551 ACPI_COMPATIBLE_ID_LIST **ReturnCidList) 552{ 553 ACPI_OPERAND_OBJECT *ObjDesc; 554 ACPI_STATUS Status; 555 UINT32 Count; 556 UINT32 Size; 557 ACPI_COMPATIBLE_ID_LIST *CidList; 558 ACPI_NATIVE_UINT i; 559 560 561 ACPI_FUNCTION_TRACE ("UtExecute_CID"); 562 563 564 /* Evaluate the _CID method for this device */ 565 566 Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__CID, 567 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_PACKAGE, 568 &ObjDesc); 569 if (ACPI_FAILURE (Status)) 570 { 571 return_ACPI_STATUS (Status); 572 } 573 574 /* Get the number of _CIDs returned */ 575 576 Count = 1; 577 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE) 578 { 579 Count = ObjDesc->Package.Count; 580 } 581 582 /* Allocate a worst-case buffer for the _CIDs */ 583 584 Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) + 585 sizeof (ACPI_COMPATIBLE_ID_LIST)); 586 587 CidList = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Size); 588 if (!CidList) 589 { 590 return_ACPI_STATUS (AE_NO_MEMORY); 591 } 592 593 /* Init CID list */ 594 595 CidList->Count = Count; 596 CidList->Size = Size; 597 598 /* 599 * A _CID can return either a single compatible ID or a package of 600 * compatible IDs. Each compatible ID can be one of the following: 601 * 1) Integer (32 bit compressed EISA ID) or 602 * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss") 603 */ 604 605 /* The _CID object can be either a single CID or a package (list) of CIDs */ 606 607 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_PACKAGE) 608 { 609 /* Translate each package element */ 610 611 for (i = 0; i < Count; i++) 612 { 613 Status = AcpiUtTranslateOneCid (ObjDesc->Package.Elements[i], 614 &CidList->Id[i]); 615 if (ACPI_FAILURE (Status)) 616 { 617 break; 618 } 619 } 620 } 621 else 622 { 623 /* Only one CID, translate to a string */ 624 625 Status = AcpiUtTranslateOneCid (ObjDesc, CidList->Id); 626 } 627 628 /* Cleanup on error */ 629 630 if (ACPI_FAILURE (Status)) 631 { 632 ACPI_MEM_FREE (CidList); 633 } 634 else 635 { 636 *ReturnCidList = CidList; 637 } 638 639 /* On exit, we must delete the _CID return object */ 640 641 AcpiUtRemoveReference (ObjDesc); 642 return_ACPI_STATUS (Status); 643} 644 645 646/******************************************************************************* 647 * 648 * FUNCTION: AcpiUtExecute_UID 649 * 650 * PARAMETERS: DeviceNode - Node for the device 651 * Uid - Where the UID is returned 652 * 653 * RETURN: Status 654 * 655 * DESCRIPTION: Executes the _UID control method that returns the hardware 656 * ID of the device. 657 * 658 * NOTE: Internal function, no parameter validation 659 * 660 ******************************************************************************/ 661 662ACPI_STATUS 663AcpiUtExecute_UID ( 664 ACPI_NAMESPACE_NODE *DeviceNode, 665 ACPI_DEVICE_ID *Uid) 666{ 667 ACPI_OPERAND_OBJECT *ObjDesc; 668 ACPI_STATUS Status; 669 670 671 ACPI_FUNCTION_TRACE ("UtExecute_UID"); 672 673 674 Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID, 675 ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING, &ObjDesc); 676 if (ACPI_FAILURE (Status)) 677 { 678 return_ACPI_STATUS (Status); 679 } 680 681 if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) 682 { 683 /* Convert the Numeric UID to string */ 684 685 AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Value); 686 } 687 else 688 { 689 /* Copy the String UID from the returned object */ 690 691 AcpiUtCopyIdString (Uid->Value, ObjDesc->String.Pointer, 692 sizeof (Uid->Value)); 693 } 694 695 /* On exit, we must delete the return object */ 696 697 AcpiUtRemoveReference (ObjDesc); 698 return_ACPI_STATUS (Status); 699} 700 701 702/******************************************************************************* 703 * 704 * FUNCTION: AcpiUtExecute_STA 705 * 706 * PARAMETERS: DeviceNode - Node for the device 707 * Flags - Where the status flags are returned 708 * 709 * RETURN: Status 710 * 711 * DESCRIPTION: Executes _STA for selected device and stores results in 712 * *Flags. 713 * 714 * NOTE: Internal function, no parameter validation 715 * 716 ******************************************************************************/ 717 718ACPI_STATUS 719AcpiUtExecute_STA ( 720 ACPI_NAMESPACE_NODE *DeviceNode, 721 UINT32 *Flags) 722{ 723 ACPI_OPERAND_OBJECT *ObjDesc; 724 ACPI_STATUS Status; 725 726 727 ACPI_FUNCTION_TRACE ("UtExecute_STA"); 728 729 730 Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA, 731 ACPI_BTYPE_INTEGER, &ObjDesc); 732 if (ACPI_FAILURE (Status)) 733 { 734 if (AE_NOT_FOUND == Status) 735 { 736 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 737 "_STA on %4.4s was not found, assuming device is present\n", 738 AcpiUtGetNodeName (DeviceNode))); 739 740 *Flags = 0x0F; 741 Status = AE_OK; 742 } 743 744 return_ACPI_STATUS (Status); 745 } 746 747 /* Extract the status flags */ 748 749 *Flags = (UINT32) ObjDesc->Integer.Value; 750 751 /* On exit, we must delete the return object */ 752 753 AcpiUtRemoveReference (ObjDesc); 754 return_ACPI_STATUS (Status); 755} 756 757 758/******************************************************************************* 759 * 760 * FUNCTION: AcpiUtExecute_Sxds 761 * 762 * PARAMETERS: DeviceNode - Node for the device 763 * Flags - Where the status flags are returned 764 * 765 * RETURN: Status 766 * 767 * DESCRIPTION: Executes _STA for selected device and stores results in 768 * *Flags. 769 * 770 * NOTE: Internal function, no parameter validation 771 * 772 ******************************************************************************/ 773 774ACPI_STATUS 775AcpiUtExecute_Sxds ( 776 ACPI_NAMESPACE_NODE *DeviceNode, 777 UINT8 *Highest) 778{ 779 ACPI_OPERAND_OBJECT *ObjDesc; 780 ACPI_STATUS Status; 781 UINT32 i; 782 783 784 ACPI_FUNCTION_TRACE ("UtExecute_Sxds"); 785 786 787 for (i = 0; i < 4; i++) 788 { 789 Highest[i] = 0xFF; 790 Status = AcpiUtEvaluateObject (DeviceNode, 791 (char *) AcpiGbl_HighestDstateNames[i], 792 ACPI_BTYPE_INTEGER, &ObjDesc); 793 if (ACPI_FAILURE (Status)) 794 { 795 if (Status != AE_NOT_FOUND) 796 { 797 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 798 "%s on Device %4.4s, %s\n", 799 (char *) AcpiGbl_HighestDstateNames[i], 800 AcpiUtGetNodeName (DeviceNode), 801 AcpiFormatException (Status))); 802 803 return_ACPI_STATUS (Status); 804 } 805 } 806 else 807 { 808 /* Extract the Dstate value */ 809 810 Highest[i] = (UINT8) ObjDesc->Integer.Value; 811 812 /* Delete the return object */ 813 814 AcpiUtRemoveReference (ObjDesc); 815 } 816 } 817 818 return_ACPI_STATUS (AE_OK); 819} 820