1 /****************************************************************************** 2 * 3 * Module Name: utxface - External interfaces, miscellaneous utility functions 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 117 #define __UTXFACE_C__ 118 119 #include "acpi.h" 120 #include "accommon.h" 121 #include "acdebug.h" 122 123 #define _COMPONENT ACPI_UTILITIES 124 ACPI_MODULE_NAME ("utxface") 125 126 127 /******************************************************************************* 128 * 129 * FUNCTION: AcpiTerminate 130 * 131 * PARAMETERS: None 132 * 133 * RETURN: Status 134 * 135 * DESCRIPTION: Shutdown the ACPICA subsystem and release all resources. 136 * 137 ******************************************************************************/ 138 139 ACPI_STATUS 140 AcpiTerminate ( 141 void) 142 { 143 ACPI_STATUS Status; 144 145 146 ACPI_FUNCTION_TRACE (AcpiTerminate); 147 148 149 /* Just exit if subsystem is already shutdown */ 150 151 if (AcpiGbl_Shutdown) 152 { 153 ACPI_ERROR ((AE_INFO, "ACPI Subsystem is already terminated")); 154 return_ACPI_STATUS (AE_OK); 155 } 156 157 /* Subsystem appears active, go ahead and shut it down */ 158 159 AcpiGbl_Shutdown = TRUE; 160 AcpiGbl_StartupFlags = 0; 161 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem\n")); 162 163 /* Terminate the AML Debugger if present */ 164 165 ACPI_DEBUGGER_EXEC (AcpiGbl_DbTerminateThreads = TRUE); 166 167 /* Shutdown and free all resources */ 168 169 AcpiUtSubsystemShutdown (); 170 171 /* Free the mutex objects */ 172 173 AcpiUtMutexTerminate (); 174 175 176 #ifdef ACPI_DEBUGGER 177 178 /* Shut down the debugger */ 179 180 AcpiDbTerminate (); 181 #endif 182 183 /* Now we can shutdown the OS-dependent layer */ 184 185 Status = AcpiOsTerminate (); 186 return_ACPI_STATUS (Status); 187 } 188 189 ACPI_EXPORT_SYMBOL (AcpiTerminate) 190 191 192 #ifndef ACPI_ASL_COMPILER 193 /******************************************************************************* 194 * 195 * FUNCTION: AcpiSubsystemStatus 196 * 197 * PARAMETERS: None 198 * 199 * RETURN: Status of the ACPI subsystem 200 * 201 * DESCRIPTION: Other drivers that use the ACPI subsystem should call this 202 * before making any other calls, to ensure the subsystem 203 * initialized successfully. 204 * 205 ******************************************************************************/ 206 207 ACPI_STATUS 208 AcpiSubsystemStatus ( 209 void) 210 { 211 212 if (AcpiGbl_StartupFlags & ACPI_INITIALIZED_OK) 213 { 214 return (AE_OK); 215 } 216 else 217 { 218 return (AE_ERROR); 219 } 220 } 221 222 ACPI_EXPORT_SYMBOL (AcpiSubsystemStatus) 223 224 225 /******************************************************************************* 226 * 227 * FUNCTION: AcpiGetSystemInfo 228 * 229 * PARAMETERS: OutBuffer - A buffer to receive the resources for the 230 * device 231 * 232 * RETURN: Status - the status of the call 233 * 234 * DESCRIPTION: This function is called to get information about the current 235 * state of the ACPI subsystem. It will return system information 236 * in the OutBuffer. 237 * 238 * If the function fails an appropriate status will be returned 239 * and the value of OutBuffer is undefined. 240 * 241 ******************************************************************************/ 242 243 ACPI_STATUS 244 AcpiGetSystemInfo ( 245 ACPI_BUFFER *OutBuffer) 246 { 247 ACPI_SYSTEM_INFO *InfoPtr; 248 ACPI_STATUS Status; 249 250 251 ACPI_FUNCTION_TRACE (AcpiGetSystemInfo); 252 253 254 /* Parameter validation */ 255 256 Status = AcpiUtValidateBuffer (OutBuffer); 257 if (ACPI_FAILURE (Status)) 258 { 259 return_ACPI_STATUS (Status); 260 } 261 262 /* Validate/Allocate/Clear caller buffer */ 263 264 Status = AcpiUtInitializeBuffer (OutBuffer, sizeof (ACPI_SYSTEM_INFO)); 265 if (ACPI_FAILURE (Status)) 266 { 267 return_ACPI_STATUS (Status); 268 } 269 270 /* 271 * Populate the return buffer 272 */ 273 InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer; 274 275 InfoPtr->AcpiCaVersion = ACPI_CA_VERSION; 276 277 /* System flags (ACPI capabilities) */ 278 279 InfoPtr->Flags = ACPI_SYS_MODE_ACPI; 280 281 /* Timer resolution - 24 or 32 bits */ 282 283 if (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) 284 { 285 InfoPtr->TimerResolution = 24; 286 } 287 else 288 { 289 InfoPtr->TimerResolution = 32; 290 } 291 292 /* Clear the reserved fields */ 293 294 InfoPtr->Reserved1 = 0; 295 InfoPtr->Reserved2 = 0; 296 297 /* Current debug levels */ 298 299 InfoPtr->DebugLayer = AcpiDbgLayer; 300 InfoPtr->DebugLevel = AcpiDbgLevel; 301 302 return_ACPI_STATUS (AE_OK); 303 } 304 305 ACPI_EXPORT_SYMBOL (AcpiGetSystemInfo) 306 307 308 /******************************************************************************* 309 * 310 * FUNCTION: AcpiGetStatistics 311 * 312 * PARAMETERS: Stats - Where the statistics are returned 313 * 314 * RETURN: Status - the status of the call 315 * 316 * DESCRIPTION: Get the contents of the various system counters 317 * 318 ******************************************************************************/ 319 320 ACPI_STATUS 321 AcpiGetStatistics ( 322 ACPI_STATISTICS *Stats) 323 { 324 ACPI_FUNCTION_TRACE (AcpiGetStatistics); 325 326 327 /* Parameter validation */ 328 329 if (!Stats) 330 { 331 return_ACPI_STATUS (AE_BAD_PARAMETER); 332 } 333 334 /* Various interrupt-based event counters */ 335 336 Stats->SciCount = AcpiSciCount; 337 Stats->GpeCount = AcpiGpeCount; 338 339 ACPI_MEMCPY (Stats->FixedEventCount, AcpiFixedEventCount, 340 sizeof (AcpiFixedEventCount)); 341 342 343 /* Other counters */ 344 345 Stats->MethodCount = AcpiMethodCount; 346 347 return_ACPI_STATUS (AE_OK); 348 } 349 350 ACPI_EXPORT_SYMBOL (AcpiGetStatistics) 351 352 353 /***************************************************************************** 354 * 355 * FUNCTION: AcpiInstallInitializationHandler 356 * 357 * PARAMETERS: Handler - Callback procedure 358 * Function - Not (currently) used, see below 359 * 360 * RETURN: Status 361 * 362 * DESCRIPTION: Install an initialization handler 363 * 364 * TBD: When a second function is added, must save the Function also. 365 * 366 ****************************************************************************/ 367 368 ACPI_STATUS 369 AcpiInstallInitializationHandler ( 370 ACPI_INIT_HANDLER Handler, 371 UINT32 Function) 372 { 373 374 if (!Handler) 375 { 376 return (AE_BAD_PARAMETER); 377 } 378 379 if (AcpiGbl_InitHandler) 380 { 381 return (AE_ALREADY_EXISTS); 382 } 383 384 AcpiGbl_InitHandler = Handler; 385 return (AE_OK); 386 } 387 388 ACPI_EXPORT_SYMBOL (AcpiInstallInitializationHandler) 389 390 391 /***************************************************************************** 392 * 393 * FUNCTION: AcpiPurgeCachedObjects 394 * 395 * PARAMETERS: None 396 * 397 * RETURN: Status 398 * 399 * DESCRIPTION: Empty all caches (delete the cached objects) 400 * 401 ****************************************************************************/ 402 403 ACPI_STATUS 404 AcpiPurgeCachedObjects ( 405 void) 406 { 407 ACPI_FUNCTION_TRACE (AcpiPurgeCachedObjects); 408 409 410 (void) AcpiOsPurgeCache (AcpiGbl_StateCache); 411 (void) AcpiOsPurgeCache (AcpiGbl_OperandCache); 412 (void) AcpiOsPurgeCache (AcpiGbl_PsNodeCache); 413 (void) AcpiOsPurgeCache (AcpiGbl_PsNodeExtCache); 414 415 return_ACPI_STATUS (AE_OK); 416 } 417 418 ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects) 419 420 421 /***************************************************************************** 422 * 423 * FUNCTION: AcpiInstallInterface 424 * 425 * PARAMETERS: InterfaceName - The interface to install 426 * 427 * RETURN: Status 428 * 429 * DESCRIPTION: Install an _OSI interface to the global list 430 * 431 ****************************************************************************/ 432 433 ACPI_STATUS 434 AcpiInstallInterface ( 435 ACPI_STRING InterfaceName) 436 { 437 ACPI_STATUS Status; 438 ACPI_INTERFACE_INFO *InterfaceInfo; 439 440 441 /* Parameter validation */ 442 443 if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0)) 444 { 445 return (AE_BAD_PARAMETER); 446 } 447 448 Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); 449 if (ACPI_FAILURE (Status)) 450 { 451 return (Status); 452 } 453 454 /* Check if the interface name is already in the global list */ 455 456 InterfaceInfo = AcpiUtGetInterface (InterfaceName); 457 if (InterfaceInfo) 458 { 459 /* 460 * The interface already exists in the list. This is OK if the 461 * interface has been marked invalid -- just clear the bit. 462 */ 463 if (InterfaceInfo->Flags & ACPI_OSI_INVALID) 464 { 465 InterfaceInfo->Flags &= ~ACPI_OSI_INVALID; 466 Status = AE_OK; 467 } 468 else 469 { 470 Status = AE_ALREADY_EXISTS; 471 } 472 } 473 else 474 { 475 /* New interface name, install into the global list */ 476 477 Status = AcpiUtInstallInterface (InterfaceName); 478 } 479 480 AcpiOsReleaseMutex (AcpiGbl_OsiMutex); 481 return (Status); 482 } 483 484 ACPI_EXPORT_SYMBOL (AcpiInstallInterface) 485 486 487 /***************************************************************************** 488 * 489 * FUNCTION: AcpiRemoveInterface 490 * 491 * PARAMETERS: InterfaceName - The interface to remove 492 * 493 * RETURN: Status 494 * 495 * DESCRIPTION: Remove an _OSI interface from the global list 496 * 497 ****************************************************************************/ 498 499 ACPI_STATUS 500 AcpiRemoveInterface ( 501 ACPI_STRING InterfaceName) 502 { 503 ACPI_STATUS Status; 504 505 506 /* Parameter validation */ 507 508 if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0)) 509 { 510 return (AE_BAD_PARAMETER); 511 } 512 513 Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); 514 if (ACPI_FAILURE (Status)) 515 { 516 return (Status); 517 } 518 519 Status = AcpiUtRemoveInterface (InterfaceName); 520 521 AcpiOsReleaseMutex (AcpiGbl_OsiMutex); 522 return (Status); 523 } 524 525 ACPI_EXPORT_SYMBOL (AcpiRemoveInterface) 526 527 528 /***************************************************************************** 529 * 530 * FUNCTION: AcpiInstallInterfaceHandler 531 * 532 * PARAMETERS: Handler - The _OSI interface handler to install 533 * NULL means "remove existing handler" 534 * 535 * RETURN: Status 536 * 537 * DESCRIPTION: Install a handler for the predefined _OSI ACPI method. 538 * invoked during execution of the internal implementation of 539 * _OSI. A NULL handler simply removes any existing handler. 540 * 541 ****************************************************************************/ 542 543 ACPI_STATUS 544 AcpiInstallInterfaceHandler ( 545 ACPI_INTERFACE_HANDLER Handler) 546 { 547 ACPI_STATUS Status; 548 549 550 Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); 551 if (ACPI_FAILURE (Status)) 552 { 553 return (Status); 554 } 555 556 if (Handler && AcpiGbl_InterfaceHandler) 557 { 558 Status = AE_ALREADY_EXISTS; 559 } 560 else 561 { 562 AcpiGbl_InterfaceHandler = Handler; 563 } 564 565 AcpiOsReleaseMutex (AcpiGbl_OsiMutex); 566 return (Status); 567 } 568 569 ACPI_EXPORT_SYMBOL (AcpiInstallInterfaceHandler) 570 571 572 /***************************************************************************** 573 * 574 * FUNCTION: AcpiUpdateInterfaces 575 * 576 * PARAMETERS: Action - Actions to be performed during the 577 * update 578 * 579 * RETURN: Status 580 * 581 * DESCRIPTION: Update _OSI interface strings, disabling or enabling OS vendor 582 * string or/and feature group strings. 583 * 584 ****************************************************************************/ 585 586 ACPI_STATUS 587 AcpiUpdateInterfaces ( 588 UINT8 Action) 589 { 590 ACPI_STATUS Status; 591 592 593 Status = AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); 594 if (ACPI_FAILURE (Status)) 595 { 596 return (Status); 597 } 598 599 Status = AcpiUtUpdateInterfaces (Action); 600 601 AcpiOsReleaseMutex (AcpiGbl_OsiMutex); 602 return (Status); 603 } 604 605 606 /***************************************************************************** 607 * 608 * FUNCTION: AcpiCheckAddressRange 609 * 610 * PARAMETERS: SpaceId - Address space ID 611 * Address - Start address 612 * Length - Length 613 * Warn - TRUE if warning on overlap desired 614 * 615 * RETURN: Count of the number of conflicts detected. 616 * 617 * DESCRIPTION: Check if the input address range overlaps any of the 618 * ASL operation region address ranges. 619 * 620 ****************************************************************************/ 621 622 UINT32 623 AcpiCheckAddressRange ( 624 ACPI_ADR_SPACE_TYPE SpaceId, 625 ACPI_PHYSICAL_ADDRESS Address, 626 ACPI_SIZE Length, 627 BOOLEAN Warn) 628 { 629 UINT32 Overlaps; 630 ACPI_STATUS Status; 631 632 633 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); 634 if (ACPI_FAILURE (Status)) 635 { 636 return (0); 637 } 638 639 Overlaps = AcpiUtCheckAddressRange (SpaceId, Address, 640 (UINT32) Length, Warn); 641 642 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); 643 return (Overlaps); 644 } 645 646 ACPI_EXPORT_SYMBOL (AcpiCheckAddressRange) 647 648 #endif /* !ACPI_ASL_COMPILER */ 649 650 651 /******************************************************************************* 652 * 653 * FUNCTION: AcpiDecodePldBuffer 654 * 655 * PARAMETERS: InBuffer - Buffer returned by _PLD method 656 * Length - Length of the InBuffer 657 * ReturnBuffer - Where the decode buffer is returned 658 * 659 * RETURN: Status and the decoded _PLD buffer. User must deallocate 660 * the buffer via ACPI_FREE. 661 * 662 * DESCRIPTION: Decode the bit-packed buffer returned by the _PLD method into 663 * a local struct that is much more useful to an ACPI driver. 664 * 665 ******************************************************************************/ 666 667 ACPI_STATUS 668 AcpiDecodePldBuffer ( 669 UINT8 *InBuffer, 670 ACPI_SIZE Length, 671 ACPI_PLD_INFO **ReturnBuffer) 672 { 673 ACPI_PLD_INFO *PldInfo; 674 UINT32 *Buffer = ACPI_CAST_PTR (UINT32, InBuffer); 675 UINT32 Dword; 676 677 678 /* Parameter validation */ 679 680 if (!InBuffer || !ReturnBuffer || (Length < 16)) 681 { 682 return (AE_BAD_PARAMETER); 683 } 684 685 PldInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PLD_INFO)); 686 if (!PldInfo) 687 { 688 return (AE_NO_MEMORY); 689 } 690 691 /* First 32-bit DWord */ 692 693 ACPI_MOVE_32_TO_32 (&Dword, &Buffer[0]); 694 PldInfo->Revision = ACPI_PLD_GET_REVISION (&Dword); 695 PldInfo->IgnoreColor = ACPI_PLD_GET_IGNORE_COLOR (&Dword); 696 PldInfo->Color = ACPI_PLD_GET_COLOR (&Dword); 697 698 /* Second 32-bit DWord */ 699 700 ACPI_MOVE_32_TO_32 (&Dword, &Buffer[1]); 701 PldInfo->Width = ACPI_PLD_GET_WIDTH (&Dword); 702 PldInfo->Height = ACPI_PLD_GET_HEIGHT(&Dword); 703 704 /* Third 32-bit DWord */ 705 706 ACPI_MOVE_32_TO_32 (&Dword, &Buffer[2]); 707 PldInfo->UserVisible = ACPI_PLD_GET_USER_VISIBLE (&Dword); 708 PldInfo->Dock = ACPI_PLD_GET_DOCK (&Dword); 709 PldInfo->Lid = ACPI_PLD_GET_LID (&Dword); 710 PldInfo->Panel = ACPI_PLD_GET_PANEL (&Dword); 711 PldInfo->VerticalPosition = ACPI_PLD_GET_VERTICAL (&Dword); 712 PldInfo->HorizontalPosition = ACPI_PLD_GET_HORIZONTAL (&Dword); 713 PldInfo->Shape = ACPI_PLD_GET_SHAPE (&Dword); 714 PldInfo->GroupOrientation = ACPI_PLD_GET_ORIENTATION (&Dword); 715 PldInfo->GroupToken = ACPI_PLD_GET_TOKEN (&Dword); 716 PldInfo->GroupPosition = ACPI_PLD_GET_POSITION (&Dword); 717 PldInfo->Bay = ACPI_PLD_GET_BAY (&Dword); 718 719 /* Fourth 32-bit DWord */ 720 721 ACPI_MOVE_32_TO_32 (&Dword, &Buffer[3]); 722 PldInfo->Ejectable = ACPI_PLD_GET_EJECTABLE (&Dword); 723 PldInfo->OspmEjectRequired = ACPI_PLD_GET_OSPM_EJECT (&Dword); 724 PldInfo->CabinetNumber = ACPI_PLD_GET_CABINET (&Dword); 725 PldInfo->CardCageNumber = ACPI_PLD_GET_CARD_CAGE (&Dword); 726 PldInfo->Reference = ACPI_PLD_GET_REFERENCE (&Dword); 727 PldInfo->Rotation = ACPI_PLD_GET_ROTATION (&Dword); 728 PldInfo->Order = ACPI_PLD_GET_ORDER (&Dword); 729 730 if (Length >= ACPI_PLD_BUFFER_SIZE) 731 { 732 /* Fifth 32-bit DWord (Revision 2 of _PLD) */ 733 734 ACPI_MOVE_32_TO_32 (&Dword, &Buffer[4]); 735 PldInfo->VerticalOffset = ACPI_PLD_GET_VERT_OFFSET (&Dword); 736 PldInfo->HorizontalOffset = ACPI_PLD_GET_HORIZ_OFFSET (&Dword); 737 } 738 739 *ReturnBuffer = PldInfo; 740 return (AE_OK); 741 } 742 743 ACPI_EXPORT_SYMBOL (AcpiDecodePldBuffer) 744