1 /******************************************************************************
3 * Name: acresrc.h - Resource Manager function prototypes
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2005, R. Byron Moore
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 * Resource dispatch and info tables
54 struct acpi_resource_info {
56 u8 minimum_aml_resource_length;
57 u8 minimum_internal_struct_length;
60 /* Types for length_type above */
62 #define ACPI_FIXED_LENGTH 0
63 #define ACPI_VARIABLE_LENGTH 1
64 #define ACPI_SMALL_VARIABLE_LENGTH 2
68 typedef acpi_status(*ACPI_SET_RESOURCE_HANDLER) (struct acpi_resource *
70 union aml_resource * aml);
72 typedef acpi_status(*ACPI_GET_RESOURCE_HANDLER) (union aml_resource * aml,
73 u16 aml_resource_length,
74 struct acpi_resource *
77 typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (union acpi_resource_data * data);
79 /* Tables indexed by internal resource type */
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[];
85 /* Tables indexed by raw AML resource descriptor type */
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[];
93 * Function prototypes called from Acpi* APIs
96 acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
99 acpi_rs_get_crs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
101 #ifdef ACPI_FUTURE_USAGE
103 acpi_rs_get_prs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
104 #endif /* ACPI_FUTURE_USAGE */
107 acpi_rs_get_method_data(acpi_handle handle,
108 char *path, struct acpi_buffer *ret_buffer);
111 acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
114 acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
115 struct acpi_buffer *output_buffer);
118 acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
119 struct acpi_buffer *output_buffer);
122 acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
123 struct acpi_buffer *output_buffer);
128 #ifdef ACPI_FUTURE_USAGE
129 void acpi_rs_dump_resource_list(struct acpi_resource *resource);
131 void acpi_rs_dump_irq_list(u8 * route_table);
132 #endif /* ACPI_FUTURE_USAGE */
138 acpi_rs_get_list_length(u8 * aml_buffer,
139 u32 aml_buffer_length, acpi_size * size_needed);
142 acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer,
143 acpi_size * size_needed);
146 acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
147 acpi_size * buffer_size_needed);
150 acpi_rs_convert_aml_to_resources(u8 * aml_buffer,
151 u32 aml_buffer_length, u8 * output_buffer);
154 acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
155 acpi_size aml_size_needed, u8 * output_buffer);
161 acpi_rs_get_io(union aml_resource *aml,
162 u16 aml_resource_length, struct acpi_resource *resource);
165 acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml);
168 acpi_rs_get_fixed_io(union aml_resource *aml,
169 u16 aml_resource_length, struct acpi_resource *resource);
172 acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml);
175 acpi_rs_get_dma(union aml_resource *aml,
176 u16 aml_resource_length, struct acpi_resource *resource);
179 acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml);
185 acpi_rs_get_irq(union aml_resource *aml,
186 u16 aml_resource_length, struct acpi_resource *resource);
189 acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml);
192 acpi_rs_get_ext_irq(union aml_resource *aml,
193 u16 aml_resource_length, struct acpi_resource *resource);
196 acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml);
202 acpi_rs_get_address16(union aml_resource *aml,
203 u16 aml_resource_length, struct acpi_resource *resource);
206 acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml);
209 acpi_rs_get_address32(union aml_resource *aml,
210 u16 aml_resource_length, struct acpi_resource *resource);
213 acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml);
216 acpi_rs_get_address64(union aml_resource *aml,
217 u16 aml_resource_length, struct acpi_resource *resource);
220 acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml);
223 acpi_rs_get_ext_address64(union aml_resource *aml,
224 u16 aml_resource_length,
225 struct acpi_resource *resource);
228 acpi_rs_set_ext_address64(struct acpi_resource *resource,
229 union aml_resource *aml);
235 acpi_rs_get_memory24(union aml_resource *aml,
236 u16 aml_resource_length, struct acpi_resource *resource);
239 acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml);
242 acpi_rs_get_memory32(union aml_resource *aml,
243 u16 aml_resource_length, struct acpi_resource *resource);
246 acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml);
249 acpi_rs_get_fixed_memory32(union aml_resource *aml,
250 u16 aml_resource_length,
251 struct acpi_resource *resource);
254 acpi_rs_set_fixed_memory32(struct acpi_resource *resource,
255 union aml_resource *aml);
261 acpi_rs_get_generic_reg(union aml_resource *aml,
262 u16 aml_resource_length,
263 struct acpi_resource *resource);
266 acpi_rs_set_generic_reg(struct acpi_resource *resource,
267 union aml_resource *aml);
270 acpi_rs_get_vendor(union aml_resource *aml,
271 u16 aml_resource_length, struct acpi_resource *resource);
274 acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml);
277 acpi_rs_get_start_dpf(union aml_resource *aml,
278 u16 aml_resource_length, struct acpi_resource *resource);
281 acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml);
284 acpi_rs_get_end_dpf(union aml_resource *aml,
285 u16 aml_resource_length, struct acpi_resource *resource);
288 acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml);
291 acpi_rs_get_end_tag(union aml_resource *aml,
292 u16 aml_resource_length, struct acpi_resource *resource);
295 acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml);
301 acpi_rs_move_data(void *destination,
302 void *source, u16 item_count, u8 move_type);
304 /* Types used in move_type above */
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
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);
318 acpi_rs_set_resource_source(union aml_resource *aml,
319 acpi_size minimum_length,
320 struct acpi_resource_source *resource_source);
322 u8 acpi_rs_get_resource_type(u8 resource_start_byte);
324 u32 acpi_rs_get_descriptor_length(union aml_resource *aml);
326 u16 acpi_rs_get_resource_length(union aml_resource *aml);
329 acpi_rs_set_resource_header(u8 descriptor_type,
330 acpi_size total_length, union aml_resource *aml);
332 struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type);
334 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
338 void acpi_rs_dump_irq(union acpi_resource_data *resource);
340 void acpi_rs_dump_address16(union acpi_resource_data *resource);
342 void acpi_rs_dump_address32(union acpi_resource_data *resource);
344 void acpi_rs_dump_address64(union acpi_resource_data *resource);
346 void acpi_rs_dump_ext_address64(union acpi_resource_data *resource);
348 void acpi_rs_dump_dma(union acpi_resource_data *resource);
350 void acpi_rs_dump_io(union acpi_resource_data *resource);
352 void acpi_rs_dump_ext_irq(union acpi_resource_data *resource);
354 void acpi_rs_dump_fixed_io(union acpi_resource_data *resource);
356 void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource);
358 void acpi_rs_dump_memory24(union acpi_resource_data *resource);
360 void acpi_rs_dump_memory32(union acpi_resource_data *resource);
362 void acpi_rs_dump_start_dpf(union acpi_resource_data *resource);
364 void acpi_rs_dump_vendor(union acpi_resource_data *resource);
366 void acpi_rs_dump_generic_reg(union acpi_resource_data *resource);
368 void acpi_rs_dump_end_dpf(union acpi_resource_data *resource);
370 void acpi_rs_dump_end_tag(union acpi_resource_data *resource);
374 #endif /* __ACRESRC_H__ */