]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /****************************************************************************** |
2 | * | |
3 | * Name: acresrc.h - Resource Manager function prototypes | |
4 | * | |
5 | *****************************************************************************/ | |
6 | ||
7 | /* | |
7735ca0e | 8 | * Copyright (C) 2000 - 2017, Intel Corp. |
1da177e4 LT |
9 | * All rights reserved. |
10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | |
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. | |
25 | * | |
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. | |
29 | * | |
30 | * NO WARRANTY | |
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. | |
42 | */ | |
43 | ||
44 | #ifndef __ACRESRC_H__ | |
45 | #define __ACRESRC_H__ | |
46 | ||
50eca3eb BM |
47 | /* Need the AML resource descriptor structs */ |
48 | ||
49 | #include "amlresrc.h" | |
50 | ||
0897831b BM |
51 | /* |
52 | * If possible, pack the following structures to byte alignment, since we | |
f6dd9221 BM |
53 | * don't care about performance for debug output. Two cases where we cannot |
54 | * pack the structures: | |
55 | * | |
56 | * 1) Hardware does not support misaligned memory transfers | |
57 | * 2) Compiler does not support pointers within packed structures | |
0897831b | 58 | */ |
f6dd9221 | 59 | #if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED)) |
0897831b BM |
60 | #pragma pack(1) |
61 | #endif | |
62 | ||
63 | /* | |
64 | * Individual entry for the resource conversion tables | |
65 | */ | |
66 | typedef const struct acpi_rsconvert_info { | |
67 | u8 opcode; | |
68 | u8 resource_offset; | |
69 | u8 aml_offset; | |
70 | u8 value; | |
71 | ||
72 | } acpi_rsconvert_info; | |
73 | ||
74 | /* Resource conversion opcodes */ | |
75 | ||
e0fe0a8d LM |
76 | typedef enum { |
77 | ACPI_RSC_INITGET = 0, | |
78 | ACPI_RSC_INITSET, | |
79 | ACPI_RSC_FLAGINIT, | |
80 | ACPI_RSC_1BITFLAG, | |
81 | ACPI_RSC_2BITFLAG, | |
82 | ACPI_RSC_3BITFLAG, | |
83 | ACPI_RSC_ADDRESS, | |
84 | ACPI_RSC_BITMASK, | |
85 | ACPI_RSC_BITMASK16, | |
86 | ACPI_RSC_COUNT, | |
87 | ACPI_RSC_COUNT16, | |
88 | ACPI_RSC_COUNT_GPIO_PIN, | |
89 | ACPI_RSC_COUNT_GPIO_RES, | |
90 | ACPI_RSC_COUNT_GPIO_VEN, | |
91 | ACPI_RSC_COUNT_SERIAL_RES, | |
92 | ACPI_RSC_COUNT_SERIAL_VEN, | |
93 | ACPI_RSC_DATA8, | |
94 | ACPI_RSC_EXIT_EQ, | |
95 | ACPI_RSC_EXIT_LE, | |
96 | ACPI_RSC_EXIT_NE, | |
97 | ACPI_RSC_LENGTH, | |
98 | ACPI_RSC_MOVE_GPIO_PIN, | |
99 | ACPI_RSC_MOVE_GPIO_RES, | |
100 | ACPI_RSC_MOVE_SERIAL_RES, | |
101 | ACPI_RSC_MOVE_SERIAL_VEN, | |
102 | ACPI_RSC_MOVE8, | |
103 | ACPI_RSC_MOVE16, | |
104 | ACPI_RSC_MOVE32, | |
105 | ACPI_RSC_MOVE64, | |
106 | ACPI_RSC_SET8, | |
107 | ACPI_RSC_SOURCE, | |
108 | ACPI_RSC_SOURCEX | |
109 | } ACPI_RSCONVERT_OPCODES; | |
0897831b BM |
110 | |
111 | /* Resource Conversion sub-opcodes */ | |
112 | ||
113 | #define ACPI_RSC_COMPARE_AML_LENGTH 0 | |
114 | #define ACPI_RSC_COMPARE_VALUE 1 | |
115 | ||
116 | #define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info)) | |
117 | ||
118 | #define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f) | |
119 | #define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f) | |
120 | ||
e0fe0a8d LM |
121 | /* |
122 | * Individual entry for the resource dump tables | |
123 | */ | |
0897831b BM |
124 | typedef const struct acpi_rsdump_info { |
125 | u8 opcode; | |
126 | u8 offset; | |
0dfaaa3d | 127 | const char *name; |
96db255c | 128 | const char **pointer; |
50eca3eb | 129 | |
0897831b | 130 | } acpi_rsdump_info; |
50eca3eb | 131 | |
0897831b | 132 | /* Values for the Opcode field above */ |
50eca3eb | 133 | |
e0fe0a8d LM |
134 | typedef enum { |
135 | ACPI_RSD_TITLE = 0, | |
136 | ACPI_RSD_1BITFLAG, | |
137 | ACPI_RSD_2BITFLAG, | |
138 | ACPI_RSD_3BITFLAG, | |
139 | ACPI_RSD_ADDRESS, | |
140 | ACPI_RSD_DWORDLIST, | |
141 | ACPI_RSD_LITERAL, | |
142 | ACPI_RSD_LONGLIST, | |
143 | ACPI_RSD_SHORTLIST, | |
144 | ACPI_RSD_SHORTLISTX, | |
145 | ACPI_RSD_SOURCE, | |
146 | ACPI_RSD_STRING, | |
147 | ACPI_RSD_UINT8, | |
148 | ACPI_RSD_UINT16, | |
149 | ACPI_RSD_UINT32, | |
150 | ACPI_RSD_UINT64, | |
fdaa0980 MW |
151 | ACPI_RSD_WORDLIST, |
152 | ACPI_RSD_LABEL, | |
f8a6c866 | 153 | ACPI_RSD_SOURCE_LABEL, |
fdaa0980 | 154 | |
e0fe0a8d | 155 | } ACPI_RSDUMP_OPCODES; |
50eca3eb | 156 | |
0897831b | 157 | /* restore default alignment */ |
50eca3eb | 158 | |
0897831b | 159 | #pragma pack() |
50eca3eb | 160 | |
0897831b | 161 | /* Resource tables indexed by internal resource type */ |
50eca3eb | 162 | |
0897831b | 163 | extern const u8 acpi_gbl_aml_resource_sizes[]; |
e0fe0a8d | 164 | extern const u8 acpi_gbl_aml_resource_serial_bus_sizes[]; |
0897831b BM |
165 | extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[]; |
166 | ||
167 | /* Resource tables indexed by raw AML resource descriptor type */ | |
50eca3eb | 168 | |
c51a4de8 | 169 | extern const u8 acpi_gbl_resource_struct_sizes[]; |
e0fe0a8d | 170 | extern const u8 acpi_gbl_resource_struct_serial_bus_sizes[]; |
96db255c BM |
171 | extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[]; |
172 | ||
e0fe0a8d LM |
173 | extern struct acpi_rsconvert_info |
174 | *acpi_gbl_convert_resource_serial_bus_dispatch[]; | |
175 | ||
c51a4de8 BM |
176 | struct acpi_vendor_walk_info { |
177 | struct acpi_vendor_uuid *uuid; | |
178 | struct acpi_buffer *buffer; | |
179 | acpi_status status; | |
180 | }; | |
0897831b BM |
181 | |
182 | /* | |
183 | * rscreate | |
184 | */ | |
185 | acpi_status | |
186 | acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, | |
187 | struct acpi_buffer *output_buffer); | |
188 | ||
189 | acpi_status | |
9a0a3597 | 190 | acpi_rs_create_aml_resources(struct acpi_buffer *resource_list, |
0897831b BM |
191 | struct acpi_buffer *output_buffer); |
192 | ||
193 | acpi_status | |
194 | acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |
195 | struct acpi_buffer *output_buffer); | |
50eca3eb | 196 | |
1da177e4 | 197 | /* |
0897831b | 198 | * rsutils |
1da177e4 | 199 | */ |
4119532c | 200 | |
1da177e4 | 201 | acpi_status |
4119532c BM |
202 | acpi_rs_get_prt_method_data(struct acpi_namespace_node *node, |
203 | struct acpi_buffer *ret_buffer); | |
1da177e4 LT |
204 | |
205 | acpi_status | |
4119532c BM |
206 | acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, |
207 | struct acpi_buffer *ret_buffer); | |
1da177e4 | 208 | |
1da177e4 | 209 | acpi_status |
4119532c BM |
210 | acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, |
211 | struct acpi_buffer *ret_buffer); | |
1da177e4 LT |
212 | |
213 | acpi_status | |
4be44fcd | 214 | acpi_rs_get_method_data(acpi_handle handle, |
0dfaaa3d | 215 | const char *path, struct acpi_buffer *ret_buffer); |
1da177e4 LT |
216 | |
217 | acpi_status | |
4119532c BM |
218 | acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, |
219 | struct acpi_buffer *ret_buffer); | |
1da177e4 | 220 | |
a91cdde2 BM |
221 | acpi_status |
222 | acpi_rs_get_aei_method_data(struct acpi_namespace_node *node, | |
223 | struct acpi_buffer *ret_buffer); | |
224 | ||
44f6c012 RM |
225 | /* |
226 | * rscalc | |
227 | */ | |
1da177e4 | 228 | acpi_status |
f5c1e1c5 LZ |
229 | acpi_rs_get_list_length(u8 *aml_buffer, |
230 | u32 aml_buffer_length, acpi_size *size_needed); | |
1da177e4 LT |
231 | |
232 | acpi_status | |
9a0a3597 | 233 | acpi_rs_get_aml_length(struct acpi_resource *resource_list, |
f5c1e1c5 | 234 | acpi_size resource_list_size, acpi_size *size_needed); |
1da177e4 LT |
235 | |
236 | acpi_status | |
4be44fcd | 237 | acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, |
f5c1e1c5 | 238 | acpi_size *buffer_size_needed); |
1da177e4 LT |
239 | |
240 | acpi_status | |
61686124 BM |
241 | acpi_rs_convert_aml_to_resources(u8 * aml, |
242 | u32 length, | |
243 | u32 offset, u8 resource_index, void **context); | |
1da177e4 LT |
244 | |
245 | acpi_status | |
50eca3eb BM |
246 | acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, |
247 | acpi_size aml_size_needed, u8 * output_buffer); | |
1da177e4 | 248 | |
50eca3eb BM |
249 | /* |
250 | * rsaddr | |
251 | */ | |
0897831b BM |
252 | void |
253 | acpi_rs_set_address_common(union aml_resource *aml, | |
50eca3eb | 254 | struct acpi_resource *resource); |
1da177e4 | 255 | |
0897831b BM |
256 | u8 |
257 | acpi_rs_get_address_common(struct acpi_resource *resource, | |
50eca3eb | 258 | union aml_resource *aml); |
1da177e4 | 259 | |
50eca3eb BM |
260 | /* |
261 | * rsmisc | |
262 | */ | |
1da177e4 | 263 | acpi_status |
0897831b BM |
264 | acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, |
265 | union aml_resource *aml, | |
266 | struct acpi_rsconvert_info *info); | |
1da177e4 LT |
267 | |
268 | acpi_status | |
0897831b BM |
269 | acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, |
270 | union aml_resource *aml, | |
271 | struct acpi_rsconvert_info *info); | |
50eca3eb BM |
272 | |
273 | /* | |
274 | * rsutils | |
275 | */ | |
276 | void | |
277 | acpi_rs_move_data(void *destination, | |
278 | void *source, u16 item_count, u8 move_type); | |
279 | ||
0897831b | 280 | u8 acpi_rs_decode_bitmask(u16 mask, u8 * list); |
50eca3eb | 281 | |
0897831b | 282 | u16 acpi_rs_encode_bitmask(u8 * list, u8 count); |
50eca3eb | 283 | |
0897831b BM |
284 | acpi_rs_length |
285 | acpi_rs_get_resource_source(acpi_rs_length resource_length, | |
286 | acpi_rs_length minimum_length, | |
50eca3eb BM |
287 | struct acpi_resource_source *resource_source, |
288 | union aml_resource *aml, char *string_ptr); | |
289 | ||
0897831b | 290 | acpi_rsdesc_size |
50eca3eb | 291 | acpi_rs_set_resource_source(union aml_resource *aml, |
0897831b | 292 | acpi_rs_length minimum_length, |
50eca3eb | 293 | struct acpi_resource_source *resource_source); |
1da177e4 | 294 | |
50eca3eb BM |
295 | void |
296 | acpi_rs_set_resource_header(u8 descriptor_type, | |
0897831b BM |
297 | acpi_rsdesc_size total_length, |
298 | union aml_resource *aml); | |
299 | ||
300 | void | |
301 | acpi_rs_set_resource_length(acpi_rsdesc_size total_length, | |
302 | union aml_resource *aml); | |
50eca3eb | 303 | |
bda663d3 | 304 | /* |
39239fed | 305 | * rsdump - Debugger support |
bda663d3 | 306 | */ |
39239fed | 307 | #ifdef ACPI_DEBUGGER |
0897831b | 308 | void acpi_rs_dump_resource_list(struct acpi_resource *resource); |
50eca3eb | 309 | |
18ae9021 | 310 | void acpi_rs_dump_irq_list(u8 *route_table); |
27c481f3 | 311 | #endif |
50eca3eb | 312 | |
0897831b BM |
313 | /* |
314 | * Resource conversion tables | |
315 | */ | |
316 | extern struct acpi_rsconvert_info acpi_rs_convert_dma[]; | |
317 | extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[]; | |
318 | extern struct acpi_rsconvert_info acpi_rs_convert_io[]; | |
319 | extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[]; | |
320 | extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[]; | |
321 | extern struct acpi_rsconvert_info acpi_rs_convert_memory24[]; | |
322 | extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[]; | |
323 | extern struct acpi_rsconvert_info acpi_rs_convert_memory32[]; | |
324 | extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[]; | |
325 | extern struct acpi_rsconvert_info acpi_rs_convert_address32[]; | |
326 | extern struct acpi_rsconvert_info acpi_rs_convert_address16[]; | |
327 | extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[]; | |
328 | extern struct acpi_rsconvert_info acpi_rs_convert_address64[]; | |
329 | extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[]; | |
e0fe0a8d LM |
330 | extern struct acpi_rsconvert_info acpi_rs_convert_gpio[]; |
331 | extern struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[]; | |
332 | extern struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[]; | |
333 | extern struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[]; | |
334 | extern struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[]; | |
2b726930 | 335 | extern struct acpi_rsconvert_info acpi_rs_convert_pin_function[]; |
97028ce6 | 336 | extern struct acpi_rsconvert_info acpi_rs_convert_pin_config[]; |
fdaa0980 | 337 | extern struct acpi_rsconvert_info acpi_rs_convert_pin_group[]; |
f8a6c866 | 338 | extern struct acpi_rsconvert_info acpi_rs_convert_pin_group_function[]; |
044b7239 | 339 | extern struct acpi_rsconvert_info acpi_rs_convert_pin_group_config[]; |
0897831b BM |
340 | |
341 | /* These resources require separate get/set tables */ | |
342 | ||
343 | extern struct acpi_rsconvert_info acpi_rs_get_irq[]; | |
344 | extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[]; | |
345 | extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[]; | |
346 | extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[]; | |
347 | ||
348 | extern struct acpi_rsconvert_info acpi_rs_set_irq[]; | |
349 | extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[]; | |
350 | extern struct acpi_rsconvert_info acpi_rs_set_vendor[]; | |
50eca3eb | 351 | |
0897831b BM |
352 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
353 | /* | |
354 | * rsinfo | |
355 | */ | |
356 | extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[]; | |
e0fe0a8d | 357 | extern struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[]; |
50eca3eb | 358 | |
0897831b | 359 | /* |
42f8fb75 | 360 | * rsdumpinfo |
0897831b BM |
361 | */ |
362 | extern struct acpi_rsdump_info acpi_rs_dump_irq[]; | |
42f8fb75 | 363 | extern struct acpi_rsdump_info acpi_rs_dump_prt[]; |
0897831b BM |
364 | extern struct acpi_rsdump_info acpi_rs_dump_dma[]; |
365 | extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[]; | |
366 | extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[]; | |
367 | extern struct acpi_rsdump_info acpi_rs_dump_io[]; | |
42f8fb75 | 368 | extern struct acpi_rsdump_info acpi_rs_dump_io_flags[]; |
0897831b BM |
369 | extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[]; |
370 | extern struct acpi_rsdump_info acpi_rs_dump_vendor[]; | |
371 | extern struct acpi_rsdump_info acpi_rs_dump_end_tag[]; | |
372 | extern struct acpi_rsdump_info acpi_rs_dump_memory24[]; | |
373 | extern struct acpi_rsdump_info acpi_rs_dump_memory32[]; | |
42f8fb75 | 374 | extern struct acpi_rsdump_info acpi_rs_dump_memory_flags[]; |
0897831b BM |
375 | extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[]; |
376 | extern struct acpi_rsdump_info acpi_rs_dump_address16[]; | |
377 | extern struct acpi_rsdump_info acpi_rs_dump_address32[]; | |
378 | extern struct acpi_rsdump_info acpi_rs_dump_address64[]; | |
379 | extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[]; | |
380 | extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[]; | |
381 | extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[]; | |
e0fe0a8d | 382 | extern struct acpi_rsdump_info acpi_rs_dump_gpio[]; |
2b726930 | 383 | extern struct acpi_rsdump_info acpi_rs_dump_pin_function[]; |
e0fe0a8d LM |
384 | extern struct acpi_rsdump_info acpi_rs_dump_fixed_dma[]; |
385 | extern struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[]; | |
386 | extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[]; | |
387 | extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[]; | |
388 | extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[]; | |
42f8fb75 | 389 | extern struct acpi_rsdump_info acpi_rs_dump_general_flags[]; |
97028ce6 | 390 | extern struct acpi_rsdump_info acpi_rs_dump_pin_config[]; |
fdaa0980 | 391 | extern struct acpi_rsdump_info acpi_rs_dump_pin_group[]; |
f8a6c866 | 392 | extern struct acpi_rsdump_info acpi_rs_dump_pin_group_function[]; |
044b7239 | 393 | extern struct acpi_rsdump_info acpi_rs_dump_pin_group_config[]; |
50eca3eb | 394 | #endif |
bda663d3 | 395 | |
4be44fcd | 396 | #endif /* __ACRESRC_H__ */ |