Linux 2.6.20.7
[linux/fpc-iii.git] / drivers / acpi / resources / rsdump.c
blob9c99a723a860da348f507e162404eca9fe8ed693
1 /*******************************************************************************
3 * Module Name: rsdump - Functions to display the resource structures.
5 ******************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2006, R. Byron Moore
9 * All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
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.
30 * NO WARRANTY
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.
44 #include <acpi/acpi.h>
45 #include <acpi/acresrc.h>
47 #define _COMPONENT ACPI_RESOURCES
48 ACPI_MODULE_NAME("rsdump")
50 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
51 /* Local prototypes */
52 static void acpi_rs_out_string(char *title, char *value);
54 static void acpi_rs_out_integer8(char *title, u8 value);
56 static void acpi_rs_out_integer16(char *title, u16 value);
58 static void acpi_rs_out_integer32(char *title, u32 value);
60 static void acpi_rs_out_integer64(char *title, u64 value);
62 static void acpi_rs_out_title(char *title);
64 static void acpi_rs_dump_byte_list(u16 length, u8 * data);
66 static void acpi_rs_dump_dword_list(u8 length, u32 * data);
68 static void acpi_rs_dump_short_byte_list(u8 length, u8 * data);
70 static void
71 acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source);
73 static void acpi_rs_dump_address_common(union acpi_resource_data *resource);
75 static void
76 acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table);
78 #define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f)
79 #define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f)
80 #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info))
82 /*******************************************************************************
84 * Resource Descriptor info tables
86 * Note: The first table entry must be a Title or Literal and must contain
87 * the table length (number of table entries)
89 ******************************************************************************/
91 struct acpi_rsdump_info acpi_rs_dump_irq[6] = {
92 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL},
93 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering",
94 acpi_gbl_he_decode},
95 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity",
96 acpi_gbl_ll_decode},
97 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing",
98 acpi_gbl_shr_decode},
99 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count),
100 "Interrupt Count", NULL},
101 {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]),
102 "Interrupt List", NULL}
105 struct acpi_rsdump_info acpi_rs_dump_dma[6] = {
106 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL},
107 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed",
108 acpi_gbl_typ_decode},
109 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering",
110 acpi_gbl_bm_decode},
111 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type",
112 acpi_gbl_siz_decode},
113 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count",
114 NULL},
115 {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List",
116 NULL}
119 struct acpi_rsdump_info acpi_rs_dump_start_dpf[3] = {
120 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf),
121 "Start-Dependent-Functions", NULL},
122 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority),
123 "Compatibility Priority", acpi_gbl_config_decode},
124 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness),
125 "Performance/Robustness", acpi_gbl_config_decode}
128 struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = {
129 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf),
130 "End-Dependent-Functions", NULL}
133 struct acpi_rsdump_info acpi_rs_dump_io[6] = {
134 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL},
135 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding",
136 acpi_gbl_io_decode},
137 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL},
138 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL},
139 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL},
140 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length",
141 NULL}
144 struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = {
145 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io),
146 "Fixed I/O", NULL},
147 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL},
148 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length),
149 "Address Length", NULL}
152 struct acpi_rsdump_info acpi_rs_dump_vendor[3] = {
153 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor),
154 "Vendor Specific", NULL},
155 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL},
156 {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data",
157 NULL}
160 struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = {
161 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag",
162 NULL}
165 struct acpi_rsdump_info acpi_rs_dump_memory24[6] = {
166 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24),
167 "24-Bit Memory Range", NULL},
168 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect),
169 "Write Protect", acpi_gbl_rw_decode},
170 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum",
171 NULL},
172 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum",
173 NULL},
174 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment",
175 NULL},
176 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length),
177 "Address Length", NULL}
180 struct acpi_rsdump_info acpi_rs_dump_memory32[6] = {
181 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32),
182 "32-Bit Memory Range", NULL},
183 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect),
184 "Write Protect", acpi_gbl_rw_decode},
185 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum",
186 NULL},
187 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum",
188 NULL},
189 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment",
190 NULL},
191 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length),
192 "Address Length", NULL}
195 struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = {
196 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32),
197 "32-Bit Fixed Memory Range", NULL},
198 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect),
199 "Write Protect", acpi_gbl_rw_decode},
200 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address",
201 NULL},
202 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length),
203 "Address Length", NULL}
206 struct acpi_rsdump_info acpi_rs_dump_address16[8] = {
207 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16),
208 "16-Bit WORD Address Space", NULL},
209 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
210 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity",
211 NULL},
212 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum",
213 NULL},
214 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum",
215 NULL},
216 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset),
217 "Translation Offset", NULL},
218 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length),
219 "Address Length", NULL},
220 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL}
223 struct acpi_rsdump_info acpi_rs_dump_address32[8] = {
224 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32),
225 "32-Bit DWORD Address Space", NULL},
226 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
227 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity",
228 NULL},
229 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum",
230 NULL},
231 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum",
232 NULL},
233 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset),
234 "Translation Offset", NULL},
235 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length),
236 "Address Length", NULL},
237 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL}
240 struct acpi_rsdump_info acpi_rs_dump_address64[8] = {
241 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64),
242 "64-Bit QWORD Address Space", NULL},
243 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
244 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity",
245 NULL},
246 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum",
247 NULL},
248 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum",
249 NULL},
250 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset),
251 "Translation Offset", NULL},
252 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length),
253 "Address Length", NULL},
254 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL}
257 struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = {
258 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64),
259 "64-Bit Extended Address Space", NULL},
260 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
261 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity),
262 "Granularity", NULL},
263 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum),
264 "Address Minimum", NULL},
265 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum),
266 "Address Maximum", NULL},
267 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset),
268 "Translation Offset", NULL},
269 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length),
270 "Address Length", NULL},
271 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific),
272 "Type-Specific Attribute", NULL}
275 struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = {
276 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq),
277 "Extended IRQ", NULL},
278 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer),
279 "Type", acpi_gbl_consume_decode},
280 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering),
281 "Triggering", acpi_gbl_he_decode},
282 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity",
283 acpi_gbl_ll_decode},
284 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing",
285 acpi_gbl_shr_decode},
286 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL,
287 NULL},
288 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count),
289 "Interrupt Count", NULL},
290 {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]),
291 "Interrupt List", NULL}
294 struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = {
295 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg),
296 "Generic Register", NULL},
297 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID",
298 NULL},
299 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width",
300 NULL},
301 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset",
302 NULL},
303 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size),
304 "Access Size", NULL},
305 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL}
309 * Tables used for common address descriptor flag fields
311 static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = {
312 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL,
313 NULL},
314 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer),
315 "Consumer/Producer", acpi_gbl_consume_decode},
316 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode",
317 acpi_gbl_dec_decode},
318 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed),
319 "Min Relocatability", acpi_gbl_min_decode},
320 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed),
321 "Max Relocatability", acpi_gbl_max_decode}
324 static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
325 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags),
326 "Resource Type", (void *)"Memory Range"},
327 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect),
328 "Write Protect", acpi_gbl_rw_decode},
329 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching),
330 "Caching", acpi_gbl_mem_decode},
331 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type),
332 "Range Type", acpi_gbl_mtp_decode},
333 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation),
334 "Translation", acpi_gbl_ttp_decode}
337 static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = {
338 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags),
339 "Resource Type", (void *)"I/O Range"},
340 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type),
341 "Range Type", acpi_gbl_rng_decode},
342 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation),
343 "Translation", acpi_gbl_ttp_decode},
344 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type),
345 "Translation Type", acpi_gbl_trs_decode}
349 * Table used to dump _PRT contents
351 static struct acpi_rsdump_info acpi_rs_dump_prt[5] = {
352 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL},
353 {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL},
354 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL},
355 {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL},
356 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL}
359 /*******************************************************************************
361 * FUNCTION: acpi_rs_dump_descriptor
363 * PARAMETERS: Resource
365 * RETURN: None
367 * DESCRIPTION:
369 ******************************************************************************/
371 static void
372 acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
374 u8 *target = NULL;
375 u8 *previous_target;
376 char *name;
377 u8 count;
379 /* First table entry must contain the table length (# of table entries) */
381 count = table->offset;
383 while (count) {
384 previous_target = target;
385 target = ACPI_ADD_PTR(u8, resource, table->offset);
386 name = table->name;
388 switch (table->opcode) {
389 case ACPI_RSD_TITLE:
391 * Optional resource title
393 if (table->name) {
394 acpi_os_printf("%s Resource\n", name);
396 break;
398 /* Strings */
400 case ACPI_RSD_LITERAL:
401 acpi_rs_out_string(name,
402 ACPI_CAST_PTR(char, table->pointer));
403 break;
405 case ACPI_RSD_STRING:
406 acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
407 break;
409 /* Data items, 8/16/32/64 bit */
411 case ACPI_RSD_UINT8:
412 acpi_rs_out_integer8(name, ACPI_GET8(target));
413 break;
415 case ACPI_RSD_UINT16:
416 acpi_rs_out_integer16(name, ACPI_GET16(target));
417 break;
419 case ACPI_RSD_UINT32:
420 acpi_rs_out_integer32(name, ACPI_GET32(target));
421 break;
423 case ACPI_RSD_UINT64:
424 acpi_rs_out_integer64(name, ACPI_GET64(target));
425 break;
427 /* Flags: 1-bit and 2-bit flags supported */
429 case ACPI_RSD_1BITFLAG:
430 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
431 table->
432 pointer[*target &
433 0x01]));
434 break;
436 case ACPI_RSD_2BITFLAG:
437 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
438 table->
439 pointer[*target &
440 0x03]));
441 break;
443 case ACPI_RSD_SHORTLIST:
445 * Short byte list (single line output) for DMA and IRQ resources
446 * Note: The list length is obtained from the previous table entry
448 if (previous_target) {
449 acpi_rs_out_title(name);
450 acpi_rs_dump_short_byte_list(*previous_target,
451 target);
453 break;
455 case ACPI_RSD_LONGLIST:
457 * Long byte list for Vendor resource data
458 * Note: The list length is obtained from the previous table entry
460 if (previous_target) {
461 acpi_rs_dump_byte_list(ACPI_GET16
462 (previous_target),
463 target);
465 break;
467 case ACPI_RSD_DWORDLIST:
469 * Dword list for Extended Interrupt resources
470 * Note: The list length is obtained from the previous table entry
472 if (previous_target) {
473 acpi_rs_dump_dword_list(*previous_target,
474 ACPI_CAST_PTR(u32,
475 target));
477 break;
479 case ACPI_RSD_ADDRESS:
481 * Common flags for all Address resources
483 acpi_rs_dump_address_common(ACPI_CAST_PTR
484 (union acpi_resource_data,
485 target));
486 break;
488 case ACPI_RSD_SOURCE:
490 * Optional resource_source for Address resources
492 acpi_rs_dump_resource_source(ACPI_CAST_PTR
493 (struct
494 acpi_resource_source,
495 target));
496 break;
498 default:
499 acpi_os_printf("**** Invalid table opcode [%X] ****\n",
500 table->opcode);
501 return;
504 table++;
505 count--;
509 /*******************************************************************************
511 * FUNCTION: acpi_rs_dump_resource_source
513 * PARAMETERS: resource_source - Pointer to a Resource Source struct
515 * RETURN: None
517 * DESCRIPTION: Common routine for dumping the optional resource_source and the
518 * corresponding resource_source_index.
520 ******************************************************************************/
522 static void
523 acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
525 ACPI_FUNCTION_ENTRY();
527 if (resource_source->index == 0xFF) {
528 return;
531 acpi_rs_out_integer8("Resource Source Index", resource_source->index);
533 acpi_rs_out_string("Resource Source",
534 resource_source->string_ptr ?
535 resource_source->string_ptr : "[Not Specified]");
538 /*******************************************************************************
540 * FUNCTION: acpi_rs_dump_address_common
542 * PARAMETERS: Resource - Pointer to an internal resource descriptor
544 * RETURN: None
546 * DESCRIPTION: Dump the fields that are common to all Address resource
547 * descriptors
549 ******************************************************************************/
551 static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
553 ACPI_FUNCTION_ENTRY();
555 /* Decode the type-specific flags */
557 switch (resource->address.resource_type) {
558 case ACPI_MEMORY_RANGE:
560 acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags);
561 break;
563 case ACPI_IO_RANGE:
565 acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags);
566 break;
568 case ACPI_BUS_NUMBER_RANGE:
570 acpi_rs_out_string("Resource Type", "Bus Number Range");
571 break;
573 default:
575 acpi_rs_out_integer8("Resource Type",
576 (u8) resource->address.resource_type);
577 break;
580 /* Decode the general flags */
582 acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags);
585 /*******************************************************************************
587 * FUNCTION: acpi_rs_dump_resource_list
589 * PARAMETERS: resource_list - Pointer to a resource descriptor list
591 * RETURN: None
593 * DESCRIPTION: Dispatches the structure to the correct dump routine.
595 ******************************************************************************/
597 void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
599 u32 count = 0;
600 u32 type;
602 ACPI_FUNCTION_ENTRY();
604 if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
605 || !(_COMPONENT & acpi_dbg_layer)) {
606 return;
609 /* Walk list and dump all resource descriptors (END_TAG terminates) */
611 do {
612 acpi_os_printf("\n[%02X] ", count);
613 count++;
615 /* Validate Type before dispatch */
617 type = resource_list->type;
618 if (type > ACPI_RESOURCE_TYPE_MAX) {
619 acpi_os_printf
620 ("Invalid descriptor type (%X) in resource list\n",
621 resource_list->type);
622 return;
625 /* Dump the resource descriptor */
627 acpi_rs_dump_descriptor(&resource_list->data,
628 acpi_gbl_dump_resource_dispatch[type]);
630 /* Point to the next resource structure */
632 resource_list =
633 ACPI_ADD_PTR(struct acpi_resource, resource_list,
634 resource_list->length);
636 /* Exit when END_TAG descriptor is reached */
638 } while (type != ACPI_RESOURCE_TYPE_END_TAG);
641 /*******************************************************************************
643 * FUNCTION: acpi_rs_dump_irq_list
645 * PARAMETERS: route_table - Pointer to the routing table to dump.
647 * RETURN: None
649 * DESCRIPTION: Print IRQ routing table
651 ******************************************************************************/
653 void acpi_rs_dump_irq_list(u8 * route_table)
655 struct acpi_pci_routing_table *prt_element;
656 u8 count;
658 ACPI_FUNCTION_ENTRY();
660 if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
661 || !(_COMPONENT & acpi_dbg_layer)) {
662 return;
665 prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table);
667 /* Dump all table elements, Exit on zero length element */
669 for (count = 0; prt_element->length; count++) {
670 acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
671 count);
672 acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt);
674 prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table,
675 prt_element, prt_element->length);
679 /*******************************************************************************
681 * FUNCTION: acpi_rs_out*
683 * PARAMETERS: Title - Name of the resource field
684 * Value - Value of the resource field
686 * RETURN: None
688 * DESCRIPTION: Miscellaneous helper functions to consistently format the
689 * output of the resource dump routines
691 ******************************************************************************/
693 static void acpi_rs_out_string(char *title, char *value)
695 acpi_os_printf("%27s : %s", title, value);
696 if (!*value) {
697 acpi_os_printf("[NULL NAMESTRING]");
699 acpi_os_printf("\n");
702 static void acpi_rs_out_integer8(char *title, u8 value)
704 acpi_os_printf("%27s : %2.2X\n", title, value);
707 static void acpi_rs_out_integer16(char *title, u16 value)
709 acpi_os_printf("%27s : %4.4X\n", title, value);
712 static void acpi_rs_out_integer32(char *title, u32 value)
714 acpi_os_printf("%27s : %8.8X\n", title, value);
717 static void acpi_rs_out_integer64(char *title, u64 value)
719 acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
722 static void acpi_rs_out_title(char *title)
724 acpi_os_printf("%27s : ", title);
727 /*******************************************************************************
729 * FUNCTION: acpi_rs_dump*List
731 * PARAMETERS: Length - Number of elements in the list
732 * Data - Start of the list
734 * RETURN: None
736 * DESCRIPTION: Miscellaneous functions to dump lists of raw data
738 ******************************************************************************/
740 static void acpi_rs_dump_byte_list(u16 length, u8 * data)
742 u8 i;
744 for (i = 0; i < length; i++) {
745 acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]);
749 static void acpi_rs_dump_short_byte_list(u8 length, u8 * data)
751 u8 i;
753 for (i = 0; i < length; i++) {
754 acpi_os_printf("%X ", data[i]);
756 acpi_os_printf("\n");
759 static void acpi_rs_dump_dword_list(u8 length, u32 * data)
761 u8 i;
763 for (i = 0; i < length; i++) {
764 acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]);
768 #endif