isci: fix ssp response iu buffer size in isci_tmf
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / acpi / acrestyp.h
blob0a66cc45dd6b79a0fdb17be3368b87cdd1c646f5
1 /******************************************************************************
3 * Name: acrestyp.h - Defines, types, and structures for resource descriptors
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved.
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.
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.
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.
44 #ifndef __ACRESTYP_H__
45 #define __ACRESTYP_H__
48 * Definitions for Resource Attributes
50 typedef u16 acpi_rs_length; /* Resource Length field is fixed at 16 bits */
51 typedef u32 acpi_rsdesc_size; /* Max Resource Descriptor size is (Length+3) = (64_k-1)+3 */
54 * Memory Attributes
56 #define ACPI_READ_ONLY_MEMORY (u8) 0x00
57 #define ACPI_READ_WRITE_MEMORY (u8) 0x01
59 #define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00
60 #define ACPI_CACHABLE_MEMORY (u8) 0x01
61 #define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02
62 #define ACPI_PREFETCHABLE_MEMORY (u8) 0x03
65 * IO Attributes
66 * The ISA IO ranges are: n000-n0_fFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
67 * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cd0-n_fFFh.
69 #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01
70 #define ACPI_ISA_ONLY_RANGES (u8) 0x02
71 #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
73 /* Type of translation - 1=Sparse, 0=Dense */
75 #define ACPI_SPARSE_TRANSLATION (u8) 0x01
78 * IO Port Descriptor Decode
80 #define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
81 #define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
84 * IRQ Attributes
86 #define ACPI_LEVEL_SENSITIVE (u8) 0x00
87 #define ACPI_EDGE_SENSITIVE (u8) 0x01
89 #define ACPI_ACTIVE_HIGH (u8) 0x00
90 #define ACPI_ACTIVE_LOW (u8) 0x01
92 #define ACPI_EXCLUSIVE (u8) 0x00
93 #define ACPI_SHARED (u8) 0x01
96 * DMA Attributes
98 #define ACPI_COMPATIBILITY (u8) 0x00
99 #define ACPI_TYPE_A (u8) 0x01
100 #define ACPI_TYPE_B (u8) 0x02
101 #define ACPI_TYPE_F (u8) 0x03
103 #define ACPI_NOT_BUS_MASTER (u8) 0x00
104 #define ACPI_BUS_MASTER (u8) 0x01
106 #define ACPI_TRANSFER_8 (u8) 0x00
107 #define ACPI_TRANSFER_8_16 (u8) 0x01
108 #define ACPI_TRANSFER_16 (u8) 0x02
111 * Start Dependent Functions Priority definitions
113 #define ACPI_GOOD_CONFIGURATION (u8) 0x00
114 #define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01
115 #define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02
118 * 16, 32 and 64-bit Address Descriptor resource types
120 #define ACPI_MEMORY_RANGE (u8) 0x00
121 #define ACPI_IO_RANGE (u8) 0x01
122 #define ACPI_BUS_NUMBER_RANGE (u8) 0x02
124 #define ACPI_ADDRESS_NOT_FIXED (u8) 0x00
125 #define ACPI_ADDRESS_FIXED (u8) 0x01
127 #define ACPI_POS_DECODE (u8) 0x00
128 #define ACPI_SUB_DECODE (u8) 0x01
130 #define ACPI_PRODUCER (u8) 0x00
131 #define ACPI_CONSUMER (u8) 0x01
134 * If possible, pack the following structures to byte alignment
136 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
137 #pragma pack(1)
138 #endif
140 /* UUID data structures for use in vendor-defined resource descriptors */
142 struct acpi_uuid {
143 u8 data[ACPI_UUID_LENGTH];
146 struct acpi_vendor_uuid {
147 u8 subtype;
148 u8 data[ACPI_UUID_LENGTH];
152 * Structures used to describe device resources
154 struct acpi_resource_irq {
155 u8 descriptor_length;
156 u8 triggering;
157 u8 polarity;
158 u8 sharable;
159 u8 interrupt_count;
160 u8 interrupts[1];
163 struct acpi_resource_dma {
164 u8 type;
165 u8 bus_master;
166 u8 transfer;
167 u8 channel_count;
168 u8 channels[1];
171 struct acpi_resource_start_dependent {
172 u8 descriptor_length;
173 u8 compatibility_priority;
174 u8 performance_robustness;
178 * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
179 * needed because it has no fields
182 struct acpi_resource_io {
183 u8 io_decode;
184 u8 alignment;
185 u8 address_length;
186 u16 minimum;
187 u16 maximum;
190 struct acpi_resource_fixed_io {
191 u16 address;
192 u8 address_length;
195 struct acpi_resource_vendor {
196 u16 byte_length;
197 u8 byte_data[1];
200 /* Vendor resource with UUID info (introduced in ACPI 3.0) */
202 struct acpi_resource_vendor_typed {
203 u16 byte_length;
204 u8 uuid_subtype;
205 u8 uuid[ACPI_UUID_LENGTH];
206 u8 byte_data[1];
209 struct acpi_resource_end_tag {
210 u8 checksum;
213 struct acpi_resource_memory24 {
214 u8 write_protect;
215 u16 minimum;
216 u16 maximum;
217 u16 alignment;
218 u16 address_length;
221 struct acpi_resource_memory32 {
222 u8 write_protect;
223 u32 minimum;
224 u32 maximum;
225 u32 alignment;
226 u32 address_length;
229 struct acpi_resource_fixed_memory32 {
230 u8 write_protect;
231 u32 address;
232 u32 address_length;
235 struct acpi_memory_attribute {
236 u8 write_protect;
237 u8 caching;
238 u8 range_type;
239 u8 translation;
242 struct acpi_io_attribute {
243 u8 range_type;
244 u8 translation;
245 u8 translation_type;
246 u8 reserved1;
249 union acpi_resource_attribute {
250 struct acpi_memory_attribute mem;
251 struct acpi_io_attribute io;
253 /* Used for the *word_space macros */
255 u8 type_specific;
258 struct acpi_resource_source {
259 u8 index;
260 u16 string_length;
261 char *string_ptr;
264 /* Fields common to all address descriptors, 16/32/64 bit */
266 #define ACPI_RESOURCE_ADDRESS_COMMON \
267 u8 resource_type; \
268 u8 producer_consumer; \
269 u8 decode; \
270 u8 min_address_fixed; \
271 u8 max_address_fixed; \
272 union acpi_resource_attribute info;
274 struct acpi_resource_address {
275 ACPI_RESOURCE_ADDRESS_COMMON};
277 struct acpi_resource_address16 {
278 ACPI_RESOURCE_ADDRESS_COMMON u16 granularity;
279 u16 minimum;
280 u16 maximum;
281 u16 translation_offset;
282 u16 address_length;
283 struct acpi_resource_source resource_source;
286 struct acpi_resource_address32 {
287 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity;
288 u32 minimum;
289 u32 maximum;
290 u32 translation_offset;
291 u32 address_length;
292 struct acpi_resource_source resource_source;
295 struct acpi_resource_address64 {
296 ACPI_RESOURCE_ADDRESS_COMMON u64 granularity;
297 u64 minimum;
298 u64 maximum;
299 u64 translation_offset;
300 u64 address_length;
301 struct acpi_resource_source resource_source;
304 struct acpi_resource_extended_address64 {
305 ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD;
306 u64 granularity;
307 u64 minimum;
308 u64 maximum;
309 u64 translation_offset;
310 u64 address_length;
311 u64 type_specific;
314 struct acpi_resource_extended_irq {
315 u8 producer_consumer;
316 u8 triggering;
317 u8 polarity;
318 u8 sharable;
319 u8 interrupt_count;
320 struct acpi_resource_source resource_source;
321 u32 interrupts[1];
324 struct acpi_resource_generic_register {
325 u8 space_id;
326 u8 bit_width;
327 u8 bit_offset;
328 u8 access_size;
329 u64 address;
332 /* ACPI_RESOURCE_TYPEs */
334 #define ACPI_RESOURCE_TYPE_IRQ 0
335 #define ACPI_RESOURCE_TYPE_DMA 1
336 #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
337 #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
338 #define ACPI_RESOURCE_TYPE_IO 4
339 #define ACPI_RESOURCE_TYPE_FIXED_IO 5
340 #define ACPI_RESOURCE_TYPE_VENDOR 6
341 #define ACPI_RESOURCE_TYPE_END_TAG 7
342 #define ACPI_RESOURCE_TYPE_MEMORY24 8
343 #define ACPI_RESOURCE_TYPE_MEMORY32 9
344 #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
345 #define ACPI_RESOURCE_TYPE_ADDRESS16 11
346 #define ACPI_RESOURCE_TYPE_ADDRESS32 12
347 #define ACPI_RESOURCE_TYPE_ADDRESS64 13
348 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
349 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
350 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
351 #define ACPI_RESOURCE_TYPE_MAX 16
353 /* Master union for resource descriptors */
355 union acpi_resource_data {
356 struct acpi_resource_irq irq;
357 struct acpi_resource_dma dma;
358 struct acpi_resource_start_dependent start_dpf;
359 struct acpi_resource_io io;
360 struct acpi_resource_fixed_io fixed_io;
361 struct acpi_resource_vendor vendor;
362 struct acpi_resource_vendor_typed vendor_typed;
363 struct acpi_resource_end_tag end_tag;
364 struct acpi_resource_memory24 memory24;
365 struct acpi_resource_memory32 memory32;
366 struct acpi_resource_fixed_memory32 fixed_memory32;
367 struct acpi_resource_address16 address16;
368 struct acpi_resource_address32 address32;
369 struct acpi_resource_address64 address64;
370 struct acpi_resource_extended_address64 ext_address64;
371 struct acpi_resource_extended_irq extended_irq;
372 struct acpi_resource_generic_register generic_reg;
374 /* Common fields */
376 struct acpi_resource_address address; /* Common 16/32/64 address fields */
379 /* Common resource header */
381 struct acpi_resource {
382 u32 type;
383 u32 length;
384 union acpi_resource_data data;
387 /* restore default alignment */
389 #pragma pack()
391 #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
392 #define ACPI_RS_SIZE_MIN (u32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
393 #define ACPI_RS_SIZE(type) (u32) (ACPI_RS_SIZE_NO_DATA + sizeof (type))
395 #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length)
397 struct acpi_pci_routing_table {
398 u32 length;
399 u32 pin;
400 u64 address; /* here for 64-bit alignment */
401 u32 source_index;
402 char source[4]; /* pad to 64 bits so sizeof() works in all cases */
405 #endif /* __ACRESTYP_H__ */