xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/components/utilities/utxface.c (revision 90ae2e54f6ccaca73c011a2aa4cdd660417108ad)
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 - 2012, 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     (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
449 
450     /* Check if the interface name is already in the global list */
451 
452     InterfaceInfo = AcpiUtGetInterface (InterfaceName);
453     if (InterfaceInfo)
454     {
455         /*
456          * The interface already exists in the list. This is OK if the
457          * interface has been marked invalid -- just clear the bit.
458          */
459         if (InterfaceInfo->Flags & ACPI_OSI_INVALID)
460         {
461             InterfaceInfo->Flags &= ~ACPI_OSI_INVALID;
462             Status = AE_OK;
463         }
464         else
465         {
466             Status = AE_ALREADY_EXISTS;
467         }
468     }
469     else
470     {
471         /* New interface name, install into the global list */
472 
473         Status = AcpiUtInstallInterface (InterfaceName);
474     }
475 
476     AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
477     return (Status);
478 }
479 
480 ACPI_EXPORT_SYMBOL (AcpiInstallInterface)
481 
482 
483 /*****************************************************************************
484  *
485  * FUNCTION:    AcpiRemoveInterface
486  *
487  * PARAMETERS:  InterfaceName       - The interface to remove
488  *
489  * RETURN:      Status
490  *
491  * DESCRIPTION: Remove an _OSI interface from the global list
492  *
493  ****************************************************************************/
494 
495 ACPI_STATUS
496 AcpiRemoveInterface (
497     ACPI_STRING             InterfaceName)
498 {
499     ACPI_STATUS             Status;
500 
501 
502     /* Parameter validation */
503 
504     if (!InterfaceName || (ACPI_STRLEN (InterfaceName) == 0))
505     {
506         return (AE_BAD_PARAMETER);
507     }
508 
509     (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
510 
511     Status = AcpiUtRemoveInterface (InterfaceName);
512 
513     AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
514     return (Status);
515 }
516 
517 ACPI_EXPORT_SYMBOL (AcpiRemoveInterface)
518 
519 
520 /*****************************************************************************
521  *
522  * FUNCTION:    AcpiInstallInterfaceHandler
523  *
524  * PARAMETERS:  Handler             - The _OSI interface handler to install
525  *                                    NULL means "remove existing handler"
526  *
527  * RETURN:      Status
528  *
529  * DESCRIPTION: Install a handler for the predefined _OSI ACPI method.
530  *              invoked during execution of the internal implementation of
531  *              _OSI. A NULL handler simply removes any existing handler.
532  *
533  ****************************************************************************/
534 
535 ACPI_STATUS
536 AcpiInstallInterfaceHandler (
537     ACPI_INTERFACE_HANDLER  Handler)
538 {
539     ACPI_STATUS             Status = AE_OK;
540 
541 
542     (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER);
543 
544     if (Handler && AcpiGbl_InterfaceHandler)
545     {
546         Status = AE_ALREADY_EXISTS;
547     }
548     else
549     {
550         AcpiGbl_InterfaceHandler = Handler;
551     }
552 
553     AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
554     return (Status);
555 }
556 
557 ACPI_EXPORT_SYMBOL (AcpiInstallInterfaceHandler)
558 
559 
560 /*****************************************************************************
561  *
562  * FUNCTION:    AcpiCheckAddressRange
563  *
564  * PARAMETERS:  SpaceId             - Address space ID
565  *              Address             - Start address
566  *              Length              - Length
567  *              Warn                - TRUE if warning on overlap desired
568  *
569  * RETURN:      Count of the number of conflicts detected.
570  *
571  * DESCRIPTION: Check if the input address range overlaps any of the
572  *              ASL operation region address ranges.
573  *
574  ****************************************************************************/
575 
576 UINT32
577 AcpiCheckAddressRange (
578     ACPI_ADR_SPACE_TYPE     SpaceId,
579     ACPI_PHYSICAL_ADDRESS   Address,
580     ACPI_SIZE               Length,
581     BOOLEAN                 Warn)
582 {
583     UINT32                  Overlaps;
584     ACPI_STATUS             Status;
585 
586 
587     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
588     if (ACPI_FAILURE (Status))
589     {
590         return (0);
591     }
592 
593     Overlaps = AcpiUtCheckAddressRange (SpaceId, Address,
594         (UINT32) Length, Warn);
595 
596     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
597     return (Overlaps);
598 }
599 
600 ACPI_EXPORT_SYMBOL (AcpiCheckAddressRange)
601 
602 #endif /* !ACPI_ASL_COMPILER */
603 
604 
605 /*******************************************************************************
606  *
607  * FUNCTION:    AcpiDecodePldBuffer
608  *
609  * PARAMETERS:  InBuffer            - Buffer returned by _PLD method
610  *              Length              - Length of the InBuffer
611  *              ReturnBuffer        - Where the decode buffer is returned
612  *
613  * RETURN:      Status and the decoded _PLD buffer. User must deallocate
614  *              the buffer via ACPI_FREE.
615  *
616  * DESCRIPTION: Decode the bit-packed buffer returned by the _PLD method into
617  *              a local struct that is much more useful to an ACPI driver.
618  *
619  ******************************************************************************/
620 
621 ACPI_STATUS
622 AcpiDecodePldBuffer (
623     UINT8                   *InBuffer,
624     ACPI_SIZE               Length,
625     ACPI_PLD_INFO           **ReturnBuffer)
626 {
627     ACPI_PLD_INFO           *PldInfo;
628     UINT32                  *Buffer = ACPI_CAST_PTR (UINT32, InBuffer);
629     UINT32                  Dword;
630 
631 
632     /* Parameter validation */
633 
634     if (!InBuffer || !ReturnBuffer || (Length < 16))
635     {
636         return (AE_BAD_PARAMETER);
637     }
638 
639     PldInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PLD_INFO));
640     if (!PldInfo)
641     {
642         return (AE_NO_MEMORY);
643     }
644 
645     /* First 32-bit DWord */
646 
647     ACPI_MOVE_32_TO_32 (&Dword, &Buffer[0]);
648     PldInfo->Revision =             ACPI_PLD_GET_REVISION (&Dword);
649     PldInfo->IgnoreColor =          ACPI_PLD_GET_IGNORE_COLOR (&Dword);
650     PldInfo->Color =                ACPI_PLD_GET_COLOR (&Dword);
651 
652     /* Second 32-bit DWord */
653 
654     ACPI_MOVE_32_TO_32 (&Dword, &Buffer[1]);
655     PldInfo->Width =                ACPI_PLD_GET_WIDTH (&Dword);
656     PldInfo->Height =               ACPI_PLD_GET_HEIGHT(&Dword);
657 
658     /* Third 32-bit DWord */
659 
660     ACPI_MOVE_32_TO_32 (&Dword, &Buffer[2]);
661     PldInfo->UserVisible =          ACPI_PLD_GET_USER_VISIBLE (&Dword);
662     PldInfo->Dock =                 ACPI_PLD_GET_DOCK (&Dword);
663     PldInfo->Lid =                  ACPI_PLD_GET_LID (&Dword);
664     PldInfo->Panel =                ACPI_PLD_GET_PANEL (&Dword);
665     PldInfo->VerticalPosition =     ACPI_PLD_GET_VERTICAL (&Dword);
666     PldInfo->HorizontalPosition =   ACPI_PLD_GET_HORIZONTAL (&Dword);
667     PldInfo->Shape =                ACPI_PLD_GET_SHAPE (&Dword);
668     PldInfo->GroupOrientation =     ACPI_PLD_GET_ORIENTATION (&Dword);
669     PldInfo->GroupToken =           ACPI_PLD_GET_TOKEN (&Dword);
670     PldInfo->GroupPosition =        ACPI_PLD_GET_POSITION (&Dword);
671     PldInfo->Bay =                  ACPI_PLD_GET_BAY (&Dword);
672 
673     /* Fourth 32-bit DWord */
674 
675     ACPI_MOVE_32_TO_32 (&Dword, &Buffer[3]);
676     PldInfo->Ejectable =            ACPI_PLD_GET_EJECTABLE (&Dword);
677     PldInfo->OspmEjectRequired =    ACPI_PLD_GET_OSPM_EJECT (&Dword);
678     PldInfo->CabinetNumber =        ACPI_PLD_GET_CABINET (&Dword);
679     PldInfo->CardCageNumber =       ACPI_PLD_GET_CARD_CAGE (&Dword);
680     PldInfo->Reference =            ACPI_PLD_GET_REFERENCE (&Dword);
681     PldInfo->Rotation =             ACPI_PLD_GET_ROTATION (&Dword);
682     PldInfo->Order =                ACPI_PLD_GET_ORDER (&Dword);
683 
684     if (Length >= ACPI_PLD_BUFFER_SIZE)
685     {
686         /* Fifth 32-bit DWord (Revision 2 of _PLD) */
687 
688         ACPI_MOVE_32_TO_32 (&Dword, &Buffer[4]);
689         PldInfo->VerticalOffset =       ACPI_PLD_GET_VERT_OFFSET (&Dword);
690         PldInfo->HorizontalOffset =     ACPI_PLD_GET_HORIZ_OFFSET (&Dword);
691     }
692 
693     *ReturnBuffer = PldInfo;
694     return (AE_OK);
695 }
696 
697 ACPI_EXPORT_SYMBOL (AcpiDecodePldBuffer)
698