1 /*******************************************************************************
3 * Module Name: rsdump - Functions to display the resource structures.
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2012, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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>
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_word_list(u16 length
, u16
*data
);
68 static void acpi_rs_dump_dword_list(u8 length
, u32
*data
);
70 static void acpi_rs_dump_short_byte_list(u8 length
, u8
*data
);
73 acpi_rs_dump_resource_source(struct acpi_resource_source
*resource_source
);
75 static void acpi_rs_dump_address_common(union acpi_resource_data
*resource
);
78 acpi_rs_dump_descriptor(void *resource
, struct acpi_rsdump_info
*table
);
80 #define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f)
81 #define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f)
82 #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info))
84 /*******************************************************************************
86 * Resource Descriptor info tables
88 * Note: The first table entry must be a Title or Literal and must contain
89 * the table length (number of table entries)
91 ******************************************************************************/
93 struct acpi_rsdump_info acpi_rs_dump_irq
[7] = {
94 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq
), "IRQ", NULL
},
95 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(irq
.descriptor_length
),
96 "Descriptor Length", NULL
},
97 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(irq
.triggering
), "Triggering",
99 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(irq
.polarity
), "Polarity",
101 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(irq
.sharable
), "Sharing",
102 acpi_gbl_shr_decode
},
103 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(irq
.interrupt_count
),
104 "Interrupt Count", NULL
},
105 {ACPI_RSD_SHORTLIST
, ACPI_RSD_OFFSET(irq
.interrupts
[0]),
106 "Interrupt List", NULL
}
109 struct acpi_rsdump_info acpi_rs_dump_dma
[6] = {
110 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma
), "DMA", NULL
},
111 {ACPI_RSD_2BITFLAG
, ACPI_RSD_OFFSET(dma
.type
), "Speed",
112 acpi_gbl_typ_decode
},
113 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(dma
.bus_master
), "Mastering",
115 {ACPI_RSD_2BITFLAG
, ACPI_RSD_OFFSET(dma
.transfer
), "Transfer Type",
116 acpi_gbl_siz_decode
},
117 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(dma
.channel_count
), "Channel Count",
119 {ACPI_RSD_SHORTLIST
, ACPI_RSD_OFFSET(dma
.channels
[0]), "Channel List",
123 struct acpi_rsdump_info acpi_rs_dump_start_dpf
[4] = {
124 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf
),
125 "Start-Dependent-Functions", NULL
},
126 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(start_dpf
.descriptor_length
),
127 "Descriptor Length", NULL
},
128 {ACPI_RSD_2BITFLAG
, ACPI_RSD_OFFSET(start_dpf
.compatibility_priority
),
129 "Compatibility Priority", acpi_gbl_config_decode
},
130 {ACPI_RSD_2BITFLAG
, ACPI_RSD_OFFSET(start_dpf
.performance_robustness
),
131 "Performance/Robustness", acpi_gbl_config_decode
}
134 struct acpi_rsdump_info acpi_rs_dump_end_dpf
[1] = {
135 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf
),
136 "End-Dependent-Functions", NULL
}
139 struct acpi_rsdump_info acpi_rs_dump_io
[6] = {
140 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io
), "I/O", NULL
},
141 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(io
.io_decode
), "Address Decoding",
143 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(io
.minimum
), "Address Minimum", NULL
},
144 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(io
.maximum
), "Address Maximum", NULL
},
145 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(io
.alignment
), "Alignment", NULL
},
146 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(io
.address_length
), "Address Length",
150 struct acpi_rsdump_info acpi_rs_dump_fixed_io
[3] = {
151 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io
),
153 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(fixed_io
.address
), "Address", NULL
},
154 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(fixed_io
.address_length
),
155 "Address Length", NULL
}
158 struct acpi_rsdump_info acpi_rs_dump_vendor
[3] = {
159 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor
),
160 "Vendor Specific", NULL
},
161 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(vendor
.byte_length
), "Length", NULL
},
162 {ACPI_RSD_LONGLIST
, ACPI_RSD_OFFSET(vendor
.byte_data
[0]), "Vendor Data",
166 struct acpi_rsdump_info acpi_rs_dump_end_tag
[1] = {
167 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag
), "EndTag",
171 struct acpi_rsdump_info acpi_rs_dump_memory24
[6] = {
172 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24
),
173 "24-Bit Memory Range", NULL
},
174 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(memory24
.write_protect
),
175 "Write Protect", acpi_gbl_rw_decode
},
176 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(memory24
.minimum
), "Address Minimum",
178 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(memory24
.maximum
), "Address Maximum",
180 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(memory24
.alignment
), "Alignment",
182 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(memory24
.address_length
),
183 "Address Length", NULL
}
186 struct acpi_rsdump_info acpi_rs_dump_memory32
[6] = {
187 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32
),
188 "32-Bit Memory Range", NULL
},
189 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(memory32
.write_protect
),
190 "Write Protect", acpi_gbl_rw_decode
},
191 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(memory32
.minimum
), "Address Minimum",
193 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(memory32
.maximum
), "Address Maximum",
195 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(memory32
.alignment
), "Alignment",
197 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(memory32
.address_length
),
198 "Address Length", NULL
}
201 struct acpi_rsdump_info acpi_rs_dump_fixed_memory32
[4] = {
202 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32
),
203 "32-Bit Fixed Memory Range", NULL
},
204 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(fixed_memory32
.write_protect
),
205 "Write Protect", acpi_gbl_rw_decode
},
206 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(fixed_memory32
.address
), "Address",
208 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(fixed_memory32
.address_length
),
209 "Address Length", NULL
}
212 struct acpi_rsdump_info acpi_rs_dump_address16
[8] = {
213 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16
),
214 "16-Bit WORD Address Space", NULL
},
215 {ACPI_RSD_ADDRESS
, 0, NULL
, NULL
},
216 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(address16
.granularity
), "Granularity",
218 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(address16
.minimum
), "Address Minimum",
220 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(address16
.maximum
), "Address Maximum",
222 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(address16
.translation_offset
),
223 "Translation Offset", NULL
},
224 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(address16
.address_length
),
225 "Address Length", NULL
},
226 {ACPI_RSD_SOURCE
, ACPI_RSD_OFFSET(address16
.resource_source
), NULL
, NULL
}
229 struct acpi_rsdump_info acpi_rs_dump_address32
[8] = {
230 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32
),
231 "32-Bit DWORD Address Space", NULL
},
232 {ACPI_RSD_ADDRESS
, 0, NULL
, NULL
},
233 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(address32
.granularity
), "Granularity",
235 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(address32
.minimum
), "Address Minimum",
237 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(address32
.maximum
), "Address Maximum",
239 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(address32
.translation_offset
),
240 "Translation Offset", NULL
},
241 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(address32
.address_length
),
242 "Address Length", NULL
},
243 {ACPI_RSD_SOURCE
, ACPI_RSD_OFFSET(address32
.resource_source
), NULL
, NULL
}
246 struct acpi_rsdump_info acpi_rs_dump_address64
[8] = {
247 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64
),
248 "64-Bit QWORD Address Space", NULL
},
249 {ACPI_RSD_ADDRESS
, 0, NULL
, NULL
},
250 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(address64
.granularity
), "Granularity",
252 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(address64
.minimum
), "Address Minimum",
254 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(address64
.maximum
), "Address Maximum",
256 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(address64
.translation_offset
),
257 "Translation Offset", NULL
},
258 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(address64
.address_length
),
259 "Address Length", NULL
},
260 {ACPI_RSD_SOURCE
, ACPI_RSD_OFFSET(address64
.resource_source
), NULL
, NULL
}
263 struct acpi_rsdump_info acpi_rs_dump_ext_address64
[8] = {
264 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64
),
265 "64-Bit Extended Address Space", NULL
},
266 {ACPI_RSD_ADDRESS
, 0, NULL
, NULL
},
267 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(ext_address64
.granularity
),
268 "Granularity", NULL
},
269 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(ext_address64
.minimum
),
270 "Address Minimum", NULL
},
271 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(ext_address64
.maximum
),
272 "Address Maximum", NULL
},
273 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(ext_address64
.translation_offset
),
274 "Translation Offset", NULL
},
275 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(ext_address64
.address_length
),
276 "Address Length", NULL
},
277 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(ext_address64
.type_specific
),
278 "Type-Specific Attribute", NULL
}
281 struct acpi_rsdump_info acpi_rs_dump_ext_irq
[8] = {
282 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq
),
283 "Extended IRQ", NULL
},
284 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(extended_irq
.producer_consumer
),
285 "Type", acpi_gbl_consume_decode
},
286 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(extended_irq
.triggering
),
287 "Triggering", acpi_gbl_he_decode
},
288 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(extended_irq
.polarity
), "Polarity",
290 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(extended_irq
.sharable
), "Sharing",
291 acpi_gbl_shr_decode
},
292 {ACPI_RSD_SOURCE
, ACPI_RSD_OFFSET(extended_irq
.resource_source
), NULL
,
294 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(extended_irq
.interrupt_count
),
295 "Interrupt Count", NULL
},
296 {ACPI_RSD_DWORDLIST
, ACPI_RSD_OFFSET(extended_irq
.interrupts
[0]),
297 "Interrupt List", NULL
}
300 struct acpi_rsdump_info acpi_rs_dump_generic_reg
[6] = {
301 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg
),
302 "Generic Register", NULL
},
303 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(generic_reg
.space_id
), "Space ID",
305 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(generic_reg
.bit_width
), "Bit Width",
307 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(generic_reg
.bit_offset
), "Bit Offset",
309 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(generic_reg
.access_size
),
310 "Access Size", NULL
},
311 {ACPI_RSD_UINT64
, ACPI_RSD_OFFSET(generic_reg
.address
), "Address", NULL
}
314 struct acpi_rsdump_info acpi_rs_dump_gpio
[16] = {
315 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_gpio
), "GPIO", NULL
},
316 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(gpio
.revision_id
), "RevisionId", NULL
},
317 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(gpio
.connection_type
),
318 "ConnectionType", acpi_gbl_ct_decode
},
319 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(gpio
.producer_consumer
),
320 "ProducerConsumer", acpi_gbl_consume_decode
},
321 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(gpio
.pin_config
), "PinConfig",
322 acpi_gbl_ppc_decode
},
323 {ACPI_RSD_2BITFLAG
, ACPI_RSD_OFFSET(gpio
.sharable
), "Sharable",
324 acpi_gbl_shr_decode
},
325 {ACPI_RSD_2BITFLAG
, ACPI_RSD_OFFSET(gpio
.io_restriction
),
326 "IoRestriction", acpi_gbl_ior_decode
},
327 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(gpio
.triggering
), "Triggering",
329 {ACPI_RSD_2BITFLAG
, ACPI_RSD_OFFSET(gpio
.polarity
), "Polarity",
331 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(gpio
.drive_strength
), "DriveStrength",
333 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(gpio
.debounce_timeout
),
334 "DebounceTimeout", NULL
},
335 {ACPI_RSD_SOURCE
, ACPI_RSD_OFFSET(gpio
.resource_source
),
336 "ResourceSource", NULL
},
337 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(gpio
.pin_table_length
),
338 "PinTableLength", NULL
},
339 {ACPI_RSD_WORDLIST
, ACPI_RSD_OFFSET(gpio
.pin_table
), "PinTable", NULL
},
340 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(gpio
.vendor_length
), "VendorLength",
342 {ACPI_RSD_SHORTLISTX
, ACPI_RSD_OFFSET(gpio
.vendor_data
), "VendorData",
346 struct acpi_rsdump_info acpi_rs_dump_fixed_dma
[4] = {
347 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_dma
),
349 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(fixed_dma
.request_lines
),
350 "RequestLines", NULL
},
351 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(fixed_dma
.channels
), "Channels",
353 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(fixed_dma
.width
), "TransferWidth",
354 acpi_gbl_dts_decode
},
357 #define ACPI_RS_DUMP_COMMON_SERIAL_BUS \
358 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.revision_id), "RevisionId", NULL}, \
359 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type), "Type", acpi_gbl_sbt_decode}, \
360 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer", acpi_gbl_consume_decode}, \
361 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode), "SlaveMode", acpi_gbl_sm_decode}, \
362 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId", NULL}, \
363 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength", NULL}, \
364 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource", NULL}, \
365 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (common_serial_bus.vendor_length), "VendorLength", NULL}, \
366 {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data), "VendorData", NULL},
368 struct acpi_rsdump_info acpi_rs_dump_common_serial_bus
[10] = {
369 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus
),
370 "Common Serial Bus", NULL
},
371 ACPI_RS_DUMP_COMMON_SERIAL_BUS
374 struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus
[13] = {
375 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus
),
376 "I2C Serial Bus", NULL
},
377 ACPI_RS_DUMP_COMMON_SERIAL_BUS
{ACPI_RSD_1BITFLAG
,
378 ACPI_RSD_OFFSET(i2c_serial_bus
.
380 "AccessMode", acpi_gbl_am_decode
},
381 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(i2c_serial_bus
.connection_speed
),
382 "ConnectionSpeed", NULL
},
383 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(i2c_serial_bus
.slave_address
),
384 "SlaveAddress", NULL
},
387 struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus
[17] = {
388 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus
),
389 "Spi Serial Bus", NULL
},
390 ACPI_RS_DUMP_COMMON_SERIAL_BUS
{ACPI_RSD_1BITFLAG
,
391 ACPI_RSD_OFFSET(spi_serial_bus
.
392 wire_mode
), "WireMode",
394 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(spi_serial_bus
.device_polarity
),
395 "DevicePolarity", acpi_gbl_dp_decode
},
396 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(spi_serial_bus
.data_bit_length
),
397 "DataBitLength", NULL
},
398 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(spi_serial_bus
.clock_phase
),
399 "ClockPhase", acpi_gbl_cph_decode
},
400 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(spi_serial_bus
.clock_polarity
),
401 "ClockPolarity", acpi_gbl_cpo_decode
},
402 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(spi_serial_bus
.device_selection
),
403 "DeviceSelection", NULL
},
404 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(spi_serial_bus
.connection_speed
),
405 "ConnectionSpeed", NULL
},
408 struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus
[19] = {
409 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus
),
410 "Uart Serial Bus", NULL
},
411 ACPI_RS_DUMP_COMMON_SERIAL_BUS
{ACPI_RSD_2BITFLAG
,
412 ACPI_RSD_OFFSET(uart_serial_bus
.
414 "FlowControl", acpi_gbl_fc_decode
},
415 {ACPI_RSD_2BITFLAG
, ACPI_RSD_OFFSET(uart_serial_bus
.stop_bits
),
416 "StopBits", acpi_gbl_sb_decode
},
417 {ACPI_RSD_3BITFLAG
, ACPI_RSD_OFFSET(uart_serial_bus
.data_bits
),
418 "DataBits", acpi_gbl_bpb_decode
},
419 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(uart_serial_bus
.endian
), "Endian",
421 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(uart_serial_bus
.parity
), "Parity",
423 {ACPI_RSD_UINT8
, ACPI_RSD_OFFSET(uart_serial_bus
.lines_enabled
),
424 "LinesEnabled", NULL
},
425 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(uart_serial_bus
.rx_fifo_size
),
427 {ACPI_RSD_UINT16
, ACPI_RSD_OFFSET(uart_serial_bus
.tx_fifo_size
),
429 {ACPI_RSD_UINT32
, ACPI_RSD_OFFSET(uart_serial_bus
.default_baud_rate
),
430 "ConnectionSpeed", NULL
},
434 * Tables used for common address descriptor flag fields
436 static struct acpi_rsdump_info acpi_rs_dump_general_flags
[5] = {
437 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags
), NULL
,
439 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(address
.producer_consumer
),
440 "Consumer/Producer", acpi_gbl_consume_decode
},
441 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(address
.decode
), "Address Decode",
442 acpi_gbl_dec_decode
},
443 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(address
.min_address_fixed
),
444 "Min Relocatability", acpi_gbl_min_decode
},
445 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(address
.max_address_fixed
),
446 "Max Relocatability", acpi_gbl_max_decode
}
449 static struct acpi_rsdump_info acpi_rs_dump_memory_flags
[5] = {
450 {ACPI_RSD_LITERAL
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags
),
451 "Resource Type", (void *)"Memory Range"},
452 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(address
.info
.mem
.write_protect
),
453 "Write Protect", acpi_gbl_rw_decode
},
454 {ACPI_RSD_2BITFLAG
, ACPI_RSD_OFFSET(address
.info
.mem
.caching
),
455 "Caching", acpi_gbl_mem_decode
},
456 {ACPI_RSD_2BITFLAG
, ACPI_RSD_OFFSET(address
.info
.mem
.range_type
),
457 "Range Type", acpi_gbl_mtp_decode
},
458 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(address
.info
.mem
.translation
),
459 "Translation", acpi_gbl_ttp_decode
}
462 static struct acpi_rsdump_info acpi_rs_dump_io_flags
[4] = {
463 {ACPI_RSD_LITERAL
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags
),
464 "Resource Type", (void *)"I/O Range"},
465 {ACPI_RSD_2BITFLAG
, ACPI_RSD_OFFSET(address
.info
.io
.range_type
),
466 "Range Type", acpi_gbl_rng_decode
},
467 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(address
.info
.io
.translation
),
468 "Translation", acpi_gbl_ttp_decode
},
469 {ACPI_RSD_1BITFLAG
, ACPI_RSD_OFFSET(address
.info
.io
.translation_type
),
470 "Translation Type", acpi_gbl_trs_decode
}
474 * Table used to dump _PRT contents
476 static struct acpi_rsdump_info acpi_rs_dump_prt
[5] = {
477 {ACPI_RSD_TITLE
, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt
), NULL
, NULL
},
478 {ACPI_RSD_UINT64
, ACPI_PRT_OFFSET(address
), "Address", NULL
},
479 {ACPI_RSD_UINT32
, ACPI_PRT_OFFSET(pin
), "Pin", NULL
},
480 {ACPI_RSD_STRING
, ACPI_PRT_OFFSET(source
[0]), "Source", NULL
},
481 {ACPI_RSD_UINT32
, ACPI_PRT_OFFSET(source_index
), "Source Index", NULL
}
484 /*******************************************************************************
486 * FUNCTION: acpi_rs_dump_descriptor
488 * PARAMETERS: Resource
494 ******************************************************************************/
497 acpi_rs_dump_descriptor(void *resource
, struct acpi_rsdump_info
*table
)
504 /* First table entry must contain the table length (# of table entries) */
506 count
= table
->offset
;
509 previous_target
= target
;
510 target
= ACPI_ADD_PTR(u8
, resource
, table
->offset
);
513 switch (table
->opcode
) {
516 * Optional resource title
519 acpi_os_printf("%s Resource\n", name
);
525 case ACPI_RSD_LITERAL
:
526 acpi_rs_out_string(name
,
527 ACPI_CAST_PTR(char, table
->pointer
));
530 case ACPI_RSD_STRING
:
531 acpi_rs_out_string(name
, ACPI_CAST_PTR(char, target
));
534 /* Data items, 8/16/32/64 bit */
537 if (table
->pointer
) {
538 acpi_rs_out_string(name
, ACPI_CAST_PTR(char,
543 acpi_rs_out_integer8(name
, ACPI_GET8(target
));
547 case ACPI_RSD_UINT16
:
548 acpi_rs_out_integer16(name
, ACPI_GET16(target
));
551 case ACPI_RSD_UINT32
:
552 acpi_rs_out_integer32(name
, ACPI_GET32(target
));
555 case ACPI_RSD_UINT64
:
556 acpi_rs_out_integer64(name
, ACPI_GET64(target
));
559 /* Flags: 1-bit and 2-bit flags supported */
561 case ACPI_RSD_1BITFLAG
:
562 acpi_rs_out_string(name
, ACPI_CAST_PTR(char,
568 case ACPI_RSD_2BITFLAG
:
569 acpi_rs_out_string(name
, ACPI_CAST_PTR(char,
575 case ACPI_RSD_3BITFLAG
:
576 acpi_rs_out_string(name
, ACPI_CAST_PTR(char,
582 case ACPI_RSD_SHORTLIST
:
584 * Short byte list (single line output) for DMA and IRQ resources
585 * Note: The list length is obtained from the previous table entry
587 if (previous_target
) {
588 acpi_rs_out_title(name
);
589 acpi_rs_dump_short_byte_list(*previous_target
,
594 case ACPI_RSD_SHORTLISTX
:
596 * Short byte list (single line output) for GPIO vendor data
597 * Note: The list length is obtained from the previous table entry
599 if (previous_target
) {
600 acpi_rs_out_title(name
);
601 acpi_rs_dump_short_byte_list(*previous_target
,
603 (ACPI_CAST_INDIRECT_PTR
608 case ACPI_RSD_LONGLIST
:
610 * Long byte list for Vendor resource data
611 * Note: The list length is obtained from the previous table entry
613 if (previous_target
) {
614 acpi_rs_dump_byte_list(ACPI_GET16
620 case ACPI_RSD_DWORDLIST
:
622 * Dword list for Extended Interrupt resources
623 * Note: The list length is obtained from the previous table entry
625 if (previous_target
) {
626 acpi_rs_dump_dword_list(*previous_target
,
632 case ACPI_RSD_WORDLIST
:
634 * Word list for GPIO Pin Table
635 * Note: The list length is obtained from the previous table entry
637 if (previous_target
) {
638 acpi_rs_dump_word_list(*previous_target
,
639 *(ACPI_CAST_INDIRECT_PTR
644 case ACPI_RSD_ADDRESS
:
646 * Common flags for all Address resources
648 acpi_rs_dump_address_common(ACPI_CAST_PTR
649 (union acpi_resource_data
,
653 case ACPI_RSD_SOURCE
:
655 * Optional resource_source for Address resources
657 acpi_rs_dump_resource_source(ACPI_CAST_PTR(struct
658 acpi_resource_source
,
663 acpi_os_printf("**** Invalid table opcode [%X] ****\n",
673 /*******************************************************************************
675 * FUNCTION: acpi_rs_dump_resource_source
677 * PARAMETERS: resource_source - Pointer to a Resource Source struct
681 * DESCRIPTION: Common routine for dumping the optional resource_source and the
682 * corresponding resource_source_index.
684 ******************************************************************************/
687 acpi_rs_dump_resource_source(struct acpi_resource_source
*resource_source
)
689 ACPI_FUNCTION_ENTRY();
691 if (resource_source
->index
== 0xFF) {
695 acpi_rs_out_integer8("Resource Source Index", resource_source
->index
);
697 acpi_rs_out_string("Resource Source",
698 resource_source
->string_ptr
?
699 resource_source
->string_ptr
: "[Not Specified]");
702 /*******************************************************************************
704 * FUNCTION: acpi_rs_dump_address_common
706 * PARAMETERS: Resource - Pointer to an internal resource descriptor
710 * DESCRIPTION: Dump the fields that are common to all Address resource
713 ******************************************************************************/
715 static void acpi_rs_dump_address_common(union acpi_resource_data
*resource
)
717 ACPI_FUNCTION_ENTRY();
719 /* Decode the type-specific flags */
721 switch (resource
->address
.resource_type
) {
722 case ACPI_MEMORY_RANGE
:
724 acpi_rs_dump_descriptor(resource
, acpi_rs_dump_memory_flags
);
729 acpi_rs_dump_descriptor(resource
, acpi_rs_dump_io_flags
);
732 case ACPI_BUS_NUMBER_RANGE
:
734 acpi_rs_out_string("Resource Type", "Bus Number Range");
739 acpi_rs_out_integer8("Resource Type",
740 (u8
) resource
->address
.resource_type
);
744 /* Decode the general flags */
746 acpi_rs_dump_descriptor(resource
, acpi_rs_dump_general_flags
);
749 /*******************************************************************************
751 * FUNCTION: acpi_rs_dump_resource_list
753 * PARAMETERS: resource_list - Pointer to a resource descriptor list
757 * DESCRIPTION: Dispatches the structure to the correct dump routine.
759 ******************************************************************************/
761 void acpi_rs_dump_resource_list(struct acpi_resource
*resource_list
)
766 ACPI_FUNCTION_ENTRY();
768 if (!(acpi_dbg_level
& ACPI_LV_RESOURCES
)
769 || !(_COMPONENT
& acpi_dbg_layer
)) {
773 /* Walk list and dump all resource descriptors (END_TAG terminates) */
776 acpi_os_printf("\n[%02X] ", count
);
779 /* Validate Type before dispatch */
781 type
= resource_list
->type
;
782 if (type
> ACPI_RESOURCE_TYPE_MAX
) {
784 ("Invalid descriptor type (%X) in resource list\n",
785 resource_list
->type
);
789 /* Dump the resource descriptor */
791 if (type
== ACPI_RESOURCE_TYPE_SERIAL_BUS
) {
792 acpi_rs_dump_descriptor(&resource_list
->data
,
793 acpi_gbl_dump_serial_bus_dispatch
794 [resource_list
->data
.
795 common_serial_bus
.type
]);
797 acpi_rs_dump_descriptor(&resource_list
->data
,
798 acpi_gbl_dump_resource_dispatch
802 /* Point to the next resource structure */
804 resource_list
= ACPI_NEXT_RESOURCE(resource_list
);
806 /* Exit when END_TAG descriptor is reached */
808 } while (type
!= ACPI_RESOURCE_TYPE_END_TAG
);
811 /*******************************************************************************
813 * FUNCTION: acpi_rs_dump_irq_list
815 * PARAMETERS: route_table - Pointer to the routing table to dump.
819 * DESCRIPTION: Print IRQ routing table
821 ******************************************************************************/
823 void acpi_rs_dump_irq_list(u8
* route_table
)
825 struct acpi_pci_routing_table
*prt_element
;
828 ACPI_FUNCTION_ENTRY();
830 if (!(acpi_dbg_level
& ACPI_LV_RESOURCES
)
831 || !(_COMPONENT
& acpi_dbg_layer
)) {
835 prt_element
= ACPI_CAST_PTR(struct acpi_pci_routing_table
, route_table
);
837 /* Dump all table elements, Exit on zero length element */
839 for (count
= 0; prt_element
->length
; count
++) {
840 acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
842 acpi_rs_dump_descriptor(prt_element
, acpi_rs_dump_prt
);
844 prt_element
= ACPI_ADD_PTR(struct acpi_pci_routing_table
,
845 prt_element
, prt_element
->length
);
849 /*******************************************************************************
851 * FUNCTION: acpi_rs_out*
853 * PARAMETERS: Title - Name of the resource field
854 * Value - Value of the resource field
858 * DESCRIPTION: Miscellaneous helper functions to consistently format the
859 * output of the resource dump routines
861 ******************************************************************************/
863 static void acpi_rs_out_string(char *title
, char *value
)
865 acpi_os_printf("%27s : %s", title
, value
);
867 acpi_os_printf("[NULL NAMESTRING]");
869 acpi_os_printf("\n");
872 static void acpi_rs_out_integer8(char *title
, u8 value
)
874 acpi_os_printf("%27s : %2.2X\n", title
, value
);
877 static void acpi_rs_out_integer16(char *title
, u16 value
)
879 acpi_os_printf("%27s : %4.4X\n", title
, value
);
882 static void acpi_rs_out_integer32(char *title
, u32 value
)
884 acpi_os_printf("%27s : %8.8X\n", title
, value
);
887 static void acpi_rs_out_integer64(char *title
, u64 value
)
889 acpi_os_printf("%27s : %8.8X%8.8X\n", title
, ACPI_FORMAT_UINT64(value
));
892 static void acpi_rs_out_title(char *title
)
894 acpi_os_printf("%27s : ", title
);
897 /*******************************************************************************
899 * FUNCTION: acpi_rs_dump*List
901 * PARAMETERS: Length - Number of elements in the list
902 * Data - Start of the list
906 * DESCRIPTION: Miscellaneous functions to dump lists of raw data
908 ******************************************************************************/
910 static void acpi_rs_dump_byte_list(u16 length
, u8
* data
)
914 for (i
= 0; i
< length
; i
++) {
915 acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i
, data
[i
]);
919 static void acpi_rs_dump_short_byte_list(u8 length
, u8
* data
)
923 for (i
= 0; i
< length
; i
++) {
924 acpi_os_printf("%X ", data
[i
]);
926 acpi_os_printf("\n");
929 static void acpi_rs_dump_dword_list(u8 length
, u32
* data
)
933 for (i
= 0; i
< length
; i
++) {
934 acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i
, data
[i
]);
938 static void acpi_rs_dump_word_list(u16 length
, u16
*data
)
942 for (i
= 0; i
< length
; i
++) {
943 acpi_os_printf("%25s%2.2X : %4.4X\n", "Word", i
, data
[i
]);