blob: cebd890d3db5c3b009daf8052f6d72b05485f8c2 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*******************************************************************************
2 *
3 * Module Name: rsdump - Functions to display the resource structures.
4 *
5 ******************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2005, R. Byron Moore
9 * All rights reserved.
10 *
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.
25 *
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.
29 *
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.
42 */
43
Linus Torvalds1da177e2005-04-16 15:20:36 -070044#include <acpi/acpi.h>
45#include <acpi/acresrc.h>
Bob Moore08978312005-10-21 00:00:00 -040046#include <acpi/acdisasm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
48#define _COMPONENT ACPI_RESOURCES
Len Brown4be44fc2005-08-05 00:44:28 -040049ACPI_MODULE_NAME("rsdump")
Robert Moore6f42ccf2005-05-13 00:00:00 -040050
51#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
Robert Moore44f6c012005-04-18 22:49:35 -040052/* Local prototypes */
Robert Moorebda663d2005-09-16 16:51:15 -040053static void acpi_rs_out_string(char *title, char *value);
54
55static void acpi_rs_out_integer8(char *title, u8 value);
56
57static void acpi_rs_out_integer16(char *title, u16 value);
58
59static void acpi_rs_out_integer32(char *title, u32 value);
60
61static void acpi_rs_out_integer64(char *title, u64 value);
62
63static void acpi_rs_out_title(char *title);
64
Bob Moore08978312005-10-21 00:00:00 -040065static void acpi_rs_dump_byte_list(u16 length, u8 * data);
Robert Moorebda663d2005-09-16 16:51:15 -040066
Bob Moore08978312005-10-21 00:00:00 -040067static void acpi_rs_dump_dword_list(u8 length, u32 * data);
Robert Moorebda663d2005-09-16 16:51:15 -040068
Bob Moore08978312005-10-21 00:00:00 -040069static void acpi_rs_dump_short_byte_list(u8 length, u8 * data);
Robert Moorebda663d2005-09-16 16:51:15 -040070
71static void
72acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source);
73
74static void acpi_rs_dump_address_common(union acpi_resource_data *resource);
75
Bob Moore08978312005-10-21 00:00:00 -040076static void
77acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table);
78
79#define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f)
80#define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f)
81#define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info))
82
83/*******************************************************************************
84 *
85 * Resource Descriptor info tables
86 *
87 * Note: The first table entry must be a Title or Literal and must contain
88 * the table length (number of table entries)
89 *
90 ******************************************************************************/
91
92struct acpi_rsdump_info acpi_rs_dump_irq[6] = {
93 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL},
94 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering",
95 acpi_gbl_HEdecode},
96 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity",
97 acpi_gbl_LLdecode},
98 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing",
99 acpi_gbl_SHRdecode},
100 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count),
101 "Interrupt Count", NULL},
102 {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]),
103 "Interrupt List", NULL}
104};
105
106struct acpi_rsdump_info acpi_rs_dump_dma[6] = {
107 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL},
108 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed",
109 acpi_gbl_TYPdecode},
110 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering",
111 acpi_gbl_BMdecode},
112 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type",
113 acpi_gbl_SIZdecode},
114 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count",
115 NULL},
116 {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List",
117 NULL}
118};
119
120struct acpi_rsdump_info acpi_rs_dump_start_dpf[3] = {
121 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf),
122 "Start-Dependent-Functions", NULL},
123 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority),
124 "Compatibility Priority", acpi_gbl_config_decode},
125 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness),
126 "Performance/Robustness", acpi_gbl_config_decode}
127};
128
129struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = {
130 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf),
131 "End-Dependent-Functions", NULL}
132};
133
134struct acpi_rsdump_info acpi_rs_dump_io[6] = {
135 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL},
136 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding",
137 acpi_gbl_io_decode},
138 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL},
139 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL},
140 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL},
141 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length",
142 NULL}
143};
144
145struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = {
146 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io),
147 "Fixed I/O", NULL},
148 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL},
149 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length),
150 "Address Length", NULL}
151};
152
153struct acpi_rsdump_info acpi_rs_dump_vendor[3] = {
154 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor),
155 "Vendor Specific", NULL},
156 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL},
157 {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data",
158 NULL}
159};
160
161struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = {
162 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "end_tag",
163 NULL}
164};
165
166struct acpi_rsdump_info acpi_rs_dump_memory24[6] = {
167 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24),
168 "24-Bit Memory Range", NULL},
169 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect),
170 "Write Protect", acpi_gbl_RWdecode},
171 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum",
172 NULL},
173 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum",
174 NULL},
175 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment",
176 NULL},
177 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length),
178 "Address Length", NULL}
179};
180
181struct acpi_rsdump_info acpi_rs_dump_memory32[6] = {
182 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32),
183 "32-Bit Memory Range", NULL},
184 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect),
185 "Write Protect", acpi_gbl_RWdecode},
186 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum",
187 NULL},
188 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum",
189 NULL},
190 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment",
191 NULL},
192 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length),
193 "Address Length", NULL}
194};
195
196struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = {
197 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32),
198 "32-Bit Fixed Memory Range", NULL},
199 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect),
200 "Write Protect", acpi_gbl_RWdecode},
201 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address",
202 NULL},
203 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length),
204 "Address Length", NULL}
205};
206
207struct acpi_rsdump_info acpi_rs_dump_address16[8] = {
208 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16),
209 "16-Bit WORD Address Space", NULL},
210 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
211 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity",
212 NULL},
213 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum",
214 NULL},
215 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum",
216 NULL},
217 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset),
218 "Translation Offset", NULL},
219 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length),
220 "Address Length", NULL},
221 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL}
222};
223
224struct acpi_rsdump_info acpi_rs_dump_address32[8] = {
225 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32),
226 "32-Bit DWORD Address Space", NULL},
227 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
228 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity",
229 NULL},
230 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum",
231 NULL},
232 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum",
233 NULL},
234 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset),
235 "Translation Offset", NULL},
236 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length),
237 "Address Length", NULL},
238 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL}
239};
240
241struct acpi_rsdump_info acpi_rs_dump_address64[8] = {
242 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64),
243 "64-Bit QWORD Address Space", NULL},
244 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
245 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity",
246 NULL},
247 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum",
248 NULL},
249 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum",
250 NULL},
251 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset),
252 "Translation Offset", NULL},
253 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length),
254 "Address Length", NULL},
255 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL}
256};
257
258struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = {
259 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64),
260 "64-Bit Extended Address Space", NULL},
261 {ACPI_RSD_ADDRESS, 0, NULL, NULL},
262 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity),
263 "Granularity", NULL},
264 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum),
265 "Address Minimum", NULL},
266 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum),
267 "Address Maximum", NULL},
268 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset),
269 "Translation Offset", NULL},
270 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length),
271 "Address Length", NULL},
272 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific),
273 "Type-Specific Attribute", NULL}
274};
275
276struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = {
277 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq),
278 "Extended IRQ", NULL},
279 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer),
280 "Type", acpi_gbl_consume_decode},
281 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering),
282 "Triggering", acpi_gbl_HEdecode},
283 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity",
284 acpi_gbl_LLdecode},
285 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing",
286 acpi_gbl_SHRdecode},
287 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL,
288 NULL},
289 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count),
290 "Interrupt Count", NULL},
291 {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]),
292 "Interrupt List", NULL}
293};
294
295struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = {
296 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg),
297 "Generic Register", NULL},
298 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID",
299 NULL},
300 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width",
301 NULL},
302 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset",
303 NULL},
304 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size),
305 "Access Size", NULL},
306 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL}
307};
308
309/*
310 * Tables used for common address descriptor flag fields
311 */
312static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = {
313 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL,
314 NULL},
315 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer),
316 "Consumer/Producer", acpi_gbl_consume_decode},
317 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode",
318 acpi_gbl_DECdecode},
319 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed),
320 "Min Relocatability", acpi_gbl_min_decode},
321 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed),
322 "Max Relocatability", acpi_gbl_max_decode}
323};
324
325static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
326 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags),
Bob Moore96db2552005-11-02 00:00:00 -0500327 "Resource Type", (void *)"Memory Range"},
Bob Moore08978312005-10-21 00:00:00 -0400328 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect),
329 "Write Protect", acpi_gbl_RWdecode},
330 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching),
331 "Caching", acpi_gbl_MEMdecode},
332 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type),
333 "Range Type", acpi_gbl_MTPdecode},
334 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation),
335 "Translation", acpi_gbl_TTPdecode}
336};
337
338static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = {
339 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags),
Bob Moore96db2552005-11-02 00:00:00 -0500340 "Resource Type", (void *)"I/O Range"},
Bob Moore08978312005-10-21 00:00:00 -0400341 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type),
342 "Range Type", acpi_gbl_RNGdecode},
343 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation),
344 "Translation", acpi_gbl_TTPdecode},
345 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type),
346 "Translation Type", acpi_gbl_TRSdecode}
347};
348
349/*
350 * Table used to dump _PRT contents
351 */
352static struct acpi_rsdump_info acpi_rs_dump_prt[5] = {
353 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL},
354 {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL},
355 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL},
356 {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL},
357 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL}
358};
359
360/*******************************************************************************
361 *
362 * FUNCTION: acpi_rs_dump_descriptor
363 *
364 * PARAMETERS: Resource
365 *
366 * RETURN: None
367 *
368 * DESCRIPTION:
369 *
370 ******************************************************************************/
371
372static void
373acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
374{
Bob Moore96db2552005-11-02 00:00:00 -0500375 u8 *target = NULL;
376 u8 *previous_target;
Bob Moore08978312005-10-21 00:00:00 -0400377 char *name;
378 u8 count;
379
380 /* First table entry must contain the table length (# of table entries) */
381
382 count = table->offset;
383
384 while (count) {
385 previous_target = target;
Bob Moorec51a4de2005-11-17 13:07:00 -0500386 target = ACPI_ADD_PTR(u8, resource, table->offset);
Bob Moore08978312005-10-21 00:00:00 -0400387 name = table->name;
388
389 switch (table->opcode) {
390 case ACPI_RSD_TITLE:
391 /*
392 * Optional resource title
393 */
394 if (table->name) {
395 acpi_os_printf("%s Resource\n", name);
396 }
397 break;
398
399 /* Strings */
400
401 case ACPI_RSD_LITERAL:
Bob Moore96db2552005-11-02 00:00:00 -0500402 acpi_rs_out_string(name,
403 ACPI_CAST_PTR(char, table->pointer));
Bob Moore08978312005-10-21 00:00:00 -0400404 break;
405
406 case ACPI_RSD_STRING:
Bob Moore96db2552005-11-02 00:00:00 -0500407 acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
Bob Moore08978312005-10-21 00:00:00 -0400408 break;
409
410 /* Data items, 8/16/32/64 bit */
411
412 case ACPI_RSD_UINT8:
Bob Moorec51a4de2005-11-17 13:07:00 -0500413 acpi_rs_out_integer8(name, ACPI_GET8(target));
Bob Moore08978312005-10-21 00:00:00 -0400414 break;
415
416 case ACPI_RSD_UINT16:
Bob Moorec51a4de2005-11-17 13:07:00 -0500417 acpi_rs_out_integer16(name, ACPI_GET16(target));
Bob Moore08978312005-10-21 00:00:00 -0400418 break;
419
420 case ACPI_RSD_UINT32:
Bob Moorec51a4de2005-11-17 13:07:00 -0500421 acpi_rs_out_integer32(name, ACPI_GET32(target));
Bob Moore08978312005-10-21 00:00:00 -0400422 break;
423
424 case ACPI_RSD_UINT64:
Bob Moorec51a4de2005-11-17 13:07:00 -0500425 acpi_rs_out_integer64(name, ACPI_GET64(target));
Bob Moore08978312005-10-21 00:00:00 -0400426 break;
427
428 /* Flags: 1-bit and 2-bit flags supported */
429
430 case ACPI_RSD_1BITFLAG:
Bob Moore96db2552005-11-02 00:00:00 -0500431 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
432 table->
433 pointer[*target &
434 0x01]));
Bob Moore08978312005-10-21 00:00:00 -0400435 break;
436
437 case ACPI_RSD_2BITFLAG:
Bob Moore96db2552005-11-02 00:00:00 -0500438 acpi_rs_out_string(name, ACPI_CAST_PTR(char,
439 table->
440 pointer[*target &
441 0x03]));
Bob Moore08978312005-10-21 00:00:00 -0400442 break;
443
444 case ACPI_RSD_SHORTLIST:
445 /*
446 * Short byte list (single line output) for DMA and IRQ resources
447 * Note: The list length is obtained from the previous table entry
448 */
449 if (previous_target) {
450 acpi_rs_out_title(name);
Bob Moore96db2552005-11-02 00:00:00 -0500451 acpi_rs_dump_short_byte_list(*previous_target,
452 target);
Bob Moore08978312005-10-21 00:00:00 -0400453 }
454 break;
455
456 case ACPI_RSD_LONGLIST:
457 /*
458 * Long byte list for Vendor resource data
459 * Note: The list length is obtained from the previous table entry
460 */
461 if (previous_target) {
Bob Moorec51a4de2005-11-17 13:07:00 -0500462 acpi_rs_dump_byte_list(ACPI_GET16
463 (previous_target),
Bob Moore96db2552005-11-02 00:00:00 -0500464 target);
Bob Moore08978312005-10-21 00:00:00 -0400465 }
466 break;
467
468 case ACPI_RSD_DWORDLIST:
469 /*
470 * Dword list for Extended Interrupt resources
471 * Note: The list length is obtained from the previous table entry
472 */
473 if (previous_target) {
Bob Moore96db2552005-11-02 00:00:00 -0500474 acpi_rs_dump_dword_list(*previous_target,
475 ACPI_CAST_PTR(u32,
476 target));
Bob Moore08978312005-10-21 00:00:00 -0400477 }
478 break;
479
480 case ACPI_RSD_ADDRESS:
481 /*
482 * Common flags for all Address resources
483 */
Bob Moore96db2552005-11-02 00:00:00 -0500484 acpi_rs_dump_address_common(ACPI_CAST_PTR
485 (union acpi_resource_data,
486 target));
Bob Moore08978312005-10-21 00:00:00 -0400487 break;
488
489 case ACPI_RSD_SOURCE:
490 /*
491 * Optional resource_source for Address resources
492 */
Bob Moore96db2552005-11-02 00:00:00 -0500493 acpi_rs_dump_resource_source(ACPI_CAST_PTR
494 (struct
495 acpi_resource_source,
496 target));
Bob Moore08978312005-10-21 00:00:00 -0400497 break;
498
499 default:
500 acpi_os_printf("**** Invalid table opcode [%X] ****\n",
501 table->opcode);
502 return;
503 }
504
505 table++;
506 count--;
507 }
508}
509
510/*******************************************************************************
511 *
512 * FUNCTION: acpi_rs_dump_resource_source
513 *
514 * PARAMETERS: resource_source - Pointer to a Resource Source struct
515 *
516 * RETURN: None
517 *
518 * DESCRIPTION: Common routine for dumping the optional resource_source and the
519 * corresponding resource_source_index.
520 *
521 ******************************************************************************/
522
523static void
524acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
525{
526 ACPI_FUNCTION_ENTRY();
527
528 if (resource_source->index == 0xFF) {
529 return;
530 }
531
532 acpi_rs_out_integer8("Resource Source Index", resource_source->index);
533
534 acpi_rs_out_string("Resource Source",
535 resource_source->string_ptr ?
536 resource_source->string_ptr : "[Not Specified]");
537}
538
539/*******************************************************************************
540 *
541 * FUNCTION: acpi_rs_dump_address_common
542 *
543 * PARAMETERS: Resource - Pointer to an internal resource descriptor
544 *
545 * RETURN: None
546 *
547 * DESCRIPTION: Dump the fields that are common to all Address resource
548 * descriptors
549 *
550 ******************************************************************************/
551
552static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
553{
554 ACPI_FUNCTION_ENTRY();
555
556 /* Decode the type-specific flags */
557
558 switch (resource->address.resource_type) {
559 case ACPI_MEMORY_RANGE:
560
561 acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags);
562 break;
563
564 case ACPI_IO_RANGE:
565
566 acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags);
567 break;
568
569 case ACPI_BUS_NUMBER_RANGE:
570
571 acpi_rs_out_string("Resource Type", "Bus Number Range");
572 break;
573
574 default:
575
576 acpi_rs_out_integer8("Resource Type",
577 (u8) resource->address.resource_type);
578 break;
579 }
580
581 /* Decode the general flags */
582
583 acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags);
584}
585
586/*******************************************************************************
587 *
588 * FUNCTION: acpi_rs_dump_resource_list
589 *
590 * PARAMETERS: resource_list - Pointer to a resource descriptor list
591 *
592 * RETURN: None
593 *
594 * DESCRIPTION: Dispatches the structure to the correct dump routine.
595 *
596 ******************************************************************************/
597
598void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
599{
600 u32 count = 0;
601 u32 type;
602
603 ACPI_FUNCTION_ENTRY();
604
605 if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
606 || !(_COMPONENT & acpi_dbg_layer)) {
607 return;
608 }
609
610 /* Walk list and dump all resource descriptors (END_TAG terminates) */
611
612 do {
613 acpi_os_printf("\n[%02X] ", count);
614 count++;
615
616 /* Validate Type before dispatch */
617
618 type = resource_list->type;
619 if (type > ACPI_RESOURCE_TYPE_MAX) {
620 acpi_os_printf
621 ("Invalid descriptor type (%X) in resource list\n",
622 resource_list->type);
623 return;
624 }
625
626 /* Dump the resource descriptor */
627
628 acpi_rs_dump_descriptor(&resource_list->data,
629 acpi_gbl_dump_resource_dispatch[type]);
630
631 /* Point to the next resource structure */
632
633 resource_list =
Bob Moorec51a4de2005-11-17 13:07:00 -0500634 ACPI_ADD_PTR(struct acpi_resource, resource_list,
Bob Moore08978312005-10-21 00:00:00 -0400635 resource_list->length);
636
637 /* Exit when END_TAG descriptor is reached */
638
639 } while (type != ACPI_RESOURCE_TYPE_END_TAG);
640}
641
642/*******************************************************************************
643 *
644 * FUNCTION: acpi_rs_dump_irq_list
645 *
646 * PARAMETERS: route_table - Pointer to the routing table to dump.
647 *
648 * RETURN: None
649 *
650 * DESCRIPTION: Print IRQ routing table
651 *
652 ******************************************************************************/
653
654void acpi_rs_dump_irq_list(u8 * route_table)
655{
656 struct acpi_pci_routing_table *prt_element;
657 u8 count;
658
659 ACPI_FUNCTION_ENTRY();
660
661 if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
662 || !(_COMPONENT & acpi_dbg_layer)) {
663 return;
664 }
665
666 prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table);
667
668 /* Dump all table elements, Exit on zero length element */
669
670 for (count = 0; prt_element->length; count++) {
671 acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
672 count);
673 acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt);
674
Bob Moorec51a4de2005-11-17 13:07:00 -0500675 prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table,
676 prt_element, prt_element->length);
Bob Moore08978312005-10-21 00:00:00 -0400677 }
678}
679
Linus Torvalds1da177e2005-04-16 15:20:36 -0700680/*******************************************************************************
681 *
Robert Moorebda663d2005-09-16 16:51:15 -0400682 * FUNCTION: acpi_rs_out*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 *
Robert Moorebda663d2005-09-16 16:51:15 -0400684 * PARAMETERS: Title - Name of the resource field
685 * Value - Value of the resource field
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686 *
687 * RETURN: None
688 *
Robert Moorebda663d2005-09-16 16:51:15 -0400689 * DESCRIPTION: Miscellaneous helper functions to consistently format the
690 * output of the resource dump routines
Linus Torvalds1da177e2005-04-16 15:20:36 -0700691 *
692 ******************************************************************************/
693
Robert Moorebda663d2005-09-16 16:51:15 -0400694static void acpi_rs_out_string(char *title, char *value)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700695{
Bob Moore50eca3e2005-09-30 19:03:00 -0400696 acpi_os_printf("%27s : %s\n", title, value);
Robert Moorebda663d2005-09-16 16:51:15 -0400697}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700698
Robert Moorebda663d2005-09-16 16:51:15 -0400699static void acpi_rs_out_integer8(char *title, u8 value)
700{
Bob Moore50eca3e2005-09-30 19:03:00 -0400701 acpi_os_printf("%27s : %2.2X\n", title, value);
Robert Moorebda663d2005-09-16 16:51:15 -0400702}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700703
Robert Moorebda663d2005-09-16 16:51:15 -0400704static void acpi_rs_out_integer16(char *title, u16 value)
705{
Bob Moore50eca3e2005-09-30 19:03:00 -0400706 acpi_os_printf("%27s : %4.4X\n", title, value);
Robert Moorebda663d2005-09-16 16:51:15 -0400707}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708
Robert Moorebda663d2005-09-16 16:51:15 -0400709static void acpi_rs_out_integer32(char *title, u32 value)
710{
Bob Moore50eca3e2005-09-30 19:03:00 -0400711 acpi_os_printf("%27s : %8.8X\n", title, value);
Robert Moorebda663d2005-09-16 16:51:15 -0400712}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700713
Robert Moorebda663d2005-09-16 16:51:15 -0400714static void acpi_rs_out_integer64(char *title, u64 value)
715{
Bob Moore50eca3e2005-09-30 19:03:00 -0400716 acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
Robert Moorebda663d2005-09-16 16:51:15 -0400717}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700718
Robert Moorebda663d2005-09-16 16:51:15 -0400719static void acpi_rs_out_title(char *title)
720{
Bob Moore50eca3e2005-09-30 19:03:00 -0400721 acpi_os_printf("%27s : ", title);
Robert Moorebda663d2005-09-16 16:51:15 -0400722}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700723
Robert Moorebda663d2005-09-16 16:51:15 -0400724/*******************************************************************************
725 *
726 * FUNCTION: acpi_rs_dump*List
727 *
728 * PARAMETERS: Length - Number of elements in the list
729 * Data - Start of the list
730 *
731 * RETURN: None
732 *
733 * DESCRIPTION: Miscellaneous functions to dump lists of raw data
734 *
735 ******************************************************************************/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700736
Bob Moore08978312005-10-21 00:00:00 -0400737static void acpi_rs_dump_byte_list(u16 length, u8 * data)
Robert Moorebda663d2005-09-16 16:51:15 -0400738{
Bob Moore08978312005-10-21 00:00:00 -0400739 u8 i;
Robert Moorebda663d2005-09-16 16:51:15 -0400740
741 for (i = 0; i < length; i++) {
Bob Moore50eca3e2005-09-30 19:03:00 -0400742 acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]);
Robert Moorebda663d2005-09-16 16:51:15 -0400743 }
744}
745
Bob Moore08978312005-10-21 00:00:00 -0400746static void acpi_rs_dump_short_byte_list(u8 length, u8 * data)
Robert Moorebda663d2005-09-16 16:51:15 -0400747{
Bob Moore08978312005-10-21 00:00:00 -0400748 u8 i;
Robert Moorebda663d2005-09-16 16:51:15 -0400749
750 for (i = 0; i < length; i++) {
751 acpi_os_printf("%X ", data[i]);
752 }
753 acpi_os_printf("\n");
754}
755
Bob Moore08978312005-10-21 00:00:00 -0400756static void acpi_rs_dump_dword_list(u8 length, u32 * data)
Bob Moore50eca3e2005-09-30 19:03:00 -0400757{
Bob Moore08978312005-10-21 00:00:00 -0400758 u8 i;
Bob Moore50eca3e2005-09-30 19:03:00 -0400759
Bob Moore08978312005-10-21 00:00:00 -0400760 for (i = 0; i < length; i++) {
761 acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]);
Robert Moorebda663d2005-09-16 16:51:15 -0400762 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763}
764
765#endif