Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
/******************************************************************************
 *
 * Module Name: aslpld - Implementation of ASL ToPLD macro
 *
 *****************************************************************************/

/*
 * Copyright (C) 2000 - 2019, Intel Corp.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * NO WARRANTY
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES.
 */

#include "aslcompiler.h"
#include "aslcompiler.y.h"
#include "amlcode.h"

#define _COMPONENT          ACPI_COMPILER
        ACPI_MODULE_NAME    ("aslpld")


/* Local prototypes */

static UINT8 *
OpcEncodePldBuffer (
    ACPI_PLD_INFO           *PldInfo);

static BOOLEAN
OpcFindName (
    const char              **List,
    char                    *Name,
    UINT32                  *Index);


/*******************************************************************************
 *
 * FUNCTION:    OpcDoPld
 *
 * PARAMETERS:  Op                  - Current parse node
 *
 * RETURN:      None
 *
 * DESCRIPTION: Convert ToPLD macro to 20-byte buffer
 *
 * The ToPLD parse tree looks like this:
 *
 *      TOPLD
 *          PLD_REVISION
 *              INTEGER
 *          PLD_IGNORECOLOR
 *              INTEGER
 *          ...
 *          etc.
 *
 ******************************************************************************/

void
OpcDoPld (
    ACPI_PARSE_OBJECT       *Op)
{
    ACPI_PLD_INFO           PldInfo;
    UINT8                   *Buffer;
    ACPI_PARSE_OBJECT       *ThisOp;
    ACPI_PARSE_OBJECT       *NewOp;
    UINT16                  ParseOpcode;
    UINT32                  Value;


    if (!Op)
    {
        AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, NULL);
        return;
    }

    if (Op->Asl.ParseOpcode != PARSEOP_TOPLD)
    {
        AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, Op, NULL);
        return;
    }

    memset (&PldInfo, 0, sizeof (ACPI_PLD_INFO));

    /* Traverse the list of PLD Ops (one per PLD field) */

    ThisOp = Op->Asl.Child;
    while (ThisOp)
    {
        /* Get child values */

        ParseOpcode = ThisOp->Asl.Child->Asl.ParseOpcode;
        Value = (UINT32) ThisOp->Asl.Child->Asl.Value.Integer;

        switch (ThisOp->Asl.ParseOpcode)
        {
        case PARSEOP_PLD_REVISION:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 127)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            PldInfo.Revision = (UINT8) Value;
            break;

        case PARSEOP_PLD_IGNORECOLOR:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 1)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            PldInfo.IgnoreColor = (UINT8) Value;
            break;

        case PARSEOP_PLD_RED:
        case PARSEOP_PLD_GREEN:
        case PARSEOP_PLD_BLUE:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            if (Value > 255)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_RED)
            {
                PldInfo.Red = (UINT8) Value;
            }
            else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_GREEN)
            {
                PldInfo.Green = (UINT8) Value;
            }
            else /* PARSEOP_PLD_BLUE */
            {
                PldInfo.Blue = (UINT8) Value;
            }
            break;

        case PARSEOP_PLD_WIDTH:
        case PARSEOP_PLD_HEIGHT:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 65535)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_WIDTH)
            {
                PldInfo.Width = (UINT16) Value;
            }
            else /* PARSEOP_PLD_HEIGHT */
            {
                PldInfo.Height = (UINT16) Value;
            }

            break;

        case PARSEOP_PLD_USERVISIBLE:
        case PARSEOP_PLD_DOCK:
        case PARSEOP_PLD_LID:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 1)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_USERVISIBLE)
            {
                PldInfo.UserVisible = (UINT8) Value;
            }
            else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_DOCK)
            {
                PldInfo.Dock = (UINT8) Value;
            }
            else
            {
                PldInfo.Lid = (UINT8) Value;
            }

            break;

        case PARSEOP_PLD_PANEL:

            if (ParseOpcode == PARSEOP_INTEGER)
            {
                if (Value > 6)
                {
                    AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                    break;
                }
            }
            else /* PARSEOP_STRING */
            {
                if (!OpcFindName (AcpiGbl_PldPanelList,
                    ThisOp->Asl.Child->Asl.Value.String,
                    &Value))
                {
                    AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);
                    break;
                }
            }

            PldInfo.Panel = (UINT8) Value;
            break;

        case PARSEOP_PLD_VERTICALPOSITION:

            if (ParseOpcode == PARSEOP_INTEGER)
            {
                if (Value > 2)
                {
                    AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                    break;
                }
            }
            else /* PARSEOP_STRING */
            {
                if (!OpcFindName (AcpiGbl_PldVerticalPositionList,
                    ThisOp->Asl.Child->Asl.Value.String,
                    &Value))
                {
                    AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);
                    break;
                }
            }

            PldInfo.VerticalPosition = (UINT8) Value;
            break;

        case PARSEOP_PLD_HORIZONTALPOSITION:

            if (ParseOpcode == PARSEOP_INTEGER)
            {
                if (Value > 2)
                {
                    AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                    break;
                }
            }
            else /* PARSEOP_STRING */
            {
                if (!OpcFindName (AcpiGbl_PldHorizontalPositionList,
                    ThisOp->Asl.Child->Asl.Value.String,
                    &Value))
                {
                    AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);
                    break;
                }
            }

            PldInfo.HorizontalPosition = (UINT8) Value;
            break;

        case PARSEOP_PLD_SHAPE:

            if (ParseOpcode == PARSEOP_INTEGER)
            {
                if (Value > 8)
                {
                    AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                    break;
                }
            }
            else /* PARSEOP_STRING */
            {
                if (!OpcFindName (AcpiGbl_PldShapeList,
                    ThisOp->Asl.Child->Asl.Value.String,
                    &Value))
                {
                    AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, ThisOp, NULL);
                    break;
                }
            }

            PldInfo.Shape = (UINT8) Value;
            break;

        case PARSEOP_PLD_GROUPORIENTATION:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 1)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            PldInfo.GroupOrientation = (UINT8) Value;
            break;

        case PARSEOP_PLD_GROUPTOKEN:
        case PARSEOP_PLD_GROUPPOSITION:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 255)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_GROUPTOKEN)
            {
                PldInfo.GroupToken = (UINT8) Value;
            }
            else /* PARSEOP_PLD_GROUPPOSITION */
            {
                PldInfo.GroupPosition = (UINT8) Value;
            }

            break;

        case PARSEOP_PLD_BAY:
        case PARSEOP_PLD_EJECTABLE:
        case PARSEOP_PLD_EJECTREQUIRED:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 1)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_BAY)
            {
                PldInfo.Bay = (UINT8) Value;
            }
            else if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_EJECTABLE)
            {
                PldInfo.Ejectable = (UINT8) Value;
            }
            else /* PARSEOP_PLD_EJECTREQUIRED */
            {
                PldInfo.OspmEjectRequired = (UINT8) Value;
            }

            break;

        case PARSEOP_PLD_CABINETNUMBER:
        case PARSEOP_PLD_CARDCAGENUMBER:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 255)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_CABINETNUMBER)
            {
                PldInfo.CabinetNumber = (UINT8) Value;
            }
            else /* PARSEOP_PLD_CARDCAGENUMBER */
            {
                PldInfo.CardCageNumber = (UINT8) Value;
            }

            break;

        case PARSEOP_PLD_REFERENCE:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 1)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            PldInfo.Reference = (UINT8) Value;
            break;

        case PARSEOP_PLD_ROTATION:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 7)
            {
                switch (Value)
                {
                case 45:

                    Value = 1;
                    break;

                case 90:

                    Value = 2;
                    break;

                case 135:

                    Value = 3;
                    break;

                case 180:

                    Value = 4;
                    break;

                case 225:

                    Value = 5;
                    break;

                case 270:

                    Value = 6;
                    break;

                case 315:

                    Value = 7;
                    break;

                default:

                    AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                    break;
                }
            }

            PldInfo.Rotation = (UINT8) Value;
            break;

        case PARSEOP_PLD_ORDER:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 31)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            PldInfo.Order = (UINT8) Value;
            break;

        case PARSEOP_PLD_VERTICALOFFSET:
        case PARSEOP_PLD_HORIZONTALOFFSET:

            if (ParseOpcode != PARSEOP_INTEGER)
            {
                AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
                break;
            }

            if (Value > 65535)
            {
                AslError (ASL_ERROR, ASL_MSG_RANGE, ThisOp, NULL);
                break;
            }

            if (ThisOp->Asl.ParseOpcode == PARSEOP_PLD_VERTICALOFFSET)
            {
                PldInfo.VerticalOffset = (UINT16) Value;
            }
            else /* PARSEOP_PLD_HORIZONTALOFFSET */
            {
                PldInfo.HorizontalOffset = (UINT16) Value;
            }

            break;

        default:

            AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ThisOp, NULL);
            break;
        }

        ThisOp = ThisOp->Asl.Next;
    }

    Buffer = OpcEncodePldBuffer (&PldInfo);

    /* Change Op to a Buffer */

    Op->Asl.ParseOpcode = PARSEOP_BUFFER;
    Op->Common.AmlOpcode = AML_BUFFER_OP;

    /* Disable further optimization */

    Op->Asl.CompileFlags &= ~OP_COMPILE_TIME_CONST;
    UtSetParseOpName (Op);

    /* Child node is the buffer length */

    NewOp = TrAllocateOp (PARSEOP_INTEGER);

    NewOp->Asl.AmlOpcode = AML_BYTE_OP;
    NewOp->Asl.Value.Integer = 20;
    NewOp->Asl.Parent = Op;

    Op->Asl.Child = NewOp;
    Op = NewOp;

    /* Peer to the child is the raw buffer data */

    NewOp = TrAllocateOp (PARSEOP_RAW_DATA);
    NewOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER;
    NewOp->Asl.AmlLength = 20;
    NewOp->Asl.Value.String = ACPI_CAST_PTR (char, Buffer);
    NewOp->Asl.Parent = Op->Asl.Parent;

    Op->Asl.Next = NewOp;
}


/*******************************************************************************
 *
 * FUNCTION:    OpcEncodePldBuffer
 *
 * PARAMETERS:  PldInfo             - _PLD buffer struct (Using local struct)
 *
 * RETURN:      Encode _PLD buffer suitable for return value from _PLD
 *
 * DESCRIPTION: Bit-packs a _PLD buffer struct.
 *
 ******************************************************************************/

static UINT8 *
OpcEncodePldBuffer (
    ACPI_PLD_INFO           *PldInfo)
{
    UINT32                  *Buffer;
    UINT32                  Dword;


    Buffer = ACPI_CAST_PTR (UINT32, UtLocalCacheCalloc (ACPI_PLD_BUFFER_SIZE));

    /* First 32 bits */

    Dword = 0;
    ACPI_PLD_SET_REVISION       (&Dword, PldInfo->Revision);
    ACPI_PLD_SET_IGNORE_COLOR   (&Dword, PldInfo->IgnoreColor);
    ACPI_PLD_SET_RED            (&Dword, PldInfo->Red);
    ACPI_PLD_SET_GREEN          (&Dword, PldInfo->Green);
    ACPI_PLD_SET_BLUE           (&Dword, PldInfo->Blue);
    ACPI_MOVE_32_TO_32          (&Buffer[0], &Dword);

    /* Second 32 bits */

    Dword = 0;
    ACPI_PLD_SET_WIDTH          (&Dword, PldInfo->Width);
    ACPI_PLD_SET_HEIGHT         (&Dword, PldInfo->Height);
    ACPI_MOVE_32_TO_32          (&Buffer[1], &Dword);

    /* Third 32 bits */

    Dword = 0;
    ACPI_PLD_SET_USER_VISIBLE   (&Dword, PldInfo->UserVisible);
    ACPI_PLD_SET_DOCK           (&Dword, PldInfo->Dock);
    ACPI_PLD_SET_LID            (&Dword, PldInfo->Lid);
    ACPI_PLD_SET_PANEL          (&Dword, PldInfo->Panel);
    ACPI_PLD_SET_VERTICAL       (&Dword, PldInfo->VerticalPosition);
    ACPI_PLD_SET_HORIZONTAL     (&Dword, PldInfo->HorizontalPosition);
    ACPI_PLD_SET_SHAPE          (&Dword, PldInfo->Shape);
    ACPI_PLD_SET_ORIENTATION    (&Dword, PldInfo->GroupOrientation);
    ACPI_PLD_SET_TOKEN          (&Dword, PldInfo->GroupToken);
    ACPI_PLD_SET_POSITION       (&Dword, PldInfo->GroupPosition);
    ACPI_PLD_SET_BAY            (&Dword, PldInfo->Bay);
    ACPI_MOVE_32_TO_32          (&Buffer[2], &Dword);

    /* Fourth 32 bits */

    Dword = 0;
    ACPI_PLD_SET_EJECTABLE      (&Dword, PldInfo->Ejectable);
    ACPI_PLD_SET_OSPM_EJECT     (&Dword, PldInfo->OspmEjectRequired);
    ACPI_PLD_SET_CABINET        (&Dword, PldInfo->CabinetNumber);
    ACPI_PLD_SET_CARD_CAGE      (&Dword, PldInfo->CardCageNumber);
    ACPI_PLD_SET_REFERENCE      (&Dword, PldInfo->Reference);
    ACPI_PLD_SET_ROTATION       (&Dword, PldInfo->Rotation);
    ACPI_PLD_SET_ORDER          (&Dword, PldInfo->Order);
    ACPI_MOVE_32_TO_32          (&Buffer[3], &Dword);

    /* Revision 2 adds an additional DWORD */

    if (PldInfo->Revision >= 2)
    {
        /* Fifth 32 bits */

        Dword = 0;
        ACPI_PLD_SET_VERT_OFFSET    (&Dword, PldInfo->VerticalOffset);
        ACPI_PLD_SET_HORIZ_OFFSET   (&Dword, PldInfo->HorizontalOffset);
        ACPI_MOVE_32_TO_32          (&Buffer[4], &Dword);
    }

    return (ACPI_CAST_PTR (UINT8, Buffer));
}


/*******************************************************************************
 *
 * FUNCTION:    OpcFindName
 *
 * PARAMETERS:  List                - Array of char strings to be searched
 *              Name                - Char string to string for
 *              Index               - Index value to set if found
 *
 * RETURN:      TRUE if any names matched, FALSE otherwise
 *
 * DESCRIPTION: Match PLD name to value in lookup table. Sets Value to
 *              equivalent parameter value.
 *
 ******************************************************************************/

static BOOLEAN
OpcFindName (
    const char              **List,
    char                    *Name,
    UINT32                  *Index)
{
    const char              *NameString;
    UINT32                  i;


    AcpiUtStrupr (Name);

    for (i = 0, NameString = List[0];
            NameString;
            i++, NameString = List[i])
    {
        if (!(strncmp (NameString, Name, strlen (Name))))
        {
            *Index = i;
            return (TRUE);
        }
    }

    return (FALSE);
}