2 /******************************************************************************
4 * Module Name: aslrestype1 - Short (type1) resource templates and descriptors
7 *****************************************************************************/
9 /******************************************************************************
13 * Some or all of this work - Copyright (c) 1999 - 2005, 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: RsDoDmaDescriptor
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 "DMA" descriptor
138 ******************************************************************************/
142 ACPI_PARSE_OBJECT *Op,
143 UINT32 CurrentByteOffset)
145 AML_RESOURCE *Descriptor;
146 ACPI_PARSE_OBJECT *InitializerOp;
147 ASL_RESOURCE_NODE *Rnode;
149 UINT8 DmaChannelMask = 0;
150 UINT8 DmaChannels = 0;
153 InitializerOp = Op->Asl.Child;
154 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
156 Descriptor = Rnode->Buffer;
157 Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
160 /* Process all child initialization nodes */
162 for (i = 0; InitializerOp; i++)
166 case 0: /* DMA type */
168 RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
169 RsCreateBitField (InitializerOp, ASL_RESNAME_DMATYPE,
170 CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
173 case 1: /* Bus Master */
175 RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
176 RsCreateBitField (InitializerOp, ASL_RESNAME_BUSMASTER,
177 CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
180 case 2: /* Xfer Type (transfer width) */
182 RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
183 RsCreateBitField (InitializerOp, ASL_RESNAME_XFERTYPE,
184 CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
189 UtAttachNamepathToOwner (Op, InitializerOp);
194 /* All DMA channel bytes are handled here, after flags and name */
196 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
198 /* Up to 8 channels can be specified in the list */
203 AslError (ASL_ERROR, ASL_MSG_DMA_LIST,
204 InitializerOp, NULL);
208 /* Only DMA channels 0-7 are allowed (mask is 8 bits) */
210 if (InitializerOp->Asl.Value.Integer > 7)
212 AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL,
213 InitializerOp, NULL);
219 (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
222 if (i == 4) /* case 4: First DMA byte */
224 /* Check now for duplicates in list */
226 RsCheckListForDuplicates (InitializerOp);
228 /* Create a named field at the start of the list */
230 RsCreateByteField (InitializerOp, ASL_RESNAME_DMA,
232 ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
237 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
240 /* Now we can set the channel mask */
242 Descriptor->Dma.DmaChannelMask = DmaChannelMask;
247 /*******************************************************************************
249 * FUNCTION: RsDoEndDependentDescriptor
251 * PARAMETERS: Op - Parent resource descriptor parse node
252 * CurrentByteOffset - Offset into the resource template AML
253 * buffer (to track references to the desc)
255 * RETURN: Completed resource node
257 * DESCRIPTION: Construct a short "EndDependentFn" descriptor
259 ******************************************************************************/
262 RsDoEndDependentDescriptor (
263 ACPI_PARSE_OBJECT *Op,
264 UINT32 CurrentByteOffset)
266 AML_RESOURCE *Descriptor;
267 ASL_RESOURCE_NODE *Rnode;
270 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT));
272 Descriptor = Rnode->Buffer;
273 Descriptor->EndDpf.DescriptorType = ACPI_RESOURCE_NAME_END_DEPENDENT |
274 ASL_RDESC_END_DEPEND_SIZE;
279 /*******************************************************************************
281 * FUNCTION: RsDoFixedIoDescriptor
283 * PARAMETERS: Op - Parent resource descriptor parse node
284 * CurrentByteOffset - Offset into the resource template AML
285 * buffer (to track references to the desc)
287 * RETURN: Completed resource node
289 * DESCRIPTION: Construct a short "FixedIO" descriptor
291 ******************************************************************************/
294 RsDoFixedIoDescriptor (
295 ACPI_PARSE_OBJECT *Op,
296 UINT32 CurrentByteOffset)
298 AML_RESOURCE *Descriptor;
299 ACPI_PARSE_OBJECT *InitializerOp;
300 ASL_RESOURCE_NODE *Rnode;
304 InitializerOp = Op->Asl.Child;
305 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
307 Descriptor = Rnode->Buffer;
308 Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO |
309 ASL_RDESC_FIXED_IO_SIZE;
311 /* Process all child initialization nodes */
313 for (i = 0; InitializerOp; i++)
317 case 0: /* Base Address */
319 Descriptor->FixedIo.Address =
320 (UINT16) InitializerOp->Asl.Value.Integer;
321 RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS,
322 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
327 Descriptor->FixedIo.AddressLength =
328 (UINT8) InitializerOp->Asl.Value.Integer;
329 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
330 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
335 UtAttachNamepathToOwner (Op, InitializerOp);
340 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
344 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
351 /*******************************************************************************
353 * FUNCTION: RsDoIoDescriptor
355 * PARAMETERS: Op - Parent resource descriptor parse node
356 * CurrentByteOffset - Offset into the resource template AML
357 * buffer (to track references to the desc)
359 * RETURN: Completed resource node
361 * DESCRIPTION: Construct a short "IO" descriptor
363 ******************************************************************************/
367 ACPI_PARSE_OBJECT *Op,
368 UINT32 CurrentByteOffset)
370 AML_RESOURCE *Descriptor;
371 ACPI_PARSE_OBJECT *InitializerOp;
372 ASL_RESOURCE_NODE *Rnode;
376 InitializerOp = Op->Asl.Child;
377 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
379 Descriptor = Rnode->Buffer;
380 Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
383 /* Process all child initialization nodes */
385 for (i = 0; InitializerOp; i++)
389 case 0: /* Decode size */
391 RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1);
392 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
393 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0);
396 case 1: /* Min Address */
398 Descriptor->Io.Minimum =
399 (UINT16) InitializerOp->Asl.Value.Integer;
400 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
401 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
404 case 2: /* Max Address */
406 Descriptor->Io.Maximum =
407 (UINT16) InitializerOp->Asl.Value.Integer;
408 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
409 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
412 case 3: /* Alignment */
414 Descriptor->Io.Alignment =
415 (UINT8) InitializerOp->Asl.Value.Integer;
416 RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
417 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
422 Descriptor->Io.AddressLength =
423 (UINT8) InitializerOp->Asl.Value.Integer;
424 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
425 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
430 UtAttachNamepathToOwner (Op, InitializerOp);
435 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
439 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
446 /*******************************************************************************
448 * FUNCTION: RsDoIrqDescriptor
450 * PARAMETERS: Op - Parent resource descriptor parse node
451 * CurrentByteOffset - Offset into the resource template AML
452 * buffer (to track references to the desc)
454 * RETURN: Completed resource node
456 * DESCRIPTION: Construct a short "IRQ" descriptor
458 ******************************************************************************/
462 ACPI_PARSE_OBJECT *Op,
463 UINT32 CurrentByteOffset)
465 AML_RESOURCE *Descriptor;
466 ACPI_PARSE_OBJECT *InitializerOp;
467 ASL_RESOURCE_NODE *Rnode;
468 UINT32 Interrupts = 0;
473 InitializerOp = Op->Asl.Child;
474 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
476 /* Length = 3 (with flag byte) */
478 Descriptor = Rnode->Buffer;
479 Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
480 (ASL_RDESC_IRQ_SIZE + 0x01);
482 /* Process all child initialization nodes */
484 for (i = 0; InitializerOp; i++)
488 case 0: /* Interrupt Type (or Mode - edge/level) */
490 RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
491 RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE,
492 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
495 case 1: /* Interrupt Level (or Polarity - Active high/low) */
497 RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
498 RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL,
499 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
502 case 2: /* Share Type - Default: exclusive (0) */
504 RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
505 RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE,
506 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
511 UtAttachNamepathToOwner (Op, InitializerOp);
516 /* All IRQ bytes are handled here, after the flags and name */
518 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
520 /* Up to 16 interrupts can be specified in the list */
525 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
526 InitializerOp, NULL);
530 /* Only interrupts 0-15 are allowed (mask is 16 bits) */
532 if (InitializerOp->Asl.Value.Integer > 15)
534 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
535 InitializerOp, NULL);
539 IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
543 /* Case 4: First IRQ value in list */
547 /* Check now for duplicates in list */
549 RsCheckListForDuplicates (InitializerOp);
551 /* Create a named field at the start of the list */
553 RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
554 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
559 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
562 /* Now we can set the channel mask */
564 Descriptor->Irq.IrqMask = IrqMask;
569 /*******************************************************************************
571 * FUNCTION: RsDoIrqNoFlagsDescriptor
573 * PARAMETERS: Op - Parent resource descriptor parse node
574 * CurrentByteOffset - Offset into the resource template AML
575 * buffer (to track references to the desc)
577 * RETURN: Completed resource node
579 * DESCRIPTION: Construct a short "IRQNoFlags" descriptor
581 ******************************************************************************/
584 RsDoIrqNoFlagsDescriptor (
585 ACPI_PARSE_OBJECT *Op,
586 UINT32 CurrentByteOffset)
588 AML_RESOURCE *Descriptor;
589 ACPI_PARSE_OBJECT *InitializerOp;
590 ASL_RESOURCE_NODE *Rnode;
592 UINT32 Interrupts = 0;
596 InitializerOp = Op->Asl.Child;
597 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
599 Descriptor = Rnode->Buffer;
600 Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
603 /* Process all child initialization nodes */
605 for (i = 0; InitializerOp; i++)
611 UtAttachNamepathToOwner (Op, InitializerOp);
616 /* IRQ bytes are handled here, after the flags and name */
618 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
620 /* Up to 16 interrupts can be specified in the list */
625 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
626 InitializerOp, NULL);
630 /* Only interrupts 0-15 are allowed (mask is 16 bits) */
632 if (InitializerOp->Asl.Value.Integer > 15)
634 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
635 InitializerOp, NULL);
639 IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
643 /* Case 1: First IRQ value in list */
647 /* Check now for duplicates in list */
649 RsCheckListForDuplicates (InitializerOp);
651 /* Create a named field at the start of the list */
653 RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
654 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
659 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
662 /* Now we can set the interrupt mask */
664 Descriptor->Irq.IrqMask = IrqMask;
669 /*******************************************************************************
671 * FUNCTION: RsDoMemory24Descriptor
673 * PARAMETERS: Op - Parent resource descriptor parse node
674 * CurrentByteOffset - Offset into the resource template AML
675 * buffer (to track references to the desc)
677 * RETURN: Completed resource node
679 * DESCRIPTION: Construct a short "Memory24" descriptor
681 ******************************************************************************/
684 RsDoMemory24Descriptor (
685 ACPI_PARSE_OBJECT *Op,
686 UINT32 CurrentByteOffset)
688 AML_RESOURCE *Descriptor;
689 ACPI_PARSE_OBJECT *InitializerOp;
690 ASL_RESOURCE_NODE *Rnode;
694 InitializerOp = Op->Asl.Child;
695 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24));
697 Descriptor = Rnode->Buffer;
698 Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
699 Descriptor->Memory24.ResourceLength = 9;
701 /* Process all child initialization nodes */
703 for (i = 0; InitializerOp; i++)
707 case 0: /* Read/Write type */
709 RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1);
710 RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
711 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0);
714 case 1: /* Min Address */
716 Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
717 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
718 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
721 case 2: /* Max Address */
723 Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
724 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
725 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
728 case 3: /* Alignment */
730 Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
731 RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
732 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
737 Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
738 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
739 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
744 UtAttachNamepathToOwner (Op, InitializerOp);
749 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
753 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
760 /*******************************************************************************
762 * FUNCTION: RsDoMemory32Descriptor
764 * PARAMETERS: Op - Parent resource descriptor parse node
765 * CurrentByteOffset - Offset into the resource template AML
766 * buffer (to track references to the desc)
768 * RETURN: Completed resource node
770 * DESCRIPTION: Construct a short "Memory32" descriptor
772 ******************************************************************************/
775 RsDoMemory32Descriptor (
776 ACPI_PARSE_OBJECT *Op,
777 UINT32 CurrentByteOffset)
779 AML_RESOURCE *Descriptor;
780 ACPI_PARSE_OBJECT *InitializerOp;
781 ASL_RESOURCE_NODE *Rnode;
785 InitializerOp = Op->Asl.Child;
786 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
788 Descriptor = Rnode->Buffer;
789 Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
790 Descriptor->Memory32.ResourceLength = 17;
792 /* Process all child initialization nodes */
794 for (i = 0; InitializerOp; i++)
798 case 0: /* Read/Write type */
800 RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1);
801 RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
802 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0);
805 case 1: /* Min Address */
807 Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
808 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
809 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
812 case 2: /* Max Address */
814 Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
815 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
816 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
819 case 3: /* Alignment */
821 Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
822 RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
823 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
828 Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
829 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
830 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
835 UtAttachNamepathToOwner (Op, InitializerOp);
840 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
844 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
851 /*******************************************************************************
853 * FUNCTION: RsDoMemory32FixedDescriptor
855 * PARAMETERS: Op - Parent resource descriptor parse node
856 * CurrentByteOffset - Offset into the resource template AML
857 * buffer (to track references to the desc)
859 * RETURN: Completed resource node
861 * DESCRIPTION: Construct a short "Memory32Fixed" descriptor
863 ******************************************************************************/
866 RsDoMemory32FixedDescriptor (
867 ACPI_PARSE_OBJECT *Op,
868 UINT32 CurrentByteOffset)
870 AML_RESOURCE *Descriptor;
871 ACPI_PARSE_OBJECT *InitializerOp;
872 ASL_RESOURCE_NODE *Rnode;
876 InitializerOp = Op->Asl.Child;
877 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
879 Descriptor = Rnode->Buffer;
880 Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
881 Descriptor->FixedMemory32.ResourceLength = 9;
883 /* Process all child initialization nodes */
885 for (i = 0; InitializerOp; i++)
889 case 0: /* Read/Write type */
891 RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1);
892 RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
893 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0);
896 case 1: /* Address */
898 Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
899 RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS,
900 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
905 Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
906 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
907 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
912 UtAttachNamepathToOwner (Op, InitializerOp);
917 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
921 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
928 /*******************************************************************************
930 * FUNCTION: RsDoStartDependentDescriptor
932 * PARAMETERS: Op - Parent resource descriptor parse node
933 * CurrentByteOffset - Offset into the resource template AML
934 * buffer (to track references to the desc)
936 * RETURN: Completed resource node
938 * DESCRIPTION: Construct a short "StartDependentFn" descriptor
940 ******************************************************************************/
943 RsDoStartDependentDescriptor (
944 ACPI_PARSE_OBJECT *Op,
945 UINT32 CurrentByteOffset)
947 AML_RESOURCE *Descriptor;
948 ACPI_PARSE_OBJECT *InitializerOp;
949 ASL_RESOURCE_NODE *Rnode;
950 ASL_RESOURCE_NODE *PreviousRnode;
951 ASL_RESOURCE_NODE *NextRnode;
956 InitializerOp = Op->Asl.Child;
957 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT));
959 PreviousRnode = Rnode;
960 Descriptor = Rnode->Buffer;
962 /* Descriptor has priority byte */
964 Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
965 (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
967 /* Process all child initialization nodes */
969 State = ACPI_RSTATE_START_DEPENDENT;
970 for (i = 0; InitializerOp; i++)
974 case 0: /* Compatibility Priority */
976 if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
978 AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY,
979 InitializerOp, NULL);
982 RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0);
985 case 1: /* Performance/Robustness Priority */
987 if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
989 AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE,
990 InitializerOp, NULL);
993 RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0);
997 NextRnode = RsDoOneResourceDescriptor (InitializerOp,
998 CurrentByteOffset, &State);
1001 * Update current byte offset to indicate the number of bytes from the
1002 * start of the buffer. Buffer can include multiple descriptors, we
1003 * must keep track of the offset of not only each descriptor, but each
1004 * element (field) within each descriptor as well.
1007 CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
1012 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1019 /*******************************************************************************
1021 * FUNCTION: RsDoStartDependentNoPriDescriptor
1023 * PARAMETERS: Op - Parent resource descriptor parse node
1024 * CurrentByteOffset - Offset into the resource template AML
1025 * buffer (to track references to the desc)
1027 * RETURN: Completed resource node
1029 * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor
1031 ******************************************************************************/
1034 RsDoStartDependentNoPriDescriptor (
1035 ACPI_PARSE_OBJECT *Op,
1036 UINT32 CurrentByteOffset)
1038 AML_RESOURCE *Descriptor;
1039 ACPI_PARSE_OBJECT *InitializerOp;
1040 ASL_RESOURCE_NODE *Rnode;
1041 ASL_RESOURCE_NODE *PreviousRnode;
1042 ASL_RESOURCE_NODE *NextRnode;
1046 InitializerOp = Op->Asl.Child;
1047 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO));
1049 Descriptor = Rnode->Buffer;
1050 Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
1051 ASL_RDESC_ST_DEPEND_SIZE;
1052 PreviousRnode = Rnode;
1054 /* Process all child initialization nodes */
1056 State = ACPI_RSTATE_START_DEPENDENT;
1057 while (InitializerOp)
1059 NextRnode = RsDoOneResourceDescriptor (InitializerOp,
1060 CurrentByteOffset, &State);
1063 * Update current byte offset to indicate the number of bytes from the
1064 * start of the buffer. Buffer can include multiple descriptors, we
1065 * must keep track of the offset of not only each descriptor, but each
1066 * element (field) within each descriptor as well.
1068 CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
1070 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1077 /*******************************************************************************
1079 * FUNCTION: RsDoVendorSmallDescriptor
1081 * PARAMETERS: Op - Parent resource descriptor parse node
1082 * CurrentByteOffset - Offset into the resource template AML
1083 * buffer (to track references to the desc)
1085 * RETURN: Completed resource node
1087 * DESCRIPTION: Construct a short "VendorShort" descriptor
1089 ******************************************************************************/
1092 RsDoVendorSmallDescriptor (
1093 ACPI_PARSE_OBJECT *Op,
1094 UINT32 CurrentByteOffset)
1096 AML_RESOURCE *Descriptor;
1097 ACPI_PARSE_OBJECT *InitializerOp;
1098 ASL_RESOURCE_NODE *Rnode;
1103 InitializerOp = Op->Asl.Child;
1105 /* Allocate worst case - 7 vendor bytes */
1107 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7);
1109 Descriptor = Rnode->Buffer;
1110 Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL;
1111 VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER);
1113 /* Process all child initialization nodes */
1115 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1116 for (i = 0; InitializerOp; i++)
1118 /* Maximum 7 vendor data bytes allowed (0-6) */
1122 AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL);
1124 /* Eat the excess initializers */
1126 while (InitializerOp)
1128 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1133 VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer;
1134 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1137 /* Adjust the Rnode buffer size, so correct number of bytes are emitted */
1139 Rnode->BufferLength -= (7 - i);
1141 /* Set the length in the Type Tag */
1143 Descriptor->VendorSmall.DescriptorType |= (UINT8) i;