2 /******************************************************************************
4 * Module Name: amlresrc.h - AML resource descriptors
6 *****************************************************************************/
9 * Copyright (C) 2000 - 2006, R. Byron Moore
10 * All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions, and the following disclaimer,
17 * without modification.
18 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
19 * substantially similar to the "NO WARRANTY" disclaimer below
20 * ("Disclaimer") and any redistribution must be conditioned upon
21 * including a substantially similar Disclaimer requirement for further
22 * binary redistribution.
23 * 3. Neither the names of the above-listed copyright holders nor the names
24 * of any contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
27 * Alternatively, this software may be distributed under the terms of the
28 * GNU General Public License ("GPL") version 2 as published by the Free
29 * Software Foundation.
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
40 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
41 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 * POSSIBILITY OF SUCH DAMAGES.
48 #define ACPI_RESTAG_ADDRESS "_ADR"
49 #define ACPI_RESTAG_ALIGNMENT "_ALN"
50 #define ACPI_RESTAG_ADDRESSSPACE "_ASI"
51 #define ACPI_RESTAG_ACCESSSIZE "_ASZ"
52 #define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
53 #define ACPI_RESTAG_BASEADDRESS "_BAS"
54 #define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
55 #define ACPI_RESTAG_DECODE "_DEC"
56 #define ACPI_RESTAG_DMA "_DMA"
57 #define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
58 #define ACPI_RESTAG_GRANULARITY "_GRA"
59 #define ACPI_RESTAG_INTERRUPT "_INT"
60 #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
61 #define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
62 #define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
63 #define ACPI_RESTAG_LENGTH "_LEN"
64 #define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
65 #define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
66 #define ACPI_RESTAG_MAXADDR "_MAX"
67 #define ACPI_RESTAG_MINADDR "_MIN"
68 #define ACPI_RESTAG_MAXTYPE "_MAF"
69 #define ACPI_RESTAG_MINTYPE "_MIF"
70 #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
71 #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
72 #define ACPI_RESTAG_RANGETYPE "_RNG"
73 #define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
74 #define ACPI_RESTAG_TRANSLATION "_TRA"
75 #define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
76 #define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
77 #define ACPI_RESTAG_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */
79 /* Default sizes for "small" resource descriptors */
81 #define ASL_RDESC_IRQ_SIZE 0x02
82 #define ASL_RDESC_DMA_SIZE 0x02
83 #define ASL_RDESC_ST_DEPEND_SIZE 0x00
84 #define ASL_RDESC_END_DEPEND_SIZE 0x00
85 #define ASL_RDESC_IO_SIZE 0x07
86 #define ASL_RDESC_FIXED_IO_SIZE 0x03
87 #define ASL_RDESC_END_TAG_SIZE 0x01
89 struct asl_resource_node
{
92 struct asl_resource_node
*next
;
95 /* Macros used to generate AML resource length fields */
97 #define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header))
98 #define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header))
101 * Resource descriptors defined in the ACPI specification.
103 * Packing/alignment must be BYTE because these descriptors
104 * are used to overlay the raw AML byte stream.
111 #define AML_RESOURCE_SMALL_HEADER_COMMON \
114 struct aml_resource_small_header
{
115 AML_RESOURCE_SMALL_HEADER_COMMON
};
117 struct aml_resource_irq
{
118 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask
;
122 struct aml_resource_irq_noflags
{
123 AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask
;
126 struct aml_resource_dma
{
127 AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask
;
131 struct aml_resource_start_dependent
{
132 AML_RESOURCE_SMALL_HEADER_COMMON u8 flags
;
135 struct aml_resource_start_dependent_noprio
{
136 AML_RESOURCE_SMALL_HEADER_COMMON
};
138 struct aml_resource_end_dependent
{
139 AML_RESOURCE_SMALL_HEADER_COMMON
};
141 struct aml_resource_io
{
142 AML_RESOURCE_SMALL_HEADER_COMMON u8 flags
;
149 struct aml_resource_fixed_io
{
150 AML_RESOURCE_SMALL_HEADER_COMMON u16 address
;
154 struct aml_resource_vendor_small
{
155 AML_RESOURCE_SMALL_HEADER_COMMON
};
157 struct aml_resource_end_tag
{
158 AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum
;
164 #define AML_RESOURCE_LARGE_HEADER_COMMON \
168 struct aml_resource_large_header
{
169 AML_RESOURCE_LARGE_HEADER_COMMON
};
171 struct aml_resource_memory24
{
172 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags
;
179 struct aml_resource_vendor_large
{
180 AML_RESOURCE_LARGE_HEADER_COMMON
};
182 struct aml_resource_memory32
{
183 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags
;
190 struct aml_resource_fixed_memory32
{
191 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags
;
196 #define AML_RESOURCE_ADDRESS_COMMON \
201 struct aml_resource_address
{
202 AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON
};
204 struct aml_resource_extended_address64
{
205 AML_RESOURCE_LARGE_HEADER_COMMON
206 AML_RESOURCE_ADDRESS_COMMON u8 revision_iD
;
211 u64 translation_offset
;
216 #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
218 struct aml_resource_address64
{
219 AML_RESOURCE_LARGE_HEADER_COMMON
220 AML_RESOURCE_ADDRESS_COMMON u64 granularity
;
223 u64 translation_offset
;
227 struct aml_resource_address32
{
228 AML_RESOURCE_LARGE_HEADER_COMMON
229 AML_RESOURCE_ADDRESS_COMMON u32 granularity
;
232 u32 translation_offset
;
236 struct aml_resource_address16
{
237 AML_RESOURCE_LARGE_HEADER_COMMON
238 AML_RESOURCE_ADDRESS_COMMON u16 granularity
;
241 u16 translation_offset
;
245 struct aml_resource_extended_irq
{
246 AML_RESOURCE_LARGE_HEADER_COMMON u8 flags
;
249 /* res_source_index, res_source optional fields follow */
252 struct aml_resource_generic_register
{
253 AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id
;
256 u8 access_size
; /* ACPI 3.0, was previously Reserved */
260 /* restore default alignment */
264 /* Union of all resource descriptors, so we can allocate the worst case */
267 /* Descriptor headers */
270 struct aml_resource_small_header small_header
;
271 struct aml_resource_large_header large_header
;
273 /* Small resource descriptors */
275 struct aml_resource_irq irq
;
276 struct aml_resource_dma dma
;
277 struct aml_resource_start_dependent start_dpf
;
278 struct aml_resource_end_dependent end_dpf
;
279 struct aml_resource_io io
;
280 struct aml_resource_fixed_io fixed_io
;
281 struct aml_resource_vendor_small vendor_small
;
282 struct aml_resource_end_tag end_tag
;
284 /* Large resource descriptors */
286 struct aml_resource_memory24 memory24
;
287 struct aml_resource_generic_register generic_reg
;
288 struct aml_resource_vendor_large vendor_large
;
289 struct aml_resource_memory32 memory32
;
290 struct aml_resource_fixed_memory32 fixed_memory32
;
291 struct aml_resource_address16 address16
;
292 struct aml_resource_address32 address32
;
293 struct aml_resource_address64 address64
;
294 struct aml_resource_extended_address64 ext_address64
;
295 struct aml_resource_extended_irq extended_irq
;
297 /* Utility overlays */
299 struct aml_resource_address address
;