2 /******************************************************************************
4 * Module Name: aslrestype1 - Short (type1) resource templates and descriptors
7 *****************************************************************************/
9 /******************************************************************************
13 * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
14 * All rights reserved.
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
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
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;
39 * The above copyright and patent license is granted only if the following
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.
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
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
74 * 3.4. Intel retains all right, title, and interest in and to the Original
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.
82 * 4. Disclaimer and Export Compliance
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
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
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.
116 *****************************************************************************/
119 #include <contrib/dev/acpica/compiler/aslcompiler.h>
120 #include "aslcompiler.y.h"
122 #define _COMPONENT ACPI_COMPILER
123 ACPI_MODULE_NAME ("aslrestype1")
126 /*******************************************************************************
128 * FUNCTION: RsDoEndTagDescriptor
130 * PARAMETERS: Op - Parent resource descriptor parse node
131 * CurrentByteOffset - Offset into the resource template AML
132 * buffer (to track references to the desc)
134 * RETURN: Completed resource node
136 * DESCRIPTION: Construct a short "EndDependentFn" descriptor
138 ******************************************************************************/
141 RsDoEndTagDescriptor (
142 ACPI_PARSE_OBJECT *Op,
143 UINT32 CurrentByteOffset)
145 AML_RESOURCE *Descriptor;
146 ASL_RESOURCE_NODE *Rnode;
149 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG));
151 Descriptor = Rnode->Buffer;
152 Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG |
153 ASL_RDESC_END_TAG_SIZE;
154 Descriptor->EndTag.Checksum = 0;
160 /*******************************************************************************
162 * FUNCTION: RsDoDmaDescriptor
164 * PARAMETERS: Op - Parent resource descriptor parse node
165 * CurrentByteOffset - Offset into the resource template AML
166 * buffer (to track references to the desc)
168 * RETURN: Completed resource node
170 * DESCRIPTION: Construct a short "DMA" descriptor
172 ******************************************************************************/
176 ACPI_PARSE_OBJECT *Op,
177 UINT32 CurrentByteOffset)
179 AML_RESOURCE *Descriptor;
180 ACPI_PARSE_OBJECT *InitializerOp;
181 ASL_RESOURCE_NODE *Rnode;
183 UINT8 DmaChannelMask = 0;
184 UINT8 DmaChannels = 0;
187 InitializerOp = Op->Asl.Child;
188 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
190 Descriptor = Rnode->Buffer;
191 Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
194 /* Process all child initialization nodes */
196 for (i = 0; InitializerOp; i++)
200 case 0: /* DMA type */
202 RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
203 RsCreateBitField (InitializerOp, ACPI_RESTAG_DMATYPE,
204 CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
207 case 1: /* Bus Master */
209 RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
210 RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER,
211 CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
214 case 2: /* Xfer Type (transfer width) */
216 RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
217 RsCreateBitField (InitializerOp, ACPI_RESTAG_XFERTYPE,
218 CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
223 UtAttachNamepathToOwner (Op, InitializerOp);
228 /* All DMA channel bytes are handled here, after flags and name */
230 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
232 /* Up to 8 channels can be specified in the list */
237 AslError (ASL_ERROR, ASL_MSG_DMA_LIST,
238 InitializerOp, NULL);
242 /* Only DMA channels 0-7 are allowed (mask is 8 bits) */
244 if (InitializerOp->Asl.Value.Integer > 7)
246 AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL,
247 InitializerOp, NULL);
253 (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
256 if (i == 4) /* case 4: First DMA byte */
258 /* Check now for duplicates in list */
260 RsCheckListForDuplicates (InitializerOp);
262 /* Create a named field at the start of the list */
264 RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA,
266 ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
271 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
274 /* Now we can set the channel mask */
276 Descriptor->Dma.DmaChannelMask = DmaChannelMask;
281 /*******************************************************************************
283 * FUNCTION: RsDoEndDependentDescriptor
285 * PARAMETERS: Op - Parent resource descriptor parse node
286 * CurrentByteOffset - Offset into the resource template AML
287 * buffer (to track references to the desc)
289 * RETURN: Completed resource node
291 * DESCRIPTION: Construct a short "EndDependentFn" descriptor
293 ******************************************************************************/
296 RsDoEndDependentDescriptor (
297 ACPI_PARSE_OBJECT *Op,
298 UINT32 CurrentByteOffset)
300 AML_RESOURCE *Descriptor;
301 ASL_RESOURCE_NODE *Rnode;
304 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT));
306 Descriptor = Rnode->Buffer;
307 Descriptor->EndDpf.DescriptorType = ACPI_RESOURCE_NAME_END_DEPENDENT |
308 ASL_RDESC_END_DEPEND_SIZE;
313 /*******************************************************************************
315 * FUNCTION: RsDoFixedIoDescriptor
317 * PARAMETERS: Op - Parent resource descriptor parse node
318 * CurrentByteOffset - Offset into the resource template AML
319 * buffer (to track references to the desc)
321 * RETURN: Completed resource node
323 * DESCRIPTION: Construct a short "FixedIO" descriptor
325 ******************************************************************************/
328 RsDoFixedIoDescriptor (
329 ACPI_PARSE_OBJECT *Op,
330 UINT32 CurrentByteOffset)
332 AML_RESOURCE *Descriptor;
333 ACPI_PARSE_OBJECT *InitializerOp;
334 ASL_RESOURCE_NODE *Rnode;
338 InitializerOp = Op->Asl.Child;
339 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
341 Descriptor = Rnode->Buffer;
342 Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO |
343 ASL_RDESC_FIXED_IO_SIZE;
345 /* Process all child initialization nodes */
347 for (i = 0; InitializerOp; i++)
351 case 0: /* Base Address */
353 Descriptor->FixedIo.Address =
354 (UINT16) InitializerOp->Asl.Value.Integer;
355 RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
356 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
361 Descriptor->FixedIo.AddressLength =
362 (UINT8) InitializerOp->Asl.Value.Integer;
363 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
364 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
369 UtAttachNamepathToOwner (Op, InitializerOp);
374 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
378 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
385 /*******************************************************************************
387 * FUNCTION: RsDoIoDescriptor
389 * PARAMETERS: Op - Parent resource descriptor parse node
390 * CurrentByteOffset - Offset into the resource template AML
391 * buffer (to track references to the desc)
393 * RETURN: Completed resource node
395 * DESCRIPTION: Construct a short "IO" descriptor
397 ******************************************************************************/
401 ACPI_PARSE_OBJECT *Op,
402 UINT32 CurrentByteOffset)
404 AML_RESOURCE *Descriptor;
405 ACPI_PARSE_OBJECT *InitializerOp;
406 ASL_RESOURCE_NODE *Rnode;
410 InitializerOp = Op->Asl.Child;
411 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
413 Descriptor = Rnode->Buffer;
414 Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
417 /* Process all child initialization nodes */
419 for (i = 0; InitializerOp; i++)
423 case 0: /* Decode size */
425 RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1);
426 RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
427 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0);
430 case 1: /* Min Address */
432 Descriptor->Io.Minimum =
433 (UINT16) InitializerOp->Asl.Value.Integer;
434 RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
435 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
438 case 2: /* Max Address */
440 Descriptor->Io.Maximum =
441 (UINT16) InitializerOp->Asl.Value.Integer;
442 RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
443 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
446 case 3: /* Alignment */
448 Descriptor->Io.Alignment =
449 (UINT8) InitializerOp->Asl.Value.Integer;
450 RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
451 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
456 Descriptor->Io.AddressLength =
457 (UINT8) InitializerOp->Asl.Value.Integer;
458 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
459 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
464 UtAttachNamepathToOwner (Op, InitializerOp);
469 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
473 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
480 /*******************************************************************************
482 * FUNCTION: RsDoIrqDescriptor
484 * PARAMETERS: Op - Parent resource descriptor parse node
485 * CurrentByteOffset - Offset into the resource template AML
486 * buffer (to track references to the desc)
488 * RETURN: Completed resource node
490 * DESCRIPTION: Construct a short "IRQ" descriptor
492 ******************************************************************************/
496 ACPI_PARSE_OBJECT *Op,
497 UINT32 CurrentByteOffset)
499 AML_RESOURCE *Descriptor;
500 ACPI_PARSE_OBJECT *InitializerOp;
501 ASL_RESOURCE_NODE *Rnode;
502 UINT32 Interrupts = 0;
507 InitializerOp = Op->Asl.Child;
508 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
510 /* Length = 3 (with flag byte) */
512 Descriptor = Rnode->Buffer;
513 Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
514 (ASL_RDESC_IRQ_SIZE + 0x01);
516 /* Process all child initialization nodes */
518 for (i = 0; InitializerOp; i++)
522 case 0: /* Interrupt Type (or Mode - edge/level) */
524 RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
525 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
526 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
529 case 1: /* Interrupt Level (or Polarity - Active high/low) */
531 RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
532 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
533 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
536 case 2: /* Share Type - Default: exclusive (0) */
538 RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
539 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
540 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
545 UtAttachNamepathToOwner (Op, InitializerOp);
550 /* All IRQ bytes are handled here, after the flags and name */
552 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
554 /* Up to 16 interrupts can be specified in the list */
559 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
560 InitializerOp, NULL);
564 /* Only interrupts 0-15 are allowed (mask is 16 bits) */
566 if (InitializerOp->Asl.Value.Integer > 15)
568 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
569 InitializerOp, NULL);
573 IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
577 /* Case 4: First IRQ value in list */
581 /* Check now for duplicates in list */
583 RsCheckListForDuplicates (InitializerOp);
585 /* Create a named field at the start of the list */
587 RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
588 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
593 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
596 /* Now we can set the channel mask */
598 Descriptor->Irq.IrqMask = IrqMask;
603 /*******************************************************************************
605 * FUNCTION: RsDoIrqNoFlagsDescriptor
607 * PARAMETERS: Op - Parent resource descriptor parse node
608 * CurrentByteOffset - Offset into the resource template AML
609 * buffer (to track references to the desc)
611 * RETURN: Completed resource node
613 * DESCRIPTION: Construct a short "IRQNoFlags" descriptor
615 ******************************************************************************/
618 RsDoIrqNoFlagsDescriptor (
619 ACPI_PARSE_OBJECT *Op,
620 UINT32 CurrentByteOffset)
622 AML_RESOURCE *Descriptor;
623 ACPI_PARSE_OBJECT *InitializerOp;
624 ASL_RESOURCE_NODE *Rnode;
626 UINT32 Interrupts = 0;
630 InitializerOp = Op->Asl.Child;
631 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
633 Descriptor = Rnode->Buffer;
634 Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
637 /* Process all child initialization nodes */
639 for (i = 0; InitializerOp; i++)
645 UtAttachNamepathToOwner (Op, InitializerOp);
650 /* IRQ bytes are handled here, after the flags and name */
652 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
654 /* Up to 16 interrupts can be specified in the list */
659 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
660 InitializerOp, NULL);
664 /* Only interrupts 0-15 are allowed (mask is 16 bits) */
666 if (InitializerOp->Asl.Value.Integer > 15)
668 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
669 InitializerOp, NULL);
673 IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
677 /* Case 1: First IRQ value in list */
681 /* Check now for duplicates in list */
683 RsCheckListForDuplicates (InitializerOp);
685 /* Create a named field at the start of the list */
687 RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
688 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
693 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
696 /* Now we can set the interrupt mask */
698 Descriptor->Irq.IrqMask = IrqMask;
703 /*******************************************************************************
705 * FUNCTION: RsDoMemory24Descriptor
707 * PARAMETERS: Op - Parent resource descriptor parse node
708 * CurrentByteOffset - Offset into the resource template AML
709 * buffer (to track references to the desc)
711 * RETURN: Completed resource node
713 * DESCRIPTION: Construct a short "Memory24" descriptor
715 ******************************************************************************/
718 RsDoMemory24Descriptor (
719 ACPI_PARSE_OBJECT *Op,
720 UINT32 CurrentByteOffset)
722 AML_RESOURCE *Descriptor;
723 ACPI_PARSE_OBJECT *InitializerOp;
724 ASL_RESOURCE_NODE *Rnode;
728 InitializerOp = Op->Asl.Child;
729 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24));
731 Descriptor = Rnode->Buffer;
732 Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
733 Descriptor->Memory24.ResourceLength = 9;
735 /* Process all child initialization nodes */
737 for (i = 0; InitializerOp; i++)
741 case 0: /* Read/Write type */
743 RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1);
744 RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
745 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0);
748 case 1: /* Min Address */
750 Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
751 RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
752 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
755 case 2: /* Max Address */
757 Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
758 RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
759 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
762 case 3: /* Alignment */
764 Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
765 RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
766 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
771 Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
772 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
773 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
778 UtAttachNamepathToOwner (Op, InitializerOp);
783 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
787 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
794 /*******************************************************************************
796 * FUNCTION: RsDoMemory32Descriptor
798 * PARAMETERS: Op - Parent resource descriptor parse node
799 * CurrentByteOffset - Offset into the resource template AML
800 * buffer (to track references to the desc)
802 * RETURN: Completed resource node
804 * DESCRIPTION: Construct a short "Memory32" descriptor
806 ******************************************************************************/
809 RsDoMemory32Descriptor (
810 ACPI_PARSE_OBJECT *Op,
811 UINT32 CurrentByteOffset)
813 AML_RESOURCE *Descriptor;
814 ACPI_PARSE_OBJECT *InitializerOp;
815 ASL_RESOURCE_NODE *Rnode;
819 InitializerOp = Op->Asl.Child;
820 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
822 Descriptor = Rnode->Buffer;
823 Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
824 Descriptor->Memory32.ResourceLength = 17;
826 /* Process all child initialization nodes */
828 for (i = 0; InitializerOp; i++)
832 case 0: /* Read/Write type */
834 RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1);
835 RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
836 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0);
839 case 1: /* Min Address */
841 Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
842 RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
843 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
846 case 2: /* Max Address */
848 Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
849 RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
850 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
853 case 3: /* Alignment */
855 Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
856 RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
857 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
862 Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
863 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
864 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
869 UtAttachNamepathToOwner (Op, InitializerOp);
874 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
878 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
885 /*******************************************************************************
887 * FUNCTION: RsDoMemory32FixedDescriptor
889 * PARAMETERS: Op - Parent resource descriptor parse node
890 * CurrentByteOffset - Offset into the resource template AML
891 * buffer (to track references to the desc)
893 * RETURN: Completed resource node
895 * DESCRIPTION: Construct a short "Memory32Fixed" descriptor
897 ******************************************************************************/
900 RsDoMemory32FixedDescriptor (
901 ACPI_PARSE_OBJECT *Op,
902 UINT32 CurrentByteOffset)
904 AML_RESOURCE *Descriptor;
905 ACPI_PARSE_OBJECT *InitializerOp;
906 ASL_RESOURCE_NODE *Rnode;
910 InitializerOp = Op->Asl.Child;
911 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
913 Descriptor = Rnode->Buffer;
914 Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
915 Descriptor->FixedMemory32.ResourceLength = 9;
917 /* Process all child initialization nodes */
919 for (i = 0; InitializerOp; i++)
923 case 0: /* Read/Write type */
925 RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1);
926 RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
927 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0);
930 case 1: /* Address */
932 Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
933 RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
934 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
939 Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
940 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
941 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
946 UtAttachNamepathToOwner (Op, InitializerOp);
951 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
955 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
962 /*******************************************************************************
964 * FUNCTION: RsDoStartDependentDescriptor
966 * PARAMETERS: Op - Parent resource descriptor parse node
967 * CurrentByteOffset - Offset into the resource template AML
968 * buffer (to track references to the desc)
970 * RETURN: Completed resource node
972 * DESCRIPTION: Construct a short "StartDependentFn" descriptor
974 ******************************************************************************/
977 RsDoStartDependentDescriptor (
978 ACPI_PARSE_OBJECT *Op,
979 UINT32 CurrentByteOffset)
981 AML_RESOURCE *Descriptor;
982 ACPI_PARSE_OBJECT *InitializerOp;
983 ASL_RESOURCE_NODE *Rnode;
984 ASL_RESOURCE_NODE *PreviousRnode;
985 ASL_RESOURCE_NODE *NextRnode;
990 InitializerOp = Op->Asl.Child;
991 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT));
993 PreviousRnode = Rnode;
994 Descriptor = Rnode->Buffer;
996 /* Descriptor has priority byte */
998 Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
999 (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
1001 /* Process all child initialization nodes */
1003 State = ACPI_RSTATE_START_DEPENDENT;
1004 for (i = 0; InitializerOp; i++)
1008 case 0: /* Compatibility Priority */
1010 if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
1012 AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY,
1013 InitializerOp, NULL);
1016 RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0);
1019 case 1: /* Performance/Robustness Priority */
1021 if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
1023 AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE,
1024 InitializerOp, NULL);
1027 RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0);
1031 NextRnode = RsDoOneResourceDescriptor (InitializerOp,
1032 CurrentByteOffset, &State);
1035 * Update current byte offset to indicate the number of bytes from the
1036 * start of the buffer. Buffer can include multiple descriptors, we
1037 * must keep track of the offset of not only each descriptor, but each
1038 * element (field) within each descriptor as well.
1041 CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
1046 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1053 /*******************************************************************************
1055 * FUNCTION: RsDoStartDependentNoPriDescriptor
1057 * PARAMETERS: Op - Parent resource descriptor parse node
1058 * CurrentByteOffset - Offset into the resource template AML
1059 * buffer (to track references to the desc)
1061 * RETURN: Completed resource node
1063 * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor
1065 ******************************************************************************/
1068 RsDoStartDependentNoPriDescriptor (
1069 ACPI_PARSE_OBJECT *Op,
1070 UINT32 CurrentByteOffset)
1072 AML_RESOURCE *Descriptor;
1073 ACPI_PARSE_OBJECT *InitializerOp;
1074 ASL_RESOURCE_NODE *Rnode;
1075 ASL_RESOURCE_NODE *PreviousRnode;
1076 ASL_RESOURCE_NODE *NextRnode;
1080 InitializerOp = Op->Asl.Child;
1081 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO));
1083 Descriptor = Rnode->Buffer;
1084 Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
1085 ASL_RDESC_ST_DEPEND_SIZE;
1086 PreviousRnode = Rnode;
1088 /* Process all child initialization nodes */
1090 State = ACPI_RSTATE_START_DEPENDENT;
1091 while (InitializerOp)
1093 NextRnode = RsDoOneResourceDescriptor (InitializerOp,
1094 CurrentByteOffset, &State);
1097 * Update current byte offset to indicate the number of bytes from the
1098 * start of the buffer. Buffer can include multiple descriptors, we
1099 * must keep track of the offset of not only each descriptor, but each
1100 * element (field) within each descriptor as well.
1102 CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
1104 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1111 /*******************************************************************************
1113 * FUNCTION: RsDoVendorSmallDescriptor
1115 * PARAMETERS: Op - Parent resource descriptor parse node
1116 * CurrentByteOffset - Offset into the resource template AML
1117 * buffer (to track references to the desc)
1119 * RETURN: Completed resource node
1121 * DESCRIPTION: Construct a short "VendorShort" descriptor
1123 ******************************************************************************/
1126 RsDoVendorSmallDescriptor (
1127 ACPI_PARSE_OBJECT *Op,
1128 UINT32 CurrentByteOffset)
1130 AML_RESOURCE *Descriptor;
1131 ACPI_PARSE_OBJECT *InitializerOp;
1132 ASL_RESOURCE_NODE *Rnode;
1137 InitializerOp = Op->Asl.Child;
1139 /* Allocate worst case - 7 vendor bytes */
1141 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7);
1143 Descriptor = Rnode->Buffer;
1144 Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL;
1145 VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER);
1147 /* Process all child initialization nodes */
1149 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1150 for (i = 0; InitializerOp; i++)
1152 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
1157 /* Maximum 7 vendor data bytes allowed (0-6) */
1161 AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL);
1163 /* Eat the excess initializers */
1165 while (InitializerOp)
1167 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1172 VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer;
1173 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1176 /* Adjust the Rnode buffer size, so correct number of bytes are emitted */
1178 Rnode->BufferLength -= (7 - i);
1180 /* Set the length in the Type Tag */
1182 Descriptor->VendorSmall.DescriptorType |= (UINT8) i;