ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

rsdump.c
Go to the documentation of this file.
00001 /*******************************************************************************
00002  *
00003  * Module Name: rsdump - Functions to display the resource structures.
00004  *
00005  ******************************************************************************/
00006 
00007 /******************************************************************************
00008  *
00009  * 1. Copyright Notice
00010  *
00011  * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
00012  * All rights reserved.
00013  *
00014  * 2. License
00015  *
00016  * 2.1. This is your license from Intel Corp. under its intellectual property
00017  * rights.  You may have additional license terms from the party that provided
00018  * you this software, covering your right to use that party's intellectual
00019  * property rights.
00020  *
00021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
00022  * copy of the source code appearing in this file ("Covered Code") an
00023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
00024  * base code distributed originally by Intel ("Original Intel Code") to copy,
00025  * make derivatives, distribute, use and display any portion of the Covered
00026  * Code in any form, with the right to sublicense such rights; and
00027  *
00028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
00029  * license (with the right to sublicense), under only those claims of Intel
00030  * patents that are infringed by the Original Intel Code, to make, use, sell,
00031  * offer to sell, and import the Covered Code and derivative works thereof
00032  * solely to the minimum extent necessary to exercise the above copyright
00033  * license, and in no event shall the patent license extend to any additions
00034  * to or modifications of the Original Intel Code.  No other license or right
00035  * is granted directly or by implication, estoppel or otherwise;
00036  *
00037  * The above copyright and patent license is granted only if the following
00038  * conditions are met:
00039  *
00040  * 3. Conditions
00041  *
00042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
00043  * Redistribution of source code of any substantial portion of the Covered
00044  * Code or modification with rights to further distribute source must include
00045  * the above Copyright Notice, the above License, this list of Conditions,
00046  * and the following Disclaimer and Export Compliance provision.  In addition,
00047  * Licensee must cause all Covered Code to which Licensee contributes to
00048  * contain a file documenting the changes Licensee made to create that Covered
00049  * Code and the date of any change.  Licensee must include in that file the
00050  * documentation of any changes made by any predecessor Licensee.  Licensee
00051  * must include a prominent statement that the modification is derived,
00052  * directly or indirectly, from Original Intel Code.
00053  *
00054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
00055  * Redistribution of source code of any substantial portion of the Covered
00056  * Code or modification without rights to further distribute source must
00057  * include the following Disclaimer and Export Compliance provision in the
00058  * documentation and/or other materials provided with distribution.  In
00059  * addition, Licensee may not authorize further sublicense of source of any
00060  * portion of the Covered Code, and must include terms to the effect that the
00061  * license from Licensee to its licensee is limited to the intellectual
00062  * property embodied in the software Licensee provides to its licensee, and
00063  * not to intellectual property embodied in modifications its licensee may
00064  * make.
00065  *
00066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
00067  * substantial portion of the Covered Code or modification must reproduce the
00068  * above Copyright Notice, and the following Disclaimer and Export Compliance
00069  * provision in the documentation and/or other materials provided with the
00070  * distribution.
00071  *
00072  * 3.4. Intel retains all right, title, and interest in and to the Original
00073  * Intel Code.
00074  *
00075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
00076  * Intel shall be used in advertising or otherwise to promote the sale, use or
00077  * other dealings in products derived from or relating to the Covered Code
00078  * without prior written authorization from Intel.
00079  *
00080  * 4. Disclaimer and Export Compliance
00081  *
00082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
00083  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
00084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
00085  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
00086  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
00087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
00088  * PARTICULAR PURPOSE.
00089  *
00090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
00091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
00092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
00093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
00094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
00095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
00096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
00097  * LIMITED REMEDY.
00098  *
00099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
00100  * software or system incorporating such software without first obtaining any
00101  * required license or other approval from the U. S. Department of Commerce or
00102  * any other agency or department of the United States Government.  In the
00103  * event Licensee exports any such software from the United States or
00104  * re-exports any such software from a foreign destination, Licensee shall
00105  * ensure that the distribution and export/re-export of the software is in
00106  * compliance with all laws, regulations, orders, or other restrictions of the
00107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
00108  * any of its subsidiaries will export/re-export any technical data, process,
00109  * software, or service, directly or indirectly, to any country for which the
00110  * United States government or any agency thereof requires an export license,
00111  * other governmental approval, or letter of assurance, without first obtaining
00112  * such license, approval or letter.
00113  *
00114  *****************************************************************************/
00115 
00116 
00117 #define __RSDUMP_C__
00118 
00119 #include "acpi.h"
00120 #include "accommon.h"
00121 #include "acresrc.h"
00122 
00123 #define _COMPONENT          ACPI_RESOURCES
00124         ACPI_MODULE_NAME    ("rsdump")
00125 
00126 
00127 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
00128 
00129 /* Local prototypes */
00130 
00131 static void
00132 AcpiRsOutString (
00133     char                    *Title,
00134     char                    *Value);
00135 
00136 static void
00137 AcpiRsOutInteger8 (
00138     char                    *Title,
00139     UINT8                   Value);
00140 
00141 static void
00142 AcpiRsOutInteger16 (
00143     char                    *Title,
00144     UINT16                  Value);
00145 
00146 static void
00147 AcpiRsOutInteger32 (
00148     char                    *Title,
00149     UINT32                  Value);
00150 
00151 static void
00152 AcpiRsOutInteger64 (
00153     char                    *Title,
00154     UINT64                  Value);
00155 
00156 static void
00157 AcpiRsOutTitle (
00158     char                    *Title);
00159 
00160 static void
00161 AcpiRsDumpByteList (
00162     UINT16                  Length,
00163     UINT8                   *Data);
00164 
00165 static void
00166 AcpiRsDumpDwordList (
00167     UINT8                   Length,
00168     UINT32                  *Data);
00169 
00170 static void
00171 AcpiRsDumpShortByteList (
00172     UINT8                  Length,
00173     UINT8                  *Data);
00174 
00175 static void
00176 AcpiRsDumpResourceSource (
00177     ACPI_RESOURCE_SOURCE    *ResourceSource);
00178 
00179 static void
00180 AcpiRsDumpAddressCommon (
00181     ACPI_RESOURCE_DATA      *Resource);
00182 
00183 static void
00184 AcpiRsDumpDescriptor (
00185     void                    *Resource,
00186     ACPI_RSDUMP_INFO *Table);
00187 
00188 
00189 #define ACPI_RSD_OFFSET(f)          (UINT8) ACPI_OFFSET (ACPI_RESOURCE_DATA,f)
00190 #define ACPI_PRT_OFFSET(f)          (UINT8) ACPI_OFFSET (ACPI_PCI_ROUTING_TABLE,f)
00191 #define ACPI_RSD_TABLE_SIZE(name)   (sizeof(name) / sizeof (ACPI_RSDUMP_INFO))
00192 
00193 
00194 /*******************************************************************************
00195  *
00196  * Resource Descriptor info tables
00197  *
00198  * Note: The first table entry must be a Title or Literal and must contain
00199  * the table length (number of table entries)
00200  *
00201  ******************************************************************************/
00202 
00203 ACPI_RSDUMP_INFO        AcpiRsDumpIrq[7] =
00204 {
00205     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq),                "IRQ",                      NULL},
00206     {ACPI_RSD_UINT8 ,   ACPI_RSD_OFFSET (Irq.DescriptorLength),             "Descriptor Length",        NULL},
00207     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering),                   "Triggering",               AcpiGbl_HeDecode},
00208     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity),                     "Polarity",                 AcpiGbl_LlDecode},
00209     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable),                     "Sharing",                  AcpiGbl_ShrDecode},
00210     {ACPI_RSD_UINT8 ,   ACPI_RSD_OFFSET (Irq.InterruptCount),               "Interrupt Count",          NULL},
00211     {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]),                "Interrupt List",           NULL}
00212 };
00213 
00214 ACPI_RSDUMP_INFO        AcpiRsDumpDma[6] =
00215 {
00216     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpDma),                "DMA",                      NULL},
00217     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type),                         "Speed",                    AcpiGbl_TypDecode},
00218     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster),                    "Mastering",                AcpiGbl_BmDecode},
00219     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer),                     "Transfer Type",            AcpiGbl_SizDecode},
00220     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (Dma.ChannelCount),                 "Channel Count",            NULL},
00221     {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]),                  "Channel List",             NULL}
00222 };
00223 
00224 ACPI_RSDUMP_INFO        AcpiRsDumpStartDpf[4] =
00225 {
00226     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpStartDpf),           "Start-Dependent-Functions",NULL},
00227     {ACPI_RSD_UINT8 ,   ACPI_RSD_OFFSET (StartDpf.DescriptorLength),        "Descriptor Length",        NULL},
00228     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.CompatibilityPriority),   "Compatibility Priority",   AcpiGbl_ConfigDecode},
00229     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.PerformanceRobustness),   "Performance/Robustness",   AcpiGbl_ConfigDecode}
00230 };
00231 
00232 ACPI_RSDUMP_INFO        AcpiRsDumpEndDpf[1] =
00233 {
00234     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndDpf),             "End-Dependent-Functions",  NULL}
00235 };
00236 
00237 ACPI_RSDUMP_INFO        AcpiRsDumpIo[6] =
00238 {
00239     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpIo),                 "I/O",                      NULL},
00240     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Io.IoDecode),                      "Address Decoding",         AcpiGbl_IoDecode},
00241     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Io.Minimum),                       "Address Minimum",          NULL},
00242     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Io.Maximum),                       "Address Maximum",          NULL},
00243     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (Io.Alignment),                     "Alignment",                NULL},
00244     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (Io.AddressLength),                 "Address Length",           NULL}
00245 };
00246 
00247 ACPI_RSDUMP_INFO        AcpiRsDumpFixedIo[3] =
00248 {
00249     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedIo),            "Fixed I/O",                NULL},
00250     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (FixedIo.Address),                  "Address",                  NULL},
00251     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (FixedIo.AddressLength),            "Address Length",           NULL}
00252 };
00253 
00254 ACPI_RSDUMP_INFO        AcpiRsDumpVendor[3] =
00255 {
00256     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpVendor),             "Vendor Specific",          NULL},
00257     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Vendor.ByteLength),                "Length",                   NULL},
00258     {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET (Vendor.ByteData[0]),               "Vendor Data",              NULL}
00259 };
00260 
00261 ACPI_RSDUMP_INFO        AcpiRsDumpEndTag[1] =
00262 {
00263     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndTag),             "EndTag",                   NULL}
00264 };
00265 
00266 ACPI_RSDUMP_INFO        AcpiRsDumpMemory24[6] =
00267 {
00268     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory24),           "24-Bit Memory Range",      NULL},
00269     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect),            "Write Protect",            AcpiGbl_RwDecode},
00270     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.Minimum),                 "Address Minimum",          NULL},
00271     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.Maximum),                 "Address Maximum",          NULL},
00272     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.Alignment),               "Alignment",                NULL},
00273     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Memory24.AddressLength),           "Address Length",           NULL}
00274 };
00275 
00276 ACPI_RSDUMP_INFO        AcpiRsDumpMemory32[6] =
00277 {
00278     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory32),           "32-Bit Memory Range",      NULL},
00279     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect),            "Write Protect",            AcpiGbl_RwDecode},
00280     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.Minimum),                 "Address Minimum",          NULL},
00281     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.Maximum),                 "Address Maximum",          NULL},
00282     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.Alignment),               "Alignment",                NULL},
00283     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Memory32.AddressLength),           "Address Length",           NULL}
00284 };
00285 
00286 ACPI_RSDUMP_INFO        AcpiRsDumpFixedMemory32[4] =
00287 {
00288     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedMemory32),      "32-Bit Fixed Memory Range",NULL},
00289     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect),       "Write Protect",            AcpiGbl_RwDecode},
00290     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (FixedMemory32.Address),            "Address",                  NULL},
00291     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (FixedMemory32.AddressLength),      "Address Length",           NULL}
00292 };
00293 
00294 ACPI_RSDUMP_INFO        AcpiRsDumpAddress16[8] =
00295 {
00296     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress16),          "16-Bit WORD Address Space",NULL},
00297     {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
00298     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.Granularity),            "Granularity",              NULL},
00299     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.Minimum),                "Address Minimum",          NULL},
00300     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.Maximum),                "Address Maximum",          NULL},
00301     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.TranslationOffset),      "Translation Offset",       NULL},
00302     {ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (Address16.AddressLength),          "Address Length",           NULL},
00303     {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (Address16.ResourceSource),         NULL,                       NULL}
00304 };
00305 
00306 ACPI_RSDUMP_INFO        AcpiRsDumpAddress32[8] =
00307 {
00308     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress32),         "32-Bit DWORD Address Space", NULL},
00309     {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
00310     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.Granularity),            "Granularity",              NULL},
00311     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.Minimum),                "Address Minimum",          NULL},
00312     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.Maximum),                "Address Maximum",          NULL},
00313     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.TranslationOffset),      "Translation Offset",       NULL},
00314     {ACPI_RSD_UINT32,   ACPI_RSD_OFFSET (Address32.AddressLength),          "Address Length",           NULL},
00315     {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (Address32.ResourceSource),         NULL,                       NULL}
00316 };
00317 
00318 ACPI_RSDUMP_INFO        AcpiRsDumpAddress64[8] =
00319 {
00320     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress64),          "64-Bit QWORD Address Space", NULL},
00321     {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
00322     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.Granularity),            "Granularity",              NULL},
00323     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.Minimum),                "Address Minimum",          NULL},
00324     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.Maximum),                "Address Maximum",          NULL},
00325     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.TranslationOffset),      "Translation Offset",       NULL},
00326     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (Address64.AddressLength),          "Address Length",           NULL},
00327     {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (Address64.ResourceSource),         NULL,                       NULL}
00328 };
00329 
00330 ACPI_RSDUMP_INFO        AcpiRsDumpExtAddress64[8] =
00331 {
00332     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtAddress64),       "64-Bit Extended Address Space", NULL},
00333     {ACPI_RSD_ADDRESS,  0,                                                  NULL,                       NULL},
00334     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.Granularity),         "Granularity",              NULL},
00335     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.Minimum),             "Address Minimum",          NULL},
00336     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.Maximum),             "Address Maximum",          NULL},
00337     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.TranslationOffset),   "Translation Offset",       NULL},
00338     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.AddressLength),       "Address Length",           NULL},
00339     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (ExtAddress64.TypeSpecific),        "Type-Specific Attribute",  NULL}
00340 };
00341 
00342 ACPI_RSDUMP_INFO        AcpiRsDumpExtIrq[8] =
00343 {
00344     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtIrq),             "Extended IRQ",             NULL},
00345     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer),     "Type",                     AcpiGbl_ConsumeDecode},
00346     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering),           "Triggering",               AcpiGbl_HeDecode},
00347     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity),             "Polarity",                 AcpiGbl_LlDecode},
00348     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable),             "Sharing",                  AcpiGbl_ShrDecode},
00349     {ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource),       NULL,                       NULL},
00350     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount),       "Interrupt Count",          NULL},
00351     {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]),        "Interrupt List",           NULL}
00352 };
00353 
00354 ACPI_RSDUMP_INFO        AcpiRsDumpGenericReg[6] =
00355 {
00356     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpGenericReg),         "Generic Register",         NULL},
00357     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.SpaceId),               "Space ID",                 NULL},
00358     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.BitWidth),              "Bit Width",                NULL},
00359     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.BitOffset),             "Bit Offset",               NULL},
00360     {ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (GenericReg.AccessSize),            "Access Size",              NULL},
00361     {ACPI_RSD_UINT64,   ACPI_RSD_OFFSET (GenericReg.Address),               "Address",                  NULL}
00362 };
00363 
00364 
00365 /*
00366  * Tables used for common address descriptor flag fields
00367  */
00368 static ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[5] =
00369 {
00370     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpGeneralFlags),       NULL,                       NULL},
00371     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.ProducerConsumer),         "Consumer/Producer",        AcpiGbl_ConsumeDecode},
00372     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode),                   "Address Decode",           AcpiGbl_DecDecode},
00373     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MinAddressFixed),          "Min Relocatability",       AcpiGbl_MinDecode},
00374     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MaxAddressFixed),          "Max Relocatability",       AcpiGbl_MaxDecode}
00375 };
00376 
00377 static ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[5] =
00378 {
00379     {ACPI_RSD_LITERAL,  ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags),        "Resource Type",            (void *) "Memory Range"},
00380     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect),    "Write Protect",            AcpiGbl_RwDecode},
00381     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching),         "Caching",                  AcpiGbl_MemDecode},
00382     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType),       "Range Type",               AcpiGbl_MtpDecode},
00383     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation),     "Translation",              AcpiGbl_TtpDecode}
00384 };
00385 
00386 static ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[4] =
00387 {
00388     {ACPI_RSD_LITERAL,  ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags),            "Resource Type",            (void *) "I/O Range"},
00389     {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType),        "Range Type",               AcpiGbl_RngDecode},
00390     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation),      "Translation",              AcpiGbl_TtpDecode},
00391     {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType),  "Translation Type",         AcpiGbl_TrsDecode}
00392 };
00393 
00394 
00395 /*
00396  * Table used to dump _PRT contents
00397  */
00398 static ACPI_RSDUMP_INFO   AcpiRsDumpPrt[5] =
00399 {
00400     {ACPI_RSD_TITLE,    ACPI_RSD_TABLE_SIZE (AcpiRsDumpPrt),                NULL,                       NULL},
00401     {ACPI_RSD_UINT64,   ACPI_PRT_OFFSET (Address),                          "Address",                  NULL},
00402     {ACPI_RSD_UINT32,   ACPI_PRT_OFFSET (Pin),                              "Pin",                      NULL},
00403     {ACPI_RSD_STRING,   ACPI_PRT_OFFSET (Source[0]),                        "Source",                   NULL},
00404     {ACPI_RSD_UINT32,   ACPI_PRT_OFFSET (SourceIndex),                      "Source Index",             NULL}
00405 };
00406 
00407 
00408 /*******************************************************************************
00409  *
00410  * FUNCTION:    AcpiRsDumpDescriptor
00411  *
00412  * PARAMETERS:  Resource
00413  *
00414  * RETURN:      None
00415  *
00416  * DESCRIPTION:
00417  *
00418  ******************************************************************************/
00419 
00420 static void
00421 AcpiRsDumpDescriptor (
00422     void                    *Resource,
00423     ACPI_RSDUMP_INFO        *Table)
00424 {
00425     UINT8                   *Target = NULL;
00426     UINT8                   *PreviousTarget;
00427     char                    *Name;
00428     UINT8                    Count;
00429 
00430 
00431     /* First table entry must contain the table length (# of table entries) */
00432 
00433     Count = Table->Offset;
00434 
00435     while (Count)
00436     {
00437         PreviousTarget = Target;
00438         Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset);
00439         Name = Table->Name;
00440 
00441         switch (Table->Opcode)
00442         {
00443         case ACPI_RSD_TITLE:
00444             /*
00445              * Optional resource title
00446              */
00447             if (Table->Name)
00448             {
00449                 AcpiOsPrintf ("%s Resource\n", Name);
00450             }
00451             break;
00452 
00453         /* Strings */
00454 
00455         case ACPI_RSD_LITERAL:
00456             AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer));
00457             break;
00458 
00459         case ACPI_RSD_STRING:
00460             AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target));
00461             break;
00462 
00463         /* Data items, 8/16/32/64 bit */
00464 
00465         case ACPI_RSD_UINT8:
00466             AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));
00467             break;
00468 
00469         case ACPI_RSD_UINT16:
00470             AcpiRsOutInteger16 (Name, ACPI_GET16 (Target));
00471             break;
00472 
00473         case ACPI_RSD_UINT32:
00474             AcpiRsOutInteger32 (Name, ACPI_GET32 (Target));
00475             break;
00476 
00477         case ACPI_RSD_UINT64:
00478             AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
00479             break;
00480 
00481         /* Flags: 1-bit and 2-bit flags supported */
00482 
00483         case ACPI_RSD_1BITFLAG:
00484             AcpiRsOutString (Name, ACPI_CAST_PTR (char,
00485                 Table->Pointer [*Target & 0x01]));
00486             break;
00487 
00488         case ACPI_RSD_2BITFLAG:
00489             AcpiRsOutString (Name, ACPI_CAST_PTR (char,
00490                 Table->Pointer [*Target & 0x03]));
00491             break;
00492 
00493         case ACPI_RSD_SHORTLIST:
00494             /*
00495              * Short byte list (single line output) for DMA and IRQ resources
00496              * Note: The list length is obtained from the previous table entry
00497              */
00498             if (PreviousTarget)
00499             {
00500                 AcpiRsOutTitle (Name);
00501                 AcpiRsDumpShortByteList (*PreviousTarget, Target);
00502             }
00503             break;
00504 
00505         case ACPI_RSD_LONGLIST:
00506             /*
00507              * Long byte list for Vendor resource data
00508              * Note: The list length is obtained from the previous table entry
00509              */
00510             if (PreviousTarget)
00511             {
00512                 AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target);
00513             }
00514             break;
00515 
00516         case ACPI_RSD_DWORDLIST:
00517             /*
00518              * Dword list for Extended Interrupt resources
00519              * Note: The list length is obtained from the previous table entry
00520              */
00521             if (PreviousTarget)
00522             {
00523                 AcpiRsDumpDwordList (*PreviousTarget,
00524                     ACPI_CAST_PTR (UINT32, Target));
00525             }
00526             break;
00527 
00528         case ACPI_RSD_ADDRESS:
00529             /*
00530              * Common flags for all Address resources
00531              */
00532             AcpiRsDumpAddressCommon (ACPI_CAST_PTR (ACPI_RESOURCE_DATA, Target));
00533             break;
00534 
00535         case ACPI_RSD_SOURCE:
00536             /*
00537              * Optional ResourceSource for Address resources
00538              */
00539             AcpiRsDumpResourceSource (ACPI_CAST_PTR (ACPI_RESOURCE_SOURCE, Target));
00540             break;
00541 
00542         default:
00543             AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
00544                 Table->Opcode);
00545             return;
00546         }
00547 
00548         Table++;
00549         Count--;
00550     }
00551 }
00552 
00553 
00554 /*******************************************************************************
00555  *
00556  * FUNCTION:    AcpiRsDumpResourceSource
00557  *
00558  * PARAMETERS:  ResourceSource      - Pointer to a Resource Source struct
00559  *
00560  * RETURN:      None
00561  *
00562  * DESCRIPTION: Common routine for dumping the optional ResourceSource and the
00563  *              corresponding ResourceSourceIndex.
00564  *
00565  ******************************************************************************/
00566 
00567 static void
00568 AcpiRsDumpResourceSource (
00569     ACPI_RESOURCE_SOURCE    *ResourceSource)
00570 {
00571     ACPI_FUNCTION_ENTRY ();
00572 
00573 
00574     if (ResourceSource->Index == 0xFF)
00575     {
00576         return;
00577     }
00578 
00579     AcpiRsOutInteger8 ("Resource Source Index",
00580         ResourceSource->Index);
00581 
00582     AcpiRsOutString ("Resource Source",
00583         ResourceSource->StringPtr ?
00584             ResourceSource->StringPtr : "[Not Specified]");
00585 }
00586 
00587 
00588 /*******************************************************************************
00589  *
00590  * FUNCTION:    AcpiRsDumpAddressCommon
00591  *
00592  * PARAMETERS:  Resource        - Pointer to an internal resource descriptor
00593  *
00594  * RETURN:      None
00595  *
00596  * DESCRIPTION: Dump the fields that are common to all Address resource
00597  *              descriptors
00598  *
00599  ******************************************************************************/
00600 
00601 static void
00602 AcpiRsDumpAddressCommon (
00603     ACPI_RESOURCE_DATA      *Resource)
00604 {
00605     ACPI_FUNCTION_ENTRY ();
00606 
00607 
00608    /* Decode the type-specific flags */
00609 
00610     switch (Resource->Address.ResourceType)
00611     {
00612     case ACPI_MEMORY_RANGE:
00613 
00614         AcpiRsDumpDescriptor (Resource, AcpiRsDumpMemoryFlags);
00615         break;
00616 
00617     case ACPI_IO_RANGE:
00618 
00619         AcpiRsDumpDescriptor (Resource, AcpiRsDumpIoFlags);
00620         break;
00621 
00622     case ACPI_BUS_NUMBER_RANGE:
00623 
00624         AcpiRsOutString ("Resource Type", "Bus Number Range");
00625         break;
00626 
00627     default:
00628 
00629         AcpiRsOutInteger8 ("Resource Type",
00630             (UINT8) Resource->Address.ResourceType);
00631         break;
00632     }
00633 
00634     /* Decode the general flags */
00635 
00636     AcpiRsDumpDescriptor (Resource, AcpiRsDumpGeneralFlags);
00637 }
00638 
00639 
00640 /*******************************************************************************
00641  *
00642  * FUNCTION:    AcpiRsDumpResourceList
00643  *
00644  * PARAMETERS:  ResourceList        - Pointer to a resource descriptor list
00645  *
00646  * RETURN:      None
00647  *
00648  * DESCRIPTION: Dispatches the structure to the correct dump routine.
00649  *
00650  ******************************************************************************/
00651 
00652 void
00653 AcpiRsDumpResourceList (
00654     ACPI_RESOURCE           *ResourceList)
00655 {
00656     UINT32                  Count = 0;
00657     UINT32                  Type;
00658 
00659 
00660     ACPI_FUNCTION_ENTRY ();
00661 
00662 
00663     if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))
00664     {
00665         return;
00666     }
00667 
00668     /* Walk list and dump all resource descriptors (END_TAG terminates) */
00669 
00670     do
00671     {
00672         AcpiOsPrintf ("\n[%02X] ", Count);
00673         Count++;
00674 
00675         /* Validate Type before dispatch */
00676 
00677         Type = ResourceList->Type;
00678         if (Type > ACPI_RESOURCE_TYPE_MAX)
00679         {
00680             AcpiOsPrintf (
00681                 "Invalid descriptor type (%X) in resource list\n",
00682                 ResourceList->Type);
00683             return;
00684         }
00685 
00686         /* Dump the resource descriptor */
00687 
00688         AcpiRsDumpDescriptor (&ResourceList->Data,
00689             AcpiGbl_DumpResourceDispatch[Type]);
00690 
00691         /* Point to the next resource structure */
00692 
00693         ResourceList = ACPI_ADD_PTR (ACPI_RESOURCE, ResourceList,
00694                             ResourceList->Length);
00695 
00696         /* Exit when END_TAG descriptor is reached */
00697 
00698     } while (Type != ACPI_RESOURCE_TYPE_END_TAG);
00699 }
00700 
00701 
00702 /*******************************************************************************
00703  *
00704  * FUNCTION:    AcpiRsDumpIrqList
00705  *
00706  * PARAMETERS:  RouteTable      - Pointer to the routing table to dump.
00707  *
00708  * RETURN:      None
00709  *
00710  * DESCRIPTION: Print IRQ routing table
00711  *
00712  ******************************************************************************/
00713 
00714 void
00715 AcpiRsDumpIrqList (
00716     UINT8                   *RouteTable)
00717 {
00718     ACPI_PCI_ROUTING_TABLE  *PrtElement;
00719     UINT8                   Count;
00720 
00721 
00722     ACPI_FUNCTION_ENTRY ();
00723 
00724 
00725     if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))
00726     {
00727         return;
00728     }
00729 
00730     PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable);
00731 
00732     /* Dump all table elements, Exit on zero length element */
00733 
00734     for (Count = 0; PrtElement->Length; Count++)
00735     {
00736         AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count);
00737         AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt);
00738 
00739         PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE,
00740                         PrtElement, PrtElement->Length);
00741     }
00742 }
00743 
00744 
00745 /*******************************************************************************
00746  *
00747  * FUNCTION:    AcpiRsOut*
00748  *
00749  * PARAMETERS:  Title       - Name of the resource field
00750  *              Value       - Value of the resource field
00751  *
00752  * RETURN:      None
00753  *
00754  * DESCRIPTION: Miscellaneous helper functions to consistently format the
00755  *              output of the resource dump routines
00756  *
00757  ******************************************************************************/
00758 
00759 static void
00760 AcpiRsOutString (
00761     char                    *Title,
00762     char                    *Value)
00763 {
00764     AcpiOsPrintf ("%27s : %s", Title, Value);
00765     if (!*Value)
00766     {
00767         AcpiOsPrintf ("[NULL NAMESTRING]");
00768     }
00769     AcpiOsPrintf ("\n");
00770 }
00771 
00772 static void
00773 AcpiRsOutInteger8 (
00774     char                    *Title,
00775     UINT8                   Value)
00776 {
00777     AcpiOsPrintf ("%27s : %2.2X\n", Title, Value);
00778 }
00779 
00780 static void
00781 AcpiRsOutInteger16 (
00782     char                    *Title,
00783     UINT16                  Value)
00784 {
00785     AcpiOsPrintf ("%27s : %4.4X\n", Title, Value);
00786 }
00787 
00788 static void
00789 AcpiRsOutInteger32 (
00790     char                    *Title,
00791     UINT32                  Value)
00792 {
00793     AcpiOsPrintf ("%27s : %8.8X\n", Title, Value);
00794 }
00795 
00796 static void
00797 AcpiRsOutInteger64 (
00798     char                    *Title,
00799     UINT64                  Value)
00800 {
00801     AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title,
00802         ACPI_FORMAT_UINT64 (Value));
00803 }
00804 
00805 static void
00806 AcpiRsOutTitle (
00807     char                    *Title)
00808 {
00809     AcpiOsPrintf ("%27s : ", Title);
00810 }
00811 
00812 
00813 /*******************************************************************************
00814  *
00815  * FUNCTION:    AcpiRsDump*List
00816  *
00817  * PARAMETERS:  Length      - Number of elements in the list
00818  *              Data        - Start of the list
00819  *
00820  * RETURN:      None
00821  *
00822  * DESCRIPTION: Miscellaneous functions to dump lists of raw data
00823  *
00824  ******************************************************************************/
00825 
00826 static void
00827 AcpiRsDumpByteList (
00828     UINT16                  Length,
00829     UINT8                   *Data)
00830 {
00831     UINT8                   i;
00832 
00833 
00834     for (i = 0; i < Length; i++)
00835     {
00836         AcpiOsPrintf ("%25s%2.2X : %2.2X\n",
00837             "Byte", i, Data[i]);
00838     }
00839 }
00840 
00841 static void
00842 AcpiRsDumpShortByteList (
00843     UINT8                  Length,
00844     UINT8                  *Data)
00845 {
00846     UINT8                   i;
00847 
00848 
00849     for (i = 0; i < Length; i++)
00850     {
00851         AcpiOsPrintf ("%X ", Data[i]);
00852     }
00853     AcpiOsPrintf ("\n");
00854 }
00855 
00856 static void
00857 AcpiRsDumpDwordList (
00858     UINT8                   Length,
00859     UINT32                  *Data)
00860 {
00861     UINT8                   i;
00862 
00863 
00864     for (i = 0; i < Length; i++)
00865     {
00866         AcpiOsPrintf ("%25s%2.2X : %8.8X\n",
00867             "Dword", i, Data[i]);
00868     }
00869 }
00870 
00871 #endif
00872 

Generated on Sun May 27 2012 04:27:22 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.