1 /******************************************************************************
3 * Module Name: aslrestype2w - Large Word 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 "aslcompiler.h"
153 #include "aslcompiler.y.h"
155 #define _COMPONENT ACPI_COMPILER
156 ACPI_MODULE_NAME ("aslrestype2w")
159 * This module contains the Word (16-bit) address space descriptors:
166 /*******************************************************************************
168 * FUNCTION: RsDoWordIoDescriptor
170 * PARAMETERS: Info - Parse Op and resource template offset
172 * RETURN: Completed resource node
174 * DESCRIPTION: Construct a long "WordIO" descriptor
176 ******************************************************************************/
179 RsDoWordIoDescriptor (
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 UINT8
*OptionalFields
;
190 UINT16 StringLength
= 0;
191 UINT32 OptionIndex
= 0;
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_ADDRESS16
) + 1 + StringLength
);
204 Descriptor
= Rnode
->Buffer
;
205 Descriptor
->Address16
.DescriptorType
= ACPI_RESOURCE_NAME_ADDRESS16
;
206 Descriptor
->Address16
.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_ADDRESS16
);
213 Descriptor
->Address16
.ResourceLength
= (UINT16
)
214 (sizeof (AML_RESOURCE_ADDRESS16
) -
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
->Address16
.Flags
, InitializerOp
, 0, 1);
228 case 1: /* MinType */
230 RsSetFlagBits (&Descriptor
->Address16
.Flags
, InitializerOp
, 2, 0);
231 RsCreateBitField (InitializerOp
, ACPI_RESTAG_MINTYPE
,
232 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Flags
), 2);
235 case 2: /* MaxType */
237 RsSetFlagBits (&Descriptor
->Address16
.Flags
, InitializerOp
, 3, 0);
238 RsCreateBitField (InitializerOp
, ACPI_RESTAG_MAXTYPE
,
239 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Flags
), 3);
242 case 3: /* DecodeType */
244 RsSetFlagBits (&Descriptor
->Address16
.Flags
, InitializerOp
, 1, 0);
245 RsCreateBitField (InitializerOp
, ACPI_RESTAG_DECODE
,
246 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Flags
), 1);
249 case 4: /* Range Type */
251 RsSetFlagBits (&Descriptor
->Address16
.SpecificFlags
, InitializerOp
, 0, 3);
252 RsCreateMultiBitField (InitializerOp
, ACPI_RESTAG_RANGETYPE
,
253 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.SpecificFlags
), 0, 2);
256 case 5: /* Address Granularity */
258 Descriptor
->Address16
.Granularity
= (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
259 RsCreateWordField (InitializerOp
, ACPI_RESTAG_GRANULARITY
,
260 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Granularity
));
261 GranOp
= InitializerOp
;
264 case 6: /* Address Min */
266 Descriptor
->Address16
.Minimum
= (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
267 RsCreateWordField (InitializerOp
, ACPI_RESTAG_MINADDR
,
268 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Minimum
));
269 MinOp
= InitializerOp
;
272 case 7: /* Address Max */
274 Descriptor
->Address16
.Maximum
= (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
275 RsCreateWordField (InitializerOp
, ACPI_RESTAG_MAXADDR
,
276 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Maximum
));
277 MaxOp
= InitializerOp
;
280 case 8: /* Translation Offset */
282 Descriptor
->Address16
.TranslationOffset
= (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
283 RsCreateWordField (InitializerOp
, ACPI_RESTAG_TRANSLATION
,
284 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.TranslationOffset
));
287 case 9: /* Address Length */
289 Descriptor
->Address16
.AddressLength
= (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
290 RsCreateWordField (InitializerOp
, ACPI_RESTAG_LENGTH
,
291 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.AddressLength
));
292 LengthOp
= InitializerOp
;
295 case 10: /* ResSourceIndex [Optional Field - BYTE] */
297 if (InitializerOp
->Asl
.ParseOpcode
!= PARSEOP_DEFAULT_ARG
)
299 OptionalFields
[0] = (UINT8
) InitializerOp
->Asl
.Value
.Integer
;
301 Descriptor
->Address16
.ResourceLength
++;
302 ResSourceIndex
= TRUE
;
306 case 11: /* ResSource [Optional Field - STRING] */
308 if ((InitializerOp
->Asl
.ParseOpcode
!= PARSEOP_DEFAULT_ARG
) &&
309 (InitializerOp
->Asl
.Value
.String
))
313 Descriptor
->Address16
.ResourceLength
= (UINT16
)
314 (Descriptor
->Address16
.ResourceLength
+ StringLength
);
317 &OptionalFields
[OptionIndex
],
318 InitializerOp
->Asl
.Value
.String
);
320 /* ResourceSourceIndex must also be valid */
324 AslError (ASL_ERROR
, ASL_MSG_RESOURCE_INDEX
,
325 InitializerOp
, NULL
);
332 * Not a valid ResourceSource, ResourceSourceIndex must also
335 else if (ResSourceIndex
)
337 AslError (ASL_ERROR
, ASL_MSG_RESOURCE_SOURCE
,
338 InitializerOp
, NULL
);
343 case 12: /* ResourceTag */
345 UtAttachNamepathToOwner (Info
->DescriptorTypeOp
, InitializerOp
);
350 RsSetFlagBits (&Descriptor
->Address16
.SpecificFlags
, InitializerOp
, 4, 0);
351 RsCreateBitField (InitializerOp
, ACPI_RESTAG_TYPE
,
352 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.SpecificFlags
), 4);
355 case 14: /* Translation Type */
357 RsSetFlagBits (&Descriptor
->Address16
.SpecificFlags
, InitializerOp
, 5, 0);
358 RsCreateBitField (InitializerOp
, ACPI_RESTAG_TRANSTYPE
,
359 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.SpecificFlags
), 5);
364 AslError (ASL_ERROR
, ASL_MSG_RESOURCE_LIST
, InitializerOp
, NULL
);
368 InitializerOp
= RsCompleteNodeAndGetNext (InitializerOp
);
371 /* Validate the Min/Max/Len/Gran values */
373 RsLargeAddressCheck (
374 (UINT64
) Descriptor
->Address16
.Minimum
,
375 (UINT64
) Descriptor
->Address16
.Maximum
,
376 (UINT64
) Descriptor
->Address16
.AddressLength
,
377 (UINT64
) Descriptor
->Address16
.Granularity
,
378 Descriptor
->Address16
.Flags
,
379 MinOp
, MaxOp
, LengthOp
, GranOp
, Info
->DescriptorTypeOp
);
381 Rnode
->BufferLength
= sizeof (AML_RESOURCE_ADDRESS16
) +
382 OptionIndex
+ StringLength
;
387 /*******************************************************************************
389 * FUNCTION: RsDoWordBusNumberDescriptor
391 * PARAMETERS: Info - Parse Op and resource template offset
393 * RETURN: Completed resource node
395 * DESCRIPTION: Construct a long "WordBusNumber" descriptor
397 ******************************************************************************/
400 RsDoWordBusNumberDescriptor (
401 ASL_RESOURCE_INFO
*Info
)
403 AML_RESOURCE
*Descriptor
;
404 ACPI_PARSE_OBJECT
*InitializerOp
;
405 ACPI_PARSE_OBJECT
*MinOp
= NULL
;
406 ACPI_PARSE_OBJECT
*MaxOp
= NULL
;
407 ACPI_PARSE_OBJECT
*LengthOp
= NULL
;
408 ACPI_PARSE_OBJECT
*GranOp
= NULL
;
409 ASL_RESOURCE_NODE
*Rnode
;
410 UINT8
*OptionalFields
;
411 UINT16 StringLength
= 0;
412 UINT32 OptionIndex
= 0;
413 UINT32 CurrentByteOffset
;
415 BOOLEAN ResSourceIndex
= FALSE
;
418 InitializerOp
= Info
->DescriptorTypeOp
->Asl
.Child
;
419 StringLength
= RsGetStringDataLength (InitializerOp
);
420 CurrentByteOffset
= Info
->CurrentByteOffset
;
422 Rnode
= RsAllocateResourceNode (
423 sizeof (AML_RESOURCE_ADDRESS16
) + 1 + StringLength
);
425 Descriptor
= Rnode
->Buffer
;
426 Descriptor
->Address16
.DescriptorType
= ACPI_RESOURCE_NAME_ADDRESS16
;
427 Descriptor
->Address16
.ResourceType
= ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE
;
430 * Initial descriptor length -- may be enlarged if there are
431 * optional fields present
433 OptionalFields
= ((UINT8
*) Descriptor
) + sizeof (AML_RESOURCE_ADDRESS16
);
434 Descriptor
->Address16
.ResourceLength
= (UINT16
)
435 (sizeof (AML_RESOURCE_ADDRESS16
) -
436 sizeof (AML_RESOURCE_LARGE_HEADER
));
438 /* Process all child initialization nodes */
440 for (i
= 0; InitializerOp
; i
++)
444 case 0: /* Resource Usage */
446 RsSetFlagBits (&Descriptor
->Address16
.Flags
, InitializerOp
, 0, 1);
449 case 1: /* MinType */
451 RsSetFlagBits (&Descriptor
->Address16
.Flags
, InitializerOp
, 2, 0);
452 RsCreateBitField (InitializerOp
, ACPI_RESTAG_MINTYPE
,
453 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Flags
), 2);
456 case 2: /* MaxType */
458 RsSetFlagBits (&Descriptor
->Address16
.Flags
, InitializerOp
, 3, 0);
459 RsCreateBitField (InitializerOp
, ACPI_RESTAG_MAXTYPE
,
460 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Flags
), 3);
463 case 3: /* DecodeType */
465 RsSetFlagBits (&Descriptor
->Address16
.Flags
, InitializerOp
, 1, 0);
466 RsCreateBitField (InitializerOp
, ACPI_RESTAG_DECODE
,
467 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Flags
), 1);
470 case 4: /* Address Granularity */
472 Descriptor
->Address16
.Granularity
=
473 (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
474 RsCreateWordField (InitializerOp
, ACPI_RESTAG_GRANULARITY
,
475 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Granularity
));
476 GranOp
= InitializerOp
;
479 case 5: /* Min Address */
481 Descriptor
->Address16
.Minimum
=
482 (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
483 RsCreateWordField (InitializerOp
, ACPI_RESTAG_MINADDR
,
484 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Minimum
));
485 MinOp
= InitializerOp
;
488 case 6: /* Max Address */
490 Descriptor
->Address16
.Maximum
=
491 (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
492 RsCreateWordField (InitializerOp
, ACPI_RESTAG_MAXADDR
,
493 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Maximum
));
494 MaxOp
= InitializerOp
;
497 case 7: /* Translation Offset */
499 Descriptor
->Address16
.TranslationOffset
=
500 (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
501 RsCreateWordField (InitializerOp
, ACPI_RESTAG_TRANSLATION
,
502 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.TranslationOffset
));
505 case 8: /* Address Length */
507 Descriptor
->Address16
.AddressLength
=
508 (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
509 RsCreateWordField (InitializerOp
, ACPI_RESTAG_LENGTH
,
510 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.AddressLength
));
511 LengthOp
= InitializerOp
;
514 case 9: /* ResSourceIndex [Optional Field - BYTE] */
516 if (InitializerOp
->Asl
.ParseOpcode
!= PARSEOP_DEFAULT_ARG
)
518 OptionalFields
[0] = (UINT8
) InitializerOp
->Asl
.Value
.Integer
;
520 Descriptor
->Address16
.ResourceLength
++;
521 ResSourceIndex
= TRUE
;
525 case 10: /* ResSource [Optional Field - STRING] */
527 if ((InitializerOp
->Asl
.ParseOpcode
!= PARSEOP_DEFAULT_ARG
) &&
528 (InitializerOp
->Asl
.Value
.String
))
532 Descriptor
->Address16
.ResourceLength
= (UINT16
)
533 (Descriptor
->Address16
.ResourceLength
+ StringLength
);
536 &OptionalFields
[OptionIndex
],
537 InitializerOp
->Asl
.Value
.String
);
539 /* ResourceSourceIndex must also be valid */
543 AslError (ASL_ERROR
, ASL_MSG_RESOURCE_INDEX
,
544 InitializerOp
, NULL
);
551 * Not a valid ResourceSource, ResourceSourceIndex must also
554 else if (ResSourceIndex
)
556 AslError (ASL_ERROR
, ASL_MSG_RESOURCE_SOURCE
,
557 InitializerOp
, NULL
);
562 case 11: /* ResourceTag */
564 UtAttachNamepathToOwner (Info
->DescriptorTypeOp
, InitializerOp
);
569 AslError (ASL_ERROR
, ASL_MSG_RESOURCE_LIST
, InitializerOp
, NULL
);
573 InitializerOp
= RsCompleteNodeAndGetNext (InitializerOp
);
576 /* Validate the Min/Max/Len/Gran values */
578 RsLargeAddressCheck (
579 (UINT64
) Descriptor
->Address16
.Minimum
,
580 (UINT64
) Descriptor
->Address16
.Maximum
,
581 (UINT64
) Descriptor
->Address16
.AddressLength
,
582 (UINT64
) Descriptor
->Address16
.Granularity
,
583 Descriptor
->Address16
.Flags
,
584 MinOp
, MaxOp
, LengthOp
, GranOp
, Info
->DescriptorTypeOp
);
586 Rnode
->BufferLength
= sizeof (AML_RESOURCE_ADDRESS16
) +
587 OptionIndex
+ StringLength
;
592 /*******************************************************************************
594 * FUNCTION: RsDoWordSpaceDescriptor
596 * PARAMETERS: Info - Parse Op and resource template offset
598 * RETURN: Completed resource node
600 * DESCRIPTION: Construct a long "WordSpace" descriptor
602 ******************************************************************************/
605 RsDoWordSpaceDescriptor (
606 ASL_RESOURCE_INFO
*Info
)
608 AML_RESOURCE
*Descriptor
;
609 ACPI_PARSE_OBJECT
*InitializerOp
;
610 ACPI_PARSE_OBJECT
*MinOp
= NULL
;
611 ACPI_PARSE_OBJECT
*MaxOp
= NULL
;
612 ACPI_PARSE_OBJECT
*LengthOp
= NULL
;
613 ACPI_PARSE_OBJECT
*GranOp
= NULL
;
614 ASL_RESOURCE_NODE
*Rnode
;
615 UINT8
*OptionalFields
;
616 UINT16 StringLength
= 0;
617 UINT32 OptionIndex
= 0;
618 UINT32 CurrentByteOffset
;
620 BOOLEAN ResSourceIndex
= FALSE
;
623 InitializerOp
= Info
->DescriptorTypeOp
->Asl
.Child
;
624 StringLength
= RsGetStringDataLength (InitializerOp
);
625 CurrentByteOffset
= Info
->CurrentByteOffset
;
627 Rnode
= RsAllocateResourceNode (
628 sizeof (AML_RESOURCE_ADDRESS16
) + 1 + StringLength
);
630 Descriptor
= Rnode
->Buffer
;
631 Descriptor
->Address16
.DescriptorType
= ACPI_RESOURCE_NAME_ADDRESS16
;
634 * Initial descriptor length -- may be enlarged if there are
635 * optional fields present
637 OptionalFields
= ((UINT8
*) Descriptor
) + sizeof (AML_RESOURCE_ADDRESS16
);
638 Descriptor
->Address16
.ResourceLength
= (UINT16
)
639 (sizeof (AML_RESOURCE_ADDRESS16
) -
640 sizeof (AML_RESOURCE_LARGE_HEADER
));
642 /* Process all child initialization nodes */
644 for (i
= 0; InitializerOp
; i
++)
648 case 0: /* Resource Type */
650 Descriptor
->Address16
.ResourceType
=
651 (UINT8
) InitializerOp
->Asl
.Value
.Integer
;
654 case 1: /* Resource Usage */
656 RsSetFlagBits (&Descriptor
->Address16
.Flags
, InitializerOp
, 0, 1);
659 case 2: /* DecodeType */
661 RsSetFlagBits (&Descriptor
->Address16
.Flags
, InitializerOp
, 1, 0);
662 RsCreateBitField (InitializerOp
, ACPI_RESTAG_DECODE
,
663 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Flags
), 1);
666 case 3: /* MinType */
668 RsSetFlagBits (&Descriptor
->Address16
.Flags
, InitializerOp
, 2, 0);
669 RsCreateBitField (InitializerOp
, ACPI_RESTAG_MINTYPE
,
670 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Flags
), 2);
673 case 4: /* MaxType */
675 RsSetFlagBits (&Descriptor
->Address16
.Flags
, InitializerOp
, 3, 0);
676 RsCreateBitField (InitializerOp
, ACPI_RESTAG_MAXTYPE
,
677 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Flags
), 3);
680 case 5: /* Type-Specific flags */
682 Descriptor
->Address16
.SpecificFlags
=
683 (UINT8
) InitializerOp
->Asl
.Value
.Integer
;
686 case 6: /* Address Granularity */
688 Descriptor
->Address16
.Granularity
=
689 (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
690 RsCreateWordField (InitializerOp
, ACPI_RESTAG_GRANULARITY
,
691 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Granularity
));
692 GranOp
= InitializerOp
;
695 case 7: /* Min Address */
697 Descriptor
->Address16
.Minimum
=
698 (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
699 RsCreateWordField (InitializerOp
, ACPI_RESTAG_MINADDR
,
700 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Minimum
));
701 MinOp
= InitializerOp
;
704 case 8: /* Max Address */
706 Descriptor
->Address16
.Maximum
=
707 (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
708 RsCreateWordField (InitializerOp
, ACPI_RESTAG_MAXADDR
,
709 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.Maximum
));
710 MaxOp
= InitializerOp
;
713 case 9: /* Translation Offset */
715 Descriptor
->Address16
.TranslationOffset
=
716 (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
717 RsCreateWordField (InitializerOp
, ACPI_RESTAG_TRANSLATION
,
718 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.TranslationOffset
));
721 case 10: /* Address Length */
723 Descriptor
->Address16
.AddressLength
=
724 (UINT16
) InitializerOp
->Asl
.Value
.Integer
;
725 RsCreateWordField (InitializerOp
, ACPI_RESTAG_LENGTH
,
726 CurrentByteOffset
+ ASL_RESDESC_OFFSET (Address16
.AddressLength
));
727 LengthOp
= InitializerOp
;
730 case 11: /* ResSourceIndex [Optional Field - BYTE] */
732 if (InitializerOp
->Asl
.ParseOpcode
!= PARSEOP_DEFAULT_ARG
)
734 OptionalFields
[0] = (UINT8
) InitializerOp
->Asl
.Value
.Integer
;
736 Descriptor
->Address16
.ResourceLength
++;
737 ResSourceIndex
= TRUE
;
741 case 12: /* ResSource [Optional Field - STRING] */
743 if ((InitializerOp
->Asl
.ParseOpcode
!= PARSEOP_DEFAULT_ARG
) &&
744 (InitializerOp
->Asl
.Value
.String
))
748 Descriptor
->Address16
.ResourceLength
= (UINT16
)
749 (Descriptor
->Address16
.ResourceLength
+ StringLength
);
752 &OptionalFields
[OptionIndex
],
753 InitializerOp
->Asl
.Value
.String
);
755 /* ResourceSourceIndex must also be valid */
759 AslError (ASL_ERROR
, ASL_MSG_RESOURCE_INDEX
,
760 InitializerOp
, NULL
);
767 * Not a valid ResourceSource, ResourceSourceIndex must also
770 else if (ResSourceIndex
)
772 AslError (ASL_ERROR
, ASL_MSG_RESOURCE_SOURCE
,
773 InitializerOp
, NULL
);
778 case 13: /* ResourceTag */
780 UtAttachNamepathToOwner (Info
->DescriptorTypeOp
, InitializerOp
);
785 AslError (ASL_ERROR
, ASL_MSG_RESOURCE_LIST
, InitializerOp
, NULL
);
789 InitializerOp
= RsCompleteNodeAndGetNext (InitializerOp
);
792 /* Validate the Min/Max/Len/Gran values */
794 RsLargeAddressCheck (
795 (UINT64
) Descriptor
->Address16
.Minimum
,
796 (UINT64
) Descriptor
->Address16
.Maximum
,
797 (UINT64
) Descriptor
->Address16
.AddressLength
,
798 (UINT64
) Descriptor
->Address16
.Granularity
,
799 Descriptor
->Address16
.Flags
,
800 MinOp
, MaxOp
, LengthOp
, GranOp
, Info
->DescriptorTypeOp
);
802 Rnode
->BufferLength
= sizeof (AML_RESOURCE_ADDRESS16
) +
803 OptionIndex
+ StringLength
;