1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /******************************************************************************
4 * Name: acresrc.h - Resource Manager function prototypes
6 * Copyright (C) 2000 - 2023, Intel Corp.
8 *****************************************************************************/
13 /* Need the AML resource descriptor structs */
18 * If possible, pack the following structures to byte alignment, since we
19 * don't care about performance for debug output. Two cases where we cannot
20 * pack the structures:
22 * 1) Hardware does not support misaligned memory transfers
23 * 2) Compiler does not support pointers within packed structures
25 #if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
30 * Individual entry for the resource conversion tables
32 typedef const struct acpi_rsconvert_info
{
38 } acpi_rsconvert_info
;
40 /* Resource conversion opcodes */
55 ACPI_RSC_COUNT_GPIO_PIN
,
56 ACPI_RSC_COUNT_GPIO_RES
,
57 ACPI_RSC_COUNT_GPIO_VEN
,
58 ACPI_RSC_COUNT_SERIAL_RES
,
59 ACPI_RSC_COUNT_SERIAL_VEN
,
65 ACPI_RSC_MOVE_GPIO_PIN
,
66 ACPI_RSC_MOVE_GPIO_RES
,
67 ACPI_RSC_MOVE_SERIAL_RES
,
68 ACPI_RSC_MOVE_SERIAL_VEN
,
76 } ACPI_RSCONVERT_OPCODES
;
78 /* Resource Conversion sub-opcodes */
80 #define ACPI_RSC_COMPARE_AML_LENGTH 0
81 #define ACPI_RSC_COMPARE_VALUE 1
83 #define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info))
85 #define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f)
86 #define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f)
89 * Individual entry for the resource dump tables
91 typedef const struct acpi_rsdump_info
{
99 /* Values for the Opcode field above */
121 ACPI_RSD_SOURCE_LABEL
,
123 } ACPI_RSDUMP_OPCODES
;
125 /* restore default alignment */
129 /* Resource tables indexed by internal resource type */
131 extern const u8 acpi_gbl_aml_resource_sizes
[];
132 extern const u8 acpi_gbl_aml_resource_serial_bus_sizes
[];
133 extern struct acpi_rsconvert_info
*acpi_gbl_set_resource_dispatch
[];
135 /* Resource tables indexed by raw AML resource descriptor type */
137 extern const u8 acpi_gbl_resource_struct_sizes
[];
138 extern const u8 acpi_gbl_resource_struct_serial_bus_sizes
[];
139 extern struct acpi_rsconvert_info
*acpi_gbl_get_resource_dispatch
[];
141 extern struct acpi_rsconvert_info
142 *acpi_gbl_convert_resource_serial_bus_dispatch
[];
144 struct acpi_vendor_walk_info
{
145 struct acpi_vendor_uuid
*uuid
;
146 struct acpi_buffer
*buffer
;
154 acpi_rs_create_resource_list(union acpi_operand_object
*aml_buffer
,
155 struct acpi_buffer
*output_buffer
);
158 acpi_rs_create_aml_resources(struct acpi_buffer
*resource_list
,
159 struct acpi_buffer
*output_buffer
);
162 acpi_rs_create_pci_routing_table(union acpi_operand_object
*package_object
,
163 struct acpi_buffer
*output_buffer
);
170 acpi_rs_get_prt_method_data(struct acpi_namespace_node
*node
,
171 struct acpi_buffer
*ret_buffer
);
174 acpi_rs_get_crs_method_data(struct acpi_namespace_node
*node
,
175 struct acpi_buffer
*ret_buffer
);
178 acpi_rs_get_prs_method_data(struct acpi_namespace_node
*node
,
179 struct acpi_buffer
*ret_buffer
);
182 acpi_rs_get_method_data(acpi_handle handle
,
183 const char *path
, struct acpi_buffer
*ret_buffer
);
186 acpi_rs_set_srs_method_data(struct acpi_namespace_node
*node
,
187 struct acpi_buffer
*ret_buffer
);
190 acpi_rs_get_aei_method_data(struct acpi_namespace_node
*node
,
191 struct acpi_buffer
*ret_buffer
);
197 acpi_rs_get_list_length(u8
*aml_buffer
,
198 u32 aml_buffer_length
, acpi_size
*size_needed
);
201 acpi_rs_get_aml_length(struct acpi_resource
*resource_list
,
202 acpi_size resource_list_size
, acpi_size
*size_needed
);
205 acpi_rs_get_pci_routing_table_length(union acpi_operand_object
*package_object
,
206 acpi_size
*buffer_size_needed
);
209 acpi_rs_convert_aml_to_resources(u8
* aml
,
211 u32 offset
, u8 resource_index
, void **context
);
214 acpi_rs_convert_resources_to_aml(struct acpi_resource
*resource
,
215 acpi_size aml_size_needed
, u8
* output_buffer
);
221 acpi_rs_set_address_common(union aml_resource
*aml
,
222 struct acpi_resource
*resource
);
225 acpi_rs_get_address_common(struct acpi_resource
*resource
,
226 union aml_resource
*aml
);
232 acpi_rs_convert_aml_to_resource(struct acpi_resource
*resource
,
233 union aml_resource
*aml
,
234 struct acpi_rsconvert_info
*info
);
237 acpi_rs_convert_resource_to_aml(struct acpi_resource
*resource
,
238 union aml_resource
*aml
,
239 struct acpi_rsconvert_info
*info
);
245 acpi_rs_move_data(void *destination
,
246 void *source
, u16 item_count
, u8 move_type
);
248 u8
acpi_rs_decode_bitmask(u16 mask
, u8
* list
);
250 u16
acpi_rs_encode_bitmask(u8
* list
, u8 count
);
253 acpi_rs_get_resource_source(acpi_rs_length resource_length
,
254 acpi_rs_length minimum_length
,
255 struct acpi_resource_source
*resource_source
,
256 union aml_resource
*aml
, char *string_ptr
);
259 acpi_rs_set_resource_source(union aml_resource
*aml
,
260 acpi_rs_length minimum_length
,
261 struct acpi_resource_source
*resource_source
);
264 acpi_rs_set_resource_header(u8 descriptor_type
,
265 acpi_rsdesc_size total_length
,
266 union aml_resource
*aml
);
269 acpi_rs_set_resource_length(acpi_rsdesc_size total_length
,
270 union aml_resource
*aml
);
273 * rsdump - Debugger support
276 void acpi_rs_dump_resource_list(struct acpi_resource
*resource
);
278 void acpi_rs_dump_irq_list(u8
*route_table
);
282 * Resource conversion tables
284 extern struct acpi_rsconvert_info acpi_rs_convert_dma
[];
285 extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf
[];
286 extern struct acpi_rsconvert_info acpi_rs_convert_io
[];
287 extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io
[];
288 extern struct acpi_rsconvert_info acpi_rs_convert_end_tag
[];
289 extern struct acpi_rsconvert_info acpi_rs_convert_memory24
[];
290 extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg
[];
291 extern struct acpi_rsconvert_info acpi_rs_convert_memory32
[];
292 extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32
[];
293 extern struct acpi_rsconvert_info acpi_rs_convert_address32
[];
294 extern struct acpi_rsconvert_info acpi_rs_convert_address16
[];
295 extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq
[];
296 extern struct acpi_rsconvert_info acpi_rs_convert_address64
[];
297 extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64
[];
298 extern struct acpi_rsconvert_info acpi_rs_convert_gpio
[];
299 extern struct acpi_rsconvert_info acpi_rs_convert_fixed_dma
[];
300 extern struct acpi_rsconvert_info acpi_rs_convert_csi2_serial_bus
[];
301 extern struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus
[];
302 extern struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus
[];
303 extern struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus
[];
304 extern struct acpi_rsconvert_info acpi_rs_convert_pin_function
[];
305 extern struct acpi_rsconvert_info acpi_rs_convert_pin_config
[];
306 extern struct acpi_rsconvert_info acpi_rs_convert_pin_group
[];
307 extern struct acpi_rsconvert_info acpi_rs_convert_pin_group_function
[];
308 extern struct acpi_rsconvert_info acpi_rs_convert_pin_group_config
[];
309 extern struct acpi_rsconvert_info acpi_rs_convert_clock_input
[];
311 /* These resources require separate get/set tables */
313 extern struct acpi_rsconvert_info acpi_rs_get_irq
[];
314 extern struct acpi_rsconvert_info acpi_rs_get_start_dpf
[];
315 extern struct acpi_rsconvert_info acpi_rs_get_vendor_small
[];
316 extern struct acpi_rsconvert_info acpi_rs_get_vendor_large
[];
318 extern struct acpi_rsconvert_info acpi_rs_set_irq
[];
319 extern struct acpi_rsconvert_info acpi_rs_set_start_dpf
[];
320 extern struct acpi_rsconvert_info acpi_rs_set_vendor
[];
322 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
326 extern struct acpi_rsdump_info
*acpi_gbl_dump_resource_dispatch
[];
327 extern struct acpi_rsdump_info
*acpi_gbl_dump_serial_bus_dispatch
[];
332 extern struct acpi_rsdump_info acpi_rs_dump_irq
[];
333 extern struct acpi_rsdump_info acpi_rs_dump_prt
[];
334 extern struct acpi_rsdump_info acpi_rs_dump_dma
[];
335 extern struct acpi_rsdump_info acpi_rs_dump_start_dpf
[];
336 extern struct acpi_rsdump_info acpi_rs_dump_end_dpf
[];
337 extern struct acpi_rsdump_info acpi_rs_dump_io
[];
338 extern struct acpi_rsdump_info acpi_rs_dump_io_flags
[];
339 extern struct acpi_rsdump_info acpi_rs_dump_fixed_io
[];
340 extern struct acpi_rsdump_info acpi_rs_dump_vendor
[];
341 extern struct acpi_rsdump_info acpi_rs_dump_end_tag
[];
342 extern struct acpi_rsdump_info acpi_rs_dump_memory24
[];
343 extern struct acpi_rsdump_info acpi_rs_dump_memory32
[];
344 extern struct acpi_rsdump_info acpi_rs_dump_memory_flags
[];
345 extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32
[];
346 extern struct acpi_rsdump_info acpi_rs_dump_address16
[];
347 extern struct acpi_rsdump_info acpi_rs_dump_address32
[];
348 extern struct acpi_rsdump_info acpi_rs_dump_address64
[];
349 extern struct acpi_rsdump_info acpi_rs_dump_ext_address64
[];
350 extern struct acpi_rsdump_info acpi_rs_dump_ext_irq
[];
351 extern struct acpi_rsdump_info acpi_rs_dump_generic_reg
[];
352 extern struct acpi_rsdump_info acpi_rs_dump_gpio
[];
353 extern struct acpi_rsdump_info acpi_rs_dump_pin_function
[];
354 extern struct acpi_rsdump_info acpi_rs_dump_fixed_dma
[];
355 extern struct acpi_rsdump_info acpi_rs_dump_common_serial_bus
[];
356 extern struct acpi_rsdump_info acpi_rs_dump_csi2_serial_bus
[];
357 extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus
[];
358 extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus
[];
359 extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus
[];
360 extern struct acpi_rsdump_info acpi_rs_dump_general_flags
[];
361 extern struct acpi_rsdump_info acpi_rs_dump_pin_config
[];
362 extern struct acpi_rsdump_info acpi_rs_dump_pin_group
[];
363 extern struct acpi_rsdump_info acpi_rs_dump_pin_group_function
[];
364 extern struct acpi_rsdump_info acpi_rs_dump_pin_group_config
[];
365 extern struct acpi_rsdump_info acpi_rs_dump_clock_input
[];
368 #endif /* __ACRESRC_H__ */