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