diff options
Diffstat (limited to 'include/acpi/acresrc.h')
-rw-r--r-- | include/acpi/acresrc.h | 313 |
1 files changed, 207 insertions, 106 deletions
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h index ce2cf72fd4c8..b66994e9e4ee 100644 --- a/include/acpi/acresrc.h +++ b/include/acpi/acresrc.h | |||
@@ -44,6 +44,51 @@ | |||
44 | #ifndef __ACRESRC_H__ | 44 | #ifndef __ACRESRC_H__ |
45 | #define __ACRESRC_H__ | 45 | #define __ACRESRC_H__ |
46 | 46 | ||
47 | /* Need the AML resource descriptor structs */ | ||
48 | |||
49 | #include "amlresrc.h" | ||
50 | |||
51 | /* | ||
52 | * Resource dispatch and info tables | ||
53 | */ | ||
54 | struct acpi_resource_info { | ||
55 | u8 length_type; | ||
56 | u8 minimum_aml_resource_length; | ||
57 | u8 minimum_internal_struct_length; | ||
58 | }; | ||
59 | |||
60 | /* Types for length_type above */ | ||
61 | |||
62 | #define ACPI_FIXED_LENGTH 0 | ||
63 | #define ACPI_VARIABLE_LENGTH 1 | ||
64 | #define ACPI_SMALL_VARIABLE_LENGTH 2 | ||
65 | |||
66 | /* Handlers */ | ||
67 | |||
68 | typedef acpi_status(*ACPI_SET_RESOURCE_HANDLER) (struct acpi_resource * | ||
69 | resource, | ||
70 | union aml_resource * aml); | ||
71 | |||
72 | typedef acpi_status(*ACPI_GET_RESOURCE_HANDLER) (union aml_resource * aml, | ||
73 | u16 aml_resource_length, | ||
74 | struct acpi_resource * | ||
75 | resource); | ||
76 | |||
77 | typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (union acpi_resource_data * data); | ||
78 | |||
79 | /* Tables indexed by internal resource type */ | ||
80 | |||
81 | extern u8 acpi_gbl_aml_resource_sizes[]; | ||
82 | extern ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[]; | ||
83 | extern ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[]; | ||
84 | |||
85 | /* Tables indexed by raw AML resource descriptor type */ | ||
86 | |||
87 | extern struct acpi_resource_info acpi_gbl_sm_resource_info[]; | ||
88 | extern struct acpi_resource_info acpi_gbl_lg_resource_info[]; | ||
89 | extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[]; | ||
90 | extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[]; | ||
91 | |||
47 | /* | 92 | /* |
48 | * Function prototypes called from Acpi* APIs | 93 | * Function prototypes called from Acpi* APIs |
49 | */ | 94 | */ |
@@ -66,12 +111,12 @@ acpi_status | |||
66 | acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); | 111 | acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); |
67 | 112 | ||
68 | acpi_status | 113 | acpi_status |
69 | acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, | 114 | acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, |
70 | struct acpi_buffer *output_buffer); | 115 | struct acpi_buffer *output_buffer); |
71 | 116 | ||
72 | acpi_status | 117 | acpi_status |
73 | acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, | 118 | acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, |
74 | struct acpi_buffer *output_buffer); | 119 | struct acpi_buffer *output_buffer); |
75 | 120 | ||
76 | acpi_status | 121 | acpi_status |
77 | acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | 122 | acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, |
@@ -90,184 +135,240 @@ void acpi_rs_dump_irq_list(u8 * route_table); | |||
90 | * rscalc | 135 | * rscalc |
91 | */ | 136 | */ |
92 | acpi_status | 137 | acpi_status |
93 | acpi_rs_get_byte_stream_start(u8 * byte_stream_buffer, | 138 | acpi_rs_get_list_length(u8 * aml_buffer, |
94 | u8 ** byte_stream_start, u32 * size); | 139 | u32 aml_buffer_length, acpi_size * size_needed); |
95 | |||
96 | acpi_status | ||
97 | acpi_rs_get_list_length(u8 * byte_stream_buffer, | ||
98 | u32 byte_stream_buffer_length, acpi_size * size_needed); | ||
99 | 140 | ||
100 | acpi_status | 141 | acpi_status |
101 | acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list_buffer, | 142 | acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer, |
102 | acpi_size * size_needed); | 143 | acpi_size * size_needed); |
103 | 144 | ||
104 | acpi_status | 145 | acpi_status |
105 | acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, | 146 | acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, |
106 | acpi_size * buffer_size_needed); | 147 | acpi_size * buffer_size_needed); |
107 | 148 | ||
108 | acpi_status | 149 | acpi_status |
109 | acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, | 150 | acpi_rs_convert_aml_to_resources(u8 * aml_buffer, |
110 | u32 byte_stream_buffer_length, u8 * output_buffer); | 151 | u32 aml_buffer_length, u8 * output_buffer); |
111 | 152 | ||
112 | acpi_status | 153 | acpi_status |
113 | acpi_rs_list_to_byte_stream(struct acpi_resource *resource, | 154 | acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, |
114 | acpi_size byte_stream_size_needed, | 155 | acpi_size aml_size_needed, u8 * output_buffer); |
115 | u8 * output_buffer); | ||
116 | 156 | ||
157 | /* | ||
158 | * rsio | ||
159 | */ | ||
117 | acpi_status | 160 | acpi_status |
118 | acpi_rs_io_resource(u8 * byte_stream_buffer, | 161 | acpi_rs_get_io(union aml_resource *aml, |
119 | acpi_size * bytes_consumed, | 162 | u16 aml_resource_length, struct acpi_resource *resource); |
120 | u8 ** output_buffer, acpi_size * structure_size); | ||
121 | 163 | ||
122 | acpi_status | 164 | acpi_status |
123 | acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, | 165 | acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml); |
124 | acpi_size * bytes_consumed, | ||
125 | u8 ** output_buffer, acpi_size * structure_size); | ||
126 | 166 | ||
127 | acpi_status | 167 | acpi_status |
128 | acpi_rs_io_stream(struct acpi_resource *resource, | 168 | acpi_rs_get_fixed_io(union aml_resource *aml, |
129 | u8 ** output_buffer, acpi_size * bytes_consumed); | 169 | u16 aml_resource_length, struct acpi_resource *resource); |
130 | 170 | ||
131 | acpi_status | 171 | acpi_status |
132 | acpi_rs_fixed_io_stream(struct acpi_resource *resource, | 172 | acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml); |
133 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
134 | 173 | ||
135 | acpi_status | 174 | acpi_status |
136 | acpi_rs_irq_resource(u8 * byte_stream_buffer, | 175 | acpi_rs_get_dma(union aml_resource *aml, |
137 | acpi_size * bytes_consumed, | 176 | u16 aml_resource_length, struct acpi_resource *resource); |
138 | u8 ** output_buffer, acpi_size * structure_size); | ||
139 | 177 | ||
140 | acpi_status | 178 | acpi_status |
141 | acpi_rs_irq_stream(struct acpi_resource *resource, | 179 | acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml); |
142 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
143 | 180 | ||
181 | /* | ||
182 | * rsirq | ||
183 | */ | ||
144 | acpi_status | 184 | acpi_status |
145 | acpi_rs_dma_resource(u8 * byte_stream_buffer, | 185 | acpi_rs_get_irq(union aml_resource *aml, |
146 | acpi_size * bytes_consumed, | 186 | u16 aml_resource_length, struct acpi_resource *resource); |
147 | u8 ** output_buffer, acpi_size * structure_size); | ||
148 | 187 | ||
149 | acpi_status | 188 | acpi_status |
150 | acpi_rs_dma_stream(struct acpi_resource *resource, | 189 | acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml); |
151 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
152 | 190 | ||
153 | acpi_status | 191 | acpi_status |
154 | acpi_rs_address16_resource(u8 * byte_stream_buffer, | 192 | acpi_rs_get_ext_irq(union aml_resource *aml, |
155 | acpi_size * bytes_consumed, | 193 | u16 aml_resource_length, struct acpi_resource *resource); |
156 | u8 ** output_buffer, acpi_size * structure_size); | ||
157 | 194 | ||
158 | acpi_status | 195 | acpi_status |
159 | acpi_rs_address16_stream(struct acpi_resource *resource, | 196 | acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml); |
160 | u8 ** output_buffer, acpi_size * bytes_consumed); | 197 | |
198 | /* | ||
199 | * rsaddr | ||
200 | */ | ||
201 | acpi_status | ||
202 | acpi_rs_get_address16(union aml_resource *aml, | ||
203 | u16 aml_resource_length, struct acpi_resource *resource); | ||
161 | 204 | ||
162 | acpi_status | 205 | acpi_status |
163 | acpi_rs_address32_resource(u8 * byte_stream_buffer, | 206 | acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml); |
164 | acpi_size * bytes_consumed, | ||
165 | u8 ** output_buffer, acpi_size * structure_size); | ||
166 | 207 | ||
167 | acpi_status | 208 | acpi_status |
168 | acpi_rs_address32_stream(struct acpi_resource *resource, | 209 | acpi_rs_get_address32(union aml_resource *aml, |
169 | u8 ** output_buffer, acpi_size * bytes_consumed); | 210 | u16 aml_resource_length, struct acpi_resource *resource); |
170 | 211 | ||
171 | acpi_status | 212 | acpi_status |
172 | acpi_rs_address64_resource(u8 * byte_stream_buffer, | 213 | acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml); |
173 | acpi_size * bytes_consumed, | ||
174 | u8 ** output_buffer, acpi_size * structure_size); | ||
175 | 214 | ||
176 | acpi_status | 215 | acpi_status |
177 | acpi_rs_address64_stream(struct acpi_resource *resource, | 216 | acpi_rs_get_address64(union aml_resource *aml, |
178 | u8 ** output_buffer, acpi_size * bytes_consumed); | 217 | u16 aml_resource_length, struct acpi_resource *resource); |
179 | 218 | ||
180 | acpi_status | 219 | acpi_status |
181 | acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, | 220 | acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml); |
182 | acpi_size * bytes_consumed, | 221 | |
183 | u8 ** output_buffer, | 222 | acpi_status |
184 | acpi_size * structure_size); | 223 | acpi_rs_get_ext_address64(union aml_resource *aml, |
224 | u16 aml_resource_length, | ||
225 | struct acpi_resource *resource); | ||
226 | |||
227 | acpi_status | ||
228 | acpi_rs_set_ext_address64(struct acpi_resource *resource, | ||
229 | union aml_resource *aml); | ||
230 | |||
231 | /* | ||
232 | * rsmemory | ||
233 | */ | ||
234 | acpi_status | ||
235 | acpi_rs_get_memory24(union aml_resource *aml, | ||
236 | u16 aml_resource_length, struct acpi_resource *resource); | ||
185 | 237 | ||
186 | acpi_status | 238 | acpi_status |
187 | acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, | 239 | acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml); |
188 | acpi_size * bytes_consumed, | ||
189 | u8 ** output_buffer, | ||
190 | acpi_size * structure_size); | ||
191 | 240 | ||
192 | acpi_status | 241 | acpi_status |
193 | acpi_rs_start_depend_fns_stream(struct acpi_resource *resource, | 242 | acpi_rs_get_memory32(union aml_resource *aml, |
194 | u8 ** output_buffer, | 243 | u16 aml_resource_length, struct acpi_resource *resource); |
195 | acpi_size * bytes_consumed); | ||
196 | 244 | ||
197 | acpi_status | 245 | acpi_status |
198 | acpi_rs_end_depend_fns_stream(struct acpi_resource *resource, | 246 | acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml); |
199 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
200 | 247 | ||
201 | acpi_status | 248 | acpi_status |
202 | acpi_rs_memory24_resource(u8 * byte_stream_buffer, | 249 | acpi_rs_get_fixed_memory32(union aml_resource *aml, |
203 | acpi_size * bytes_consumed, | 250 | u16 aml_resource_length, |
204 | u8 ** output_buffer, acpi_size * structure_size); | 251 | struct acpi_resource *resource); |
205 | 252 | ||
206 | acpi_status | 253 | acpi_status |
207 | acpi_rs_memory24_stream(struct acpi_resource *resource, | 254 | acpi_rs_set_fixed_memory32(struct acpi_resource *resource, |
208 | u8 ** output_buffer, acpi_size * bytes_consumed); | 255 | union aml_resource *aml); |
209 | 256 | ||
257 | /* | ||
258 | * rsmisc | ||
259 | */ | ||
210 | acpi_status | 260 | acpi_status |
211 | acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, | 261 | acpi_rs_get_generic_reg(union aml_resource *aml, |
212 | acpi_size * bytes_consumed, | 262 | u16 aml_resource_length, |
213 | u8 ** output_buffer, | 263 | struct acpi_resource *resource); |
214 | acpi_size * structure_size); | ||
215 | 264 | ||
216 | acpi_status | 265 | acpi_status |
217 | acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, | 266 | acpi_rs_set_generic_reg(struct acpi_resource *resource, |
218 | acpi_size * bytes_consumed, | 267 | union aml_resource *aml); |
219 | u8 ** output_buffer, | ||
220 | acpi_size * structure_size); | ||
221 | 268 | ||
222 | acpi_status | 269 | acpi_status |
223 | acpi_rs_memory32_range_stream(struct acpi_resource *resource, | 270 | acpi_rs_get_vendor(union aml_resource *aml, |
224 | u8 ** output_buffer, acpi_size * bytes_consumed); | 271 | u16 aml_resource_length, struct acpi_resource *resource); |
225 | 272 | ||
226 | acpi_status | 273 | acpi_status |
227 | acpi_rs_fixed_memory32_stream(struct acpi_resource *resource, | 274 | acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml); |
228 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
229 | 275 | ||
230 | acpi_status | 276 | acpi_status |
231 | acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, | 277 | acpi_rs_get_start_dpf(union aml_resource *aml, |
232 | acpi_size * bytes_consumed, | 278 | u16 aml_resource_length, struct acpi_resource *resource); |
233 | u8 ** output_buffer, acpi_size * structure_size); | ||
234 | 279 | ||
235 | acpi_status | 280 | acpi_status |
236 | acpi_rs_extended_irq_stream(struct acpi_resource *resource, | 281 | acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml); |
237 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
238 | 282 | ||
239 | acpi_status | 283 | acpi_status |
240 | acpi_rs_end_tag_resource(u8 * byte_stream_buffer, | 284 | acpi_rs_get_end_dpf(union aml_resource *aml, |
241 | acpi_size * bytes_consumed, | 285 | u16 aml_resource_length, struct acpi_resource *resource); |
242 | u8 ** output_buffer, acpi_size * structure_size); | ||
243 | 286 | ||
244 | acpi_status | 287 | acpi_status |
245 | acpi_rs_end_tag_stream(struct acpi_resource *resource, | 288 | acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml); |
246 | u8 ** output_buffer, acpi_size * bytes_consumed); | ||
247 | 289 | ||
248 | acpi_status | 290 | acpi_status |
249 | acpi_rs_vendor_resource(u8 * byte_stream_buffer, | 291 | acpi_rs_get_end_tag(union aml_resource *aml, |
250 | acpi_size * bytes_consumed, | 292 | u16 aml_resource_length, struct acpi_resource *resource); |
251 | u8 ** output_buffer, acpi_size * structure_size); | ||
252 | 293 | ||
253 | acpi_status | 294 | acpi_status |
254 | acpi_rs_vendor_stream(struct acpi_resource *resource, | 295 | acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml); |
255 | u8 ** output_buffer, acpi_size * bytes_consumed); | 296 | |
297 | /* | ||
298 | * rsutils | ||
299 | */ | ||
300 | void | ||
301 | acpi_rs_move_data(void *destination, | ||
302 | void *source, u16 item_count, u8 move_type); | ||
303 | |||
304 | /* Types used in move_type above */ | ||
305 | |||
306 | #define ACPI_MOVE_TYPE_16_TO_32 0 | ||
307 | #define ACPI_MOVE_TYPE_32_TO_16 1 | ||
308 | #define ACPI_MOVE_TYPE_32_TO_32 2 | ||
309 | #define ACPI_MOVE_TYPE_64_TO_64 3 | ||
310 | |||
311 | u16 | ||
312 | acpi_rs_get_resource_source(u16 resource_length, | ||
313 | acpi_size minimum_length, | ||
314 | struct acpi_resource_source *resource_source, | ||
315 | union aml_resource *aml, char *string_ptr); | ||
316 | |||
317 | acpi_size | ||
318 | acpi_rs_set_resource_source(union aml_resource *aml, | ||
319 | acpi_size minimum_length, | ||
320 | struct acpi_resource_source *resource_source); | ||
256 | 321 | ||
257 | u8 acpi_rs_get_resource_type(u8 resource_start_byte); | 322 | u8 acpi_rs_get_resource_type(u8 resource_start_byte); |
258 | 323 | ||
324 | u32 acpi_rs_get_descriptor_length(union aml_resource *aml); | ||
325 | |||
326 | u16 acpi_rs_get_resource_length(union aml_resource *aml); | ||
327 | |||
328 | void | ||
329 | acpi_rs_set_resource_header(u8 descriptor_type, | ||
330 | acpi_size total_length, union aml_resource *aml); | ||
331 | |||
332 | struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type); | ||
333 | |||
334 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
259 | /* | 335 | /* |
260 | * rsmisc | 336 | * rsdump |
261 | */ | 337 | */ |
262 | acpi_status | 338 | void acpi_rs_dump_irq(union acpi_resource_data *resource); |
263 | acpi_rs_generic_register_resource(u8 * byte_stream_buffer, | ||
264 | acpi_size * bytes_consumed, | ||
265 | u8 ** output_buffer, | ||
266 | acpi_size * structure_size); | ||
267 | 339 | ||
268 | acpi_status | 340 | void acpi_rs_dump_address16(union acpi_resource_data *resource); |
269 | acpi_rs_generic_register_stream(struct acpi_resource *resource, | 341 | |
270 | u8 ** output_buffer, | 342 | void acpi_rs_dump_address32(union acpi_resource_data *resource); |
271 | acpi_size * bytes_consumed); | 343 | |
344 | void acpi_rs_dump_address64(union acpi_resource_data *resource); | ||
345 | |||
346 | void acpi_rs_dump_ext_address64(union acpi_resource_data *resource); | ||
347 | |||
348 | void acpi_rs_dump_dma(union acpi_resource_data *resource); | ||
349 | |||
350 | void acpi_rs_dump_io(union acpi_resource_data *resource); | ||
351 | |||
352 | void acpi_rs_dump_ext_irq(union acpi_resource_data *resource); | ||
353 | |||
354 | void acpi_rs_dump_fixed_io(union acpi_resource_data *resource); | ||
355 | |||
356 | void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource); | ||
357 | |||
358 | void acpi_rs_dump_memory24(union acpi_resource_data *resource); | ||
359 | |||
360 | void acpi_rs_dump_memory32(union acpi_resource_data *resource); | ||
361 | |||
362 | void acpi_rs_dump_start_dpf(union acpi_resource_data *resource); | ||
363 | |||
364 | void acpi_rs_dump_vendor(union acpi_resource_data *resource); | ||
365 | |||
366 | void acpi_rs_dump_generic_reg(union acpi_resource_data *resource); | ||
367 | |||
368 | void acpi_rs_dump_end_dpf(union acpi_resource_data *resource); | ||
369 | |||
370 | void acpi_rs_dump_end_tag(union acpi_resource_data *resource); | ||
371 | |||
372 | #endif | ||
272 | 373 | ||
273 | #endif /* __ACRESRC_H__ */ | 374 | #endif /* __ACRESRC_H__ */ |