blob: 051786e4b210d9cc80d3dd8aa9da0c1d649bb3d5 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001
2/******************************************************************************
3 *
4 * Module Name: amlresrc.h - AML resource descriptors
5 *
6 *****************************************************************************/
7
8/*
9 * Copyright (C) 2000 - 2005, R. Byron Moore
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
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.
26 *
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.
30 *
31 * NO WARRANTY
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.
43 */
44
Linus Torvalds1da177e2005-04-16 15:20:36 -070045#ifndef __AMLRESRC_H
46#define __AMLRESRC_H
47
Linus Torvalds1da177e2005-04-16 15:20:36 -070048#define ASL_RESNAME_ADDRESS "_ADR"
49#define ASL_RESNAME_ALIGNMENT "_ALN"
50#define ASL_RESNAME_ADDRESSSPACE "_ASI"
51#define ASL_RESNAME_ACCESSSIZE "_ASZ"
52#define ASL_RESNAME_TYPESPECIFICATTRIBUTES "_ATT"
53#define ASL_RESNAME_BASEADDRESS "_BAS"
Len Brown4be44fc2005-08-05 00:44:28 -040054#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070055#define ASL_RESNAME_DECODE "_DEC"
56#define ASL_RESNAME_DMA "_DMA"
Len Brown4be44fc2005-08-05 00:44:28 -040057#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070058#define ASL_RESNAME_GRANULARITY "_GRA"
59#define ASL_RESNAME_INTERRUPT "_INT"
Len Brown4be44fc2005-08-05 00:44:28 -040060#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
61#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
62#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070063#define ASL_RESNAME_LENGTH "_LEN"
Len Brown4be44fc2005-08-05 00:44:28 -040064#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
65#define ASL_RESNAME_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070066#define ASL_RESNAME_MAXADDR "_MAX"
67#define ASL_RESNAME_MINADDR "_MIN"
68#define ASL_RESNAME_MAXTYPE "_MAF"
69#define ASL_RESNAME_MINTYPE "_MIF"
70#define ASL_RESNAME_REGISTERBITOFFSET "_RBO"
71#define ASL_RESNAME_REGISTERBITWIDTH "_RBW"
72#define ASL_RESNAME_RANGETYPE "_RNG"
Len Brown4be44fc2005-08-05 00:44:28 -040073#define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070074#define ASL_RESNAME_TRANSLATION "_TRA"
Len Brown4be44fc2005-08-05 00:44:28 -040075#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
76#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */
77#define ASL_RESNAME_XFERTYPE "_SIz" /* 8(0), 8_and16(1), 16(2) */
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
79/* Default sizes for "small" resource descriptors */
80
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
88
Len Brown4be44fc2005-08-05 00:44:28 -040089struct asl_resource_node {
90 u32 buffer_length;
91 void *buffer;
92 struct asl_resource_node *next;
Linus Torvalds1da177e2005-04-16 15:20:36 -070093};
94
Linus Torvalds1da177e2005-04-16 15:20:36 -070095/*
96 * Resource descriptors defined in the ACPI specification.
97 *
98 * Packing/alignment must be BYTE because these descriptors
99 * are used to overlay the AML byte stream.
100 */
101#pragma pack(1)
102
Len Brown4be44fc2005-08-05 00:44:28 -0400103struct asl_irq_format_desc {
104 u8 descriptor_type;
105 u16 irq_mask;
106 u8 flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107};
108
Len Brown4be44fc2005-08-05 00:44:28 -0400109struct asl_irq_noflags_desc {
110 u8 descriptor_type;
111 u16 irq_mask;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112};
113
Len Brown4be44fc2005-08-05 00:44:28 -0400114struct asl_dma_format_desc {
115 u8 descriptor_type;
116 u8 dma_channel_mask;
117 u8 flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118};
119
Len Brown4be44fc2005-08-05 00:44:28 -0400120struct asl_start_dependent_desc {
121 u8 descriptor_type;
122 u8 flags;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123};
124
Len Brown4be44fc2005-08-05 00:44:28 -0400125struct asl_start_dependent_noprio_desc {
126 u8 descriptor_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127};
128
Len Brown4be44fc2005-08-05 00:44:28 -0400129struct asl_end_dependent_desc {
130 u8 descriptor_type;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131};
132
Len Brown4be44fc2005-08-05 00:44:28 -0400133struct asl_io_port_desc {
134 u8 descriptor_type;
135 u8 information;
136 u16 address_min;
137 u16 address_max;
138 u8 alignment;
139 u8 length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140};
141
Len Brown4be44fc2005-08-05 00:44:28 -0400142struct asl_fixed_io_port_desc {
143 u8 descriptor_type;
144 u16 base_address;
145 u8 length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146};
147
Len Brown4be44fc2005-08-05 00:44:28 -0400148struct asl_small_vendor_desc {
149 u8 descriptor_type;
150 u8 vendor_defined[7];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151};
152
Len Brown4be44fc2005-08-05 00:44:28 -0400153struct asl_end_tag_desc {
154 u8 descriptor_type;
155 u8 checksum;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156};
157
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158/* LARGE descriptors */
159
Len Brown4be44fc2005-08-05 00:44:28 -0400160struct asl_memory_24_desc {
161 u8 descriptor_type;
162 u16 length;
163 u8 information;
164 u16 address_min;
165 u16 address_max;
166 u16 alignment;
167 u16 range_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168};
169
Len Brown4be44fc2005-08-05 00:44:28 -0400170struct asl_large_vendor_desc {
171 u8 descriptor_type;
172 u16 length;
173 u8 vendor_defined[1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174};
175
Len Brown4be44fc2005-08-05 00:44:28 -0400176struct asl_memory_32_desc {
177 u8 descriptor_type;
178 u16 length;
179 u8 information;
180 u32 address_min;
181 u32 address_max;
182 u32 alignment;
183 u32 range_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184};
185
Len Brown4be44fc2005-08-05 00:44:28 -0400186struct asl_fixed_memory_32_desc {
187 u8 descriptor_type;
188 u16 length;
189 u8 information;
190 u32 base_address;
191 u32 range_length;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192};
193
Len Brown4be44fc2005-08-05 00:44:28 -0400194struct asl_extended_address_desc {
195 u8 descriptor_type;
196 u16 length;
197 u8 resource_type;
198 u8 flags;
199 u8 specific_flags;
200 u8 revision_iD;
201 u8 reserved;
202 u64 granularity;
203 u64 address_min;
204 u64 address_max;
205 u64 translation_offset;
206 u64 address_length;
207 u64 type_specific_attributes;
208 u8 optional_fields[2]; /* Used for length calculation only */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209};
210
Len Brown4be44fc2005-08-05 00:44:28 -0400211#define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212
Len Brown4be44fc2005-08-05 00:44:28 -0400213struct asl_qword_address_desc {
214 u8 descriptor_type;
215 u16 length;
216 u8 resource_type;
217 u8 flags;
218 u8 specific_flags;
219 u64 granularity;
220 u64 address_min;
221 u64 address_max;
222 u64 translation_offset;
223 u64 address_length;
224 u8 optional_fields[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225};
226
Len Brown4be44fc2005-08-05 00:44:28 -0400227struct asl_dword_address_desc {
228 u8 descriptor_type;
229 u16 length;
230 u8 resource_type;
231 u8 flags;
232 u8 specific_flags;
233 u32 granularity;
234 u32 address_min;
235 u32 address_max;
236 u32 translation_offset;
237 u32 address_length;
238 u8 optional_fields[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239};
240
Len Brown4be44fc2005-08-05 00:44:28 -0400241struct asl_word_address_desc {
242 u8 descriptor_type;
243 u16 length;
244 u8 resource_type;
245 u8 flags;
246 u8 specific_flags;
247 u16 granularity;
248 u16 address_min;
249 u16 address_max;
250 u16 translation_offset;
251 u16 address_length;
252 u8 optional_fields[2];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700253};
254
Len Brown4be44fc2005-08-05 00:44:28 -0400255struct asl_extended_xrupt_desc {
256 u8 descriptor_type;
257 u16 length;
258 u8 flags;
259 u8 table_length;
260 u32 interrupt_number[1];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700261 /* res_source_index, res_source optional fields follow */
262};
263
Len Brown4be44fc2005-08-05 00:44:28 -0400264struct asl_general_register_desc {
265 u8 descriptor_type;
266 u16 length;
267 u8 address_space_id;
268 u8 bit_width;
269 u8 bit_offset;
270 u8 access_size; /* ACPI 3.0, was Reserved */
271 u64 address;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272};
273
274/* restore default alignment */
275
276#pragma pack()
277
278/* Union of all resource descriptors, so we can allocate the worst case */
279
Len Brown4be44fc2005-08-05 00:44:28 -0400280union asl_resource_desc {
281 struct asl_irq_format_desc irq;
282 struct asl_dma_format_desc dma;
283 struct asl_start_dependent_desc std;
284 struct asl_end_dependent_desc end;
285 struct asl_io_port_desc iop;
286 struct asl_fixed_io_port_desc fio;
287 struct asl_small_vendor_desc smv;
288 struct asl_end_tag_desc et;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289
Len Brown4be44fc2005-08-05 00:44:28 -0400290 struct asl_memory_24_desc M24;
291 struct asl_large_vendor_desc lgv;
292 struct asl_memory_32_desc M32;
293 struct asl_fixed_memory_32_desc F32;
294 struct asl_qword_address_desc qas;
295 struct asl_dword_address_desc das;
296 struct asl_word_address_desc was;
297 struct asl_extended_address_desc eas;
298 struct asl_extended_xrupt_desc exx;
299 struct asl_general_register_desc grg;
300 u32 u32_item;
301 u16 u16_item;
302 u8 U8item;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303};
304
Linus Torvalds1da177e2005-04-16 15:20:36 -0700305#endif