Subversion Repositories Kolibri OS

Rev

Rev 1498 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1498 serge 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 - 2011, Intel Corp.
2216 Serge 12
 * All rights reserved.
1498 serge 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
 
117
 
118
#include "aslcompiler.y.h"
119
120
 
121
        ACPI_MODULE_NAME    ("aslrestype1")
122
123
 
124
 * This module contains miscellaneous small resource descriptors:
125
 *
126
 * EndTag
127
 * EndDependentFn
128
 * Memory24
129
 * Memory32
130
 * Memory32Fixed
131
 * StartDependentFn
132
 * StartDependentFnNoPri
133
 * VendorShort
134
 */
135
136
 
137
 *
138
 * FUNCTION:    RsDoEndTagDescriptor
139
 *
140
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
141
 *              CurrentByteOffset   - Offset into the resource template AML
142
 *                                    buffer (to track references to the desc)
143
 *
144
 * RETURN:      Completed resource node
145
 *
146
 * DESCRIPTION: Construct a short "EndDependentFn" descriptor
147
 *
148
 ******************************************************************************/
149
150
 
151
RsDoEndTagDescriptor (
152
    ACPI_PARSE_OBJECT       *Op,
153
    UINT32                  CurrentByteOffset)
154
{
155
    AML_RESOURCE            *Descriptor;
156
    ASL_RESOURCE_NODE       *Rnode;
157
158
 
159
 
160
161
 
162
    Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG |
163
                                        ASL_RDESC_END_TAG_SIZE;
164
    Descriptor->EndTag.Checksum = 0;
165
166
 
167
}
168
169
 
170
 
171
 *
172
 * FUNCTION:    RsDoEndDependentDescriptor
173
 *
174
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
175
 *              CurrentByteOffset   - Offset into the resource template AML
176
 *                                    buffer (to track references to the desc)
177
 *
178
 * RETURN:      Completed resource node
179
 *
180
 * DESCRIPTION: Construct a short "EndDependentFn" descriptor
181
 *
182
 ******************************************************************************/
183
184
 
185
RsDoEndDependentDescriptor (
186
    ACPI_PARSE_OBJECT       *Op,
187
    UINT32                  CurrentByteOffset)
188
{
189
    AML_RESOURCE            *Descriptor;
190
    ASL_RESOURCE_NODE       *Rnode;
191
192
 
193
 
194
195
 
196
    Descriptor->EndDpf.DescriptorType  = ACPI_RESOURCE_NAME_END_DEPENDENT |
197
                                      ASL_RDESC_END_DEPEND_SIZE;
198
    return (Rnode);
199
}
200
201
 
202
 
203
 *
204
 * FUNCTION:    RsDoMemory24Descriptor
205
 *
206
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
207
 *              CurrentByteOffset   - Offset into the resource template AML
208
 *                                    buffer (to track references to the desc)
209
 *
210
 * RETURN:      Completed resource node
211
 *
212
 * DESCRIPTION: Construct a short "Memory24" descriptor
213
 *
214
 ******************************************************************************/
215
216
 
217
RsDoMemory24Descriptor (
218
    ACPI_PARSE_OBJECT       *Op,
219
    UINT32                  CurrentByteOffset)
220
{
221
    AML_RESOURCE            *Descriptor;
222
    ACPI_PARSE_OBJECT       *InitializerOp;
223
    ACPI_PARSE_OBJECT       *MinOp = NULL;
224
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
225
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
226
    ASL_RESOURCE_NODE       *Rnode;
227
    UINT32                  i;
228
229
 
230
 
231
    Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24));
232
233
 
234
    Descriptor->Memory24.DescriptorType  = ACPI_RESOURCE_NAME_MEMORY24;
235
    Descriptor->Memory24.ResourceLength = 9;
236
237
 
238
239
 
240
    {
241
        switch (i)
242
        {
243
        case 0: /* Read/Write type */
244
245
 
246
            RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
247
                CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0);
248
            break;
249
250
 
251
252
 
253
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
254
                CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
255
            MinOp = InitializerOp;
256
            break;
257
258
 
259
260
 
261
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
262
                CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
263
            MaxOp = InitializerOp;
264
            break;
265
266
 
267
268
 
269
            RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
270
                CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
271
            break;
272
273
 
274
275
 
276
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
277
                CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
278
            LengthOp = InitializerOp;
279
            break;
280
281
 
282
283
 
284
            break;
285
286
 
287
288
 
289
            break;
290
        }
291
292
 
293
    }
294
295
 
296
297
 
298
        Descriptor->Memory24.Minimum,
299
        Descriptor->Memory24.Maximum,
300
        Descriptor->Memory24.AddressLength,
301
        Descriptor->Memory24.Alignment,
302
        MinOp, MaxOp, LengthOp, NULL, Op);
2216 Serge 303
1498 serge 304
 
305
}
306
307
 
308
 
309
 *
310
 * FUNCTION:    RsDoMemory32Descriptor
311
 *
312
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
313
 *              CurrentByteOffset   - Offset into the resource template AML
314
 *                                    buffer (to track references to the desc)
315
 *
316
 * RETURN:      Completed resource node
317
 *
318
 * DESCRIPTION: Construct a short "Memory32" descriptor
319
 *
320
 ******************************************************************************/
321
322
 
323
RsDoMemory32Descriptor (
324
    ACPI_PARSE_OBJECT       *Op,
325
    UINT32                  CurrentByteOffset)
326
{
327
    AML_RESOURCE            *Descriptor;
328
    ACPI_PARSE_OBJECT       *InitializerOp;
329
    ACPI_PARSE_OBJECT       *MinOp = NULL;
330
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
331
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
332
    ACPI_PARSE_OBJECT       *AlignOp = NULL;
333
    ASL_RESOURCE_NODE       *Rnode;
334
    UINT32                  i;
335
336
 
337
 
338
    Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
339
340
 
341
    Descriptor->Memory32.DescriptorType  = ACPI_RESOURCE_NAME_MEMORY32;
342
    Descriptor->Memory32.ResourceLength = 17;
343
344
 
345
346
 
347
    {
348
        switch (i)
349
        {
350
        case 0: /* Read/Write type */
351
352
 
353
            RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
354
                CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0);
355
            break;
356
357
 
358
359
 
360
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
361
                CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
362
            MinOp = InitializerOp;
363
            break;
364
365
 
366
367
 
368
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
369
                CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
370
            MaxOp = InitializerOp;
371
            break;
372
373
 
374
375
 
376
            RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
377
                CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
378
            AlignOp = InitializerOp;
379
            break;
380
381
 
382
383
 
384
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
385
                CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
386
            LengthOp = InitializerOp;
387
            break;
388
389
 
390
391
 
392
            break;
393
394
 
395
396
 
397
            break;
398
        }
399
400
 
401
    }
402
403
 
404
405
 
406
        Descriptor->Memory32.Minimum,
407
        Descriptor->Memory32.Maximum,
408
        Descriptor->Memory32.AddressLength,
409
        Descriptor->Memory32.Alignment,
410
        MinOp, MaxOp, LengthOp, AlignOp, Op);
2216 Serge 411
1498 serge 412
 
413
}
414
415
 
416
 
417
 *
418
 * FUNCTION:    RsDoMemory32FixedDescriptor
419
 *
420
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
421
 *              CurrentByteOffset   - Offset into the resource template AML
422
 *                                    buffer (to track references to the desc)
423
 *
424
 * RETURN:      Completed resource node
425
 *
426
 * DESCRIPTION: Construct a short "Memory32Fixed" descriptor
427
 *
428
 ******************************************************************************/
429
430
 
431
RsDoMemory32FixedDescriptor (
432
    ACPI_PARSE_OBJECT       *Op,
433
    UINT32                  CurrentByteOffset)
434
{
435
    AML_RESOURCE            *Descriptor;
436
    ACPI_PARSE_OBJECT       *InitializerOp;
437
    ASL_RESOURCE_NODE       *Rnode;
438
    UINT32                  i;
439
440
 
441
 
442
    Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
443
444
 
445
    Descriptor->FixedMemory32.DescriptorType  = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
446
    Descriptor->FixedMemory32.ResourceLength = 9;
447
448
 
449
450
 
451
    {
452
        switch (i)
453
        {
454
        case 0: /* Read/Write type */
455
456
 
457
            RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
458
                CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0);
459
            break;
460
461
 
462
463
 
464
            RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
465
                CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
466
            break;
467
468
 
469
470
 
471
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
472
                CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
473
            break;
474
475
 
476
477
 
478
            break;
479
480
 
481
482
 
483
            break;
484
        }
485
486
 
487
    }
488
489
 
490
}
491
492
 
493
 
494
 *
495
 * FUNCTION:    RsDoStartDependentDescriptor
496
 *
497
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
498
 *              CurrentByteOffset   - Offset into the resource template AML
499
 *                                    buffer (to track references to the desc)
500
 *
501
 * RETURN:      Completed resource node
502
 *
503
 * DESCRIPTION: Construct a short "StartDependentFn" descriptor
504
 *
505
 ******************************************************************************/
506
507
 
508
RsDoStartDependentDescriptor (
509
    ACPI_PARSE_OBJECT       *Op,
510
    UINT32                  CurrentByteOffset)
511
{
512
    AML_RESOURCE            *Descriptor;
513
    ACPI_PARSE_OBJECT       *InitializerOp;
514
    ASL_RESOURCE_NODE       *Rnode;
515
    ASL_RESOURCE_NODE       *PreviousRnode;
516
    ASL_RESOURCE_NODE       *NextRnode;
517
    UINT32                  i;
518
    UINT8                   State;
519
520
 
521
 
522
    Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT));
523
524
 
525
    Descriptor = Rnode->Buffer;
526
527
 
528
529
 
530
                                      (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
531
532
 
533
534
 
535
    for (i = 0; InitializerOp; i++)
536
    {
537
        switch (i)
538
        {
539
        case 0: /* Compatibility Priority */
540
541
 
542
            {
543
                AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY,
544
                    InitializerOp, NULL);
545
            }
546
547
 
548
            break;
549
550
 
551
552
 
553
            {
554
                AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE,
555
                    InitializerOp, NULL);
556
            }
557
558
 
559
            break;
560
561
 
562
563
 
564
                        CurrentByteOffset, &State);
565
566
 
567
             * Update current byte offset to indicate the number of bytes from the
568
             * start of the buffer.  Buffer can include multiple descriptors, we
569
             * must keep track of the offset of not only each descriptor, but each
570
             * element (field) within each descriptor as well.
571
             */
572
            CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
573
                                    NextRnode);
574
            break;
575
        }
576
577
 
578
    }
579
580
 
581
}
582
583
 
584
 
585
 *
586
 * FUNCTION:    RsDoStartDependentNoPriDescriptor
587
 *
588
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
589
 *              CurrentByteOffset   - Offset into the resource template AML
590
 *                                    buffer (to track references to the desc)
591
 *
592
 * RETURN:      Completed resource node
593
 *
594
 * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor
595
 *
596
 ******************************************************************************/
597
598
 
599
RsDoStartDependentNoPriDescriptor (
600
    ACPI_PARSE_OBJECT       *Op,
601
    UINT32                  CurrentByteOffset)
602
{
603
    AML_RESOURCE            *Descriptor;
604
    ACPI_PARSE_OBJECT       *InitializerOp;
605
    ASL_RESOURCE_NODE       *Rnode;
606
    ASL_RESOURCE_NODE       *PreviousRnode;
607
    ASL_RESOURCE_NODE       *NextRnode;
608
    UINT8                   State;
609
610
 
611
 
612
    Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO));
613
614
 
615
    Descriptor->StartDpf.DescriptorType  = ACPI_RESOURCE_NAME_START_DEPENDENT |
616
                                      ASL_RDESC_ST_DEPEND_SIZE;
617
    PreviousRnode = Rnode;
618
619
 
620
621
 
622
    while (InitializerOp)
623
    {
624
        NextRnode = RsDoOneResourceDescriptor  (InitializerOp,
625
                        CurrentByteOffset, &State);
626
627
 
628
         * Update current byte offset to indicate the number of bytes from the
629
         * start of the buffer.  Buffer can include multiple descriptors, we
630
         * must keep track of the offset of not only each descriptor, but each
631
         * element (field) within each descriptor as well.
632
         */
633
        CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
634
635
 
636
    }
637
638
 
639
}
640
641
 
642
 
643
 *
644
 * FUNCTION:    RsDoVendorSmallDescriptor
645
 *
646
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
647
 *              CurrentByteOffset   - Offset into the resource template AML
648
 *                                    buffer (to track references to the desc)
649
 *
650
 * RETURN:      Completed resource node
651
 *
652
 * DESCRIPTION: Construct a short "VendorShort" descriptor
653
 *
654
 ******************************************************************************/
655
656
 
657
RsDoVendorSmallDescriptor (
658
    ACPI_PARSE_OBJECT       *Op,
659
    UINT32                  CurrentByteOffset)
660
{
661
    AML_RESOURCE            *Descriptor;
662
    ACPI_PARSE_OBJECT       *InitializerOp;
663
    ASL_RESOURCE_NODE       *Rnode;
664
    UINT8                   *VendorData;
665
    UINT32                  i;
666
667
 
668
 
669
670
 
671
672
 
673
674
 
675
    Descriptor->VendorSmall.DescriptorType  = ACPI_RESOURCE_NAME_VENDOR_SMALL;
676
    VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER);
677
678
 
679
680
 
681
    for (i = 0; InitializerOp; i++)
682
    {
683
        if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
684
        {
685
            break;
686
        }
687
688
 
689
690
 
691
        {
692
            AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL);
693
694
 
695
696
 
697
            {
698
                InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
699
            }
700
            break;
701
        }
702
703
 
704
        InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
705
    }
706
707
 
708
709
 
710
711
 
712
713
 
714
    return (Rnode);
715
}
716