Back to home page

Quest Cross Reference

 
 

    


Warning, cross-references for /kernel/drivers/acpica/rsdump.c need to be fixed.

0001 /*******************************************************************************
0002  *
0003  * Module Name: rsdump - Functions to display the resource structures.
0004  *
0005  ******************************************************************************/
0006 
0007 /******************************************************************************
0008  *
0009  * 1. Copyright Notice
0010  *
0011  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
0012  * All rights reserved.
0013  *
0014  * 2. License
0015  *
0016  * 2.1. This is your license from Intel Corp. under its intellectual property
0017  * rights.  You may have additional license terms from the party that provided
0018  * you this software, covering your right to use that party's intellectual
0019  * property rights.
0020  *
0021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0022  * copy of the source code appearing in this file ("Covered Code") an
0023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0024  * base code distributed originally by Intel ("Original Intel Code") to copy,
0025  * make derivatives, distribute, use and display any portion of the Covered
0026  * Code in any form, with the right to sublicense such rights; and
0027  *
0028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0029  * license (with the right to sublicense), under only those claims of Intel
0030  * patents that are infringed by the Original Intel Code, to make, use, sell,
0031  * offer to sell, and import the Covered Code and derivative works thereof
0032  * solely to the minimum extent necessary to exercise the above copyright
0033  * license, and in no event shall the patent license extend to any additions
0034  * to or modifications of the Original Intel Code.  No other license or right
0035  * is granted directly or by implication, estoppel or otherwise;
0036  *
0037  * The above copyright and patent license is granted only if the following
0038  * conditions are met:
0039  *
0040  * 3. Conditions
0041  *
0042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0043  * Redistribution of source code of any substantial portion of the Covered
0044  * Code or modification with rights to further distribute source must include
0045  * the above Copyright Notice, the above License, this list of Conditions,
0046  * and the following Disclaimer and Export Compliance provision.  In addition,
0047  * Licensee must cause all Covered Code to which Licensee contributes to
0048  * contain a file documenting the changes Licensee made to create that Covered
0049  * Code and the date of any change.  Licensee must include in that file the
0050  * documentation of any changes made by any predecessor Licensee.  Licensee
0051  * must include a prominent statement that the modification is derived,
0052  * directly or indirectly, from Original Intel Code.
0053  *
0054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0055  * Redistribution of source code of any substantial portion of the Covered
0056  * Code or modification without rights to further distribute source must
0057  * include the following Disclaimer and Export Compliance provision in the
0058  * documentation and/or other materials provided with distribution.  In
0059  * addition, Licensee may not authorize further sublicense of source of any
0060  * portion of the Covered Code, and must include terms to the effect that the
0061  * license from Licensee to its licensee is limited to the intellectual
0062  * property embodied in the software Licensee provides to its licensee, and
0063  * not to intellectual property embodied in modifications its licensee may
0064  * make.
0065  *
0066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0067  * substantial portion of the Covered Code or modification must reproduce the
0068  * above Copyright Notice, and the following Disclaimer and Export Compliance
0069  * provision in the documentation and/or other materials provided with the
0070  * distribution.
0071  *
0072  * 3.4. Intel retains all right, title, and interest in and to the Original
0073  * Intel Code.
0074  *
0075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0076  * Intel shall be used in advertising or otherwise to promote the sale, use or
0077  * other dealings in products derived from or relating to the Covered Code
0078  * without prior written authorization from Intel.
0079  *
0080  * 4. Disclaimer and Export Compliance
0081  *
0082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0083  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
0085  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
0086  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
0087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0088  * PARTICULAR PURPOSE.
0089  *
0090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
0096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0097  * LIMITED REMEDY.
0098  *
0099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0100  * software or system incorporating such software without first obtaining any
0101  * required license or other approval from the U. S. Department of Commerce or
0102  * any other agency or department of the United States Government.  In the
0103  * event Licensee exports any such software from the United States or
0104  * re-exports any such software from a foreign destination, Licensee shall
0105  * ensure that the distribution and export/re-export of the software is in
0106  * compliance with all laws, regulations, orders, or other restrictions of the
0107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0108  * any of its subsidiaries will export/re-export any technical data, process,
0109  * software, or service, directly or indirectly, to any country for which the
0110  * United States government or any agency thereof requires an export license,
0111  * other governmental approval, or letter of assurance, without first obtaining
0112  * such license, approval or letter.
0113  *
0114  *****************************************************************************/
0115 
0116 
0117 #define __RSDUMP_C__
0118 
0119 #include "acpi.h"
0120 #include "accommon.h"
0121 #include "acresrc.h"
0122 
0123 #define _COMPONENT          ACPI_RESOURCES
0124         ACPI_MODULE_NAME    ("rsdump")
0125 
0126 
0127 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
0128 
0129 /* Local prototypes */
0130 
0131 static void
0132 AcpiRsOutString (
0133     char                    *Title,
0134     char                    *Value);
0135 
0136 static void
0137 AcpiRsOutInteger8 (
0138     char                    *Title,
0139     UINT8                   Value);
0140 
0141 static void
0142 AcpiRsOutInteger16 (
0143     char                    *Title,
0144     UINT16                  Value);
0145 
0146 static void
0147 AcpiRsOutInteger32 (
0148     char                    *Title,
0149     UINT32                  Value);
0150 
0151 static void
0152 AcpiRsOutInteger64 (
0153     char                    *Title,
0154     UINT64                  Value);
0155 
0156 static void
0157 AcpiRsOutTitle (
0158     char                    *Title);
0159 
0160 static void
0161 AcpiRsDumpByteList (
0162     UINT16                  Length,
0163     UINT8                   *Data);
0164 
0165 static void
0166 AcpiRsDumpDwordList (
0167     UINT8                   Length,
0168     UINT32                  *Data);
0169 
0170 static void
0171 AcpiRsDumpShortByteList (
0172     UINT8                  Length,
0173     UINT8                  *Data);
0174 
0175 static void
0176 AcpiRsDumpResourceSource (
0177     ACPI_RESOURCE_SOURCE    *ResourceSource);
0178 
0179 static void
0180 AcpiRsDumpAddressCommon (
0181     ACPI_RESOURCE_DATA      *Resource);
0182 
0183 static void
0184 AcpiRsDumpDescriptor (
0185     void                    *Resource,
0186     ACPI_RSDUMP_INFO *Table);
0187 
0188 
0189 #define ACPI_RSD_OFFSET(f)          (UINT8) ACPI_OFFSET (ACPI_RESOURCE_DATA,f)
0190 #define ACPI_PRT_OFFSET(f)          (UINT8) ACPI_OFFSET (ACPI_PCI_ROUTING_TABLE,f)
0191 #define ACPI_RSD_TABLE_SIZE(name)   (sizeof(name) / sizeof (ACPI_RSDUMP_INFO))
0192 
0193 
0194 /*******************************************************************************
0195  *
0196  * Resource Descriptor info tables
0197  *
0198  * Note: The first table entry must be a Title or Literal and must contain
0199  * the table length (number of table entries)
0200  *
0201  ******************************************************************************/
0202 
0203 ACPI_RSDUMP_INFO        AcpiRsDumpIrq[7] =
0204 {
0205     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq),                "IRQ",                      NULL},
0206     {ACPI_RSD_UINT8 ,   ACPI_RSD_OFFSET (Irq.DescriptorLength),             "Descriptor Length",        NULL},
0207     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering),                   "Triggering",               AcpiGbl_HeDecode},
0208     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity),                     "Polarity",                 AcpiGbl_LlDecode},
0209     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable),                     "Sharing",                  AcpiGbl_ShrDecode},
0210     {ACPI_RSD_UINT8 ,   ACPI_RSD_OFFSET (Irq.InterruptCount),               "Interrupt Count",          NULL},
0211     {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]),                "Interrupt List",           NULL}
0212 };
0213 
0214 ACPI_RSDUMP_INFO        AcpiRsDumpDma[6] =
0215 {
0216     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpDma),                "DMA",                      NULL},
0217     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type),                         "Speed",                    AcpiGbl_TypDecode},
0218     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster),                    "Mastering",                AcpiGbl_BmDecode},
0219     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer),                     "Transfer Type",            AcpiGbl_SizDecode},
0220     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (Dma.ChannelCount),                 "Channel Count",            NULL},
0221     {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]),                  "Channel List",             NULL}
0222 };
0223 
0224 ACPI_RSDUMP_INFO        AcpiRsDumpStartDpf[4] =
0225 {
0226     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpStartDpf),           "Start-Dependent-Functions",NULL},
0227     {ACPI_RSD_UINT8 ,   ACPI_RSD_OFFSET (StartDpf.DescriptorLength),        "Descriptor Length",        NULL},
0228     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.CompatibilityPriority),   "Compatibility Priority",   AcpiGbl_ConfigDecode},
0229     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.PerformanceRobustness),   "Performance/Robustness",   AcpiGbl_ConfigDecode}
0230 };
0231 
0232 ACPI_RSDUMP_INFO        AcpiRsDumpEndDpf[1] =
0233 {
0234     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndDpf),             "End-Dependent-Functions",  NULL}
0235 };
0236 
0237 ACPI_RSDUMP_INFO        AcpiRsDumpIo[6] =
0238 {
0239     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpIo),                 "I/O",                      NULL},
0240     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Io.IoDecode),                      "Address Decoding",         AcpiGbl_IoDecode},
0241     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Io.Minimum),                       "Address Minimum",          NULL},
0242     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Io.Maximum),                       "Address Maximum",          NULL},
0243     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (Io.Alignment),                     "Alignment",                NULL},
0244     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (Io.AddressLength),                 "Address Length",           NULL}
0245 };
0246 
0247 ACPI_RSDUMP_INFO        AcpiRsDumpFixedIo[3] =
0248 {
0249     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedIo),            "Fixed I/O",                NULL},
0250     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (FixedIo.Address),                  "Address",                  NULL},
0251     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (FixedIo.AddressLength),            "Address Length",           NULL}
0252 };
0253 
0254 ACPI_RSDUMP_INFO        AcpiRsDumpVendor[3] =
0255 {
0256     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpVendor),             "Vendor Specific",          NULL},
0257     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Vendor.ByteLength),                "Length",                   NULL},
0258     {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET (Vendor.ByteData[0]),               "Vendor Data",              NULL}
0259 };
0260 
0261 ACPI_RSDUMP_INFO        AcpiRsDumpEndTag[1] =
0262 {
0263     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndTag),             "EndTag",                   NULL}
0264 };
0265 
0266 ACPI_RSDUMP_INFO        AcpiRsDumpMemory24[6] =
0267 {
0268     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory24),           "24-Bit Memory Range",      NULL},
0269     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect),            "Write Protect",            AcpiGbl_RwDecode},
0270     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.Minimum),                 "Address Minimum",          NULL},
0271     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.Maximum),                 "Address Maximum",          NULL},
0272     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.Alignment),               "Alignment",                NULL},
0273     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.AddressLength),           "Address Length",           NULL}
0274 };
0275 
0276 ACPI_RSDUMP_INFO        AcpiRsDumpMemory32[6] =
0277 {
0278     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory32),           "32-Bit Memory Range",      NULL},
0279     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect),            "Write Protect",            AcpiGbl_RwDecode},
0280     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.Minimum),                 "Address Minimum",          NULL},
0281     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.Maximum),                 "Address Maximum",          NULL},
0282     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.Alignment),               "Alignment",                NULL},
0283     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.AddressLength),           "Address Length",           NULL}
0284 };
0285 
0286 ACPI_RSDUMP_INFO        AcpiRsDumpFixedMemory32[4] =
0287 {
0288     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedMemory32),      "32-Bit Fixed Memory Range",NULL},
0289     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect),       "Write Protect",            AcpiGbl_RwDecode},
0290     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (FixedMemory32.Address),            "Address",                  NULL},
0291     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (FixedMemory32.AddressLength),      "Address Length",           NULL}
0292 };
0293 
0294 ACPI_RSDUMP_INFO        AcpiRsDumpAddress16[8] =
0295 {
0296     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress16),          "16-Bit WORD Address Space",NULL},
0297     {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
0298     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.Granularity),            "Granularity",              NULL},
0299     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.Minimum),                "Address Minimum",          NULL},
0300     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.Maximum),                "Address Maximum",          NULL},
0301     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.TranslationOffset),      "Translation Offset",       NULL},
0302     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.AddressLength),          "Address Length",           NULL},
0303     {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (Address16.ResourceSource),         NULL,                       NULL}
0304 };
0305 
0306 ACPI_RSDUMP_INFO        AcpiRsDumpAddress32[8] =
0307 {
0308     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress32),         "32-Bit DWORD Address Space", NULL},
0309     {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
0310     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.Granularity),            "Granularity",              NULL},
0311     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.Minimum),                "Address Minimum",          NULL},
0312     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.Maximum),                "Address Maximum",          NULL},
0313     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.TranslationOffset),      "Translation Offset",       NULL},
0314     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.AddressLength),          "Address Length",           NULL},
0315     {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (Address32.ResourceSource),         NULL,                       NULL}
0316 };
0317 
0318 ACPI_RSDUMP_INFO        AcpiRsDumpAddress64[8] =
0319 {
0320     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress64),          "64-Bit QWORD Address Space", NULL},
0321     {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
0322     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.Granularity),            "Granularity",              NULL},
0323     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.Minimum),                "Address Minimum",          NULL},
0324     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.Maximum),                "Address Maximum",          NULL},
0325     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.TranslationOffset),      "Translation Offset",       NULL},
0326     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.AddressLength),          "Address Length",           NULL},
0327     {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (Address64.ResourceSource),         NULL,                       NULL}
0328 };
0329 
0330 ACPI_RSDUMP_INFO        AcpiRsDumpExtAddress64[8] =
0331 {
0332     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtAddress64),       "64-Bit Extended Address Space", NULL},
0333     {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
0334     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.Granularity),         "Granularity",              NULL},
0335     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.Minimum),             "Address Minimum",          NULL},
0336     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.Maximum),             "Address Maximum",          NULL},
0337     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.TranslationOffset),   "Translation Offset",       NULL},
0338     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.AddressLength),       "Address Length",           NULL},
0339     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.TypeSpecific),        "Type-Specific Attribute",  NULL}
0340 };
0341 
0342 ACPI_RSDUMP_INFO        AcpiRsDumpExtIrq[8] =
0343 {
0344     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtIrq),             "Extended IRQ",             NULL},
0345     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer),     "Type",                     AcpiGbl_ConsumeDecode},
0346     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering),           "Triggering",               AcpiGbl_HeDecode},
0347     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity),             "Polarity",                 AcpiGbl_LlDecode},
0348     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable),             "Sharing",                  AcpiGbl_ShrDecode},
0349     {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource),       NULL,                       NULL},
0350     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount),       "Interrupt Count",          NULL},
0351     {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]),        "Interrupt List",           NULL}
0352 };
0353 
0354 ACPI_RSDUMP_INFO        AcpiRsDumpGenericReg[6] =
0355 {
0356     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpGenericReg),         "Generic Register",         NULL},
0357     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.SpaceId),               "Space ID",                 NULL},
0358     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.BitWidth),              "Bit Width",                NULL},
0359     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.BitOffset),             "Bit Offset",               NULL},
0360     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.AccessSize),            "Access Size",              NULL},
0361     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (GenericReg.Address),               "Address",                  NULL}
0362 };
0363 
0364 
0365 /*
0366  * Tables used for common address descriptor flag fields
0367  */
0368 static ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[5] =
0369 {
0370     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpGeneralFlags),       NULL,                       NULL},
0371     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.ProducerConsumer),         "Consumer/Producer",        AcpiGbl_ConsumeDecode},
0372     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode),                   "Address Decode",           AcpiGbl_DecDecode},
0373     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MinAddressFixed),          "Min Relocatability",       AcpiGbl_MinDecode},
0374     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MaxAddressFixed),          "Max Relocatability",       AcpiGbl_MaxDecode}
0375 };
0376 
0377 static ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[5] =
0378 {
0379     {ACPI_RSD_LITERAL,  ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags),        "Resource Type",            (void *) "Memory Range"},
0380     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect),    "Write Protect",            AcpiGbl_RwDecode},
0381     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching),         "Caching",                  AcpiGbl_MemDecode},
0382     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType),       "Range Type",               AcpiGbl_MtpDecode},
0383     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation),     "Translation",              AcpiGbl_TtpDecode}
0384 };
0385 
0386 static ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[4] =
0387 {
0388     {ACPI_RSD_LITERAL,  ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags),            "Resource Type",            (void *) "I/O Range"},
0389     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType),        "Range Type",               AcpiGbl_RngDecode},
0390     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation),      "Translation",              AcpiGbl_TtpDecode},
0391     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType),  "Translation Type",         AcpiGbl_TrsDecode}
0392 };
0393 
0394 
0395 /*
0396  * Table used to dump _PRT contents
0397  */
0398 static ACPI_RSDUMP_INFO   AcpiRsDumpPrt[5] =
0399 {
0400     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpPrt),                NULL,                       NULL},
0401     {ACPI_RSD_UINT64,   ACPI_PRT_OFFSET (Address),                          "Address",                  NULL},
0402     {ACPI_RSD_UINT32,   ACPI_PRT_OFFSET (Pin),                              "Pin",                      NULL},
0403     {ACPI_RSD_STRING,   ACPI_PRT_OFFSET (Source[0]),                        "Source",                   NULL},
0404     {ACPI_RSD_UINT32,   ACPI_PRT_OFFSET (SourceIndex),                      "Source Index",             NULL}
0405 };
0406 
0407 
0408 /*******************************************************************************
0409  *
0410  * FUNCTION:    AcpiRsDumpDescriptor
0411  *
0412  * PARAMETERS:  Resource
0413  *
0414  * RETURN:      None
0415  *
0416  * DESCRIPTION:
0417  *
0418  ******************************************************************************/
0419 
0420 static void
0421 AcpiRsDumpDescriptor (
0422     void                    *Resource,
0423     ACPI_RSDUMP_INFO        *Table)
0424 {
0425     UINT8                   *Target = NULL;
0426     UINT8                   *PreviousTarget;
0427     char                    *Name;
0428     UINT8                    Count;
0429 
0430 
0431     /* First table entry must contain the table length (# of table entries) */
0432 
0433     Count = Table->Offset;
0434 
0435     while (Count)
0436     {
0437         PreviousTarget = Target;
0438         Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset);
0439         Name = Table->Name;
0440 
0441         switch (Table->Opcode)
0442         {
0443         case ACPI_RSD_TITLE:
0444             /*
0445              * Optional resource title
0446              */
0447             if (Table->Name)
0448             {
0449                 AcpiOsPrintf ("%s Resource\n", Name);
0450             }
0451             break;
0452 
0453         /* Strings */
0454 
0455         case ACPI_RSD_LITERAL:
0456             AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer));
0457             break;
0458 
0459         case ACPI_RSD_STRING:
0460             AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target));
0461             break;
0462 
0463         /* Data items, 8/16/32/64 bit */
0464 
0465         case ACPI_RSD_UINT8:
0466             AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));
0467             break;
0468 
0469         case ACPI_RSD_UINT16:
0470             AcpiRsOutInteger16 (Name, ACPI_GET16 (Target));
0471             break;
0472 
0473         case ACPI_RSD_UINT32:
0474             AcpiRsOutInteger32 (Name, ACPI_GET32 (Target));
0475             break;
0476 
0477         case ACPI_RSD_UINT64:
0478             AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
0479             break;
0480 
0481         /* Flags: 1-bit and 2-bit flags supported */
0482 
0483         case ACPI_RSD_1BITFLAG:
0484             AcpiRsOutString (Name, ACPI_CAST_PTR (char,
0485                 Table->Pointer [*Target & 0x01]));
0486             break;
0487 
0488         case ACPI_RSD_2BITFLAG:
0489             AcpiRsOutString (Name, ACPI_CAST_PTR (char,
0490                 Table->Pointer [*Target & 0x03]));
0491             break;
0492 
0493         case ACPI_RSD_SHORTLIST:
0494             /*
0495              * Short byte list (single line output) for DMA and IRQ resources
0496              * Note: The list length is obtained from the previous table entry
0497              */
0498             if (PreviousTarget)
0499             {
0500                 AcpiRsOutTitle (Name);
0501                 AcpiRsDumpShortByteList (*PreviousTarget, Target);
0502             }
0503             break;
0504 
0505         case ACPI_RSD_LONGLIST:
0506             /*
0507              * Long byte list for Vendor resource data
0508              * Note: The list length is obtained from the previous table entry
0509              */
0510             if (PreviousTarget)
0511             {
0512                 AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target);
0513             }
0514             break;
0515 
0516         case ACPI_RSD_DWORDLIST:
0517             /*
0518              * Dword list for Extended Interrupt resources
0519              * Note: The list length is obtained from the previous table entry
0520              */
0521             if (PreviousTarget)
0522             {
0523                 AcpiRsDumpDwordList (*PreviousTarget,
0524                     ACPI_CAST_PTR (UINT32, Target));
0525             }
0526             break;
0527 
0528         case ACPI_RSD_ADDRESS:
0529             /*
0530              * Common flags for all Address resources
0531              */
0532             AcpiRsDumpAddressCommon (ACPI_CAST_PTR (ACPI_RESOURCE_DATA, Target));
0533             break;
0534 
0535         case ACPI_RSD_SOURCE:
0536             /*
0537              * Optional ResourceSource for Address resources
0538              */
0539             AcpiRsDumpResourceSource (ACPI_CAST_PTR (ACPI_RESOURCE_SOURCE, Target));
0540             break;
0541 
0542         default:
0543             AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
0544                 Table->Opcode);
0545             return;
0546         }
0547 
0548         Table++;
0549         Count--;
0550     }
0551 }
0552 
0553 
0554 /*******************************************************************************
0555  *
0556  * FUNCTION:    AcpiRsDumpResourceSource
0557  *
0558  * PARAMETERS:  ResourceSource      - Pointer to a Resource Source struct
0559  *
0560  * RETURN:      None
0561  *
0562  * DESCRIPTION: Common routine for dumping the optional ResourceSource and the
0563  *              corresponding ResourceSourceIndex.
0564  *
0565  ******************************************************************************/
0566 
0567 static void
0568 AcpiRsDumpResourceSource (
0569     ACPI_RESOURCE_SOURCE    *ResourceSource)
0570 {
0571     ACPI_FUNCTION_ENTRY ();
0572 
0573 
0574     if (ResourceSource->Index == 0xFF)
0575     {
0576         return;
0577     }
0578 
0579     AcpiRsOutInteger8 ("Resource Source Index",
0580         ResourceSource->Index);
0581 
0582     AcpiRsOutString ("Resource Source",
0583         ResourceSource->StringPtr ?
0584             ResourceSource->StringPtr : "[Not Specified]");
0585 }
0586 
0587 
0588 /*******************************************************************************
0589  *
0590  * FUNCTION:    AcpiRsDumpAddressCommon
0591  *
0592  * PARAMETERS:  Resource        - Pointer to an internal resource descriptor
0593  *
0594  * RETURN:      None
0595  *
0596  * DESCRIPTION: Dump the fields that are common to all Address resource
0597  *              descriptors
0598  *
0599  ******************************************************************************/
0600 
0601 static void
0602 AcpiRsDumpAddressCommon (
0603     ACPI_RESOURCE_DATA      *Resource)
0604 {
0605     ACPI_FUNCTION_ENTRY ();
0606 
0607 
0608    /* Decode the type-specific flags */
0609 
0610     switch (Resource->Address.ResourceType)
0611     {
0612     case ACPI_MEMORY_RANGE:
0613 
0614         AcpiRsDumpDescriptor (Resource, AcpiRsDumpMemoryFlags);
0615         break;
0616 
0617     case ACPI_IO_RANGE:
0618 
0619         AcpiRsDumpDescriptor (Resource, AcpiRsDumpIoFlags);
0620         break;
0621 
0622     case ACPI_BUS_NUMBER_RANGE:
0623 
0624         AcpiRsOutString ("Resource Type", "Bus Number Range");
0625         break;
0626 
0627     default:
0628 
0629         AcpiRsOutInteger8 ("Resource Type",
0630             (UINT8) Resource->Address.ResourceType);
0631         break;
0632     }
0633 
0634     /* Decode the general flags */
0635 
0636     AcpiRsDumpDescriptor (Resource, AcpiRsDumpGeneralFlags);
0637 }
0638 
0639 
0640 /*******************************************************************************
0641  *
0642  * FUNCTION:    AcpiRsDumpResourceList
0643  *
0644  * PARAMETERS:  ResourceList        - Pointer to a resource descriptor list
0645  *
0646  * RETURN:      None
0647  *
0648  * DESCRIPTION: Dispatches the structure to the correct dump routine.
0649  *
0650  ******************************************************************************/
0651 
0652 void
0653 AcpiRsDumpResourceList (
0654     ACPI_RESOURCE           *ResourceList)
0655 {
0656     UINT32                  Count = 0;
0657     UINT32                  Type;
0658 
0659 
0660     ACPI_FUNCTION_ENTRY ();
0661 
0662 
0663     if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))
0664     {
0665         return;
0666     }
0667 
0668     /* Walk list and dump all resource descriptors (END_TAG terminates) */
0669 
0670     do
0671     {
0672         AcpiOsPrintf ("\n[%02X] ", Count);
0673         Count++;
0674 
0675         /* Validate Type before dispatch */
0676 
0677         Type = ResourceList->Type;
0678         if (Type > ACPI_RESOURCE_TYPE_MAX)
0679         {
0680             AcpiOsPrintf (
0681                 "Invalid descriptor type (%X) in resource list\n",
0682                 ResourceList->Type);
0683             return;
0684         }
0685 
0686         /* Dump the resource descriptor */
0687 
0688         AcpiRsDumpDescriptor (&ResourceList->Data,
0689             AcpiGbl_DumpResourceDispatch[Type]);
0690 
0691         /* Point to the next resource structure */
0692 
0693         ResourceList = ACPI_ADD_PTR (ACPI_RESOURCE, ResourceList,
0694                             ResourceList->Length);
0695 
0696         /* Exit when END_TAG descriptor is reached */
0697 
0698     } while (Type != ACPI_RESOURCE_TYPE_END_TAG);
0699 }
0700 
0701 
0702 /*******************************************************************************
0703  *
0704  * FUNCTION:    AcpiRsDumpIrqList
0705  *
0706  * PARAMETERS:  RouteTable      - Pointer to the routing table to dump.
0707  *
0708  * RETURN:      None
0709  *
0710  * DESCRIPTION: Print IRQ routing table
0711  *
0712  ******************************************************************************/
0713 
0714 void
0715 AcpiRsDumpIrqList (
0716     UINT8                   *RouteTable)
0717 {
0718     ACPI_PCI_ROUTING_TABLE  *PrtElement;
0719     UINT8                   Count;
0720 
0721 
0722     ACPI_FUNCTION_ENTRY ();
0723 
0724 
0725     if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))
0726     {
0727         return;
0728     }
0729 
0730     PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable);
0731 
0732     /* Dump all table elements, Exit on zero length element */
0733 
0734     for (Count = 0; PrtElement->Length; Count++)
0735     {
0736         AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count);
0737         AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt);
0738 
0739         PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE,
0740                         PrtElement, PrtElement->Length);
0741     }
0742 }
0743 
0744 
0745 /*******************************************************************************
0746  *
0747  * FUNCTION:    AcpiRsOut*
0748  *
0749  * PARAMETERS:  Title       - Name of the resource field
0750  *              Value       - Value of the resource field
0751  *
0752  * RETURN:      None
0753  *
0754  * DESCRIPTION: Miscellaneous helper functions to consistently format the
0755  *              output of the resource dump routines
0756  *
0757  ******************************************************************************/
0758 
0759 static void
0760 AcpiRsOutString (
0761     char                    *Title,
0762     char                    *Value)
0763 {
0764     AcpiOsPrintf ("%27s : %s", Title, Value);
0765     if (!*Value)
0766     {
0767         AcpiOsPrintf ("[NULL NAMESTRING]");
0768     }
0769     AcpiOsPrintf ("\n");
0770 }
0771 
0772 static void
0773 AcpiRsOutInteger8 (
0774     char                    *Title,
0775     UINT8                   Value)
0776 {
0777     AcpiOsPrintf ("%27s : %2.2X\n", Title, Value);
0778 }
0779 
0780 static void
0781 AcpiRsOutInteger16 (
0782     char                    *Title,
0783     UINT16                  Value)
0784 {
0785     AcpiOsPrintf ("%27s : %4.4X\n", Title, Value);
0786 }
0787 
0788 static void
0789 AcpiRsOutInteger32 (
0790     char                    *Title,
0791     UINT32                  Value)
0792 {
0793     AcpiOsPrintf ("%27s : %8.8X\n", Title, Value);
0794 }
0795 
0796 static void
0797 AcpiRsOutInteger64 (
0798     char                    *Title,
0799     UINT64                  Value)
0800 {
0801     AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title,
0802         ACPI_FORMAT_UINT64 (Value));
0803 }
0804 
0805 static void
0806 AcpiRsOutTitle (
0807     char                    *Title)
0808 {
0809     AcpiOsPrintf ("%27s : ", Title);
0810 }
0811 
0812 
0813 /*******************************************************************************
0814  *
0815  * FUNCTION:    AcpiRsDump*List
0816  *
0817  * PARAMETERS:  Length      - Number of elements in the list
0818  *              Data        - Start of the list
0819  *
0820  * RETURN:      None
0821  *
0822  * DESCRIPTION: Miscellaneous functions to dump lists of raw data
0823  *
0824  ******************************************************************************/
0825 
0826 static void
0827 AcpiRsDumpByteList (
0828     UINT16                  Length,
0829     UINT8                   *Data)
0830 {
0831     UINT8                   i;
0832 
0833 
0834     for (i = 0; i < Length; i++)
0835     {
0836         AcpiOsPrintf ("%25s%2.2X : %2.2X\n",
0837             "Byte", i, Data[i]);
0838     }
0839 }
0840 
0841 static void
0842 AcpiRsDumpShortByteList (
0843     UINT8                  Length,
0844     UINT8                  *Data)
0845 {
0846     UINT8                   i;
0847 
0848 
0849     for (i = 0; i < Length; i++)
0850     {
0851         AcpiOsPrintf ("%X ", Data[i]);
0852     }
0853     AcpiOsPrintf ("\n");
0854 }
0855 
0856 static void
0857 AcpiRsDumpDwordList (
0858     UINT8                   Length,
0859     UINT32                  *Data)
0860 {
0861     UINT8                   i;
0862 
0863 
0864     for (i = 0; i < Length; i++)
0865     {
0866         AcpiOsPrintf ("%25s%2.2X : %8.8X\n",
0867             "Dword", i, Data[i]);
0868     }
0869 }
0870 
0871 #endif
0872