Subversion Repositories Kolibri OS

Rev

Rev 1498 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1498 Rev 2216
1
/******************************************************************************
1
/******************************************************************************
2
 *
2
 *
3
 * Module Name: aslrestype2d - Large DWord address resource descriptors
3
 * Module Name: aslrestype2d - Large DWord address resource descriptors
4
 *
4
 *
5
 *****************************************************************************/
5
 *****************************************************************************/
6
 
6
 
7
/******************************************************************************
7
/******************************************************************************
8
 *
8
 *
9
 * 1. Copyright Notice
9
 * 1. Copyright Notice
10
 *
10
 *
11
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
11
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12
 * All rights reserved.
12
 * All rights reserved.
13
 *
13
 *
14
 * 2. License
14
 * 2. License
15
 *
15
 *
16
 * 2.1. This is your license from Intel Corp. under its intellectual property
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
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
18
 * you this software, covering your right to use that party's intellectual
19
 * property rights.
19
 * property rights.
20
 *
20
 *
21
 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
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
22
 * copy of the source code appearing in this file ("Covered Code") an
23
 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
23
 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24
 * base code distributed originally by Intel ("Original Intel Code") to copy,
24
 * base code distributed originally by Intel ("Original Intel Code") to copy,
25
 * make derivatives, distribute, use and display any portion of the Covered
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
26
 * Code in any form, with the right to sublicense such rights; and
27
 *
27
 *
28
 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
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
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,
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
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
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
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
34
 * to or modifications of the Original Intel Code.  No other license or right
35
 * is granted directly or by implication, estoppel or otherwise;
35
 * is granted directly or by implication, estoppel or otherwise;
36
 *
36
 *
37
 * The above copyright and patent license is granted only if the following
37
 * The above copyright and patent license is granted only if the following
38
 * conditions are met:
38
 * conditions are met:
39
 *
39
 *
40
 * 3. Conditions
40
 * 3. Conditions
41
 *
41
 *
42
 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
42
 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43
 * Redistribution of source code of any substantial portion of the Covered
43
 * Redistribution of source code of any substantial portion of the Covered
44
 * Code or modification with rights to further distribute source must include
44
 * Code or modification with rights to further distribute source must include
45
 * the above Copyright Notice, the above License, this list of Conditions,
45
 * the above Copyright Notice, the above License, this list of Conditions,
46
 * and the following Disclaimer and Export Compliance provision.  In addition,
46
 * and the following Disclaimer and Export Compliance provision.  In addition,
47
 * Licensee must cause all Covered Code to which Licensee contributes to
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
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
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
50
 * documentation of any changes made by any predecessor Licensee.  Licensee
51
 * must include a prominent statement that the modification is derived,
51
 * must include a prominent statement that the modification is derived,
52
 * directly or indirectly, from Original Intel Code.
52
 * directly or indirectly, from Original Intel Code.
53
 *
53
 *
54
 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
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
55
 * Redistribution of source code of any substantial portion of the Covered
56
 * Code or modification without rights to further distribute source must
56
 * Code or modification without rights to further distribute source must
57
 * include the following Disclaimer and Export Compliance provision in the
57
 * include the following Disclaimer and Export Compliance provision in the
58
 * documentation and/or other materials provided with distribution.  In
58
 * documentation and/or other materials provided with distribution.  In
59
 * addition, Licensee may not authorize further sublicense of source of any
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
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
61
 * license from Licensee to its licensee is limited to the intellectual
62
 * property embodied in the software Licensee provides to its licensee, and
62
 * property embodied in the software Licensee provides to its licensee, and
63
 * not to intellectual property embodied in modifications its licensee may
63
 * not to intellectual property embodied in modifications its licensee may
64
 * make.
64
 * make.
65
 *
65
 *
66
 * 3.3. Redistribution of Executable. Redistribution in executable form of any
66
 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67
 * substantial portion of the Covered Code or modification must reproduce the
67
 * substantial portion of the Covered Code or modification must reproduce the
68
 * above Copyright Notice, and the following Disclaimer and Export Compliance
68
 * above Copyright Notice, and the following Disclaimer and Export Compliance
69
 * provision in the documentation and/or other materials provided with the
69
 * provision in the documentation and/or other materials provided with the
70
 * distribution.
70
 * distribution.
71
 *
71
 *
72
 * 3.4. Intel retains all right, title, and interest in and to the Original
72
 * 3.4. Intel retains all right, title, and interest in and to the Original
73
 * Intel Code.
73
 * Intel Code.
74
 *
74
 *
75
 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
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
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
77
 * other dealings in products derived from or relating to the Covered Code
78
 * without prior written authorization from Intel.
78
 * without prior written authorization from Intel.
79
 *
79
 *
80
 * 4. Disclaimer and Export Compliance
80
 * 4. Disclaimer and Export Compliance
81
 *
81
 *
82
 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
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
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,
84
 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85
 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
85
 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86
 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
86
 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87
 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
87
 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88
 * PARTICULAR PURPOSE.
88
 * PARTICULAR PURPOSE.
89
 *
89
 *
90
 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
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
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,
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
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
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
95
 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96
 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
96
 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97
 * LIMITED REMEDY.
97
 * LIMITED REMEDY.
98
 *
98
 *
99
 * 4.3. Licensee shall not export, either directly or indirectly, any of this
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
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
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
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
103
 * event Licensee exports any such software from the United States or
104
 * re-exports any such software from a foreign destination, Licensee shall
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
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
106
 * compliance with all laws, regulations, orders, or other restrictions of the
107
 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
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,
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
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,
110
 * United States government or any agency thereof requires an export license,
111
 * other governmental approval, or letter of assurance, without first obtaining
111
 * other governmental approval, or letter of assurance, without first obtaining
112
 * such license, approval or letter.
112
 * such license, approval or letter.
113
 *
113
 *
114
 *****************************************************************************/
114
 *****************************************************************************/
115
 
115
 
116
 
116
 
117
#include "aslcompiler.h"
117
#include "aslcompiler.h"
118
#include "aslcompiler.y.h"
118
#include "aslcompiler.y.h"
119
 
119
 
120
#define _COMPONENT          ACPI_COMPILER
120
#define _COMPONENT          ACPI_COMPILER
121
        ACPI_MODULE_NAME    ("aslrestype2d")
121
        ACPI_MODULE_NAME    ("aslrestype2d")
122
 
122
 
123
/*
123
/*
124
 * This module contains the Dword (32-bit) address space descriptors:
124
 * This module contains the Dword (32-bit) address space descriptors:
125
 *
125
 *
126
 * DwordIO
126
 * DwordIO
127
 * DwordMemory
127
 * DwordMemory
128
 * DwordSpace
128
 * DwordSpace
129
 */
129
 */
130
 
130
 
131
/*******************************************************************************
131
/*******************************************************************************
132
 *
132
 *
133
 * FUNCTION:    RsDoDwordIoDescriptor
133
 * FUNCTION:    RsDoDwordIoDescriptor
134
 *
134
 *
135
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
135
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
136
 *              CurrentByteOffset   - Offset into the resource template AML
136
 *              CurrentByteOffset   - Offset into the resource template AML
137
 *                                    buffer (to track references to the desc)
137
 *                                    buffer (to track references to the desc)
138
 *
138
 *
139
 * RETURN:      Completed resource node
139
 * RETURN:      Completed resource node
140
 *
140
 *
141
 * DESCRIPTION: Construct a long "DwordIO" descriptor
141
 * DESCRIPTION: Construct a long "DwordIO" descriptor
142
 *
142
 *
143
 ******************************************************************************/
143
 ******************************************************************************/
144
 
144
 
145
ASL_RESOURCE_NODE *
145
ASL_RESOURCE_NODE *
146
RsDoDwordIoDescriptor (
146
RsDoDwordIoDescriptor (
147
    ACPI_PARSE_OBJECT       *Op,
147
    ACPI_PARSE_OBJECT       *Op,
148
    UINT32                  CurrentByteOffset)
148
    UINT32                  CurrentByteOffset)
149
{
149
{
150
    AML_RESOURCE            *Descriptor;
150
    AML_RESOURCE            *Descriptor;
151
    ACPI_PARSE_OBJECT       *InitializerOp;
151
    ACPI_PARSE_OBJECT       *InitializerOp;
152
    ACPI_PARSE_OBJECT       *MinOp = NULL;
152
    ACPI_PARSE_OBJECT       *MinOp = NULL;
153
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
153
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
154
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
154
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
155
    ACPI_PARSE_OBJECT       *GranOp = NULL;
155
    ACPI_PARSE_OBJECT       *GranOp = NULL;
156
    ASL_RESOURCE_NODE       *Rnode;
156
    ASL_RESOURCE_NODE       *Rnode;
157
    UINT16                  StringLength = 0;
157
    UINT16                  StringLength = 0;
158
    UINT32                  OptionIndex = 0;
158
    UINT32                  OptionIndex = 0;
159
    UINT8                   *OptionalFields;
159
    UINT8                   *OptionalFields;
160
    UINT32                  i;
160
    UINT32                  i;
161
    BOOLEAN                 ResSourceIndex = FALSE;
161
    BOOLEAN                 ResSourceIndex = FALSE;
162
 
162
 
163
 
163
 
164
    InitializerOp = Op->Asl.Child;
164
    InitializerOp = Op->Asl.Child;
165
    StringLength = RsGetStringDataLength (InitializerOp);
165
    StringLength = RsGetStringDataLength (InitializerOp);
166
 
166
 
167
    Rnode = RsAllocateResourceNode (
167
    Rnode = RsAllocateResourceNode (
168
                sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
168
                sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
169
 
169
 
170
    Descriptor = Rnode->Buffer;
170
    Descriptor = Rnode->Buffer;
171
    Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
171
    Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
172
    Descriptor->Address32.ResourceType   = ACPI_ADDRESS_TYPE_IO_RANGE;
172
    Descriptor->Address32.ResourceType   = ACPI_ADDRESS_TYPE_IO_RANGE;
173
 
173
 
174
    /*
174
    /*
175
     * Initial descriptor length -- may be enlarged if there are
175
     * Initial descriptor length -- may be enlarged if there are
176
     * optional fields present
176
     * optional fields present
177
     */
177
     */
178
    OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
178
    OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
179
    Descriptor->Address32.ResourceLength = (UINT16)
179
    Descriptor->Address32.ResourceLength = (UINT16)
180
        (sizeof (AML_RESOURCE_ADDRESS32) -
180
        (sizeof (AML_RESOURCE_ADDRESS32) -
181
         sizeof (AML_RESOURCE_LARGE_HEADER));
181
         sizeof (AML_RESOURCE_LARGE_HEADER));
182
 
182
 
183
    /* Process all child initialization nodes */
183
    /* Process all child initialization nodes */
184
 
184
 
185
    for (i = 0; InitializerOp; i++)
185
    for (i = 0; InitializerOp; i++)
186
    {
186
    {
187
        switch (i)
187
        switch (i)
188
        {
188
        {
189
        case 0: /* Resource Usage */
189
        case 0: /* Resource Usage */
190
 
190
 
191
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
191
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
192
            break;
192
            break;
193
 
193
 
194
        case 1: /* MinType */
194
        case 1: /* MinType */
195
 
195
 
196
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
196
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
197
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
197
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
198
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
198
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
199
            break;
199
            break;
200
 
200
 
201
        case 2: /* MaxType */
201
        case 2: /* MaxType */
202
 
202
 
203
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
203
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
204
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
204
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
205
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
205
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
206
            break;
206
            break;
207
 
207
 
208
        case 3: /* DecodeType */
208
        case 3: /* DecodeType */
209
 
209
 
210
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
210
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
211
            RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
211
            RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
212
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
212
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
213
            break;
213
            break;
214
 
214
 
215
        case 4: /* Range Type */
215
        case 4: /* Range Type */
216
 
216
 
217
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 3);
217
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 3);
218
            RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
218
            RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
219
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
219
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
220
            break;
220
            break;
221
 
221
 
222
        case 5: /* Address Granularity */
222
        case 5: /* Address Granularity */
223
 
223
 
224
            Descriptor->Address32.Granularity =
224
            Descriptor->Address32.Granularity =
225
                (UINT32) InitializerOp->Asl.Value.Integer;
225
                (UINT32) InitializerOp->Asl.Value.Integer;
226
            RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
226
            RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
227
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
227
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
228
            GranOp = InitializerOp;
228
            GranOp = InitializerOp;
229
            break;
229
            break;
230
 
230
 
231
        case 6: /* Address Min */
231
        case 6: /* Address Min */
232
 
232
 
233
            Descriptor->Address32.Minimum =
233
            Descriptor->Address32.Minimum =
234
                (UINT32) InitializerOp->Asl.Value.Integer;
234
                (UINT32) InitializerOp->Asl.Value.Integer;
235
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
235
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
236
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
236
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
237
            MinOp = InitializerOp;
237
            MinOp = InitializerOp;
238
            break;
238
            break;
239
 
239
 
240
        case 7: /* Address Max */
240
        case 7: /* Address Max */
241
 
241
 
242
            Descriptor->Address32.Maximum =
242
            Descriptor->Address32.Maximum =
243
                (UINT32) InitializerOp->Asl.Value.Integer;
243
                (UINT32) InitializerOp->Asl.Value.Integer;
244
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
244
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
245
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
245
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
246
            MaxOp = InitializerOp;
246
            MaxOp = InitializerOp;
247
            break;
247
            break;
248
 
248
 
249
        case 8: /* Translation Offset */
249
        case 8: /* Translation Offset */
250
 
250
 
251
            Descriptor->Address32.TranslationOffset =
251
            Descriptor->Address32.TranslationOffset =
252
                (UINT32) InitializerOp->Asl.Value.Integer;
252
                (UINT32) InitializerOp->Asl.Value.Integer;
253
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
253
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
254
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
254
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
255
            break;
255
            break;
256
 
256
 
257
        case 9: /* Address Length */
257
        case 9: /* Address Length */
258
 
258
 
259
            Descriptor->Address32.AddressLength =
259
            Descriptor->Address32.AddressLength =
260
                (UINT32) InitializerOp->Asl.Value.Integer;
260
                (UINT32) InitializerOp->Asl.Value.Integer;
261
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
261
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
262
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
262
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
263
            LengthOp = InitializerOp;
263
            LengthOp = InitializerOp;
264
            break;
264
            break;
265
 
265
 
266
        case 10: /* ResSourceIndex [Optional Field - BYTE] */
266
        case 10: /* ResSourceIndex [Optional Field - BYTE] */
267
 
267
 
268
            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
268
            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
269
            {
269
            {
270
                /* Found a valid ResourceSourceIndex */
270
                /* Found a valid ResourceSourceIndex */
271
 
271
 
272
                OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
272
                OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
273
                OptionIndex++;
273
                OptionIndex++;
274
                Descriptor->Address32.ResourceLength++;
274
                Descriptor->Address32.ResourceLength++;
275
                ResSourceIndex = TRUE;
275
                ResSourceIndex = TRUE;
276
            }
276
            }
277
            break;
277
            break;
278
 
278
 
279
        case 11: /* ResSource [Optional Field - STRING] */
279
        case 11: /* ResSource [Optional Field - STRING] */
280
 
280
 
281
            if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
281
            if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
282
                (InitializerOp->Asl.Value.String))
282
                (InitializerOp->Asl.Value.String))
283
            {
283
            {
284
                if (StringLength)
284
                if (StringLength)
285
                {
285
                {
286
                    /* Found a valid ResourceSource */
286
                    /* Found a valid ResourceSource */
287
 
287
 
288
                    Descriptor->Address32.ResourceLength = (UINT16)
288
                    Descriptor->Address32.ResourceLength = (UINT16)
289
                        (Descriptor->Address32.ResourceLength + StringLength);
289
                        (Descriptor->Address32.ResourceLength + StringLength);
290
 
290
 
291
                    strcpy ((char *)
291
                    strcpy ((char *)
292
                        &OptionalFields[OptionIndex],
292
                        &OptionalFields[OptionIndex],
293
                        InitializerOp->Asl.Value.String);
293
                        InitializerOp->Asl.Value.String);
294
 
294
 
295
                    /* ResourceSourceIndex must also be valid */
295
                    /* ResourceSourceIndex must also be valid */
296
 
296
 
297
                    if (!ResSourceIndex)
297
                    if (!ResSourceIndex)
298
                    {
298
                    {
299
                        AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
299
                        AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
300
                            InitializerOp, NULL);
300
                            InitializerOp, NULL);
301
                    }
301
                    }
302
                }
302
                }
303
            }
303
            }
304
 
304
 
305
#if 0
305
#if 0
306
            /*
306
            /*
307
             * Not a valid ResourceSource, ResourceSourceIndex must also
307
             * Not a valid ResourceSource, ResourceSourceIndex must also
308
             * be invalid
308
             * be invalid
309
             */
309
             */
310
            else if (ResSourceIndex)
310
            else if (ResSourceIndex)
311
            {
311
            {
312
                AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
312
                AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
313
                    InitializerOp, NULL);
313
                    InitializerOp, NULL);
314
            }
314
            }
315
#endif
315
#endif
316
            break;
316
            break;
317
 
317
 
318
        case 12: /* ResourceTag */
318
        case 12: /* ResourceTag */
319
 
319
 
320
            UtAttachNamepathToOwner (Op, InitializerOp);
320
            UtAttachNamepathToOwner (Op, InitializerOp);
321
            break;
321
            break;
322
 
322
 
323
        case 13: /* Type */
323
        case 13: /* Type */
324
 
324
 
325
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 4, 0);
325
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 4, 0);
326
            RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
326
            RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
327
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 4);
327
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 4);
328
            break;
328
            break;
329
 
329
 
330
        case 14: /* Translation Type */
330
        case 14: /* Translation Type */
331
 
331
 
332
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
332
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
333
            RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
333
            RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
334
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
334
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
335
            break;
335
            break;
336
 
336
 
337
        default:
337
        default:
338
 
338
 
339
            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
339
            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
340
            break;
340
            break;
341
        }
341
        }
342
 
342
 
343
        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
343
        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
344
    }
344
    }
345
 
345
 
346
    /* Validate the Min/Max/Len/Gran values */
346
    /* Validate the Min/Max/Len/Gran values */
347
 
347
 
348
    RsLargeAddressCheck (
348
    RsLargeAddressCheck (
349
        Descriptor->Address32.Minimum,
349
        (UINT64) Descriptor->Address32.Minimum,
350
        Descriptor->Address32.Maximum,
350
        (UINT64) Descriptor->Address32.Maximum,
351
        Descriptor->Address32.AddressLength,
351
        (UINT64) Descriptor->Address32.AddressLength,
352
        Descriptor->Address32.Granularity,
352
        (UINT64) Descriptor->Address32.Granularity,
353
        Descriptor->Address32.Flags,
353
        Descriptor->Address32.Flags,
354
        MinOp, MaxOp, LengthOp, GranOp);
354
        MinOp, MaxOp, LengthOp, GranOp, Op);
355
 
355
 
356
    Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
356
    Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
357
                            OptionIndex + StringLength;
357
                            OptionIndex + StringLength;
358
    return (Rnode);
358
    return (Rnode);
359
}
359
}
360
 
360
 
361
 
361
 
362
/*******************************************************************************
362
/*******************************************************************************
363
 *
363
 *
364
 * FUNCTION:    RsDoDwordMemoryDescriptor
364
 * FUNCTION:    RsDoDwordMemoryDescriptor
365
 *
365
 *
366
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
366
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
367
 *              CurrentByteOffset   - Offset into the resource template AML
367
 *              CurrentByteOffset   - Offset into the resource template AML
368
 *                                    buffer (to track references to the desc)
368
 *                                    buffer (to track references to the desc)
369
 *
369
 *
370
 * RETURN:      Completed resource node
370
 * RETURN:      Completed resource node
371
 *
371
 *
372
 * DESCRIPTION: Construct a long "DwordMemory" descriptor
372
 * DESCRIPTION: Construct a long "DwordMemory" descriptor
373
 *
373
 *
374
 ******************************************************************************/
374
 ******************************************************************************/
375
 
375
 
376
ASL_RESOURCE_NODE *
376
ASL_RESOURCE_NODE *
377
RsDoDwordMemoryDescriptor (
377
RsDoDwordMemoryDescriptor (
378
    ACPI_PARSE_OBJECT       *Op,
378
    ACPI_PARSE_OBJECT       *Op,
379
    UINT32                  CurrentByteOffset)
379
    UINT32                  CurrentByteOffset)
380
{
380
{
381
    AML_RESOURCE            *Descriptor;
381
    AML_RESOURCE            *Descriptor;
382
    ACPI_PARSE_OBJECT       *InitializerOp;
382
    ACPI_PARSE_OBJECT       *InitializerOp;
383
    ACPI_PARSE_OBJECT       *MinOp = NULL;
383
    ACPI_PARSE_OBJECT       *MinOp = NULL;
384
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
384
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
385
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
385
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
386
    ACPI_PARSE_OBJECT       *GranOp = NULL;
386
    ACPI_PARSE_OBJECT       *GranOp = NULL;
387
    ASL_RESOURCE_NODE       *Rnode;
387
    ASL_RESOURCE_NODE       *Rnode;
388
    UINT8                   *OptionalFields;
388
    UINT8                   *OptionalFields;
389
    UINT16                  StringLength = 0;
389
    UINT16                  StringLength = 0;
390
    UINT32                  OptionIndex = 0;
390
    UINT32                  OptionIndex = 0;
391
    UINT32                  i;
391
    UINT32                  i;
392
    BOOLEAN                 ResSourceIndex = FALSE;
392
    BOOLEAN                 ResSourceIndex = FALSE;
393
 
393
 
394
 
394
 
395
    InitializerOp = Op->Asl.Child;
395
    InitializerOp = Op->Asl.Child;
396
    StringLength = RsGetStringDataLength (InitializerOp);
396
    StringLength = RsGetStringDataLength (InitializerOp);
397
 
397
 
398
    Rnode = RsAllocateResourceNode (
398
    Rnode = RsAllocateResourceNode (
399
                sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
399
                sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
400
 
400
 
401
    Descriptor = Rnode->Buffer;
401
    Descriptor = Rnode->Buffer;
402
    Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
402
    Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
403
    Descriptor->Address32.ResourceType   = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
403
    Descriptor->Address32.ResourceType   = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
404
 
404
 
405
    /*
405
    /*
406
     * Initial descriptor length -- may be enlarged if there are
406
     * Initial descriptor length -- may be enlarged if there are
407
     * optional fields present
407
     * optional fields present
408
     */
408
     */
409
    OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
409
    OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
410
    Descriptor->Address32.ResourceLength = (UINT16)
410
    Descriptor->Address32.ResourceLength = (UINT16)
411
        (sizeof (AML_RESOURCE_ADDRESS32) -
411
        (sizeof (AML_RESOURCE_ADDRESS32) -
412
         sizeof (AML_RESOURCE_LARGE_HEADER));
412
         sizeof (AML_RESOURCE_LARGE_HEADER));
413
 
413
 
414
 
414
 
415
    /* Process all child initialization nodes */
415
    /* Process all child initialization nodes */
416
 
416
 
417
    for (i = 0; InitializerOp; i++)
417
    for (i = 0; InitializerOp; i++)
418
    {
418
    {
419
        switch (i)
419
        switch (i)
420
        {
420
        {
421
        case 0: /* Resource Usage */
421
        case 0: /* Resource Usage */
422
 
422
 
423
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
423
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
424
            break;
424
            break;
425
 
425
 
426
        case 1: /* DecodeType */
426
        case 1: /* DecodeType */
427
 
427
 
428
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
428
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
429
            RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
429
            RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
430
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
430
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
431
            break;
431
            break;
432
 
432
 
433
        case 2: /* MinType */
433
        case 2: /* MinType */
434
 
434
 
435
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
435
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
436
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
436
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
437
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
437
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
438
            break;
438
            break;
439
 
439
 
440
        case 3: /* MaxType */
440
        case 3: /* MaxType */
441
 
441
 
442
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
442
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
443
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
443
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
444
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
444
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
445
            break;
445
            break;
446
 
446
 
447
        case 4: /* Memory Type */
447
        case 4: /* Memory Type */
448
 
448
 
449
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 1, 0);
449
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 1, 0);
450
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
450
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
451
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 1);
451
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 1);
452
            break;
452
            break;
453
 
453
 
454
        case 5: /* Read/Write Type */
454
        case 5: /* Read/Write Type */
455
 
455
 
456
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 1);
456
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 1);
457
            RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
457
            RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
458
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
458
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
459
            break;
459
            break;
460
 
460
 
461
        case 6: /* Address Granularity */
461
        case 6: /* Address Granularity */
462
 
462
 
463
            Descriptor->Address32.Granularity =
463
            Descriptor->Address32.Granularity =
464
                (UINT32) InitializerOp->Asl.Value.Integer;
464
                (UINT32) InitializerOp->Asl.Value.Integer;
465
            RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
465
            RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
466
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
466
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
467
            GranOp = InitializerOp;
467
            GranOp = InitializerOp;
468
            break;
468
            break;
469
 
469
 
470
        case 7: /* Min Address */
470
        case 7: /* Min Address */
471
 
471
 
472
            Descriptor->Address32.Minimum =
472
            Descriptor->Address32.Minimum =
473
                (UINT32) InitializerOp->Asl.Value.Integer;
473
                (UINT32) InitializerOp->Asl.Value.Integer;
474
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
474
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
475
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
475
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
476
            MinOp = InitializerOp;
476
            MinOp = InitializerOp;
477
            break;
477
            break;
478
 
478
 
479
        case 8: /* Max Address */
479
        case 8: /* Max Address */
480
 
480
 
481
            Descriptor->Address32.Maximum =
481
            Descriptor->Address32.Maximum =
482
                (UINT32) InitializerOp->Asl.Value.Integer;
482
                (UINT32) InitializerOp->Asl.Value.Integer;
483
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
483
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
484
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
484
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
485
            MaxOp = InitializerOp;
485
            MaxOp = InitializerOp;
486
            break;
486
            break;
487
 
487
 
488
        case 9: /* Translation Offset */
488
        case 9: /* Translation Offset */
489
 
489
 
490
            Descriptor->Address32.TranslationOffset =
490
            Descriptor->Address32.TranslationOffset =
491
                (UINT32) InitializerOp->Asl.Value.Integer;
491
                (UINT32) InitializerOp->Asl.Value.Integer;
492
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
492
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
493
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
493
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
494
            break;
494
            break;
495
 
495
 
496
        case 10: /* Address Length */
496
        case 10: /* Address Length */
497
 
497
 
498
            Descriptor->Address32.AddressLength =
498
            Descriptor->Address32.AddressLength =
499
                (UINT32) InitializerOp->Asl.Value.Integer;
499
                (UINT32) InitializerOp->Asl.Value.Integer;
500
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
500
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
501
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
501
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
502
            LengthOp = InitializerOp;
502
            LengthOp = InitializerOp;
503
            break;
503
            break;
504
 
504
 
505
        case 11: /* ResSourceIndex [Optional Field - BYTE] */
505
        case 11: /* ResSourceIndex [Optional Field - BYTE] */
506
 
506
 
507
            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
507
            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
508
            {
508
            {
509
                OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
509
                OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
510
                OptionIndex++;
510
                OptionIndex++;
511
                Descriptor->Address32.ResourceLength++;
511
                Descriptor->Address32.ResourceLength++;
512
                ResSourceIndex = TRUE;
512
                ResSourceIndex = TRUE;
513
            }
513
            }
514
            break;
514
            break;
515
 
515
 
516
        case 12: /* ResSource [Optional Field - STRING] */
516
        case 12: /* ResSource [Optional Field - STRING] */
517
 
517
 
518
            if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
518
            if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
519
                (InitializerOp->Asl.Value.String))
519
                (InitializerOp->Asl.Value.String))
520
            {
520
            {
521
                if (StringLength)
521
                if (StringLength)
522
                {
522
                {
523
                    Descriptor->Address32.ResourceLength = (UINT16)
523
                    Descriptor->Address32.ResourceLength = (UINT16)
524
                        (Descriptor->Address32.ResourceLength + StringLength);
524
                        (Descriptor->Address32.ResourceLength + StringLength);
525
 
525
 
526
                    strcpy ((char *)
526
                    strcpy ((char *)
527
                        &OptionalFields[OptionIndex],
527
                        &OptionalFields[OptionIndex],
528
                        InitializerOp->Asl.Value.String);
528
                        InitializerOp->Asl.Value.String);
529
 
529
 
530
                    /* ResourceSourceIndex must also be valid */
530
                    /* ResourceSourceIndex must also be valid */
531
 
531
 
532
                    if (!ResSourceIndex)
532
                    if (!ResSourceIndex)
533
                    {
533
                    {
534
                        AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
534
                        AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
535
                            InitializerOp, NULL);
535
                            InitializerOp, NULL);
536
                    }
536
                    }
537
                }
537
                }
538
            }
538
            }
539
 
539
 
540
#if 0
540
#if 0
541
            /*
541
            /*
542
             * Not a valid ResourceSource, ResourceSourceIndex must also
542
             * Not a valid ResourceSource, ResourceSourceIndex must also
543
             * be invalid
543
             * be invalid
544
             */
544
             */
545
            else if (ResSourceIndex)
545
            else if (ResSourceIndex)
546
            {
546
            {
547
                AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
547
                AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
548
                    InitializerOp, NULL);
548
                    InitializerOp, NULL);
549
            }
549
            }
550
#endif
550
#endif
551
            break;
551
            break;
552
 
552
 
553
        case 13: /* ResourceTag */
553
        case 13: /* ResourceTag */
554
 
554
 
555
            UtAttachNamepathToOwner (Op, InitializerOp);
555
            UtAttachNamepathToOwner (Op, InitializerOp);
556
            break;
556
            break;
557
 
557
 
558
 
558
 
559
        case 14: /* Address Range */
559
        case 14: /* Address Range */
560
 
560
 
561
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 3, 0);
561
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 3, 0);
562
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
562
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
563
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 3);
563
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 3);
564
            break;
564
            break;
565
 
565
 
566
        case 15: /* Type */
566
        case 15: /* Type */
567
 
567
 
568
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
568
            RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
569
            RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
569
            RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
570
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
570
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
571
            break;
571
            break;
572
 
572
 
573
        default:
573
        default:
574
 
574
 
575
            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
575
            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
576
            break;
576
            break;
577
        }
577
        }
578
 
578
 
579
        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
579
        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
580
    }
580
    }
581
 
581
 
582
    /* Validate the Min/Max/Len/Gran values */
582
    /* Validate the Min/Max/Len/Gran values */
583
 
583
 
584
    RsLargeAddressCheck (
584
    RsLargeAddressCheck (
585
        Descriptor->Address32.Minimum,
585
        (UINT64) Descriptor->Address32.Minimum,
586
        Descriptor->Address32.Maximum,
586
        (UINT64) Descriptor->Address32.Maximum,
587
        Descriptor->Address32.AddressLength,
587
        (UINT64) Descriptor->Address32.AddressLength,
588
        Descriptor->Address32.Granularity,
588
        (UINT64) Descriptor->Address32.Granularity,
589
        Descriptor->Address32.Flags,
589
        Descriptor->Address32.Flags,
590
        MinOp, MaxOp, LengthOp, GranOp);
590
        MinOp, MaxOp, LengthOp, GranOp, Op);
591
 
591
 
592
    Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
592
    Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
593
                            OptionIndex + StringLength;
593
                            OptionIndex + StringLength;
594
    return (Rnode);
594
    return (Rnode);
595
}
595
}
596
 
596
 
597
 
597
 
598
/*******************************************************************************
598
/*******************************************************************************
599
 *
599
 *
600
 * FUNCTION:    RsDoDwordSpaceDescriptor
600
 * FUNCTION:    RsDoDwordSpaceDescriptor
601
 *
601
 *
602
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
602
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
603
 *              CurrentByteOffset   - Offset into the resource template AML
603
 *              CurrentByteOffset   - Offset into the resource template AML
604
 *                                    buffer (to track references to the desc)
604
 *                                    buffer (to track references to the desc)
605
 *
605
 *
606
 * RETURN:      Completed resource node
606
 * RETURN:      Completed resource node
607
 *
607
 *
608
 * DESCRIPTION: Construct a long "DwordSpace" descriptor
608
 * DESCRIPTION: Construct a long "DwordSpace" descriptor
609
 *
609
 *
610
 ******************************************************************************/
610
 ******************************************************************************/
611
 
611
 
612
ASL_RESOURCE_NODE *
612
ASL_RESOURCE_NODE *
613
RsDoDwordSpaceDescriptor (
613
RsDoDwordSpaceDescriptor (
614
    ACPI_PARSE_OBJECT       *Op,
614
    ACPI_PARSE_OBJECT       *Op,
615
    UINT32                  CurrentByteOffset)
615
    UINT32                  CurrentByteOffset)
616
{
616
{
617
    AML_RESOURCE            *Descriptor;
617
    AML_RESOURCE            *Descriptor;
618
    ACPI_PARSE_OBJECT       *InitializerOp;
618
    ACPI_PARSE_OBJECT       *InitializerOp;
619
    ACPI_PARSE_OBJECT       *MinOp = NULL;
619
    ACPI_PARSE_OBJECT       *MinOp = NULL;
620
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
620
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
621
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
621
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
622
    ACPI_PARSE_OBJECT       *GranOp = NULL;
622
    ACPI_PARSE_OBJECT       *GranOp = NULL;
623
    ASL_RESOURCE_NODE       *Rnode;
623
    ASL_RESOURCE_NODE       *Rnode;
624
    UINT8                   *OptionalFields;
624
    UINT8                   *OptionalFields;
625
    UINT16                  StringLength = 0;
625
    UINT16                  StringLength = 0;
626
    UINT32                  OptionIndex = 0;
626
    UINT32                  OptionIndex = 0;
627
    UINT32                  i;
627
    UINT32                  i;
628
    BOOLEAN                 ResSourceIndex = FALSE;
628
    BOOLEAN                 ResSourceIndex = FALSE;
629
 
629
 
630
 
630
 
631
    InitializerOp = Op->Asl.Child;
631
    InitializerOp = Op->Asl.Child;
632
    StringLength = RsGetStringDataLength (InitializerOp);
632
    StringLength = RsGetStringDataLength (InitializerOp);
633
 
633
 
634
    Rnode = RsAllocateResourceNode (
634
    Rnode = RsAllocateResourceNode (
635
                sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
635
                sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
636
 
636
 
637
    Descriptor = Rnode->Buffer;
637
    Descriptor = Rnode->Buffer;
638
    Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
638
    Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
639
 
639
 
640
    /*
640
    /*
641
     * Initial descriptor length -- may be enlarged if there are
641
     * Initial descriptor length -- may be enlarged if there are
642
     * optional fields present
642
     * optional fields present
643
     */
643
     */
644
    OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
644
    OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
645
    Descriptor->Address32.ResourceLength = (UINT16)
645
    Descriptor->Address32.ResourceLength = (UINT16)
646
        (sizeof (AML_RESOURCE_ADDRESS32) -
646
        (sizeof (AML_RESOURCE_ADDRESS32) -
647
         sizeof (AML_RESOURCE_LARGE_HEADER));
647
         sizeof (AML_RESOURCE_LARGE_HEADER));
648
 
648
 
649
    /* Process all child initialization nodes */
649
    /* Process all child initialization nodes */
650
 
650
 
651
    for (i = 0; InitializerOp; i++)
651
    for (i = 0; InitializerOp; i++)
652
    {
652
    {
653
        switch (i)
653
        switch (i)
654
        {
654
        {
655
        case 0: /* Resource Type */
655
        case 0: /* Resource Type */
656
 
656
 
657
            Descriptor->Address32.ResourceType =
657
            Descriptor->Address32.ResourceType =
658
                (UINT8) InitializerOp->Asl.Value.Integer;
658
                (UINT8) InitializerOp->Asl.Value.Integer;
659
            break;
659
            break;
660
 
660
 
661
        case 1: /* Resource Usage */
661
        case 1: /* Resource Usage */
662
 
662
 
663
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
663
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
664
            break;
664
            break;
665
 
665
 
666
        case 2: /* DecodeType */
666
        case 2: /* DecodeType */
667
 
667
 
668
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
668
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
669
            RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
669
            RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
670
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
670
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
671
            break;
671
            break;
672
 
672
 
673
        case 3: /* MinType */
673
        case 3: /* MinType */
674
 
674
 
675
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
675
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
676
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
676
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
677
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
677
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
678
            break;
678
            break;
679
 
679
 
680
        case 4: /* MaxType */
680
        case 4: /* MaxType */
681
 
681
 
682
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
682
            RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
683
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
683
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
684
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
684
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
685
            break;
685
            break;
686
 
686
 
687
        case 5: /* Type-Specific flags */
687
        case 5: /* Type-Specific flags */
688
 
688
 
689
            Descriptor->Address32.SpecificFlags =
689
            Descriptor->Address32.SpecificFlags =
690
                (UINT8) InitializerOp->Asl.Value.Integer;
690
                (UINT8) InitializerOp->Asl.Value.Integer;
691
            break;
691
            break;
692
 
692
 
693
        case 6: /* Address Granularity */
693
        case 6: /* Address Granularity */
694
 
694
 
695
            Descriptor->Address32.Granularity =
695
            Descriptor->Address32.Granularity =
696
                (UINT32) InitializerOp->Asl.Value.Integer;
696
                (UINT32) InitializerOp->Asl.Value.Integer;
697
            RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
697
            RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
698
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
698
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
699
            GranOp = InitializerOp;
699
            GranOp = InitializerOp;
700
            break;
700
            break;
701
 
701
 
702
        case 7: /* Min Address */
702
        case 7: /* Min Address */
703
 
703
 
704
            Descriptor->Address32.Minimum =
704
            Descriptor->Address32.Minimum =
705
                (UINT32) InitializerOp->Asl.Value.Integer;
705
                (UINT32) InitializerOp->Asl.Value.Integer;
706
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
706
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
707
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
707
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
708
            MinOp = InitializerOp;
708
            MinOp = InitializerOp;
709
            break;
709
            break;
710
 
710
 
711
        case 8: /* Max Address */
711
        case 8: /* Max Address */
712
 
712
 
713
            Descriptor->Address32.Maximum =
713
            Descriptor->Address32.Maximum =
714
                (UINT32) InitializerOp->Asl.Value.Integer;
714
                (UINT32) InitializerOp->Asl.Value.Integer;
715
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
715
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
716
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
716
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
717
            MaxOp = InitializerOp;
717
            MaxOp = InitializerOp;
718
            break;
718
            break;
719
 
719
 
720
        case 9: /* Translation Offset */
720
        case 9: /* Translation Offset */
721
 
721
 
722
            Descriptor->Address32.TranslationOffset =
722
            Descriptor->Address32.TranslationOffset =
723
                (UINT32) InitializerOp->Asl.Value.Integer;
723
                (UINT32) InitializerOp->Asl.Value.Integer;
724
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
724
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
725
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
725
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
726
            break;
726
            break;
727
 
727
 
728
        case 10: /* Address Length */
728
        case 10: /* Address Length */
729
 
729
 
730
            Descriptor->Address32.AddressLength =
730
            Descriptor->Address32.AddressLength =
731
                (UINT32) InitializerOp->Asl.Value.Integer;
731
                (UINT32) InitializerOp->Asl.Value.Integer;
732
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
732
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
733
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
733
                CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
734
            LengthOp = InitializerOp;
734
            LengthOp = InitializerOp;
735
            break;
735
            break;
736
 
736
 
737
        case 11: /* ResSourceIndex [Optional Field - BYTE] */
737
        case 11: /* ResSourceIndex [Optional Field - BYTE] */
738
 
738
 
739
            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
739
            if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
740
            {
740
            {
741
                OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
741
                OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
742
                OptionIndex++;
742
                OptionIndex++;
743
                Descriptor->Address32.ResourceLength++;
743
                Descriptor->Address32.ResourceLength++;
744
                ResSourceIndex = TRUE;
744
                ResSourceIndex = TRUE;
745
            }
745
            }
746
            break;
746
            break;
747
 
747
 
748
        case 12: /* ResSource [Optional Field - STRING] */
748
        case 12: /* ResSource [Optional Field - STRING] */
749
 
749
 
750
            if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
750
            if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
751
                (InitializerOp->Asl.Value.String))
751
                (InitializerOp->Asl.Value.String))
752
            {
752
            {
753
                if (StringLength)
753
                if (StringLength)
754
                {
754
                {
755
                    Descriptor->Address32.ResourceLength = (UINT16)
755
                    Descriptor->Address32.ResourceLength = (UINT16)
756
                        (Descriptor->Address32.ResourceLength + StringLength);
756
                        (Descriptor->Address32.ResourceLength + StringLength);
757
 
757
 
758
                    strcpy ((char *)
758
                    strcpy ((char *)
759
                        &OptionalFields[OptionIndex],
759
                        &OptionalFields[OptionIndex],
760
                        InitializerOp->Asl.Value.String);
760
                        InitializerOp->Asl.Value.String);
761
 
761
 
762
                    /* ResourceSourceIndex must also be valid */
762
                    /* ResourceSourceIndex must also be valid */
763
 
763
 
764
                    if (!ResSourceIndex)
764
                    if (!ResSourceIndex)
765
                    {
765
                    {
766
                        AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
766
                        AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
767
                            InitializerOp, NULL);
767
                            InitializerOp, NULL);
768
                    }
768
                    }
769
                }
769
                }
770
            }
770
            }
771
 
771
 
772
#if 0
772
#if 0
773
            /*
773
            /*
774
             * Not a valid ResourceSource, ResourceSourceIndex must also
774
             * Not a valid ResourceSource, ResourceSourceIndex must also
775
             * be invalid
775
             * be invalid
776
             */
776
             */
777
            else if (ResSourceIndex)
777
            else if (ResSourceIndex)
778
            {
778
            {
779
                AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
779
                AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
780
                    InitializerOp, NULL);
780
                    InitializerOp, NULL);
781
            }
781
            }
782
#endif
782
#endif
783
            break;
783
            break;
784
 
784
 
785
        case 13: /* ResourceTag */
785
        case 13: /* ResourceTag */
786
 
786
 
787
            UtAttachNamepathToOwner (Op, InitializerOp);
787
            UtAttachNamepathToOwner (Op, InitializerOp);
788
            break;
788
            break;
789
 
789
 
790
        default:
790
        default:
791
 
791
 
792
            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST,
792
            AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST,
793
                InitializerOp, NULL);
793
                InitializerOp, NULL);
794
            break;
794
            break;
795
        }
795
        }
796
 
796
 
797
        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
797
        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
798
    }
798
    }
799
 
799
 
800
    /* Validate the Min/Max/Len/Gran values */
800
    /* Validate the Min/Max/Len/Gran values */
801
 
801
 
802
    RsLargeAddressCheck (
802
    RsLargeAddressCheck (
803
        Descriptor->Address32.Minimum,
803
        (UINT64) Descriptor->Address32.Minimum,
804
        Descriptor->Address32.Maximum,
804
        (UINT64) Descriptor->Address32.Maximum,
805
        Descriptor->Address32.AddressLength,
805
        (UINT64) Descriptor->Address32.AddressLength,
806
        Descriptor->Address32.Granularity,
806
        (UINT64) Descriptor->Address32.Granularity,
807
        Descriptor->Address32.Flags,
807
        Descriptor->Address32.Flags,
808
        MinOp, MaxOp, LengthOp, GranOp);
808
        MinOp, MaxOp, LengthOp, GranOp, Op);
809
 
809
 
810
    Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
810
    Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
811
                            OptionIndex + StringLength;
811
                            OptionIndex + StringLength;
812
    return (Rnode);
812
    return (Rnode);
813
}
813
}