Print this page
acpica-unix2-20130823
PANKOVs restructure
   1 /*******************************************************************************
   2  *
   3  * Module Name: rsirq - IRQ resource descriptors
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


  40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41  * POSSIBILITY OF SUCH DAMAGES.
  42  */
  43 
  44 #define __RSIRQ_C__
  45 
  46 #include "acpi.h"
  47 #include "accommon.h"
  48 #include "acresrc.h"
  49 
  50 #define _COMPONENT          ACPI_RESOURCES
  51         ACPI_MODULE_NAME    ("rsirq")
  52 
  53 
  54 /*******************************************************************************
  55  *
  56  * AcpiRsGetIrq
  57  *
  58  ******************************************************************************/
  59 
  60 ACPI_RSCONVERT_INFO     AcpiRsGetIrq[8] =
  61 {
  62     {ACPI_RSC_INITGET,  ACPI_RESOURCE_TYPE_IRQ,
  63                         ACPI_RS_SIZE (ACPI_RESOURCE_IRQ),
  64                         ACPI_RSC_TABLE_SIZE (AcpiRsGetIrq)},
  65 
  66     /* Get the IRQ mask (bytes 1:2) */
  67 
  68     {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]),
  69                         AML_OFFSET (Irq.IrqMask),
  70                         ACPI_RS_OFFSET (Data.Irq.InterruptCount)},
  71 
  72     /* Set default flags (others are zero) */
  73 
  74     {ACPI_RSC_SET8,     ACPI_RS_OFFSET (Data.Irq.Triggering),
  75                         ACPI_EDGE_SENSITIVE,
  76                         1},
  77 
  78     /* Get the descriptor length (2 or 3 for IRQ descriptor) */
  79 
  80     {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Irq.DescriptorLength),
  81                         AML_OFFSET (Irq.DescriptorType),
  82                         0},
  83 
  84     /* All done if no flag byte present in descriptor */
  85 
  86     {ACPI_RSC_EXIT_NE,  ACPI_RSC_COMPARE_AML_LENGTH, 0, 3},
  87 
  88     /* Get flags: Triggering[0], Polarity[3], Sharing[4] */
  89 
  90     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering),
  91                         AML_OFFSET (Irq.Flags),
  92                         0},
  93 
  94     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Polarity),
  95                         AML_OFFSET (Irq.Flags),
  96                         3},
  97 
  98     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Sharable),
  99                         AML_OFFSET (Irq.Flags),
 100                         4}




 101 };
 102 
 103 
 104 /*******************************************************************************
 105  *
 106  * AcpiRsSetIrq
 107  *
 108  ******************************************************************************/
 109 
 110 ACPI_RSCONVERT_INFO     AcpiRsSetIrq[13] =
 111 {
 112     /* Start with a default descriptor of length 3 */
 113 
 114     {ACPI_RSC_INITSET,  ACPI_RESOURCE_NAME_IRQ,
 115                         sizeof (AML_RESOURCE_IRQ),
 116                         ACPI_RSC_TABLE_SIZE (AcpiRsSetIrq)},
 117 
 118     /* Convert interrupt list to 16-bit IRQ bitmask */
 119 
 120     {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]),
 121                         AML_OFFSET (Irq.IrqMask),
 122                         ACPI_RS_OFFSET (Data.Irq.InterruptCount)},
 123 
 124     /* Set the flags byte */
 125 
 126     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering),
 127                         AML_OFFSET (Irq.Flags),
 128                         0},
 129 
 130     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Polarity),
 131                         AML_OFFSET (Irq.Flags),
 132                         3},
 133 
 134     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Sharable),
 135                         AML_OFFSET (Irq.Flags),
 136                         4},
 137 




 138     /*
 139      * All done if the output descriptor length is required to be 3
 140      * (i.e., optimization to 2 bytes cannot be attempted)
 141      */
 142     {ACPI_RSC_EXIT_EQ,  ACPI_RSC_COMPARE_VALUE,
 143                         ACPI_RS_OFFSET(Data.Irq.DescriptorLength),
 144                         3},
 145 
 146     /* Set length to 2 bytes (no flags byte) */
 147 
 148     {ACPI_RSC_LENGTH,   0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)},
 149 
 150     /*
 151      * All done if the output descriptor length is required to be 2.
 152      *
 153      * TBD: Perhaps we should check for error if input flags are not
 154      * compatible with a 2-byte descriptor.
 155      */
 156     {ACPI_RSC_EXIT_EQ,  ACPI_RSC_COMPARE_VALUE,
 157                         ACPI_RS_OFFSET(Data.Irq.DescriptorLength),


 172     {ACPI_RSC_EXIT_NE,  ACPI_RSC_COMPARE_VALUE,
 173                         ACPI_RS_OFFSET (Data.Irq.Polarity),
 174                         ACPI_ACTIVE_HIGH},
 175 
 176     {ACPI_RSC_EXIT_NE,  ACPI_RSC_COMPARE_VALUE,
 177                         ACPI_RS_OFFSET (Data.Irq.Sharable),
 178                         ACPI_EXCLUSIVE},
 179 
 180     /* We can optimize to a 2-byte IrqNoFlags() descriptor */
 181 
 182     {ACPI_RSC_LENGTH,   0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)}
 183 };
 184 
 185 
 186 /*******************************************************************************
 187  *
 188  * AcpiRsConvertExtIrq
 189  *
 190  ******************************************************************************/
 191 
 192 ACPI_RSCONVERT_INFO     AcpiRsConvertExtIrq[9] =
 193 {
 194     {ACPI_RSC_INITGET,  ACPI_RESOURCE_TYPE_EXTENDED_IRQ,
 195                         ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ),
 196                         ACPI_RSC_TABLE_SIZE (AcpiRsConvertExtIrq)},
 197 
 198     {ACPI_RSC_INITSET,  ACPI_RESOURCE_NAME_EXTENDED_IRQ,
 199                         sizeof (AML_RESOURCE_EXTENDED_IRQ),
 200                         0},
 201 
 202     /* Flag bits */
 203 


 204     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.ProducerConsumer),
 205                         AML_OFFSET (ExtendedIrq.Flags),
 206                         0},
 207 
 208     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Triggering),
 209                         AML_OFFSET (ExtendedIrq.Flags),
 210                         1},
 211 
 212     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Polarity),
 213                         AML_OFFSET (ExtendedIrq.Flags),
 214                         2},
 215 
 216     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Sharable),
 217                         AML_OFFSET (ExtendedIrq.Flags),
 218                         3},
 219 




 220     /* IRQ Table length (Byte4) */
 221 
 222     {ACPI_RSC_COUNT,    ACPI_RS_OFFSET (Data.ExtendedIrq.InterruptCount),
 223                         AML_OFFSET (ExtendedIrq.InterruptCount),
 224                         sizeof (UINT32)},
 225 
 226     /* Copy every IRQ in the table, each is 32 bits */
 227 
 228     {ACPI_RSC_MOVE32,   ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]),
 229                         AML_OFFSET (ExtendedIrq.Interrupts[0]),
 230                         0},
 231 
 232     /* Optional ResourceSource (Index and String) */
 233 
 234     {ACPI_RSC_SOURCEX,  ACPI_RS_OFFSET (Data.ExtendedIrq.ResourceSource),
 235                         ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]),
 236                         sizeof (AML_RESOURCE_EXTENDED_IRQ)}
 237 };
 238 
 239 


 257 
 258     {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Dma.Transfer),
 259                         AML_OFFSET (Dma.Flags),
 260                         0},
 261 
 262     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Dma.BusMaster),
 263                         AML_OFFSET (Dma.Flags),
 264                         2},
 265 
 266     {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Dma.Type),
 267                         AML_OFFSET (Dma.Flags),
 268                         5},
 269 
 270     /* DMA channel mask bits */
 271 
 272     {ACPI_RSC_BITMASK,  ACPI_RS_OFFSET (Data.Dma.Channels[0]),
 273                         AML_OFFSET (Dma.DmaChannelMask),
 274                         ACPI_RS_OFFSET (Data.Dma.ChannelCount)}
 275 };
 276 






























   1 /*******************************************************************************
   2  *
   3  * Module Name: rsirq - IRQ resource descriptors
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2013, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


  40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41  * POSSIBILITY OF SUCH DAMAGES.
  42  */
  43 
  44 #define __RSIRQ_C__
  45 
  46 #include "acpi.h"
  47 #include "accommon.h"
  48 #include "acresrc.h"
  49 
  50 #define _COMPONENT          ACPI_RESOURCES
  51         ACPI_MODULE_NAME    ("rsirq")
  52 
  53 
  54 /*******************************************************************************
  55  *
  56  * AcpiRsGetIrq
  57  *
  58  ******************************************************************************/
  59 
  60 ACPI_RSCONVERT_INFO     AcpiRsGetIrq[9] =
  61 {
  62     {ACPI_RSC_INITGET,  ACPI_RESOURCE_TYPE_IRQ,
  63                         ACPI_RS_SIZE (ACPI_RESOURCE_IRQ),
  64                         ACPI_RSC_TABLE_SIZE (AcpiRsGetIrq)},
  65 
  66     /* Get the IRQ mask (bytes 1:2) */
  67 
  68     {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]),
  69                         AML_OFFSET (Irq.IrqMask),
  70                         ACPI_RS_OFFSET (Data.Irq.InterruptCount)},
  71 
  72     /* Set default flags (others are zero) */
  73 
  74     {ACPI_RSC_SET8,     ACPI_RS_OFFSET (Data.Irq.Triggering),
  75                         ACPI_EDGE_SENSITIVE,
  76                         1},
  77 
  78     /* Get the descriptor length (2 or 3 for IRQ descriptor) */
  79 
  80     {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Irq.DescriptorLength),
  81                         AML_OFFSET (Irq.DescriptorType),
  82                         0},
  83 
  84     /* All done if no flag byte present in descriptor */
  85 
  86     {ACPI_RSC_EXIT_NE,  ACPI_RSC_COMPARE_AML_LENGTH, 0, 3},
  87 
  88     /* Get flags: Triggering[0], Polarity[3], Sharing[4], Wake[5] */
  89 
  90     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering),
  91                         AML_OFFSET (Irq.Flags),
  92                         0},
  93 
  94     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Polarity),
  95                         AML_OFFSET (Irq.Flags),
  96                         3},
  97 
  98     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Sharable),
  99                         AML_OFFSET (Irq.Flags),
 100                         4},
 101 
 102     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.WakeCapable),
 103                         AML_OFFSET (Irq.Flags),
 104                         5}
 105 };
 106 
 107 
 108 /*******************************************************************************
 109  *
 110  * AcpiRsSetIrq
 111  *
 112  ******************************************************************************/
 113 
 114 ACPI_RSCONVERT_INFO     AcpiRsSetIrq[14] =
 115 {
 116     /* Start with a default descriptor of length 3 */
 117 
 118     {ACPI_RSC_INITSET,  ACPI_RESOURCE_NAME_IRQ,
 119                         sizeof (AML_RESOURCE_IRQ),
 120                         ACPI_RSC_TABLE_SIZE (AcpiRsSetIrq)},
 121 
 122     /* Convert interrupt list to 16-bit IRQ bitmask */
 123 
 124     {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]),
 125                         AML_OFFSET (Irq.IrqMask),
 126                         ACPI_RS_OFFSET (Data.Irq.InterruptCount)},
 127 
 128     /* Set flags: Triggering[0], Polarity[3], Sharing[4], Wake[5] */
 129 
 130     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering),
 131                         AML_OFFSET (Irq.Flags),
 132                         0},
 133 
 134     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Polarity),
 135                         AML_OFFSET (Irq.Flags),
 136                         3},
 137 
 138     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Sharable),
 139                         AML_OFFSET (Irq.Flags),
 140                         4},
 141 
 142     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.WakeCapable),
 143                         AML_OFFSET (Irq.Flags),
 144                         5},
 145 
 146     /*
 147      * All done if the output descriptor length is required to be 3
 148      * (i.e., optimization to 2 bytes cannot be attempted)
 149      */
 150     {ACPI_RSC_EXIT_EQ,  ACPI_RSC_COMPARE_VALUE,
 151                         ACPI_RS_OFFSET(Data.Irq.DescriptorLength),
 152                         3},
 153 
 154     /* Set length to 2 bytes (no flags byte) */
 155 
 156     {ACPI_RSC_LENGTH,   0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)},
 157 
 158     /*
 159      * All done if the output descriptor length is required to be 2.
 160      *
 161      * TBD: Perhaps we should check for error if input flags are not
 162      * compatible with a 2-byte descriptor.
 163      */
 164     {ACPI_RSC_EXIT_EQ,  ACPI_RSC_COMPARE_VALUE,
 165                         ACPI_RS_OFFSET(Data.Irq.DescriptorLength),


 180     {ACPI_RSC_EXIT_NE,  ACPI_RSC_COMPARE_VALUE,
 181                         ACPI_RS_OFFSET (Data.Irq.Polarity),
 182                         ACPI_ACTIVE_HIGH},
 183 
 184     {ACPI_RSC_EXIT_NE,  ACPI_RSC_COMPARE_VALUE,
 185                         ACPI_RS_OFFSET (Data.Irq.Sharable),
 186                         ACPI_EXCLUSIVE},
 187 
 188     /* We can optimize to a 2-byte IrqNoFlags() descriptor */
 189 
 190     {ACPI_RSC_LENGTH,   0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)}
 191 };
 192 
 193 
 194 /*******************************************************************************
 195  *
 196  * AcpiRsConvertExtIrq
 197  *
 198  ******************************************************************************/
 199 
 200 ACPI_RSCONVERT_INFO     AcpiRsConvertExtIrq[10] =
 201 {
 202     {ACPI_RSC_INITGET,  ACPI_RESOURCE_TYPE_EXTENDED_IRQ,
 203                         ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ),
 204                         ACPI_RSC_TABLE_SIZE (AcpiRsConvertExtIrq)},
 205 
 206     {ACPI_RSC_INITSET,  ACPI_RESOURCE_NAME_EXTENDED_IRQ,
 207                         sizeof (AML_RESOURCE_EXTENDED_IRQ),
 208                         0},
 209 
 210     /*
 211      * Flags: Producer/Consumer[0], Triggering[1], Polarity[2],
 212      *        Sharing[3], Wake[4]
 213      */
 214     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.ProducerConsumer),
 215                         AML_OFFSET (ExtendedIrq.Flags),
 216                         0},
 217 
 218     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Triggering),
 219                         AML_OFFSET (ExtendedIrq.Flags),
 220                         1},
 221 
 222     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Polarity),
 223                         AML_OFFSET (ExtendedIrq.Flags),
 224                         2},
 225 
 226     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Sharable),
 227                         AML_OFFSET (ExtendedIrq.Flags),
 228                         3},
 229 
 230     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.WakeCapable),
 231                         AML_OFFSET (ExtendedIrq.Flags),
 232                         4},
 233 
 234     /* IRQ Table length (Byte4) */
 235 
 236     {ACPI_RSC_COUNT,    ACPI_RS_OFFSET (Data.ExtendedIrq.InterruptCount),
 237                         AML_OFFSET (ExtendedIrq.InterruptCount),
 238                         sizeof (UINT32)},
 239 
 240     /* Copy every IRQ in the table, each is 32 bits */
 241 
 242     {ACPI_RSC_MOVE32,   ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]),
 243                         AML_OFFSET (ExtendedIrq.Interrupts[0]),
 244                         0},
 245 
 246     /* Optional ResourceSource (Index and String) */
 247 
 248     {ACPI_RSC_SOURCEX,  ACPI_RS_OFFSET (Data.ExtendedIrq.ResourceSource),
 249                         ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]),
 250                         sizeof (AML_RESOURCE_EXTENDED_IRQ)}
 251 };
 252 
 253 


 271 
 272     {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Dma.Transfer),
 273                         AML_OFFSET (Dma.Flags),
 274                         0},
 275 
 276     {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Dma.BusMaster),
 277                         AML_OFFSET (Dma.Flags),
 278                         2},
 279 
 280     {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Dma.Type),
 281                         AML_OFFSET (Dma.Flags),
 282                         5},
 283 
 284     /* DMA channel mask bits */
 285 
 286     {ACPI_RSC_BITMASK,  ACPI_RS_OFFSET (Data.Dma.Channels[0]),
 287                         AML_OFFSET (Dma.DmaChannelMask),
 288                         ACPI_RS_OFFSET (Data.Dma.ChannelCount)}
 289 };
 290 
 291 
 292 /*******************************************************************************
 293  *
 294  * AcpiRsConvertFixedDma
 295  *
 296  ******************************************************************************/
 297 
 298 ACPI_RSCONVERT_INFO     AcpiRsConvertFixedDma[4] =
 299 {
 300     {ACPI_RSC_INITGET,  ACPI_RESOURCE_TYPE_FIXED_DMA,
 301                         ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_DMA),
 302                         ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedDma)},
 303 
 304     {ACPI_RSC_INITSET,  ACPI_RESOURCE_NAME_FIXED_DMA,
 305                         sizeof (AML_RESOURCE_FIXED_DMA),
 306                         0},
 307 
 308     /*
 309      * These fields are contiguous in both the source and destination:
 310      * RequestLines
 311      * Channels
 312      */
 313     {ACPI_RSC_MOVE16,   ACPI_RS_OFFSET (Data.FixedDma.RequestLines),
 314                         AML_OFFSET (FixedDma.RequestLines),
 315                         2},
 316 
 317     {ACPI_RSC_MOVE8,    ACPI_RS_OFFSET (Data.FixedDma.Width),
 318                         AML_OFFSET (FixedDma.Width),
 319                         1},
 320 };