1 /*******************************************************************************
2  *
3  * Module Name: rsdump - Functions to display the resource structures.
4  *
5  ******************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2004, 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 
44 
45 #include <acpi/acpi.h>
46 #include <acpi/acresrc.h>
47 
48 #define _COMPONENT          ACPI_RESOURCES
49 	 ACPI_MODULE_NAME    ("rsdump")
50 
51 
52 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
53 
54 /*******************************************************************************
55  *
56  * FUNCTION:    acpi_rs_dump_irq
57  *
58  * PARAMETERS:  Data            - pointer to the resource structure to dump.
59  *
60  * RETURN:      None
61  *
62  * DESCRIPTION: Prints out the various members of the Data structure type.
63  *
64  ******************************************************************************/
65 
66 void
acpi_rs_dump_irq(union acpi_resource_data * data)67 acpi_rs_dump_irq (
68 	union acpi_resource_data        *data)
69 {
70 	struct acpi_resource_irq        *irq_data = (struct acpi_resource_irq *) data;
71 	u8                              index = 0;
72 
73 
74 	ACPI_FUNCTION_ENTRY ();
75 
76 
77 	acpi_os_printf ("IRQ Resource\n");
78 
79 	acpi_os_printf ("  %s Triggered\n",
80 			 ACPI_LEVEL_SENSITIVE == irq_data->edge_level ? "Level" : "Edge");
81 
82 	acpi_os_printf ("  Active %s\n",
83 			 ACPI_ACTIVE_LOW == irq_data->active_high_low ? "Low" : "High");
84 
85 	acpi_os_printf ("  %s\n",
86 			 ACPI_SHARED == irq_data->shared_exclusive ? "Shared" : "Exclusive");
87 
88 	acpi_os_printf ("  %X Interrupts ( ", irq_data->number_of_interrupts);
89 
90 	for (index = 0; index < irq_data->number_of_interrupts; index++) {
91 		acpi_os_printf ("%X ", irq_data->interrupts[index]);
92 	}
93 
94 	acpi_os_printf (")\n");
95 	return;
96 }
97 
98 
99 /*******************************************************************************
100  *
101  * FUNCTION:    acpi_rs_dump_dma
102  *
103  * PARAMETERS:  Data            - pointer to the resource structure to dump.
104  *
105  * RETURN:      None
106  *
107  * DESCRIPTION: Prints out the various members of the Data structure type.
108  *
109  ******************************************************************************/
110 
111 void
acpi_rs_dump_dma(union acpi_resource_data * data)112 acpi_rs_dump_dma (
113 	union acpi_resource_data        *data)
114 {
115 	struct acpi_resource_dma        *dma_data = (struct acpi_resource_dma *) data;
116 	u8                              index = 0;
117 
118 
119 	ACPI_FUNCTION_ENTRY ();
120 
121 
122 	acpi_os_printf ("DMA Resource\n");
123 
124 	switch (dma_data->type) {
125 	case ACPI_COMPATIBILITY:
126 		acpi_os_printf ("  Compatibility mode\n");
127 		break;
128 
129 	case ACPI_TYPE_A:
130 		acpi_os_printf ("  Type A\n");
131 		break;
132 
133 	case ACPI_TYPE_B:
134 		acpi_os_printf ("  Type B\n");
135 		break;
136 
137 	case ACPI_TYPE_F:
138 		acpi_os_printf ("  Type F\n");
139 		break;
140 
141 	default:
142 		acpi_os_printf ("  Invalid DMA type\n");
143 		break;
144 	}
145 
146 	acpi_os_printf ("  %sBus Master\n",
147 			 ACPI_BUS_MASTER == dma_data->bus_master ? "" : "Not a ");
148 
149 
150 	switch (dma_data->transfer) {
151 	case ACPI_TRANSFER_8:
152 		acpi_os_printf ("  8-bit only transfer\n");
153 		break;
154 
155 	case ACPI_TRANSFER_8_16:
156 		acpi_os_printf ("  8 and 16-bit transfer\n");
157 		break;
158 
159 	case ACPI_TRANSFER_16:
160 		acpi_os_printf ("  16 bit only transfer\n");
161 		break;
162 
163 	default:
164 		acpi_os_printf ("  Invalid transfer preference\n");
165 		break;
166 	}
167 
168 	acpi_os_printf ("  Number of Channels: %X ( ", dma_data->number_of_channels);
169 
170 	for (index = 0; index < dma_data->number_of_channels; index++) {
171 		acpi_os_printf ("%X ", dma_data->channels[index]);
172 	}
173 
174 	acpi_os_printf (")\n");
175 	return;
176 }
177 
178 
179 /*******************************************************************************
180  *
181  * FUNCTION:    acpi_rs_dump_start_depend_fns
182  *
183  * PARAMETERS:  Data            - pointer to the resource structure to dump.
184  *
185  * RETURN:      None
186  *
187  * DESCRIPTION: Prints out the various members of the Data structure type.
188  *
189  ******************************************************************************/
190 
191 void
acpi_rs_dump_start_depend_fns(union acpi_resource_data * data)192 acpi_rs_dump_start_depend_fns (
193 	union acpi_resource_data        *data)
194 {
195 	struct acpi_resource_start_dpf *sdf_data = (struct acpi_resource_start_dpf *) data;
196 
197 
198 	ACPI_FUNCTION_ENTRY ();
199 
200 
201 	acpi_os_printf ("Start Dependent Functions Resource\n");
202 
203 	switch (sdf_data->compatibility_priority) {
204 	case ACPI_GOOD_CONFIGURATION:
205 		acpi_os_printf ("  Good configuration\n");
206 		break;
207 
208 	case ACPI_ACCEPTABLE_CONFIGURATION:
209 		acpi_os_printf ("  Acceptable configuration\n");
210 		break;
211 
212 	case ACPI_SUB_OPTIMAL_CONFIGURATION:
213 		acpi_os_printf ("  Sub-optimal configuration\n");
214 		break;
215 
216 	default:
217 		acpi_os_printf ("  Invalid compatibility priority\n");
218 		break;
219 	}
220 
221 	switch(sdf_data->performance_robustness) {
222 	case ACPI_GOOD_CONFIGURATION:
223 		acpi_os_printf ("  Good configuration\n");
224 		break;
225 
226 	case ACPI_ACCEPTABLE_CONFIGURATION:
227 		acpi_os_printf ("  Acceptable configuration\n");
228 		break;
229 
230 	case ACPI_SUB_OPTIMAL_CONFIGURATION:
231 		acpi_os_printf ("  Sub-optimal configuration\n");
232 		break;
233 
234 	default:
235 		acpi_os_printf ("  Invalid performance "
236 				  "robustness preference\n");
237 		break;
238 	}
239 
240 	return;
241 }
242 
243 
244 /*******************************************************************************
245  *
246  * FUNCTION:    acpi_rs_dump_io
247  *
248  * PARAMETERS:  Data            - pointer to the resource structure to dump.
249  *
250  * RETURN:      None
251  *
252  * DESCRIPTION: Prints out the various members of the Data structure type.
253  *
254  ******************************************************************************/
255 
256 void
acpi_rs_dump_io(union acpi_resource_data * data)257 acpi_rs_dump_io (
258 	union acpi_resource_data        *data)
259 {
260 	struct acpi_resource_io         *io_data = (struct acpi_resource_io *) data;
261 
262 
263 	ACPI_FUNCTION_ENTRY ();
264 
265 
266 	acpi_os_printf ("Io Resource\n");
267 
268 	acpi_os_printf ("  %d bit decode\n",
269 			 ACPI_DECODE_16 == io_data->io_decode ? 16 : 10);
270 
271 	acpi_os_printf ("  Range minimum base: %08X\n",
272 			 io_data->min_base_address);
273 
274 	acpi_os_printf ("  Range maximum base: %08X\n",
275 			 io_data->max_base_address);
276 
277 	acpi_os_printf ("  Alignment: %08X\n",
278 			 io_data->alignment);
279 
280 	acpi_os_printf ("  Range Length: %08X\n",
281 			 io_data->range_length);
282 
283 	return;
284 }
285 
286 
287 /*******************************************************************************
288  *
289  * FUNCTION:    acpi_rs_dump_fixed_io
290  *
291  * PARAMETERS:  Data            - pointer to the resource structure to dump.
292  *
293  * RETURN:      None
294  *
295  * DESCRIPTION: Prints out the various members of the Data structure type.
296  *
297  ******************************************************************************/
298 
299 void
acpi_rs_dump_fixed_io(union acpi_resource_data * data)300 acpi_rs_dump_fixed_io (
301 	union acpi_resource_data        *data)
302 {
303 	struct acpi_resource_fixed_io   *fixed_io_data = (struct acpi_resource_fixed_io *) data;
304 
305 
306 	ACPI_FUNCTION_ENTRY ();
307 
308 
309 	acpi_os_printf ("Fixed Io Resource\n");
310 	acpi_os_printf ("  Range base address: %08X",
311 			 fixed_io_data->base_address);
312 
313 	acpi_os_printf ("  Range length: %08X",
314 			 fixed_io_data->range_length);
315 
316 	return;
317 }
318 
319 
320 /*******************************************************************************
321  *
322  * FUNCTION:    acpi_rs_dump_vendor_specific
323  *
324  * PARAMETERS:  Data            - pointer to the resource structure to dump.
325  *
326  * RETURN:      None
327  *
328  * DESCRIPTION: Prints out the various members of the Data structure type.
329  *
330  ******************************************************************************/
331 
332 void
acpi_rs_dump_vendor_specific(union acpi_resource_data * data)333 acpi_rs_dump_vendor_specific (
334 	union acpi_resource_data        *data)
335 {
336 	struct acpi_resource_vendor     *vendor_data = (struct acpi_resource_vendor *) data;
337 	u16                             index = 0;
338 
339 
340 	ACPI_FUNCTION_ENTRY ();
341 
342 
343 	acpi_os_printf ("Vendor Specific Resource\n");
344 
345 	acpi_os_printf ("  Length: %08X\n", vendor_data->length);
346 
347 	for (index = 0; index < vendor_data->length; index++) {
348 		acpi_os_printf ("  Byte %X: %08X\n",
349 				 index, vendor_data->reserved[index]);
350 	}
351 
352 	return;
353 }
354 
355 
356 /*******************************************************************************
357  *
358  * FUNCTION:    acpi_rs_dump_memory24
359  *
360  * PARAMETERS:  Data            - pointer to the resource structure to dump.
361  *
362  * RETURN:      None
363  *
364  * DESCRIPTION: Prints out the various members of the Data structure type.
365  *
366  ******************************************************************************/
367 
368 void
acpi_rs_dump_memory24(union acpi_resource_data * data)369 acpi_rs_dump_memory24 (
370 	union acpi_resource_data        *data)
371 {
372 	struct acpi_resource_mem24      *memory24_data = (struct acpi_resource_mem24 *) data;
373 
374 
375 	ACPI_FUNCTION_ENTRY ();
376 
377 
378 	acpi_os_printf ("24-Bit Memory Range Resource\n");
379 
380 	acpi_os_printf ("  Read%s\n",
381 			 ACPI_READ_WRITE_MEMORY ==
382 			 memory24_data->read_write_attribute ?
383 			 "/Write" : " only");
384 
385 	acpi_os_printf ("  Range minimum base: %08X\n",
386 			 memory24_data->min_base_address);
387 
388 	acpi_os_printf ("  Range maximum base: %08X\n",
389 			 memory24_data->max_base_address);
390 
391 	acpi_os_printf ("  Alignment: %08X\n",
392 			 memory24_data->alignment);
393 
394 	acpi_os_printf ("  Range length: %08X\n",
395 			 memory24_data->range_length);
396 
397 	return;
398 }
399 
400 
401 /*******************************************************************************
402  *
403  * FUNCTION:    acpi_rs_dump_memory32
404  *
405  * PARAMETERS:  Data            - pointer to the resource structure to dump.
406  *
407  * RETURN:      None
408  *
409  * DESCRIPTION: Prints out the various members of the Data structure type.
410  *
411  ******************************************************************************/
412 
413 void
acpi_rs_dump_memory32(union acpi_resource_data * data)414 acpi_rs_dump_memory32 (
415 	union acpi_resource_data        *data)
416 {
417 	struct acpi_resource_mem32      *memory32_data = (struct acpi_resource_mem32 *) data;
418 
419 
420 	ACPI_FUNCTION_ENTRY ();
421 
422 
423 	acpi_os_printf ("32-Bit Memory Range Resource\n");
424 
425 	acpi_os_printf ("  Read%s\n",
426 			 ACPI_READ_WRITE_MEMORY ==
427 			 memory32_data->read_write_attribute ?
428 			 "/Write" : " only");
429 
430 	acpi_os_printf ("  Range minimum base: %08X\n",
431 			 memory32_data->min_base_address);
432 
433 	acpi_os_printf ("  Range maximum base: %08X\n",
434 			 memory32_data->max_base_address);
435 
436 	acpi_os_printf ("  Alignment: %08X\n",
437 			 memory32_data->alignment);
438 
439 	acpi_os_printf ("  Range length: %08X\n",
440 			 memory32_data->range_length);
441 
442 	return;
443 }
444 
445 
446 /*******************************************************************************
447  *
448  * FUNCTION:    acpi_rs_dump_fixed_memory32
449  *
450  * PARAMETERS:  Data            - pointer to the resource structure to dump.
451  *
452  * RETURN:
453  *
454  * DESCRIPTION: Prints out the various members of the Data structure type.
455  *
456  ******************************************************************************/
457 
458 void
acpi_rs_dump_fixed_memory32(union acpi_resource_data * data)459 acpi_rs_dump_fixed_memory32 (
460 	union acpi_resource_data            *data)
461 {
462 	struct acpi_resource_fixed_mem32    *fixed_memory32_data = (struct acpi_resource_fixed_mem32 *) data;
463 
464 
465 	ACPI_FUNCTION_ENTRY ();
466 
467 
468 	acpi_os_printf ("32-Bit Fixed Location Memory Range Resource\n");
469 
470 	acpi_os_printf ("  Read%s\n",
471 			 ACPI_READ_WRITE_MEMORY ==
472 			 fixed_memory32_data->read_write_attribute ?
473 			 "/Write" : " Only");
474 
475 	acpi_os_printf ("  Range base address: %08X\n",
476 			 fixed_memory32_data->range_base_address);
477 
478 	acpi_os_printf ("  Range length: %08X\n",
479 			 fixed_memory32_data->range_length);
480 
481 	return;
482 }
483 
484 
485 /*******************************************************************************
486  *
487  * FUNCTION:    acpi_rs_dump_address16
488  *
489  * PARAMETERS:  Data            - pointer to the resource structure to dump.
490  *
491  * RETURN:      None
492  *
493  * DESCRIPTION: Prints out the various members of the Data structure type.
494  *
495  ******************************************************************************/
496 
497 void
acpi_rs_dump_address16(union acpi_resource_data * data)498 acpi_rs_dump_address16 (
499 	union acpi_resource_data        *data)
500 {
501 	struct acpi_resource_address16 *address16_data = (struct acpi_resource_address16 *) data;
502 
503 
504 	ACPI_FUNCTION_ENTRY ();
505 
506 
507 	acpi_os_printf ("16-Bit Address Space Resource\n");
508 	acpi_os_printf ("  Resource Type: ");
509 
510 	switch (address16_data->resource_type) {
511 	case ACPI_MEMORY_RANGE:
512 
513 		acpi_os_printf ("Memory Range\n");
514 
515 		switch (address16_data->attribute.memory.cache_attribute) {
516 		case ACPI_NON_CACHEABLE_MEMORY:
517 			acpi_os_printf ("  Type Specific: "
518 					  "Noncacheable memory\n");
519 			break;
520 
521 		case ACPI_CACHABLE_MEMORY:
522 			acpi_os_printf ("  Type Specific: "
523 					  "Cacheable memory\n");
524 			break;
525 
526 		case ACPI_WRITE_COMBINING_MEMORY:
527 			acpi_os_printf ("  Type Specific: "
528 					  "Write-combining memory\n");
529 			break;
530 
531 		case ACPI_PREFETCHABLE_MEMORY:
532 			acpi_os_printf ("  Type Specific: "
533 					  "Prefetchable memory\n");
534 			break;
535 
536 		default:
537 			acpi_os_printf ("  Type Specific: "
538 					  "Invalid cache attribute\n");
539 			break;
540 		}
541 
542 		acpi_os_printf ("  Type Specific: Read%s\n",
543 			ACPI_READ_WRITE_MEMORY ==
544 			address16_data->attribute.memory.read_write_attribute ?
545 			"/Write" : " Only");
546 		break;
547 
548 	case ACPI_IO_RANGE:
549 
550 		acpi_os_printf ("I/O Range\n");
551 
552 		switch (address16_data->attribute.io.range_attribute) {
553 		case ACPI_NON_ISA_ONLY_RANGES:
554 			acpi_os_printf ("  Type Specific: "
555 					  "Non-ISA Io Addresses\n");
556 			break;
557 
558 		case ACPI_ISA_ONLY_RANGES:
559 			acpi_os_printf ("  Type Specific: "
560 					  "ISA Io Addresses\n");
561 			break;
562 
563 		case ACPI_ENTIRE_RANGE:
564 			acpi_os_printf ("  Type Specific: "
565 					  "ISA and non-ISA Io Addresses\n");
566 			break;
567 
568 		default:
569 			acpi_os_printf ("  Type Specific: "
570 					  "Invalid range attribute\n");
571 			break;
572 		}
573 
574 		acpi_os_printf (" Type Specific: %s Translation\n",
575 			ACPI_SPARSE_TRANSLATION ==
576 			address16_data->attribute.io.translation_attribute ?
577 			"Sparse" : "Dense");
578 		break;
579 
580 	case ACPI_BUS_NUMBER_RANGE:
581 
582 		acpi_os_printf ("Bus Number Range\n");
583 		break;
584 
585 	default:
586 
587 		acpi_os_printf ("Invalid resource type. Exiting.\n");
588 		return;
589 	}
590 
591 	acpi_os_printf ("  Resource %s\n",
592 			ACPI_CONSUMER == address16_data->producer_consumer ?
593 			"Consumer" : "Producer");
594 
595 	acpi_os_printf ("  %s decode\n",
596 			 ACPI_SUB_DECODE == address16_data->decode ?
597 			 "Subtractive" : "Positive");
598 
599 	acpi_os_printf ("  Min address is %s fixed\n",
600 			 ACPI_ADDRESS_FIXED == address16_data->min_address_fixed ?
601 			 "" : "not");
602 
603 	acpi_os_printf ("  Max address is %s fixed\n",
604 			 ACPI_ADDRESS_FIXED == address16_data->max_address_fixed ?
605 			 "" : "not");
606 
607 	acpi_os_printf ("  Granularity: %08X\n",
608 			 address16_data->granularity);
609 
610 	acpi_os_printf ("  Address range min: %08X\n",
611 			 address16_data->min_address_range);
612 
613 	acpi_os_printf ("  Address range max: %08X\n",
614 			 address16_data->max_address_range);
615 
616 	acpi_os_printf ("  Address translation offset: %08X\n",
617 			 address16_data->address_translation_offset);
618 
619 	acpi_os_printf ("  Address Length: %08X\n",
620 			 address16_data->address_length);
621 
622 	if (0xFF != address16_data->resource_source.index) {
623 		acpi_os_printf ("  Resource Source Index: %X\n",
624 				 address16_data->resource_source.index);
625 		acpi_os_printf ("  Resource Source: %s\n",
626 				 address16_data->resource_source.string_ptr);
627 	}
628 
629 	return;
630 }
631 
632 
633 /*******************************************************************************
634  *
635  * FUNCTION:    acpi_rs_dump_address32
636  *
637  * PARAMETERS:  Data            - pointer to the resource structure to dump.
638  *
639  * RETURN:      None
640  *
641  * DESCRIPTION: Prints out the various members of the Data structure type.
642  *
643  ******************************************************************************/
644 
645 void
acpi_rs_dump_address32(union acpi_resource_data * data)646 acpi_rs_dump_address32 (
647 	union acpi_resource_data        *data)
648 {
649 	struct acpi_resource_address32 *address32_data = (struct acpi_resource_address32 *) data;
650 
651 
652 	ACPI_FUNCTION_ENTRY ();
653 
654 
655 	acpi_os_printf ("32-Bit Address Space Resource\n");
656 
657 	switch (address32_data->resource_type) {
658 	case ACPI_MEMORY_RANGE:
659 
660 		acpi_os_printf ("  Resource Type: Memory Range\n");
661 
662 		switch (address32_data->attribute.memory.cache_attribute) {
663 		case ACPI_NON_CACHEABLE_MEMORY:
664 			acpi_os_printf ("  Type Specific: "
665 					  "Noncacheable memory\n");
666 			break;
667 
668 		case ACPI_CACHABLE_MEMORY:
669 			acpi_os_printf ("  Type Specific: "
670 					  "Cacheable memory\n");
671 			break;
672 
673 		case ACPI_WRITE_COMBINING_MEMORY:
674 			acpi_os_printf ("  Type Specific: "
675 					  "Write-combining memory\n");
676 			break;
677 
678 		case ACPI_PREFETCHABLE_MEMORY:
679 			acpi_os_printf ("  Type Specific: "
680 					  "Prefetchable memory\n");
681 			break;
682 
683 		default:
684 			acpi_os_printf ("  Type Specific: "
685 					  "Invalid cache attribute\n");
686 			break;
687 		}
688 
689 		acpi_os_printf ("  Type Specific: Read%s\n",
690 			ACPI_READ_WRITE_MEMORY ==
691 			address32_data->attribute.memory.read_write_attribute ?
692 			"/Write" : " Only");
693 		break;
694 
695 	case ACPI_IO_RANGE:
696 
697 		acpi_os_printf ("  Resource Type: Io Range\n");
698 
699 		switch (address32_data->attribute.io.range_attribute) {
700 		case ACPI_NON_ISA_ONLY_RANGES:
701 			acpi_os_printf ("  Type Specific: "
702 					  "Non-ISA Io Addresses\n");
703 			break;
704 
705 		case ACPI_ISA_ONLY_RANGES:
706 			acpi_os_printf ("  Type Specific: "
707 					  "ISA Io Addresses\n");
708 			break;
709 
710 		case ACPI_ENTIRE_RANGE:
711 			acpi_os_printf ("  Type Specific: "
712 					  "ISA and non-ISA Io Addresses\n");
713 			break;
714 
715 		default:
716 			acpi_os_printf ("  Type Specific: "
717 					  "Invalid Range attribute");
718 			break;
719 		}
720 
721 		acpi_os_printf (" Type Specific: %s Translation\n",
722 			ACPI_SPARSE_TRANSLATION ==
723 			address32_data->attribute.io.translation_attribute ?
724 			"Sparse" : "Dense");
725 		break;
726 
727 	case ACPI_BUS_NUMBER_RANGE:
728 
729 		acpi_os_printf ("  Resource Type: Bus Number Range\n");
730 		break;
731 
732 	default:
733 
734 		acpi_os_printf ("  Invalid Resource Type..exiting.\n");
735 		return;
736 	}
737 
738 	acpi_os_printf ("  Resource %s\n",
739 			 ACPI_CONSUMER == address32_data->producer_consumer ?
740 			 "Consumer" : "Producer");
741 
742 	acpi_os_printf ("  %s decode\n",
743 			 ACPI_SUB_DECODE == address32_data->decode ?
744 			 "Subtractive" : "Positive");
745 
746 	acpi_os_printf ("  Min address is %s fixed\n",
747 			 ACPI_ADDRESS_FIXED == address32_data->min_address_fixed ?
748 			 "" : "not ");
749 
750 	acpi_os_printf ("  Max address is %s fixed\n",
751 			 ACPI_ADDRESS_FIXED == address32_data->max_address_fixed ?
752 			 "" : "not ");
753 
754 	acpi_os_printf ("  Granularity: %08X\n",
755 			 address32_data->granularity);
756 
757 	acpi_os_printf ("  Address range min: %08X\n",
758 			 address32_data->min_address_range);
759 
760 	acpi_os_printf ("  Address range max: %08X\n",
761 			 address32_data->max_address_range);
762 
763 	acpi_os_printf ("  Address translation offset: %08X\n",
764 			 address32_data->address_translation_offset);
765 
766 	acpi_os_printf ("  Address Length: %08X\n",
767 			 address32_data->address_length);
768 
769 	if(0xFF != address32_data->resource_source.index) {
770 		acpi_os_printf ("  Resource Source Index: %X\n",
771 				 address32_data->resource_source.index);
772 		acpi_os_printf ("  Resource Source: %s\n",
773 				 address32_data->resource_source.string_ptr);
774 	}
775 
776 	return;
777 }
778 
779 
780 /*******************************************************************************
781  *
782  * FUNCTION:    acpi_rs_dump_address64
783  *
784  * PARAMETERS:  Data            - pointer to the resource structure to dump.
785  *
786  * RETURN:      None
787  *
788  * DESCRIPTION: Prints out the various members of the Data structure type.
789  *
790  ******************************************************************************/
791 
792 void
acpi_rs_dump_address64(union acpi_resource_data * data)793 acpi_rs_dump_address64 (
794 	union acpi_resource_data        *data)
795 {
796 	struct acpi_resource_address64 *address64_data = (struct acpi_resource_address64 *) data;
797 
798 
799 	ACPI_FUNCTION_ENTRY ();
800 
801 
802 	acpi_os_printf ("64-Bit Address Space Resource\n");
803 
804 	switch (address64_data->resource_type) {
805 	case ACPI_MEMORY_RANGE:
806 
807 		acpi_os_printf ("  Resource Type: Memory Range\n");
808 
809 		switch (address64_data->attribute.memory.cache_attribute) {
810 		case ACPI_NON_CACHEABLE_MEMORY:
811 			acpi_os_printf ("  Type Specific: "
812 					  "Noncacheable memory\n");
813 			break;
814 
815 		case ACPI_CACHABLE_MEMORY:
816 			acpi_os_printf ("  Type Specific: "
817 					  "Cacheable memory\n");
818 			break;
819 
820 		case ACPI_WRITE_COMBINING_MEMORY:
821 			acpi_os_printf ("  Type Specific: "
822 					  "Write-combining memory\n");
823 			break;
824 
825 		case ACPI_PREFETCHABLE_MEMORY:
826 			acpi_os_printf ("  Type Specific: "
827 					  "Prefetchable memory\n");
828 			break;
829 
830 		default:
831 			acpi_os_printf ("  Type Specific: "
832 					  "Invalid cache attribute\n");
833 			break;
834 		}
835 
836 		acpi_os_printf ("  Type Specific: Read%s\n",
837 			ACPI_READ_WRITE_MEMORY ==
838 			address64_data->attribute.memory.read_write_attribute ?
839 			"/Write" : " Only");
840 		break;
841 
842 	case ACPI_IO_RANGE:
843 
844 		acpi_os_printf ("  Resource Type: Io Range\n");
845 
846 		switch (address64_data->attribute.io.range_attribute) {
847 		case ACPI_NON_ISA_ONLY_RANGES:
848 			acpi_os_printf ("  Type Specific: "
849 					  "Non-ISA Io Addresses\n");
850 			break;
851 
852 		case ACPI_ISA_ONLY_RANGES:
853 			acpi_os_printf ("  Type Specific: "
854 					  "ISA Io Addresses\n");
855 			break;
856 
857 		case ACPI_ENTIRE_RANGE:
858 			acpi_os_printf ("  Type Specific: "
859 					  "ISA and non-ISA Io Addresses\n");
860 			break;
861 
862 		default:
863 			acpi_os_printf ("  Type Specific: "
864 					  "Invalid Range attribute");
865 			break;
866 		}
867 
868 		acpi_os_printf (" Type Specific: %s Translation\n",
869 			ACPI_SPARSE_TRANSLATION ==
870 			address64_data->attribute.io.translation_attribute ?
871 			"Sparse" : "Dense");
872 		break;
873 
874 	case ACPI_BUS_NUMBER_RANGE:
875 
876 		acpi_os_printf ("  Resource Type: Bus Number Range\n");
877 		break;
878 
879 	default:
880 
881 		acpi_os_printf ("  Invalid Resource Type..exiting.\n");
882 		return;
883 	}
884 
885 	acpi_os_printf ("  Resource %s\n",
886 			 ACPI_CONSUMER == address64_data->producer_consumer ?
887 			 "Consumer" : "Producer");
888 
889 	acpi_os_printf ("  %s decode\n",
890 			 ACPI_SUB_DECODE == address64_data->decode ?
891 			 "Subtractive" : "Positive");
892 
893 	acpi_os_printf ("  Min address is %s fixed\n",
894 			 ACPI_ADDRESS_FIXED == address64_data->min_address_fixed ?
895 			 "" : "not ");
896 
897 	acpi_os_printf ("  Max address is %s fixed\n",
898 			 ACPI_ADDRESS_FIXED == address64_data->max_address_fixed ?
899 			 "" : "not ");
900 
901 	acpi_os_printf ("  Granularity: %8.8X%8.8X\n",
902 			 ACPI_FORMAT_UINT64 (address64_data->granularity));
903 
904 	acpi_os_printf ("  Address range min: %8.8X%8.8X\n",
905 			 ACPI_FORMAT_UINT64 (address64_data->min_address_range));
906 
907 	acpi_os_printf ("  Address range max: %8.8X%8.8X\n",
908 			 ACPI_FORMAT_UINT64 (address64_data->max_address_range));
909 
910 	acpi_os_printf ("  Address translation offset: %8.8X%8.8X\n",
911 			 ACPI_FORMAT_UINT64 (address64_data->address_translation_offset));
912 
913 	acpi_os_printf ("  Address Length: %8.8X%8.8X\n",
914 			 ACPI_FORMAT_UINT64 (address64_data->address_length));
915 
916 	if(0xFF != address64_data->resource_source.index) {
917 		acpi_os_printf ("  Resource Source Index: %X\n",
918 				 address64_data->resource_source.index);
919 		acpi_os_printf ("  Resource Source: %s\n",
920 				 address64_data->resource_source.string_ptr);
921 	}
922 
923 	return;
924 }
925 
926 
927 /*******************************************************************************
928  *
929  * FUNCTION:    acpi_rs_dump_extended_irq
930  *
931  * PARAMETERS:  Data            - pointer to the resource structure to dump.
932  *
933  * RETURN:      None
934  *
935  * DESCRIPTION: Prints out the various members of the Data structure type.
936  *
937  ******************************************************************************/
938 
939 void
acpi_rs_dump_extended_irq(union acpi_resource_data * data)940 acpi_rs_dump_extended_irq (
941 	union acpi_resource_data        *data)
942 {
943 	struct acpi_resource_ext_irq    *ext_irq_data = (struct acpi_resource_ext_irq *) data;
944 	u8                              index = 0;
945 
946 
947 	ACPI_FUNCTION_ENTRY ();
948 
949 
950 	acpi_os_printf ("Extended IRQ Resource\n");
951 
952 	acpi_os_printf ("  Resource %s\n",
953 			 ACPI_CONSUMER == ext_irq_data->producer_consumer ?
954 			 "Consumer" : "Producer");
955 
956 	acpi_os_printf ("  %s\n",
957 			 ACPI_LEVEL_SENSITIVE == ext_irq_data->edge_level ?
958 			 "Level" : "Edge");
959 
960 	acpi_os_printf ("  Active %s\n",
961 			 ACPI_ACTIVE_LOW == ext_irq_data->active_high_low ?
962 			 "low" : "high");
963 
964 	acpi_os_printf ("  %s\n",
965 			 ACPI_SHARED == ext_irq_data->shared_exclusive ?
966 			 "Shared" : "Exclusive");
967 
968 	acpi_os_printf ("  Interrupts : %X ( ",
969 			 ext_irq_data->number_of_interrupts);
970 
971 	for (index = 0; index < ext_irq_data->number_of_interrupts; index++) {
972 		acpi_os_printf ("%X ", ext_irq_data->interrupts[index]);
973 	}
974 
975 	acpi_os_printf (")\n");
976 
977 	if(0xFF != ext_irq_data->resource_source.index) {
978 		acpi_os_printf ("  Resource Source Index: %X",
979 				 ext_irq_data->resource_source.index);
980 		acpi_os_printf ("  Resource Source: %s",
981 				 ext_irq_data->resource_source.string_ptr);
982 	}
983 
984 	return;
985 }
986 
987 
988 /*******************************************************************************
989  *
990  * FUNCTION:    acpi_rs_dump_resource_list
991  *
992  * PARAMETERS:  Data            - pointer to the resource structure to dump.
993  *
994  * RETURN:      None
995  *
996  * DESCRIPTION: Dispatches the structure to the correct dump routine.
997  *
998  ******************************************************************************/
999 
1000 void
acpi_rs_dump_resource_list(struct acpi_resource * resource)1001 acpi_rs_dump_resource_list (
1002 	struct acpi_resource        *resource)
1003 {
1004 	u8                          count = 0;
1005 	u8                          done = FALSE;
1006 
1007 
1008 	ACPI_FUNCTION_ENTRY ();
1009 
1010 
1011 	if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
1012 		while (!done) {
1013 			acpi_os_printf ("Resource structure %X.\n", count++);
1014 
1015 			switch (resource->id) {
1016 			case ACPI_RSTYPE_IRQ:
1017 				acpi_rs_dump_irq (&resource->data);
1018 				break;
1019 
1020 			case ACPI_RSTYPE_DMA:
1021 				acpi_rs_dump_dma (&resource->data);
1022 				break;
1023 
1024 			case ACPI_RSTYPE_START_DPF:
1025 				acpi_rs_dump_start_depend_fns (&resource->data);
1026 				break;
1027 
1028 			case ACPI_RSTYPE_END_DPF:
1029 				acpi_os_printf ("end_dependent_functions Resource\n");
1030 				/* acpi_rs_dump_end_dependent_functions (Resource->Data);*/
1031 				break;
1032 
1033 			case ACPI_RSTYPE_IO:
1034 				acpi_rs_dump_io (&resource->data);
1035 				break;
1036 
1037 			case ACPI_RSTYPE_FIXED_IO:
1038 				acpi_rs_dump_fixed_io (&resource->data);
1039 				break;
1040 
1041 			case ACPI_RSTYPE_VENDOR:
1042 				acpi_rs_dump_vendor_specific (&resource->data);
1043 				break;
1044 
1045 			case ACPI_RSTYPE_END_TAG:
1046 				/*rs_dump_end_tag (Resource->Data);*/
1047 				acpi_os_printf ("end_tag Resource\n");
1048 				done = TRUE;
1049 				break;
1050 
1051 			case ACPI_RSTYPE_MEM24:
1052 				acpi_rs_dump_memory24 (&resource->data);
1053 				break;
1054 
1055 			case ACPI_RSTYPE_MEM32:
1056 				acpi_rs_dump_memory32 (&resource->data);
1057 				break;
1058 
1059 			case ACPI_RSTYPE_FIXED_MEM32:
1060 				acpi_rs_dump_fixed_memory32 (&resource->data);
1061 				break;
1062 
1063 			case ACPI_RSTYPE_ADDRESS16:
1064 				acpi_rs_dump_address16 (&resource->data);
1065 				break;
1066 
1067 			case ACPI_RSTYPE_ADDRESS32:
1068 				acpi_rs_dump_address32 (&resource->data);
1069 				break;
1070 
1071 			case ACPI_RSTYPE_ADDRESS64:
1072 				acpi_rs_dump_address64 (&resource->data);
1073 				break;
1074 
1075 			case ACPI_RSTYPE_EXT_IRQ:
1076 				acpi_rs_dump_extended_irq (&resource->data);
1077 				break;
1078 
1079 			default:
1080 				acpi_os_printf ("Invalid resource type\n");
1081 				break;
1082 
1083 			}
1084 
1085 			resource = ACPI_PTR_ADD (struct acpi_resource, resource, resource->length);
1086 		}
1087 	}
1088 
1089 	return;
1090 }
1091 
1092 /*******************************************************************************
1093  *
1094  * FUNCTION:    acpi_rs_dump_irq_list
1095  *
1096  * PARAMETERS:  Data            - pointer to the routing table to dump.
1097  *
1098  * RETURN:      None
1099  *
1100  * DESCRIPTION: Dispatches the structures to the correct dump routine.
1101  *
1102  ******************************************************************************/
1103 
1104 void
acpi_rs_dump_irq_list(u8 * route_table)1105 acpi_rs_dump_irq_list (
1106 	u8                              *route_table)
1107 {
1108 	u8                              *buffer = route_table;
1109 	u8                              count = 0;
1110 	u8                              done = FALSE;
1111 	struct acpi_pci_routing_table   *prt_element;
1112 
1113 
1114 	ACPI_FUNCTION_ENTRY ();
1115 
1116 
1117 	if (acpi_dbg_level & ACPI_LV_RESOURCES && _COMPONENT & acpi_dbg_layer) {
1118 		prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer);
1119 
1120 		while (!done) {
1121 			acpi_os_printf ("PCI IRQ Routing Table structure %X.\n", count++);
1122 
1123 			acpi_os_printf ("  Address: %8.8X%8.8X\n",
1124 					 ACPI_FORMAT_UINT64 (prt_element->address));
1125 
1126 			acpi_os_printf ("  Pin: %X\n", prt_element->pin);
1127 
1128 			acpi_os_printf ("  Source: %s\n", prt_element->source);
1129 
1130 			acpi_os_printf ("  source_index: %X\n",
1131 					 prt_element->source_index);
1132 
1133 			buffer += prt_element->length;
1134 
1135 			prt_element = ACPI_CAST_PTR (struct acpi_pci_routing_table, buffer);
1136 
1137 			if(0 == prt_element->length) {
1138 				done = TRUE;
1139 			}
1140 		}
1141 	}
1142 
1143 	return;
1144 }
1145 
1146 #endif
1147 
1148