1 /******************************************************************************
2 *
3 * Module Name: aslrestype1 - Miscellaneous small resource descriptors
4 *
5 *****************************************************************************/
6
7 /******************************************************************************
8 *
9 * 1. Copyright Notice
10 *
11 * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
12 * All rights reserved.
13 *
14 * 2. License
15 *
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
19 * property rights.
20 *
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
27 *
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
36 *
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
39 *
40 * 3. Conditions
41 *
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
53 *
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
64 * make.
65 *
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
70 * distribution.
71 *
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
74 *
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
79 *
80 * 4. Disclaimer and Export Compliance
81 *
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88 * PARTICULAR PURPOSE.
89 *
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97 * LIMITED REMEDY.
98 *
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
113 *
114 *****************************************************************************
115 *
116 * Alternatively, you may choose to be licensed under the terms of the
117 * following license:
118 *
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
121 * are met:
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
133 *
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145 *
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
149 *
150 *****************************************************************************/
151
152 #include "aslcompiler.h"
153 #include "aslcompiler.y.h"
154
155 #define _COMPONENT ACPI_COMPILER
156 ACPI_MODULE_NAME ("aslrestype1")
157
158 /*
159 * This module contains miscellaneous small resource descriptors:
160 *
161 * EndTag
162 * EndDependentFn
163 * Memory24
164 * Memory32
165 * Memory32Fixed
166 * StartDependentFn
167 * StartDependentFnNoPri
168 * VendorShort
169 */
170
171 /*******************************************************************************
172 *
173 * FUNCTION: RsDoEndTagDescriptor
174 *
175 * PARAMETERS: Info - Parse Op and resource template offset
176 *
177 * RETURN: Completed resource node
178 *
179 * DESCRIPTION: Construct a short "EndDependentFn" descriptor
180 *
181 ******************************************************************************/
182
183 ASL_RESOURCE_NODE *
RsDoEndTagDescriptor(ASL_RESOURCE_INFO * Info)184 RsDoEndTagDescriptor (
185 ASL_RESOURCE_INFO *Info)
186 {
187 AML_RESOURCE *Descriptor;
188 ASL_RESOURCE_NODE *Rnode;
189
190
191 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG));
192
193 Descriptor = Rnode->Buffer;
194 Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG |
195 ASL_RDESC_END_TAG_SIZE;
196 Descriptor->EndTag.Checksum = 0;
197 return (Rnode);
198 }
199
200
201 /*******************************************************************************
202 *
203 * FUNCTION: RsDoEndDependentDescriptor
204 *
205 * PARAMETERS: Info - Parse Op and resource template offset
206 *
207 * RETURN: Completed resource node
208 *
209 * DESCRIPTION: Construct a short "EndDependentFn" descriptor
210 *
211 ******************************************************************************/
212
213 ASL_RESOURCE_NODE *
RsDoEndDependentDescriptor(ASL_RESOURCE_INFO * Info)214 RsDoEndDependentDescriptor (
215 ASL_RESOURCE_INFO *Info)
216 {
217 AML_RESOURCE *Descriptor;
218 ASL_RESOURCE_NODE *Rnode;
219
220
221 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT));
222
223 Descriptor = Rnode->Buffer;
224 Descriptor->EndDpf.DescriptorType =
225 ACPI_RESOURCE_NAME_END_DEPENDENT | ASL_RDESC_END_DEPEND_SIZE;
226 return (Rnode);
227 }
228
229
230 /*******************************************************************************
231 *
232 * FUNCTION: RsDoMemory24Descriptor
233 *
234 * PARAMETERS: Info - Parse Op and resource template offset
235 *
236 * RETURN: Completed resource node
237 *
238 * DESCRIPTION: Construct a short "Memory24" descriptor
239 *
240 ******************************************************************************/
241
242 ASL_RESOURCE_NODE *
RsDoMemory24Descriptor(ASL_RESOURCE_INFO * Info)243 RsDoMemory24Descriptor (
244 ASL_RESOURCE_INFO *Info)
245 {
246 AML_RESOURCE *Descriptor;
247 ACPI_PARSE_OBJECT *InitializerOp;
248 ACPI_PARSE_OBJECT *MinOp = NULL;
249 ACPI_PARSE_OBJECT *MaxOp = NULL;
250 ACPI_PARSE_OBJECT *LengthOp = NULL;
251 ASL_RESOURCE_NODE *Rnode;
252 UINT32 CurrentByteOffset;
253 UINT32 i;
254
255
256 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
257 CurrentByteOffset = Info->CurrentByteOffset;
258 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24));
259
260 Descriptor = Rnode->Buffer;
261 Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
262 Descriptor->Memory24.ResourceLength = 9;
263
264 /* Process all child initialization nodes */
265
266 for (i = 0; InitializerOp; i++)
267 {
268 switch (i)
269 {
270 case 0: /* Read/Write type */
271
272 RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1);
273 RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
274 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0);
275 break;
276
277 case 1: /* Min Address */
278
279 Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
280 RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
281 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
282 MinOp = InitializerOp;
283 break;
284
285 case 2: /* Max Address */
286
287 Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
288 RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
289 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
290 MaxOp = InitializerOp;
291 break;
292
293 case 3: /* Alignment */
294
295 Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
296 RsCreateWordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
297 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
298 break;
299
300 case 4: /* Length */
301
302 Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
303 RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
304 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
305 LengthOp = InitializerOp;
306 break;
307
308 case 5: /* Name */
309
310 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
311 break;
312
313 default:
314
315 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
316 break;
317 }
318
319 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
320 }
321
322 /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
323
324 RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
325 Descriptor->Memory24.Minimum,
326 Descriptor->Memory24.Maximum,
327 Descriptor->Memory24.AddressLength,
328 Descriptor->Memory24.Alignment,
329 MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp);
330
331 return (Rnode);
332 }
333
334
335 /*******************************************************************************
336 *
337 * FUNCTION: RsDoMemory32Descriptor
338 *
339 * PARAMETERS: Info - Parse Op and resource template offset
340 *
341 * RETURN: Completed resource node
342 *
343 * DESCRIPTION: Construct a short "Memory32" descriptor
344 *
345 ******************************************************************************/
346
347 ASL_RESOURCE_NODE *
RsDoMemory32Descriptor(ASL_RESOURCE_INFO * Info)348 RsDoMemory32Descriptor (
349 ASL_RESOURCE_INFO *Info)
350 {
351 AML_RESOURCE *Descriptor;
352 ACPI_PARSE_OBJECT *InitializerOp;
353 ACPI_PARSE_OBJECT *MinOp = NULL;
354 ACPI_PARSE_OBJECT *MaxOp = NULL;
355 ACPI_PARSE_OBJECT *LengthOp = NULL;
356 ACPI_PARSE_OBJECT *AlignOp = NULL;
357 ASL_RESOURCE_NODE *Rnode;
358 UINT32 CurrentByteOffset;
359 UINT32 i;
360
361
362 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
363 CurrentByteOffset = Info->CurrentByteOffset;
364 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
365
366 Descriptor = Rnode->Buffer;
367 Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
368 Descriptor->Memory32.ResourceLength = 17;
369
370 /* Process all child initialization nodes */
371
372 for (i = 0; InitializerOp; i++)
373 {
374 switch (i)
375 {
376 case 0: /* Read/Write type */
377
378 RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1);
379 RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
380 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0);
381 break;
382
383 case 1: /* Min Address */
384
385 Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
386 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
387 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
388 MinOp = InitializerOp;
389 break;
390
391 case 2: /* Max Address */
392
393 Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
394 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
395 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
396 MaxOp = InitializerOp;
397 break;
398
399 case 3: /* Alignment */
400
401 Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
402 RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
403 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
404 AlignOp = InitializerOp;
405 break;
406
407 case 4: /* Length */
408
409 Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
410 RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
411 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
412 LengthOp = InitializerOp;
413 break;
414
415 case 5: /* Name */
416
417 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
418 break;
419
420 default:
421
422 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
423 break;
424 }
425
426 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
427 }
428
429 /* Validate the Min/Max/Len/Align values */
430
431 RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
432 Descriptor->Memory32.Minimum,
433 Descriptor->Memory32.Maximum,
434 Descriptor->Memory32.AddressLength,
435 Descriptor->Memory32.Alignment,
436 MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
437
438 return (Rnode);
439 }
440
441
442 /*******************************************************************************
443 *
444 * FUNCTION: RsDoMemory32FixedDescriptor
445 *
446 * PARAMETERS: Info - Parse Op and resource template offset
447 *
448 * RETURN: Completed resource node
449 *
450 * DESCRIPTION: Construct a short "Memory32Fixed" descriptor
451 *
452 ******************************************************************************/
453
454 ASL_RESOURCE_NODE *
RsDoMemory32FixedDescriptor(ASL_RESOURCE_INFO * Info)455 RsDoMemory32FixedDescriptor (
456 ASL_RESOURCE_INFO *Info)
457 {
458 AML_RESOURCE *Descriptor;
459 ACPI_PARSE_OBJECT *InitializerOp;
460 ASL_RESOURCE_NODE *Rnode;
461 UINT32 CurrentByteOffset;
462 UINT32 i;
463
464
465 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
466 CurrentByteOffset = Info->CurrentByteOffset;
467 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
468
469 Descriptor = Rnode->Buffer;
470 Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
471 Descriptor->FixedMemory32.ResourceLength = 9;
472
473 /* Process all child initialization nodes */
474
475 for (i = 0; InitializerOp; i++)
476 {
477 switch (i)
478 {
479 case 0: /* Read/Write type */
480
481 RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1);
482 RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
483 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0);
484 break;
485
486 case 1: /* Address */
487
488 Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
489 RsCreateDwordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
490 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
491 break;
492
493 case 2: /* Length */
494
495 Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
496 RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
497 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
498 break;
499
500 case 3: /* Name */
501
502 UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp);
503 break;
504
505 default:
506
507 AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
508 break;
509 }
510
511 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
512 }
513
514 return (Rnode);
515 }
516
517
518 /*******************************************************************************
519 *
520 * FUNCTION: RsDoStartDependentDescriptor
521 *
522 * PARAMETERS: Info - Parse Op and resource template offset
523 *
524 * RETURN: Completed resource node
525 *
526 * DESCRIPTION: Construct a short "StartDependentFn" descriptor
527 *
528 ******************************************************************************/
529
530 ASL_RESOURCE_NODE *
RsDoStartDependentDescriptor(ASL_RESOURCE_INFO * Info)531 RsDoStartDependentDescriptor (
532 ASL_RESOURCE_INFO *Info)
533 {
534 AML_RESOURCE *Descriptor;
535 ACPI_PARSE_OBJECT *InitializerOp;
536 ASL_RESOURCE_NODE *Rnode;
537 ASL_RESOURCE_NODE *PreviousRnode;
538 ASL_RESOURCE_NODE *NextRnode;
539 ASL_RESOURCE_INFO NextInfo;
540 UINT32 CurrentByteOffset;
541 UINT32 i;
542 UINT8 State;
543
544
545 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
546 CurrentByteOffset = Info->CurrentByteOffset;
547 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT));
548
549 PreviousRnode = Rnode;
550 Descriptor = Rnode->Buffer;
551
552 /* Increment offset past StartDependent descriptor */
553
554 CurrentByteOffset += sizeof (AML_RESOURCE_START_DEPENDENT);
555
556 /* Descriptor has priority byte */
557
558 Descriptor->StartDpf.DescriptorType =
559 ACPI_RESOURCE_NAME_START_DEPENDENT | (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
560
561 /* Process all child initialization nodes */
562
563 State = ACPI_RSTATE_START_DEPENDENT;
564 for (i = 0; InitializerOp; i++)
565 {
566 switch (i)
567 {
568 case 0: /* Compatibility Priority */
569
570 if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
571 {
572 AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY,
573 InitializerOp, NULL);
574 }
575
576 RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0);
577 break;
578
579 case 1: /* Performance/Robustness Priority */
580
581 if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
582 {
583 AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE,
584 InitializerOp, NULL);
585 }
586
587 RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0);
588 break;
589
590 default:
591
592 NextInfo.CurrentByteOffset = CurrentByteOffset;
593 NextInfo.DescriptorTypeOp = InitializerOp;
594
595 NextRnode = RsDoOneResourceDescriptor (&NextInfo, &State);
596
597 /*
598 * Update current byte offset to indicate the number of bytes from the
599 * start of the buffer. Buffer can include multiple descriptors, we
600 * must keep track of the offset of not only each descriptor, but each
601 * element (field) within each descriptor as well.
602 */
603 CurrentByteOffset += RsLinkDescriptorChain (
604 &PreviousRnode, NextRnode);
605 break;
606 }
607
608 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
609 }
610
611 return (Rnode);
612 }
613
614
615 /*******************************************************************************
616 *
617 * FUNCTION: RsDoStartDependentNoPriDescriptor
618 *
619 * PARAMETERS: Info - Parse Op and resource template offset
620 *
621 * RETURN: Completed resource node
622 *
623 * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor
624 *
625 ******************************************************************************/
626
627 ASL_RESOURCE_NODE *
RsDoStartDependentNoPriDescriptor(ASL_RESOURCE_INFO * Info)628 RsDoStartDependentNoPriDescriptor (
629 ASL_RESOURCE_INFO *Info)
630 {
631 AML_RESOURCE *Descriptor;
632 ACPI_PARSE_OBJECT *InitializerOp;
633 ASL_RESOURCE_NODE *Rnode;
634 ASL_RESOURCE_NODE *PreviousRnode;
635 ASL_RESOURCE_NODE *NextRnode;
636 ASL_RESOURCE_INFO NextInfo;
637 UINT32 CurrentByteOffset;
638 UINT8 State;
639
640
641 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
642 CurrentByteOffset = Info->CurrentByteOffset;
643 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO));
644
645 Descriptor = Rnode->Buffer;
646 Descriptor->StartDpf.DescriptorType =
647 ACPI_RESOURCE_NAME_START_DEPENDENT | ASL_RDESC_ST_DEPEND_SIZE;
648 PreviousRnode = Rnode;
649
650 /* Increment offset past StartDependentNoPri descriptor */
651
652 CurrentByteOffset += sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO);
653
654 /* Process all child initialization nodes */
655
656 State = ACPI_RSTATE_START_DEPENDENT;
657 while (InitializerOp)
658 {
659 NextInfo.CurrentByteOffset = CurrentByteOffset;
660 NextInfo.DescriptorTypeOp = InitializerOp;
661
662 NextRnode = RsDoOneResourceDescriptor (&NextInfo, &State);
663
664 /*
665 * Update current byte offset to indicate the number of bytes from the
666 * start of the buffer. Buffer can include multiple descriptors, we
667 * must keep track of the offset of not only each descriptor, but each
668 * element (field) within each descriptor as well.
669 */
670 CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
671
672 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
673 }
674
675 return (Rnode);
676 }
677
678
679 /*******************************************************************************
680 *
681 * FUNCTION: RsDoVendorSmallDescriptor
682 *
683 * PARAMETERS: Info - Parse Op and resource template offset
684 *
685 * RETURN: Completed resource node
686 *
687 * DESCRIPTION: Construct a short "VendorShort" descriptor
688 *
689 ******************************************************************************/
690
691 ASL_RESOURCE_NODE *
RsDoVendorSmallDescriptor(ASL_RESOURCE_INFO * Info)692 RsDoVendorSmallDescriptor (
693 ASL_RESOURCE_INFO *Info)
694 {
695 AML_RESOURCE *Descriptor;
696 ACPI_PARSE_OBJECT *InitializerOp;
697 ASL_RESOURCE_NODE *Rnode;
698 UINT8 *VendorData;
699 UINT32 i;
700
701
702 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
703
704 /* Allocate worst case - 7 vendor bytes */
705
706 Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7);
707
708 Descriptor = Rnode->Buffer;
709 Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL;
710 VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER);
711
712 /* Process all child initialization nodes */
713
714 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
715 for (i = 0; InitializerOp; i++)
716 {
717 if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
718 {
719 break;
720 }
721
722 /* Maximum 7 vendor data bytes allowed (0-6) */
723
724 if (i >= 7)
725 {
726 AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL);
727
728 /* Eat the excess initializers */
729
730 while (InitializerOp)
731 {
732 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
733 }
734 break;
735 }
736
737 VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer;
738 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
739 }
740
741 /* Adjust the Rnode buffer size, so correct number of bytes are emitted */
742
743 Rnode->BufferLength -= (7 - i);
744
745 /* Set the length in the Type Tag */
746
747 Descriptor->VendorSmall.DescriptorType |= (UINT8) i;
748 return (Rnode);
749 }
750