1 /******************************************************************************
3 * Name: acresrc.h - Resource Manager function prototypes
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2017, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
47 /* Need the AML resource descriptor structs */
52 * If possible, pack the following structures to byte alignment, since we
53 * don't care about performance for debug output. Two cases where we cannot
54 * pack the structures:
56 * 1) Hardware does not support misaligned memory transfers
57 * 2) Compiler does not support pointers within packed structures
59 #if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
64 * Individual entry for the resource conversion tables
66 typedef const struct acpi_rsconvert_info {
72 } acpi_rsconvert_info;
74 /* Resource conversion opcodes */
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,
98 ACPI_RSC_MOVE_GPIO_PIN,
99 ACPI_RSC_MOVE_GPIO_RES,
100 ACPI_RSC_MOVE_SERIAL_RES,
101 ACPI_RSC_MOVE_SERIAL_VEN,
109 } ACPI_RSCONVERT_OPCODES;
111 /* Resource Conversion sub-opcodes */
113 #define ACPI_RSC_COMPARE_AML_LENGTH 0
114 #define ACPI_RSC_COMPARE_VALUE 1
116 #define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info))
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)
122 * Individual entry for the resource dump tables
124 typedef const struct acpi_rsdump_info {
128 const char **pointer;
132 /* Values for the Opcode field above */
154 } ACPI_RSDUMP_OPCODES;
156 /* restore default alignment */
160 /* Resource tables indexed by internal resource type */
162 extern const u8 acpi_gbl_aml_resource_sizes[];
163 extern const u8 acpi_gbl_aml_resource_serial_bus_sizes[];
164 extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[];
166 /* Resource tables indexed by raw AML resource descriptor type */
168 extern const u8 acpi_gbl_resource_struct_sizes[];
169 extern const u8 acpi_gbl_resource_struct_serial_bus_sizes[];
170 extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[];
172 extern struct acpi_rsconvert_info
173 *acpi_gbl_convert_resource_serial_bus_dispatch[];
175 struct acpi_vendor_walk_info {
176 struct acpi_vendor_uuid *uuid;
177 struct acpi_buffer *buffer;
185 acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
186 struct acpi_buffer *output_buffer);
189 acpi_rs_create_aml_resources(struct acpi_buffer *resource_list,
190 struct acpi_buffer *output_buffer);
193 acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
194 struct acpi_buffer *output_buffer);
201 acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
202 struct acpi_buffer *ret_buffer);
205 acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
206 struct acpi_buffer *ret_buffer);
209 acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
210 struct acpi_buffer *ret_buffer);
213 acpi_rs_get_method_data(acpi_handle handle,
214 const char *path, struct acpi_buffer *ret_buffer);
217 acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
218 struct acpi_buffer *ret_buffer);
221 acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
222 struct acpi_buffer *ret_buffer);
228 acpi_rs_get_list_length(u8 *aml_buffer,
229 u32 aml_buffer_length, acpi_size *size_needed);
232 acpi_rs_get_aml_length(struct acpi_resource *resource_list,
233 acpi_size resource_list_size, acpi_size *size_needed);
236 acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
237 acpi_size *buffer_size_needed);
240 acpi_rs_convert_aml_to_resources(u8 * aml,
242 u32 offset, u8 resource_index, void **context);
245 acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
246 acpi_size aml_size_needed, u8 * output_buffer);
252 acpi_rs_set_address_common(union aml_resource *aml,
253 struct acpi_resource *resource);
256 acpi_rs_get_address_common(struct acpi_resource *resource,
257 union aml_resource *aml);
263 acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
264 union aml_resource *aml,
265 struct acpi_rsconvert_info *info);
268 acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
269 union aml_resource *aml,
270 struct acpi_rsconvert_info *info);
276 acpi_rs_move_data(void *destination,
277 void *source, u16 item_count, u8 move_type);
279 u8 acpi_rs_decode_bitmask(u16 mask, u8 * list);
281 u16 acpi_rs_encode_bitmask(u8 * list, u8 count);
284 acpi_rs_get_resource_source(acpi_rs_length resource_length,
285 acpi_rs_length minimum_length,
286 struct acpi_resource_source *resource_source,
287 union aml_resource *aml, char *string_ptr);
290 acpi_rs_set_resource_source(union aml_resource *aml,
291 acpi_rs_length minimum_length,
292 struct acpi_resource_source *resource_source);
295 acpi_rs_set_resource_header(u8 descriptor_type,
296 acpi_rsdesc_size total_length,
297 union aml_resource *aml);
300 acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
301 union aml_resource *aml);
304 * rsdump - Debugger support
307 void acpi_rs_dump_resource_list(struct acpi_resource *resource);
309 void acpi_rs_dump_irq_list(u8 *route_table);
313 * Resource conversion tables
315 extern struct acpi_rsconvert_info acpi_rs_convert_dma[];
316 extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[];
317 extern struct acpi_rsconvert_info acpi_rs_convert_io[];
318 extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[];
319 extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[];
320 extern struct acpi_rsconvert_info acpi_rs_convert_memory24[];
321 extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[];
322 extern struct acpi_rsconvert_info acpi_rs_convert_memory32[];
323 extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[];
324 extern struct acpi_rsconvert_info acpi_rs_convert_address32[];
325 extern struct acpi_rsconvert_info acpi_rs_convert_address16[];
326 extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[];
327 extern struct acpi_rsconvert_info acpi_rs_convert_address64[];
328 extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[];
329 extern struct acpi_rsconvert_info acpi_rs_convert_gpio[];
330 extern struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[];
331 extern struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[];
332 extern struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[];
333 extern struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[];
334 extern struct acpi_rsconvert_info acpi_rs_convert_pin_function[];
335 extern struct acpi_rsconvert_info acpi_rs_convert_pin_config[];
336 extern struct acpi_rsconvert_info acpi_rs_convert_pin_group[];
338 /* These resources require separate get/set tables */
340 extern struct acpi_rsconvert_info acpi_rs_get_irq[];
341 extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[];
342 extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[];
343 extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[];
345 extern struct acpi_rsconvert_info acpi_rs_set_irq[];
346 extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[];
347 extern struct acpi_rsconvert_info acpi_rs_set_vendor[];
349 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
353 extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
354 extern struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[];
359 extern struct acpi_rsdump_info acpi_rs_dump_irq[];
360 extern struct acpi_rsdump_info acpi_rs_dump_prt[];
361 extern struct acpi_rsdump_info acpi_rs_dump_dma[];
362 extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[];
363 extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[];
364 extern struct acpi_rsdump_info acpi_rs_dump_io[];
365 extern struct acpi_rsdump_info acpi_rs_dump_io_flags[];
366 extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[];
367 extern struct acpi_rsdump_info acpi_rs_dump_vendor[];
368 extern struct acpi_rsdump_info acpi_rs_dump_end_tag[];
369 extern struct acpi_rsdump_info acpi_rs_dump_memory24[];
370 extern struct acpi_rsdump_info acpi_rs_dump_memory32[];
371 extern struct acpi_rsdump_info acpi_rs_dump_memory_flags[];
372 extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[];
373 extern struct acpi_rsdump_info acpi_rs_dump_address16[];
374 extern struct acpi_rsdump_info acpi_rs_dump_address32[];
375 extern struct acpi_rsdump_info acpi_rs_dump_address64[];
376 extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[];
377 extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[];
378 extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[];
379 extern struct acpi_rsdump_info acpi_rs_dump_gpio[];
380 extern struct acpi_rsdump_info acpi_rs_dump_pin_function[];
381 extern struct acpi_rsdump_info acpi_rs_dump_fixed_dma[];
382 extern struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[];
383 extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[];
384 extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[];
385 extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[];
386 extern struct acpi_rsdump_info acpi_rs_dump_general_flags[];
387 extern struct acpi_rsdump_info acpi_rs_dump_pin_config[];
388 extern struct acpi_rsdump_info acpi_rs_dump_pin_group[];
391 #endif /* __ACRESRC_H__ */