Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1498 serge 1
 
2
 *
3
 * Module Name: aslrestype2e - Large Extended address resource descriptors
4
 *
5
 *****************************************************************************/
6
7
 
8
 *
9
 * 1. Copyright Notice
10
 *
11
 * Some or all of this work - Copyright (c) 1999 - 2010, 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
 
117
 
118
#include "aslcompiler.y.h"
119
120
 
121
        ACPI_MODULE_NAME    ("aslrestype2e")
122
123
 
124
 * This module contains the Extended (64-bit) address space descriptors:
125
 *
126
 * ExtendedIO
127
 * ExtendedMemory
128
 * ExtendedSpace
129
 */
130
131
 
132
 *
133
 * FUNCTION:    RsDoExtendedIoDescriptor
134
 *
135
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
136
 *              CurrentByteOffset   - Offset into the resource template AML
137
 *                                    buffer (to track references to the desc)
138
 *
139
 * RETURN:      Completed resource node
140
 *
141
 * DESCRIPTION: Construct a long "ExtendedIO" descriptor
142
 *
143
 ******************************************************************************/
144
145
 
146
RsDoExtendedIoDescriptor (
147
    ACPI_PARSE_OBJECT       *Op,
148
    UINT32                  CurrentByteOffset)
149
{
150
    AML_RESOURCE            *Descriptor;
151
    ACPI_PARSE_OBJECT       *InitializerOp;
152
    ACPI_PARSE_OBJECT       *MinOp = NULL;
153
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
154
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
155
    ACPI_PARSE_OBJECT       *GranOp = NULL;
156
    ASL_RESOURCE_NODE       *Rnode;
157
    UINT16                  StringLength = 0;
158
    UINT32                  i;
159
160
 
161
 
162
    StringLength = RsGetStringDataLength (InitializerOp);
163
164
 
165
                sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
166
167
 
168
    Descriptor->ExtAddress64.DescriptorType  = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
169
    Descriptor->ExtAddress64.ResourceType    = ACPI_ADDRESS_TYPE_IO_RANGE;
170
    Descriptor->ExtAddress64.RevisionID      = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
171
172
 
173
        (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
174
         sizeof (AML_RESOURCE_LARGE_HEADER));
175
176
 
177
178
 
179
    {
180
        switch (i)
181
        {
182
        case 0: /* Resource Usage */
183
184
 
185
            break;
186
187
 
188
189
 
190
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
191
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
192
            break;
193
194
 
195
196
 
197
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
198
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
199
            break;
200
201
 
202
203
 
204
            RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
205
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
206
            break;
207
208
 
209
210
 
211
            RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
212
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
213
            break;
214
215
 
216
217
 
218
            RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
219
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
220
            GranOp = InitializerOp;
221
           break;
222
223
 
224
225
 
226
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
227
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
228
            MinOp = InitializerOp;
229
            break;
230
231
 
232
233
 
234
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
235
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
236
            MaxOp = InitializerOp;
237
            break;
238
239
 
240
241
 
242
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
243
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
244
            break;
245
246
 
247
248
 
249
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
250
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
251
            LengthOp = InitializerOp;
252
            break;
253
254
 
255
256
 
257
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
258
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
259
            break;
260
261
 
262
263
 
264
            break;
265
266
 
267
268
 
269
            RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
270
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 4);
271
            break;
272
273
 
274
275
 
276
            RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
277
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
278
            break;
279
280
 
281
282
 
283
            break;
284
        }
285
286
 
287
    }
288
289
 
290
291
 
292
        Descriptor->ExtAddress64.Minimum,
293
        Descriptor->ExtAddress64.Maximum,
294
        Descriptor->ExtAddress64.AddressLength,
295
        Descriptor->ExtAddress64.Granularity,
296
        Descriptor->ExtAddress64.Flags,
297
        MinOp, MaxOp, LengthOp, GranOp);
298
299
 
300
    return (Rnode);
301
}
302
303
 
304
 
305
 *
306
 * FUNCTION:    RsDoExtendedMemoryDescriptor
307
 *
308
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
309
 *              CurrentByteOffset   - Offset into the resource template AML
310
 *                                    buffer (to track references to the desc)
311
 *
312
 * RETURN:      Completed resource node
313
 *
314
 * DESCRIPTION: Construct a long "ExtendedMemory" descriptor
315
 *
316
 ******************************************************************************/
317
318
 
319
RsDoExtendedMemoryDescriptor (
320
    ACPI_PARSE_OBJECT       *Op,
321
    UINT32                  CurrentByteOffset)
322
{
323
    AML_RESOURCE            *Descriptor;
324
    ACPI_PARSE_OBJECT       *InitializerOp;
325
    ACPI_PARSE_OBJECT       *MinOp = NULL;
326
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
327
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
328
    ACPI_PARSE_OBJECT       *GranOp = NULL;
329
    ASL_RESOURCE_NODE       *Rnode;
330
    UINT16                  StringLength = 0;
331
    UINT32                  i;
332
333
 
334
 
335
    StringLength = RsGetStringDataLength (InitializerOp);
336
337
 
338
                sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
339
340
 
341
    Descriptor->ExtAddress64.DescriptorType  = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
342
    Descriptor->ExtAddress64.ResourceType    = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
343
    Descriptor->ExtAddress64.RevisionID      = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
344
345
 
346
        (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
347
         sizeof (AML_RESOURCE_LARGE_HEADER));
348
349
 
350
351
 
352
    {
353
        switch (i)
354
        {
355
        case 0: /* Resource Usage */
356
357
 
358
            break;
359
360
 
361
362
 
363
            RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
364
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
365
            break;
366
367
 
368
369
 
370
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
371
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
372
            break;
373
374
 
375
376
 
377
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
378
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
379
            break;
380
381
 
382
383
 
384
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
385
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 1);
386
            break;
387
388
 
389
390
 
391
            RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
392
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
393
            break;
394
395
 
396
397
 
398
            RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
399
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
400
            GranOp = InitializerOp;
401
            break;
402
403
 
404
405
 
406
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
407
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
408
            MinOp = InitializerOp;
409
            break;
410
411
 
412
413
 
414
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
415
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
416
            MaxOp = InitializerOp;
417
            break;
418
419
 
420
421
 
422
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
423
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
424
            break;
425
426
 
427
428
 
429
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
430
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
431
            LengthOp = InitializerOp;
432
            break;
433
434
 
435
436
 
437
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
438
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
439
            break;
440
441
 
442
443
 
444
            break;
445
446
 
447
 
448
449
 
450
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
451
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 3);
452
            break;
453
454
 
455
456
 
457
            RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
458
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
459
            break;
460
461
 
462
463
 
464
            break;
465
        }
466
467
 
468
    }
469
470
 
471
472
 
473
        Descriptor->ExtAddress64.Minimum,
474
        Descriptor->ExtAddress64.Maximum,
475
        Descriptor->ExtAddress64.AddressLength,
476
        Descriptor->ExtAddress64.Granularity,
477
        Descriptor->ExtAddress64.Flags,
478
        MinOp, MaxOp, LengthOp, GranOp);
479
480
 
481
    return (Rnode);
482
}
483
484
 
485
 
486
 *
487
 * FUNCTION:    RsDoExtendedSpaceDescriptor
488
 *
489
 * PARAMETERS:  Op                  - Parent resource descriptor parse node
490
 *              CurrentByteOffset   - Offset into the resource template AML
491
 *                                    buffer (to track references to the desc)
492
 *
493
 * RETURN:      Completed resource node
494
 *
495
 * DESCRIPTION: Construct a long "ExtendedSpace" descriptor
496
 *
497
 ******************************************************************************/
498
499
 
500
RsDoExtendedSpaceDescriptor (
501
    ACPI_PARSE_OBJECT       *Op,
502
    UINT32                  CurrentByteOffset)
503
{
504
    AML_RESOURCE            *Descriptor;
505
    ACPI_PARSE_OBJECT       *InitializerOp;
506
    ACPI_PARSE_OBJECT       *MinOp = NULL;
507
    ACPI_PARSE_OBJECT       *MaxOp = NULL;
508
    ACPI_PARSE_OBJECT       *LengthOp = NULL;
509
    ACPI_PARSE_OBJECT       *GranOp = NULL;
510
    ASL_RESOURCE_NODE       *Rnode;
511
    UINT16                  StringLength = 0;
512
    UINT32                  i;
513
514
 
515
 
516
    StringLength = RsGetStringDataLength (InitializerOp);
517
518
 
519
                sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
520
521
 
522
    Descriptor->ExtAddress64.DescriptorType  = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
523
    Descriptor->ExtAddress64.RevisionID      = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
524
525
 
526
        (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
527
         sizeof (AML_RESOURCE_LARGE_HEADER));
528
529
 
530
531
 
532
    {
533
        switch (i)
534
        {
535
        case 0: /* Resource Type */
536
537
 
538
                (UINT8) InitializerOp->Asl.Value.Integer;
539
            break;
540
541
 
542
543
 
544
            break;
545
546
 
547
548
 
549
            RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
550
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
551
            break;
552
553
 
554
555
 
556
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
557
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
558
            break;
559
560
 
561
562
 
563
            RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
564
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
565
            break;
566
567
 
568
569
 
570
                (UINT8) InitializerOp->Asl.Value.Integer;
571
            break;
572
573
 
574
575
 
576
            RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
577
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
578
            GranOp = InitializerOp;
579
            break;
580
581
 
582
583
 
584
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
585
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
586
            MinOp = InitializerOp;
587
            break;
588
589
 
590
591
 
592
            RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
593
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
594
            MaxOp = InitializerOp;
595
            break;
596
597
 
598
599
 
600
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
601
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
602
            break;
603
604
 
605
606
 
607
            RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
608
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
609
            LengthOp = InitializerOp;
610
            break;
611
612
 
613
614
 
615
            RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
616
                CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
617
            break;
618
619
 
620
621
 
622
            break;
623
624
 
625
626
 
627
            break;
628
        }
629
630
 
631
    }
632
633
 
634
635
 
636
        Descriptor->ExtAddress64.Minimum,
637
        Descriptor->ExtAddress64.Maximum,
638
        Descriptor->ExtAddress64.AddressLength,
639
        Descriptor->ExtAddress64.Granularity,
640
        Descriptor->ExtAddress64.Flags,
641
        MinOp, MaxOp, LengthOp, GranOp);
642
643
 
644
    return (Rnode);
645
}
646