aboutsummaryrefslogtreecommitdiffstats
path: root/include/acpi/acresrc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/acpi/acresrc.h')
-rw-r--r--include/acpi/acresrc.h401
1 files changed, 184 insertions, 217 deletions
diff --git a/include/acpi/acresrc.h b/include/acpi/acresrc.h
index b66994e9e4ee..25cff0d5ba58 100644
--- a/include/acpi/acresrc.h
+++ b/include/acpi/acresrc.h
@@ -49,48 +49,132 @@
49#include "amlresrc.h" 49#include "amlresrc.h"
50 50
51/* 51/*
52 * If possible, pack the following structures to byte alignment, since we
53 * don't care about performance for debug output
54 */
55#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
56#pragma pack(1)
57#endif
58
59/*
60 * Individual entry for the resource conversion tables
61 */
62typedef const struct acpi_rsconvert_info {
63 u8 opcode;
64 u8 resource_offset;
65 u8 aml_offset;
66 u8 value;
67
68} acpi_rsconvert_info;
69
70/* Resource conversion opcodes */
71
72#define ACPI_RSC_INITGET 0
73#define ACPI_RSC_INITSET 1
74#define ACPI_RSC_FLAGINIT 2
75#define ACPI_RSC_1BITFLAG 3
76#define ACPI_RSC_2BITFLAG 4
77#define ACPI_RSC_COUNT 5
78#define ACPI_RSC_COUNT16 6
79#define ACPI_RSC_LENGTH 7
80#define ACPI_RSC_MOVE8 8
81#define ACPI_RSC_MOVE16 9
82#define ACPI_RSC_MOVE32 10
83#define ACPI_RSC_MOVE64 11
84#define ACPI_RSC_SET8 12
85#define ACPI_RSC_DATA8 13
86#define ACPI_RSC_ADDRESS 14
87#define ACPI_RSC_SOURCE 15
88#define ACPI_RSC_SOURCEX 16
89#define ACPI_RSC_BITMASK 17
90#define ACPI_RSC_BITMASK16 18
91#define ACPI_RSC_EXIT_NE 19
92#define ACPI_RSC_EXIT_LE 20
93
94/* Resource Conversion sub-opcodes */
95
96#define ACPI_RSC_COMPARE_AML_LENGTH 0
97#define ACPI_RSC_COMPARE_VALUE 1
98
99#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info))
100
101#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f)
102#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f)
103
104/*
52 * Resource dispatch and info tables 105 * Resource dispatch and info tables
53 */ 106 */
54struct acpi_resource_info { 107typedef const struct acpi_resource_info {
55 u8 length_type; 108 u8 length_type;
56 u8 minimum_aml_resource_length; 109 u8 minimum_aml_resource_length;
57 u8 minimum_internal_struct_length; 110 u8 minimum_internal_struct_length;
58}; 111
112} acpi_resource_info;
59 113
60/* Types for length_type above */ 114/* Types for length_type above */
61 115
62#define ACPI_FIXED_LENGTH 0 116#define ACPI_FIXED_LENGTH 0
63#define ACPI_VARIABLE_LENGTH 1 117#define ACPI_VARIABLE_LENGTH 1
64#define ACPI_SMALL_VARIABLE_LENGTH 2 118#define ACPI_SMALL_VARIABLE_LENGTH 2
119
120typedef const struct acpi_rsdump_info {
121 u8 opcode;
122 u8 offset;
123 char *name;
124 const void *pointer;
65 125
66/* Handlers */ 126} acpi_rsdump_info;
67 127
68typedef acpi_status(*ACPI_SET_RESOURCE_HANDLER) (struct acpi_resource * 128/* Values for the Opcode field above */
69 resource,
70 union aml_resource * aml);
71 129
72typedef acpi_status(*ACPI_GET_RESOURCE_HANDLER) (union aml_resource * aml, 130#define ACPI_RSD_TITLE 0
73 u16 aml_resource_length, 131#define ACPI_RSD_LITERAL 1
74 struct acpi_resource * 132#define ACPI_RSD_STRING 2
75 resource); 133#define ACPI_RSD_UINT8 3
134#define ACPI_RSD_UINT16 4
135#define ACPI_RSD_UINT32 5
136#define ACPI_RSD_UINT64 6
137#define ACPI_RSD_1BITFLAG 7
138#define ACPI_RSD_2BITFLAG 8
139#define ACPI_RSD_SHORTLIST 9
140#define ACPI_RSD_LONGLIST 10
141#define ACPI_RSD_DWORDLIST 11
142#define ACPI_RSD_ADDRESS 12
143#define ACPI_RSD_SOURCE 13
76 144
77typedef void (*ACPI_DUMP_RESOURCE_HANDLER) (union acpi_resource_data * data); 145/* restore default alignment */
78 146
79/* Tables indexed by internal resource type */ 147#pragma pack()
80 148
81extern u8 acpi_gbl_aml_resource_sizes[]; 149/* Resource tables indexed by internal resource type */
82extern ACPI_SET_RESOURCE_HANDLER acpi_gbl_set_resource_dispatch[];
83extern ACPI_DUMP_RESOURCE_HANDLER acpi_gbl_dump_resource_dispatch[];
84 150
85/* Tables indexed by raw AML resource descriptor type */ 151extern const u8 acpi_gbl_aml_resource_sizes[];
152extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[];
153
154/* Resource tables indexed by raw AML resource descriptor type */
86 155
87extern struct acpi_resource_info acpi_gbl_sm_resource_info[]; 156extern struct acpi_resource_info acpi_gbl_sm_resource_info[];
88extern struct acpi_resource_info acpi_gbl_lg_resource_info[]; 157extern struct acpi_resource_info acpi_gbl_lg_resource_info[];
89extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_sm_get_resource_dispatch[]; 158extern struct acpi_rsconvert_info *acpi_gbl_sm_get_resource_dispatch[];
90extern ACPI_GET_RESOURCE_HANDLER acpi_gbl_lg_get_resource_dispatch[]; 159extern struct acpi_rsconvert_info *acpi_gbl_lg_get_resource_dispatch[];
160
161/*
162 * rscreate
163 */
164acpi_status
165acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
166 struct acpi_buffer *output_buffer);
167
168acpi_status
169acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
170 struct acpi_buffer *output_buffer);
171
172acpi_status
173acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
174 struct acpi_buffer *output_buffer);
91 175
92/* 176/*
93 * Function prototypes called from Acpi* APIs 177 * rsutils
94 */ 178 */
95acpi_status 179acpi_status
96acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 180acpi_rs_get_prt_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
@@ -110,27 +194,6 @@ acpi_rs_get_method_data(acpi_handle handle,
110acpi_status 194acpi_status
111acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer); 195acpi_rs_set_srs_method_data(acpi_handle handle, struct acpi_buffer *ret_buffer);
112 196
113acpi_status
114acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
115 struct acpi_buffer *output_buffer);
116
117acpi_status
118acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer,
119 struct acpi_buffer *output_buffer);
120
121acpi_status
122acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
123 struct acpi_buffer *output_buffer);
124
125/*
126 * rsdump
127 */
128#ifdef ACPI_FUTURE_USAGE
129void acpi_rs_dump_resource_list(struct acpi_resource *resource);
130
131void acpi_rs_dump_irq_list(u8 * route_table);
132#endif /* ACPI_FUTURE_USAGE */
133
134/* 197/*
135 * rscalc 198 * rscalc
136 */ 199 */
@@ -155,144 +218,28 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
155 acpi_size aml_size_needed, u8 * output_buffer); 218 acpi_size aml_size_needed, u8 * output_buffer);
156 219
157/* 220/*
158 * rsio
159 */
160acpi_status
161acpi_rs_get_io(union aml_resource *aml,
162 u16 aml_resource_length, struct acpi_resource *resource);
163
164acpi_status
165acpi_rs_set_io(struct acpi_resource *resource, union aml_resource *aml);
166
167acpi_status
168acpi_rs_get_fixed_io(union aml_resource *aml,
169 u16 aml_resource_length, struct acpi_resource *resource);
170
171acpi_status
172acpi_rs_set_fixed_io(struct acpi_resource *resource, union aml_resource *aml);
173
174acpi_status
175acpi_rs_get_dma(union aml_resource *aml,
176 u16 aml_resource_length, struct acpi_resource *resource);
177
178acpi_status
179acpi_rs_set_dma(struct acpi_resource *resource, union aml_resource *aml);
180
181/*
182 * rsirq
183 */
184acpi_status
185acpi_rs_get_irq(union aml_resource *aml,
186 u16 aml_resource_length, struct acpi_resource *resource);
187
188acpi_status
189acpi_rs_set_irq(struct acpi_resource *resource, union aml_resource *aml);
190
191acpi_status
192acpi_rs_get_ext_irq(union aml_resource *aml,
193 u16 aml_resource_length, struct acpi_resource *resource);
194
195acpi_status
196acpi_rs_set_ext_irq(struct acpi_resource *resource, union aml_resource *aml);
197
198/*
199 * rsaddr 221 * rsaddr
200 */ 222 */
201acpi_status 223void
202acpi_rs_get_address16(union aml_resource *aml, 224acpi_rs_set_address_common(union aml_resource *aml,
203 u16 aml_resource_length, struct acpi_resource *resource);
204
205acpi_status
206acpi_rs_set_address16(struct acpi_resource *resource, union aml_resource *aml);
207
208acpi_status
209acpi_rs_get_address32(union aml_resource *aml,
210 u16 aml_resource_length, struct acpi_resource *resource);
211
212acpi_status
213acpi_rs_set_address32(struct acpi_resource *resource, union aml_resource *aml);
214
215acpi_status
216acpi_rs_get_address64(union aml_resource *aml,
217 u16 aml_resource_length, struct acpi_resource *resource);
218
219acpi_status
220acpi_rs_set_address64(struct acpi_resource *resource, union aml_resource *aml);
221
222acpi_status
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);
237
238acpi_status
239acpi_rs_set_memory24(struct acpi_resource *resource, union aml_resource *aml);
240
241acpi_status
242acpi_rs_get_memory32(union aml_resource *aml,
243 u16 aml_resource_length, struct acpi_resource *resource);
244
245acpi_status
246acpi_rs_set_memory32(struct acpi_resource *resource, union aml_resource *aml);
247
248acpi_status
249acpi_rs_get_fixed_memory32(union aml_resource *aml,
250 u16 aml_resource_length,
251 struct acpi_resource *resource); 225 struct acpi_resource *resource);
252 226
253acpi_status 227u8
254acpi_rs_set_fixed_memory32(struct acpi_resource *resource, 228acpi_rs_get_address_common(struct acpi_resource *resource,
255 union aml_resource *aml); 229 union aml_resource *aml);
256 230
257/* 231/*
258 * rsmisc 232 * rsmisc
259 */ 233 */
260acpi_status 234acpi_status
261acpi_rs_get_generic_reg(union aml_resource *aml, 235acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
262 u16 aml_resource_length, 236 union aml_resource *aml,
263 struct acpi_resource *resource); 237 struct acpi_rsconvert_info *info);
264
265acpi_status
266acpi_rs_set_generic_reg(struct acpi_resource *resource,
267 union aml_resource *aml);
268
269acpi_status
270acpi_rs_get_vendor(union aml_resource *aml,
271 u16 aml_resource_length, struct acpi_resource *resource);
272
273acpi_status
274acpi_rs_set_vendor(struct acpi_resource *resource, union aml_resource *aml);
275
276acpi_status
277acpi_rs_get_start_dpf(union aml_resource *aml,
278 u16 aml_resource_length, struct acpi_resource *resource);
279
280acpi_status
281acpi_rs_set_start_dpf(struct acpi_resource *resource, union aml_resource *aml);
282
283acpi_status
284acpi_rs_get_end_dpf(union aml_resource *aml,
285 u16 aml_resource_length, struct acpi_resource *resource);
286
287acpi_status
288acpi_rs_set_end_dpf(struct acpi_resource *resource, union aml_resource *aml);
289 238
290acpi_status 239acpi_status
291acpi_rs_get_end_tag(union aml_resource *aml, 240acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
292 u16 aml_resource_length, struct acpi_resource *resource); 241 union aml_resource *aml,
293 242 struct acpi_rsconvert_info *info);
294acpi_status
295acpi_rs_set_end_tag(struct acpi_resource *resource, union aml_resource *aml);
296 243
297/* 244/*
298 * rsutils 245 * rsutils
@@ -301,74 +248,94 @@ void
301acpi_rs_move_data(void *destination, 248acpi_rs_move_data(void *destination,
302 void *source, u16 item_count, u8 move_type); 249 void *source, u16 item_count, u8 move_type);
303 250
304/* Types used in move_type above */ 251u8 acpi_rs_decode_bitmask(u16 mask, u8 * list);
305 252
306#define ACPI_MOVE_TYPE_16_TO_32 0 253u16 acpi_rs_encode_bitmask(u8 * list, u8 count);
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 254
311u16 255acpi_rs_length
312acpi_rs_get_resource_source(u16 resource_length, 256acpi_rs_get_resource_source(acpi_rs_length resource_length,
313 acpi_size minimum_length, 257 acpi_rs_length minimum_length,
314 struct acpi_resource_source *resource_source, 258 struct acpi_resource_source *resource_source,
315 union aml_resource *aml, char *string_ptr); 259 union aml_resource *aml, char *string_ptr);
316 260
317acpi_size 261acpi_rsdesc_size
318acpi_rs_set_resource_source(union aml_resource *aml, 262acpi_rs_set_resource_source(union aml_resource *aml,
319 acpi_size minimum_length, 263 acpi_rs_length minimum_length,
320 struct acpi_resource_source *resource_source); 264 struct acpi_resource_source *resource_source);
321 265
322u8 acpi_rs_get_resource_type(u8 resource_start_byte);
323
324u32 acpi_rs_get_descriptor_length(union aml_resource *aml);
325
326u16 acpi_rs_get_resource_length(union aml_resource *aml);
327
328void 266void
329acpi_rs_set_resource_header(u8 descriptor_type, 267acpi_rs_set_resource_header(u8 descriptor_type,
330 acpi_size total_length, union aml_resource *aml); 268 acpi_rsdesc_size total_length,
269 union aml_resource *aml);
270
271void
272acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
273 union aml_resource *aml);
331 274
332struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type); 275struct acpi_resource_info *acpi_rs_get_resource_info(u8 resource_type);
333 276
334#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
335/* 277/*
336 * rsdump 278 * rsdump
337 */ 279 */
338void acpi_rs_dump_irq(union acpi_resource_data *resource); 280void acpi_rs_dump_resource_list(struct acpi_resource *resource);
339
340void acpi_rs_dump_address16(union acpi_resource_data *resource);
341
342void acpi_rs_dump_address32(union acpi_resource_data *resource);
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 281
366void acpi_rs_dump_generic_reg(union acpi_resource_data *resource); 282void acpi_rs_dump_irq_list(u8 * route_table);
367 283
368void acpi_rs_dump_end_dpf(union acpi_resource_data *resource); 284/*
285 * Resource conversion tables
286 */
287extern struct acpi_rsconvert_info acpi_rs_convert_dma[];
288extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[];
289extern struct acpi_rsconvert_info acpi_rs_convert_io[];
290extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[];
291extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[];
292extern struct acpi_rsconvert_info acpi_rs_convert_memory24[];
293extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[];
294extern struct acpi_rsconvert_info acpi_rs_convert_memory32[];
295extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[];
296extern struct acpi_rsconvert_info acpi_rs_convert_address32[];
297extern struct acpi_rsconvert_info acpi_rs_convert_address16[];
298extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[];
299extern struct acpi_rsconvert_info acpi_rs_convert_address64[];
300extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[];
301
302/* These resources require separate get/set tables */
303
304extern struct acpi_rsconvert_info acpi_rs_get_irq[];
305extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[];
306extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[];
307extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[];
308
309extern struct acpi_rsconvert_info acpi_rs_set_irq[];
310extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[];
311extern struct acpi_rsconvert_info acpi_rs_set_vendor[];
369 312
370void acpi_rs_dump_end_tag(union acpi_resource_data *resource); 313#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
314/*
315 * rsinfo
316 */
317extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
371 318
319/*
320 * rsdump
321 */
322extern struct acpi_rsdump_info acpi_rs_dump_irq[];
323extern struct acpi_rsdump_info acpi_rs_dump_dma[];
324extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[];
325extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[];
326extern struct acpi_rsdump_info acpi_rs_dump_io[];
327extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[];
328extern struct acpi_rsdump_info acpi_rs_dump_vendor[];
329extern struct acpi_rsdump_info acpi_rs_dump_end_tag[];
330extern struct acpi_rsdump_info acpi_rs_dump_memory24[];
331extern struct acpi_rsdump_info acpi_rs_dump_memory32[];
332extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[];
333extern struct acpi_rsdump_info acpi_rs_dump_address16[];
334extern struct acpi_rsdump_info acpi_rs_dump_address32[];
335extern struct acpi_rsdump_info acpi_rs_dump_address64[];
336extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[];
337extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[];
338extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[];
372#endif 339#endif
373 340
374#endif /* __ACRESRC_H__ */ 341#endif /* __ACRESRC_H__ */