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