aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi/acresrc.h
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2005-09-30 19:03:00 -0400
committerLen Brown <len.brown@intel.com>2005-12-10 00:20:25 -0500
commit50eca3eb89d73d9f0aa070b126c7ee6a616016ab (patch)
treeb2d06d21b34b9bd17eea4c53cff1f3866fa1b21d /include/acpi/acresrc.h
parent3d5271f9883cba7b54762bc4fe027d4172f06db7 (diff)
[ACPI] ACPICA 20050930
Completed a major overhaul of the Resource Manager code - specifically, optimizations in the area of the AML/internal resource conversion code. The code has been optimized to simplify and eliminate duplicated code, CPU stack use has been decreased by optimizing function parameters and local variables, and naming conventions across the manager have been standardized for clarity and ease of maintenance (this includes function, parameter, variable, and struct/typedef names.) All Resource Manager dispatch and information tables have been moved to a single location for clarity and ease of maintenance. One new file was created, named "rsinfo.c". The ACPI return macros (return_ACPI_STATUS, etc.) have been modified to guarantee that the argument is not evaluated twice, making them less prone to macro side-effects. However, since there exists the possibility of additional stack use if a particular compiler cannot optimize them (such as in the debug generation case), the original macros are optionally available. Note that some invocations of the return_VALUE macro may now cause size mismatch warnings; the return_UINT8 and return_UINT32 macros are provided to eliminate these. (From Randy Dunlap) Implemented a new mechanism to enable debug tracing for individual control methods. A new external interface, acpi_debug_trace(), is provided to enable this mechanism. The intent is to allow the host OS to easily enable and disable tracing for problematic control methods. This interface can be easily exposed to a user or debugger interface if desired. See the file psxface.c for details. acpi_ut_callocate() will now return a valid pointer if a length of zero is specified - a length of one is used and a warning is issued. This matches the behavior of acpi_ut_allocate(). Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include/acpi/acresrc.h')
-rw-r--r--include/acpi/acresrc.h313
1 files changed, 207 insertions, 106 deletions
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index ce2cf72fd4c8..b66994e9e4ee 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -44,6 +44,51 @@
44#ifndef __ACRESRC_H__ 44#ifndef __ACRESRC_H__
45#define __ACRESRC_H__ 45#define __ACRESRC_H__
46 46
47/* Need the AML resource descriptor structs */
48
49#include "amlresrc.h"
50
51/*
52 * Resource dispatch and info tables
53 */
54struct acpi_resource_info {
55 u8 length_type;
56 u8 minimum_aml_resource_length;
57 u8 minimum_internal_struct_length;
58};
59
60/* Types for length_type above */
61
62#define ACPI_FIXED_LENGTH 0
63#define ACPI_VARIABLE_LENGTH 1
64#define ACPI_SMALL_VARIABLE_LENGTH 2
65
66/* Handlers */
67
68typedef acpi_status(*ACPI_SET_RESOURCE_HANDLER) (struct acpi_resource *
69 resource,
70 union aml_resource * aml);
71
72typedef acpi_status(*ACPI_GET_RESOURCE_HANDLER) (union aml_resource * aml,
73 u16 aml_resource_length,
74 struct acpi_resource *
75 resource);
76
77typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (union acpi_resource_data * data);
78
79/* Tables indexed by internal resource type */
80
81extern u8 acpi_gbl_aml_resource_sizes[];
82extern ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[];
83extern ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[];
84
85/* Tables indexed by raw AML resource descriptor type */
86
87extern struct acpi_resource_info acpi_gbl_sm_resource_info[];
88extern struct acpi_resource_info acpi_gbl_lg_resource_info[];
89extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[];
90extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[];
91
47/* 92/*
48 * Function prototypes called from Acpi* APIs 93 * Function prototypes called from Acpi* APIs
49 */ 94 */
@@ -66,12 +111,12 @@ acpi_status
66acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 111acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
67 112
68acpi_status 113acpi_status
69acpi_rs_create_resource_list(union acpi_operand_object *byte_stream_buffer, 114acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
70 struct acpi_buffer *output_buffer); 115 struct acpi_buffer *output_buffer);
71 116
72acpi_status 117acpi_status
73acpi_rs_create_byte_stream(struct acpi_resource *linked_list_buffer, 118acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
74 struct acpi_buffer *output_buffer); 119 struct acpi_buffer *output_buffer);
75 120
76acpi_status 121acpi_status
77acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, 122acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
@@ -90,184 +135,240 @@ void acpi_rs_dump_irq_list(u8 * route_table);
90 * rscalc 135 * rscalc
91 */ 136 */
92acpi_status 137acpi_status
93acpi_rs_get_byte_stream_start(u8 * byte_stream_buffer, 138acpi_rs_get_list_length(u8 * aml_buffer,
94 u8 ** byte_stream_start, u32 * size); 139 u32 aml_buffer_length, acpi_size * size_needed);
95
96acpi_status
97acpi_rs_get_list_length(u8 * byte_stream_buffer,
98 u32 byte_stream_buffer_length, acpi_size * size_needed);
99 140
100acpi_status 141acpi_status
101acpi_rs_get_byte_stream_length(struct acpi_resource *linked_list_buffer, 142acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer,
102 acpi_size * size_needed); 143 acpi_size * size_needed);
103 144
104acpi_status 145acpi_status
105acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, 146acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
106 acpi_size * buffer_size_needed); 147 acpi_size * buffer_size_needed);
107 148
108acpi_status 149acpi_status
109acpi_rs_byte_stream_to_list(u8 * byte_stream_buffer, 150acpi_rs_convert_aml_to_resources(u8 * aml_buffer,
110 u32 byte_stream_buffer_length, u8 * output_buffer); 151 u32 aml_buffer_length, u8 * output_buffer);
111 152
112acpi_status 153acpi_status
113acpi_rs_list_to_byte_stream(struct acpi_resource *resource, 154acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
114 acpi_size byte_stream_size_needed, 155 acpi_size aml_size_needed, u8 * output_buffer);
115 u8 * output_buffer);
116 156
157/*
158 * rsio
159 */
117acpi_status 160acpi_status
118acpi_rs_io_resource(u8 * byte_stream_buffer, 161acpi_rs_get_io(union aml_resource *aml,
119 acpi_size * bytes_consumed, 162 u16 aml_resource_length, struct acpi_resource *resource);
120 u8 ** output_buffer, acpi_size * structure_size);
121 163
122acpi_status 164acpi_status
123acpi_rs_fixed_io_resource(u8 * byte_stream_buffer, 165acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml);
124 acpi_size * bytes_consumed,
125 u8 ** output_buffer, acpi_size * structure_size);
126 166
127acpi_status 167acpi_status
128acpi_rs_io_stream(struct acpi_resource *resource, 168acpi_rs_get_fixed_io(union aml_resource *aml,
129 u8 ** output_buffer, acpi_size * bytes_consumed); 169 u16 aml_resource_length, struct acpi_resource *resource);
130 170
131acpi_status 171acpi_status
132acpi_rs_fixed_io_stream(struct acpi_resource *resource, 172acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml);
133 u8 ** output_buffer, acpi_size * bytes_consumed);
134 173
135acpi_status 174acpi_status
136acpi_rs_irq_resource(u8 * byte_stream_buffer, 175acpi_rs_get_dma(union aml_resource *aml,
137 acpi_size * bytes_consumed, 176 u16 aml_resource_length, struct acpi_resource *resource);
138 u8 ** output_buffer, acpi_size * structure_size);
139 177
140acpi_status 178acpi_status
141acpi_rs_irq_stream(struct acpi_resource *resource, 179acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml);
142 u8 ** output_buffer, acpi_size * bytes_consumed);
143 180
181/*
182 * rsirq
183 */
144acpi_status 184acpi_status
145acpi_rs_dma_resource(u8 * byte_stream_buffer, 185acpi_rs_get_irq(union aml_resource *aml,
146 acpi_size * bytes_consumed, 186 u16 aml_resource_length, struct acpi_resource *resource);
147 u8 ** output_buffer, acpi_size * structure_size);
148 187
149acpi_status 188acpi_status
150acpi_rs_dma_stream(struct acpi_resource *resource, 189acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml);
151 u8 ** output_buffer, acpi_size * bytes_consumed);
152 190
153acpi_status 191acpi_status
154acpi_rs_address16_resource(u8 * byte_stream_buffer, 192acpi_rs_get_ext_irq(union aml_resource *aml,
155 acpi_size * bytes_consumed, 193 u16 aml_resource_length, struct acpi_resource *resource);
156 u8 ** output_buffer, acpi_size * structure_size);
157 194
158acpi_status 195acpi_status
159acpi_rs_address16_stream(struct acpi_resource *resource, 196acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml);
160 u8 ** output_buffer, acpi_size * bytes_consumed); 197
198/*
199 * rsaddr
200 */
201acpi_status
202acpi_rs_get_address16(union aml_resource *aml,
203 u16 aml_resource_length, struct acpi_resource *resource);
161 204
162acpi_status 205acpi_status
163acpi_rs_address32_resource(u8 * byte_stream_buffer, 206acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml);
164 acpi_size * bytes_consumed,
165 u8 ** output_buffer, acpi_size * structure_size);
166 207
167acpi_status 208acpi_status
168acpi_rs_address32_stream(struct acpi_resource *resource, 209acpi_rs_get_address32(union aml_resource *aml,
169 u8 ** output_buffer, acpi_size * bytes_consumed); 210 u16 aml_resource_length, struct acpi_resource *resource);
170 211
171acpi_status 212acpi_status
172acpi_rs_address64_resource(u8 * byte_stream_buffer, 213acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml);
173 acpi_size * bytes_consumed,
174 u8 ** output_buffer, acpi_size * structure_size);
175 214
176acpi_status 215acpi_status
177acpi_rs_address64_stream(struct acpi_resource *resource, 216acpi_rs_get_address64(union aml_resource *aml,
178 u8 ** output_buffer, acpi_size * bytes_consumed); 217 u16 aml_resource_length, struct acpi_resource *resource);
179 218
180acpi_status 219acpi_status
181acpi_rs_start_depend_fns_resource(u8 * byte_stream_buffer, 220acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml);
182 acpi_size * bytes_consumed, 221
183 u8 ** output_buffer, 222acpi_status
184 acpi_size * structure_size); 223acpi_rs_get_ext_address64(union aml_resource *aml,
224 u16 aml_resource_length,
225 struct acpi_resource *resource);
226
227acpi_status
228acpi_rs_set_ext_address64(struct acpi_resource *resource,
229 union aml_resource *aml);
230
231/*
232 * rsmemory
233 */
234acpi_status
235acpi_rs_get_memory24(union aml_resource *aml,
236 u16 aml_resource_length, struct acpi_resource *resource);
185 237
186acpi_status 238acpi_status
187acpi_rs_end_depend_fns_resource(u8 * byte_stream_buffer, 239acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml);
188 acpi_size * bytes_consumed,
189 u8 ** output_buffer,
190 acpi_size * structure_size);
191 240
192acpi_status 241acpi_status
193acpi_rs_start_depend_fns_stream(struct acpi_resource *resource, 242acpi_rs_get_memory32(union aml_resource *aml,
194 u8 ** output_buffer, 243 u16 aml_resource_length, struct acpi_resource *resource);
195 acpi_size * bytes_consumed);
196 244
197acpi_status 245acpi_status
198acpi_rs_end_depend_fns_stream(struct acpi_resource *resource, 246acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml);
199 u8 ** output_buffer, acpi_size * bytes_consumed);
200 247
201acpi_status 248acpi_status
202acpi_rs_memory24_resource(u8 * byte_stream_buffer, 249acpi_rs_get_fixed_memory32(union aml_resource *aml,
203 acpi_size * bytes_consumed, 250 u16 aml_resource_length,
204 u8 ** output_buffer, acpi_size * structure_size); 251 struct acpi_resource *resource);
205 252
206acpi_status 253acpi_status
207acpi_rs_memory24_stream(struct acpi_resource *resource, 254acpi_rs_set_fixed_memory32(struct acpi_resource *resource,
208 u8 ** output_buffer, acpi_size * bytes_consumed); 255 union aml_resource *aml);
209 256
257/*
258 * rsmisc
259 */
210acpi_status 260acpi_status
211acpi_rs_memory32_range_resource(u8 * byte_stream_buffer, 261acpi_rs_get_generic_reg(union aml_resource *aml,
212 acpi_size * bytes_consumed, 262 u16 aml_resource_length,
213 u8 ** output_buffer, 263 struct acpi_resource *resource);
214 acpi_size * structure_size);
215 264
216acpi_status 265acpi_status
217acpi_rs_fixed_memory32_resource(u8 * byte_stream_buffer, 266acpi_rs_set_generic_reg(struct acpi_resource *resource,
218 acpi_size * bytes_consumed, 267 union aml_resource *aml);
219 u8 ** output_buffer,
220 acpi_size * structure_size);
221 268
222acpi_status 269acpi_status
223acpi_rs_memory32_range_stream(struct acpi_resource *resource, 270acpi_rs_get_vendor(union aml_resource *aml,
224 u8 ** output_buffer, acpi_size * bytes_consumed); 271 u16 aml_resource_length, struct acpi_resource *resource);
225 272
226acpi_status 273acpi_status
227acpi_rs_fixed_memory32_stream(struct acpi_resource *resource, 274acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml);
228 u8 ** output_buffer, acpi_size * bytes_consumed);
229 275
230acpi_status 276acpi_status
231acpi_rs_extended_irq_resource(u8 * byte_stream_buffer, 277acpi_rs_get_start_dpf(union aml_resource *aml,
232 acpi_size * bytes_consumed, 278 u16 aml_resource_length, struct acpi_resource *resource);
233 u8 ** output_buffer, acpi_size * structure_size);
234 279
235acpi_status 280acpi_status
236acpi_rs_extended_irq_stream(struct acpi_resource *resource, 281acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml);
237 u8 ** output_buffer, acpi_size * bytes_consumed);
238 282
239acpi_status 283acpi_status
240acpi_rs_end_tag_resource(u8 * byte_stream_buffer, 284acpi_rs_get_end_dpf(union aml_resource *aml,
241 acpi_size * bytes_consumed, 285 u16 aml_resource_length, struct acpi_resource *resource);
242 u8 ** output_buffer, acpi_size * structure_size);
243 286
244acpi_status 287acpi_status
245acpi_rs_end_tag_stream(struct acpi_resource *resource, 288acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml);
246 u8 ** output_buffer, acpi_size * bytes_consumed);
247 289
248acpi_status 290acpi_status
249acpi_rs_vendor_resource(u8 * byte_stream_buffer, 291acpi_rs_get_end_tag(union aml_resource *aml,
250 acpi_size * bytes_consumed, 292 u16 aml_resource_length, struct acpi_resource *resource);
251 u8 ** output_buffer, acpi_size * structure_size);
252 293
253acpi_status 294acpi_status
254acpi_rs_vendor_stream(struct acpi_resource *resource, 295acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml);
255 u8 ** output_buffer, acpi_size * bytes_consumed); 296
297/*
298 * rsutils
299 */
300void
301acpi_rs_move_data(void *destination,
302 void *source, u16 item_count, u8 move_type);
303
304/* Types used in move_type above */
305
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
310
311u16
312acpi_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);
316
317acpi_size
318acpi_rs_set_resource_source(union aml_resource *aml,
319 acpi_size minimum_length,
320 struct acpi_resource_source *resource_source);
256 321
257u8 acpi_rs_get_resource_type(u8 resource_start_byte); 322u8 acpi_rs_get_resource_type(u8 resource_start_byte);
258 323
324u32 acpi_rs_get_descriptor_length(union aml_resource *aml);
325
326u16 acpi_rs_get_resource_length(union aml_resource *aml);
327
328void
329acpi_rs_set_resource_header(u8 descriptor_type,
330 acpi_size total_length, union aml_resource *aml);
331
332struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type);
333
334#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
259/* 335/*
260 * rsmisc 336 * rsdump
261 */ 337 */
262acpi_status 338void acpi_rs_dump_irq(union acpi_resource_data *resource);
263acpi_rs_generic_register_resource(u8 * byte_stream_buffer,
264 acpi_size * bytes_consumed,
265 u8 ** output_buffer,
266 acpi_size * structure_size);
267 339
268acpi_status 340void acpi_rs_dump_address16(union acpi_resource_data *resource);
269acpi_rs_generic_register_stream(struct acpi_resource *resource, 341
270 u8 ** output_buffer, 342void acpi_rs_dump_address32(union acpi_resource_data *resource);
271 acpi_size * bytes_consumed); 343
344void acpi_rs_dump_address64(union acpi_resource_data *resource);
345
346void acpi_rs_dump_ext_address64(union acpi_resource_data *resource);
347
348void acpi_rs_dump_dma(union acpi_resource_data *resource);
349
350void acpi_rs_dump_io(union acpi_resource_data *resource);
351
352void acpi_rs_dump_ext_irq(union acpi_resource_data *resource);
353
354void acpi_rs_dump_fixed_io(union acpi_resource_data *resource);
355
356void acpi_rs_dump_fixed_memory32(union acpi_resource_data *resource);
357
358void acpi_rs_dump_memory24(union acpi_resource_data *resource);
359
360void acpi_rs_dump_memory32(union acpi_resource_data *resource);
361
362void acpi_rs_dump_start_dpf(union acpi_resource_data *resource);
363
364void acpi_rs_dump_vendor(union acpi_resource_data *resource);
365
366void acpi_rs_dump_generic_reg(union acpi_resource_data *resource);
367
368void acpi_rs_dump_end_dpf(union acpi_resource_data *resource);
369
370void acpi_rs_dump_end_tag(union acpi_resource_data *resource);
371
372#endif
272 373
273#endif /* __ACRESRC_H__ */ 374#endif /* __ACRESRC_H__ */