1
2/******************************************************************************
3 *
4 * Module Name: aslrestype2 - Long (type2) resource templates and descriptors
5 * $Revision: 26 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.
22 *
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
29 *
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code. No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
38 *
39 * The above copyright and patent license is granted only if the following
40 * conditions are met:
41 *
42 * 3. Conditions
43 *
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision. In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change. Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee. Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
55 *
56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57 * Redistribution of source code of any substantial portion of the Covered
58 * Code or modification without rights to further distribute source must
59 * include the following Disclaimer and Export Compliance provision in the
60 * documentation and/or other materials provided with distribution. In
61 * addition, Licensee may not authorize further sublicense of source of any
62 * portion of the Covered Code, and must include terms to the effect that the
63 * license from Licensee to its licensee is limited to the intellectual
64 * property embodied in the software Licensee provides to its licensee, and
65 * not to intellectual property embodied in modifications its licensee may
66 * make.
67 *
68 * 3.3. Redistribution of Executable. Redistribution in executable form of any
69 * substantial portion of the Covered Code or modification must reproduce the
70 * above Copyright Notice, and the following Disclaimer and Export Compliance
71 * provision in the documentation and/or other materials provided with the
72 * distribution.
73 *
74 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * Intel Code.
76 *
77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78 * Intel shall be used in advertising or otherwise to promote the sale, use or
79 * other dealings in products derived from or relating to the Covered Code
80 * without prior written authorization from Intel.
81 *
82 * 4. Disclaimer and Export Compliance
83 *
84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
87 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * PARTICULAR PURPOSE.
91 *
92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * LIMITED REMEDY.
100 *
101 * 4.3. Licensee shall not export, either directly or indirectly, any of this
102 * software or system incorporating such software without first obtaining any
103 * required license or other approval from the U. S. Department of Commerce or
104 * any other agency or department of the United States Government. In the
105 * event Licensee exports any such software from the United States or
106 * re-exports any such software from a foreign destination, Licensee shall
107 * ensure that the distribution and export/re-export of the software is in
108 * compliance with all laws, regulations, orders, or other restrictions of the
109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110 * any of its subsidiaries will export/re-export any technical data, process,
111 * software, or service, directly or indirectly, to any country for which the
112 * United States government or any agency thereof requires an export license,
113 * other governmental approval, or letter of assurance, without first obtaining
114 * such license, approval or letter.
115 *
116 *****************************************************************************/
117
118
119#include "aslcompiler.h"
120#include "aslcompiler.y.h"
121
122#define _COMPONENT ACPI_COMPILER
123 ACPI_MODULE_NAME ("aslrestype2")
124
125
126/*******************************************************************************
127 *
128 * FUNCTION: RsGetStringDataLength
129 *
130 * PARAMETERS: InitializerOp - Start of a subtree of init nodes
131 *
132 * RETURN: Valid string length if a string node is found
133 *
134 * DESCRIPTION: In a list of peer nodes, find the first one that contains a
135 * string and return the length of the string.
136 *
137 ******************************************************************************/
138
139UINT32
140RsGetStringDataLength (
141 ACPI_PARSE_OBJECT *InitializerOp)
142{
143
144 while (InitializerOp)
145 {
146 if (InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
147 {
148 return (strlen (InitializerOp->Asl.Value.String) + 1);
149 }
150 InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
151 }
152
153 return 0;
154}
155
156
157/*******************************************************************************
158 *
159 * FUNCTION: RsDoDwordIoDescriptor
160 *
161 * PARAMETERS: Op - Parent resource descriptor parse node
162 * CurrentByteOffset - Offset into the resource template AML
163 * buffer (to track references to the desc)
164 *
165 * RETURN: Completed resource node
166 *
167 * DESCRIPTION: Construct a long "DwordIO" descriptor
168 *
169 ******************************************************************************/
170
171ASL_RESOURCE_NODE *
172RsDoDwordIoDescriptor (
173 ACPI_PARSE_OBJECT *Op,
174 UINT32 CurrentByteOffset)
175{
176 ASL_RESOURCE_DESC *Descriptor;
177 ACPI_PARSE_OBJECT *InitializerOp;
178 ASL_RESOURCE_NODE *Rnode;
179 UINT32 StringLength = 0;
180 UINT32 OptionIndex = 0;
181 UINT32 i;
182
183
184 InitializerOp = Op->Asl.Child;
185 StringLength = RsGetStringDataLength (InitializerOp);
186
187 Rnode = RsAllocateResourceNode (sizeof (ASL_DWORD_ADDRESS_DESC) +
188 StringLength);
189
190 Descriptor = Rnode->Buffer;
191 Descriptor->Das.DescriptorType = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE;
192 Descriptor->Das.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
193
194 /*
195 * Initial descriptor length -- may be enlarged if there are
196 * optional fields present
197 */
198 Descriptor->Das.Length = (UINT16) (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
199 ASL_RESDESC_OFFSET (Das.ResourceType));
200
201 /*
202 * Process all child initialization nodes
203 */
204 for (i = 0; InitializerOp; i++)
205 {
206 switch (i)
207 {
208 case 0: /* Resource Type */
209
210 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 0, 1);
211 break;
212
213 case 1: /* MinType */
214
215 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 2, 0);
216 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
217 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 2);
218 break;
219
220 case 2: /* MaxType */
221
222 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 3, 0);
223 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
224 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 3);
225 break;
226
227 case 3: /* DecodeType */
228
229 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 1, 0);
230 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
231 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 1);
232 break;
233
234 case 4: /* Range Type */
235
236 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 0, 3);
237 RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
238 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 0);
239 break;
240
241 case 5: /* Address Granularity */
242
243 Descriptor->Das.Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
244 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
245 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Granularity));
246 break;
247
248 case 6: /* Address Min */
249
250 Descriptor->Das.AddressMin = (UINT32) InitializerOp->Asl.Value.Integer;
251 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
252 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMin));
253 break;
254
255 case 7: /* Address Max */
256
257 Descriptor->Das.AddressMax = (UINT32) InitializerOp->Asl.Value.Integer;
258 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
259 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMax));
260 break;
261
262 case 8: /* Translation Offset */
263
264 Descriptor->Das.TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
265 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
266 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.TranslationOffset));
267 break;
268
269 case 9: /* Address Length */
270
271 Descriptor->Das.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
272 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
273 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressLength));
274 break;
275
276 case 10: /* ResSourceIndex [Optional Field - BYTE] */
277
278 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
279 {
280 Descriptor->Das.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
281 OptionIndex++;
282 Descriptor->Das.Length++;
283 }
284 break;
285
286 case 11: /* ResSource [Optional Field - STRING] */
287
288 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
289 (InitializerOp->Asl.Value.String))
290 {
291 if (StringLength)
292 {
293 Descriptor->Das.Length = (UINT16) (Descriptor->Das.Length + StringLength);
294
295 strcpy ((char *) &Descriptor->Das.OptionalFields[OptionIndex],
296 InitializerOp->Asl.Value.String);
297 }
298 }
299 break;
300
301 case 12: /* ResourceTag */
302
303 UtAttachNamepathToOwner (Op, InitializerOp);
304 break;
305
306 case 13: /* Type */
307
308 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 4, 0);
309 RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
310 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 4);
311 break;
312
313 case 14: /* Translation Type */
314
315 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 5, 0);
316 RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
317 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 5);
318 break;
319
320 default:
321
322 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
323 break;
324 }
325
326 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
327 }
328
329 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
330 ASL_RESDESC_OFFSET (Das.DescriptorType))
331 + OptionIndex + StringLength;
332 return (Rnode);
333}
334
335
336/*******************************************************************************
337 *
338 * FUNCTION: RsDoDwordMemoryDescriptor
339 *
340 * PARAMETERS: Op - Parent resource descriptor parse node
341 * CurrentByteOffset - Offset into the resource template AML
342 * buffer (to track references to the desc)
343 *
344 * RETURN: Completed resource node
345 *
346 * DESCRIPTION: Construct a long "DwordMemory" descriptor
347 *
348 ******************************************************************************/
349
350ASL_RESOURCE_NODE *
351RsDoDwordMemoryDescriptor (
352 ACPI_PARSE_OBJECT *Op,
353 UINT32 CurrentByteOffset)
354{
355 ASL_RESOURCE_DESC *Descriptor;
356 ACPI_PARSE_OBJECT *InitializerOp;
357 ASL_RESOURCE_NODE *Rnode;
358 UINT32 StringLength = 0;
359 UINT32 OptionIndex = 0;
360 UINT32 i;
361
362
363 InitializerOp = Op->Asl.Child;
364 StringLength = RsGetStringDataLength (InitializerOp);
365
366 Rnode = RsAllocateResourceNode (sizeof (ASL_DWORD_ADDRESS_DESC) +
367 StringLength);
368
369 Descriptor = Rnode->Buffer;
370 Descriptor->Das.DescriptorType = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE;
371 Descriptor->Das.ResourceType = ACPI_RESOURCE_TYPE_MEMORY_RANGE;
372
373 /*
374 * Initial descriptor length -- may be enlarged if there are
375 * optional fields present
376 */
377 Descriptor->Das.Length = (UINT16) (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
378 ASL_RESDESC_OFFSET (Das.ResourceType));
379
380 /*
381 * Process all child initialization nodes
382 */
383 for (i = 0; InitializerOp; i++)
384 {
385 switch (i)
386 {
387 case 0: /* Resource Type */
388
389 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 0, 1);
390 break;
391
392 case 1: /* DecodeType */
393
394 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 1, 0);
395 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
396 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 1);
397 break;
398
399 case 2: /* MinType */
400
401 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 2, 0);
402 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
403 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 2);
404 break;
405
406 case 3: /* MaxType */
407
408 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 3, 0);
409 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
410 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 3);
411 break;
412
413 case 4: /* Memory Type */
414
415 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 1, 0);
416 RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE,
417 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 1);
418 break;
419
420 case 5: /* Read/Write Type */
421
422 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 0, 1);
423 RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
424 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 0);
425 break;
426
427 case 6: /* Address Granularity */
428
429 Descriptor->Das.Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
430 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
431 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Granularity));
432 break;
433
434 case 7: /* Min Address */
435
436 Descriptor->Das.AddressMin = (UINT32) InitializerOp->Asl.Value.Integer;
437 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
438 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMin));
439 break;
440
441 case 8: /* Max Address */
442
443 Descriptor->Das.AddressMax = (UINT32) InitializerOp->Asl.Value.Integer;
444 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
445 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMax));
446 break;
447
448 case 9: /* Translation Offset */
449
450 Descriptor->Das.TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
451 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
452 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.TranslationOffset));
453 break;
454
455 case 10: /* Address Length */
456
457 Descriptor->Das.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
458 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
459 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressLength));
460 break;
461
462 case 11: /* ResSourceIndex [Optional Field - BYTE] */
463
464 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
465 {
466 Descriptor->Das.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
467 OptionIndex++;
468 Descriptor->Das.Length++;
469 }
470 break;
471
472 case 12: /* ResSource [Optional Field - STRING] */
473
474 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
475 (InitializerOp->Asl.Value.String))
476 {
477 if (StringLength)
478 {
479 Descriptor->Das.Length = (UINT16) (Descriptor->Das.Length + StringLength);
480
481 strcpy ((char *) &Descriptor->Das.OptionalFields[OptionIndex],
482 InitializerOp->Asl.Value.String);
483 }
484 }
485 break;
486
487 case 13: /* ResourceTag */
488
489 UtAttachNamepathToOwner (Op, InitializerOp);
490 break;
491
492
493 case 14: /* Address Range */
494
495 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 3, 0);
496 RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES,
497 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 3);
498 break;
499
500 case 15: /* Type */
501
502 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 5, 0);
503 RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
504 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 5);
505 break;
506
507 default:
508
509 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
510 break;
511 }
512
513 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
514 }
515
516 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
517 ASL_RESDESC_OFFSET (Das.DescriptorType))
518 + OptionIndex + StringLength;
519 return (Rnode);
520}
521
522
523/*******************************************************************************
524 *
525 * FUNCTION: RsDoQwordIoDescriptor
526 *
527 * PARAMETERS: Op - Parent resource descriptor parse node
528 * CurrentByteOffset - Offset into the resource template AML
529 * buffer (to track references to the desc)
530 *
531 * RETURN: Completed resource node
532 *
533 * DESCRIPTION: Construct a long "QwordIO" descriptor
534 *
535 ******************************************************************************/
536
537ASL_RESOURCE_NODE *
538RsDoQwordIoDescriptor (
539 ACPI_PARSE_OBJECT *Op,
540 UINT32 CurrentByteOffset)
541{
542 ASL_RESOURCE_DESC *Descriptor;
543 ACPI_PARSE_OBJECT *InitializerOp;
544 ASL_RESOURCE_NODE *Rnode;
545 UINT32 StringLength = 0;
546 UINT32 OptionIndex = 0;
547 UINT32 i;
548
549
550 InitializerOp = Op->Asl.Child;
551 StringLength = RsGetStringDataLength (InitializerOp);
552
553 Rnode = RsAllocateResourceNode (sizeof (ASL_QWORD_ADDRESS_DESC) +
554 StringLength);
555
556 Descriptor = Rnode->Buffer;
557 Descriptor->Qas.DescriptorType = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE;
558 Descriptor->Qas.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
559
560 /*
561 * Initial descriptor length -- may be enlarged if there are
562 * optional fields present
563 */
564 Descriptor->Qas.Length = (UINT16) (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
565 ASL_RESDESC_OFFSET (Qas.ResourceType));
566 /*
567 * Process all child initialization nodes
568 */
569 for (i = 0; InitializerOp; i++)
570 {
571 switch (i)
572 {
573 case 0: /* Resource Type */
574
575 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 0, 1);
576 break;
577
578 case 1: /* MinType */
579
580 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 2, 0);
581 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
582 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 2);
583 break;
584
585 case 2: /* MaxType */
586
587 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 3, 0);
588 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
589 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 3);
590 break;
591
592 case 3: /* DecodeType */
593
594 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 1, 0);
595 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
596 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 1);
597 break;
598
599 case 4: /* Range Type */
600
601 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 0, 3);
602 RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
603 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 0);
604 break;
605
606 case 5: /* Address Granularity */
607
608 Descriptor->Qas.Granularity = InitializerOp->Asl.Value.Integer;
609 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
610 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Granularity));
611 break;
612
613 case 6: /* Address Min */
614
615 Descriptor->Qas.AddressMin = InitializerOp->Asl.Value.Integer;
616 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
617 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMin));
618 break;
619
620 case 7: /* Address Max */
621
622 Descriptor->Qas.AddressMax = InitializerOp->Asl.Value.Integer;
623 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
624 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMax));
625 break;
626
627 case 8: /* Translation Offset */
628
629 Descriptor->Qas.TranslationOffset = InitializerOp->Asl.Value.Integer;
630 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
631 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.TranslationOffset));
632 break;
633
634 case 9: /* Address Length */
635
636 Descriptor->Qas.AddressLength = InitializerOp->Asl.Value.Integer;
637 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
638 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressLength));
639 break;
640
641 case 10: /* ResSourceIndex [Optional Field - BYTE] */
642
643 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
644 {
645 Descriptor->Qas.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
646 OptionIndex++;
647 Descriptor->Qas.Length++;
648 }
649 break;
650
651 case 11: /* ResSource [Optional Field - STRING] */
652
653 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
654 (InitializerOp->Asl.Value.String))
655 {
656 if (StringLength)
657 {
658 Descriptor->Qas.Length = (UINT16) (Descriptor->Qas.Length + StringLength);
659
660 strcpy ((char *) &Descriptor->Qas.OptionalFields[OptionIndex],
661 InitializerOp->Asl.Value.String);
662 }
663 }
664 break;
665
666 case 12: /* ResourceTag */
667
668 UtAttachNamepathToOwner (Op, InitializerOp);
669 break;
670
671 case 13: /* Type */
672
673 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 4, 0);
674 RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
675 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 4);
676 break;
677
678 case 14: /* Translation Type */
679
680 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 5, 0);
681 RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
682 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 5);
683 break;
684
685 default:
686
687 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
688 break;
689 }
690
691 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
692 }
693
694 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
695 ASL_RESDESC_OFFSET (Qas.DescriptorType))
696 + OptionIndex + StringLength;
697 return (Rnode);
698}
699
700
701/*******************************************************************************
702 *
703 * FUNCTION: RsDoQwordMemoryDescriptor
704 *
705 * PARAMETERS: Op - Parent resource descriptor parse node
706 * CurrentByteOffset - Offset into the resource template AML
707 * buffer (to track references to the desc)
708 *
709 * RETURN: Completed resource node
710 *
711 * DESCRIPTION: Construct a long "QwordMemory" descriptor
712 *
713 ******************************************************************************/
714
715ASL_RESOURCE_NODE *
716RsDoQwordMemoryDescriptor (
717 ACPI_PARSE_OBJECT *Op,
718 UINT32 CurrentByteOffset)
719{
720 ASL_RESOURCE_DESC *Descriptor;
721 ACPI_PARSE_OBJECT *InitializerOp;
722 ASL_RESOURCE_NODE *Rnode;
723 UINT32 StringLength = 0;
724 UINT32 OptionIndex = 0;
725 UINT32 i;
726
727
728 InitializerOp = Op->Asl.Child;
729 StringLength = RsGetStringDataLength (InitializerOp);
730
731 Rnode = RsAllocateResourceNode (sizeof (ASL_QWORD_ADDRESS_DESC) +
732 StringLength);
733
734 Descriptor = Rnode->Buffer;
735 Descriptor->Qas.DescriptorType = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE;
736 Descriptor->Qas.ResourceType = ACPI_RESOURCE_TYPE_MEMORY_RANGE;
737
738 /*
739 * Initial descriptor length -- may be enlarged if there are
740 * optional fields present
741 */
742 Descriptor->Qas.Length = (UINT16) (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
743 ASL_RESDESC_OFFSET (Qas.ResourceType));
744 /*
745 * Process all child initialization nodes
746 */
747 for (i = 0; InitializerOp; i++)
748 {
749 switch (i)
750 {
751 case 0: /* Resource Type */
752
753 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 0, 1);
754 break;
755
756 case 1: /* DecodeType */
757
758 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 1, 0);
759 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
760 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 1);
761 break;
762
763 case 2: /* MinType */
764
765 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 2, 0);
766 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
767 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 2);
768 break;
769
770 case 3: /* MaxType */
771
772 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 3, 0);
773 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
774 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 3);
775 break;
776
777 case 4: /* Memory Type */
778
779 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 1, 0);
780 RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE,
781 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 1);
782 break;
783
784 case 5: /* Read/Write Type */
785
786 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 0, 1);
787 RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
788 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 0);
789 break;
790
791 case 6: /* Address Granularity */
792
793 Descriptor->Qas.Granularity = InitializerOp->Asl.Value.Integer;
794 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
795 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Granularity));
796 break;
797
798 case 7: /* Min Address */
799
800 Descriptor->Qas.AddressMin = InitializerOp->Asl.Value.Integer;
801 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
802 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMin));
803 break;
804
805 case 8: /* Max Address */
806
807 Descriptor->Qas.AddressMax = InitializerOp->Asl.Value.Integer;
808 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
809 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMax));
810 break;
811
812 case 9: /* Translation Offset */
813
814 Descriptor->Qas.TranslationOffset = InitializerOp->Asl.Value.Integer;
815 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
816 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.TranslationOffset));
817 break;
818
819 case 10: /* Address Length */
820
821 Descriptor->Qas.AddressLength = InitializerOp->Asl.Value.Integer;
822 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
823 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressLength));
824 break;
825
826 case 11: /* ResSourceIndex [Optional Field - BYTE] */
827
828 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
829 {
830 Descriptor->Qas.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
831 OptionIndex++;
832 Descriptor->Qas.Length++;
833 }
834 break;
835
836 case 12: /* ResSource [Optional Field - STRING] */
837
838 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
839 (InitializerOp->Asl.Value.String))
840 {
841 if (StringLength)
842 {
843 Descriptor->Qas.Length = (UINT16) (Descriptor->Qas.Length + StringLength);
844
845 strcpy ((char *) &Descriptor->Qas.OptionalFields[OptionIndex],
846 InitializerOp->Asl.Value.String);
847 }
848 }
849 break;
850
851 case 13: /* ResourceTag */
852
853 UtAttachNamepathToOwner (Op, InitializerOp);
854 break;
855
856
857 case 14: /* Address Range */
858
859 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 3, 0);
860 RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES,
861 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 3);
862 break;
863
864 case 15: /* Type */
865
866 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 5, 0);
867 RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
868 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 5);
869 break;
870
871 default:
872
873 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
874 break;
875 }
876
877 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
878 }
879
880 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
881 ASL_RESDESC_OFFSET (Qas.DescriptorType))
882 + OptionIndex + StringLength;
883 return (Rnode);
884}
885
886
887/*******************************************************************************
888 *
889 * FUNCTION: RsDoWordIoDescriptor
890 *
891 * PARAMETERS: Op - Parent resource descriptor parse node
892 * CurrentByteOffset - Offset into the resource template AML
893 * buffer (to track references to the desc)
894 *
895 * RETURN: Completed resource node
896 *
897 * DESCRIPTION: Construct a long "WordIO" descriptor
898 *
899 ******************************************************************************/
900
901ASL_RESOURCE_NODE *
902RsDoWordIoDescriptor (
903 ACPI_PARSE_OBJECT *Op,
904 UINT32 CurrentByteOffset)
905{
906 ASL_RESOURCE_DESC *Descriptor;
907 ACPI_PARSE_OBJECT *InitializerOp;
908 ASL_RESOURCE_NODE *Rnode;
909 UINT32 StringLength = 0;
910 UINT32 OptionIndex = 0;
911 UINT32 i;
912
913
914 InitializerOp = Op->Asl.Child;
915 StringLength = RsGetStringDataLength (InitializerOp);
916
917 Rnode = RsAllocateResourceNode (sizeof (ASL_WORD_ADDRESS_DESC) +
918 StringLength);
919
920 Descriptor = Rnode->Buffer;
921 Descriptor->Was.DescriptorType = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE;
922 Descriptor->Was.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
923
924 /*
925 * Initial descriptor length -- may be enlarged if there are
926 * optional fields present
927 */
928 Descriptor->Was.Length = (UINT16) (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
929 ASL_RESDESC_OFFSET (Was.ResourceType));
930
931 /*
932 * Process all child initialization nodes
933 */
934 for (i = 0; InitializerOp; i++)
935 {
936 switch (i)
937 {
938 case 0: /* Resource Type */
939
940 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 0, 1);
941 break;
942
943 case 1: /* MinType */
944
945 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 2, 0);
946 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
947 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 2);
948 break;
949
950 case 2: /* MaxType */
951
952 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 3, 0);
953 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
954 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 3);
955 break;
956
957 case 3: /* DecodeType */
958
959 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 1, 0);
960 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
961 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 1);
962 break;
963
964 case 4: /* Range Type */
965
966 RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 0, 3);
967 RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
968 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 0);
969 break;
970
971 case 5: /* Address Granularity */
972
973 Descriptor->Was.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
974 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
975 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Granularity));
976 break;
977
978 case 6: /* Address Min */
979
980 Descriptor->Was.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
981 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
982 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMin));
983 break;
984
985 case 7: /* Address Max */
986
987 Descriptor->Was.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
988 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
989 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMax));
990 break;
991
992 case 8: /* Translation Offset */
993
994 Descriptor->Was.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
995 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
996 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.TranslationOffset));
997 break;
998
999 case 9: /* Address Length */
1000
1001 Descriptor->Was.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
1002 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
1003 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressLength));
1004 break;
1005
1006 case 10: /* ResSourceIndex [Optional Field - BYTE] */
1007
1008 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1009 {
1010 Descriptor->Was.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1011 OptionIndex++;
1012 Descriptor->Was.Length++;
1013 }
1014 break;
1015
1016 case 11: /* ResSource [Optional Field - STRING] */
1017
1018 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
1019 (InitializerOp->Asl.Value.String))
1020 {
1021 if (StringLength)
1022 {
1023 Descriptor->Was.Length = (UINT16) (Descriptor->Was.Length +StringLength);
1024
1025 strcpy ((char *) &Descriptor->Was.OptionalFields[OptionIndex],
1026 InitializerOp->Asl.Value.String);
1027 }
1028 }
1029 break;
1030
1031 case 12: /* ResourceTag */
1032
1033 UtAttachNamepathToOwner (Op, InitializerOp);
1034 break;
1035
1036 case 13: /* Type */
1037
1038 RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 4, 0);
1039 RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
1040 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 4);
1041 break;
1042
1043 case 14: /* Translation Type */
1044
1045 RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 5, 0);
1046 RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
1047 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 5);
1048 break;
1049
1050 default:
1051
1052 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
1053 break;
1054 }
1055
1056 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1057 }
1058
1059 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
1060 ASL_RESDESC_OFFSET (Was.DescriptorType))
1061 + OptionIndex + StringLength;
1062 return (Rnode);
1063}
1064
1065
1066/*******************************************************************************
1067 *
1068 * FUNCTION: RsDoWordBusNumberDescriptor
1069 *
1070 * PARAMETERS: Op - Parent resource descriptor parse node
1071 * CurrentByteOffset - Offset into the resource template AML
1072 * buffer (to track references to the desc)
1073 *
1074 * RETURN: Completed resource node
1075 *
1076 * DESCRIPTION: Construct a long "WordBusNumber" descriptor
1077 *
1078 ******************************************************************************/
1079
1080ASL_RESOURCE_NODE *
1081RsDoWordBusNumberDescriptor (
1082 ACPI_PARSE_OBJECT *Op,
1083 UINT32 CurrentByteOffset)
1084{
1085 ASL_RESOURCE_DESC *Descriptor;
1086 ACPI_PARSE_OBJECT *InitializerOp;
1087 ASL_RESOURCE_NODE *Rnode;
1088 UINT32 StringLength = 0;
1089 UINT32 OptionIndex = 0;
1090 UINT32 i;
1091
1092
1093 InitializerOp = Op->Asl.Child;
1094 StringLength = RsGetStringDataLength (InitializerOp);
1095
1096 Rnode = RsAllocateResourceNode (sizeof (ASL_WORD_ADDRESS_DESC) +
1097 StringLength);
1098
1099 Descriptor = Rnode->Buffer;
1100 Descriptor->Was.DescriptorType = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE;
1101 Descriptor->Was.ResourceType = ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE;
1102
1103 /*
1104 * Initial descriptor length -- may be enlarged if there are
1105 * optional fields present
1106 */
1107 Descriptor->Was.Length = (UINT16) (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
1108 ASL_RESDESC_OFFSET (Was.ResourceType));
1109
1110 /*
1111 * Process all child initialization nodes
1112 */
1113 for (i = 0; InitializerOp; i++)
1114 {
1115 switch (i)
1116 {
1117 case 0: /* Resource Type */
1118
1119 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 0, 1);
1120 break;
1121
1122 case 1: /* MinType */
1123
1124 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 2, 0);
1125 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
1126 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 2);
1127 break;
1128
1129 case 2: /* MaxType */
1130
1131 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 3, 0);
1132 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
1133 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 3);
1134 break;
1135
1136 case 3: /* DecodeType */
1137
1138 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 1, 0);
1139 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
1140 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 1);
1141 break;
1142
1143 case 4: /* Address Granularity */
1144
1145 Descriptor->Was.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
1146 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
1147 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Granularity));
1148 break;
1149
1150 case 5: /* Min Address */
1151
1152 Descriptor->Was.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
1153 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
1154 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMin));
1155 break;
1156
1157 case 6: /* Max Address */
1158
1159 Descriptor->Was.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
1160 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
1161 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMax));
1162 break;
1163
1164 case 7: /* Translation Offset */
1165
1166 Descriptor->Was.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
1167 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
1168 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.TranslationOffset));
1169 break;
1170
1171 case 8: /* Address Length */
1172
1173 Descriptor->Was.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
1174 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
1175 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressLength));
1176 break;
1177
1178 case 9: /* ResSourceIndex [Optional Field - BYTE] */
1179
1180 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1181 {
1182 Descriptor->Was.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1183 OptionIndex++;
1184 Descriptor->Was.Length++;
1185 }
1186 break;
1187
1188 case 10: /* ResSource [Optional Field - STRING] */
1189
1190 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
1191 (InitializerOp->Asl.Value.String))
1192 {
1193 if (StringLength)
1194 {
1195 Descriptor->Was.Length = (UINT16) (Descriptor->Was.Length + StringLength);
1196
1197 strcpy ((char *) &Descriptor->Was.OptionalFields[OptionIndex],
1198 InitializerOp->Asl.Value.String);
1199 }
1200 }
1201 break;
1202
1203 case 11: /* ResourceTag */
1204
1205 UtAttachNamepathToOwner (Op, InitializerOp);
1206 break;
1207
1208 default:
1209
1210 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
1211 break;
1212 }
1213
1214 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1215 }
1216
1217 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
1218 ASL_RESDESC_OFFSET (Was.DescriptorType))
1219 + OptionIndex + StringLength;
1220 return (Rnode);
1221}
1222
1223
1224/*******************************************************************************
1225 *
1226 * FUNCTION: RsDoInterruptDescriptor
1227 *
1228 * PARAMETERS: Op - Parent resource descriptor parse node
1229 * CurrentByteOffset - Offset into the resource template AML
1230 * buffer (to track references to the desc)
1231 *
1232 * RETURN: Completed resource node
1233 *
1234 * DESCRIPTION: Construct a long "Interrupt" descriptor
1235 *
1236 ******************************************************************************/
1237
1238ASL_RESOURCE_NODE *
1239RsDoInterruptDescriptor (
1240 ACPI_PARSE_OBJECT *Op,
1241 UINT32 CurrentByteOffset)
1242{
1243 ASL_RESOURCE_DESC *Descriptor;
1244 ASL_RESOURCE_DESC *Rover = NULL;
1245 ACPI_PARSE_OBJECT *InitializerOp;
1246 ASL_RESOURCE_NODE *Rnode;
1247 UINT32 StringLength = 0;
1248 UINT32 OptionIndex = 0;
1249 UINT32 i;
1250 BOOLEAN HasResSourceIndex = FALSE;
1251 UINT8 ResSourceIndex = 0;
1252 UINT8 *ResSourceString = NULL;
1253
1254
1255 InitializerOp = Op->Asl.Child;
1256 StringLength = RsGetStringDataLength (InitializerOp);
1257 if (StringLength)
1258 {
1259 /* Make room for the ResourceSourceIndex */
1260
1261 OptionIndex++;
1262 }
1263
1264 /* Count the interrupt numbers */
1265
1266 for (i = 0; InitializerOp; i++)
1267 {
1268 InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
1269 if (i <= 6)
1270 {
1271 continue;
1272 }
1273
1274 OptionIndex += 4;
1275 }
1276
1277 InitializerOp = Op->Asl.Child;
1278 Rnode = RsAllocateResourceNode (sizeof (ASL_EXTENDED_XRUPT_DESC) +
1279 OptionIndex + StringLength);
1280 Descriptor = Rnode->Buffer;
1281 Descriptor->Exx.DescriptorType = ACPI_RDESC_TYPE_EXTENDED_XRUPT;
1282
1283 /*
1284 * Initial descriptor length -- may be enlarged if there are
1285 * optional fields present
1286 */
1287 Descriptor->Exx.Length = 2; /* Flags and table length byte */
1288 Descriptor->Exx.TableLength = 0;
1289
1290 Rover = ACPI_CAST_PTR (ASL_RESOURCE_DESC, (&(Descriptor->Exx.InterruptNumber[0])));
1291
1292 /*
1293 * Process all child initialization nodes
1294 */
1295 for (i = 0; InitializerOp; i++)
1296 {
1297 switch (i)
1298 {
1299 case 0: /* Resource Type (Default: consumer (1) */
1300
1301 RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 0, 1);
1302 break;
1303
1304 case 1: /* Interrupt Type (or Mode - edge/level) */
1305
1306 RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 1, 0);
1307 RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE,
1308 CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 0);
1309 break;
1310
1311 case 2: /* Interrupt Level (or Polarity - Active high/low) */
1312
1313 RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 2, 0);
1314 RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL,
1315 CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 2);
1316 break;
1317
1318 case 3: /* Share Type - Default: exclusive (0) */
1319
1320 RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 3, 0);
1321 RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE,
1322 CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 3);
1323 break;
1324
1325 case 4: /* ResSourceIndex [Optional Field - BYTE] */
1326
1327 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1328 {
1329 HasResSourceIndex = TRUE;
1330 ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
1331 }
1332 break;
1333
1334 case 5: /* ResSource [Optional Field - STRING] */
1335
1336 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
1337 (InitializerOp->Asl.Value.String))
1338 {
1339 if (StringLength)
1340 {
1341 ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String;
1342 }
1343 }
1344 break;
1345
1346 case 6: /* ResourceTag */
1347
1348 UtAttachNamepathToOwner (Op, InitializerOp);
1349 break;
1350
1351 default:
1352 /*
1353 * Interrupt Numbers come through here, repeatedly.
1354 * Store the integer and move pointer to the next one.
1355 */
1356 Rover->U32Item = (UINT32) InitializerOp->Asl.Value.Integer;
1357 Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U32Item), 4);
1358
1359 Descriptor->Exx.TableLength++;
1360 Descriptor->Exx.Length += 4;
1361
1362 if (i == 7) /* case 7: First interrupt number */
1363 {
1364 RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
1365 CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.InterruptNumber[0]));
1366 }
1367 }
1368
1369 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1370 }
1371
1372 /*
1373 * Add optional ResSourceIndex if present
1374 */
1375 if (HasResSourceIndex)
1376 {
1377 Rover->U8Item = ResSourceIndex;
1378 Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U8Item), 1);
1379 Descriptor->Exx.Length += 1;
1380 }
1381
1382 /*
1383 * Add optional ResSource string if present
1384 */
1385 if (StringLength && ResSourceString)
1386 {
1387
1388 strcpy ((char *) Rover, (char *) ResSourceString);
1389 Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U8Item), StringLength);
1390 Descriptor->Exx.Length = (UINT16) (Descriptor->Exx.Length + StringLength);
1391 }
1392
1393 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Exx.InterruptNumber[0]) -
1394 ASL_RESDESC_OFFSET (Exx.DescriptorType))
1395 + OptionIndex + StringLength;
1396 return (Rnode);
1397}
1398
1399
1400/*******************************************************************************
1401 *
1402 * FUNCTION: RsDoVendorLargeDescriptor
1403 *
1404 * PARAMETERS: Op - Parent resource descriptor parse node
1405 * CurrentByteOffset - Offset into the resource template AML
1406 * buffer (to track references to the desc)
1407 *
1408 * RETURN: Completed resource node
1409 *
1410 * DESCRIPTION: Construct a long "VendorLong" descriptor
1411 *
1412 ******************************************************************************/
1413
1414ASL_RESOURCE_NODE *
1415RsDoVendorLargeDescriptor (
1416 ACPI_PARSE_OBJECT *Op,
1417 UINT32 CurrentByteOffset)
1418{
1419 ASL_RESOURCE_DESC *Descriptor;
1420 ACPI_PARSE_OBJECT *InitializerOp;
1421 ASL_RESOURCE_NODE *Rnode;
1422 UINT32 i;
1423
1424
1425 /* Count the number of data bytes */
1426
1427 InitializerOp = Op->Asl.Child;
1428 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1429
1430 for (i = 0; InitializerOp; i++)
1431 {
1432 InitializerOp = InitializerOp->Asl.Next;
1433 }
1434
1435 InitializerOp = Op->Asl.Child;
1436 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1437 Rnode = RsAllocateResourceNode (sizeof (ASL_LARGE_VENDOR_DESC) + (i - 1));
1438
1439 Descriptor = Rnode->Buffer;
1440 Descriptor->Lgv.DescriptorType = ACPI_RDESC_TYPE_LARGE_VENDOR;
1441 Descriptor->Lgv.Length = (UINT16) i;
1442
1443 /*
1444 * Process all child initialization nodes
1445 */
1446 for (i = 0; InitializerOp; i++)
1447 {
1448 Descriptor->Lgv.VendorDefined[i] = (UINT8) InitializerOp->Asl.Value.Integer;
1449
1450 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1451 }
1452
1453 return (Rnode);
1454}
1455
1456
1457/*******************************************************************************
1458 *
1459 * FUNCTION: RsDoGeneralRegisterDescriptor
1460 *
1461 * PARAMETERS: Op - Parent resource descriptor parse node
1462 * CurrentByteOffset - Offset into the resource template AML
1463 * buffer (to track references to the desc)
1464 *
1465 * RETURN: Completed resource node
1466 *
1467 * DESCRIPTION: Construct a long "Register" descriptor
1468 *
1469 ******************************************************************************/
1470
1471ASL_RESOURCE_NODE *
1472RsDoGeneralRegisterDescriptor (
1473 ACPI_PARSE_OBJECT *Op,
1474 UINT32 CurrentByteOffset)
1475{
1476 ASL_RESOURCE_DESC *Descriptor;
1477 ACPI_PARSE_OBJECT *InitializerOp;
1478 ASL_RESOURCE_NODE *Rnode;
1479 UINT32 i;
1480
1481
1482 InitializerOp = Op->Asl.Child;
1483 Rnode = RsAllocateResourceNode (sizeof (ASL_GENERAL_REGISTER_DESC));
1484
1485 Descriptor = Rnode->Buffer;
1486 Descriptor->Grg.DescriptorType = ACPI_RDESC_TYPE_GENERAL_REGISTER;
1487 Descriptor->Grg.Length = 12;
1488
1489 /*
1490 * Process all child initialization nodes
1491 */
1492 for (i = 0; InitializerOp; i++)
1493 {
1494 switch (i)
1495 {
1496 case 0: /* Address space */
1497
1498 Descriptor->Grg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer;
1499 RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESSSPACE,
1500 CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.AddressSpaceId));
1501 break;
1502
1503 case 1: /* Register Bit Width */
1504
1505 Descriptor->Grg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer;
1506 RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITWIDTH,
1507 CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.BitWidth));
1508 break;
1509
1510 case 2: /* Register Bit Offset */
1511
1512 Descriptor->Grg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
1513 RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITOFFSET,
1514 CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.BitOffset));
1515 break;
1516
1517 case 3: /* Register Address */
1518
1519 Descriptor->Grg.Address = InitializerOp->Asl.Value.Integer;
1520 RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESS,
1521 CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.Address));
1522 break;
1523
1524
1525 default:
1526
1527 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
1528 break;
1529 }
1530
1531 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1532 }
1533 return (Rnode);
1534}
1535
1536
2/******************************************************************************
3 *
4 * Module Name: aslrestype2 - Long (type2) resource templates and descriptors
5 * $Revision: 26 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.
22 *
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
29 *
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code. No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
38 *
39 * The above copyright and patent license is granted only if the following
40 * conditions are met:
41 *
42 * 3. Conditions
43 *
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision. In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change. Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee. Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
55 *
56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57 * Redistribution of source code of any substantial portion of the Covered
58 * Code or modification without rights to further distribute source must
59 * include the following Disclaimer and Export Compliance provision in the
60 * documentation and/or other materials provided with distribution. In
61 * addition, Licensee may not authorize further sublicense of source of any
62 * portion of the Covered Code, and must include terms to the effect that the
63 * license from Licensee to its licensee is limited to the intellectual
64 * property embodied in the software Licensee provides to its licensee, and
65 * not to intellectual property embodied in modifications its licensee may
66 * make.
67 *
68 * 3.3. Redistribution of Executable. Redistribution in executable form of any
69 * substantial portion of the Covered Code or modification must reproduce the
70 * above Copyright Notice, and the following Disclaimer and Export Compliance
71 * provision in the documentation and/or other materials provided with the
72 * distribution.
73 *
74 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * Intel Code.
76 *
77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78 * Intel shall be used in advertising or otherwise to promote the sale, use or
79 * other dealings in products derived from or relating to the Covered Code
80 * without prior written authorization from Intel.
81 *
82 * 4. Disclaimer and Export Compliance
83 *
84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
87 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * PARTICULAR PURPOSE.
91 *
92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * LIMITED REMEDY.
100 *
101 * 4.3. Licensee shall not export, either directly or indirectly, any of this
102 * software or system incorporating such software without first obtaining any
103 * required license or other approval from the U. S. Department of Commerce or
104 * any other agency or department of the United States Government. In the
105 * event Licensee exports any such software from the United States or
106 * re-exports any such software from a foreign destination, Licensee shall
107 * ensure that the distribution and export/re-export of the software is in
108 * compliance with all laws, regulations, orders, or other restrictions of the
109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110 * any of its subsidiaries will export/re-export any technical data, process,
111 * software, or service, directly or indirectly, to any country for which the
112 * United States government or any agency thereof requires an export license,
113 * other governmental approval, or letter of assurance, without first obtaining
114 * such license, approval or letter.
115 *
116 *****************************************************************************/
117
118
119#include "aslcompiler.h"
120#include "aslcompiler.y.h"
121
122#define _COMPONENT ACPI_COMPILER
123 ACPI_MODULE_NAME ("aslrestype2")
124
125
126/*******************************************************************************
127 *
128 * FUNCTION: RsGetStringDataLength
129 *
130 * PARAMETERS: InitializerOp - Start of a subtree of init nodes
131 *
132 * RETURN: Valid string length if a string node is found
133 *
134 * DESCRIPTION: In a list of peer nodes, find the first one that contains a
135 * string and return the length of the string.
136 *
137 ******************************************************************************/
138
139UINT32
140RsGetStringDataLength (
141 ACPI_PARSE_OBJECT *InitializerOp)
142{
143
144 while (InitializerOp)
145 {
146 if (InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
147 {
148 return (strlen (InitializerOp->Asl.Value.String) + 1);
149 }
150 InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
151 }
152
153 return 0;
154}
155
156
157/*******************************************************************************
158 *
159 * FUNCTION: RsDoDwordIoDescriptor
160 *
161 * PARAMETERS: Op - Parent resource descriptor parse node
162 * CurrentByteOffset - Offset into the resource template AML
163 * buffer (to track references to the desc)
164 *
165 * RETURN: Completed resource node
166 *
167 * DESCRIPTION: Construct a long "DwordIO" descriptor
168 *
169 ******************************************************************************/
170
171ASL_RESOURCE_NODE *
172RsDoDwordIoDescriptor (
173 ACPI_PARSE_OBJECT *Op,
174 UINT32 CurrentByteOffset)
175{
176 ASL_RESOURCE_DESC *Descriptor;
177 ACPI_PARSE_OBJECT *InitializerOp;
178 ASL_RESOURCE_NODE *Rnode;
179 UINT32 StringLength = 0;
180 UINT32 OptionIndex = 0;
181 UINT32 i;
182
183
184 InitializerOp = Op->Asl.Child;
185 StringLength = RsGetStringDataLength (InitializerOp);
186
187 Rnode = RsAllocateResourceNode (sizeof (ASL_DWORD_ADDRESS_DESC) +
188 StringLength);
189
190 Descriptor = Rnode->Buffer;
191 Descriptor->Das.DescriptorType = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE;
192 Descriptor->Das.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
193
194 /*
195 * Initial descriptor length -- may be enlarged if there are
196 * optional fields present
197 */
198 Descriptor->Das.Length = (UINT16) (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
199 ASL_RESDESC_OFFSET (Das.ResourceType));
200
201 /*
202 * Process all child initialization nodes
203 */
204 for (i = 0; InitializerOp; i++)
205 {
206 switch (i)
207 {
208 case 0: /* Resource Type */
209
210 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 0, 1);
211 break;
212
213 case 1: /* MinType */
214
215 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 2, 0);
216 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
217 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 2);
218 break;
219
220 case 2: /* MaxType */
221
222 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 3, 0);
223 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
224 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 3);
225 break;
226
227 case 3: /* DecodeType */
228
229 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 1, 0);
230 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
231 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 1);
232 break;
233
234 case 4: /* Range Type */
235
236 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 0, 3);
237 RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
238 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 0);
239 break;
240
241 case 5: /* Address Granularity */
242
243 Descriptor->Das.Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
244 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
245 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Granularity));
246 break;
247
248 case 6: /* Address Min */
249
250 Descriptor->Das.AddressMin = (UINT32) InitializerOp->Asl.Value.Integer;
251 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
252 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMin));
253 break;
254
255 case 7: /* Address Max */
256
257 Descriptor->Das.AddressMax = (UINT32) InitializerOp->Asl.Value.Integer;
258 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
259 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMax));
260 break;
261
262 case 8: /* Translation Offset */
263
264 Descriptor->Das.TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
265 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
266 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.TranslationOffset));
267 break;
268
269 case 9: /* Address Length */
270
271 Descriptor->Das.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
272 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
273 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressLength));
274 break;
275
276 case 10: /* ResSourceIndex [Optional Field - BYTE] */
277
278 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
279 {
280 Descriptor->Das.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
281 OptionIndex++;
282 Descriptor->Das.Length++;
283 }
284 break;
285
286 case 11: /* ResSource [Optional Field - STRING] */
287
288 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
289 (InitializerOp->Asl.Value.String))
290 {
291 if (StringLength)
292 {
293 Descriptor->Das.Length = (UINT16) (Descriptor->Das.Length + StringLength);
294
295 strcpy ((char *) &Descriptor->Das.OptionalFields[OptionIndex],
296 InitializerOp->Asl.Value.String);
297 }
298 }
299 break;
300
301 case 12: /* ResourceTag */
302
303 UtAttachNamepathToOwner (Op, InitializerOp);
304 break;
305
306 case 13: /* Type */
307
308 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 4, 0);
309 RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
310 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 4);
311 break;
312
313 case 14: /* Translation Type */
314
315 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 5, 0);
316 RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
317 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 5);
318 break;
319
320 default:
321
322 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
323 break;
324 }
325
326 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
327 }
328
329 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
330 ASL_RESDESC_OFFSET (Das.DescriptorType))
331 + OptionIndex + StringLength;
332 return (Rnode);
333}
334
335
336/*******************************************************************************
337 *
338 * FUNCTION: RsDoDwordMemoryDescriptor
339 *
340 * PARAMETERS: Op - Parent resource descriptor parse node
341 * CurrentByteOffset - Offset into the resource template AML
342 * buffer (to track references to the desc)
343 *
344 * RETURN: Completed resource node
345 *
346 * DESCRIPTION: Construct a long "DwordMemory" descriptor
347 *
348 ******************************************************************************/
349
350ASL_RESOURCE_NODE *
351RsDoDwordMemoryDescriptor (
352 ACPI_PARSE_OBJECT *Op,
353 UINT32 CurrentByteOffset)
354{
355 ASL_RESOURCE_DESC *Descriptor;
356 ACPI_PARSE_OBJECT *InitializerOp;
357 ASL_RESOURCE_NODE *Rnode;
358 UINT32 StringLength = 0;
359 UINT32 OptionIndex = 0;
360 UINT32 i;
361
362
363 InitializerOp = Op->Asl.Child;
364 StringLength = RsGetStringDataLength (InitializerOp);
365
366 Rnode = RsAllocateResourceNode (sizeof (ASL_DWORD_ADDRESS_DESC) +
367 StringLength);
368
369 Descriptor = Rnode->Buffer;
370 Descriptor->Das.DescriptorType = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE;
371 Descriptor->Das.ResourceType = ACPI_RESOURCE_TYPE_MEMORY_RANGE;
372
373 /*
374 * Initial descriptor length -- may be enlarged if there are
375 * optional fields present
376 */
377 Descriptor->Das.Length = (UINT16) (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
378 ASL_RESDESC_OFFSET (Das.ResourceType));
379
380 /*
381 * Process all child initialization nodes
382 */
383 for (i = 0; InitializerOp; i++)
384 {
385 switch (i)
386 {
387 case 0: /* Resource Type */
388
389 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 0, 1);
390 break;
391
392 case 1: /* DecodeType */
393
394 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 1, 0);
395 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
396 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 1);
397 break;
398
399 case 2: /* MinType */
400
401 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 2, 0);
402 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
403 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 2);
404 break;
405
406 case 3: /* MaxType */
407
408 RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 3, 0);
409 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
410 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 3);
411 break;
412
413 case 4: /* Memory Type */
414
415 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 1, 0);
416 RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE,
417 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 1);
418 break;
419
420 case 5: /* Read/Write Type */
421
422 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 0, 1);
423 RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
424 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 0);
425 break;
426
427 case 6: /* Address Granularity */
428
429 Descriptor->Das.Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
430 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
431 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Granularity));
432 break;
433
434 case 7: /* Min Address */
435
436 Descriptor->Das.AddressMin = (UINT32) InitializerOp->Asl.Value.Integer;
437 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
438 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMin));
439 break;
440
441 case 8: /* Max Address */
442
443 Descriptor->Das.AddressMax = (UINT32) InitializerOp->Asl.Value.Integer;
444 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
445 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMax));
446 break;
447
448 case 9: /* Translation Offset */
449
450 Descriptor->Das.TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
451 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
452 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.TranslationOffset));
453 break;
454
455 case 10: /* Address Length */
456
457 Descriptor->Das.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
458 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
459 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressLength));
460 break;
461
462 case 11: /* ResSourceIndex [Optional Field - BYTE] */
463
464 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
465 {
466 Descriptor->Das.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
467 OptionIndex++;
468 Descriptor->Das.Length++;
469 }
470 break;
471
472 case 12: /* ResSource [Optional Field - STRING] */
473
474 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
475 (InitializerOp->Asl.Value.String))
476 {
477 if (StringLength)
478 {
479 Descriptor->Das.Length = (UINT16) (Descriptor->Das.Length + StringLength);
480
481 strcpy ((char *) &Descriptor->Das.OptionalFields[OptionIndex],
482 InitializerOp->Asl.Value.String);
483 }
484 }
485 break;
486
487 case 13: /* ResourceTag */
488
489 UtAttachNamepathToOwner (Op, InitializerOp);
490 break;
491
492
493 case 14: /* Address Range */
494
495 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 3, 0);
496 RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES,
497 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 3);
498 break;
499
500 case 15: /* Type */
501
502 RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 5, 0);
503 RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
504 CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 5);
505 break;
506
507 default:
508
509 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
510 break;
511 }
512
513 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
514 }
515
516 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
517 ASL_RESDESC_OFFSET (Das.DescriptorType))
518 + OptionIndex + StringLength;
519 return (Rnode);
520}
521
522
523/*******************************************************************************
524 *
525 * FUNCTION: RsDoQwordIoDescriptor
526 *
527 * PARAMETERS: Op - Parent resource descriptor parse node
528 * CurrentByteOffset - Offset into the resource template AML
529 * buffer (to track references to the desc)
530 *
531 * RETURN: Completed resource node
532 *
533 * DESCRIPTION: Construct a long "QwordIO" descriptor
534 *
535 ******************************************************************************/
536
537ASL_RESOURCE_NODE *
538RsDoQwordIoDescriptor (
539 ACPI_PARSE_OBJECT *Op,
540 UINT32 CurrentByteOffset)
541{
542 ASL_RESOURCE_DESC *Descriptor;
543 ACPI_PARSE_OBJECT *InitializerOp;
544 ASL_RESOURCE_NODE *Rnode;
545 UINT32 StringLength = 0;
546 UINT32 OptionIndex = 0;
547 UINT32 i;
548
549
550 InitializerOp = Op->Asl.Child;
551 StringLength = RsGetStringDataLength (InitializerOp);
552
553 Rnode = RsAllocateResourceNode (sizeof (ASL_QWORD_ADDRESS_DESC) +
554 StringLength);
555
556 Descriptor = Rnode->Buffer;
557 Descriptor->Qas.DescriptorType = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE;
558 Descriptor->Qas.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
559
560 /*
561 * Initial descriptor length -- may be enlarged if there are
562 * optional fields present
563 */
564 Descriptor->Qas.Length = (UINT16) (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
565 ASL_RESDESC_OFFSET (Qas.ResourceType));
566 /*
567 * Process all child initialization nodes
568 */
569 for (i = 0; InitializerOp; i++)
570 {
571 switch (i)
572 {
573 case 0: /* Resource Type */
574
575 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 0, 1);
576 break;
577
578 case 1: /* MinType */
579
580 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 2, 0);
581 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
582 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 2);
583 break;
584
585 case 2: /* MaxType */
586
587 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 3, 0);
588 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
589 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 3);
590 break;
591
592 case 3: /* DecodeType */
593
594 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 1, 0);
595 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
596 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 1);
597 break;
598
599 case 4: /* Range Type */
600
601 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 0, 3);
602 RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
603 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 0);
604 break;
605
606 case 5: /* Address Granularity */
607
608 Descriptor->Qas.Granularity = InitializerOp->Asl.Value.Integer;
609 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
610 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Granularity));
611 break;
612
613 case 6: /* Address Min */
614
615 Descriptor->Qas.AddressMin = InitializerOp->Asl.Value.Integer;
616 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
617 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMin));
618 break;
619
620 case 7: /* Address Max */
621
622 Descriptor->Qas.AddressMax = InitializerOp->Asl.Value.Integer;
623 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
624 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMax));
625 break;
626
627 case 8: /* Translation Offset */
628
629 Descriptor->Qas.TranslationOffset = InitializerOp->Asl.Value.Integer;
630 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
631 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.TranslationOffset));
632 break;
633
634 case 9: /* Address Length */
635
636 Descriptor->Qas.AddressLength = InitializerOp->Asl.Value.Integer;
637 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
638 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressLength));
639 break;
640
641 case 10: /* ResSourceIndex [Optional Field - BYTE] */
642
643 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
644 {
645 Descriptor->Qas.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
646 OptionIndex++;
647 Descriptor->Qas.Length++;
648 }
649 break;
650
651 case 11: /* ResSource [Optional Field - STRING] */
652
653 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
654 (InitializerOp->Asl.Value.String))
655 {
656 if (StringLength)
657 {
658 Descriptor->Qas.Length = (UINT16) (Descriptor->Qas.Length + StringLength);
659
660 strcpy ((char *) &Descriptor->Qas.OptionalFields[OptionIndex],
661 InitializerOp->Asl.Value.String);
662 }
663 }
664 break;
665
666 case 12: /* ResourceTag */
667
668 UtAttachNamepathToOwner (Op, InitializerOp);
669 break;
670
671 case 13: /* Type */
672
673 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 4, 0);
674 RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
675 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 4);
676 break;
677
678 case 14: /* Translation Type */
679
680 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 5, 0);
681 RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
682 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 5);
683 break;
684
685 default:
686
687 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
688 break;
689 }
690
691 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
692 }
693
694 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
695 ASL_RESDESC_OFFSET (Qas.DescriptorType))
696 + OptionIndex + StringLength;
697 return (Rnode);
698}
699
700
701/*******************************************************************************
702 *
703 * FUNCTION: RsDoQwordMemoryDescriptor
704 *
705 * PARAMETERS: Op - Parent resource descriptor parse node
706 * CurrentByteOffset - Offset into the resource template AML
707 * buffer (to track references to the desc)
708 *
709 * RETURN: Completed resource node
710 *
711 * DESCRIPTION: Construct a long "QwordMemory" descriptor
712 *
713 ******************************************************************************/
714
715ASL_RESOURCE_NODE *
716RsDoQwordMemoryDescriptor (
717 ACPI_PARSE_OBJECT *Op,
718 UINT32 CurrentByteOffset)
719{
720 ASL_RESOURCE_DESC *Descriptor;
721 ACPI_PARSE_OBJECT *InitializerOp;
722 ASL_RESOURCE_NODE *Rnode;
723 UINT32 StringLength = 0;
724 UINT32 OptionIndex = 0;
725 UINT32 i;
726
727
728 InitializerOp = Op->Asl.Child;
729 StringLength = RsGetStringDataLength (InitializerOp);
730
731 Rnode = RsAllocateResourceNode (sizeof (ASL_QWORD_ADDRESS_DESC) +
732 StringLength);
733
734 Descriptor = Rnode->Buffer;
735 Descriptor->Qas.DescriptorType = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE;
736 Descriptor->Qas.ResourceType = ACPI_RESOURCE_TYPE_MEMORY_RANGE;
737
738 /*
739 * Initial descriptor length -- may be enlarged if there are
740 * optional fields present
741 */
742 Descriptor->Qas.Length = (UINT16) (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
743 ASL_RESDESC_OFFSET (Qas.ResourceType));
744 /*
745 * Process all child initialization nodes
746 */
747 for (i = 0; InitializerOp; i++)
748 {
749 switch (i)
750 {
751 case 0: /* Resource Type */
752
753 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 0, 1);
754 break;
755
756 case 1: /* DecodeType */
757
758 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 1, 0);
759 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
760 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 1);
761 break;
762
763 case 2: /* MinType */
764
765 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 2, 0);
766 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
767 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 2);
768 break;
769
770 case 3: /* MaxType */
771
772 RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 3, 0);
773 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
774 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 3);
775 break;
776
777 case 4: /* Memory Type */
778
779 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 1, 0);
780 RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE,
781 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 1);
782 break;
783
784 case 5: /* Read/Write Type */
785
786 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 0, 1);
787 RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
788 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 0);
789 break;
790
791 case 6: /* Address Granularity */
792
793 Descriptor->Qas.Granularity = InitializerOp->Asl.Value.Integer;
794 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
795 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Granularity));
796 break;
797
798 case 7: /* Min Address */
799
800 Descriptor->Qas.AddressMin = InitializerOp->Asl.Value.Integer;
801 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
802 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMin));
803 break;
804
805 case 8: /* Max Address */
806
807 Descriptor->Qas.AddressMax = InitializerOp->Asl.Value.Integer;
808 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
809 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMax));
810 break;
811
812 case 9: /* Translation Offset */
813
814 Descriptor->Qas.TranslationOffset = InitializerOp->Asl.Value.Integer;
815 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
816 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.TranslationOffset));
817 break;
818
819 case 10: /* Address Length */
820
821 Descriptor->Qas.AddressLength = InitializerOp->Asl.Value.Integer;
822 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
823 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressLength));
824 break;
825
826 case 11: /* ResSourceIndex [Optional Field - BYTE] */
827
828 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
829 {
830 Descriptor->Qas.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
831 OptionIndex++;
832 Descriptor->Qas.Length++;
833 }
834 break;
835
836 case 12: /* ResSource [Optional Field - STRING] */
837
838 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
839 (InitializerOp->Asl.Value.String))
840 {
841 if (StringLength)
842 {
843 Descriptor->Qas.Length = (UINT16) (Descriptor->Qas.Length + StringLength);
844
845 strcpy ((char *) &Descriptor->Qas.OptionalFields[OptionIndex],
846 InitializerOp->Asl.Value.String);
847 }
848 }
849 break;
850
851 case 13: /* ResourceTag */
852
853 UtAttachNamepathToOwner (Op, InitializerOp);
854 break;
855
856
857 case 14: /* Address Range */
858
859 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 3, 0);
860 RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES,
861 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 3);
862 break;
863
864 case 15: /* Type */
865
866 RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 5, 0);
867 RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
868 CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 5);
869 break;
870
871 default:
872
873 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
874 break;
875 }
876
877 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
878 }
879
880 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
881 ASL_RESDESC_OFFSET (Qas.DescriptorType))
882 + OptionIndex + StringLength;
883 return (Rnode);
884}
885
886
887/*******************************************************************************
888 *
889 * FUNCTION: RsDoWordIoDescriptor
890 *
891 * PARAMETERS: Op - Parent resource descriptor parse node
892 * CurrentByteOffset - Offset into the resource template AML
893 * buffer (to track references to the desc)
894 *
895 * RETURN: Completed resource node
896 *
897 * DESCRIPTION: Construct a long "WordIO" descriptor
898 *
899 ******************************************************************************/
900
901ASL_RESOURCE_NODE *
902RsDoWordIoDescriptor (
903 ACPI_PARSE_OBJECT *Op,
904 UINT32 CurrentByteOffset)
905{
906 ASL_RESOURCE_DESC *Descriptor;
907 ACPI_PARSE_OBJECT *InitializerOp;
908 ASL_RESOURCE_NODE *Rnode;
909 UINT32 StringLength = 0;
910 UINT32 OptionIndex = 0;
911 UINT32 i;
912
913
914 InitializerOp = Op->Asl.Child;
915 StringLength = RsGetStringDataLength (InitializerOp);
916
917 Rnode = RsAllocateResourceNode (sizeof (ASL_WORD_ADDRESS_DESC) +
918 StringLength);
919
920 Descriptor = Rnode->Buffer;
921 Descriptor->Was.DescriptorType = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE;
922 Descriptor->Was.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
923
924 /*
925 * Initial descriptor length -- may be enlarged if there are
926 * optional fields present
927 */
928 Descriptor->Was.Length = (UINT16) (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
929 ASL_RESDESC_OFFSET (Was.ResourceType));
930
931 /*
932 * Process all child initialization nodes
933 */
934 for (i = 0; InitializerOp; i++)
935 {
936 switch (i)
937 {
938 case 0: /* Resource Type */
939
940 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 0, 1);
941 break;
942
943 case 1: /* MinType */
944
945 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 2, 0);
946 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
947 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 2);
948 break;
949
950 case 2: /* MaxType */
951
952 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 3, 0);
953 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
954 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 3);
955 break;
956
957 case 3: /* DecodeType */
958
959 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 1, 0);
960 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
961 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 1);
962 break;
963
964 case 4: /* Range Type */
965
966 RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 0, 3);
967 RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
968 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 0);
969 break;
970
971 case 5: /* Address Granularity */
972
973 Descriptor->Was.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
974 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
975 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Granularity));
976 break;
977
978 case 6: /* Address Min */
979
980 Descriptor->Was.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
981 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
982 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMin));
983 break;
984
985 case 7: /* Address Max */
986
987 Descriptor->Was.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
988 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
989 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMax));
990 break;
991
992 case 8: /* Translation Offset */
993
994 Descriptor->Was.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
995 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
996 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.TranslationOffset));
997 break;
998
999 case 9: /* Address Length */
1000
1001 Descriptor->Was.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
1002 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
1003 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressLength));
1004 break;
1005
1006 case 10: /* ResSourceIndex [Optional Field - BYTE] */
1007
1008 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1009 {
1010 Descriptor->Was.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1011 OptionIndex++;
1012 Descriptor->Was.Length++;
1013 }
1014 break;
1015
1016 case 11: /* ResSource [Optional Field - STRING] */
1017
1018 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
1019 (InitializerOp->Asl.Value.String))
1020 {
1021 if (StringLength)
1022 {
1023 Descriptor->Was.Length = (UINT16) (Descriptor->Was.Length +StringLength);
1024
1025 strcpy ((char *) &Descriptor->Was.OptionalFields[OptionIndex],
1026 InitializerOp->Asl.Value.String);
1027 }
1028 }
1029 break;
1030
1031 case 12: /* ResourceTag */
1032
1033 UtAttachNamepathToOwner (Op, InitializerOp);
1034 break;
1035
1036 case 13: /* Type */
1037
1038 RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 4, 0);
1039 RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
1040 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 4);
1041 break;
1042
1043 case 14: /* Translation Type */
1044
1045 RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 5, 0);
1046 RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
1047 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 5);
1048 break;
1049
1050 default:
1051
1052 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
1053 break;
1054 }
1055
1056 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1057 }
1058
1059 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
1060 ASL_RESDESC_OFFSET (Was.DescriptorType))
1061 + OptionIndex + StringLength;
1062 return (Rnode);
1063}
1064
1065
1066/*******************************************************************************
1067 *
1068 * FUNCTION: RsDoWordBusNumberDescriptor
1069 *
1070 * PARAMETERS: Op - Parent resource descriptor parse node
1071 * CurrentByteOffset - Offset into the resource template AML
1072 * buffer (to track references to the desc)
1073 *
1074 * RETURN: Completed resource node
1075 *
1076 * DESCRIPTION: Construct a long "WordBusNumber" descriptor
1077 *
1078 ******************************************************************************/
1079
1080ASL_RESOURCE_NODE *
1081RsDoWordBusNumberDescriptor (
1082 ACPI_PARSE_OBJECT *Op,
1083 UINT32 CurrentByteOffset)
1084{
1085 ASL_RESOURCE_DESC *Descriptor;
1086 ACPI_PARSE_OBJECT *InitializerOp;
1087 ASL_RESOURCE_NODE *Rnode;
1088 UINT32 StringLength = 0;
1089 UINT32 OptionIndex = 0;
1090 UINT32 i;
1091
1092
1093 InitializerOp = Op->Asl.Child;
1094 StringLength = RsGetStringDataLength (InitializerOp);
1095
1096 Rnode = RsAllocateResourceNode (sizeof (ASL_WORD_ADDRESS_DESC) +
1097 StringLength);
1098
1099 Descriptor = Rnode->Buffer;
1100 Descriptor->Was.DescriptorType = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE;
1101 Descriptor->Was.ResourceType = ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE;
1102
1103 /*
1104 * Initial descriptor length -- may be enlarged if there are
1105 * optional fields present
1106 */
1107 Descriptor->Was.Length = (UINT16) (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
1108 ASL_RESDESC_OFFSET (Was.ResourceType));
1109
1110 /*
1111 * Process all child initialization nodes
1112 */
1113 for (i = 0; InitializerOp; i++)
1114 {
1115 switch (i)
1116 {
1117 case 0: /* Resource Type */
1118
1119 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 0, 1);
1120 break;
1121
1122 case 1: /* MinType */
1123
1124 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 2, 0);
1125 RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
1126 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 2);
1127 break;
1128
1129 case 2: /* MaxType */
1130
1131 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 3, 0);
1132 RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
1133 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 3);
1134 break;
1135
1136 case 3: /* DecodeType */
1137
1138 RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 1, 0);
1139 RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
1140 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 1);
1141 break;
1142
1143 case 4: /* Address Granularity */
1144
1145 Descriptor->Was.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
1146 RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
1147 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Granularity));
1148 break;
1149
1150 case 5: /* Min Address */
1151
1152 Descriptor->Was.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
1153 RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
1154 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMin));
1155 break;
1156
1157 case 6: /* Max Address */
1158
1159 Descriptor->Was.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
1160 RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
1161 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMax));
1162 break;
1163
1164 case 7: /* Translation Offset */
1165
1166 Descriptor->Was.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
1167 RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
1168 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.TranslationOffset));
1169 break;
1170
1171 case 8: /* Address Length */
1172
1173 Descriptor->Was.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
1174 RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
1175 CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressLength));
1176 break;
1177
1178 case 9: /* ResSourceIndex [Optional Field - BYTE] */
1179
1180 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1181 {
1182 Descriptor->Was.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1183 OptionIndex++;
1184 Descriptor->Was.Length++;
1185 }
1186 break;
1187
1188 case 10: /* ResSource [Optional Field - STRING] */
1189
1190 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
1191 (InitializerOp->Asl.Value.String))
1192 {
1193 if (StringLength)
1194 {
1195 Descriptor->Was.Length = (UINT16) (Descriptor->Was.Length + StringLength);
1196
1197 strcpy ((char *) &Descriptor->Was.OptionalFields[OptionIndex],
1198 InitializerOp->Asl.Value.String);
1199 }
1200 }
1201 break;
1202
1203 case 11: /* ResourceTag */
1204
1205 UtAttachNamepathToOwner (Op, InitializerOp);
1206 break;
1207
1208 default:
1209
1210 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
1211 break;
1212 }
1213
1214 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1215 }
1216
1217 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
1218 ASL_RESDESC_OFFSET (Was.DescriptorType))
1219 + OptionIndex + StringLength;
1220 return (Rnode);
1221}
1222
1223
1224/*******************************************************************************
1225 *
1226 * FUNCTION: RsDoInterruptDescriptor
1227 *
1228 * PARAMETERS: Op - Parent resource descriptor parse node
1229 * CurrentByteOffset - Offset into the resource template AML
1230 * buffer (to track references to the desc)
1231 *
1232 * RETURN: Completed resource node
1233 *
1234 * DESCRIPTION: Construct a long "Interrupt" descriptor
1235 *
1236 ******************************************************************************/
1237
1238ASL_RESOURCE_NODE *
1239RsDoInterruptDescriptor (
1240 ACPI_PARSE_OBJECT *Op,
1241 UINT32 CurrentByteOffset)
1242{
1243 ASL_RESOURCE_DESC *Descriptor;
1244 ASL_RESOURCE_DESC *Rover = NULL;
1245 ACPI_PARSE_OBJECT *InitializerOp;
1246 ASL_RESOURCE_NODE *Rnode;
1247 UINT32 StringLength = 0;
1248 UINT32 OptionIndex = 0;
1249 UINT32 i;
1250 BOOLEAN HasResSourceIndex = FALSE;
1251 UINT8 ResSourceIndex = 0;
1252 UINT8 *ResSourceString = NULL;
1253
1254
1255 InitializerOp = Op->Asl.Child;
1256 StringLength = RsGetStringDataLength (InitializerOp);
1257 if (StringLength)
1258 {
1259 /* Make room for the ResourceSourceIndex */
1260
1261 OptionIndex++;
1262 }
1263
1264 /* Count the interrupt numbers */
1265
1266 for (i = 0; InitializerOp; i++)
1267 {
1268 InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
1269 if (i <= 6)
1270 {
1271 continue;
1272 }
1273
1274 OptionIndex += 4;
1275 }
1276
1277 InitializerOp = Op->Asl.Child;
1278 Rnode = RsAllocateResourceNode (sizeof (ASL_EXTENDED_XRUPT_DESC) +
1279 OptionIndex + StringLength);
1280 Descriptor = Rnode->Buffer;
1281 Descriptor->Exx.DescriptorType = ACPI_RDESC_TYPE_EXTENDED_XRUPT;
1282
1283 /*
1284 * Initial descriptor length -- may be enlarged if there are
1285 * optional fields present
1286 */
1287 Descriptor->Exx.Length = 2; /* Flags and table length byte */
1288 Descriptor->Exx.TableLength = 0;
1289
1290 Rover = ACPI_CAST_PTR (ASL_RESOURCE_DESC, (&(Descriptor->Exx.InterruptNumber[0])));
1291
1292 /*
1293 * Process all child initialization nodes
1294 */
1295 for (i = 0; InitializerOp; i++)
1296 {
1297 switch (i)
1298 {
1299 case 0: /* Resource Type (Default: consumer (1) */
1300
1301 RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 0, 1);
1302 break;
1303
1304 case 1: /* Interrupt Type (or Mode - edge/level) */
1305
1306 RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 1, 0);
1307 RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE,
1308 CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 0);
1309 break;
1310
1311 case 2: /* Interrupt Level (or Polarity - Active high/low) */
1312
1313 RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 2, 0);
1314 RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL,
1315 CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 2);
1316 break;
1317
1318 case 3: /* Share Type - Default: exclusive (0) */
1319
1320 RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 3, 0);
1321 RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE,
1322 CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 3);
1323 break;
1324
1325 case 4: /* ResSourceIndex [Optional Field - BYTE] */
1326
1327 if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
1328 {
1329 HasResSourceIndex = TRUE;
1330 ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer;
1331 }
1332 break;
1333
1334 case 5: /* ResSource [Optional Field - STRING] */
1335
1336 if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
1337 (InitializerOp->Asl.Value.String))
1338 {
1339 if (StringLength)
1340 {
1341 ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String;
1342 }
1343 }
1344 break;
1345
1346 case 6: /* ResourceTag */
1347
1348 UtAttachNamepathToOwner (Op, InitializerOp);
1349 break;
1350
1351 default:
1352 /*
1353 * Interrupt Numbers come through here, repeatedly.
1354 * Store the integer and move pointer to the next one.
1355 */
1356 Rover->U32Item = (UINT32) InitializerOp->Asl.Value.Integer;
1357 Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U32Item), 4);
1358
1359 Descriptor->Exx.TableLength++;
1360 Descriptor->Exx.Length += 4;
1361
1362 if (i == 7) /* case 7: First interrupt number */
1363 {
1364 RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
1365 CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.InterruptNumber[0]));
1366 }
1367 }
1368
1369 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1370 }
1371
1372 /*
1373 * Add optional ResSourceIndex if present
1374 */
1375 if (HasResSourceIndex)
1376 {
1377 Rover->U8Item = ResSourceIndex;
1378 Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U8Item), 1);
1379 Descriptor->Exx.Length += 1;
1380 }
1381
1382 /*
1383 * Add optional ResSource string if present
1384 */
1385 if (StringLength && ResSourceString)
1386 {
1387
1388 strcpy ((char *) Rover, (char *) ResSourceString);
1389 Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U8Item), StringLength);
1390 Descriptor->Exx.Length = (UINT16) (Descriptor->Exx.Length + StringLength);
1391 }
1392
1393 Rnode->BufferLength = (ASL_RESDESC_OFFSET (Exx.InterruptNumber[0]) -
1394 ASL_RESDESC_OFFSET (Exx.DescriptorType))
1395 + OptionIndex + StringLength;
1396 return (Rnode);
1397}
1398
1399
1400/*******************************************************************************
1401 *
1402 * FUNCTION: RsDoVendorLargeDescriptor
1403 *
1404 * PARAMETERS: Op - Parent resource descriptor parse node
1405 * CurrentByteOffset - Offset into the resource template AML
1406 * buffer (to track references to the desc)
1407 *
1408 * RETURN: Completed resource node
1409 *
1410 * DESCRIPTION: Construct a long "VendorLong" descriptor
1411 *
1412 ******************************************************************************/
1413
1414ASL_RESOURCE_NODE *
1415RsDoVendorLargeDescriptor (
1416 ACPI_PARSE_OBJECT *Op,
1417 UINT32 CurrentByteOffset)
1418{
1419 ASL_RESOURCE_DESC *Descriptor;
1420 ACPI_PARSE_OBJECT *InitializerOp;
1421 ASL_RESOURCE_NODE *Rnode;
1422 UINT32 i;
1423
1424
1425 /* Count the number of data bytes */
1426
1427 InitializerOp = Op->Asl.Child;
1428 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1429
1430 for (i = 0; InitializerOp; i++)
1431 {
1432 InitializerOp = InitializerOp->Asl.Next;
1433 }
1434
1435 InitializerOp = Op->Asl.Child;
1436 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1437 Rnode = RsAllocateResourceNode (sizeof (ASL_LARGE_VENDOR_DESC) + (i - 1));
1438
1439 Descriptor = Rnode->Buffer;
1440 Descriptor->Lgv.DescriptorType = ACPI_RDESC_TYPE_LARGE_VENDOR;
1441 Descriptor->Lgv.Length = (UINT16) i;
1442
1443 /*
1444 * Process all child initialization nodes
1445 */
1446 for (i = 0; InitializerOp; i++)
1447 {
1448 Descriptor->Lgv.VendorDefined[i] = (UINT8) InitializerOp->Asl.Value.Integer;
1449
1450 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1451 }
1452
1453 return (Rnode);
1454}
1455
1456
1457/*******************************************************************************
1458 *
1459 * FUNCTION: RsDoGeneralRegisterDescriptor
1460 *
1461 * PARAMETERS: Op - Parent resource descriptor parse node
1462 * CurrentByteOffset - Offset into the resource template AML
1463 * buffer (to track references to the desc)
1464 *
1465 * RETURN: Completed resource node
1466 *
1467 * DESCRIPTION: Construct a long "Register" descriptor
1468 *
1469 ******************************************************************************/
1470
1471ASL_RESOURCE_NODE *
1472RsDoGeneralRegisterDescriptor (
1473 ACPI_PARSE_OBJECT *Op,
1474 UINT32 CurrentByteOffset)
1475{
1476 ASL_RESOURCE_DESC *Descriptor;
1477 ACPI_PARSE_OBJECT *InitializerOp;
1478 ASL_RESOURCE_NODE *Rnode;
1479 UINT32 i;
1480
1481
1482 InitializerOp = Op->Asl.Child;
1483 Rnode = RsAllocateResourceNode (sizeof (ASL_GENERAL_REGISTER_DESC));
1484
1485 Descriptor = Rnode->Buffer;
1486 Descriptor->Grg.DescriptorType = ACPI_RDESC_TYPE_GENERAL_REGISTER;
1487 Descriptor->Grg.Length = 12;
1488
1489 /*
1490 * Process all child initialization nodes
1491 */
1492 for (i = 0; InitializerOp; i++)
1493 {
1494 switch (i)
1495 {
1496 case 0: /* Address space */
1497
1498 Descriptor->Grg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer;
1499 RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESSSPACE,
1500 CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.AddressSpaceId));
1501 break;
1502
1503 case 1: /* Register Bit Width */
1504
1505 Descriptor->Grg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer;
1506 RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITWIDTH,
1507 CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.BitWidth));
1508 break;
1509
1510 case 2: /* Register Bit Offset */
1511
1512 Descriptor->Grg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
1513 RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITOFFSET,
1514 CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.BitOffset));
1515 break;
1516
1517 case 3: /* Register Address */
1518
1519 Descriptor->Grg.Address = InitializerOp->Asl.Value.Integer;
1520 RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESS,
1521 CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.Address));
1522 break;
1523
1524
1525 default:
1526
1527 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
1528 break;
1529 }
1530
1531 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1532 }
1533 return (Rnode);
1534}
1535
1536