[ACPI] ACPICA 20060113
[deliverable/linux.git] / drivers / acpi / resources / rsirq.c
CommitLineData
1da177e4
LT
1/*******************************************************************************
2 *
3 * Module Name: rsirq - IRQ resource descriptors
4 *
5 ******************************************************************************/
6
7/*
4a90c7e8 8 * Copyright (C) 2000 - 2006, R. Byron Moore
1da177e4
LT
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.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
1da177e4
LT
44#include <acpi/acpi.h>
45#include <acpi/acresrc.h>
46
47#define _COMPONENT ACPI_RESOURCES
4be44fcd 48ACPI_MODULE_NAME("rsirq")
1da177e4
LT
49
50/*******************************************************************************
51 *
0897831b 52 * acpi_rs_get_irq
1da177e4
LT
53 *
54 ******************************************************************************/
0897831b
BM
55struct acpi_rsconvert_info acpi_rs_get_irq[7] = {
56 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ,
57 ACPI_RS_SIZE(struct acpi_resource_irq),
58 ACPI_RSC_TABLE_SIZE(acpi_rs_get_irq)},
44f6c012 59
50eca3eb 60 /* Get the IRQ mask (bytes 1:2) */
1da177e4 61
0897831b
BM
62 {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]),
63 AML_OFFSET(irq.irq_mask),
64 ACPI_RS_OFFSET(data.irq.interrupt_count)},
65
66 /* Set default flags (others are zero) */
67
68 {ACPI_RSC_SET8, ACPI_RS_OFFSET(data.irq.triggering),
69 ACPI_EDGE_SENSITIVE,
70 1},
71
72 /* All done if no flag byte present in descriptor */
73
74 {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3},
75
76 /* Get flags: Triggering[0], Polarity[3], Sharing[4] */
77
78 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering),
79 AML_OFFSET(irq.flags),
80 0},
81
82 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity),
83 AML_OFFSET(irq.flags),
84 3},
85
86 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
87 AML_OFFSET(irq.flags),
88 4}
89};
1da177e4 90
1da177e4
LT
91/*******************************************************************************
92 *
0897831b 93 * acpi_rs_set_irq
1da177e4
LT
94 *
95 ******************************************************************************/
96
0897831b
BM
97struct acpi_rsconvert_info acpi_rs_set_irq[9] = {
98 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ,
99 sizeof(struct aml_resource_irq),
100 ACPI_RSC_TABLE_SIZE(acpi_rs_set_irq)},
1da177e4 101
50eca3eb
BM
102 /* Convert interrupt list to 16-bit IRQ bitmask */
103
0897831b
BM
104 {ACPI_RSC_BITMASK16, ACPI_RS_OFFSET(data.irq.interrupts[0]),
105 AML_OFFSET(irq.irq_mask),
106 ACPI_RS_OFFSET(data.irq.interrupt_count)},
107
108 /* Set the flags byte by default */
50eca3eb 109
0897831b
BM
110 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.triggering),
111 AML_OFFSET(irq.flags),
112 0},
50eca3eb 113
0897831b
BM
114 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.polarity),
115 AML_OFFSET(irq.flags),
116 3},
1da177e4 117
0897831b
BM
118 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.irq.sharable),
119 AML_OFFSET(irq.flags),
120 4},
1da177e4 121 /*
0897831b
BM
122 * Check if the flags byte is necessary. Not needed if the flags are:
123 * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE
1da177e4 124 */
0897831b
BM
125 {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
126 ACPI_RS_OFFSET(data.irq.triggering),
127 ACPI_EDGE_SENSITIVE},
44f6c012 128
0897831b
BM
129 {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
130 ACPI_RS_OFFSET(data.irq.polarity),
131 ACPI_ACTIVE_HIGH},
1da177e4 132
0897831b
BM
133 {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
134 ACPI_RS_OFFSET(data.irq.sharable),
135 ACPI_EXCLUSIVE},
1da177e4 136
0897831b 137 /* irq_no_flags() descriptor can be used */
44f6c012 138
0897831b
BM
139 {ACPI_RSC_LENGTH, 0, 0, sizeof(struct aml_resource_irq_noflags)}
140};
1da177e4 141
1da177e4
LT
142/*******************************************************************************
143 *
0897831b 144 * acpi_rs_convert_ext_irq
1da177e4
LT
145 *
146 ******************************************************************************/
147
0897831b
BM
148struct acpi_rsconvert_info acpi_rs_convert_ext_irq[9] = {
149 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ,
150 ACPI_RS_SIZE(struct acpi_resource_extended_irq),
151 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_ext_irq)},
1da177e4 152
0897831b
BM
153 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_IRQ,
154 sizeof(struct aml_resource_extended_irq),
155 0},
1da177e4 156
0897831b 157 /* Flag bits */
44f6c012 158
0897831b
BM
159 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.producer_consumer),
160 AML_OFFSET(extended_irq.flags),
161 0},
1da177e4 162
0897831b
BM
163 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.triggering),
164 AML_OFFSET(extended_irq.flags),
165 1},
50eca3eb 166
0897831b
BM
167 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.polarity),
168 AML_OFFSET(extended_irq.flags),
169 2},
1da177e4 170
0897831b
BM
171 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.extended_irq.sharable),
172 AML_OFFSET(extended_irq.flags),
173 3},
1da177e4 174
0897831b 175 /* IRQ Table length (Byte4) */
44f6c012 176
0897831b
BM
177 {ACPI_RSC_COUNT, ACPI_RS_OFFSET(data.extended_irq.interrupt_count),
178 AML_OFFSET(extended_irq.interrupt_count),
179 sizeof(u32)}
180 ,
1da177e4 181
0897831b 182 /* Copy every IRQ in the table, each is 32 bits */
44f6c012 183
0897831b
BM
184 {ACPI_RSC_MOVE32, ACPI_RS_OFFSET(data.extended_irq.interrupts[0]),
185 AML_OFFSET(extended_irq.interrupts[0]),
186 0}
187 ,
1da177e4 188
0897831b 189 /* Optional resource_source (Index and String) */
1da177e4 190
0897831b
BM
191 {ACPI_RSC_SOURCEX, ACPI_RS_OFFSET(data.extended_irq.resource_source),
192 ACPI_RS_OFFSET(data.extended_irq.interrupts[0]),
193 sizeof(struct aml_resource_extended_irq)}
194};
1da177e4 195
1da177e4
LT
196/*******************************************************************************
197 *
0897831b 198 * acpi_rs_convert_dma
1da177e4
LT
199 *
200 ******************************************************************************/
201
0897831b
BM
202struct acpi_rsconvert_info acpi_rs_convert_dma[6] = {
203 {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_DMA,
204 ACPI_RS_SIZE(struct acpi_resource_dma),
205 ACPI_RSC_TABLE_SIZE(acpi_rs_convert_dma)},
1da177e4 206
0897831b
BM
207 {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_DMA,
208 sizeof(struct aml_resource_dma),
209 0},
44f6c012 210
0897831b 211 /* Flags: transfer preference, bus mastering, channel speed */
1da177e4 212
0897831b
BM
213 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.transfer),
214 AML_OFFSET(dma.flags),
215 0},
44f6c012 216
0897831b
BM
217 {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET(data.dma.bus_master),
218 AML_OFFSET(dma.flags),
219 2},
1da177e4 220
0897831b
BM
221 {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET(data.dma.type),
222 AML_OFFSET(dma.flags),
223 5},
44f6c012 224
0897831b 225 /* DMA channel mask bits */
1da177e4 226
0897831b
BM
227 {ACPI_RSC_BITMASK, ACPI_RS_OFFSET(data.dma.channels[0]),
228 AML_OFFSET(dma.dma_channel_mask),
229 ACPI_RS_OFFSET(data.dma.channel_count)}
230};
This page took 0.06702 seconds and 5 git commands to generate.