1 /******************************************************************************
3 * Name: acresrc.h - Resource Manager function prototypes
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2008, 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 */
76 #define ACPI_RSC_INITGET 0
77 #define ACPI_RSC_INITSET 1
78 #define ACPI_RSC_FLAGINIT 2
79 #define ACPI_RSC_1BITFLAG 3
80 #define ACPI_RSC_2BITFLAG 4
81 #define ACPI_RSC_COUNT 5
82 #define ACPI_RSC_COUNT16 6
83 #define ACPI_RSC_LENGTH 7
84 #define ACPI_RSC_MOVE8 8
85 #define ACPI_RSC_MOVE16 9
86 #define ACPI_RSC_MOVE32 10
87 #define ACPI_RSC_MOVE64 11
88 #define ACPI_RSC_SET8 12
89 #define ACPI_RSC_DATA8 13
90 #define ACPI_RSC_ADDRESS 14
91 #define ACPI_RSC_SOURCE 15
92 #define ACPI_RSC_SOURCEX 16
93 #define ACPI_RSC_BITMASK 17
94 #define ACPI_RSC_BITMASK16 18
95 #define ACPI_RSC_EXIT_NE 19
96 #define ACPI_RSC_EXIT_LE 20
97 #define ACPI_RSC_EXIT_EQ 21
99 /* Resource Conversion sub-opcodes */
101 #define ACPI_RSC_COMPARE_AML_LENGTH 0
102 #define ACPI_RSC_COMPARE_VALUE 1
104 #define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info))
106 #define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f)
107 #define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f)
109 typedef const struct acpi_rsdump_info {
113 const char **pointer;
117 /* Values for the Opcode field above */
119 #define ACPI_RSD_TITLE 0
120 #define ACPI_RSD_LITERAL 1
121 #define ACPI_RSD_STRING 2
122 #define ACPI_RSD_UINT8 3
123 #define ACPI_RSD_UINT16 4
124 #define ACPI_RSD_UINT32 5
125 #define ACPI_RSD_UINT64 6
126 #define ACPI_RSD_1BITFLAG 7
127 #define ACPI_RSD_2BITFLAG 8
128 #define ACPI_RSD_SHORTLIST 9
129 #define ACPI_RSD_LONGLIST 10
130 #define ACPI_RSD_DWORDLIST 11
131 #define ACPI_RSD_ADDRESS 12
132 #define ACPI_RSD_SOURCE 13
134 /* restore default alignment */
138 /* Resource tables indexed by internal resource type */
140 extern const u8 acpi_gbl_aml_resource_sizes[];
141 extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[];
143 /* Resource tables indexed by raw AML resource descriptor type */
145 extern const u8 acpi_gbl_resource_struct_sizes[];
146 extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[];
148 struct acpi_vendor_walk_info {
149 struct acpi_vendor_uuid *uuid;
150 struct acpi_buffer *buffer;
158 acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
159 struct acpi_buffer *output_buffer);
162 acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
163 struct acpi_buffer *output_buffer);
166 acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
167 struct acpi_buffer *output_buffer);
174 acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
175 struct acpi_buffer *ret_buffer);
178 acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
179 struct acpi_buffer *ret_buffer);
182 acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
183 struct acpi_buffer *ret_buffer);
186 acpi_rs_get_method_data(acpi_handle handle,
187 char *path, struct acpi_buffer *ret_buffer);
190 acpi_rs_set_srs_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 *linked_list_buffer,
202 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);
275 void acpi_rs_dump_resource_list(struct acpi_resource *resource);
277 void acpi_rs_dump_irq_list(u8 * route_table);
280 * Resource conversion tables
282 extern struct acpi_rsconvert_info acpi_rs_convert_dma[];
283 extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[];
284 extern struct acpi_rsconvert_info acpi_rs_convert_io[];
285 extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[];
286 extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[];
287 extern struct acpi_rsconvert_info acpi_rs_convert_memory24[];
288 extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[];
289 extern struct acpi_rsconvert_info acpi_rs_convert_memory32[];
290 extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[];
291 extern struct acpi_rsconvert_info acpi_rs_convert_address32[];
292 extern struct acpi_rsconvert_info acpi_rs_convert_address16[];
293 extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[];
294 extern struct acpi_rsconvert_info acpi_rs_convert_address64[];
295 extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[];
297 /* These resources require separate get/set tables */
299 extern struct acpi_rsconvert_info acpi_rs_get_irq[];
300 extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[];
301 extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[];
302 extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[];
304 extern struct acpi_rsconvert_info acpi_rs_set_irq[];
305 extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[];
306 extern struct acpi_rsconvert_info acpi_rs_set_vendor[];
308 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
312 extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
317 extern struct acpi_rsdump_info acpi_rs_dump_irq[];
318 extern struct acpi_rsdump_info acpi_rs_dump_dma[];
319 extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[];
320 extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[];
321 extern struct acpi_rsdump_info acpi_rs_dump_io[];
322 extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[];
323 extern struct acpi_rsdump_info acpi_rs_dump_vendor[];
324 extern struct acpi_rsdump_info acpi_rs_dump_end_tag[];
325 extern struct acpi_rsdump_info acpi_rs_dump_memory24[];
326 extern struct acpi_rsdump_info acpi_rs_dump_memory32[];
327 extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[];
328 extern struct acpi_rsdump_info acpi_rs_dump_address16[];
329 extern struct acpi_rsdump_info acpi_rs_dump_address32[];
330 extern struct acpi_rsdump_info acpi_rs_dump_address64[];
331 extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[];
332 extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[];
333 extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[];
336 #endif /* __ACRESRC_H__ */