Import acpica-20050211 from Intel.
[dragonfly.git] / sys / contrib / dev / acpica-unix-20050211 / compiler / aslopcodes.c
1
2 /******************************************************************************
3  *
4  * Module Name: aslopcode - AML opcode generation
5  *              $Revision: 62 $
6  *
7  *****************************************************************************/
8
9 /******************************************************************************
10  *
11  * 1. Copyright Notice
12  *
13  * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
14  * All rights reserved.
15  *
16  * 2. License
17  *
18  * 2.1. This is your license from Intel Corp. under its intellectual property
19  * rights.  You may have additional license terms from the party that provided
20  * you this software, covering your right to use that party's intellectual
21  * property rights.
22  *
23  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24  * copy of the source code appearing in this file ("Covered Code") an
25  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26  * base code distributed originally by Intel ("Original Intel Code") to copy,
27  * make derivatives, distribute, use and display any portion of the Covered
28  * Code in any form, with the right to sublicense such rights; and
29  *
30  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31  * license (with the right to sublicense), under only those claims of Intel
32  * patents that are infringed by the Original Intel Code, to make, use, sell,
33  * offer to sell, and import the Covered Code and derivative works thereof
34  * solely to the minimum extent necessary to exercise the above copyright
35  * license, and in no event shall the patent license extend to any additions
36  * to or modifications of the Original Intel Code.  No other license or right
37  * is granted directly or by implication, estoppel or otherwise;
38  *
39  * The above copyright and patent license is granted only if the following
40  * conditions are met:
41  *
42  * 3. Conditions
43  *
44  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45  * Redistribution of source code of any substantial portion of the Covered
46  * Code or modification with rights to further distribute source must include
47  * the above Copyright Notice, the above License, this list of Conditions,
48  * and the following Disclaimer and Export Compliance provision.  In addition,
49  * Licensee must cause all Covered Code to which Licensee contributes to
50  * contain a file documenting the changes Licensee made to create that Covered
51  * Code and the date of any change.  Licensee must include in that file the
52  * documentation of any changes made by any predecessor Licensee.  Licensee
53  * must include a prominent statement that the modification is derived,
54  * directly or indirectly, from Original Intel Code.
55  *
56  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57  * Redistribution of source code of any substantial portion of the Covered
58  * Code or modification without rights to further distribute source must
59  * include the following Disclaimer and Export Compliance provision in the
60  * documentation and/or other materials provided with distribution.  In
61  * addition, Licensee may not authorize further sublicense of source of any
62  * portion of the Covered Code, and must include terms to the effect that the
63  * license from Licensee to its licensee is limited to the intellectual
64  * property embodied in the software Licensee provides to its licensee, and
65  * not to intellectual property embodied in modifications its licensee may
66  * make.
67  *
68  * 3.3. Redistribution of Executable. Redistribution in executable form of any
69  * substantial portion of the Covered Code or modification must reproduce the
70  * above Copyright Notice, and the following Disclaimer and Export Compliance
71  * provision in the documentation and/or other materials provided with the
72  * distribution.
73  *
74  * 3.4. Intel retains all right, title, and interest in and to the Original
75  * Intel Code.
76  *
77  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78  * Intel shall be used in advertising or otherwise to promote the sale, use or
79  * other dealings in products derived from or relating to the Covered Code
80  * without prior written authorization from Intel.
81  *
82  * 4. Disclaimer and Export Compliance
83  *
84  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90  * PARTICULAR PURPOSE.
91  *
92  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99  * LIMITED REMEDY.
100  *
101  * 4.3. Licensee shall not export, either directly or indirectly, any of this
102  * software or system incorporating such software without first obtaining any
103  * required license or other approval from the U. S. Department of Commerce or
104  * any other agency or department of the United States Government.  In the
105  * event Licensee exports any such software from the United States or
106  * re-exports any such software from a foreign destination, Licensee shall
107  * ensure that the distribution and export/re-export of the software is in
108  * compliance with all laws, regulations, orders, or other restrictions of the
109  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110  * any of its subsidiaries will export/re-export any technical data, process,
111  * software, or service, directly or indirectly, to any country for which the
112  * United States government or any agency thereof requires an export license,
113  * other governmental approval, or letter of assurance, without first obtaining
114  * such license, approval or letter.
115  *
116  *****************************************************************************/
117
118
119 #include "aslcompiler.h"
120 #include "aslcompiler.y.h"
121 #include "amlcode.h"
122
123 #define _COMPONENT          ACPI_COMPILER
124         ACPI_MODULE_NAME    ("aslopcodes")
125
126
127 /*******************************************************************************
128  *
129  * FUNCTION:    OpcAmlOpcodeWalk
130  *
131  * PARAMETERS:  ASL_WALK_CALLBACK
132  *
133  * RETURN:      Status
134  *
135  * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML
136  *              operands.
137  *
138  ******************************************************************************/
139
140 ACPI_STATUS
141 OpcAmlOpcodeWalk (
142     ACPI_PARSE_OBJECT       *Op,
143     UINT32                  Level,
144     void                    *Context)
145 {
146
147     TotalParseNodes++;
148
149     OpcGenerateAmlOpcode (Op);
150     OpnGenerateAmlOperands (Op);
151
152     return (AE_OK);
153 }
154
155
156 /*******************************************************************************
157  *
158  * FUNCTION:    OpcGetIntegerWidth
159  *
160  * PARAMETERS:  Op          - DEFINITION BLOCK op
161  *
162  * RETURN:      none
163  *
164  * DESCRIPTION: Extract integer width from the table revision
165  *
166  ******************************************************************************/
167
168 void
169 OpcGetIntegerWidth (
170     ACPI_PARSE_OBJECT       *Op)
171 {
172     ACPI_PARSE_OBJECT       *Child;
173
174     if (!Op)
175     {
176         return;
177     }
178
179     Child = Op->Asl.Child;
180     Child = Child->Asl.Next;
181     Child = Child->Asl.Next;
182
183     /* Use the revision to set the integer width */
184
185     AcpiUtSetIntegerWidth ((UINT8) Child->Asl.Value.Integer);
186 }
187
188
189 /*******************************************************************************
190  *
191  * FUNCTION:    OpcSetOptimalIntegerSize
192  *
193  * PARAMETERS:  Op        - A parse tree node
194  *
195  * RETURN:      Integer width, in bytes.  Also sets the node AML opcode to the
196  *              optimal integer AML prefix opcode.
197  *
198  * DESCRIPTION: Determine the optimal AML encoding of an integer.  All leading
199  *              zeros can be truncated to squeeze the integer into the
200  *              minimal number of AML bytes.
201  *
202  ******************************************************************************/
203
204 UINT32
205 OpcSetOptimalIntegerSize (
206     ACPI_PARSE_OBJECT       *Op)
207 {
208
209 /*
210     TBD: - we don't want to optimize integers in the block header, but the
211     code below does not work correctly.
212
213     if (Op->Asl.Parent &&
214         Op->Asl.Parent->Asl.Parent &&
215         (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK))
216     {
217         return 0;
218     }
219 */
220
221     /*
222      * Check for the special AML integers first - Zero, One, Ones.
223      * These are single-byte opcodes that are the smallest possible
224      * representation of an integer.
225      *
226      * This optimization is optional.
227      */
228     if (Gbl_IntegerOptimizationFlag)
229     {
230         switch (Op->Asl.Value.Integer)
231         {
232         case 0:
233
234             Op->Asl.AmlOpcode = AML_ZERO_OP;
235             AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Zero");
236             return 1;
237
238         case 1:
239
240             Op->Asl.AmlOpcode = AML_ONE_OP;
241             AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "One");
242             return 1;
243
244         case ACPI_UINT32_MAX:
245
246             /* Check for table integer width (32 or 64) */
247
248             if (AcpiGbl_IntegerByteWidth == 4)
249             {
250                 Op->Asl.AmlOpcode = AML_ONES_OP;
251                 AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Ones");
252                 return 1;
253             }
254             break;
255
256         case ACPI_INTEGER_MAX:
257
258             /* Check for table integer width (32 or 64) */
259
260             if (AcpiGbl_IntegerByteWidth == 8)
261             {
262                 Op->Asl.AmlOpcode = AML_ONES_OP;
263                 AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Ones");
264                 return 1;
265             }
266             break;
267
268         default:
269             break;
270         }
271     }
272
273     /* Find the best fit using the various AML integer prefixes */
274
275     if (Op->Asl.Value.Integer <= ACPI_UINT8_MAX)
276     {
277         Op->Asl.AmlOpcode = AML_BYTE_OP;
278         return 1;
279     }
280     if (Op->Asl.Value.Integer <= ACPI_UINT16_MAX)
281     {
282         Op->Asl.AmlOpcode = AML_WORD_OP;
283         return 2;
284     }
285     if (Op->Asl.Value.Integer <= ACPI_UINT32_MAX)
286     {
287         Op->Asl.AmlOpcode = AML_DWORD_OP;
288         return 4;
289     }
290     else
291     {
292         Op->Asl.AmlOpcode = AML_QWORD_OP;
293         return 8;
294     }
295 }
296
297
298 /*******************************************************************************
299  *
300  * FUNCTION:    OpcDoAccessAs
301  *
302  * PARAMETERS:  Op        - Parse node
303  *
304  * RETURN:      None
305  *
306  * DESCRIPTION: Implement the ACCESS_AS ASL keyword.
307  *
308  ******************************************************************************/
309
310 void
311 OpcDoAccessAs (
312     ACPI_PARSE_OBJECT           *Op)
313 {
314     ACPI_PARSE_OBJECT           *Next;
315
316
317     Op->Asl.AmlOpcodeLength = 1;
318     Next = Op->Asl.Child;
319
320     /* First child is the access type */
321
322     Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
323     Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
324
325     /* Second child is the optional access attribute */
326
327     Next = Next->Asl.Next;
328     if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
329     {
330         Next->Asl.Value.Integer = 0;
331     }
332     Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
333     Next->Asl.ParseOpcode = PARSEOP_RAW_DATA;
334 }
335
336
337 /*******************************************************************************
338  *
339  * FUNCTION:    OpcDoUnicode
340  *
341  * PARAMETERS:  Op        - Parse node
342  *
343  * RETURN:      None
344  *
345  * DESCRIPTION: Implement the UNICODE ASL "macro".  Convert the input string
346  *              to a unicode buffer.  There is no Unicode AML opcode.
347  *
348  * Note:  The Unicode string is 16 bits per character, no leading signature,
349  *        with a 16-bit terminating NULL.
350  *
351  ******************************************************************************/
352
353 void
354 OpcDoUnicode (
355     ACPI_PARSE_OBJECT           *Op)
356 {
357     ACPI_PARSE_OBJECT           *InitializerOp;
358     UINT32                      Length;
359     UINT32                      Count;
360     UINT32                      i;
361     UINT8                       *AsciiString;
362     UINT16                      *UnicodeString;
363     ACPI_PARSE_OBJECT           *BufferLengthOp;
364
365
366     /* Change op into a buffer object */
367
368     Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
369     Op->Asl.ParseOpcode = PARSEOP_BUFFER;
370     UtSetParseOpName (Op);
371
372     /* Buffer Length is first, followed by the string */
373
374     BufferLengthOp = Op->Asl.Child;
375     InitializerOp = BufferLengthOp->Asl.Next;
376
377     AsciiString = (UINT8 *) InitializerOp->Asl.Value.String;
378
379     /* Create a new buffer for the Unicode string */
380
381     Count = strlen (InitializerOp->Asl.Value.String) + 1;
382     Length = Count * sizeof (UINT16);
383     UnicodeString = UtLocalCalloc (Length);
384
385     /* Convert to Unicode string (including null terminator) */
386
387     for (i = 0; i < Count; i++)
388     {
389         UnicodeString[i] = (UINT16) AsciiString[i];
390     }
391
392     /*
393      * Just set the buffer size node to be the buffer length, regardless
394      * of whether it was previously an integer or a default_arg placeholder
395      */
396     BufferLengthOp->Asl.ParseOpcode   = PARSEOP_INTEGER;
397     BufferLengthOp->Asl.AmlOpcode     = AML_DWORD_OP;
398     BufferLengthOp->Asl.Value.Integer = Length;
399     UtSetParseOpName (BufferLengthOp);
400
401     (void) OpcSetOptimalIntegerSize (BufferLengthOp);
402
403     /* The Unicode string is a raw data buffer */
404
405     InitializerOp->Asl.Value.Buffer   = (UINT8 *) UnicodeString;
406     InitializerOp->Asl.AmlOpcode      = AML_RAW_DATA_BUFFER;
407     InitializerOp->Asl.AmlLength      = Length;
408     InitializerOp->Asl.ParseOpcode    = PARSEOP_RAW_DATA;
409     InitializerOp->Asl.Child          = NULL;
410     UtSetParseOpName (InitializerOp);
411 }
412
413
414 /*******************************************************************************
415  *
416  * FUNCTION:    OpcDoEisaId
417  *
418  * PARAMETERS:  Op        - Parse node
419  *
420  * RETURN:      None
421  *
422  * DESCRIPTION: Convert a string EISA ID to numeric representation.  See the
423  *              Pnp BIOS Specification for details.  Here is an excerpt:
424  *
425  *              A seven character ASCII representation of the product
426  *              identifier compressed into a 32-bit identifier.  The seven
427  *              character ID consists of a three character manufacturer code,
428  *              a three character hexadecimal product identifier, and a one
429  *              character hexadecimal revision number.  The manufacturer code
430  *              is a 3 uppercase character code that is compressed into 3 5-bit
431  *              values as follows:
432  *                  1) Find hex ASCII value for each letter
433  *                  2) Subtract 40h from each ASCII value
434  *                  3) Retain 5 least signficant bits for each letter by
435  *                     discarding upper 3 bits because they are always 0.
436  *                  4) Compressed code = concatenate 0 and the 3 5-bit values
437  *
438  *              The format of the compressed product identifier is as follows:
439  *              Byte 0: Bit 7       - Reserved (0)
440  *                      Bits 6-2:   - 1st character of compressed mfg code
441  *                      Bits 1-0    - Upper 2 bits of 2nd character of mfg code
442  *              Byte 1: Bits 7-5    - Lower 3 bits of 2nd character of mfg code
443  *                      Bits 4-0    - 3rd character of mfg code
444  *              Byte 2: Bits 7-4    - 1st hex digit of product number
445  *                      Bits 3-0    - 2nd hex digit of product number
446  *              Byte 3: Bits 7-4    - 3st hex digit of product number
447  *                      Bits 3-0    - Hex digit of the revision number
448  *
449  ******************************************************************************/
450
451 void
452 OpcDoEisaId (
453     ACPI_PARSE_OBJECT       *Op)
454 {
455     UINT32                  EisaId = 0;
456     UINT32                  BigEndianId;
457     char                    *InString;
458     ACPI_STATUS             Status = AE_OK;
459     ACPI_NATIVE_UINT        i;
460
461
462     InString = (char *) Op->Asl.Value.String;
463
464     /*
465      * The EISAID string must be exactly 7 characters and of the form
466      * "LLLXXXX" -- 3 letters and 4 hex digits (e.g., "PNP0001")
467      */
468     if (ACPI_STRLEN (InString) != 7)
469     {
470         Status = AE_BAD_PARAMETER;
471     }
472     else
473     {
474         /* Check all 7 characters for correct format */
475
476         for (i = 0; i < 7; i++)
477         {
478             /* First 3 characters must be uppercase letters */
479
480             if (i < 3)
481             {
482                 if (!isupper (InString[i]))
483                 {
484                     Status = AE_BAD_PARAMETER;
485                 }
486             }
487
488             /* Last 4 characters must be hex digits */
489
490             else if (!isxdigit (InString[i]))
491             {
492                 Status = AE_BAD_PARAMETER;
493             }
494         }
495     }
496
497     if (ACPI_FAILURE (Status))
498     {
499         AslError (ASL_ERROR, ASL_MSG_INVALID_EISAID, Op, Op->Asl.Value.String);
500     }
501     else
502     {
503         /* Create ID big-endian first (bits are contiguous) */
504
505         BigEndianId  =  (UINT32) (InString[0] - 0x40) << 26 |
506                         (UINT32) (InString[1] - 0x40) << 21 |
507                         (UINT32) (InString[2] - 0x40) << 16 |
508
509                         (UtHexCharToValue (InString[3])) << 12 |
510                         (UtHexCharToValue (InString[4])) << 8  |
511                         (UtHexCharToValue (InString[5])) << 4  |
512                          UtHexCharToValue (InString[6]);
513
514         /* Swap to little-endian to get final ID (see function header) */
515
516         EisaId = AcpiUtDwordByteSwap (BigEndianId);
517     }
518
519     /*
520      * Morph the Op into an integer, regardless of whether there
521      * was an error in the EISAID string
522      */
523     Op->Asl.Value.Integer = EisaId;
524
525     Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
526     Op->Asl.ParseOpcode = PARSEOP_INTEGER;
527     (void) OpcSetOptimalIntegerSize (Op);
528
529     /* Op is now an integer */
530
531     UtSetParseOpName (Op);
532 }
533
534
535 /*******************************************************************************
536  *
537  * FUNCTION:    OpcDoUiId
538  *
539  * PARAMETERS:  Op        - Parse node
540  *
541  * RETURN:      None
542  *
543  * DESCRIPTION:
544  *
545  ******************************************************************************/
546
547 static UINT8 OpcMapToUUID[16] = {6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34};
548
549 void
550 OpcDoUuId (
551     ACPI_PARSE_OBJECT       *Op)
552 {
553     char                    *InString;
554     char                    *Buffer;
555     ACPI_STATUS             Status = AE_OK;
556     ACPI_NATIVE_UINT        i;
557     ACPI_PARSE_OBJECT       *NewOp;
558
559
560     InString = (char *) Op->Asl.Value.String;
561
562     if (ACPI_STRLEN (InString) != 36)
563     {
564         Status = AE_BAD_PARAMETER;
565     }
566     else
567     {
568         /* Check all 36 characters for correct format */
569
570         for (i = 0; i < 36; i++)
571         {
572             if ((i == 8) || (i == 13) || (i == 18) || (i == 23))
573             {
574                 if (InString[i] != '-')
575                 {
576                     Status = AE_BAD_PARAMETER;
577                 }
578             }
579             else
580             {
581                 if (!isxdigit (InString[i]))
582                 {
583                     Status = AE_BAD_PARAMETER;
584                 }
585             }
586         }
587     }
588
589     Buffer = UtLocalCalloc (16);
590
591     if (ACPI_FAILURE (Status))
592     {
593         AslError (ASL_ERROR, ASL_MSG_INVALID_UUID, Op, Op->Asl.Value.String);
594     }
595     else for (i = 0; i < 16; i++)
596     {
597         Buffer[i]  = (char) (UtHexCharToValue (InString[OpcMapToUUID[i]]) << 4);
598         Buffer[i] |= (char)  UtHexCharToValue (InString[OpcMapToUUID[i] + 1]);
599     }
600
601     /* Change Op to a Buffer */
602
603     Op->Asl.ParseOpcode = PARSEOP_BUFFER;
604     Op->Common.AmlOpcode = AML_BUFFER_OP;
605     Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;   /* Disable further optimization */
606     UtSetParseOpName (Op);
607
608     /* Child node is the buffer length */
609
610     NewOp = TrAllocateNode (PARSEOP_INTEGER);
611
612     NewOp->Asl.AmlOpcode     = AML_BYTE_OP;
613     NewOp->Asl.Value.Integer = 16;
614     NewOp->Asl.Parent        = Op;
615
616     Op->Asl.Child = NewOp;
617     Op = NewOp;
618
619     /* Peer to the child is the raw buffer data */
620
621     NewOp = TrAllocateNode (PARSEOP_RAW_DATA);
622     NewOp->Asl.AmlOpcode     = AML_RAW_DATA_BUFFER;
623     NewOp->Asl.AmlLength     = 16;
624     NewOp->Asl.Value.String  = (char *) Buffer;
625     NewOp->Asl.Parent        = Op->Asl.Parent;
626
627     Op->Asl.Next = NewOp;
628 }
629
630
631 /*******************************************************************************
632  *
633  * FUNCTION:    OpcGenerateAmlOpcode
634  *
635  * PARAMETERS:  Op        - Parse node
636  *
637  * RETURN:      None
638  *
639  * DESCRIPTION: Generate the AML opcode associated with the node and its
640  *              parse (lex/flex) keyword opcode.  Essentially implements
641  *              a mapping between the parse opcodes and the actual AML opcodes.
642  *
643  ******************************************************************************/
644
645 void
646 OpcGenerateAmlOpcode (
647     ACPI_PARSE_OBJECT       *Op)
648 {
649
650     UINT16                  Index;
651
652
653     Index = (UINT16) (Op->Asl.ParseOpcode - ASL_PARSE_OPCODE_BASE);
654
655     Op->Asl.AmlOpcode     = AslKeywordMapping[Index].AmlOpcode;
656     Op->Asl.AcpiBtype     = AslKeywordMapping[Index].AcpiBtype;
657     Op->Asl.CompileFlags |= AslKeywordMapping[Index].Flags;
658
659     if (!Op->Asl.Value.Integer)
660     {
661         Op->Asl.Value.Integer = AslKeywordMapping[Index].Value;
662     }
663
664     /* Special handling for some opcodes */
665
666     switch (Op->Asl.ParseOpcode)
667     {
668     case PARSEOP_INTEGER:
669         /*
670          * Set the opcode based on the size of the integer
671          */
672         (void) OpcSetOptimalIntegerSize (Op);
673         break;
674
675     case PARSEOP_OFFSET:
676
677         Op->Asl.AmlOpcodeLength = 1;
678         break;
679
680     case PARSEOP_ACCESSAS:
681
682         OpcDoAccessAs (Op);
683         break;
684
685     case PARSEOP_EISAID:
686
687         OpcDoEisaId (Op);
688         break;
689
690     case PARSEOP_TOUUID:
691
692         OpcDoUuId (Op);
693         break;
694
695     case PARSEOP_UNICODE:
696
697         OpcDoUnicode (Op);
698         break;
699
700     case PARSEOP_INCLUDE:
701
702         Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
703         Gbl_HasIncludeFiles = TRUE;
704         break;
705
706     case PARSEOP_EXTERNAL:
707
708         Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
709         Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
710         break;
711
712     case PARSEOP_PACKAGE:
713         /*
714          * The variable-length package has a different opcode
715          */
716         if ((Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
717             (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER)     &&
718             (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_BYTECONST))
719         {
720             Op->Asl.AmlOpcode = AML_VAR_PACKAGE_OP;
721         }
722         break;
723
724     default:
725         /* Nothing to do for other opcodes */
726         break;
727     }
728
729     return;
730 }
731
732