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