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: dmresrcl.c - "Large" Resource Descriptor disassembly
4
 *
5
 ******************************************************************************/
6
 
7
/******************************************************************************
8
 *
9
 * 1. Copyright Notice
10
 *
2216 Serge 11
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
1498 serge 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
#include "acpi.h"
118
#include "accommon.h"
119
#include "acdisasm.h"
120
 
121
 
122
#ifdef ACPI_DISASSEMBLER
123
 
124
#define _COMPONENT          ACPI_CA_DEBUGGER
125
        ACPI_MODULE_NAME    ("dbresrcl")
126
 
127
 
128
/* Common names for address and memory descriptors */
129
 
130
static char                 *AcpiDmAddressNames[] =
131
{
132
    "Granularity",
133
    "Range Minimum",
134
    "Range Maximum",
135
    "Translation Offset",
136
    "Length"
137
};
138
 
139
static char                 *AcpiDmMemoryNames[] =
140
{
141
    "Range Minimum",
142
    "Range Maximum",
143
    "Alignment",
144
    "Length"
145
};
146
 
147
 
148
/* Local prototypes */
149
 
150
static void
151
AcpiDmSpaceFlags (
152
        UINT8               Flags);
153
 
154
static void
155
AcpiDmIoFlags (
156
        UINT8               Flags);
157
 
158
static void
159
AcpiDmIoFlags2 (
160
        UINT8               SpecificFlags);
161
 
162
static void
163
AcpiDmMemoryFlags (
164
    UINT8                   Flags,
165
    UINT8                   SpecificFlags);
166
 
167
static void
168
AcpiDmMemoryFlags2 (
169
    UINT8                   SpecificFlags);
170
 
171
static void
172
AcpiDmResourceSource (
173
    AML_RESOURCE            *Resource,
174
    ACPI_SIZE               MinimumLength,
175
    UINT32                  Length);
176
 
177
static void
178
AcpiDmAddressFields (
179
    void                    *Source,
180
    UINT8                   Type,
181
    UINT32                  Level);
182
 
183
static void
184
AcpiDmAddressPrefix (
185
    UINT8                   Type);
186
 
187
static void
188
AcpiDmAddressCommon (
189
    AML_RESOURCE            *Resource,
190
    UINT8                   Type,
191
    UINT32                  Level);
192
 
193
static void
194
AcpiDmAddressFlags (
195
    AML_RESOURCE            *Resource);
196
 
197
 
198
/*******************************************************************************
199
 *
200
 * FUNCTION:    AcpiDmMemoryFields
201
 *
202
 * PARAMETERS:  Source              - Pointer to the contiguous data fields
203
 *              Type                - 16 or 32 (bit)
204
 *              Level               - Current source code indentation level
205
 *
206
 * RETURN:      None
207
 *
208
 * DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors
209
 *
210
 ******************************************************************************/
211
 
212
static void
213
AcpiDmMemoryFields (
214
    void                    *Source,
215
    UINT8                   Type,
216
    UINT32                  Level)
217
{
218
    UINT32                  i;
219
 
220
 
221
    for (i = 0; i < 4; i++)
222
    {
223
        AcpiDmIndent (Level + 1);
224
 
225
        switch (Type)
226
        {
227
        case 16:
228
            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
229
                AcpiDmMemoryNames[i]);
230
            break;
231
 
232
        case 32:
233
            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
234
                AcpiDmMemoryNames[i]);
235
            break;
236
 
237
        default:
238
            return;
239
        }
240
    }
241
}
242
 
243
 
244
/*******************************************************************************
245
 *
246
 * FUNCTION:    AcpiDmAddressFields
247
 *
248
 * PARAMETERS:  Source              - Pointer to the contiguous data fields
249
 *              Type                - 16, 32, or 64 (bit)
250
 *              Level               - Current source code indentation level
251
 *
252
 * RETURN:      None
253
 *
254
 * DESCRIPTION: Decode fields common to address descriptors
255
 *
256
 ******************************************************************************/
257
 
258
static void
259
AcpiDmAddressFields (
260
    void                    *Source,
261
    UINT8                   Type,
262
    UINT32                  Level)
263
{
264
    UINT32                  i;
265
 
266
 
267
    AcpiOsPrintf ("\n");
268
 
269
    for (i = 0; i < 5; i++)
270
    {
271
        AcpiDmIndent (Level + 1);
272
 
273
        switch (Type)
274
        {
275
        case 16:
276
            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
277
                AcpiDmAddressNames[i]);
278
            break;
279
 
280
        case 32:
281
            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
282
                AcpiDmAddressNames[i]);
283
            break;
284
 
285
        case 64:
286
            AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
287
                AcpiDmAddressNames[i]);
288
            break;
289
 
290
        default:
291
            return;
292
        }
293
    }
294
}
295
 
296
 
297
/*******************************************************************************
298
 *
299
 * FUNCTION:    AcpiDmAddressPrefix
300
 *
301
 * PARAMETERS:  Type                - Descriptor type
302
 *
303
 * RETURN:      None
304
 *
305
 * DESCRIPTION: Emit name prefix representing the address descriptor type
306
 *
307
 ******************************************************************************/
308
 
309
static void
310
AcpiDmAddressPrefix (
311
    UINT8                   Type)
312
{
313
 
314
    switch (Type)
315
    {
316
    case ACPI_RESOURCE_TYPE_ADDRESS16:
317
        AcpiOsPrintf ("Word");
318
        break;
319
 
320
    case ACPI_RESOURCE_TYPE_ADDRESS32:
321
        AcpiOsPrintf ("DWord");
322
        break;
323
 
324
    case ACPI_RESOURCE_TYPE_ADDRESS64:
325
        AcpiOsPrintf ("QWord");
326
        break;
327
 
328
    case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
329
        AcpiOsPrintf ("Extended");
330
        break;
331
 
332
    default:
333
        return;
334
    }
335
}
336
 
337
 
338
/*******************************************************************************
339
 *
340
 * FUNCTION:    AcpiDmAddressCommon
341
 *
342
 * PARAMETERS:  Resource            - Raw AML descriptor
343
 *              Type                - Descriptor type
344
 *              Level               - Current source code indentation level
345
 *
346
 * RETURN:      None
347
 *
348
 * DESCRIPTION: Emit common name and flag fields common to address descriptors
349
 *
350
 ******************************************************************************/
351
 
352
static void
353
AcpiDmAddressCommon (
354
    AML_RESOURCE            *Resource,
355
    UINT8                   Type,
356
    UINT32                  Level)
357
{
358
    UINT8                   ResourceType;
359
    UINT8                   SpecificFlags;
360
    UINT8                   Flags;
361
 
362
 
363
    ResourceType = Resource->Address.ResourceType;
364
    SpecificFlags = Resource->Address.SpecificFlags;
365
    Flags = Resource->Address.Flags;
366
 
367
    AcpiDmIndent (Level);
368
 
369
    /* Validate ResourceType */
370
 
371
    if ((ResourceType > 2) && (ResourceType < 0xC0))
372
    {
373
        AcpiOsPrintf ("/**** Invalid Resource Type: 0x%X ****/", ResourceType);
374
        return;
375
    }
376
 
377
    /* Prefix is either Word, DWord, QWord, or Extended */
378
 
379
    AcpiDmAddressPrefix (Type);
380
 
381
    /* Resource Types above 0xC0 are vendor-defined */
382
 
383
    if (ResourceType > 2)
384
    {
385
        AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);
386
        AcpiDmSpaceFlags (Flags);
387
        AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);
388
        return;
389
    }
390
 
391
    /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
392
 
393
    AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ResourceType & 0x3]);
394
 
395
    /* Decode the general and type-specific flags */
396
 
397
    if (ResourceType == ACPI_MEMORY_RANGE)
398
    {
399
        AcpiDmMemoryFlags (Flags, SpecificFlags);
400
    }
401
    else /* IO range or BusNumberRange */
402
    {
403
        AcpiDmIoFlags (Flags);
404
        if (ResourceType == ACPI_IO_RANGE)
405
        {
406
            AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [SpecificFlags & 0x3]);
407
        }
408
    }
409
}
410
 
411
 
412
/*******************************************************************************
413
 *
414
 * FUNCTION:    AcpiDmAddressFlags
415
 *
416
 * PARAMETERS:  Resource        - Raw AML descriptor
417
 *
418
 * RETURN:      None
419
 *
420
 * DESCRIPTION: Emit flags common to address descriptors
421
 *
422
 ******************************************************************************/
423
 
424
static void
425
AcpiDmAddressFlags (
426
    AML_RESOURCE            *Resource)
427
{
428
 
429
    if (Resource->Address.ResourceType == ACPI_IO_RANGE)
430
    {
431
        AcpiDmIoFlags2 (Resource->Address.SpecificFlags);
432
    }
433
    else if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE)
434
    {
435
        AcpiDmMemoryFlags2 (Resource->Address.SpecificFlags);
436
    }
437
}
438
 
439
 
440
/*******************************************************************************
441
 *
442
 * FUNCTION:    AcpiDmSpaceFlags
443
 *
444
 * PARAMETERS:  Flags               - Flag byte to be decoded
445
 *
446
 * RETURN:      None
447
 *
448
 * DESCRIPTION: Decode the flags specific to Space Address space descriptors
449
 *
450
 ******************************************************************************/
451
 
452
static void
453
AcpiDmSpaceFlags (
454
    UINT8                   Flags)
455
{
456
 
457
    AcpiOsPrintf ("%s, %s, %s, %s,",
458
        AcpiGbl_ConsumeDecode [(Flags & 1)],
459
        AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
460
        AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
461
        AcpiGbl_MaxDecode [(Flags & 0x8) >> 3]);
462
}
463
 
464
 
465
/*******************************************************************************
466
 *
467
 * FUNCTION:    AcpiDmIoFlags
468
 *
469
 * PARAMETERS:  Flags               - Flag byte to be decoded
470
 *
471
 * RETURN:      None
472
 *
473
 * DESCRIPTION: Decode the flags specific to IO Address space descriptors
474
 *
475
 ******************************************************************************/
476
 
477
static void
478
AcpiDmIoFlags (
479
        UINT8               Flags)
480
{
481
    AcpiOsPrintf ("%s, %s, %s, %s,",
482
        AcpiGbl_ConsumeDecode [(Flags & 1)],
483
        AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
484
        AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
485
        AcpiGbl_DecDecode [(Flags & 0x2) >> 1]);
486
}
487
 
488
 
489
/*******************************************************************************
490
 *
491
 * FUNCTION:    AcpiDmIoFlags2
492
 *
493
 * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
494
 *
495
 * RETURN:      None
496
 *
497
 * DESCRIPTION: Decode the flags specific to IO Address space descriptors
498
 *
499
 ******************************************************************************/
500
 
501
static void
502
AcpiDmIoFlags2 (
503
        UINT8               SpecificFlags)
504
{
505
 
506
    AcpiOsPrintf (", %s",
507
        AcpiGbl_TtpDecode [(SpecificFlags & 0x10) >> 4]);
508
 
509
    /* TRS is only used if TTP is TypeTranslation */
510
 
511
    if (SpecificFlags & 0x10)
512
    {
513
        AcpiOsPrintf (", %s",
514
            AcpiGbl_TrsDecode [(SpecificFlags & 0x20) >> 5]);
515
    }
516
}
517
 
518
 
519
/*******************************************************************************
520
 *
521
 * FUNCTION:    AcpiDmMemoryFlags
522
 *
523
 * PARAMETERS:  Flags               - Flag byte to be decoded
524
 *              SpecificFlags       - "Specific" flag byte to be decoded
525
 *
526
 * RETURN:      None
527
 *
528
 * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
529
 *
530
 ******************************************************************************/
531
 
532
static void
533
AcpiDmMemoryFlags (
534
    UINT8                   Flags,
535
    UINT8                   SpecificFlags)
536
{
537
 
538
    AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
539
        AcpiGbl_ConsumeDecode [(Flags & 1)],
540
        AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
541
        AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
542
        AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
543
        AcpiGbl_MemDecode [(SpecificFlags & 0x6) >> 1],
544
        AcpiGbl_RwDecode [(SpecificFlags & 0x1)]);
545
}
546
 
547
 
548
/*******************************************************************************
549
 *
550
 * FUNCTION:    AcpiDmMemoryFlags2
551
 *
552
 * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
553
 *
554
 * RETURN:      None
555
 *
556
 * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
557
 *
558
 ******************************************************************************/
559
 
560
static void
561
AcpiDmMemoryFlags2 (
562
    UINT8                   SpecificFlags)
563
{
564
 
565
    AcpiOsPrintf (", %s, %s",
566
        AcpiGbl_MtpDecode [(SpecificFlags & 0x18) >> 3],
567
        AcpiGbl_TtpDecode [(SpecificFlags & 0x20) >> 5]);
568
}
569
 
570
 
571
/*******************************************************************************
572
 *
573
 * FUNCTION:    AcpiDmResourceSource
574
 *
575
 * PARAMETERS:  Resource        - Raw AML descriptor
576
 *              MinimumLength   - descriptor length without optional fields
577
 *              ResourceLength
578
 *
579
 * RETURN:      None
580
 *
581
 * DESCRIPTION: Dump optional ResourceSource fields of an address descriptor
582
 *
583
 ******************************************************************************/
584
 
585
static void
586
AcpiDmResourceSource (
587
    AML_RESOURCE            *Resource,
588
    ACPI_SIZE               MinimumTotalLength,
589
    UINT32                  ResourceLength)
590
{
591
    UINT8                   *AmlResourceSource;
592
    UINT32                  TotalLength;
593
 
594
 
595
    TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
596
 
597
    /* Check if the optional ResourceSource fields are present */
598
 
599
    if (TotalLength <= MinimumTotalLength)
600
    {
601
        /* The two optional fields are not used */
602
 
603
        AcpiOsPrintf (",, ");
604
        return;
605
    }
606
 
607
    /* Get a pointer to the ResourceSource */
608
 
609
    AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);
610
 
611
    /*
612
     * Always emit the ResourceSourceIndex (Byte)
613
     *
614
     * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the
615
     * Index even if the String does not exist. Although this is in violation
616
     * of the ACPI specification, it is very important to emit ASL code that
617
     * can be compiled back to the identical AML. There may be fields and/or
618
     * indexes into the resource template buffer that are compiled to absolute
619
     * offsets, and these will be broken if the AML length is changed.
620
     */
621
    AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);
622
 
623
    /* Make sure that the ResourceSource string exists before dumping it */
624
 
625
    if (TotalLength > (MinimumTotalLength + 1))
626
    {
627
        AcpiOsPrintf (" ");
628
        AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX);
629
    }
630
 
631
    AcpiOsPrintf (", ");
632
}
633
 
634
 
635
/*******************************************************************************
636
 *
637
 * FUNCTION:    AcpiDmWordDescriptor
638
 *
639
 * PARAMETERS:  Resource            - Pointer to the resource descriptor
640
 *              Length              - Length of the descriptor in bytes
641
 *              Level               - Current source code indentation level
642
 *
643
 * RETURN:      None
644
 *
645
 * DESCRIPTION: Decode a Word Address Space descriptor
646
 *
647
 ******************************************************************************/
648
 
649
void
650
AcpiDmWordDescriptor (
651
    AML_RESOURCE            *Resource,
652
    UINT32                  Length,
653
    UINT32                  Level)
654
{
655
 
656
    /* Dump resource name and flags */
657
 
658
    AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS16, Level);
659
 
660
    /* Dump the 5 contiguous WORD values */
661
 
662
    AcpiDmAddressFields (&Resource->Address16.Granularity, 16, Level);
663
 
664
    /* The ResourceSource fields are optional */
665
 
666
    AcpiDmIndent (Level + 1);
667
    AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS16), Length);
668
 
669
    /* Insert a descriptor name */
670
 
671
    AcpiDmDescriptorName ();
672
 
673
    /* Type-specific flags */
674
 
675
    AcpiDmAddressFlags (Resource);
676
    AcpiOsPrintf (")\n");
677
}
678
 
679
 
680
/*******************************************************************************
681
 *
682
 * FUNCTION:    AcpiDmDwordDescriptor
683
 *
684
 * PARAMETERS:  Resource            - Pointer to the resource descriptor
685
 *              Length              - Length of the descriptor in bytes
686
 *              Level               - Current source code indentation level
687
 *
688
 * RETURN:      None
689
 *
690
 * DESCRIPTION: Decode a DWord Address Space descriptor
691
 *
692
 ******************************************************************************/
693
 
694
void
695
AcpiDmDwordDescriptor (
696
    AML_RESOURCE            *Resource,
697
    UINT32                  Length,
698
    UINT32                  Level)
699
{
700
 
701
    /* Dump resource name and flags */
702
 
703
    AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS32, Level);
704
 
705
    /* Dump the 5 contiguous DWORD values */
706
 
707
    AcpiDmAddressFields (&Resource->Address32.Granularity, 32, Level);
708
 
709
    /* The ResourceSource fields are optional */
710
 
711
    AcpiDmIndent (Level + 1);
712
    AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS32), Length);
713
 
714
    /* Insert a descriptor name */
715
 
716
    AcpiDmDescriptorName ();
717
 
718
    /* Type-specific flags */
719
 
720
    AcpiDmAddressFlags (Resource);
721
    AcpiOsPrintf (")\n");
722
}
723
 
724
 
725
/*******************************************************************************
726
 *
727
 * FUNCTION:    AcpiDmQwordDescriptor
728
 *
729
 * PARAMETERS:  Resource            - Pointer to the resource descriptor
730
 *              Length              - Length of the descriptor in bytes
731
 *              Level               - Current source code indentation level
732
 *
733
 * RETURN:      None
734
 *
735
 * DESCRIPTION: Decode a QWord Address Space descriptor
736
 *
737
 ******************************************************************************/
738
 
739
void
740
AcpiDmQwordDescriptor (
741
    AML_RESOURCE            *Resource,
742
    UINT32                  Length,
743
    UINT32                  Level)
744
{
745
 
746
    /* Dump resource name and flags */
747
 
748
    AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS64, Level);
749
 
750
    /* Dump the 5 contiguous QWORD values */
751
 
752
    AcpiDmAddressFields (&Resource->Address64.Granularity, 64, Level);
753
 
754
    /* The ResourceSource fields are optional */
755
 
756
    AcpiDmIndent (Level + 1);
757
    AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS64), Length);
758
 
759
    /* Insert a descriptor name */
760
 
761
    AcpiDmDescriptorName ();
762
 
763
    /* Type-specific flags */
764
 
765
    AcpiDmAddressFlags (Resource);
766
    AcpiOsPrintf (")\n");
767
}
768
 
769
 
770
/*******************************************************************************
771
 *
772
 * FUNCTION:    AcpiDmExtendedDescriptor
773
 *
774
 * PARAMETERS:  Resource            - Pointer to the resource descriptor
775
 *              Length              - Length of the descriptor in bytes
776
 *              Level               - Current source code indentation level
777
 *
778
 * RETURN:      None
779
 *
780
 * DESCRIPTION: Decode a Extended Address Space descriptor
781
 *
782
 ******************************************************************************/
783
 
784
void
785
AcpiDmExtendedDescriptor (
786
    AML_RESOURCE            *Resource,
787
    UINT32                  Length,
788
    UINT32                  Level)
789
{
790
 
791
    /* Dump resource name and flags */
792
 
793
    AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level);
794
 
795
    /* Dump the 5 contiguous QWORD values */
796
 
797
    AcpiDmAddressFields (&Resource->ExtAddress64.Granularity, 64, Level);
798
 
799
    /* Extra field for this descriptor only */
800
 
801
    AcpiDmIndent (Level + 1);
802
    AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,
803
        "Type-Specific Attributes");
804
 
805
    /* Insert a descriptor name */
806
 
807
    AcpiDmIndent (Level + 1);
808
    AcpiDmDescriptorName ();
809
 
810
    /* Type-specific flags */
811
 
812
    AcpiDmAddressFlags (Resource);
813
    AcpiOsPrintf (")\n");
814
}
815
 
816
 
817
/*******************************************************************************
818
 *
819
 * FUNCTION:    AcpiDmMemory24Descriptor
820
 *
821
 * PARAMETERS:  Resource            - Pointer to the resource descriptor
822
 *              Length              - Length of the descriptor in bytes
823
 *              Level               - Current source code indentation level
824
 *
825
 * RETURN:      None
826
 *
827
 * DESCRIPTION: Decode a Memory24 descriptor
828
 *
829
 ******************************************************************************/
830
 
831
void
832
AcpiDmMemory24Descriptor (
833
    AML_RESOURCE            *Resource,
834
    UINT32                  Length,
835
    UINT32                  Level)
836
{
837
 
838
    /* Dump name and read/write flag */
839
 
840
    AcpiDmIndent (Level);
841
    AcpiOsPrintf ("Memory24 (%s,\n",
842
        AcpiGbl_RwDecode [Resource->Memory24.Flags & 1]);
843
 
844
    /* Dump the 4 contiguous WORD values */
845
 
846
    AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
847
 
848
    /* Insert a descriptor name */
849
 
850
    AcpiDmIndent (Level + 1);
851
    AcpiDmDescriptorName ();
852
    AcpiOsPrintf (")\n");
853
}
854
 
855
 
856
/*******************************************************************************
857
 *
858
 * FUNCTION:    AcpiDmMemory32Descriptor
859
 *
860
 * PARAMETERS:  Resource            - Pointer to the resource descriptor
861
 *              Length              - Length of the descriptor in bytes
862
 *              Level               - Current source code indentation level
863
 *
864
 * RETURN:      None
865
 *
866
 * DESCRIPTION: Decode a Memory32 descriptor
867
 *
868
 ******************************************************************************/
869
 
870
void
871
AcpiDmMemory32Descriptor (
872
    AML_RESOURCE            *Resource,
873
    UINT32                  Length,
874
    UINT32                  Level)
875
{
876
 
877
    /* Dump name and read/write flag */
878
 
879
    AcpiDmIndent (Level);
880
    AcpiOsPrintf ("Memory32 (%s,\n",
881
        AcpiGbl_RwDecode [Resource->Memory32.Flags & 1]);
882
 
883
    /* Dump the 4 contiguous DWORD values */
884
 
885
    AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
886
 
887
    /* Insert a descriptor name */
888
 
889
    AcpiDmIndent (Level + 1);
890
    AcpiDmDescriptorName ();
891
    AcpiOsPrintf (")\n");
892
}
893
 
894
 
895
/*******************************************************************************
896
 *
897
 * FUNCTION:    AcpiDmFixedMemory32Descriptor
898
 *
899
 * PARAMETERS:  Resource            - Pointer to the resource descriptor
900
 *              Length              - Length of the descriptor in bytes
901
 *              Level               - Current source code indentation level
902
 *
903
 * RETURN:      None
904
 *
905
 * DESCRIPTION: Decode a Fixed Memory32 descriptor
906
 *
907
 ******************************************************************************/
908
 
909
void
910
AcpiDmFixedMemory32Descriptor (
911
    AML_RESOURCE            *Resource,
912
    UINT32                  Length,
913
    UINT32                  Level)
914
{
915
 
916
    /* Dump name and read/write flag */
917
 
918
    AcpiDmIndent (Level);
919
    AcpiOsPrintf ("Memory32Fixed (%s,\n",
920
        AcpiGbl_RwDecode [Resource->FixedMemory32.Flags & 1]);
921
 
922
    AcpiDmIndent (Level + 1);
923
    AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base");
924
 
925
    AcpiDmIndent (Level + 1);
926
    AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length");
927
 
928
    /* Insert a descriptor name */
929
 
930
    AcpiDmIndent (Level + 1);
931
    AcpiDmDescriptorName ();
932
    AcpiOsPrintf (")\n");
933
}
934
 
935
 
936
/*******************************************************************************
937
 *
938
 * FUNCTION:    AcpiDmGenericRegisterDescriptor
939
 *
940
 * PARAMETERS:  Resource            - Pointer to the resource descriptor
941
 *              Length              - Length of the descriptor in bytes
942
 *              Level               - Current source code indentation level
943
 *
944
 * RETURN:      None
945
 *
946
 * DESCRIPTION: Decode a Generic Register descriptor
947
 *
948
 ******************************************************************************/
949
 
950
void
951
AcpiDmGenericRegisterDescriptor (
952
    AML_RESOURCE            *Resource,
953
    UINT32                  Length,
954
    UINT32                  Level)
955
{
956
 
957
    AcpiDmIndent (Level);
958
    AcpiOsPrintf ("Register (");
959
    AcpiDmAddressSpace (Resource->GenericReg.AddressSpaceId);
960
    AcpiOsPrintf ("\n");
961
 
962
    AcpiDmIndent (Level + 1);
963
    AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Bit Width");
964
 
965
    AcpiDmIndent (Level + 1);
966
    AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
967
 
968
    AcpiDmIndent (Level + 1);
969
    AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
970
 
971
    /* Optional field for ACPI 3.0 */
972
 
973
    AcpiDmIndent (Level + 1);
974
    if (Resource->GenericReg.AccessSize)
975
    {
976
        AcpiOsPrintf ("0x%2.2X,               // %s\n",
977
            Resource->GenericReg.AccessSize, "Access Size");
978
        AcpiDmIndent (Level + 1);
979
    }
980
    else
981
    {
982
        AcpiOsPrintf (",");
983
    }
984
 
985
    /* DescriptorName was added for ACPI 3.0+ */
986
 
987
    AcpiDmDescriptorName ();
988
    AcpiOsPrintf (")\n");
989
}
990
 
991
 
992
/*******************************************************************************
993
 *
994
 * FUNCTION:    AcpiDmInterruptDescriptor
995
 *
996
 * PARAMETERS:  Resource            - Pointer to the resource descriptor
997
 *              Length              - Length of the descriptor in bytes
998
 *              Level               - Current source code indentation level
999
 *
1000
 * RETURN:      None
1001
 *
1002
 * DESCRIPTION: Decode a extended Interrupt descriptor
1003
 *
1004
 ******************************************************************************/
1005
 
1006
void
1007
AcpiDmInterruptDescriptor (
1008
    AML_RESOURCE            *Resource,
1009
    UINT32                  Length,
1010
    UINT32                  Level)
1011
{
1012
    UINT32                  i;
1013
 
1014
 
1015
    AcpiDmIndent (Level);
1016
    AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
1017
        AcpiGbl_ConsumeDecode [(Resource->ExtendedIrq.Flags & 1)],
1018
        AcpiGbl_HeDecode [(Resource->ExtendedIrq.Flags >> 1) & 1],
1019
        AcpiGbl_LlDecode [(Resource->ExtendedIrq.Flags >> 2) & 1],
1020
        AcpiGbl_ShrDecode [(Resource->ExtendedIrq.Flags >> 3) & 1]);
1021
 
1022
    /*
1023
     * The ResourceSource fields are optional and appear after the interrupt
1024
     * list. Must compute length based on length of the list. First xrupt
1025
     * is included in the struct (reason for -1 below)
1026
     */
1027
    AcpiDmResourceSource (Resource,
1028
        sizeof (AML_RESOURCE_EXTENDED_IRQ) +
1029
            ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
1030
        Resource->ExtendedIrq.ResourceLength);
1031
 
1032
    /* Insert a descriptor name */
1033
 
1034
    AcpiDmDescriptorName ();
1035
    AcpiOsPrintf (")\n");
1036
 
1037
    /* Dump the interrupt list */
1038
 
1039
    AcpiDmIndent (Level);
1040
    AcpiOsPrintf ("{\n");
1041
    for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
1042
    {
1043
        AcpiDmIndent (Level + 1);
1044
        AcpiOsPrintf ("0x%8.8X,\n",
1045
            (UINT32) Resource->ExtendedIrq.Interrupts[i]);
1046
    }
1047
 
1048
    AcpiDmIndent (Level);
1049
    AcpiOsPrintf ("}\n");
1050
}
1051
 
1052
 
1053
/*******************************************************************************
1054
 *
1055
 * FUNCTION:    AcpiDmVendorCommon
1056
 *
1057
 * PARAMETERS:  Name                - Descriptor name suffix
1058
 *              ByteData            - Pointer to the vendor byte data
1059
 *              Length              - Length of the byte data
1060
 *              Level               - Current source code indentation level
1061
 *
1062
 * RETURN:      None
1063
 *
1064
 * DESCRIPTION: Decode a Vendor descriptor, both Large and Small
1065
 *
1066
 ******************************************************************************/
1067
 
1068
void
1069
AcpiDmVendorCommon (
1070
    char                    *Name,
1071
    UINT8                   *ByteData,
1072
    UINT32                  Length,
1073
    UINT32                  Level)
1074
{
1075
 
1076
    /* Dump macro name */
1077
 
1078
    AcpiDmIndent (Level);
1079
    AcpiOsPrintf ("Vendor%s (", Name);
1080
 
1081
    /* Insert a descriptor name */
1082
 
1083
    AcpiDmDescriptorName ();
1084
    AcpiOsPrintf (")      // Length = 0x%.2X\n", Length);
1085
 
1086
    /* Dump the vendor bytes */
1087
 
1088
    AcpiDmIndent (Level);
1089
    AcpiOsPrintf ("{\n");
1090
 
1091
    AcpiDmDisasmByteList (Level + 1, ByteData, Length);
1092
 
1093
    AcpiDmIndent (Level);
1094
    AcpiOsPrintf ("}\n");
1095
}
1096
 
1097
 
1098
/*******************************************************************************
1099
 *
1100
 * FUNCTION:    AcpiDmVendorLargeDescriptor
1101
 *
1102
 * PARAMETERS:  Resource            - Pointer to the resource descriptor
1103
 *              Length              - Length of the descriptor in bytes
1104
 *              Level               - Current source code indentation level
1105
 *
1106
 * RETURN:      None
1107
 *
1108
 * DESCRIPTION: Decode a Vendor Large descriptor
1109
 *
1110
 ******************************************************************************/
1111
 
1112
void
1113
AcpiDmVendorLargeDescriptor (
1114
    AML_RESOURCE            *Resource,
1115
    UINT32                  Length,
1116
    UINT32                  Level)
1117
{
1118
 
1119
    AcpiDmVendorCommon ("Long ",
1120
        ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
1121
        Length, Level);
1122
}
1123
 
1124
#endif
1125