]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | |
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 | ||
1da177e4 LT |
45 | #ifndef __AMLRESRC_H |
46 | #define __AMLRESRC_H | |
47 | ||
1da177e4 LT |
48 | #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" | |
4be44fcd | 54 | #define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ |
1da177e4 LT |
55 | #define ASL_RESNAME_DECODE "_DEC" |
56 | #define ASL_RESNAME_DMA "_DMA" | |
4be44fcd | 57 | #define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ |
1da177e4 LT |
58 | #define ASL_RESNAME_GRANULARITY "_GRA" |
59 | #define ASL_RESNAME_INTERRUPT "_INT" | |
4be44fcd LB |
60 | #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) */ | |
1da177e4 | 63 | #define ASL_RESNAME_LENGTH "_LEN" |
4be44fcd LB |
64 | #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) */ | |
1da177e4 LT |
66 | #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" | |
4be44fcd | 73 | #define ASL_RESNAME_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */ |
1da177e4 | 74 | #define ASL_RESNAME_TRANSLATION "_TRA" |
4be44fcd LB |
75 | #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) */ | |
1da177e4 LT |
78 | |
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 | ||
4be44fcd LB |
89 | struct asl_resource_node { |
90 | u32 buffer_length; | |
91 | void *buffer; | |
92 | struct asl_resource_node *next; | |
1da177e4 LT |
93 | }; |
94 | ||
1da177e4 LT |
95 | /* |
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 | ||
4be44fcd LB |
103 | struct asl_irq_format_desc { |
104 | u8 descriptor_type; | |
105 | u16 irq_mask; | |
106 | u8 flags; | |
1da177e4 LT |
107 | }; |
108 | ||
4be44fcd LB |
109 | struct asl_irq_noflags_desc { |
110 | u8 descriptor_type; | |
111 | u16 irq_mask; | |
1da177e4 LT |
112 | }; |
113 | ||
4be44fcd LB |
114 | struct asl_dma_format_desc { |
115 | u8 descriptor_type; | |
116 | u8 dma_channel_mask; | |
117 | u8 flags; | |
1da177e4 LT |
118 | }; |
119 | ||
4be44fcd LB |
120 | struct asl_start_dependent_desc { |
121 | u8 descriptor_type; | |
122 | u8 flags; | |
1da177e4 LT |
123 | }; |
124 | ||
4be44fcd LB |
125 | struct asl_start_dependent_noprio_desc { |
126 | u8 descriptor_type; | |
1da177e4 LT |
127 | }; |
128 | ||
4be44fcd LB |
129 | struct asl_end_dependent_desc { |
130 | u8 descriptor_type; | |
1da177e4 LT |
131 | }; |
132 | ||
4be44fcd LB |
133 | struct 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; | |
1da177e4 LT |
140 | }; |
141 | ||
4be44fcd LB |
142 | struct asl_fixed_io_port_desc { |
143 | u8 descriptor_type; | |
144 | u16 base_address; | |
145 | u8 length; | |
1da177e4 LT |
146 | }; |
147 | ||
4be44fcd LB |
148 | struct asl_small_vendor_desc { |
149 | u8 descriptor_type; | |
150 | u8 vendor_defined[7]; | |
1da177e4 LT |
151 | }; |
152 | ||
4be44fcd LB |
153 | struct asl_end_tag_desc { |
154 | u8 descriptor_type; | |
155 | u8 checksum; | |
1da177e4 LT |
156 | }; |
157 | ||
1da177e4 LT |
158 | /* LARGE descriptors */ |
159 | ||
bda663d3 RM |
160 | #define ASL_LARGE_HEADER_COMMON \ |
161 | u8 descriptor_type;\ | |
162 | u16 length; | |
163 | ||
164 | struct asl_large_header { | |
165 | ASL_LARGE_HEADER_COMMON}; | |
166 | ||
4be44fcd | 167 | struct asl_memory_24_desc { |
bda663d3 | 168 | ASL_LARGE_HEADER_COMMON u8 information; |
4be44fcd LB |
169 | u16 address_min; |
170 | u16 address_max; | |
171 | u16 alignment; | |
172 | u16 range_length; | |
1da177e4 LT |
173 | }; |
174 | ||
4be44fcd | 175 | struct asl_large_vendor_desc { |
bda663d3 | 176 | ASL_LARGE_HEADER_COMMON u8 vendor_defined[1]; |
1da177e4 LT |
177 | }; |
178 | ||
4be44fcd | 179 | struct asl_memory_32_desc { |
bda663d3 | 180 | ASL_LARGE_HEADER_COMMON u8 information; |
4be44fcd LB |
181 | u32 address_min; |
182 | u32 address_max; | |
183 | u32 alignment; | |
184 | u32 range_length; | |
1da177e4 LT |
185 | }; |
186 | ||
4be44fcd | 187 | struct asl_fixed_memory_32_desc { |
bda663d3 | 188 | ASL_LARGE_HEADER_COMMON u8 information; |
4be44fcd LB |
189 | u32 base_address; |
190 | u32 range_length; | |
1da177e4 LT |
191 | }; |
192 | ||
4be44fcd | 193 | struct asl_extended_address_desc { |
bda663d3 | 194 | ASL_LARGE_HEADER_COMMON u8 resource_type; |
4be44fcd LB |
195 | u8 flags; |
196 | u8 specific_flags; | |
197 | u8 revision_iD; | |
198 | u8 reserved; | |
199 | u64 granularity; | |
200 | u64 address_min; | |
201 | u64 address_max; | |
202 | u64 translation_offset; | |
203 | u64 address_length; | |
204 | u64 type_specific_attributes; | |
205 | u8 optional_fields[2]; /* Used for length calculation only */ | |
1da177e4 LT |
206 | }; |
207 | ||
4be44fcd LB |
208 | #define ASL_EXTENDED_ADDRESS_DESC_REVISION 1 /* ACPI 3.0 */ |
209 | ||
210 | struct asl_qword_address_desc { | |
bda663d3 | 211 | ASL_LARGE_HEADER_COMMON u8 resource_type; |
4be44fcd LB |
212 | u8 flags; |
213 | u8 specific_flags; | |
214 | u64 granularity; | |
215 | u64 address_min; | |
216 | u64 address_max; | |
217 | u64 translation_offset; | |
218 | u64 address_length; | |
219 | u8 optional_fields[2]; | |
1da177e4 LT |
220 | }; |
221 | ||
4be44fcd | 222 | struct asl_dword_address_desc { |
bda663d3 | 223 | ASL_LARGE_HEADER_COMMON u8 resource_type; |
4be44fcd LB |
224 | u8 flags; |
225 | u8 specific_flags; | |
226 | u32 granularity; | |
227 | u32 address_min; | |
228 | u32 address_max; | |
229 | u32 translation_offset; | |
230 | u32 address_length; | |
231 | u8 optional_fields[2]; | |
1da177e4 LT |
232 | }; |
233 | ||
4be44fcd | 234 | struct asl_word_address_desc { |
bda663d3 | 235 | ASL_LARGE_HEADER_COMMON u8 resource_type; |
4be44fcd LB |
236 | u8 flags; |
237 | u8 specific_flags; | |
238 | u16 granularity; | |
239 | u16 address_min; | |
240 | u16 address_max; | |
241 | u16 translation_offset; | |
242 | u16 address_length; | |
243 | u8 optional_fields[2]; | |
1da177e4 LT |
244 | }; |
245 | ||
4be44fcd | 246 | struct asl_extended_xrupt_desc { |
bda663d3 | 247 | ASL_LARGE_HEADER_COMMON u8 flags; |
4be44fcd LB |
248 | u8 table_length; |
249 | u32 interrupt_number[1]; | |
1da177e4 LT |
250 | /* res_source_index, res_source optional fields follow */ |
251 | }; | |
252 | ||
bda663d3 RM |
253 | struct asl_generic_register_desc { |
254 | ASL_LARGE_HEADER_COMMON u8 address_space_id; | |
4be44fcd LB |
255 | u8 bit_width; |
256 | u8 bit_offset; | |
257 | u8 access_size; /* ACPI 3.0, was Reserved */ | |
258 | u64 address; | |
1da177e4 LT |
259 | }; |
260 | ||
261 | /* restore default alignment */ | |
262 | ||
263 | #pragma pack() | |
264 | ||
265 | /* Union of all resource descriptors, so we can allocate the worst case */ | |
266 | ||
4be44fcd LB |
267 | union asl_resource_desc { |
268 | struct asl_irq_format_desc irq; | |
269 | struct asl_dma_format_desc dma; | |
4be44fcd LB |
270 | struct asl_io_port_desc iop; |
271 | struct asl_fixed_io_port_desc fio; | |
bda663d3 RM |
272 | struct asl_start_dependent_desc std; |
273 | struct asl_end_dependent_desc end; | |
4be44fcd LB |
274 | struct asl_small_vendor_desc smv; |
275 | struct asl_end_tag_desc et; | |
276 | ||
bda663d3 | 277 | struct asl_large_header lhd; |
4be44fcd LB |
278 | struct asl_memory_24_desc M24; |
279 | struct asl_large_vendor_desc lgv; | |
280 | struct asl_memory_32_desc M32; | |
281 | struct asl_fixed_memory_32_desc F32; | |
282 | struct asl_qword_address_desc qas; | |
283 | struct asl_dword_address_desc das; | |
284 | struct asl_word_address_desc was; | |
285 | struct asl_extended_address_desc eas; | |
286 | struct asl_extended_xrupt_desc exx; | |
bda663d3 | 287 | struct asl_generic_register_desc grg; |
4be44fcd LB |
288 | u32 u32_item; |
289 | u16 u16_item; | |
290 | u8 U8item; | |
1da177e4 LT |
291 | }; |
292 | ||
1da177e4 | 293 | #endif |