1 /******************************************************************************
3 * Module Name: aslrestype2d - Large DWord address resource descriptors
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
152 #include <contrib/dev/acpica/compiler/aslcompiler.h>
153 #include "aslcompiler.y.h"
155 #define _COMPONENT ACPI_COMPILER
156 ACPI_MODULE_NAME ("aslrestype2d")
159 * This module contains the Dword (32-bit) address space descriptors:
166 /*******************************************************************************
168 * FUNCTION: RsDoDwordIoDescriptor
170 * PARAMETERS: Info - Parse Op and resource template offset
172 * RETURN: Completed resource node
174 * DESCRIPTION: Construct a long "DwordIO" descriptor
176 ******************************************************************************/
179 RsDoDwordIoDescriptor (
180 ASL_RESOURCE_INFO *Info)
182 AML_RESOURCE *Descriptor;
183 ACPI_PARSE_OBJECT *InitializerOp;
184 ACPI_PARSE_OBJECT *MinOp = NULL;
185 ACPI_PARSE_OBJECT *MaxOp = NULL;
186 ACPI_PARSE_OBJECT *LengthOp = NULL;
187 ACPI_PARSE_OBJECT *GranOp = NULL;
188 ASL_RESOURCE_NODE *Rnode;
189 UINT16 StringLength = 0;
190 UINT32 OptionIndex = 0;
191 UINT8 *OptionalFields;
192 UINT32 CurrentByteOffset;
194 BOOLEAN ResSourceIndex = FALSE;
197 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
198 StringLength = RsGetStringDataLength (InitializerOp);
199 CurrentByteOffset = Info->CurrentByteOffset;
201 Rnode = RsAllocateResourceNode (
202 sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
204 Descriptor = Rnode->Buffer;
205 Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
206 Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
209 * Initial descriptor length -- may be enlarged if there are
210 * optional fields present
212 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
213 Descriptor->Address32.ResourceLength = (UINT16)
214 (sizeof (AML_RESOURCE_ADDRESS32) -
215 sizeof (AML_RESOURCE_LARGE_HEADER));
217 /* Process all child initialization nodes */
219 for (i = 0; InitializerOp; i++)
223 case 0: /* Resource Usage */
225 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
228 case 1: /* MinType */
230 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
231 RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
232 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
235 case 2: /* MaxType */
237 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
238 RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
239 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
242 case 3: /* DecodeType */
244 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
245 RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
246 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
249 case 4: /* Range Type */
251 RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 3);
252 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
253 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0, 2);
256 case 5: /* Address Granularity */
258 Descriptor->Address32.Granularity =
259 (UINT32) InitializerOp->Asl.Value.Integer;
260 RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
261 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
262 GranOp = InitializerOp;
265 case 6: /* Address Min */
267 Descriptor->Address32.Minimum =
268 (UINT32) InitializerOp->Asl.Value.Integer;
269 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
270 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
271 MinOp = InitializerOp;
274 case 7: /* Address Max */
276 Descriptor->Address32.Maximum =
277 (UINT32) InitializerOp->Asl.Value.Integer;
278 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
279 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
280 MaxOp = InitializerOp;
283 case 8: /* Translation Offset */
285 Descriptor->Address32.TranslationOffset =
286 (UINT32) InitializerOp->Asl.Value.Integer;
287 RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
288 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
291 case 9: /* Address Length */
293 Descriptor->Address32.AddressLength =
294 (UINT32) InitializerOp->Asl.Value.Integer;
295 RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
296 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
297 LengthOp = InitializerOp;
300 case 10: /* ResSourceIndex [Optional Field - BYTE] */
302 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
304 /* Found a valid ResourceSourceIndex */
306 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
308 Descriptor->Address32.ResourceLength++;
309 ResSourceIndex = TRUE;
313 case 11: /* ResSource [Optional Field - STRING] */
315 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
316 (InitializerOp->Asl.Value.String))
320 /* Found a valid ResourceSource */
322 Descriptor->Address32.ResourceLength = (UINT16)
323 (Descriptor->Address32.ResourceLength + StringLength);
326 &OptionalFields[OptionIndex],
327 InitializerOp->Asl.Value.String);
329 /* ResourceSourceIndex must also be valid */
333 AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
334 InitializerOp, NULL);
341 * Not a valid ResourceSource, ResourceSourceIndex must also
344 else if (ResSourceIndex)
346 AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
347 InitializerOp, NULL);
352 case 12: /* ResourceTag */
354 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
359 RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 4, 0);
360 RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
361 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 4);
364 case 14: /* Translation Type */
366 RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
367 RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
368 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
373 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
377 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
380 /* Validate the Min/Max/Len/Gran values */
382 RsLargeAddressCheck (
383 (UINT64) Descriptor->Address32.Minimum,
384 (UINT64) Descriptor->Address32.Maximum,
385 (UINT64) Descriptor->Address32.AddressLength,
386 (UINT64) Descriptor->Address32.Granularity,
387 Descriptor->Address32.Flags,
388 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
390 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
391 OptionIndex + StringLength;
396 /*******************************************************************************
398 * FUNCTION: RsDoDwordMemoryDescriptor
400 * PARAMETERS: Info - Parse Op and resource template offset
402 * RETURN: Completed resource node
404 * DESCRIPTION: Construct a long "DwordMemory" descriptor
406 ******************************************************************************/
409 RsDoDwordMemoryDescriptor (
410 ASL_RESOURCE_INFO *Info)
412 AML_RESOURCE *Descriptor;
413 ACPI_PARSE_OBJECT *InitializerOp;
414 ACPI_PARSE_OBJECT *MinOp = NULL;
415 ACPI_PARSE_OBJECT *MaxOp = NULL;
416 ACPI_PARSE_OBJECT *LengthOp = NULL;
417 ACPI_PARSE_OBJECT *GranOp = NULL;
418 ASL_RESOURCE_NODE *Rnode;
419 UINT8 *OptionalFields;
420 UINT16 StringLength = 0;
421 UINT32 OptionIndex = 0;
422 UINT32 CurrentByteOffset;
424 BOOLEAN ResSourceIndex = FALSE;
427 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
428 StringLength = RsGetStringDataLength (InitializerOp);
429 CurrentByteOffset = Info->CurrentByteOffset;
431 Rnode = RsAllocateResourceNode (
432 sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
434 Descriptor = Rnode->Buffer;
435 Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
436 Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
439 * Initial descriptor length -- may be enlarged if there are
440 * optional fields present
442 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
443 Descriptor->Address32.ResourceLength = (UINT16)
444 (sizeof (AML_RESOURCE_ADDRESS32) -
445 sizeof (AML_RESOURCE_LARGE_HEADER));
448 /* Process all child initialization nodes */
450 for (i = 0; InitializerOp; i++)
454 case 0: /* Resource Usage */
456 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
459 case 1: /* DecodeType */
461 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
462 RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
463 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
466 case 2: /* MinType */
468 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
469 RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
470 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
473 case 3: /* MaxType */
475 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
476 RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
477 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
480 case 4: /* Memory Type */
482 RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 1, 0);
483 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
484 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 1, 2);
487 case 5: /* Read/Write Type */
489 RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 1);
490 RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
491 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
494 case 6: /* Address Granularity */
496 Descriptor->Address32.Granularity =
497 (UINT32) InitializerOp->Asl.Value.Integer;
498 RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
499 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
500 GranOp = InitializerOp;
503 case 7: /* Min Address */
505 Descriptor->Address32.Minimum =
506 (UINT32) InitializerOp->Asl.Value.Integer;
507 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
508 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
509 MinOp = InitializerOp;
512 case 8: /* Max Address */
514 Descriptor->Address32.Maximum =
515 (UINT32) InitializerOp->Asl.Value.Integer;
516 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
517 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
518 MaxOp = InitializerOp;
521 case 9: /* Translation Offset */
523 Descriptor->Address32.TranslationOffset =
524 (UINT32) InitializerOp->Asl.Value.Integer;
525 RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
526 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
529 case 10: /* Address Length */
531 Descriptor->Address32.AddressLength =
532 (UINT32) InitializerOp->Asl.Value.Integer;
533 RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
534 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
535 LengthOp = InitializerOp;
538 case 11: /* ResSourceIndex [Optional Field - BYTE] */
540 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
542 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
544 Descriptor->Address32.ResourceLength++;
545 ResSourceIndex = TRUE;
549 case 12: /* ResSource [Optional Field - STRING] */
551 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
552 (InitializerOp->Asl.Value.String))
556 Descriptor->Address32.ResourceLength = (UINT16)
557 (Descriptor->Address32.ResourceLength + StringLength);
560 &OptionalFields[OptionIndex],
561 InitializerOp->Asl.Value.String);
563 /* ResourceSourceIndex must also be valid */
567 AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
568 InitializerOp, NULL);
575 * Not a valid ResourceSource, ResourceSourceIndex must also
578 else if (ResSourceIndex)
580 AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
581 InitializerOp, NULL);
586 case 13: /* ResourceTag */
588 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
592 case 14: /* Address Range */
594 RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 3, 0);
595 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
596 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 3, 2);
601 RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
602 RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
603 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
608 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
612 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
615 /* Validate the Min/Max/Len/Gran values */
617 RsLargeAddressCheck (
618 (UINT64) Descriptor->Address32.Minimum,
619 (UINT64) Descriptor->Address32.Maximum,
620 (UINT64) Descriptor->Address32.AddressLength,
621 (UINT64) Descriptor->Address32.Granularity,
622 Descriptor->Address32.Flags,
623 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
625 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
626 OptionIndex + StringLength;
631 /*******************************************************************************
633 * FUNCTION: RsDoDwordSpaceDescriptor
635 * PARAMETERS: Info - Parse Op and resource template offset
637 * RETURN: Completed resource node
639 * DESCRIPTION: Construct a long "DwordSpace" descriptor
641 ******************************************************************************/
644 RsDoDwordSpaceDescriptor (
645 ASL_RESOURCE_INFO *Info)
647 AML_RESOURCE *Descriptor;
648 ACPI_PARSE_OBJECT *InitializerOp;
649 ACPI_PARSE_OBJECT *MinOp = NULL;
650 ACPI_PARSE_OBJECT *MaxOp = NULL;
651 ACPI_PARSE_OBJECT *LengthOp = NULL;
652 ACPI_PARSE_OBJECT *GranOp = NULL;
653 ASL_RESOURCE_NODE *Rnode;
654 UINT8 *OptionalFields;
655 UINT16 StringLength = 0;
656 UINT32 OptionIndex = 0;
657 UINT32 CurrentByteOffset;
659 BOOLEAN ResSourceIndex = FALSE;
662 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
663 StringLength = RsGetStringDataLength (InitializerOp);
664 CurrentByteOffset = Info->CurrentByteOffset;
666 Rnode = RsAllocateResourceNode (
667 sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
669 Descriptor = Rnode->Buffer;
670 Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
673 * Initial descriptor length -- may be enlarged if there are
674 * optional fields present
676 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
677 Descriptor->Address32.ResourceLength = (UINT16)
678 (sizeof (AML_RESOURCE_ADDRESS32) -
679 sizeof (AML_RESOURCE_LARGE_HEADER));
681 /* Process all child initialization nodes */
683 for (i = 0; InitializerOp; i++)
687 case 0: /* Resource Type */
689 Descriptor->Address32.ResourceType =
690 (UINT8) InitializerOp->Asl.Value.Integer;
693 case 1: /* Resource Usage */
695 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
698 case 2: /* DecodeType */
700 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
701 RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
702 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
705 case 3: /* MinType */
707 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
708 RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
709 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
712 case 4: /* MaxType */
714 RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
715 RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
716 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
719 case 5: /* Type-Specific flags */
721 Descriptor->Address32.SpecificFlags =
722 (UINT8) InitializerOp->Asl.Value.Integer;
725 case 6: /* Address Granularity */
727 Descriptor->Address32.Granularity =
728 (UINT32) InitializerOp->Asl.Value.Integer;
729 RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
730 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
731 GranOp = InitializerOp;
734 case 7: /* Min Address */
736 Descriptor->Address32.Minimum =
737 (UINT32) InitializerOp->Asl.Value.Integer;
738 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
739 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
740 MinOp = InitializerOp;
743 case 8: /* Max Address */
745 Descriptor->Address32.Maximum =
746 (UINT32) InitializerOp->Asl.Value.Integer;
747 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
748 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
749 MaxOp = InitializerOp;
752 case 9: /* Translation Offset */
754 Descriptor->Address32.TranslationOffset =
755 (UINT32) InitializerOp->Asl.Value.Integer;
756 RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
757 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
760 case 10: /* Address Length */
762 Descriptor->Address32.AddressLength =
763 (UINT32) InitializerOp->Asl.Value.Integer;
764 RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
765 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
766 LengthOp = InitializerOp;
769 case 11: /* ResSourceIndex [Optional Field - BYTE] */
771 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
773 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
775 Descriptor->Address32.ResourceLength++;
776 ResSourceIndex = TRUE;
780 case 12: /* ResSource [Optional Field - STRING] */
782 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
783 (InitializerOp->Asl.Value.String))
787 Descriptor->Address32.ResourceLength = (UINT16)
788 (Descriptor->Address32.ResourceLength + StringLength);
791 &OptionalFields[OptionIndex],
792 InitializerOp->Asl.Value.String);
794 /* ResourceSourceIndex must also be valid */
798 AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
799 InitializerOp, NULL);
806 * Not a valid ResourceSource, ResourceSourceIndex must also
809 else if (ResSourceIndex)
811 AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
812 InitializerOp, NULL);
817 case 13: /* ResourceTag */
819 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
824 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST,
825 InitializerOp, NULL);
829 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
832 /* Validate the Min/Max/Len/Gran values */
834 RsLargeAddressCheck (
835 (UINT64) Descriptor->Address32.Minimum,
836 (UINT64) Descriptor->Address32.Maximum,
837 (UINT64) Descriptor->Address32.AddressLength,
838 (UINT64) Descriptor->Address32.Granularity,
839 Descriptor->Address32.Flags,
840 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
842 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
843 OptionIndex + StringLength;