rsdump.c revision 193267
119370Spst/*******************************************************************************
219370Spst *
319370Spst * Module Name: rsdump - Functions to display the resource structures.
419370Spst *
519370Spst ******************************************************************************/
619370Spst
719370Spst/******************************************************************************
898944Sobrien *
919370Spst * 1. Copyright Notice
1098944Sobrien *
1119370Spst * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
1298944Sobrien * All rights reserved.
1346283Sdfr *
1419370Spst * 2. License
1519370Spst *
1698944Sobrien * 2.1. This is your license from Intel Corp. under its intellectual property
1719370Spst * rights.  You may have additional license terms from the party that provided
1819370Spst * you this software, covering your right to use that party's intellectual
1919370Spst * property rights.
2019370Spst *
2119370Spst * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2219370Spst * copy of the source code appearing in this file ("Covered Code") an
2346283Sdfr * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2419370Spst * base code distributed originally by Intel ("Original Intel Code") to copy,
2519370Spst * make derivatives, distribute, use and display any portion of the Covered
2619370Spst * Code in any form, with the right to sublicense such rights; and
2719370Spst *
2819370Spst * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
2919370Spst * license (with the right to sublicense), under only those claims of Intel
3019370Spst * patents that are infringed by the Original Intel Code, to make, use, sell,
3119370Spst * offer to sell, and import the Covered Code and derivative works thereof
3219370Spst * solely to the minimum extent necessary to exercise the above copyright
3319370Spst * license, and in no event shall the patent license extend to any additions
3419370Spst * to or modifications of the Original Intel Code.  No other license or right
3519370Spst * is granted directly or by implication, estoppel or otherwise;
3619370Spst *
3719370Spst * The above copyright and patent license is granted only if the following
3819370Spst * conditions are met:
3919370Spst *
4019370Spst * 3. Conditions
4119370Spst *
4219370Spst * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4319370Spst * Redistribution of source code of any substantial portion of the Covered
4419370Spst * Code or modification with rights to further distribute source must include
4519370Spst * the above Copyright Notice, the above License, this list of Conditions,
4619370Spst * and the following Disclaimer and Export Compliance provision.  In addition,
4719370Spst * Licensee must cause all Covered Code to which Licensee contributes to
4819370Spst * contain a file documenting the changes Licensee made to create that Covered
4919370Spst * Code and the date of any change.  Licensee must include in that file the
5019370Spst * documentation of any changes made by any predecessor Licensee.  Licensee
5119370Spst * must include a prominent statement that the modification is derived,
5219370Spst * directly or indirectly, from Original Intel Code.
5319370Spst *
5419370Spst * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5519370Spst * Redistribution of source code of any substantial portion of the Covered
5619370Spst * Code or modification without rights to further distribute source must
5719370Spst * include the following Disclaimer and Export Compliance provision in the
5819370Spst * documentation and/or other materials provided with distribution.  In
5919370Spst * addition, Licensee may not authorize further sublicense of source of any
6019370Spst * portion of the Covered Code, and must include terms to the effect that the
6119370Spst * license from Licensee to its licensee is limited to the intellectual
6219370Spst * property embodied in the software Licensee provides to its licensee, and
6319370Spst * not to intellectual property embodied in modifications its licensee may
6419370Spst * make.
6519370Spst *
6619370Spst * 3.3. Redistribution of Executable. Redistribution in executable form of any
6719370Spst * substantial portion of the Covered Code or modification must reproduce the
6819370Spst * above Copyright Notice, and the following Disclaimer and Export Compliance
6919370Spst * provision in the documentation and/or other materials provided with the
7019370Spst * distribution.
7119370Spst *
7219370Spst * 3.4. Intel retains all right, title, and interest in and to the Original
7319370Spst * Intel Code.
7419370Spst *
7519370Spst * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7619370Spst * Intel shall be used in advertising or otherwise to promote the sale, use or
7719370Spst * other dealings in products derived from or relating to the Covered Code
7819370Spst * without prior written authorization from Intel.
7919370Spst *
8019370Spst * 4. Disclaimer and Export Compliance
8119370Spst *
8219370Spst * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8319370Spst * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8419370Spst * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8519370Spst * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8619370Spst * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
8719370Spst * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8819370Spst * PARTICULAR PURPOSE.
8919370Spst *
9019370Spst * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9119370Spst * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9219370Spst * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9319370Spst * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9419370Spst * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9519370Spst * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
9619370Spst * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9719370Spst * LIMITED REMEDY.
9819370Spst *
9919370Spst * 4.3. Licensee shall not export, either directly or indirectly, any of this
10019370Spst * software or system incorporating such software without first obtaining any
10119370Spst * required license or other approval from the U. S. Department of Commerce or
10219370Spst * any other agency or department of the United States Government.  In the
10319370Spst * event Licensee exports any such software from the United States or
10419370Spst * re-exports any such software from a foreign destination, Licensee shall
10519370Spst * ensure that the distribution and export/re-export of the software is in
10619370Spst * compliance with all laws, regulations, orders, or other restrictions of the
10719370Spst * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10819370Spst * any of its subsidiaries will export/re-export any technical data, process,
10919370Spst * software, or service, directly or indirectly, to any country for which the
11019370Spst * United States government or any agency thereof requires an export license,
11119370Spst * other governmental approval, or letter of assurance, without first obtaining
11219370Spst * such license, approval or letter.
11319370Spst *
11419370Spst *****************************************************************************/
11519370Spst
11619370Spst
11719370Spst#define __RSDUMP_C__
11819370Spst
11919370Spst#include "acpi.h"
12019370Spst#include "accommon.h"
12119370Spst#include "acresrc.h"
12219370Spst
12319370Spst#define _COMPONENT          ACPI_RESOURCES
12419370Spst        ACPI_MODULE_NAME    ("rsdump")
12519370Spst
12619370Spst
12719370Spst#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
12819370Spst
12919370Spst/* Local prototypes */
13019370Spst
13119370Spststatic void
13219370SpstAcpiRsOutString (
13319370Spst    char                    *Title,
13419370Spst    char                    *Value);
13519370Spst
13619370Spststatic void
13719370SpstAcpiRsOutInteger8 (
13819370Spst    char                    *Title,
13919370Spst    UINT8                   Value);
14019370Spst
14119370Spststatic void
14219370SpstAcpiRsOutInteger16 (
14319370Spst    char                    *Title,
14419370Spst    UINT16                  Value);
14519370Spst
14619370Spststatic void
14719370SpstAcpiRsOutInteger32 (
14819370Spst    char                    *Title,
14919370Spst    UINT32                  Value);
15019370Spst
15119370Spststatic void
15219370SpstAcpiRsOutInteger64 (
15319370Spst    char                    *Title,
15419370Spst    UINT64                  Value);
15519370Spst
15619370Spststatic void
15719370SpstAcpiRsOutTitle (
15819370Spst    char                    *Title);
15919370Spst
16019370Spststatic void
16119370SpstAcpiRsDumpByteList (
16219370Spst    UINT16                  Length,
16319370Spst    UINT8                   *Data);
16419370Spst
16519370Spststatic void
16619370SpstAcpiRsDumpDwordList (
16719370Spst    UINT8                   Length,
16819370Spst    UINT32                  *Data);
16919370Spst
17019370Spststatic void
17119370SpstAcpiRsDumpShortByteList (
17219370Spst    UINT8                  Length,
17319370Spst    UINT8                  *Data);
17419370Spst
17519370Spststatic void
17619370SpstAcpiRsDumpResourceSource (
17719370Spst    ACPI_RESOURCE_SOURCE    *ResourceSource);
17819370Spst
17919370Spststatic void
18019370SpstAcpiRsDumpAddressCommon (
18119370Spst    ACPI_RESOURCE_DATA      *Resource);
18219370Spst
18319370Spststatic void
18419370SpstAcpiRsDumpDescriptor (
18519370Spst    void                    *Resource,
18619370Spst    ACPI_RSDUMP_INFO *Table);
18719370Spst
18819370Spst
18919370Spst#define ACPI_RSD_OFFSET(f)          (UINT8) ACPI_OFFSET (ACPI_RESOURCE_DATA,f)
19019370Spst#define ACPI_PRT_OFFSET(f)          (UINT8) ACPI_OFFSET (ACPI_PCI_ROUTING_TABLE,f)
19119370Spst#define ACPI_RSD_TABLE_SIZE(name)   (sizeof(name) / sizeof (ACPI_RSDUMP_INFO))
19219370Spst
19319370Spst
19419370Spst/*******************************************************************************
19519370Spst *
19619370Spst * Resource Descriptor info tables
19719370Spst *
19819370Spst * Note: The first table entry must be a Title or Literal and must contain
19919370Spst * the table length (number of table entries)
20019370Spst *
20119370Spst ******************************************************************************/
20219370Spst
20319370SpstACPI_RSDUMP_INFO        AcpiRsDumpIrq[7] =
20419370Spst{
20519370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq),                "IRQ",                      NULL},
20619370Spst    {ACPI_RSD_UINT8 ,   ACPI_RSD_OFFSET (Irq.DescriptorLength),             "Descriptor Length",        NULL},
20719370Spst    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering),                   "Triggering",               AcpiGbl_HeDecode},
20819370Spst    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity),                     "Polarity",                 AcpiGbl_LlDecode},
20919370Spst    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable),                     "Sharing",                  AcpiGbl_ShrDecode},
21019370Spst    {ACPI_RSD_UINT8 ,   ACPI_RSD_OFFSET (Irq.InterruptCount),               "Interrupt Count",          NULL},
21119370Spst    {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]),                "Interrupt List",           NULL}
21219370Spst};
21319370Spst
21419370SpstACPI_RSDUMP_INFO        AcpiRsDumpDma[6] =
21519370Spst{
21619370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpDma),                "DMA",                      NULL},
21719370Spst    {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type),                         "Speed",                    AcpiGbl_TypDecode},
21819370Spst    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster),                    "Mastering",                AcpiGbl_BmDecode},
21919370Spst    {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer),                     "Transfer Type",            AcpiGbl_SizDecode},
22019370Spst    {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (Dma.ChannelCount),                 "Channel Count",            NULL},
22119370Spst    {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]),                  "Channel List",             NULL}
22219370Spst};
22319370Spst
22419370SpstACPI_RSDUMP_INFO        AcpiRsDumpStartDpf[4] =
22519370Spst{
22619370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpStartDpf),           "Start-Dependent-Functions",NULL},
22719370Spst    {ACPI_RSD_UINT8 ,   ACPI_RSD_OFFSET (StartDpf.DescriptorLength),        "Descriptor Length",        NULL},
22819370Spst    {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.CompatibilityPriority),   "Compatibility Priority",   AcpiGbl_ConfigDecode},
22919370Spst    {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.PerformanceRobustness),   "Performance/Robustness",   AcpiGbl_ConfigDecode}
23019370Spst};
23119370Spst
23219370SpstACPI_RSDUMP_INFO        AcpiRsDumpEndDpf[1] =
23319370Spst{
23419370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndDpf),             "End-Dependent-Functions",  NULL}
23519370Spst};
23619370Spst
23719370SpstACPI_RSDUMP_INFO        AcpiRsDumpIo[6] =
23819370Spst{
23919370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpIo),                 "I/O",                      NULL},
24019370Spst    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Io.IoDecode),                      "Address Decoding",         AcpiGbl_IoDecode},
24119370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Io.Minimum),                       "Address Minimum",          NULL},
24219370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Io.Maximum),                       "Address Maximum",          NULL},
24319370Spst    {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (Io.Alignment),                     "Alignment",                NULL},
24419370Spst    {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (Io.AddressLength),                 "Address Length",           NULL}
24519370Spst};
24619370Spst
24719370SpstACPI_RSDUMP_INFO        AcpiRsDumpFixedIo[3] =
24819370Spst{
24919370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedIo),            "Fixed I/O",                NULL},
25019370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (FixedIo.Address),                  "Address",                  NULL},
25119370Spst    {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (FixedIo.AddressLength),            "Address Length",           NULL}
25219370Spst};
25319370Spst
25419370SpstACPI_RSDUMP_INFO        AcpiRsDumpVendor[3] =
25519370Spst{
25619370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpVendor),             "Vendor Specific",          NULL},
25719370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Vendor.ByteLength),                "Length",                   NULL},
25819370Spst    {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET (Vendor.ByteData[0]),               "Vendor Data",              NULL}
25919370Spst};
26019370Spst
26119370SpstACPI_RSDUMP_INFO        AcpiRsDumpEndTag[1] =
26219370Spst{
26319370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndTag),             "EndTag",                   NULL}
26419370Spst};
26519370Spst
26619370SpstACPI_RSDUMP_INFO        AcpiRsDumpMemory24[6] =
26719370Spst{
26819370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory24),           "24-Bit Memory Range",      NULL},
26919370Spst    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect),            "Write Protect",            AcpiGbl_RwDecode},
27019370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.Minimum),                 "Address Minimum",          NULL},
27119370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.Maximum),                 "Address Maximum",          NULL},
27219370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.Alignment),               "Alignment",                NULL},
27319370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.AddressLength),           "Address Length",           NULL}
27419370Spst};
27519370Spst
27619370SpstACPI_RSDUMP_INFO        AcpiRsDumpMemory32[6] =
27719370Spst{
27819370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory32),           "32-Bit Memory Range",      NULL},
27919370Spst    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect),            "Write Protect",            AcpiGbl_RwDecode},
28098944Sobrien    {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.Minimum),                 "Address Minimum",          NULL},
28119370Spst    {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.Maximum),                 "Address Maximum",          NULL},
28219370Spst    {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.Alignment),               "Alignment",                NULL},
28319370Spst    {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.AddressLength),           "Address Length",           NULL}
28419370Spst};
28519370Spst
28619370SpstACPI_RSDUMP_INFO        AcpiRsDumpFixedMemory32[4] =
28719370Spst{
28819370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedMemory32),      "32-Bit Fixed Memory Range",NULL},
28919370Spst    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect),       "Write Protect",            AcpiGbl_RwDecode},
29019370Spst    {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (FixedMemory32.Address),            "Address",                  NULL},
29119370Spst    {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (FixedMemory32.AddressLength),      "Address Length",           NULL}
29219370Spst};
29319370Spst
29419370SpstACPI_RSDUMP_INFO        AcpiRsDumpAddress16[8] =
29519370Spst{
29619370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress16),          "16-Bit WORD Address Space",NULL},
29719370Spst    {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
29819370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.Granularity),            "Granularity",              NULL},
29919370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.Minimum),                "Address Minimum",          NULL},
30019370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.Maximum),                "Address Maximum",          NULL},
30119370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.TranslationOffset),      "Translation Offset",       NULL},
30219370Spst    {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.AddressLength),          "Address Length",           NULL},
30319370Spst    {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (Address16.ResourceSource),         NULL,                       NULL}
30419370Spst};
30519370Spst
30619370SpstACPI_RSDUMP_INFO        AcpiRsDumpAddress32[8] =
30719370Spst{
30819370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress32),         "32-Bit DWORD Address Space", NULL},
30998944Sobrien    {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
31019370Spst    {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.Granularity),            "Granularity",              NULL},
31119370Spst    {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.Minimum),                "Address Minimum",          NULL},
31219370Spst    {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.Maximum),                "Address Maximum",          NULL},
31319370Spst    {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.TranslationOffset),      "Translation Offset",       NULL},
31419370Spst    {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.AddressLength),          "Address Length",           NULL},
31519370Spst    {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (Address32.ResourceSource),         NULL,                       NULL}
31619370Spst};
31719370Spst
31819370SpstACPI_RSDUMP_INFO        AcpiRsDumpAddress64[8] =
31919370Spst{
32019370Spst    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress64),          "64-Bit QWORD Address Space", NULL},
32119370Spst    {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
32219370Spst    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.Granularity),            "Granularity",              NULL},
32319370Spst    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.Minimum),                "Address Minimum",          NULL},
324    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.Maximum),                "Address Maximum",          NULL},
325    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.TranslationOffset),      "Translation Offset",       NULL},
326    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.AddressLength),          "Address Length",           NULL},
327    {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (Address64.ResourceSource),         NULL,                       NULL}
328};
329
330ACPI_RSDUMP_INFO        AcpiRsDumpExtAddress64[8] =
331{
332    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtAddress64),       "64-Bit Extended Address Space", NULL},
333    {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
334    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.Granularity),         "Granularity",              NULL},
335    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.Minimum),             "Address Minimum",          NULL},
336    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.Maximum),             "Address Maximum",          NULL},
337    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.TranslationOffset),   "Translation Offset",       NULL},
338    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.AddressLength),       "Address Length",           NULL},
339    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.TypeSpecific),        "Type-Specific Attribute",  NULL}
340};
341
342ACPI_RSDUMP_INFO        AcpiRsDumpExtIrq[8] =
343{
344    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtIrq),             "Extended IRQ",             NULL},
345    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer),     "Type",                     AcpiGbl_ConsumeDecode},
346    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering),           "Triggering",               AcpiGbl_HeDecode},
347    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity),             "Polarity",                 AcpiGbl_LlDecode},
348    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable),             "Sharing",                  AcpiGbl_ShrDecode},
349    {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource),       NULL,                       NULL},
350    {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount),       "Interrupt Count",          NULL},
351    {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]),        "Interrupt List",           NULL}
352};
353
354ACPI_RSDUMP_INFO        AcpiRsDumpGenericReg[6] =
355{
356    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpGenericReg),         "Generic Register",         NULL},
357    {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.SpaceId),               "Space ID",                 NULL},
358    {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.BitWidth),              "Bit Width",                NULL},
359    {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.BitOffset),             "Bit Offset",               NULL},
360    {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.AccessSize),            "Access Size",              NULL},
361    {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (GenericReg.Address),               "Address",                  NULL}
362};
363
364
365/*
366 * Tables used for common address descriptor flag fields
367 */
368static ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[5] =
369{
370    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpGeneralFlags),       NULL,                       NULL},
371    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.ProducerConsumer),         "Consumer/Producer",        AcpiGbl_ConsumeDecode},
372    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode),                   "Address Decode",           AcpiGbl_DecDecode},
373    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MinAddressFixed),          "Min Relocatability",       AcpiGbl_MinDecode},
374    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MaxAddressFixed),          "Max Relocatability",       AcpiGbl_MaxDecode}
375};
376
377static ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[5] =
378{
379    {ACPI_RSD_LITERAL,  ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags),        "Resource Type",            (void *) "Memory Range"},
380    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect),    "Write Protect",            AcpiGbl_RwDecode},
381    {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching),         "Caching",                  AcpiGbl_MemDecode},
382    {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType),       "Range Type",               AcpiGbl_MtpDecode},
383    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation),     "Translation",              AcpiGbl_TtpDecode}
384};
385
386static ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[4] =
387{
388    {ACPI_RSD_LITERAL,  ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags),            "Resource Type",            (void *) "I/O Range"},
389    {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType),        "Range Type",               AcpiGbl_RngDecode},
390    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation),      "Translation",              AcpiGbl_TtpDecode},
391    {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType),  "Translation Type",         AcpiGbl_TrsDecode}
392};
393
394
395/*
396 * Table used to dump _PRT contents
397 */
398static ACPI_RSDUMP_INFO   AcpiRsDumpPrt[5] =
399{
400    {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpPrt),                NULL,                       NULL},
401    {ACPI_RSD_UINT64,   ACPI_PRT_OFFSET (Address),                          "Address",                  NULL},
402    {ACPI_RSD_UINT32,   ACPI_PRT_OFFSET (Pin),                              "Pin",                      NULL},
403    {ACPI_RSD_STRING,   ACPI_PRT_OFFSET (Source[0]),                        "Source",                   NULL},
404    {ACPI_RSD_UINT32,   ACPI_PRT_OFFSET (SourceIndex),                      "Source Index",             NULL}
405};
406
407
408/*******************************************************************************
409 *
410 * FUNCTION:    AcpiRsDumpDescriptor
411 *
412 * PARAMETERS:  Resource
413 *
414 * RETURN:      None
415 *
416 * DESCRIPTION:
417 *
418 ******************************************************************************/
419
420static void
421AcpiRsDumpDescriptor (
422    void                    *Resource,
423    ACPI_RSDUMP_INFO        *Table)
424{
425    UINT8                   *Target = NULL;
426    UINT8                   *PreviousTarget;
427    char                    *Name;
428    UINT8                    Count;
429
430
431    /* First table entry must contain the table length (# of table entries) */
432
433    Count = Table->Offset;
434
435    while (Count)
436    {
437        PreviousTarget = Target;
438        Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset);
439        Name = Table->Name;
440
441        switch (Table->Opcode)
442        {
443        case ACPI_RSD_TITLE:
444            /*
445             * Optional resource title
446             */
447            if (Table->Name)
448            {
449                AcpiOsPrintf ("%s Resource\n", Name);
450            }
451            break;
452
453        /* Strings */
454
455        case ACPI_RSD_LITERAL:
456            AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer));
457            break;
458
459        case ACPI_RSD_STRING:
460            AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target));
461            break;
462
463        /* Data items, 8/16/32/64 bit */
464
465        case ACPI_RSD_UINT8:
466            AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));
467            break;
468
469        case ACPI_RSD_UINT16:
470            AcpiRsOutInteger16 (Name, ACPI_GET16 (Target));
471            break;
472
473        case ACPI_RSD_UINT32:
474            AcpiRsOutInteger32 (Name, ACPI_GET32 (Target));
475            break;
476
477        case ACPI_RSD_UINT64:
478            AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
479            break;
480
481        /* Flags: 1-bit and 2-bit flags supported */
482
483        case ACPI_RSD_1BITFLAG:
484            AcpiRsOutString (Name, ACPI_CAST_PTR (char,
485                Table->Pointer [*Target & 0x01]));
486            break;
487
488        case ACPI_RSD_2BITFLAG:
489            AcpiRsOutString (Name, ACPI_CAST_PTR (char,
490                Table->Pointer [*Target & 0x03]));
491            break;
492
493        case ACPI_RSD_SHORTLIST:
494            /*
495             * Short byte list (single line output) for DMA and IRQ resources
496             * Note: The list length is obtained from the previous table entry
497             */
498            if (PreviousTarget)
499            {
500                AcpiRsOutTitle (Name);
501                AcpiRsDumpShortByteList (*PreviousTarget, Target);
502            }
503            break;
504
505        case ACPI_RSD_LONGLIST:
506            /*
507             * Long byte list for Vendor resource data
508             * Note: The list length is obtained from the previous table entry
509             */
510            if (PreviousTarget)
511            {
512                AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target);
513            }
514            break;
515
516        case ACPI_RSD_DWORDLIST:
517            /*
518             * Dword list for Extended Interrupt resources
519             * Note: The list length is obtained from the previous table entry
520             */
521            if (PreviousTarget)
522            {
523                AcpiRsDumpDwordList (*PreviousTarget,
524                    ACPI_CAST_PTR (UINT32, Target));
525            }
526            break;
527
528        case ACPI_RSD_ADDRESS:
529            /*
530             * Common flags for all Address resources
531             */
532            AcpiRsDumpAddressCommon (ACPI_CAST_PTR (ACPI_RESOURCE_DATA, Target));
533            break;
534
535        case ACPI_RSD_SOURCE:
536            /*
537             * Optional ResourceSource for Address resources
538             */
539            AcpiRsDumpResourceSource (ACPI_CAST_PTR (ACPI_RESOURCE_SOURCE, Target));
540            break;
541
542        default:
543            AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
544                Table->Opcode);
545            return;
546        }
547
548        Table++;
549        Count--;
550    }
551}
552
553
554/*******************************************************************************
555 *
556 * FUNCTION:    AcpiRsDumpResourceSource
557 *
558 * PARAMETERS:  ResourceSource      - Pointer to a Resource Source struct
559 *
560 * RETURN:      None
561 *
562 * DESCRIPTION: Common routine for dumping the optional ResourceSource and the
563 *              corresponding ResourceSourceIndex.
564 *
565 ******************************************************************************/
566
567static void
568AcpiRsDumpResourceSource (
569    ACPI_RESOURCE_SOURCE    *ResourceSource)
570{
571    ACPI_FUNCTION_ENTRY ();
572
573
574    if (ResourceSource->Index == 0xFF)
575    {
576        return;
577    }
578
579    AcpiRsOutInteger8 ("Resource Source Index",
580        ResourceSource->Index);
581
582    AcpiRsOutString ("Resource Source",
583        ResourceSource->StringPtr ?
584            ResourceSource->StringPtr : "[Not Specified]");
585}
586
587
588/*******************************************************************************
589 *
590 * FUNCTION:    AcpiRsDumpAddressCommon
591 *
592 * PARAMETERS:  Resource        - Pointer to an internal resource descriptor
593 *
594 * RETURN:      None
595 *
596 * DESCRIPTION: Dump the fields that are common to all Address resource
597 *              descriptors
598 *
599 ******************************************************************************/
600
601static void
602AcpiRsDumpAddressCommon (
603    ACPI_RESOURCE_DATA      *Resource)
604{
605    ACPI_FUNCTION_ENTRY ();
606
607
608   /* Decode the type-specific flags */
609
610    switch (Resource->Address.ResourceType)
611    {
612    case ACPI_MEMORY_RANGE:
613
614        AcpiRsDumpDescriptor (Resource, AcpiRsDumpMemoryFlags);
615        break;
616
617    case ACPI_IO_RANGE:
618
619        AcpiRsDumpDescriptor (Resource, AcpiRsDumpIoFlags);
620        break;
621
622    case ACPI_BUS_NUMBER_RANGE:
623
624        AcpiRsOutString ("Resource Type", "Bus Number Range");
625        break;
626
627    default:
628
629        AcpiRsOutInteger8 ("Resource Type",
630            (UINT8) Resource->Address.ResourceType);
631        break;
632    }
633
634    /* Decode the general flags */
635
636    AcpiRsDumpDescriptor (Resource, AcpiRsDumpGeneralFlags);
637}
638
639
640/*******************************************************************************
641 *
642 * FUNCTION:    AcpiRsDumpResourceList
643 *
644 * PARAMETERS:  ResourceList        - Pointer to a resource descriptor list
645 *
646 * RETURN:      None
647 *
648 * DESCRIPTION: Dispatches the structure to the correct dump routine.
649 *
650 ******************************************************************************/
651
652void
653AcpiRsDumpResourceList (
654    ACPI_RESOURCE           *ResourceList)
655{
656    UINT32                  Count = 0;
657    UINT32                  Type;
658
659
660    ACPI_FUNCTION_ENTRY ();
661
662
663    if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))
664    {
665        return;
666    }
667
668    /* Walk list and dump all resource descriptors (END_TAG terminates) */
669
670    do
671    {
672        AcpiOsPrintf ("\n[%02X] ", Count);
673        Count++;
674
675        /* Validate Type before dispatch */
676
677        Type = ResourceList->Type;
678        if (Type > ACPI_RESOURCE_TYPE_MAX)
679        {
680            AcpiOsPrintf (
681                "Invalid descriptor type (%X) in resource list\n",
682                ResourceList->Type);
683            return;
684        }
685
686        /* Dump the resource descriptor */
687
688        AcpiRsDumpDescriptor (&ResourceList->Data,
689            AcpiGbl_DumpResourceDispatch[Type]);
690
691        /* Point to the next resource structure */
692
693        ResourceList = ACPI_ADD_PTR (ACPI_RESOURCE, ResourceList,
694                            ResourceList->Length);
695
696        /* Exit when END_TAG descriptor is reached */
697
698    } while (Type != ACPI_RESOURCE_TYPE_END_TAG);
699}
700
701
702/*******************************************************************************
703 *
704 * FUNCTION:    AcpiRsDumpIrqList
705 *
706 * PARAMETERS:  RouteTable      - Pointer to the routing table to dump.
707 *
708 * RETURN:      None
709 *
710 * DESCRIPTION: Print IRQ routing table
711 *
712 ******************************************************************************/
713
714void
715AcpiRsDumpIrqList (
716    UINT8                   *RouteTable)
717{
718    ACPI_PCI_ROUTING_TABLE  *PrtElement;
719    UINT8                   Count;
720
721
722    ACPI_FUNCTION_ENTRY ();
723
724
725    if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))
726    {
727        return;
728    }
729
730    PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable);
731
732    /* Dump all table elements, Exit on zero length element */
733
734    for (Count = 0; PrtElement->Length; Count++)
735    {
736        AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count);
737        AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt);
738
739        PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE,
740                        PrtElement, PrtElement->Length);
741    }
742}
743
744
745/*******************************************************************************
746 *
747 * FUNCTION:    AcpiRsOut*
748 *
749 * PARAMETERS:  Title       - Name of the resource field
750 *              Value       - Value of the resource field
751 *
752 * RETURN:      None
753 *
754 * DESCRIPTION: Miscellaneous helper functions to consistently format the
755 *              output of the resource dump routines
756 *
757 ******************************************************************************/
758
759static void
760AcpiRsOutString (
761    char                    *Title,
762    char                    *Value)
763{
764    AcpiOsPrintf ("%27s : %s", Title, Value);
765    if (!*Value)
766    {
767        AcpiOsPrintf ("[NULL NAMESTRING]");
768    }
769    AcpiOsPrintf ("\n");
770}
771
772static void
773AcpiRsOutInteger8 (
774    char                    *Title,
775    UINT8                   Value)
776{
777    AcpiOsPrintf ("%27s : %2.2X\n", Title, Value);
778}
779
780static void
781AcpiRsOutInteger16 (
782    char                    *Title,
783    UINT16                  Value)
784{
785    AcpiOsPrintf ("%27s : %4.4X\n", Title, Value);
786}
787
788static void
789AcpiRsOutInteger32 (
790    char                    *Title,
791    UINT32                  Value)
792{
793    AcpiOsPrintf ("%27s : %8.8X\n", Title, Value);
794}
795
796static void
797AcpiRsOutInteger64 (
798    char                    *Title,
799    UINT64                  Value)
800{
801    AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title,
802        ACPI_FORMAT_UINT64 (Value));
803}
804
805static void
806AcpiRsOutTitle (
807    char                    *Title)
808{
809    AcpiOsPrintf ("%27s : ", Title);
810}
811
812
813/*******************************************************************************
814 *
815 * FUNCTION:    AcpiRsDump*List
816 *
817 * PARAMETERS:  Length      - Number of elements in the list
818 *              Data        - Start of the list
819 *
820 * RETURN:      None
821 *
822 * DESCRIPTION: Miscellaneous functions to dump lists of raw data
823 *
824 ******************************************************************************/
825
826static void
827AcpiRsDumpByteList (
828    UINT16                  Length,
829    UINT8                   *Data)
830{
831    UINT8                   i;
832
833
834    for (i = 0; i < Length; i++)
835    {
836        AcpiOsPrintf ("%25s%2.2X : %2.2X\n",
837            "Byte", i, Data[i]);
838    }
839}
840
841static void
842AcpiRsDumpShortByteList (
843    UINT8                  Length,
844    UINT8                  *Data)
845{
846    UINT8                   i;
847
848
849    for (i = 0; i < Length; i++)
850    {
851        AcpiOsPrintf ("%X ", Data[i]);
852    }
853    AcpiOsPrintf ("\n");
854}
855
856static void
857AcpiRsDumpDwordList (
858    UINT8                   Length,
859    UINT32                  *Data)
860{
861    UINT8                   i;
862
863
864    for (i = 0; i < Length; i++)
865    {
866        AcpiOsPrintf ("%25s%2.2X : %8.8X\n",
867            "Dword", i, Data[i]);
868    }
869}
870
871#endif
872
873