1 /****************************************************************************** 2 * 3 * Module Name: hwxface - Public ACPICA hardware interfaces 4 * 5 *****************************************************************************/ 6 7 /****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2013, 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 #include "acpi.h" 117 #include "accommon.h" 118 #include "acnamesp.h" 119 120 #define _COMPONENT ACPI_HARDWARE 121 ACPI_MODULE_NAME ("hwxface") 122 123 124 /****************************************************************************** 125 * 126 * FUNCTION: AcpiReset 127 * 128 * PARAMETERS: None 129 * 130 * RETURN: Status 131 * 132 * DESCRIPTION: Set reset register in memory or IO space. Note: Does not 133 * support reset register in PCI config space, this must be 134 * handled separately. 135 * 136 ******************************************************************************/ 137 138 ACPI_STATUS 139 AcpiReset ( 140 void) 141 { 142 ACPI_GENERIC_ADDRESS *ResetReg; 143 ACPI_STATUS Status; 144 145 146 ACPI_FUNCTION_TRACE (AcpiReset); 147 148 149 ResetReg = &AcpiGbl_FADT.ResetRegister; 150 151 /* Check if the reset register is supported */ 152 153 if (!(AcpiGbl_FADT.Flags & ACPI_FADT_RESET_REGISTER) || 154 !ResetReg->Address) 155 { 156 return_ACPI_STATUS (AE_NOT_EXIST); 157 } 158 159 if (ResetReg->SpaceId == ACPI_ADR_SPACE_SYSTEM_IO) 160 { 161 /* 162 * For I/O space, write directly to the OSL. This bypasses the port 163 * validation mechanism, which may block a valid write to the reset 164 * register. 165 */ 166 Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ResetReg->Address, 167 AcpiGbl_FADT.ResetValue, ResetReg->BitWidth); 168 } 169 else 170 { 171 /* Write the reset value to the reset register */ 172 173 Status = AcpiHwWrite (AcpiGbl_FADT.ResetValue, ResetReg); 174 } 175 176 return_ACPI_STATUS (Status); 177 } 178 179 ACPI_EXPORT_SYMBOL (AcpiReset) 180 181 182 /****************************************************************************** 183 * 184 * FUNCTION: AcpiRead 185 * 186 * PARAMETERS: Value - Where the value is returned 187 * Reg - GAS register structure 188 * 189 * RETURN: Status 190 * 191 * DESCRIPTION: Read from either memory or IO space. 192 * 193 * LIMITATIONS: <These limitations also apply to AcpiWrite> 194 * BitWidth must be exactly 8, 16, 32, or 64. 195 * SpaceID must be SystemMemory or SystemIO. 196 * BitOffset and AccessWidth are currently ignored, as there has 197 * not been a need to implement these. 198 * 199 ******************************************************************************/ 200 201 ACPI_STATUS 202 AcpiRead ( 203 UINT64 *ReturnValue, 204 ACPI_GENERIC_ADDRESS *Reg) 205 { 206 UINT32 ValueLo; 207 UINT32 ValueHi; 208 UINT32 Width; 209 UINT64 Address; 210 ACPI_STATUS Status; 211 212 213 ACPI_FUNCTION_NAME (AcpiRead); 214 215 216 if (!ReturnValue) 217 { 218 return (AE_BAD_PARAMETER); 219 } 220 221 /* Validate contents of the GAS register. Allow 64-bit transfers */ 222 223 Status = AcpiHwValidateRegister (Reg, 64, &Address); 224 if (ACPI_FAILURE (Status)) 225 { 226 return (Status); 227 } 228 229 /* 230 * Two address spaces supported: Memory or I/O. PCI_Config is 231 * not supported here because the GAS structure is insufficient 232 */ 233 if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) 234 { 235 Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) 236 Address, ReturnValue, Reg->BitWidth); 237 if (ACPI_FAILURE (Status)) 238 { 239 return (Status); 240 } 241 } 242 else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ 243 { 244 ValueLo = 0; 245 ValueHi = 0; 246 247 Width = Reg->BitWidth; 248 if (Width == 64) 249 { 250 Width = 32; /* Break into two 32-bit transfers */ 251 } 252 253 Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) 254 Address, &ValueLo, Width); 255 if (ACPI_FAILURE (Status)) 256 { 257 return (Status); 258 } 259 260 if (Reg->BitWidth == 64) 261 { 262 /* Read the top 32 bits */ 263 264 Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) 265 (Address + 4), &ValueHi, 32); 266 if (ACPI_FAILURE (Status)) 267 { 268 return (Status); 269 } 270 } 271 272 /* Set the return value only if status is AE_OK */ 273 274 *ReturnValue = (ValueLo | ((UINT64) ValueHi << 32)); 275 } 276 277 ACPI_DEBUG_PRINT ((ACPI_DB_IO, 278 "Read: %8.8X%8.8X width %2d from %8.8X%8.8X (%s)\n", 279 ACPI_FORMAT_UINT64 (*ReturnValue), Reg->BitWidth, 280 ACPI_FORMAT_UINT64 (Address), 281 AcpiUtGetRegionName (Reg->SpaceId))); 282 283 return (AE_OK); 284 } 285 286 ACPI_EXPORT_SYMBOL (AcpiRead) 287 288 289 /****************************************************************************** 290 * 291 * FUNCTION: AcpiWrite 292 * 293 * PARAMETERS: Value - Value to be written 294 * Reg - GAS register structure 295 * 296 * RETURN: Status 297 * 298 * DESCRIPTION: Write to either memory or IO space. 299 * 300 ******************************************************************************/ 301 302 ACPI_STATUS 303 AcpiWrite ( 304 UINT64 Value, 305 ACPI_GENERIC_ADDRESS *Reg) 306 { 307 UINT32 Width; 308 UINT64 Address; 309 ACPI_STATUS Status; 310 311 312 ACPI_FUNCTION_NAME (AcpiWrite); 313 314 315 /* Validate contents of the GAS register. Allow 64-bit transfers */ 316 317 Status = AcpiHwValidateRegister (Reg, 64, &Address); 318 if (ACPI_FAILURE (Status)) 319 { 320 return (Status); 321 } 322 323 /* 324 * Two address spaces supported: Memory or IO. PCI_Config is 325 * not supported here because the GAS structure is insufficient 326 */ 327 if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) 328 { 329 Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) 330 Address, Value, Reg->BitWidth); 331 if (ACPI_FAILURE (Status)) 332 { 333 return (Status); 334 } 335 } 336 else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ 337 { 338 Width = Reg->BitWidth; 339 if (Width == 64) 340 { 341 Width = 32; /* Break into two 32-bit transfers */ 342 } 343 344 Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) 345 Address, ACPI_LODWORD (Value), Width); 346 if (ACPI_FAILURE (Status)) 347 { 348 return (Status); 349 } 350 351 if (Reg->BitWidth == 64) 352 { 353 Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) 354 (Address + 4), ACPI_HIDWORD (Value), 32); 355 if (ACPI_FAILURE (Status)) 356 { 357 return (Status); 358 } 359 } 360 } 361 362 ACPI_DEBUG_PRINT ((ACPI_DB_IO, 363 "Wrote: %8.8X%8.8X width %2d to %8.8X%8.8X (%s)\n", 364 ACPI_FORMAT_UINT64 (Value), Reg->BitWidth, 365 ACPI_FORMAT_UINT64 (Address), 366 AcpiUtGetRegionName (Reg->SpaceId))); 367 368 return (Status); 369 } 370 371 ACPI_EXPORT_SYMBOL (AcpiWrite) 372 373 374 #if (!ACPI_REDUCED_HARDWARE) 375 /******************************************************************************* 376 * 377 * FUNCTION: AcpiReadBitRegister 378 * 379 * PARAMETERS: RegisterId - ID of ACPI Bit Register to access 380 * ReturnValue - Value that was read from the register, 381 * normalized to bit position zero. 382 * 383 * RETURN: Status and the value read from the specified Register. Value 384 * returned is normalized to bit0 (is shifted all the way right) 385 * 386 * DESCRIPTION: ACPI BitRegister read function. Does not acquire the HW lock. 387 * 388 * SUPPORTS: Bit fields in PM1 Status, PM1 Enable, PM1 Control, and 389 * PM2 Control. 390 * 391 * Note: The hardware lock is not required when reading the ACPI bit registers 392 * since almost all of them are single bit and it does not matter that 393 * the parent hardware register can be split across two physical 394 * registers. The only multi-bit field is SLP_TYP in the PM1 control 395 * register, but this field does not cross an 8-bit boundary (nor does 396 * it make much sense to actually read this field.) 397 * 398 ******************************************************************************/ 399 400 ACPI_STATUS 401 AcpiReadBitRegister ( 402 UINT32 RegisterId, 403 UINT32 *ReturnValue) 404 { 405 ACPI_BIT_REGISTER_INFO *BitRegInfo; 406 UINT32 RegisterValue; 407 UINT32 Value; 408 ACPI_STATUS Status; 409 410 411 ACPI_FUNCTION_TRACE_U32 (AcpiReadBitRegister, RegisterId); 412 413 414 /* Get the info structure corresponding to the requested ACPI Register */ 415 416 BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId); 417 if (!BitRegInfo) 418 { 419 return_ACPI_STATUS (AE_BAD_PARAMETER); 420 } 421 422 /* Read the entire parent register */ 423 424 Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister, 425 &RegisterValue); 426 if (ACPI_FAILURE (Status)) 427 { 428 return_ACPI_STATUS (Status); 429 } 430 431 /* Normalize the value that was read, mask off other bits */ 432 433 Value = ((RegisterValue & BitRegInfo->AccessBitMask) 434 >> BitRegInfo->BitPosition); 435 436 ACPI_DEBUG_PRINT ((ACPI_DB_IO, 437 "BitReg %X, ParentReg %X, Actual %8.8X, ReturnValue %8.8X\n", 438 RegisterId, BitRegInfo->ParentRegister, RegisterValue, Value)); 439 440 *ReturnValue = Value; 441 return_ACPI_STATUS (AE_OK); 442 } 443 444 ACPI_EXPORT_SYMBOL (AcpiReadBitRegister) 445 446 447 /******************************************************************************* 448 * 449 * FUNCTION: AcpiWriteBitRegister 450 * 451 * PARAMETERS: RegisterId - ID of ACPI Bit Register to access 452 * Value - Value to write to the register, in bit 453 * position zero. The bit is automatically 454 * shifted to the correct position. 455 * 456 * RETURN: Status 457 * 458 * DESCRIPTION: ACPI Bit Register write function. Acquires the hardware lock 459 * since most operations require a read/modify/write sequence. 460 * 461 * SUPPORTS: Bit fields in PM1 Status, PM1 Enable, PM1 Control, and 462 * PM2 Control. 463 * 464 * Note that at this level, the fact that there may be actually two 465 * hardware registers (A and B - and B may not exist) is abstracted. 466 * 467 ******************************************************************************/ 468 469 ACPI_STATUS 470 AcpiWriteBitRegister ( 471 UINT32 RegisterId, 472 UINT32 Value) 473 { 474 ACPI_BIT_REGISTER_INFO *BitRegInfo; 475 ACPI_CPU_FLAGS LockFlags; 476 UINT32 RegisterValue; 477 ACPI_STATUS Status = AE_OK; 478 479 480 ACPI_FUNCTION_TRACE_U32 (AcpiWriteBitRegister, RegisterId); 481 482 483 /* Get the info structure corresponding to the requested ACPI Register */ 484 485 BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId); 486 if (!BitRegInfo) 487 { 488 return_ACPI_STATUS (AE_BAD_PARAMETER); 489 } 490 491 LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock); 492 493 /* 494 * At this point, we know that the parent register is one of the 495 * following: PM1 Status, PM1 Enable, PM1 Control, or PM2 Control 496 */ 497 if (BitRegInfo->ParentRegister != ACPI_REGISTER_PM1_STATUS) 498 { 499 /* 500 * 1) Case for PM1 Enable, PM1 Control, and PM2 Control 501 * 502 * Perform a register read to preserve the bits that we are not 503 * interested in 504 */ 505 Status = AcpiHwRegisterRead (BitRegInfo->ParentRegister, 506 &RegisterValue); 507 if (ACPI_FAILURE (Status)) 508 { 509 goto UnlockAndExit; 510 } 511 512 /* 513 * Insert the input bit into the value that was just read 514 * and write the register 515 */ 516 ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, 517 BitRegInfo->AccessBitMask, Value); 518 519 Status = AcpiHwRegisterWrite (BitRegInfo->ParentRegister, 520 RegisterValue); 521 } 522 else 523 { 524 /* 525 * 2) Case for PM1 Status 526 * 527 * The Status register is different from the rest. Clear an event 528 * by writing 1, writing 0 has no effect. So, the only relevant 529 * information is the single bit we're interested in, all others 530 * should be written as 0 so they will be left unchanged. 531 */ 532 RegisterValue = ACPI_REGISTER_PREPARE_BITS (Value, 533 BitRegInfo->BitPosition, BitRegInfo->AccessBitMask); 534 535 /* No need to write the register if value is all zeros */ 536 537 if (RegisterValue) 538 { 539 Status = AcpiHwRegisterWrite (ACPI_REGISTER_PM1_STATUS, 540 RegisterValue); 541 } 542 } 543 544 ACPI_DEBUG_PRINT ((ACPI_DB_IO, 545 "BitReg %X, ParentReg %X, Value %8.8X, Actual %8.8X\n", 546 RegisterId, BitRegInfo->ParentRegister, Value, RegisterValue)); 547 548 549 UnlockAndExit: 550 551 AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags); 552 return_ACPI_STATUS (Status); 553 } 554 555 ACPI_EXPORT_SYMBOL (AcpiWriteBitRegister) 556 557 #endif /* !ACPI_REDUCED_HARDWARE */ 558 559 560 /******************************************************************************* 561 * 562 * FUNCTION: AcpiGetSleepTypeData 563 * 564 * PARAMETERS: SleepState - Numeric sleep state 565 * *SleepTypeA - Where SLP_TYPa is returned 566 * *SleepTypeB - Where SLP_TYPb is returned 567 * 568 * RETURN: Status 569 * 570 * DESCRIPTION: Obtain the SLP_TYPa and SLP_TYPb values for the requested 571 * sleep state via the appropriate \_Sx object. 572 * 573 * The sleep state package returned from the corresponding \_Sx_ object 574 * must contain at least one integer. 575 * 576 * March 2005: 577 * Added support for a package that contains two integers. This 578 * goes against the ACPI specification which defines this object as a 579 * package with one encoded DWORD integer. However, existing practice 580 * by many BIOS vendors is to return a package with 2 or more integer 581 * elements, at least one per sleep type (A/B). 582 * 583 * January 2013: 584 * Therefore, we must be prepared to accept a package with either a 585 * single integer or multiple integers. 586 * 587 * The single integer DWORD format is as follows: 588 * BYTE 0 - Value for the PM1A SLP_TYP register 589 * BYTE 1 - Value for the PM1B SLP_TYP register 590 * BYTE 2-3 - Reserved 591 * 592 * The dual integer format is as follows: 593 * Integer 0 - Value for the PM1A SLP_TYP register 594 * Integer 1 - Value for the PM1A SLP_TYP register 595 * 596 ******************************************************************************/ 597 598 ACPI_STATUS 599 AcpiGetSleepTypeData ( 600 UINT8 SleepState, 601 UINT8 *SleepTypeA, 602 UINT8 *SleepTypeB) 603 { 604 ACPI_STATUS Status; 605 ACPI_EVALUATE_INFO *Info; 606 ACPI_OPERAND_OBJECT **Elements; 607 608 609 ACPI_FUNCTION_TRACE (AcpiGetSleepTypeData); 610 611 612 /* Validate parameters */ 613 614 if ((SleepState > ACPI_S_STATES_MAX) || 615 !SleepTypeA || !SleepTypeB) 616 { 617 return_ACPI_STATUS (AE_BAD_PARAMETER); 618 } 619 620 /* Allocate the evaluation information block */ 621 622 Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO)); 623 if (!Info) 624 { 625 return_ACPI_STATUS (AE_NO_MEMORY); 626 } 627 628 /* 629 * Evaluate the \_Sx namespace object containing the register values 630 * for this state 631 */ 632 Info->RelativePathname = ACPI_CAST_PTR ( 633 char, AcpiGbl_SleepStateNames[SleepState]); 634 Status = AcpiNsEvaluate (Info); 635 if (ACPI_FAILURE (Status)) 636 { 637 goto Cleanup; 638 } 639 640 /* Must have a return object */ 641 642 if (!Info->ReturnObject) 643 { 644 ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]", 645 Info->RelativePathname)); 646 Status = AE_AML_NO_RETURN_VALUE; 647 goto Cleanup; 648 } 649 650 /* Return object must be of type Package */ 651 652 if (Info->ReturnObject->Common.Type != ACPI_TYPE_PACKAGE) 653 { 654 ACPI_ERROR ((AE_INFO, "Sleep State return object is not a Package")); 655 Status = AE_AML_OPERAND_TYPE; 656 goto Cleanup1; 657 } 658 659 /* 660 * Any warnings about the package length or the object types have 661 * already been issued by the predefined name module -- there is no 662 * need to repeat them here. 663 */ 664 Elements = Info->ReturnObject->Package.Elements; 665 switch (Info->ReturnObject->Package.Count) 666 { 667 case 0: 668 669 Status = AE_AML_PACKAGE_LIMIT; 670 break; 671 672 case 1: 673 674 if (Elements[0]->Common.Type != ACPI_TYPE_INTEGER) 675 { 676 Status = AE_AML_OPERAND_TYPE; 677 break; 678 } 679 680 /* A valid _Sx_ package with one integer */ 681 682 *SleepTypeA = (UINT8) Elements[0]->Integer.Value; 683 *SleepTypeB = (UINT8) (Elements[0]->Integer.Value >> 8); 684 break; 685 686 case 2: 687 default: 688 689 if ((Elements[0]->Common.Type != ACPI_TYPE_INTEGER) || 690 (Elements[1]->Common.Type != ACPI_TYPE_INTEGER)) 691 { 692 Status = AE_AML_OPERAND_TYPE; 693 break; 694 } 695 696 /* A valid _Sx_ package with two integers */ 697 698 *SleepTypeA = (UINT8) Elements[0]->Integer.Value; 699 *SleepTypeB = (UINT8) Elements[1]->Integer.Value; 700 break; 701 } 702 703 Cleanup1: 704 AcpiUtRemoveReference (Info->ReturnObject); 705 706 Cleanup: 707 if (ACPI_FAILURE (Status)) 708 { 709 ACPI_EXCEPTION ((AE_INFO, Status, 710 "While evaluating Sleep State [%s]", Info->RelativePathname)); 711 } 712 713 ACPI_FREE (Info); 714 return_ACPI_STATUS (Status); 715 } 716 717 ACPI_EXPORT_SYMBOL (AcpiGetSleepTypeData) 718