xref: /onnv-gate/usr/src/uts/intel/io/acpica/resources/rsinfo.c (revision 9980:13d7f3eec672)
13446Smrj /*******************************************************************************
23446Smrj  *
33446Smrj  * Module Name: rsinfo - Dispatch and Info tables
43446Smrj  *
53446Smrj  ******************************************************************************/
63446Smrj 
73446Smrj /******************************************************************************
83446Smrj  *
93446Smrj  * 1. Copyright Notice
103446Smrj  *
11*9980SDana.Myers@Sun.COM  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
123446Smrj  * All rights reserved.
133446Smrj  *
143446Smrj  * 2. License
153446Smrj  *
163446Smrj  * 2.1. This is your license from Intel Corp. under its intellectual property
173446Smrj  * rights.  You may have additional license terms from the party that provided
183446Smrj  * you this software, covering your right to use that party's intellectual
193446Smrj  * property rights.
203446Smrj  *
213446Smrj  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
223446Smrj  * copy of the source code appearing in this file ("Covered Code") an
233446Smrj  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
243446Smrj  * base code distributed originally by Intel ("Original Intel Code") to copy,
253446Smrj  * make derivatives, distribute, use and display any portion of the Covered
263446Smrj  * Code in any form, with the right to sublicense such rights; and
273446Smrj  *
283446Smrj  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
293446Smrj  * license (with the right to sublicense), under only those claims of Intel
303446Smrj  * patents that are infringed by the Original Intel Code, to make, use, sell,
313446Smrj  * offer to sell, and import the Covered Code and derivative works thereof
323446Smrj  * solely to the minimum extent necessary to exercise the above copyright
333446Smrj  * license, and in no event shall the patent license extend to any additions
343446Smrj  * to or modifications of the Original Intel Code.  No other license or right
353446Smrj  * is granted directly or by implication, estoppel or otherwise;
363446Smrj  *
373446Smrj  * The above copyright and patent license is granted only if the following
383446Smrj  * conditions are met:
393446Smrj  *
403446Smrj  * 3. Conditions
413446Smrj  *
423446Smrj  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
433446Smrj  * Redistribution of source code of any substantial portion of the Covered
443446Smrj  * Code or modification with rights to further distribute source must include
453446Smrj  * the above Copyright Notice, the above License, this list of Conditions,
463446Smrj  * and the following Disclaimer and Export Compliance provision.  In addition,
473446Smrj  * Licensee must cause all Covered Code to which Licensee contributes to
483446Smrj  * contain a file documenting the changes Licensee made to create that Covered
493446Smrj  * Code and the date of any change.  Licensee must include in that file the
503446Smrj  * documentation of any changes made by any predecessor Licensee.  Licensee
513446Smrj  * must include a prominent statement that the modification is derived,
523446Smrj  * directly or indirectly, from Original Intel Code.
533446Smrj  *
543446Smrj  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
553446Smrj  * Redistribution of source code of any substantial portion of the Covered
563446Smrj  * Code or modification without rights to further distribute source must
573446Smrj  * include the following Disclaimer and Export Compliance provision in the
583446Smrj  * documentation and/or other materials provided with distribution.  In
593446Smrj  * addition, Licensee may not authorize further sublicense of source of any
603446Smrj  * portion of the Covered Code, and must include terms to the effect that the
613446Smrj  * license from Licensee to its licensee is limited to the intellectual
623446Smrj  * property embodied in the software Licensee provides to its licensee, and
633446Smrj  * not to intellectual property embodied in modifications its licensee may
643446Smrj  * make.
653446Smrj  *
663446Smrj  * 3.3. Redistribution of Executable. Redistribution in executable form of any
673446Smrj  * substantial portion of the Covered Code or modification must reproduce the
683446Smrj  * above Copyright Notice, and the following Disclaimer and Export Compliance
693446Smrj  * provision in the documentation and/or other materials provided with the
703446Smrj  * distribution.
713446Smrj  *
723446Smrj  * 3.4. Intel retains all right, title, and interest in and to the Original
733446Smrj  * Intel Code.
743446Smrj  *
753446Smrj  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
763446Smrj  * Intel shall be used in advertising or otherwise to promote the sale, use or
773446Smrj  * other dealings in products derived from or relating to the Covered Code
783446Smrj  * without prior written authorization from Intel.
793446Smrj  *
803446Smrj  * 4. Disclaimer and Export Compliance
813446Smrj  *
823446Smrj  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
833446Smrj  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
843446Smrj  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
853446Smrj  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
863446Smrj  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
873446Smrj  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
883446Smrj  * PARTICULAR PURPOSE.
893446Smrj  *
903446Smrj  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
913446Smrj  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
923446Smrj  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
933446Smrj  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
943446Smrj  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
953446Smrj  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
963446Smrj  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
973446Smrj  * LIMITED REMEDY.
983446Smrj  *
993446Smrj  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1003446Smrj  * software or system incorporating such software without first obtaining any
1013446Smrj  * required license or other approval from the U. S. Department of Commerce or
1023446Smrj  * any other agency or department of the United States Government.  In the
1033446Smrj  * event Licensee exports any such software from the United States or
1043446Smrj  * re-exports any such software from a foreign destination, Licensee shall
1053446Smrj  * ensure that the distribution and export/re-export of the software is in
1063446Smrj  * compliance with all laws, regulations, orders, or other restrictions of the
1073446Smrj  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1083446Smrj  * any of its subsidiaries will export/re-export any technical data, process,
1093446Smrj  * software, or service, directly or indirectly, to any country for which the
1103446Smrj  * United States government or any agency thereof requires an export license,
1113446Smrj  * other governmental approval, or letter of assurance, without first obtaining
1123446Smrj  * such license, approval or letter.
1133446Smrj  *
1143446Smrj  *****************************************************************************/
1153446Smrj 
1163446Smrj #define __RSINFO_C__
1173446Smrj 
1183446Smrj #include "acpi.h"
119*9980SDana.Myers@Sun.COM #include "accommon.h"
1203446Smrj #include "acresrc.h"
1213446Smrj 
1223446Smrj #define _COMPONENT          ACPI_RESOURCES
1233446Smrj         ACPI_MODULE_NAME    ("rsinfo")
1243446Smrj 
1253446Smrj /*
1263446Smrj  * Resource dispatch and information tables. Any new resource types (either
1273446Smrj  * Large or Small) must be reflected in each of these tables, so they are here
1283446Smrj  * in one place.
1293446Smrj  *
1303446Smrj  * The tables for Large descriptors are indexed by bits 6:0 of the AML
1313446Smrj  * descriptor type byte. The tables for Small descriptors are indexed by
1323446Smrj  * bits 6:3 of the descriptor byte. The tables for internal resource
1333446Smrj  * descriptors are indexed by the ACPI_RESOURCE_TYPE field.
1343446Smrj  */
1353446Smrj 
1363446Smrj 
1373446Smrj /* Dispatch table for resource-to-AML (Set Resource) conversion functions */
1383446Smrj 
1393446Smrj ACPI_RSCONVERT_INFO         *AcpiGbl_SetResourceDispatch[] =
1403446Smrj {
1413446Smrj     AcpiRsSetIrq,                   /* 0x00, ACPI_RESOURCE_TYPE_IRQ */
1423446Smrj     AcpiRsConvertDma,               /* 0x01, ACPI_RESOURCE_TYPE_DMA */
1433446Smrj     AcpiRsSetStartDpf,              /* 0x02, ACPI_RESOURCE_TYPE_START_DEPENDENT */
1443446Smrj     AcpiRsConvertEndDpf,            /* 0x03, ACPI_RESOURCE_TYPE_END_DEPENDENT */
1453446Smrj     AcpiRsConvertIo,                /* 0x04, ACPI_RESOURCE_TYPE_IO */
1463446Smrj     AcpiRsConvertFixedIo,           /* 0x05, ACPI_RESOURCE_TYPE_FIXED_IO */
1473446Smrj     AcpiRsSetVendor,                /* 0x06, ACPI_RESOURCE_TYPE_VENDOR */
1483446Smrj     AcpiRsConvertEndTag,            /* 0x07, ACPI_RESOURCE_TYPE_END_TAG */
1493446Smrj     AcpiRsConvertMemory24,          /* 0x08, ACPI_RESOURCE_TYPE_MEMORY24 */
1503446Smrj     AcpiRsConvertMemory32,          /* 0x09, ACPI_RESOURCE_TYPE_MEMORY32 */
1513446Smrj     AcpiRsConvertFixedMemory32,     /* 0x0A, ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
1523446Smrj     AcpiRsConvertAddress16,         /* 0x0B, ACPI_RESOURCE_TYPE_ADDRESS16 */
1533446Smrj     AcpiRsConvertAddress32,         /* 0x0C, ACPI_RESOURCE_TYPE_ADDRESS32 */
1543446Smrj     AcpiRsConvertAddress64,         /* 0x0D, ACPI_RESOURCE_TYPE_ADDRESS64 */
1553446Smrj     AcpiRsConvertExtAddress64,      /* 0x0E, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
1563446Smrj     AcpiRsConvertExtIrq,            /* 0x0F, ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
1573446Smrj     AcpiRsConvertGenericReg         /* 0x10, ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
1583446Smrj };
1593446Smrj 
1603446Smrj /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */
1613446Smrj 
1623446Smrj ACPI_RSCONVERT_INFO         *AcpiGbl_GetResourceDispatch[] =
1633446Smrj {
1643446Smrj     /* Small descriptors */
1653446Smrj 
1663446Smrj     NULL,                           /* 0x00, Reserved */
1673446Smrj     NULL,                           /* 0x01, Reserved */
1683446Smrj     NULL,                           /* 0x02, Reserved */
1693446Smrj     NULL,                           /* 0x03, Reserved */
1703446Smrj     AcpiRsGetIrq,                   /* 0x04, ACPI_RESOURCE_NAME_IRQ */
1713446Smrj     AcpiRsConvertDma,               /* 0x05, ACPI_RESOURCE_NAME_DMA */
1723446Smrj     AcpiRsGetStartDpf,              /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
1733446Smrj     AcpiRsConvertEndDpf,            /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
1743446Smrj     AcpiRsConvertIo,                /* 0x08, ACPI_RESOURCE_NAME_IO */
1753446Smrj     AcpiRsConvertFixedIo,           /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO */
1763446Smrj     NULL,                           /* 0x0A, Reserved */
1773446Smrj     NULL,                           /* 0x0B, Reserved */
1783446Smrj     NULL,                           /* 0x0C, Reserved */
1793446Smrj     NULL,                           /* 0x0D, Reserved */
1803446Smrj     AcpiRsGetVendorSmall,           /* 0x0E, ACPI_RESOURCE_NAME_VENDOR_SMALL */
1813446Smrj     AcpiRsConvertEndTag,            /* 0x0F, ACPI_RESOURCE_NAME_END_TAG */
1823446Smrj 
1833446Smrj     /* Large descriptors */
1843446Smrj 
1853446Smrj     NULL,                           /* 0x00, Reserved */
1863446Smrj     AcpiRsConvertMemory24,          /* 0x01, ACPI_RESOURCE_NAME_MEMORY24 */
1873446Smrj     AcpiRsConvertGenericReg,        /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
1883446Smrj     NULL,                           /* 0x03, Reserved */
1893446Smrj     AcpiRsGetVendorLarge,           /* 0x04, ACPI_RESOURCE_NAME_VENDOR_LARGE */
1903446Smrj     AcpiRsConvertMemory32,          /* 0x05, ACPI_RESOURCE_NAME_MEMORY32 */
1913446Smrj     AcpiRsConvertFixedMemory32,     /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY32 */
1923446Smrj     AcpiRsConvertAddress32,         /* 0x07, ACPI_RESOURCE_NAME_ADDRESS32 */
1933446Smrj     AcpiRsConvertAddress16,         /* 0x08, ACPI_RESOURCE_NAME_ADDRESS16 */
1943446Smrj     AcpiRsConvertExtIrq,            /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_IRQ */
1953446Smrj     AcpiRsConvertAddress64,         /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */
1963446Smrj     AcpiRsConvertExtAddress64       /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */
1973446Smrj };
1983446Smrj 
1993446Smrj 
2003446Smrj #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
2013446Smrj 
2023446Smrj /* Dispatch table for resource dump functions */
2033446Smrj 
2043446Smrj ACPI_RSDUMP_INFO            *AcpiGbl_DumpResourceDispatch[] =
2053446Smrj {
2063446Smrj     AcpiRsDumpIrq,                  /* ACPI_RESOURCE_TYPE_IRQ */
2073446Smrj     AcpiRsDumpDma,                  /* ACPI_RESOURCE_TYPE_DMA */
2083446Smrj     AcpiRsDumpStartDpf,             /* ACPI_RESOURCE_TYPE_START_DEPENDENT */
2093446Smrj     AcpiRsDumpEndDpf,               /* ACPI_RESOURCE_TYPE_END_DEPENDENT */
2103446Smrj     AcpiRsDumpIo,                   /* ACPI_RESOURCE_TYPE_IO */
2113446Smrj     AcpiRsDumpFixedIo,              /* ACPI_RESOURCE_TYPE_FIXED_IO */
2123446Smrj     AcpiRsDumpVendor,               /* ACPI_RESOURCE_TYPE_VENDOR */
2133446Smrj     AcpiRsDumpEndTag,               /* ACPI_RESOURCE_TYPE_END_TAG */
2143446Smrj     AcpiRsDumpMemory24,             /* ACPI_RESOURCE_TYPE_MEMORY24 */
2153446Smrj     AcpiRsDumpMemory32,             /* ACPI_RESOURCE_TYPE_MEMORY32 */
2163446Smrj     AcpiRsDumpFixedMemory32,        /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
2173446Smrj     AcpiRsDumpAddress16,            /* ACPI_RESOURCE_TYPE_ADDRESS16 */
2183446Smrj     AcpiRsDumpAddress32,            /* ACPI_RESOURCE_TYPE_ADDRESS32 */
2193446Smrj     AcpiRsDumpAddress64,            /* ACPI_RESOURCE_TYPE_ADDRESS64 */
2203446Smrj     AcpiRsDumpExtAddress64,         /* ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
2213446Smrj     AcpiRsDumpExtIrq,               /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
2223446Smrj     AcpiRsDumpGenericReg,           /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
2233446Smrj };
2243446Smrj #endif
2253446Smrj 
2263446Smrj 
2273446Smrj /*
2283446Smrj  * Base sizes for external AML resource descriptors, indexed by internal type.
2293446Smrj  * Includes size of the descriptor header (1 byte for small descriptors,
2303446Smrj  * 3 bytes for large descriptors)
2313446Smrj  */
2323446Smrj const UINT8                 AcpiGbl_AmlResourceSizes[] =
2333446Smrj {
2343446Smrj     sizeof (AML_RESOURCE_IRQ),              /* ACPI_RESOURCE_TYPE_IRQ (optional Byte 3 always created) */
2353446Smrj     sizeof (AML_RESOURCE_DMA),              /* ACPI_RESOURCE_TYPE_DMA */
2363446Smrj     sizeof (AML_RESOURCE_START_DEPENDENT),  /* ACPI_RESOURCE_TYPE_START_DEPENDENT (optional Byte 1 always created) */
2373446Smrj     sizeof (AML_RESOURCE_END_DEPENDENT),    /* ACPI_RESOURCE_TYPE_END_DEPENDENT */
2383446Smrj     sizeof (AML_RESOURCE_IO),               /* ACPI_RESOURCE_TYPE_IO */
2393446Smrj     sizeof (AML_RESOURCE_FIXED_IO),         /* ACPI_RESOURCE_TYPE_FIXED_IO */
2403446Smrj     sizeof (AML_RESOURCE_VENDOR_SMALL),     /* ACPI_RESOURCE_TYPE_VENDOR */
2413446Smrj     sizeof (AML_RESOURCE_END_TAG),          /* ACPI_RESOURCE_TYPE_END_TAG */
2423446Smrj     sizeof (AML_RESOURCE_MEMORY24),         /* ACPI_RESOURCE_TYPE_MEMORY24 */
2433446Smrj     sizeof (AML_RESOURCE_MEMORY32),         /* ACPI_RESOURCE_TYPE_MEMORY32 */
2443446Smrj     sizeof (AML_RESOURCE_FIXED_MEMORY32),   /* ACPI_RESOURCE_TYPE_FIXED_MEMORY32 */
2453446Smrj     sizeof (AML_RESOURCE_ADDRESS16),        /* ACPI_RESOURCE_TYPE_ADDRESS16 */
2463446Smrj     sizeof (AML_RESOURCE_ADDRESS32),        /* ACPI_RESOURCE_TYPE_ADDRESS32 */
2473446Smrj     sizeof (AML_RESOURCE_ADDRESS64),        /* ACPI_RESOURCE_TYPE_ADDRESS64 */
2483446Smrj     sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),/*ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 */
2493446Smrj     sizeof (AML_RESOURCE_EXTENDED_IRQ),     /* ACPI_RESOURCE_TYPE_EXTENDED_IRQ */
2503446Smrj     sizeof (AML_RESOURCE_GENERIC_REGISTER)  /* ACPI_RESOURCE_TYPE_GENERIC_REGISTER */
2513446Smrj };
2523446Smrj 
2533446Smrj 
2543446Smrj const UINT8                 AcpiGbl_ResourceStructSizes[] =
2553446Smrj {
2563446Smrj     /* Small descriptors */
2573446Smrj 
2583446Smrj     0,
2593446Smrj     0,
2603446Smrj     0,
2613446Smrj     0,
2623446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_IRQ),
2633446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_DMA),
2643446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT),
2653446Smrj     ACPI_RS_SIZE_MIN,
2663446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_IO),
2673446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO),
2683446Smrj     0,
2693446Smrj     0,
2703446Smrj     0,
2713446Smrj     0,
2723446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR),
2733446Smrj     ACPI_RS_SIZE_MIN,
2743446Smrj 
2753446Smrj     /* Large descriptors */
2763446Smrj 
2773446Smrj     0,
2783446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY24),
2793446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER),
2803446Smrj     0,
2813446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR),
2823446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY32),
2833446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_MEMORY32),
2843446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS32),
2853446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16),
2863446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ),
2873446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64),
2883446Smrj     ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64)
2893446Smrj };
2903446Smrj 
291