1 /******************************************************************************
3 * Name: acrestyp.h - Defines, types, and structures for resource descriptors
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2008, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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 */
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
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 */
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
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
140 /* UUID data structures for use in vendor-defined resource descriptors */
143 u8 data
[ACPI_UUID_LENGTH
];
146 struct acpi_vendor_uuid
{
148 u8 data
[ACPI_UUID_LENGTH
];
152 * Structures used to describe device resources
154 struct acpi_resource_irq
{
155 u8 descriptor_length
;
163 struct acpi_resource_dma
{
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
{
190 struct acpi_resource_fixed_io
{
195 struct acpi_resource_vendor
{
200 /* Vendor resource with UUID info (introduced in ACPI 3.0) */
202 struct acpi_resource_vendor_typed
{
205 u8 uuid
[ACPI_UUID_LENGTH
];
209 struct acpi_resource_end_tag
{
213 struct acpi_resource_memory24
{
221 struct acpi_resource_memory32
{
229 struct acpi_resource_fixed_memory32
{
235 struct acpi_memory_attribute
{
242 struct acpi_io_attribute
{
249 union acpi_resource_attribute
{
250 struct acpi_memory_attribute mem
;
251 struct acpi_io_attribute io
;
253 /* Used for the *word_space macros */
258 struct acpi_resource_source
{
264 /* Fields common to all address descriptors, 16/32/64 bit */
266 #define ACPI_RESOURCE_ADDRESS_COMMON \
268 u8 producer_consumer; \
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
;
281 u16 translation_offset
;
283 struct acpi_resource_source resource_source
;
286 struct acpi_resource_address32
{
287 ACPI_RESOURCE_ADDRESS_COMMON u32 granularity
;
290 u32 translation_offset
;
292 struct acpi_resource_source resource_source
;
295 struct acpi_resource_address64
{
296 ACPI_RESOURCE_ADDRESS_COMMON u64 granularity
;
299 u64 translation_offset
;
301 struct acpi_resource_source resource_source
;
304 struct acpi_resource_extended_address64
{
305 ACPI_RESOURCE_ADDRESS_COMMON u8 revision_iD
;
309 u64 translation_offset
;
314 struct acpi_resource_extended_irq
{
315 u8 producer_consumer
;
320 struct acpi_resource_source resource_source
;
324 struct acpi_resource_generic_register
{
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
;
376 struct acpi_resource_address address
; /* Common 16/32/64 address fields */
379 /* Common resource header */
381 struct acpi_resource
{
384 union acpi_resource_data data
;
387 /* restore default alignment */
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
{
400 acpi_integer address
; /* here for 64-bit alignment */
402 char source
[4]; /* pad to 64 bits so sizeof() works in all cases */
405 #endif /* __ACRESTYP_H__ */