Linux Audio

Check our new training course

Loading...
v3.1
 
  1/*******************************************************************************
  2 *
  3 * Module Name: rsdump - Functions to display the resource structures.
  4 *
  5 ******************************************************************************/
  6
  7/*
  8 * Copyright (C) 2000 - 2011, Intel Corp.
  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
 44#include <acpi/acpi.h>
 45#include "accommon.h"
 46#include "acresrc.h"
 47
 48#define _COMPONENT          ACPI_RESOURCES
 49ACPI_MODULE_NAME("rsdump")
 50#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
 
 
 
 51/* Local prototypes */
 52static void acpi_rs_out_string(char *title, char *value);
 
 
 53
 54static void acpi_rs_out_integer8(char *title, u8 value);
 55
 56static void acpi_rs_out_integer16(char *title, u16 value);
 57
 58static void acpi_rs_out_integer32(char *title, u32 value);
 59
 60static void acpi_rs_out_integer64(char *title, u64 value);
 61
 62static void acpi_rs_out_title(char *title);
 63
 64static void acpi_rs_dump_byte_list(u16 length, u8 * data);
 65
 66static void acpi_rs_dump_dword_list(u8 length, u32 * data);
 67
 68static void acpi_rs_dump_short_byte_list(u8 length, u8 * data);
 69
 70static void
 71acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source);
 72
 
 
 
 
 73static void acpi_rs_dump_address_common(union acpi_resource_data *resource);
 74
 75static void
 76acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table);
 77
 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))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 81
 82/*******************************************************************************
 83 *
 84 * Resource Descriptor info tables
 
 
 
 
 85 *
 86 * Note: The first table entry must be a Title or Literal and must contain
 87 * the table length (number of table entries)
 88 *
 89 ******************************************************************************/
 90
 91struct 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}
105};
106
107struct 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}
119};
120
121struct 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}
130};
131
132struct 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}
135};
136
137struct 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}
146};
147
148struct 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}
154};
155
156struct 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}
162};
163
164struct 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}
167};
168
169struct 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}
182};
183
184struct 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}
197};
198
199struct 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}
208};
209
210struct 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}
225};
226
227struct 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}
242};
243
244struct 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}
259};
260
261struct 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}
277};
278
279struct 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}
296};
297
298struct 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}
310};
311
312/*
313 * Tables used for common address descriptor flag fields
314 */
315static 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}
326};
327
328static 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}
339};
340
341static 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}
350};
351
352/*
353 * Table used to dump _PRT contents
354 */
355static 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}
361};
 
 
 
 
 
 
 
 
 
362
363/*******************************************************************************
364 *
365 * FUNCTION:    acpi_rs_dump_descriptor
366 *
367 * PARAMETERS:  Resource
 
368 *
369 * RETURN:      None
370 *
371 * DESCRIPTION:
372 *
373 ******************************************************************************/
374
375static void
376acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
377{
378	u8 *target = NULL;
379	u8 *previous_target;
380	char *name;
381	u8 count;
382
383	/* First table entry must contain the table length (# of table entries) */
384
385	count = table->offset;
386
387	while (count) {
388		previous_target = target;
389		target = ACPI_ADD_PTR(u8, resource, table->offset);
390		name = table->name;
391
392		switch (table->opcode) {
393		case ACPI_RSD_TITLE:
394			/*
395			 * Optional resource title
396			 */
397			if (table->name) {
398				acpi_os_printf("%s Resource\n", name);
399			}
400			break;
401
402			/* Strings */
403
404		case ACPI_RSD_LITERAL:
 
405			acpi_rs_out_string(name,
406					   ACPI_CAST_PTR(char, table->pointer));
407			break;
408
409		case ACPI_RSD_STRING:
 
410			acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
411			break;
412
413			/* Data items, 8/16/32/64 bit */
414
415		case ACPI_RSD_UINT8:
416			acpi_rs_out_integer8(name, ACPI_GET8(target));
 
 
 
 
 
 
417			break;
418
419		case ACPI_RSD_UINT16:
 
420			acpi_rs_out_integer16(name, ACPI_GET16(target));
421			break;
422
423		case ACPI_RSD_UINT32:
 
424			acpi_rs_out_integer32(name, ACPI_GET32(target));
425			break;
426
427		case ACPI_RSD_UINT64:
 
428			acpi_rs_out_integer64(name, ACPI_GET64(target));
429			break;
430
431			/* Flags: 1-bit and 2-bit flags supported */
432
433		case ACPI_RSD_1BITFLAG:
434			acpi_rs_out_string(name, ACPI_CAST_PTR(char,
435							       table->
436							       pointer[*target &
437								       0x01]));
438			break;
439
440		case ACPI_RSD_2BITFLAG:
441			acpi_rs_out_string(name, ACPI_CAST_PTR(char,
442							       table->
443							       pointer[*target &
444								       0x03]));
 
 
 
 
 
445			break;
446
447		case ACPI_RSD_SHORTLIST:
448			/*
449			 * Short byte list (single line output) for DMA and IRQ resources
450			 * Note: The list length is obtained from the previous table entry
451			 */
452			if (previous_target) {
453				acpi_rs_out_title(name);
454				acpi_rs_dump_short_byte_list(*previous_target,
455							     target);
456			}
457			break;
458
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459		case ACPI_RSD_LONGLIST:
460			/*
461			 * Long byte list for Vendor resource data
462			 * Note: The list length is obtained from the previous table entry
463			 */
464			if (previous_target) {
465				acpi_rs_dump_byte_list(ACPI_GET16
466						       (previous_target),
467						       target);
468			}
469			break;
470
471		case ACPI_RSD_DWORDLIST:
472			/*
473			 * Dword list for Extended Interrupt resources
474			 * Note: The list length is obtained from the previous table entry
475			 */
476			if (previous_target) {
477				acpi_rs_dump_dword_list(*previous_target,
478							ACPI_CAST_PTR(u32,
479								      target));
480			}
481			break;
482
 
 
 
 
 
 
 
 
 
 
 
 
483		case ACPI_RSD_ADDRESS:
484			/*
485			 * Common flags for all Address resources
486			 */
487			acpi_rs_dump_address_common(ACPI_CAST_PTR
488						    (union acpi_resource_data,
489						     target));
490			break;
491
492		case ACPI_RSD_SOURCE:
493			/*
494			 * Optional resource_source for Address resources
495			 */
496			acpi_rs_dump_resource_source(ACPI_CAST_PTR(struct
 
497								   acpi_resource_source,
498								   target));
499			break;
500
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
501		default:
 
502			acpi_os_printf("**** Invalid table opcode [%X] ****\n",
503				       table->opcode);
504			return;
505		}
506
507		table++;
508		count--;
509	}
510}
511
512/*******************************************************************************
513 *
514 * FUNCTION:    acpi_rs_dump_resource_source
515 *
516 * PARAMETERS:  resource_source     - Pointer to a Resource Source struct
517 *
518 * RETURN:      None
519 *
520 * DESCRIPTION: Common routine for dumping the optional resource_source and the
521 *              corresponding resource_source_index.
522 *
523 ******************************************************************************/
524
525static void
526acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
527{
528	ACPI_FUNCTION_ENTRY();
529
530	if (resource_source->index == 0xFF) {
531		return;
532	}
533
534	acpi_rs_out_integer8("Resource Source Index", resource_source->index);
535
536	acpi_rs_out_string("Resource Source",
537			   resource_source->string_ptr ?
538			   resource_source->string_ptr : "[Not Specified]");
539}
540
541/*******************************************************************************
542 *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
543 * FUNCTION:    acpi_rs_dump_address_common
544 *
545 * PARAMETERS:  Resource        - Pointer to an internal resource descriptor
546 *
547 * RETURN:      None
548 *
549 * DESCRIPTION: Dump the fields that are common to all Address resource
550 *              descriptors
551 *
552 ******************************************************************************/
553
554static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
555{
556	ACPI_FUNCTION_ENTRY();
557
558	/* Decode the type-specific flags */
559
560	switch (resource->address.resource_type) {
561	case ACPI_MEMORY_RANGE:
562
563		acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags);
564		break;
565
566	case ACPI_IO_RANGE:
567
568		acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags);
569		break;
570
571	case ACPI_BUS_NUMBER_RANGE:
572
573		acpi_rs_out_string("Resource Type", "Bus Number Range");
574		break;
575
576	default:
577
578		acpi_rs_out_integer8("Resource Type",
579				     (u8) resource->address.resource_type);
580		break;
581	}
582
583	/* Decode the general flags */
584
585	acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags);
586}
587
588/*******************************************************************************
589 *
590 * FUNCTION:    acpi_rs_dump_resource_list
591 *
592 * PARAMETERS:  resource_list       - Pointer to a resource descriptor list
593 *
594 * RETURN:      None
595 *
596 * DESCRIPTION: Dispatches the structure to the correct dump routine.
597 *
598 ******************************************************************************/
599
600void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
601{
602	u32 count = 0;
603	u32 type;
604
605	ACPI_FUNCTION_ENTRY();
606
607	if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
608	    || !(_COMPONENT & acpi_dbg_layer)) {
609		return;
610	}
611
612	/* Walk list and dump all resource descriptors (END_TAG terminates) */
613
614	do {
615		acpi_os_printf("\n[%02X] ", count);
616		count++;
617
618		/* Validate Type before dispatch */
619
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;
626		}
627
628		/* Dump the resource descriptor */
629
630		acpi_rs_dump_descriptor(&resource_list->data,
631					acpi_gbl_dump_resource_dispatch[type]);
632
633		/* Point to the next resource structure */
634
635		resource_list =
636		    ACPI_ADD_PTR(struct acpi_resource, resource_list,
637				 resource_list->length);
638
639		/* Exit when END_TAG descriptor is reached */
640
641	} while (type != ACPI_RESOURCE_TYPE_END_TAG);
642}
643
644/*******************************************************************************
645 *
646 * FUNCTION:    acpi_rs_dump_irq_list
647 *
648 * PARAMETERS:  route_table     - Pointer to the routing table to dump.
649 *
650 * RETURN:      None
651 *
652 * DESCRIPTION: Print IRQ routing table
653 *
654 ******************************************************************************/
655
656void acpi_rs_dump_irq_list(u8 * route_table)
657{
658	struct acpi_pci_routing_table *prt_element;
659	u8 count;
660
661	ACPI_FUNCTION_ENTRY();
662
663	if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
664	    || !(_COMPONENT & acpi_dbg_layer)) {
665		return;
666	}
667
668	prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table);
669
670	/* Dump all table elements, Exit on zero length element */
671
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);
676
677		prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table,
678					   prt_element, prt_element->length);
679	}
680}
681
682/*******************************************************************************
683 *
684 * FUNCTION:    acpi_rs_out*
685 *
686 * PARAMETERS:  Title       - Name of the resource field
687 *              Value       - Value of the resource field
688 *
689 * RETURN:      None
690 *
691 * DESCRIPTION: Miscellaneous helper functions to consistently format the
692 *              output of the resource dump routines
693 *
694 ******************************************************************************/
695
696static void acpi_rs_out_string(char *title, char *value)
697{
 
698	acpi_os_printf("%27s : %s", title, value);
699	if (!*value) {
700		acpi_os_printf("[NULL NAMESTRING]");
701	}
702	acpi_os_printf("\n");
703}
704
705static void acpi_rs_out_integer8(char *title, u8 value)
706{
707	acpi_os_printf("%27s : %2.2X\n", title, value);
708}
709
710static void acpi_rs_out_integer16(char *title, u16 value)
711{
 
712	acpi_os_printf("%27s : %4.4X\n", title, value);
713}
714
715static void acpi_rs_out_integer32(char *title, u32 value)
716{
 
717	acpi_os_printf("%27s : %8.8X\n", title, value);
718}
719
720static void acpi_rs_out_integer64(char *title, u64 value)
721{
 
722	acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
723}
724
725static void acpi_rs_out_title(char *title)
726{
 
727	acpi_os_printf("%27s : ", title);
728}
729
730/*******************************************************************************
731 *
732 * FUNCTION:    acpi_rs_dump*List
733 *
734 * PARAMETERS:  Length      - Number of elements in the list
735 *              Data        - Start of the list
736 *
737 * RETURN:      None
738 *
739 * DESCRIPTION: Miscellaneous functions to dump lists of raw data
740 *
741 ******************************************************************************/
742
743static void acpi_rs_dump_byte_list(u16 length, u8 * data)
744{
745	u8 i;
746
747	for (i = 0; i < length; i++) {
748		acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]);
749	}
750}
751
752static void acpi_rs_dump_short_byte_list(u8 length, u8 * data)
753{
754	u8 i;
755
756	for (i = 0; i < length; i++) {
757		acpi_os_printf("%X ", data[i]);
758	}
 
759	acpi_os_printf("\n");
760}
761
762static void acpi_rs_dump_dword_list(u8 length, u32 * data)
763{
764	u8 i;
765
766	for (i = 0; i < length; i++) {
767		acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]);
768	}
769}
770
771#endif
 
 
 
 
 
 
 
v5.9
  1// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
  2/*******************************************************************************
  3 *
  4 * Module Name: rsdump - AML debugger support for resource structures.
  5 *
  6 ******************************************************************************/
  7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  8#include <acpi/acpi.h>
  9#include "accommon.h"
 10#include "acresrc.h"
 11
 12#define _COMPONENT          ACPI_RESOURCES
 13ACPI_MODULE_NAME("rsdump")
 14
 15/*
 16 * All functions in this module are used by the AML Debugger only
 17 */
 18/* Local prototypes */
 19static void acpi_rs_out_string(const char *title, const char *value);
 20
 21static void acpi_rs_out_integer8(const char *title, u8 value);
 22
 23static void acpi_rs_out_integer16(const char *title, u16 value);
 24
 25static void acpi_rs_out_integer32(const char *title, u32 value);
 26
 27static void acpi_rs_out_integer64(const char *title, u64 value);
 28
 29static void acpi_rs_out_title(const char *title);
 30
 31static void acpi_rs_dump_byte_list(u16 length, u8 *data);
 32
 33static void acpi_rs_dump_word_list(u16 length, u16 *data);
 34
 35static void acpi_rs_dump_dword_list(u8 length, u32 *data);
 36
 37static void acpi_rs_dump_short_byte_list(u8 length, u8 *data);
 38
 39static void
 40acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source);
 41
 42static void
 43acpi_rs_dump_resource_label(char *title,
 44			    struct acpi_resource_label *resource_label);
 45
 46static void acpi_rs_dump_address_common(union acpi_resource_data *resource);
 47
 48static void
 49acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table);
 50
 51/*******************************************************************************
 52 *
 53 * FUNCTION:    acpi_rs_dump_resource_list
 54 *
 55 * PARAMETERS:  resource_list       - Pointer to a resource descriptor list
 56 *
 57 * RETURN:      None
 58 *
 59 * DESCRIPTION: Dispatches the structure to the correct dump routine.
 60 *
 61 ******************************************************************************/
 62
 63void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
 64{
 65	u32 count = 0;
 66	u32 type;
 67
 68	ACPI_FUNCTION_ENTRY();
 69
 70	/* Check if debug output enabled */
 71
 72	if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) {
 73		return;
 74	}
 75
 76	/* Walk list and dump all resource descriptors (END_TAG terminates) */
 77
 78	do {
 79		acpi_os_printf("\n[%02X] ", count);
 80		count++;
 81
 82		/* Validate Type before dispatch */
 83
 84		type = resource_list->type;
 85		if (type > ACPI_RESOURCE_TYPE_MAX) {
 86			acpi_os_printf
 87			    ("Invalid descriptor type (%X) in resource list\n",
 88			     resource_list->type);
 89			return;
 90		}
 91
 92		/* Sanity check the length. It must not be zero, or we loop forever */
 93
 94		if (!resource_list->length) {
 95			acpi_os_printf
 96			    ("Invalid zero length descriptor in resource list\n");
 97			return;
 98		}
 99
100		/* Dump the resource descriptor */
101
102		if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
103			acpi_rs_dump_descriptor(&resource_list->data,
104						acpi_gbl_dump_serial_bus_dispatch
105						[resource_list->data.
106						 common_serial_bus.type]);
107		} else {
108			acpi_rs_dump_descriptor(&resource_list->data,
109						acpi_gbl_dump_resource_dispatch
110						[type]);
111		}
112
113		/* Point to the next resource structure */
114
115		resource_list = ACPI_NEXT_RESOURCE(resource_list);
116
117		/* Exit when END_TAG descriptor is reached */
118
119	} while (type != ACPI_RESOURCE_TYPE_END_TAG);
120}
121
122/*******************************************************************************
123 *
124 * FUNCTION:    acpi_rs_dump_irq_list
125 *
126 * PARAMETERS:  route_table     - Pointer to the routing table to dump.
127 *
128 * RETURN:      None
129 *
130 * DESCRIPTION: Print IRQ routing table
 
131 *
132 ******************************************************************************/
133
134void acpi_rs_dump_irq_list(u8 *route_table)
135{
136	struct acpi_pci_routing_table *prt_element;
137	u8 count;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
139	ACPI_FUNCTION_ENTRY();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
141	/* Check if debug output enabled */
142
143	if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) {
144		return;
145	}
146
147	prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table);
148
149	/* Dump all table elements, Exit on zero length element */
150
151	for (count = 0; prt_element->length; count++) {
152		acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
153			       count);
154		acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt);
155
156		prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table,
157					   prt_element, prt_element->length);
158	}
159}
160
161/*******************************************************************************
162 *
163 * FUNCTION:    acpi_rs_dump_descriptor
164 *
165 * PARAMETERS:  resource            - Buffer containing the resource
166 *              table               - Table entry to decode the resource
167 *
168 * RETURN:      None
169 *
170 * DESCRIPTION: Dump a resource descriptor based on a dump table entry.
171 *
172 ******************************************************************************/
173
174static void
175acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
176{
177	u8 *target = NULL;
178	u8 *previous_target;
179	const char *name;
180	u8 count;
181
182	/* First table entry must contain the table length (# of table entries) */
183
184	count = table->offset;
185
186	while (count) {
187		previous_target = target;
188		target = ACPI_ADD_PTR(u8, resource, table->offset);
189		name = table->name;
190
191		switch (table->opcode) {
192		case ACPI_RSD_TITLE:
193			/*
194			 * Optional resource title
195			 */
196			if (table->name) {
197				acpi_os_printf("%s Resource\n", name);
198			}
199			break;
200
201			/* Strings */
202
203		case ACPI_RSD_LITERAL:
204
205			acpi_rs_out_string(name,
206					   ACPI_CAST_PTR(char, table->pointer));
207			break;
208
209		case ACPI_RSD_STRING:
210
211			acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
212			break;
213
214			/* Data items, 8/16/32/64 bit */
215
216		case ACPI_RSD_UINT8:
217
218			if (table->pointer) {
219				acpi_rs_out_string(name,
220						   table->pointer[*target]);
221			} else {
222				acpi_rs_out_integer8(name, ACPI_GET8(target));
223			}
224			break;
225
226		case ACPI_RSD_UINT16:
227
228			acpi_rs_out_integer16(name, ACPI_GET16(target));
229			break;
230
231		case ACPI_RSD_UINT32:
232
233			acpi_rs_out_integer32(name, ACPI_GET32(target));
234			break;
235
236		case ACPI_RSD_UINT64:
237
238			acpi_rs_out_integer64(name, ACPI_GET64(target));
239			break;
240
241			/* Flags: 1-bit and 2-bit flags supported */
242
243		case ACPI_RSD_1BITFLAG:
244
245			acpi_rs_out_string(name,
246					   table->pointer[*target & 0x01]);
 
247			break;
248
249		case ACPI_RSD_2BITFLAG:
250
251			acpi_rs_out_string(name,
252					   table->pointer[*target & 0x03]);
253			break;
254
255		case ACPI_RSD_3BITFLAG:
256
257			acpi_rs_out_string(name,
258					   table->pointer[*target & 0x07]);
259			break;
260
261		case ACPI_RSD_SHORTLIST:
262			/*
263			 * Short byte list (single line output) for DMA and IRQ resources
264			 * Note: The list length is obtained from the previous table entry
265			 */
266			if (previous_target) {
267				acpi_rs_out_title(name);
268				acpi_rs_dump_short_byte_list(*previous_target,
269							     target);
270			}
271			break;
272
273		case ACPI_RSD_SHORTLISTX:
274			/*
275			 * Short byte list (single line output) for GPIO vendor data
276			 * Note: The list length is obtained from the previous table entry
277			 */
278			if (previous_target) {
279				acpi_rs_out_title(name);
280				acpi_rs_dump_short_byte_list(*previous_target,
281							     *
282							     (ACPI_CAST_INDIRECT_PTR
283							      (u8, target)));
284			}
285			break;
286
287		case ACPI_RSD_LONGLIST:
288			/*
289			 * Long byte list for Vendor resource data
290			 * Note: The list length is obtained from the previous table entry
291			 */
292			if (previous_target) {
293				acpi_rs_dump_byte_list(ACPI_GET16
294						       (previous_target),
295						       target);
296			}
297			break;
298
299		case ACPI_RSD_DWORDLIST:
300			/*
301			 * Dword list for Extended Interrupt resources
302			 * Note: The list length is obtained from the previous table entry
303			 */
304			if (previous_target) {
305				acpi_rs_dump_dword_list(*previous_target,
306							ACPI_CAST_PTR(u32,
307								      target));
308			}
309			break;
310
311		case ACPI_RSD_WORDLIST:
312			/*
313			 * Word list for GPIO Pin Table
314			 * Note: The list length is obtained from the previous table entry
315			 */
316			if (previous_target) {
317				acpi_rs_dump_word_list(*previous_target,
318						       *(ACPI_CAST_INDIRECT_PTR
319							 (u16, target)));
320			}
321			break;
322
323		case ACPI_RSD_ADDRESS:
324			/*
325			 * Common flags for all Address resources
326			 */
327			acpi_rs_dump_address_common(ACPI_CAST_PTR
328						    (union acpi_resource_data,
329						     target));
330			break;
331
332		case ACPI_RSD_SOURCE:
333			/*
334			 * Optional resource_source for Address resources
335			 */
336			acpi_rs_dump_resource_source(ACPI_CAST_PTR
337						     (struct
338								   acpi_resource_source,
339								   target));
340			break;
341
342		case ACPI_RSD_LABEL:
343			/*
344			 * resource_label
345			 */
346			acpi_rs_dump_resource_label("Resource Label",
347						    ACPI_CAST_PTR(struct
348								  acpi_resource_label,
349								  target));
350			break;
351
352		case ACPI_RSD_SOURCE_LABEL:
353			/*
354			 * resource_source_label
355			 */
356			acpi_rs_dump_resource_label("Resource Source Label",
357						    ACPI_CAST_PTR(struct
358								  acpi_resource_label,
359								  target));
360			break;
361
362		default:
363
364			acpi_os_printf("**** Invalid table opcode [%X] ****\n",
365				       table->opcode);
366			return;
367		}
368
369		table++;
370		count--;
371	}
372}
373
374/*******************************************************************************
375 *
376 * FUNCTION:    acpi_rs_dump_resource_source
377 *
378 * PARAMETERS:  resource_source     - Pointer to a Resource Source struct
379 *
380 * RETURN:      None
381 *
382 * DESCRIPTION: Common routine for dumping the optional resource_source and the
383 *              corresponding resource_source_index.
384 *
385 ******************************************************************************/
386
387static void
388acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
389{
390	ACPI_FUNCTION_ENTRY();
391
392	if (resource_source->index == 0xFF) {
393		return;
394	}
395
396	acpi_rs_out_integer8("Resource Source Index", resource_source->index);
397
398	acpi_rs_out_string("Resource Source",
399			   resource_source->string_ptr ?
400			   resource_source->string_ptr : "[Not Specified]");
401}
402
403/*******************************************************************************
404 *
405 * FUNCTION:    acpi_rs_dump_resource_label
406 *
407 * PARAMETERS:  title              - Title of the dumped resource field
408 *              resource_label     - Pointer to a Resource Label struct
409 *
410 * RETURN:      None
411 *
412 * DESCRIPTION: Common routine for dumping the resource_label
413 *
414 ******************************************************************************/
415
416static void
417acpi_rs_dump_resource_label(char *title,
418			    struct acpi_resource_label *resource_label)
419{
420	ACPI_FUNCTION_ENTRY();
421
422	acpi_rs_out_string(title,
423			   resource_label->string_ptr ?
424			   resource_label->string_ptr : "[Not Specified]");
425}
426
427/*******************************************************************************
428 *
429 * FUNCTION:    acpi_rs_dump_address_common
430 *
431 * PARAMETERS:  resource        - Pointer to an internal resource descriptor
432 *
433 * RETURN:      None
434 *
435 * DESCRIPTION: Dump the fields that are common to all Address resource
436 *              descriptors
437 *
438 ******************************************************************************/
439
440static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
441{
442	ACPI_FUNCTION_ENTRY();
443
444	/* Decode the type-specific flags */
445
446	switch (resource->address.resource_type) {
447	case ACPI_MEMORY_RANGE:
448
449		acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags);
450		break;
451
452	case ACPI_IO_RANGE:
453
454		acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags);
455		break;
456
457	case ACPI_BUS_NUMBER_RANGE:
458
459		acpi_rs_out_string("Resource Type", "Bus Number Range");
460		break;
461
462	default:
463
464		acpi_rs_out_integer8("Resource Type",
465				     (u8) resource->address.resource_type);
466		break;
467	}
468
469	/* Decode the general flags */
470
471	acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags);
472}
473
474/*******************************************************************************
475 *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
476 * FUNCTION:    acpi_rs_out*
477 *
478 * PARAMETERS:  title       - Name of the resource field
479 *              value       - Value of the resource field
480 *
481 * RETURN:      None
482 *
483 * DESCRIPTION: Miscellaneous helper functions to consistently format the
484 *              output of the resource dump routines
485 *
486 ******************************************************************************/
487
488static void acpi_rs_out_string(const char *title, const char *value)
489{
490
491	acpi_os_printf("%27s : %s", title, value);
492	if (!*value) {
493		acpi_os_printf("[NULL NAMESTRING]");
494	}
495	acpi_os_printf("\n");
496}
497
498static void acpi_rs_out_integer8(const char *title, u8 value)
499{
500	acpi_os_printf("%27s : %2.2X\n", title, value);
501}
502
503static void acpi_rs_out_integer16(const char *title, u16 value)
504{
505
506	acpi_os_printf("%27s : %4.4X\n", title, value);
507}
508
509static void acpi_rs_out_integer32(const char *title, u32 value)
510{
511
512	acpi_os_printf("%27s : %8.8X\n", title, value);
513}
514
515static void acpi_rs_out_integer64(const char *title, u64 value)
516{
517
518	acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
519}
520
521static void acpi_rs_out_title(const char *title)
522{
523
524	acpi_os_printf("%27s : ", title);
525}
526
527/*******************************************************************************
528 *
529 * FUNCTION:    acpi_rs_dump*List
530 *
531 * PARAMETERS:  length      - Number of elements in the list
532 *              data        - Start of the list
533 *
534 * RETURN:      None
535 *
536 * DESCRIPTION: Miscellaneous functions to dump lists of raw data
537 *
538 ******************************************************************************/
539
540static void acpi_rs_dump_byte_list(u16 length, u8 * data)
541{
542	u16 i;
543
544	for (i = 0; i < length; i++) {
545		acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]);
546	}
547}
548
549static void acpi_rs_dump_short_byte_list(u8 length, u8 * data)
550{
551	u8 i;
552
553	for (i = 0; i < length; i++) {
554		acpi_os_printf("%X ", data[i]);
555	}
556
557	acpi_os_printf("\n");
558}
559
560static void acpi_rs_dump_dword_list(u8 length, u32 * data)
561{
562	u8 i;
563
564	for (i = 0; i < length; i++) {
565		acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]);
566	}
567}
568
569static void acpi_rs_dump_word_list(u16 length, u16 *data)
570{
571	u16 i;
572
573	for (i = 0; i < length; i++) {
574		acpi_os_printf("%25s%2.2X : %4.4X\n", "Word", i, data[i]);
575	}
576}