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