[ARM] pxa: Gumstix Verdex PCMCIA support
[linux-2.6/verdex.git] / drivers / acpi / acpica / rsdump.c
blob3f0ca5a12d345f870cd7c9d3adddce5c6e9f5fae
1 /*******************************************************************************
3 * Module Name: rsdump - Functions to display the resource structures.
5 ******************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2008, Intel Corp.
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 "accommon.h"
46 #include "acresrc.h"
48 #define _COMPONENT ACPI_RESOURCES
49 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[7] = {
92 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL},
93 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.descriptor_length),
94 "Descriptor Length", NULL},
95 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering",
96 acpi_gbl_he_decode},
97 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity",
98 acpi_gbl_ll_decode},
99 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing",
100 acpi_gbl_shr_decode},
101 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count),
102 "Interrupt Count", NULL},
103 {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]),
104 "Interrupt List", NULL}
107 struct acpi_rsdump_info acpi_rs_dump_dma[6] = {
108 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL},
109 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed",
110 acpi_gbl_typ_decode},
111 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering",
112 acpi_gbl_bm_decode},
113 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type",
114 acpi_gbl_siz_decode},
115 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count",
116 NULL},
117 {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List",
118 NULL}
121 struct acpi_rsdump_info acpi_rs_dump_start_dpf[4] = {
122 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf),
123 "Start-Dependent-Functions", NULL},
124 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(start_dpf.descriptor_length),
125 "Descriptor Length", NULL},
126 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority),
127 "Compatibility Priority", acpi_gbl_config_decode},
128 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness),
129 "Performance/Robustness", acpi_gbl_config_decode}
132 struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = {
133 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf),
134 "End-Dependent-Functions", NULL}
137 struct acpi_rsdump_info acpi_rs_dump_io[6] = {
138 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL},
139 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding",
140 acpi_gbl_io_decode},
141 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL},
142 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL},
143 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL},
144 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length",
145 NULL}
148 struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = {
149 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io),
150 "Fixed I/O", NULL},
151 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL},
152 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length),
153 "Address Length", NULL}
156 struct acpi_rsdump_info acpi_rs_dump_vendor[3] = {
157 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor),
158 "Vendor Specific", NULL},
159 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL},
160 {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data",
161 NULL}
164 struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = {
165 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag",
166 NULL}
169 struct acpi_rsdump_info acpi_rs_dump_memory24[6] = {
170 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24),
171 "24-Bit Memory Range", NULL},
172 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect),
173 "Write Protect", acpi_gbl_rw_decode},
174 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum",
175 NULL},
176 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum",
177 NULL},
178 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment",
179 NULL},
180 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length),
181 "Address Length", NULL}
184 struct acpi_rsdump_info acpi_rs_dump_memory32[6] = {
185 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32),
186 "32-Bit Memory Range", NULL},
187 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect),
188 "Write Protect", acpi_gbl_rw_decode},
189 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum",
190 NULL},
191 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum",
192 NULL},
193 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment",
194 NULL},
195 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length),
196 "Address Length", NULL}
199 struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = {
200 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32),
201 "32-Bit Fixed Memory Range", NULL},
202 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect),
203 "Write Protect", acpi_gbl_rw_decode},
204 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address",
205 NULL},
206 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length),
207 "Address Length", NULL}
210 struct acpi_rsdump_info acpi_rs_dump_address16[8] = {
211 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16),
212 "16-Bit WORD Address Space", NULL},
213 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
214 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity",
215 NULL},
216 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum",
217 NULL},
218 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum",
219 NULL},
220 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset),
221 "Translation Offset", NULL},
222 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length),
223 "Address Length", NULL},
224 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL}
227 struct acpi_rsdump_info acpi_rs_dump_address32[8] = {
228 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32),
229 "32-Bit DWORD Address Space", NULL},
230 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
231 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity",
232 NULL},
233 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum",
234 NULL},
235 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum",
236 NULL},
237 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset),
238 "Translation Offset", NULL},
239 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length),
240 "Address Length", NULL},
241 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL}
244 struct acpi_rsdump_info acpi_rs_dump_address64[8] = {
245 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64),
246 "64-Bit QWORD Address Space", NULL},
247 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
248 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity",
249 NULL},
250 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum",
251 NULL},
252 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum",
253 NULL},
254 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset),
255 "Translation Offset", NULL},
256 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length),
257 "Address Length", NULL},
258 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL}
261 struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = {
262 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64),
263 "64-Bit Extended Address Space", NULL},
264 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
265 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity),
266 "Granularity", NULL},
267 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum),
268 "Address Minimum", NULL},
269 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum),
270 "Address Maximum", NULL},
271 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset),
272 "Translation Offset", NULL},
273 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length),
274 "Address Length", NULL},
275 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific),
276 "Type-Specific Attribute", NULL}
279 struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = {
280 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq),
281 "Extended IRQ", NULL},
282 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer),
283 "Type", acpi_gbl_consume_decode},
284 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering),
285 "Triggering", acpi_gbl_he_decode},
286 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity",
287 acpi_gbl_ll_decode},
288 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing",
289 acpi_gbl_shr_decode},
290 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL,
291 NULL},
292 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count),
293 "Interrupt Count", NULL},
294 {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]),
295 "Interrupt List", NULL}
298 struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = {
299 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg),
300 "Generic Register", NULL},
301 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID",
302 NULL},
303 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width",
304 NULL},
305 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset",
306 NULL},
307 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size),
308 "Access Size", NULL},
309 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL}
313 * Tables used for common address descriptor flag fields
315 static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = {
316 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL,
317 NULL},
318 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer),
319 "Consumer/Producer", acpi_gbl_consume_decode},
320 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode",
321 acpi_gbl_dec_decode},
322 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed),
323 "Min Relocatability", acpi_gbl_min_decode},
324 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed),
325 "Max Relocatability", acpi_gbl_max_decode}
328 static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
329 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags),
330 "Resource Type", (void *)"Memory Range"},
331 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect),
332 "Write Protect", acpi_gbl_rw_decode},
333 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching),
334 "Caching", acpi_gbl_mem_decode},
335 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type),
336 "Range Type", acpi_gbl_mtp_decode},
337 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation),
338 "Translation", acpi_gbl_ttp_decode}
341 static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = {
342 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags),
343 "Resource Type", (void *)"I/O Range"},
344 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type),
345 "Range Type", acpi_gbl_rng_decode},
346 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation),
347 "Translation", acpi_gbl_ttp_decode},
348 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type),
349 "Translation Type", acpi_gbl_trs_decode}
353 * Table used to dump _PRT contents
355 static struct acpi_rsdump_info acpi_rs_dump_prt[5] = {
356 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL},
357 {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL},
358 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL},
359 {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL},
360 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL}
363 /*******************************************************************************
365 * FUNCTION: acpi_rs_dump_descriptor
367 * PARAMETERS: Resource
369 * RETURN: None
371 * DESCRIPTION:
373 ******************************************************************************/
375 static void
376 acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
378 u8 *target = NULL;
379 u8 *previous_target;
380 char *name;
381 u8 count;
383 /* First table entry must contain the table length (# of table entries) */
385 count = table->offset;
387 while (count) {
388 previous_target = target;
389 target = ACPI_ADD_PTR(u8, resource, table->offset);
390 name = table->name;
392 switch (table->opcode) {
393 case ACPI_RSD_TITLE:
395 * Optional resource title
397 if (table->name) {
398 acpi_os_printf("%s Resource\n", name);
400 break;
402 /* Strings */
404 case ACPI_RSD_LITERAL:
405 acpi_rs_out_string(name,
406 ACPI_CAST_PTR(char, table->pointer));
407 break;
409 case ACPI_RSD_STRING:
410 acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
411 break;
413 /* Data items, 8/16/32/64 bit */
415 case ACPI_RSD_UINT8:
416 acpi_rs_out_integer8(name, ACPI_GET8(target));
417 break;
419 case ACPI_RSD_UINT16:
420 acpi_rs_out_integer16(name, ACPI_GET16(target));
421 break;
423 case ACPI_RSD_UINT32:
424 acpi_rs_out_integer32(name, ACPI_GET32(target));
425 break;
427 case ACPI_RSD_UINT64:
428 acpi_rs_out_integer64(name, ACPI_GET64(target));
429 break;
431 /* Flags: 1-bit and 2-bit flags supported */
433 case ACPI_RSD_1BITFLAG:
434 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
435 table->
436 pointer[*target &
437 0x01]));
438 break;
440 case ACPI_RSD_2BITFLAG:
441 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
442 table->
443 pointer[*target &
444 0x03]));
445 break;
447 case ACPI_RSD_SHORTLIST:
449 * Short byte list (single line output) for DMA and IRQ resources
450 * Note: The list length is obtained from the previous table entry
452 if (previous_target) {
453 acpi_rs_out_title(name);
454 acpi_rs_dump_short_byte_list(*previous_target,
455 target);
457 break;
459 case ACPI_RSD_LONGLIST:
461 * Long byte list for Vendor resource data
462 * Note: The list length is obtained from the previous table entry
464 if (previous_target) {
465 acpi_rs_dump_byte_list(ACPI_GET16
466 (previous_target),
467 target);
469 break;
471 case ACPI_RSD_DWORDLIST:
473 * Dword list for Extended Interrupt resources
474 * Note: The list length is obtained from the previous table entry
476 if (previous_target) {
477 acpi_rs_dump_dword_list(*previous_target,
478 ACPI_CAST_PTR(u32,
479 target));
481 break;
483 case ACPI_RSD_ADDRESS:
485 * Common flags for all Address resources
487 acpi_rs_dump_address_common(ACPI_CAST_PTR
488 (union acpi_resource_data,
489 target));
490 break;
492 case ACPI_RSD_SOURCE:
494 * Optional resource_source for Address resources
496 acpi_rs_dump_resource_source(ACPI_CAST_PTR(struct
497 acpi_resource_source,
498 target));
499 break;
501 default:
502 acpi_os_printf("**** Invalid table opcode [%X] ****\n",
503 table->opcode);
504 return;
507 table++;
508 count--;
512 /*******************************************************************************
514 * FUNCTION: acpi_rs_dump_resource_source
516 * PARAMETERS: resource_source - Pointer to a Resource Source struct
518 * RETURN: None
520 * DESCRIPTION: Common routine for dumping the optional resource_source and the
521 * corresponding resource_source_index.
523 ******************************************************************************/
525 static void
526 acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
528 ACPI_FUNCTION_ENTRY();
530 if (resource_source->index == 0xFF) {
531 return;
534 acpi_rs_out_integer8("Resource Source Index", resource_source->index);
536 acpi_rs_out_string("Resource Source",
537 resource_source->string_ptr ?
538 resource_source->string_ptr : "[Not Specified]");
541 /*******************************************************************************
543 * FUNCTION: acpi_rs_dump_address_common
545 * PARAMETERS: Resource - Pointer to an internal resource descriptor
547 * RETURN: None
549 * DESCRIPTION: Dump the fields that are common to all Address resource
550 * descriptors
552 ******************************************************************************/
554 static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
556 ACPI_FUNCTION_ENTRY();
558 /* Decode the type-specific flags */
560 switch (resource->address.resource_type) {
561 case ACPI_MEMORY_RANGE:
563 acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags);
564 break;
566 case ACPI_IO_RANGE:
568 acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags);
569 break;
571 case ACPI_BUS_NUMBER_RANGE:
573 acpi_rs_out_string("Resource Type", "Bus Number Range");
574 break;
576 default:
578 acpi_rs_out_integer8("Resource Type",
579 (u8) resource->address.resource_type);
580 break;
583 /* Decode the general flags */
585 acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags);
588 /*******************************************************************************
590 * FUNCTION: acpi_rs_dump_resource_list
592 * PARAMETERS: resource_list - Pointer to a resource descriptor list
594 * RETURN: None
596 * DESCRIPTION: Dispatches the structure to the correct dump routine.
598 ******************************************************************************/
600 void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
602 u32 count = 0;
603 u32 type;
605 ACPI_FUNCTION_ENTRY();
607 if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
608 || !(_COMPONENT & acpi_dbg_layer)) {
609 return;
612 /* Walk list and dump all resource descriptors (END_TAG terminates) */
614 do {
615 acpi_os_printf("\n[%02X] ", count);
616 count++;
618 /* Validate Type before dispatch */
620 type = resource_list->type;
621 if (type > ACPI_RESOURCE_TYPE_MAX) {
622 acpi_os_printf
623 ("Invalid descriptor type (%X) in resource list\n",
624 resource_list->type);
625 return;
628 /* Dump the resource descriptor */
630 acpi_rs_dump_descriptor(&resource_list->data,
631 acpi_gbl_dump_resource_dispatch[type]);
633 /* Point to the next resource structure */
635 resource_list =
636 ACPI_ADD_PTR(struct acpi_resource, resource_list,
637 resource_list->length);
639 /* Exit when END_TAG descriptor is reached */
641 } while (type != ACPI_RESOURCE_TYPE_END_TAG);
644 /*******************************************************************************
646 * FUNCTION: acpi_rs_dump_irq_list
648 * PARAMETERS: route_table - Pointer to the routing table to dump.
650 * RETURN: None
652 * DESCRIPTION: Print IRQ routing table
654 ******************************************************************************/
656 void acpi_rs_dump_irq_list(u8 * route_table)
658 struct acpi_pci_routing_table *prt_element;
659 u8 count;
661 ACPI_FUNCTION_ENTRY();
663 if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
664 || !(_COMPONENT & acpi_dbg_layer)) {
665 return;
668 prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table);
670 /* Dump all table elements, Exit on zero length element */
672 for (count = 0; prt_element->length; count++) {
673 acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
674 count);
675 acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt);
677 prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table,
678 prt_element, prt_element->length);
682 /*******************************************************************************
684 * FUNCTION: acpi_rs_out*
686 * PARAMETERS: Title - Name of the resource field
687 * Value - Value of the resource field
689 * RETURN: None
691 * DESCRIPTION: Miscellaneous helper functions to consistently format the
692 * output of the resource dump routines
694 ******************************************************************************/
696 static void acpi_rs_out_string(char *title, char *value)
698 acpi_os_printf("%27s : %s", title, value);
699 if (!*value) {
700 acpi_os_printf("[NULL NAMESTRING]");
702 acpi_os_printf("\n");
705 static void acpi_rs_out_integer8(char *title, u8 value)
707 acpi_os_printf("%27s : %2.2X\n", title, value);
710 static void acpi_rs_out_integer16(char *title, u16 value)
712 acpi_os_printf("%27s : %4.4X\n", title, value);
715 static void acpi_rs_out_integer32(char *title, u32 value)
717 acpi_os_printf("%27s : %8.8X\n", title, value);
720 static void acpi_rs_out_integer64(char *title, u64 value)
722 acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
725 static void acpi_rs_out_title(char *title)
727 acpi_os_printf("%27s : ", title);
730 /*******************************************************************************
732 * FUNCTION: acpi_rs_dump*List
734 * PARAMETERS: Length - Number of elements in the list
735 * Data - Start of the list
737 * RETURN: None
739 * DESCRIPTION: Miscellaneous functions to dump lists of raw data
741 ******************************************************************************/
743 static void acpi_rs_dump_byte_list(u16 length, u8 * data)
745 u8 i;
747 for (i = 0; i < length; i++) {
748 acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]);
752 static void acpi_rs_dump_short_byte_list(u8 length, u8 * data)
754 u8 i;
756 for (i = 0; i < length; i++) {
757 acpi_os_printf("%X ", data[i]);
759 acpi_os_printf("\n");
762 static void acpi_rs_dump_dword_list(u8 length, u32 * data)
764 u8 i;
766 for (i = 0; i < length; i++) {
767 acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]);
771 #endif