2 /******************************************************************************
4 * Module Name: aslrestype1 - Short (type1) resource templates and descriptors
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
13 * All rights reserved.
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
73 * 3.4. Intel retains all right, title, and interest in and to the Original
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************/
118 #include <contrib/dev/acpica/compiler/aslcompiler.h>
119 #include "aslcompiler.y.h"
121 #define _COMPONENT ACPI_COMPILER
122 ACPI_MODULE_NAME ("aslrestype1")
125 /*******************************************************************************
127 * FUNCTION: RsDoEndTagDescriptor
129 * PARAMETERS: Op - Parent resource descriptor parse node
130 * CurrentByteOffset - Offset into the resource template AML
131 * buffer (to track references to the desc)
133 * RETURN: Completed resource node
135 * DESCRIPTION: Construct a short "EndDependentFn" descriptor
137 ******************************************************************************/
140 RsDoEndTagDescriptor (
141 ACPI_PARSE_OBJECT *Op,
142 UINT32 CurrentByteOffset)
144 AML_RESOURCE *Descriptor;
145 ASL_RESOURCE_NODE *Rnode;
148 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG));
150 Descriptor = Rnode->Buffer;
151 Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG |
152 ASL_RDESC_END_TAG_SIZE;
153 Descriptor->EndTag.Checksum = 0;
159 /*******************************************************************************
161 * FUNCTION: RsDoDmaDescriptor
163 * PARAMETERS: Op - Parent resource descriptor parse node
164 * CurrentByteOffset - Offset into the resource template AML
165 * buffer (to track references to the desc)
167 * RETURN: Completed resource node
169 * DESCRIPTION: Construct a short "DMA" descriptor
171 ******************************************************************************/
175 ACPI_PARSE_OBJECT *Op,
176 UINT32 CurrentByteOffset)
178 AML_RESOURCE *Descriptor;
179 ACPI_PARSE_OBJECT *InitializerOp;
180 ASL_RESOURCE_NODE *Rnode;
182 UINT8 DmaChannelMask = 0;
183 UINT8 DmaChannels = 0;
186 InitializerOp = Op->Asl.Child;
187 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
189 Descriptor = Rnode->Buffer;
190 Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
193 /* Process all child initialization nodes */
195 for (i = 0; InitializerOp; i++)
199 case 0: /* DMA type */
201 RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
202 RsCreateBitField (InitializerOp, ACPI_RESTAG_DMATYPE,
203 CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
206 case 1: /* Bus Master */
208 RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
209 RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER,
210 CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
213 case 2: /* Xfer Type (transfer width) */
215 RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
216 RsCreateBitField (InitializerOp, ACPI_RESTAG_XFERTYPE,
217 CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
222 UtAttachNamepathToOwner (Op, InitializerOp);
227 /* All DMA channel bytes are handled here, after flags and name */
229 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
231 /* Up to 8 channels can be specified in the list */
236 AslError (ASL_ERROR, ASL_MSG_DMA_LIST,
237 InitializerOp, NULL);
241 /* Only DMA channels 0-7 are allowed (mask is 8 bits) */
243 if (InitializerOp->Asl.Value.Integer > 7)
245 AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL,
246 InitializerOp, NULL);
252 (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
255 if (i == 4) /* case 4: First DMA byte */
257 /* Check now for duplicates in list */
259 RsCheckListForDuplicates (InitializerOp);
261 /* Create a named field at the start of the list */
263 RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA,
265 ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
270 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
273 /* Now we can set the channel mask */
275 Descriptor->Dma.DmaChannelMask = DmaChannelMask;
280 /*******************************************************************************
282 * FUNCTION: RsDoEndDependentDescriptor
284 * PARAMETERS: Op - Parent resource descriptor parse node
285 * CurrentByteOffset - Offset into the resource template AML
286 * buffer (to track references to the desc)
288 * RETURN: Completed resource node
290 * DESCRIPTION: Construct a short "EndDependentFn" descriptor
292 ******************************************************************************/
295 RsDoEndDependentDescriptor (
296 ACPI_PARSE_OBJECT *Op,
297 UINT32 CurrentByteOffset)
299 AML_RESOURCE *Descriptor;
300 ASL_RESOURCE_NODE *Rnode;
303 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT));
305 Descriptor = Rnode->Buffer;
306 Descriptor->EndDpf.DescriptorType = ACPI_RESOURCE_NAME_END_DEPENDENT |
307 ASL_RDESC_END_DEPEND_SIZE;
312 /*******************************************************************************
314 * FUNCTION: RsDoFixedIoDescriptor
316 * PARAMETERS: Op - Parent resource descriptor parse node
317 * CurrentByteOffset - Offset into the resource template AML
318 * buffer (to track references to the desc)
320 * RETURN: Completed resource node
322 * DESCRIPTION: Construct a short "FixedIO" descriptor
324 ******************************************************************************/
327 RsDoFixedIoDescriptor (
328 ACPI_PARSE_OBJECT *Op,
329 UINT32 CurrentByteOffset)
331 AML_RESOURCE *Descriptor;
332 ACPI_PARSE_OBJECT *InitializerOp;
333 ASL_RESOURCE_NODE *Rnode;
337 InitializerOp = Op->Asl.Child;
338 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
340 Descriptor = Rnode->Buffer;
341 Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO |
342 ASL_RDESC_FIXED_IO_SIZE;
344 /* Process all child initialization nodes */
346 for (i = 0; InitializerOp; i++)
350 case 0: /* Base Address */
352 Descriptor->FixedIo.Address =
353 (UINT16) InitializerOp->Asl.Value.Integer;
354 RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
355 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
360 Descriptor->FixedIo.AddressLength =
361 (UINT8) InitializerOp->Asl.Value.Integer;
362 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
363 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
368 UtAttachNamepathToOwner (Op, InitializerOp);
373 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
377 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
384 /*******************************************************************************
386 * FUNCTION: RsDoIoDescriptor
388 * PARAMETERS: Op - Parent resource descriptor parse node
389 * CurrentByteOffset - Offset into the resource template AML
390 * buffer (to track references to the desc)
392 * RETURN: Completed resource node
394 * DESCRIPTION: Construct a short "IO" descriptor
396 ******************************************************************************/
400 ACPI_PARSE_OBJECT *Op,
401 UINT32 CurrentByteOffset)
403 AML_RESOURCE *Descriptor;
404 ACPI_PARSE_OBJECT *InitializerOp;
405 ASL_RESOURCE_NODE *Rnode;
409 InitializerOp = Op->Asl.Child;
410 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
412 Descriptor = Rnode->Buffer;
413 Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
416 /* Process all child initialization nodes */
418 for (i = 0; InitializerOp; i++)
422 case 0: /* Decode size */
424 RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1);
425 RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
426 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0);
429 case 1: /* Min Address */
431 Descriptor->Io.Minimum =
432 (UINT16) InitializerOp->Asl.Value.Integer;
433 RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
434 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
437 case 2: /* Max Address */
439 Descriptor->Io.Maximum =
440 (UINT16) InitializerOp->Asl.Value.Integer;
441 RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
442 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
445 case 3: /* Alignment */
447 Descriptor->Io.Alignment =
448 (UINT8) InitializerOp->Asl.Value.Integer;
449 RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
450 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
455 Descriptor->Io.AddressLength =
456 (UINT8) InitializerOp->Asl.Value.Integer;
457 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
458 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
463 UtAttachNamepathToOwner (Op, InitializerOp);
468 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
472 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
479 /*******************************************************************************
481 * FUNCTION: RsDoIrqDescriptor
483 * PARAMETERS: Op - Parent resource descriptor parse node
484 * CurrentByteOffset - Offset into the resource template AML
485 * buffer (to track references to the desc)
487 * RETURN: Completed resource node
489 * DESCRIPTION: Construct a short "IRQ" descriptor
491 ******************************************************************************/
495 ACPI_PARSE_OBJECT *Op,
496 UINT32 CurrentByteOffset)
498 AML_RESOURCE *Descriptor;
499 ACPI_PARSE_OBJECT *InitializerOp;
500 ASL_RESOURCE_NODE *Rnode;
501 UINT32 Interrupts = 0;
506 InitializerOp = Op->Asl.Child;
507 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
509 /* Length = 3 (with flag byte) */
511 Descriptor = Rnode->Buffer;
512 Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
513 (ASL_RDESC_IRQ_SIZE + 0x01);
515 /* Process all child initialization nodes */
517 for (i = 0; InitializerOp; i++)
521 case 0: /* Interrupt Type (or Mode - edge/level) */
523 RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
524 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
525 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
528 case 1: /* Interrupt Level (or Polarity - Active high/low) */
530 RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
531 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
532 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
535 case 2: /* Share Type - Default: exclusive (0) */
537 RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
538 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
539 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
544 UtAttachNamepathToOwner (Op, InitializerOp);
549 /* All IRQ bytes are handled here, after the flags and name */
551 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
553 /* Up to 16 interrupts can be specified in the list */
558 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
559 InitializerOp, NULL);
563 /* Only interrupts 0-15 are allowed (mask is 16 bits) */
565 if (InitializerOp->Asl.Value.Integer > 15)
567 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
568 InitializerOp, NULL);
572 IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
576 /* Case 4: First IRQ value in list */
580 /* Check now for duplicates in list */
582 RsCheckListForDuplicates (InitializerOp);
584 /* Create a named field at the start of the list */
586 RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
587 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
592 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
595 /* Now we can set the channel mask */
597 Descriptor->Irq.IrqMask = IrqMask;
602 /*******************************************************************************
604 * FUNCTION: RsDoIrqNoFlagsDescriptor
606 * PARAMETERS: Op - Parent resource descriptor parse node
607 * CurrentByteOffset - Offset into the resource template AML
608 * buffer (to track references to the desc)
610 * RETURN: Completed resource node
612 * DESCRIPTION: Construct a short "IRQNoFlags" descriptor
614 ******************************************************************************/
617 RsDoIrqNoFlagsDescriptor (
618 ACPI_PARSE_OBJECT *Op,
619 UINT32 CurrentByteOffset)
621 AML_RESOURCE *Descriptor;
622 ACPI_PARSE_OBJECT *InitializerOp;
623 ASL_RESOURCE_NODE *Rnode;
625 UINT32 Interrupts = 0;
629 InitializerOp = Op->Asl.Child;
630 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
632 Descriptor = Rnode->Buffer;
633 Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
636 /* Process all child initialization nodes */
638 for (i = 0; InitializerOp; i++)
644 UtAttachNamepathToOwner (Op, InitializerOp);
649 /* IRQ bytes are handled here, after the flags and name */
651 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
653 /* Up to 16 interrupts can be specified in the list */
658 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
659 InitializerOp, NULL);
663 /* Only interrupts 0-15 are allowed (mask is 16 bits) */
665 if (InitializerOp->Asl.Value.Integer > 15)
667 AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
668 InitializerOp, NULL);
672 IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
676 /* Case 1: First IRQ value in list */
680 /* Check now for duplicates in list */
682 RsCheckListForDuplicates (InitializerOp);
684 /* Create a named field at the start of the list */
686 RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
687 CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
692 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
695 /* Now we can set the interrupt mask */
697 Descriptor->Irq.IrqMask = IrqMask;
702 /*******************************************************************************
704 * FUNCTION: RsDoMemory24Descriptor
706 * PARAMETERS: Op - Parent resource descriptor parse node
707 * CurrentByteOffset - Offset into the resource template AML
708 * buffer (to track references to the desc)
710 * RETURN: Completed resource node
712 * DESCRIPTION: Construct a short "Memory24" descriptor
714 ******************************************************************************/
717 RsDoMemory24Descriptor (
718 ACPI_PARSE_OBJECT *Op,
719 UINT32 CurrentByteOffset)
721 AML_RESOURCE *Descriptor;
722 ACPI_PARSE_OBJECT *InitializerOp;
723 ASL_RESOURCE_NODE *Rnode;
727 InitializerOp = Op->Asl.Child;
728 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24));
730 Descriptor = Rnode->Buffer;
731 Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
732 Descriptor->Memory24.ResourceLength = 9;
734 /* Process all child initialization nodes */
736 for (i = 0; InitializerOp; i++)
740 case 0: /* Read/Write type */
742 RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1);
743 RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
744 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0);
747 case 1: /* Min Address */
749 Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
750 RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
751 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
754 case 2: /* Max Address */
756 Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
757 RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
758 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
761 case 3: /* Alignment */
763 Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
764 RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
765 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
770 Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
771 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
772 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
777 UtAttachNamepathToOwner (Op, InitializerOp);
782 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
786 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
793 /*******************************************************************************
795 * FUNCTION: RsDoMemory32Descriptor
797 * PARAMETERS: Op - Parent resource descriptor parse node
798 * CurrentByteOffset - Offset into the resource template AML
799 * buffer (to track references to the desc)
801 * RETURN: Completed resource node
803 * DESCRIPTION: Construct a short "Memory32" descriptor
805 ******************************************************************************/
808 RsDoMemory32Descriptor (
809 ACPI_PARSE_OBJECT *Op,
810 UINT32 CurrentByteOffset)
812 AML_RESOURCE *Descriptor;
813 ACPI_PARSE_OBJECT *InitializerOp;
814 ASL_RESOURCE_NODE *Rnode;
818 InitializerOp = Op->Asl.Child;
819 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
821 Descriptor = Rnode->Buffer;
822 Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
823 Descriptor->Memory32.ResourceLength = 17;
825 /* Process all child initialization nodes */
827 for (i = 0; InitializerOp; i++)
831 case 0: /* Read/Write type */
833 RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1);
834 RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
835 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0);
838 case 1: /* Min Address */
840 Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
841 RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
842 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
845 case 2: /* Max Address */
847 Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
848 RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
849 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
852 case 3: /* Alignment */
854 Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
855 RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
856 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
861 Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
862 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
863 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
868 UtAttachNamepathToOwner (Op, InitializerOp);
873 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
877 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
884 /*******************************************************************************
886 * FUNCTION: RsDoMemory32FixedDescriptor
888 * PARAMETERS: Op - Parent resource descriptor parse node
889 * CurrentByteOffset - Offset into the resource template AML
890 * buffer (to track references to the desc)
892 * RETURN: Completed resource node
894 * DESCRIPTION: Construct a short "Memory32Fixed" descriptor
896 ******************************************************************************/
899 RsDoMemory32FixedDescriptor (
900 ACPI_PARSE_OBJECT *Op,
901 UINT32 CurrentByteOffset)
903 AML_RESOURCE *Descriptor;
904 ACPI_PARSE_OBJECT *InitializerOp;
905 ASL_RESOURCE_NODE *Rnode;
909 InitializerOp = Op->Asl.Child;
910 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
912 Descriptor = Rnode->Buffer;
913 Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
914 Descriptor->FixedMemory32.ResourceLength = 9;
916 /* Process all child initialization nodes */
918 for (i = 0; InitializerOp; i++)
922 case 0: /* Read/Write type */
924 RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1);
925 RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
926 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0);
929 case 1: /* Address */
931 Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
932 RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
933 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
938 Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
939 RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
940 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
945 UtAttachNamepathToOwner (Op, InitializerOp);
950 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
954 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
961 /*******************************************************************************
963 * FUNCTION: RsDoStartDependentDescriptor
965 * PARAMETERS: Op - Parent resource descriptor parse node
966 * CurrentByteOffset - Offset into the resource template AML
967 * buffer (to track references to the desc)
969 * RETURN: Completed resource node
971 * DESCRIPTION: Construct a short "StartDependentFn" descriptor
973 ******************************************************************************/
976 RsDoStartDependentDescriptor (
977 ACPI_PARSE_OBJECT *Op,
978 UINT32 CurrentByteOffset)
980 AML_RESOURCE *Descriptor;
981 ACPI_PARSE_OBJECT *InitializerOp;
982 ASL_RESOURCE_NODE *Rnode;
983 ASL_RESOURCE_NODE *PreviousRnode;
984 ASL_RESOURCE_NODE *NextRnode;
989 InitializerOp = Op->Asl.Child;
990 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT));
992 PreviousRnode = Rnode;
993 Descriptor = Rnode->Buffer;
995 /* Descriptor has priority byte */
997 Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
998 (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
1000 /* Process all child initialization nodes */
1002 State = ACPI_RSTATE_START_DEPENDENT;
1003 for (i = 0; InitializerOp; i++)
1007 case 0: /* Compatibility Priority */
1009 if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
1011 AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY,
1012 InitializerOp, NULL);
1015 RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0);
1018 case 1: /* Performance/Robustness Priority */
1020 if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
1022 AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE,
1023 InitializerOp, NULL);
1026 RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0);
1030 NextRnode = RsDoOneResourceDescriptor (InitializerOp,
1031 CurrentByteOffset, &State);
1034 * Update current byte offset to indicate the number of bytes from the
1035 * start of the buffer. Buffer can include multiple descriptors, we
1036 * must keep track of the offset of not only each descriptor, but each
1037 * element (field) within each descriptor as well.
1040 CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
1045 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1052 /*******************************************************************************
1054 * FUNCTION: RsDoStartDependentNoPriDescriptor
1056 * PARAMETERS: Op - Parent resource descriptor parse node
1057 * CurrentByteOffset - Offset into the resource template AML
1058 * buffer (to track references to the desc)
1060 * RETURN: Completed resource node
1062 * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor
1064 ******************************************************************************/
1067 RsDoStartDependentNoPriDescriptor (
1068 ACPI_PARSE_OBJECT *Op,
1069 UINT32 CurrentByteOffset)
1071 AML_RESOURCE *Descriptor;
1072 ACPI_PARSE_OBJECT *InitializerOp;
1073 ASL_RESOURCE_NODE *Rnode;
1074 ASL_RESOURCE_NODE *PreviousRnode;
1075 ASL_RESOURCE_NODE *NextRnode;
1079 InitializerOp = Op->Asl.Child;
1080 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO));
1082 Descriptor = Rnode->Buffer;
1083 Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
1084 ASL_RDESC_ST_DEPEND_SIZE;
1085 PreviousRnode = Rnode;
1087 /* Process all child initialization nodes */
1089 State = ACPI_RSTATE_START_DEPENDENT;
1090 while (InitializerOp)
1092 NextRnode = RsDoOneResourceDescriptor (InitializerOp,
1093 CurrentByteOffset, &State);
1096 * Update current byte offset to indicate the number of bytes from the
1097 * start of the buffer. Buffer can include multiple descriptors, we
1098 * must keep track of the offset of not only each descriptor, but each
1099 * element (field) within each descriptor as well.
1101 CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
1103 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1110 /*******************************************************************************
1112 * FUNCTION: RsDoVendorSmallDescriptor
1114 * PARAMETERS: Op - Parent resource descriptor parse node
1115 * CurrentByteOffset - Offset into the resource template AML
1116 * buffer (to track references to the desc)
1118 * RETURN: Completed resource node
1120 * DESCRIPTION: Construct a short "VendorShort" descriptor
1122 ******************************************************************************/
1125 RsDoVendorSmallDescriptor (
1126 ACPI_PARSE_OBJECT *Op,
1127 UINT32 CurrentByteOffset)
1129 AML_RESOURCE *Descriptor;
1130 ACPI_PARSE_OBJECT *InitializerOp;
1131 ASL_RESOURCE_NODE *Rnode;
1136 InitializerOp = Op->Asl.Child;
1138 /* Allocate worst case - 7 vendor bytes */
1140 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7);
1142 Descriptor = Rnode->Buffer;
1143 Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL;
1144 VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER);
1146 /* Process all child initialization nodes */
1148 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1149 for (i = 0; InitializerOp; i++)
1151 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
1156 /* Maximum 7 vendor data bytes allowed (0-6) */
1160 AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL);
1162 /* Eat the excess initializers */
1164 while (InitializerOp)
1166 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1171 VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer;
1172 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1175 /* Adjust the Rnode buffer size, so correct number of bytes are emitted */
1177 Rnode->BufferLength -= (7 - i);
1179 /* Set the length in the Type Tag */
1181 Descriptor->VendorSmall.DescriptorType |= (UINT8) i;