13446Smrj /******************************************************************************* 23446Smrj * 33446Smrj * Module Name: rsirq - IRQ resource descriptors 4*7851SDana.Myers@Sun.COM * $Revision: 1.52 $ 53446Smrj * 63446Smrj ******************************************************************************/ 73446Smrj 83446Smrj /****************************************************************************** 93446Smrj * 103446Smrj * 1. Copyright Notice 113446Smrj * 12*7851SDana.Myers@Sun.COM * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. 133446Smrj * All rights reserved. 143446Smrj * 153446Smrj * 2. License 163446Smrj * 173446Smrj * 2.1. This is your license from Intel Corp. under its intellectual property 183446Smrj * rights. You may have additional license terms from the party that provided 193446Smrj * you this software, covering your right to use that party's intellectual 203446Smrj * property rights. 213446Smrj * 223446Smrj * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 233446Smrj * copy of the source code appearing in this file ("Covered Code") an 243446Smrj * irrevocable, perpetual, worldwide license under Intel's copyrights in the 253446Smrj * base code distributed originally by Intel ("Original Intel Code") to copy, 263446Smrj * make derivatives, distribute, use and display any portion of the Covered 273446Smrj * Code in any form, with the right to sublicense such rights; and 283446Smrj * 293446Smrj * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 303446Smrj * license (with the right to sublicense), under only those claims of Intel 313446Smrj * patents that are infringed by the Original Intel Code, to make, use, sell, 323446Smrj * offer to sell, and import the Covered Code and derivative works thereof 333446Smrj * solely to the minimum extent necessary to exercise the above copyright 343446Smrj * license, and in no event shall the patent license extend to any additions 353446Smrj * to or modifications of the Original Intel Code. No other license or right 363446Smrj * is granted directly or by implication, estoppel or otherwise; 373446Smrj * 383446Smrj * The above copyright and patent license is granted only if the following 393446Smrj * conditions are met: 403446Smrj * 413446Smrj * 3. Conditions 423446Smrj * 433446Smrj * 3.1. Redistribution of Source with Rights to Further Distribute Source. 443446Smrj * Redistribution of source code of any substantial portion of the Covered 453446Smrj * Code or modification with rights to further distribute source must include 463446Smrj * the above Copyright Notice, the above License, this list of Conditions, 473446Smrj * and the following Disclaimer and Export Compliance provision. In addition, 483446Smrj * Licensee must cause all Covered Code to which Licensee contributes to 493446Smrj * contain a file documenting the changes Licensee made to create that Covered 503446Smrj * Code and the date of any change. Licensee must include in that file the 513446Smrj * documentation of any changes made by any predecessor Licensee. Licensee 523446Smrj * must include a prominent statement that the modification is derived, 533446Smrj * directly or indirectly, from Original Intel Code. 543446Smrj * 553446Smrj * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 563446Smrj * Redistribution of source code of any substantial portion of the Covered 573446Smrj * Code or modification without rights to further distribute source must 583446Smrj * include the following Disclaimer and Export Compliance provision in the 593446Smrj * documentation and/or other materials provided with distribution. In 603446Smrj * addition, Licensee may not authorize further sublicense of source of any 613446Smrj * portion of the Covered Code, and must include terms to the effect that the 623446Smrj * license from Licensee to its licensee is limited to the intellectual 633446Smrj * property embodied in the software Licensee provides to its licensee, and 643446Smrj * not to intellectual property embodied in modifications its licensee may 653446Smrj * make. 663446Smrj * 673446Smrj * 3.3. Redistribution of Executable. Redistribution in executable form of any 683446Smrj * substantial portion of the Covered Code or modification must reproduce the 693446Smrj * above Copyright Notice, and the following Disclaimer and Export Compliance 703446Smrj * provision in the documentation and/or other materials provided with the 713446Smrj * distribution. 723446Smrj * 733446Smrj * 3.4. Intel retains all right, title, and interest in and to the Original 743446Smrj * Intel Code. 753446Smrj * 763446Smrj * 3.5. Neither the name Intel nor any other trademark owned or controlled by 773446Smrj * Intel shall be used in advertising or otherwise to promote the sale, use or 783446Smrj * other dealings in products derived from or relating to the Covered Code 793446Smrj * without prior written authorization from Intel. 803446Smrj * 813446Smrj * 4. Disclaimer and Export Compliance 823446Smrj * 833446Smrj * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 843446Smrj * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 853446Smrj * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 863446Smrj * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 873446Smrj * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 883446Smrj * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 893446Smrj * PARTICULAR PURPOSE. 903446Smrj * 913446Smrj * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 923446Smrj * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 933446Smrj * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 943446Smrj * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 953446Smrj * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 963446Smrj * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 973446Smrj * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 983446Smrj * LIMITED REMEDY. 993446Smrj * 1003446Smrj * 4.3. Licensee shall not export, either directly or indirectly, any of this 1013446Smrj * software or system incorporating such software without first obtaining any 1023446Smrj * required license or other approval from the U. S. Department of Commerce or 1033446Smrj * any other agency or department of the United States Government. In the 1043446Smrj * event Licensee exports any such software from the United States or 1053446Smrj * re-exports any such software from a foreign destination, Licensee shall 1063446Smrj * ensure that the distribution and export/re-export of the software is in 1073446Smrj * compliance with all laws, regulations, orders, or other restrictions of the 1083446Smrj * U.S. Export Administration Regulations. Licensee agrees that neither it nor 1093446Smrj * any of its subsidiaries will export/re-export any technical data, process, 1103446Smrj * software, or service, directly or indirectly, to any country for which the 1113446Smrj * United States government or any agency thereof requires an export license, 1123446Smrj * other governmental approval, or letter of assurance, without first obtaining 1133446Smrj * such license, approval or letter. 1143446Smrj * 1153446Smrj *****************************************************************************/ 1163446Smrj 1173446Smrj #define __RSIRQ_C__ 1183446Smrj 1193446Smrj #include "acpi.h" 1203446Smrj #include "acresrc.h" 1213446Smrj 1223446Smrj #define _COMPONENT ACPI_RESOURCES 1233446Smrj ACPI_MODULE_NAME ("rsirq") 1243446Smrj 1253446Smrj 1263446Smrj /******************************************************************************* 1273446Smrj * 1283446Smrj * AcpiRsGetIrq 1293446Smrj * 1303446Smrj ******************************************************************************/ 1313446Smrj 132*7851SDana.Myers@Sun.COM ACPI_RSCONVERT_INFO AcpiRsGetIrq[8] = 1333446Smrj { 1343446Smrj {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ, 1353446Smrj ACPI_RS_SIZE (ACPI_RESOURCE_IRQ), 1363446Smrj ACPI_RSC_TABLE_SIZE (AcpiRsGetIrq)}, 1373446Smrj 1383446Smrj /* Get the IRQ mask (bytes 1:2) */ 1393446Smrj 1403446Smrj {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]), 1413446Smrj AML_OFFSET (Irq.IrqMask), 1423446Smrj ACPI_RS_OFFSET (Data.Irq.InterruptCount)}, 1433446Smrj 1443446Smrj /* Set default flags (others are zero) */ 1453446Smrj 1463446Smrj {ACPI_RSC_SET8, ACPI_RS_OFFSET (Data.Irq.Triggering), 1473446Smrj ACPI_EDGE_SENSITIVE, 1483446Smrj 1}, 1493446Smrj 150*7851SDana.Myers@Sun.COM /* Get the descriptor length (2 or 3 for IRQ descriptor) */ 151*7851SDana.Myers@Sun.COM 152*7851SDana.Myers@Sun.COM {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Irq.DescriptorLength), 153*7851SDana.Myers@Sun.COM AML_OFFSET (Irq.DescriptorType), 154*7851SDana.Myers@Sun.COM 0}, 155*7851SDana.Myers@Sun.COM 1563446Smrj /* All done if no flag byte present in descriptor */ 1573446Smrj 1583446Smrj {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3}, 1593446Smrj 1603446Smrj /* Get flags: Triggering[0], Polarity[3], Sharing[4] */ 1613446Smrj 1623446Smrj {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering), 1633446Smrj AML_OFFSET (Irq.Flags), 1643446Smrj 0}, 1653446Smrj 1663446Smrj {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Polarity), 1673446Smrj AML_OFFSET (Irq.Flags), 1683446Smrj 3}, 1693446Smrj 1703446Smrj {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Sharable), 1713446Smrj AML_OFFSET (Irq.Flags), 1723446Smrj 4} 1733446Smrj }; 1743446Smrj 1753446Smrj 1763446Smrj /******************************************************************************* 1773446Smrj * 1783446Smrj * AcpiRsSetIrq 1793446Smrj * 1803446Smrj ******************************************************************************/ 1813446Smrj 182*7851SDana.Myers@Sun.COM ACPI_RSCONVERT_INFO AcpiRsSetIrq[13] = 1833446Smrj { 184*7851SDana.Myers@Sun.COM /* Start with a default descriptor of length 3 */ 185*7851SDana.Myers@Sun.COM 1863446Smrj {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ, 1873446Smrj sizeof (AML_RESOURCE_IRQ), 1883446Smrj ACPI_RSC_TABLE_SIZE (AcpiRsSetIrq)}, 1893446Smrj 1903446Smrj /* Convert interrupt list to 16-bit IRQ bitmask */ 1913446Smrj 1923446Smrj {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]), 1933446Smrj AML_OFFSET (Irq.IrqMask), 1943446Smrj ACPI_RS_OFFSET (Data.Irq.InterruptCount)}, 1953446Smrj 196*7851SDana.Myers@Sun.COM /* Set the flags byte */ 1973446Smrj 1983446Smrj {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering), 1993446Smrj AML_OFFSET (Irq.Flags), 2003446Smrj 0}, 2013446Smrj 2023446Smrj {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Polarity), 2033446Smrj AML_OFFSET (Irq.Flags), 2043446Smrj 3}, 2053446Smrj 2063446Smrj {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Sharable), 2073446Smrj AML_OFFSET (Irq.Flags), 2083446Smrj 4}, 209*7851SDana.Myers@Sun.COM 210*7851SDana.Myers@Sun.COM /* 211*7851SDana.Myers@Sun.COM * All done if the output descriptor length is required to be 3 212*7851SDana.Myers@Sun.COM * (i.e., optimization to 2 bytes cannot be attempted) 213*7851SDana.Myers@Sun.COM */ 214*7851SDana.Myers@Sun.COM {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, 215*7851SDana.Myers@Sun.COM ACPI_RS_OFFSET(Data.Irq.DescriptorLength), 216*7851SDana.Myers@Sun.COM 3}, 217*7851SDana.Myers@Sun.COM 218*7851SDana.Myers@Sun.COM /* Set length to 2 bytes (no flags byte) */ 219*7851SDana.Myers@Sun.COM 220*7851SDana.Myers@Sun.COM {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)}, 221*7851SDana.Myers@Sun.COM 222*7851SDana.Myers@Sun.COM /* 223*7851SDana.Myers@Sun.COM * All done if the output descriptor length is required to be 2. 224*7851SDana.Myers@Sun.COM * 225*7851SDana.Myers@Sun.COM * TBD: Perhaps we should check for error if input flags are not 226*7851SDana.Myers@Sun.COM * compatible with a 2-byte descriptor. 227*7851SDana.Myers@Sun.COM */ 228*7851SDana.Myers@Sun.COM {ACPI_RSC_EXIT_EQ, ACPI_RSC_COMPARE_VALUE, 229*7851SDana.Myers@Sun.COM ACPI_RS_OFFSET(Data.Irq.DescriptorLength), 230*7851SDana.Myers@Sun.COM 2}, 231*7851SDana.Myers@Sun.COM 232*7851SDana.Myers@Sun.COM /* Reset length to 3 bytes (descriptor with flags byte) */ 233*7851SDana.Myers@Sun.COM 234*7851SDana.Myers@Sun.COM {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ)}, 235*7851SDana.Myers@Sun.COM 2363446Smrj /* 2373446Smrj * Check if the flags byte is necessary. Not needed if the flags are: 2383446Smrj * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE 2393446Smrj */ 2403446Smrj {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, 2413446Smrj ACPI_RS_OFFSET (Data.Irq.Triggering), 2423446Smrj ACPI_EDGE_SENSITIVE}, 2433446Smrj 2443446Smrj {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, 2453446Smrj ACPI_RS_OFFSET (Data.Irq.Polarity), 2463446Smrj ACPI_ACTIVE_HIGH}, 2473446Smrj 2483446Smrj {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE, 2493446Smrj ACPI_RS_OFFSET (Data.Irq.Sharable), 2503446Smrj ACPI_EXCLUSIVE}, 2513446Smrj 252*7851SDana.Myers@Sun.COM /* We can optimize to a 2-byte IrqNoFlags() descriptor */ 2533446Smrj 2543446Smrj {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)} 2553446Smrj }; 2563446Smrj 2573446Smrj 2583446Smrj /******************************************************************************* 2593446Smrj * 2603446Smrj * AcpiRsConvertExtIrq 2613446Smrj * 2623446Smrj ******************************************************************************/ 2633446Smrj 2643446Smrj ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[9] = 2653446Smrj { 2663446Smrj {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ, 2673446Smrj ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ), 2683446Smrj ACPI_RSC_TABLE_SIZE (AcpiRsConvertExtIrq)}, 2693446Smrj 2703446Smrj {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_IRQ, 2713446Smrj sizeof (AML_RESOURCE_EXTENDED_IRQ), 2723446Smrj 0}, 2733446Smrj 2743446Smrj /* Flag bits */ 2753446Smrj 2763446Smrj {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.ProducerConsumer), 2773446Smrj AML_OFFSET (ExtendedIrq.Flags), 2783446Smrj 0}, 2793446Smrj 2803446Smrj {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Triggering), 2813446Smrj AML_OFFSET (ExtendedIrq.Flags), 2823446Smrj 1}, 2833446Smrj 2843446Smrj {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Polarity), 2853446Smrj AML_OFFSET (ExtendedIrq.Flags), 2863446Smrj 2}, 2873446Smrj 2883446Smrj {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Sharable), 2893446Smrj AML_OFFSET (ExtendedIrq.Flags), 2903446Smrj 3}, 2913446Smrj 2923446Smrj /* IRQ Table length (Byte4) */ 2933446Smrj 2943446Smrj {ACPI_RSC_COUNT, ACPI_RS_OFFSET (Data.ExtendedIrq.InterruptCount), 2953446Smrj AML_OFFSET (ExtendedIrq.InterruptCount), 2963446Smrj sizeof (UINT32)}, 2973446Smrj 2983446Smrj /* Copy every IRQ in the table, each is 32 bits */ 2993446Smrj 3003446Smrj {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]), 3013446Smrj AML_OFFSET (ExtendedIrq.Interrupts[0]), 3023446Smrj 0}, 3033446Smrj 3043446Smrj /* Optional ResourceSource (Index and String) */ 3053446Smrj 3063446Smrj {ACPI_RSC_SOURCEX, ACPI_RS_OFFSET (Data.ExtendedIrq.ResourceSource), 3073446Smrj ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]), 3083446Smrj sizeof (AML_RESOURCE_EXTENDED_IRQ)} 3093446Smrj }; 3103446Smrj 3113446Smrj 3123446Smrj /******************************************************************************* 3133446Smrj * 3143446Smrj * AcpiRsConvertDma 3153446Smrj * 3163446Smrj ******************************************************************************/ 3173446Smrj 3183446Smrj ACPI_RSCONVERT_INFO AcpiRsConvertDma[6] = 3193446Smrj { 3203446Smrj {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_DMA, 3213446Smrj ACPI_RS_SIZE (ACPI_RESOURCE_DMA), 3223446Smrj ACPI_RSC_TABLE_SIZE (AcpiRsConvertDma)}, 3233446Smrj 3243446Smrj {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_DMA, 3253446Smrj sizeof (AML_RESOURCE_DMA), 3263446Smrj 0}, 3273446Smrj 3283446Smrj /* Flags: transfer preference, bus mastering, channel speed */ 3293446Smrj 3303446Smrj {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Dma.Transfer), 3313446Smrj AML_OFFSET (Dma.Flags), 3323446Smrj 0}, 3333446Smrj 3343446Smrj {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Dma.BusMaster), 3353446Smrj AML_OFFSET (Dma.Flags), 3363446Smrj 2}, 3373446Smrj 3383446Smrj {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Dma.Type), 3393446Smrj AML_OFFSET (Dma.Flags), 3403446Smrj 5}, 3413446Smrj 3423446Smrj /* DMA channel mask bits */ 3433446Smrj 3443446Smrj {ACPI_RSC_BITMASK, ACPI_RS_OFFSET (Data.Dma.Channels[0]), 3453446Smrj AML_OFFSET (Dma.DmaChannelMask), 3463446Smrj ACPI_RS_OFFSET (Data.Dma.ChannelCount)} 3473446Smrj }; 3483446Smrj 349