1 /******************************************************************************
3 * Name: acrestyp.h - Defines, types, and structures for resource descriptors
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2011, 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__
49 * Definitions for Resource Attributes
51 typedef UINT16 ACPI_RS_LENGTH; /* Resource Length field is fixed at 16 bits */
52 typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
57 #define ACPI_READ_ONLY_MEMORY (UINT8) 0x00
58 #define ACPI_READ_WRITE_MEMORY (UINT8) 0x01
60 #define ACPI_NON_CACHEABLE_MEMORY (UINT8) 0x00
61 #define ACPI_CACHABLE_MEMORY (UINT8) 0x01
62 #define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02
63 #define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03
67 * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh.
68 * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
70 #define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01
71 #define ACPI_ISA_ONLY_RANGES (UINT8) 0x02
72 #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
74 /* Type of translation - 1=Sparse, 0=Dense */
76 #define ACPI_SPARSE_TRANSLATION (UINT8) 0x01
79 * IO Port Descriptor Decode
81 #define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */
82 #define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */
87 #define ACPI_LEVEL_SENSITIVE (UINT8) 0x00
88 #define ACPI_EDGE_SENSITIVE (UINT8) 0x01
90 #define ACPI_ACTIVE_HIGH (UINT8) 0x00
91 #define ACPI_ACTIVE_LOW (UINT8) 0x01
93 #define ACPI_EXCLUSIVE (UINT8) 0x00
94 #define ACPI_SHARED (UINT8) 0x01
99 #define ACPI_COMPATIBILITY (UINT8) 0x00
100 #define ACPI_TYPE_A (UINT8) 0x01
101 #define ACPI_TYPE_B (UINT8) 0x02
102 #define ACPI_TYPE_F (UINT8) 0x03
104 #define ACPI_NOT_BUS_MASTER (UINT8) 0x00
105 #define ACPI_BUS_MASTER (UINT8) 0x01
107 #define ACPI_TRANSFER_8 (UINT8) 0x00
108 #define ACPI_TRANSFER_8_16 (UINT8) 0x01
109 #define ACPI_TRANSFER_16 (UINT8) 0x02
112 * Start Dependent Functions Priority definitions
114 #define ACPI_GOOD_CONFIGURATION (UINT8) 0x00
115 #define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01
116 #define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02
119 * 16, 32 and 64-bit Address Descriptor resource types
121 #define ACPI_MEMORY_RANGE (UINT8) 0x00
122 #define ACPI_IO_RANGE (UINT8) 0x01
123 #define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02
125 #define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00
126 #define ACPI_ADDRESS_FIXED (UINT8) 0x01
128 #define ACPI_POS_DECODE (UINT8) 0x00
129 #define ACPI_SUB_DECODE (UINT8) 0x01
131 #define ACPI_PRODUCER (UINT8) 0x00
132 #define ACPI_CONSUMER (UINT8) 0x01
136 * If possible, pack the following structures to byte alignment
138 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
142 /* UUID data structures for use in vendor-defined resource descriptors */
144 typedef struct acpi_uuid
146 UINT8 Data[ACPI_UUID_LENGTH];
149 typedef struct acpi_vendor_uuid
152 UINT8 Data[ACPI_UUID_LENGTH];
157 * Structures used to describe device resources
159 typedef struct acpi_resource_irq
161 UINT8 DescriptorLength;
165 UINT8 InterruptCount;
170 typedef struct ACPI_RESOURCE_DMA
180 typedef struct acpi_resource_start_dependent
182 UINT8 DescriptorLength;
183 UINT8 CompatibilityPriority;
184 UINT8 PerformanceRobustness;
186 } ACPI_RESOURCE_START_DEPENDENT;
190 * The END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
191 * needed because it has no fields
195 typedef struct acpi_resource_io
205 typedef struct acpi_resource_fixed_io
210 } ACPI_RESOURCE_FIXED_IO;
212 typedef struct acpi_resource_vendor
217 } ACPI_RESOURCE_VENDOR;
219 /* Vendor resource with UUID info (introduced in ACPI 3.0) */
221 typedef struct acpi_resource_vendor_typed
225 UINT8 Uuid[ACPI_UUID_LENGTH];
228 } ACPI_RESOURCE_VENDOR_TYPED;
230 typedef struct acpi_resource_end_tag
234 } ACPI_RESOURCE_END_TAG;
236 typedef struct acpi_resource_memory24
242 UINT16 AddressLength;
244 } ACPI_RESOURCE_MEMORY24;
246 typedef struct acpi_resource_memory32
252 UINT32 AddressLength;
254 } ACPI_RESOURCE_MEMORY32;
256 typedef struct acpi_resource_fixed_memory32
260 UINT32 AddressLength;
262 } ACPI_RESOURCE_FIXED_MEMORY32;
264 typedef struct acpi_memory_attribute
271 } ACPI_MEMORY_ATTRIBUTE;
273 typedef struct acpi_io_attribute
277 UINT8 TranslationType;
282 typedef union acpi_resource_attribute
284 ACPI_MEMORY_ATTRIBUTE Mem;
285 ACPI_IO_ATTRIBUTE Io;
287 /* Used for the *WordSpace macros */
291 } ACPI_RESOURCE_ATTRIBUTE;
293 typedef struct acpi_resource_source
299 } ACPI_RESOURCE_SOURCE;
301 /* Fields common to all address descriptors, 16/32/64 bit */
303 #define ACPI_RESOURCE_ADDRESS_COMMON \
304 UINT8 ResourceType; \
305 UINT8 ProducerConsumer; \
307 UINT8 MinAddressFixed; \
308 UINT8 MaxAddressFixed; \
309 ACPI_RESOURCE_ATTRIBUTE Info;
311 typedef struct acpi_resource_address
313 ACPI_RESOURCE_ADDRESS_COMMON
315 } ACPI_RESOURCE_ADDRESS;
317 typedef struct acpi_resource_address16
319 ACPI_RESOURCE_ADDRESS_COMMON
323 UINT16 TranslationOffset;
324 UINT16 AddressLength;
325 ACPI_RESOURCE_SOURCE ResourceSource;
327 } ACPI_RESOURCE_ADDRESS16;
329 typedef struct acpi_resource_address32
331 ACPI_RESOURCE_ADDRESS_COMMON
335 UINT32 TranslationOffset;
336 UINT32 AddressLength;
337 ACPI_RESOURCE_SOURCE ResourceSource;
339 } ACPI_RESOURCE_ADDRESS32;
341 typedef struct acpi_resource_address64
343 ACPI_RESOURCE_ADDRESS_COMMON
347 UINT64 TranslationOffset;
348 UINT64 AddressLength;
349 ACPI_RESOURCE_SOURCE ResourceSource;
351 } ACPI_RESOURCE_ADDRESS64;
353 typedef struct acpi_resource_extended_address64
355 ACPI_RESOURCE_ADDRESS_COMMON
360 UINT64 TranslationOffset;
361 UINT64 AddressLength;
364 } ACPI_RESOURCE_EXTENDED_ADDRESS64;
366 typedef struct acpi_resource_extended_irq
368 UINT8 ProducerConsumer;
372 UINT8 InterruptCount;
373 ACPI_RESOURCE_SOURCE ResourceSource;
374 UINT32 Interrupts[1];
376 } ACPI_RESOURCE_EXTENDED_IRQ;
378 typedef struct acpi_resource_generic_register
386 } ACPI_RESOURCE_GENERIC_REGISTER;
389 /* ACPI_RESOURCE_TYPEs */
391 #define ACPI_RESOURCE_TYPE_IRQ 0
392 #define ACPI_RESOURCE_TYPE_DMA 1
393 #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
394 #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
395 #define ACPI_RESOURCE_TYPE_IO 4
396 #define ACPI_RESOURCE_TYPE_FIXED_IO 5
397 #define ACPI_RESOURCE_TYPE_VENDOR 6
398 #define ACPI_RESOURCE_TYPE_END_TAG 7
399 #define ACPI_RESOURCE_TYPE_MEMORY24 8
400 #define ACPI_RESOURCE_TYPE_MEMORY32 9
401 #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
402 #define ACPI_RESOURCE_TYPE_ADDRESS16 11
403 #define ACPI_RESOURCE_TYPE_ADDRESS32 12
404 #define ACPI_RESOURCE_TYPE_ADDRESS64 13
405 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
406 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
407 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
408 #define ACPI_RESOURCE_TYPE_MAX 16
410 /* Master union for resource descriptors */
412 typedef union acpi_resource_data
414 ACPI_RESOURCE_IRQ Irq;
415 ACPI_RESOURCE_DMA Dma;
416 ACPI_RESOURCE_START_DEPENDENT StartDpf;
418 ACPI_RESOURCE_FIXED_IO FixedIo;
419 ACPI_RESOURCE_VENDOR Vendor;
420 ACPI_RESOURCE_VENDOR_TYPED VendorTyped;
421 ACPI_RESOURCE_END_TAG EndTag;
422 ACPI_RESOURCE_MEMORY24 Memory24;
423 ACPI_RESOURCE_MEMORY32 Memory32;
424 ACPI_RESOURCE_FIXED_MEMORY32 FixedMemory32;
425 ACPI_RESOURCE_ADDRESS16 Address16;
426 ACPI_RESOURCE_ADDRESS32 Address32;
427 ACPI_RESOURCE_ADDRESS64 Address64;
428 ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;
429 ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq;
430 ACPI_RESOURCE_GENERIC_REGISTER GenericReg;
434 ACPI_RESOURCE_ADDRESS Address; /* Common 16/32/64 address fields */
436 } ACPI_RESOURCE_DATA;
439 /* Common resource header */
441 typedef struct acpi_resource
445 ACPI_RESOURCE_DATA Data;
449 /* restore default alignment */
454 #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
455 #define ACPI_RS_SIZE_MIN (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (12)
456 #define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
458 #define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
461 typedef struct acpi_pci_routing_table
465 UINT64 Address; /* here for 64-bit alignment */
467 char Source[4]; /* pad to 64 bits so sizeof() works in all cases */
469 } ACPI_PCI_ROUTING_TABLE;
471 #endif /* __ACRESTYP_H__ */