xref: /openbmc/linux/drivers/acpi/acpica/rsdump.c (revision ba494beeaa69bc0fb01eb89464ad5d57d26e3901)
195b482a8SLen Brown /*******************************************************************************
295b482a8SLen Brown  *
395b482a8SLen Brown  * Module Name: rsdump - Functions to display the resource structures.
495b482a8SLen Brown  *
595b482a8SLen Brown  ******************************************************************************/
695b482a8SLen Brown 
795b482a8SLen Brown /*
877848130SBob Moore  * Copyright (C) 2000 - 2012, Intel Corp.
995b482a8SLen Brown  * All rights reserved.
1095b482a8SLen Brown  *
1195b482a8SLen Brown  * Redistribution and use in source and binary forms, with or without
1295b482a8SLen Brown  * modification, are permitted provided that the following conditions
1395b482a8SLen Brown  * are met:
1495b482a8SLen Brown  * 1. Redistributions of source code must retain the above copyright
1595b482a8SLen Brown  *    notice, this list of conditions, and the following disclaimer,
1695b482a8SLen Brown  *    without modification.
1795b482a8SLen Brown  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1895b482a8SLen Brown  *    substantially similar to the "NO WARRANTY" disclaimer below
1995b482a8SLen Brown  *    ("Disclaimer") and any redistribution must be conditioned upon
2095b482a8SLen Brown  *    including a substantially similar Disclaimer requirement for further
2195b482a8SLen Brown  *    binary redistribution.
2295b482a8SLen Brown  * 3. Neither the names of the above-listed copyright holders nor the names
2395b482a8SLen Brown  *    of any contributors may be used to endorse or promote products derived
2495b482a8SLen Brown  *    from this software without specific prior written permission.
2595b482a8SLen Brown  *
2695b482a8SLen Brown  * Alternatively, this software may be distributed under the terms of the
2795b482a8SLen Brown  * GNU General Public License ("GPL") version 2 as published by the Free
2895b482a8SLen Brown  * Software Foundation.
2995b482a8SLen Brown  *
3095b482a8SLen Brown  * NO WARRANTY
3195b482a8SLen Brown  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3295b482a8SLen Brown  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3395b482a8SLen Brown  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3495b482a8SLen Brown  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3595b482a8SLen Brown  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3695b482a8SLen Brown  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3795b482a8SLen Brown  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3895b482a8SLen Brown  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3995b482a8SLen Brown  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
4095b482a8SLen Brown  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4195b482a8SLen Brown  * POSSIBILITY OF SUCH DAMAGES.
4295b482a8SLen Brown  */
4395b482a8SLen Brown 
4495b482a8SLen Brown #include <acpi/acpi.h>
45e2f7a777SLen Brown #include "accommon.h"
46e2f7a777SLen Brown #include "acresrc.h"
4795b482a8SLen Brown 
4895b482a8SLen Brown #define _COMPONENT          ACPI_RESOURCES
4995b482a8SLen Brown ACPI_MODULE_NAME("rsdump")
5095b482a8SLen Brown #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
5195b482a8SLen Brown /* Local prototypes */
5295b482a8SLen Brown static void acpi_rs_out_string(char *title, char *value);
5395b482a8SLen Brown 
5495b482a8SLen Brown static void acpi_rs_out_integer8(char *title, u8 value);
5595b482a8SLen Brown 
5695b482a8SLen Brown static void acpi_rs_out_integer16(char *title, u16 value);
5795b482a8SLen Brown 
5895b482a8SLen Brown static void acpi_rs_out_integer32(char *title, u32 value);
5995b482a8SLen Brown 
6095b482a8SLen Brown static void acpi_rs_out_integer64(char *title, u64 value);
6195b482a8SLen Brown 
6295b482a8SLen Brown static void acpi_rs_out_title(char *title);
6395b482a8SLen Brown 
6495b482a8SLen Brown static void acpi_rs_dump_byte_list(u16 length, u8 *data);
6595b482a8SLen Brown 
66e0fe0a8dSLin Ming static void acpi_rs_dump_word_list(u16 length, u16 *data);
67e0fe0a8dSLin Ming 
6895b482a8SLen Brown static void acpi_rs_dump_dword_list(u8 length, u32 *data);
6995b482a8SLen Brown 
7095b482a8SLen Brown static void acpi_rs_dump_short_byte_list(u8 length, u8 *data);
7195b482a8SLen Brown 
7295b482a8SLen Brown static void
7395b482a8SLen Brown acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source);
7495b482a8SLen Brown 
7595b482a8SLen Brown static void acpi_rs_dump_address_common(union acpi_resource_data *resource);
7695b482a8SLen Brown 
7795b482a8SLen Brown static void
7895b482a8SLen Brown acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table);
7995b482a8SLen Brown 
8095b482a8SLen Brown #define ACPI_RSD_OFFSET(f)          (u8) ACPI_OFFSET (union acpi_resource_data,f)
8195b482a8SLen Brown #define ACPI_PRT_OFFSET(f)          (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f)
8295b482a8SLen Brown #define ACPI_RSD_TABLE_SIZE(name)   (sizeof(name) / sizeof (struct acpi_rsdump_info))
8395b482a8SLen Brown 
8495b482a8SLen Brown /*******************************************************************************
8595b482a8SLen Brown  *
8695b482a8SLen Brown  * Resource Descriptor info tables
8795b482a8SLen Brown  *
8895b482a8SLen Brown  * Note: The first table entry must be a Title or Literal and must contain
8995b482a8SLen Brown  * the table length (number of table entries)
9095b482a8SLen Brown  *
9195b482a8SLen Brown  ******************************************************************************/
9295b482a8SLen Brown 
9395b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_irq[7] = {
9495b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL},
9595b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.descriptor_length),
9695b482a8SLen Brown 	 "Descriptor Length", NULL},
9795b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering",
9895b482a8SLen Brown 	 acpi_gbl_he_decode},
9995b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity",
10095b482a8SLen Brown 	 acpi_gbl_ll_decode},
10195b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing",
10295b482a8SLen Brown 	 acpi_gbl_shr_decode},
10395b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count),
10495b482a8SLen Brown 	 "Interrupt Count", NULL},
10595b482a8SLen Brown 	{ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]),
10695b482a8SLen Brown 	 "Interrupt List", NULL}
10795b482a8SLen Brown };
10895b482a8SLen Brown 
10995b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_dma[6] = {
11095b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL},
11195b482a8SLen Brown 	{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed",
11295b482a8SLen Brown 	 acpi_gbl_typ_decode},
11395b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering",
11495b482a8SLen Brown 	 acpi_gbl_bm_decode},
11595b482a8SLen Brown 	{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type",
11695b482a8SLen Brown 	 acpi_gbl_siz_decode},
11795b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count",
11895b482a8SLen Brown 	 NULL},
11995b482a8SLen Brown 	{ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List",
12095b482a8SLen Brown 	 NULL}
12195b482a8SLen Brown };
12295b482a8SLen Brown 
12395b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_start_dpf[4] = {
12495b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf),
12595b482a8SLen Brown 	 "Start-Dependent-Functions", NULL},
12695b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(start_dpf.descriptor_length),
12795b482a8SLen Brown 	 "Descriptor Length", NULL},
12895b482a8SLen Brown 	{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority),
12995b482a8SLen Brown 	 "Compatibility Priority", acpi_gbl_config_decode},
13095b482a8SLen Brown 	{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness),
13195b482a8SLen Brown 	 "Performance/Robustness", acpi_gbl_config_decode}
13295b482a8SLen Brown };
13395b482a8SLen Brown 
13495b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = {
13595b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf),
13695b482a8SLen Brown 	 "End-Dependent-Functions", NULL}
13795b482a8SLen Brown };
13895b482a8SLen Brown 
13995b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_io[6] = {
14095b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL},
14195b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding",
14295b482a8SLen Brown 	 acpi_gbl_io_decode},
14395b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL},
14495b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL},
14595b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL},
14695b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length",
14795b482a8SLen Brown 	 NULL}
14895b482a8SLen Brown };
14995b482a8SLen Brown 
15095b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = {
15195b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io),
15295b482a8SLen Brown 	 "Fixed I/O", NULL},
15395b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL},
15495b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length),
15595b482a8SLen Brown 	 "Address Length", NULL}
15695b482a8SLen Brown };
15795b482a8SLen Brown 
15895b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_vendor[3] = {
15995b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor),
16095b482a8SLen Brown 	 "Vendor Specific", NULL},
16195b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL},
16295b482a8SLen Brown 	{ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data",
16395b482a8SLen Brown 	 NULL}
16495b482a8SLen Brown };
16595b482a8SLen Brown 
16695b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = {
16795b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag",
16895b482a8SLen Brown 	 NULL}
16995b482a8SLen Brown };
17095b482a8SLen Brown 
17195b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_memory24[6] = {
17295b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24),
17395b482a8SLen Brown 	 "24-Bit Memory Range", NULL},
17495b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect),
17595b482a8SLen Brown 	 "Write Protect", acpi_gbl_rw_decode},
17695b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum",
17795b482a8SLen Brown 	 NULL},
17895b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum",
17995b482a8SLen Brown 	 NULL},
18095b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment",
18195b482a8SLen Brown 	 NULL},
18295b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length),
18395b482a8SLen Brown 	 "Address Length", NULL}
18495b482a8SLen Brown };
18595b482a8SLen Brown 
18695b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_memory32[6] = {
18795b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32),
18895b482a8SLen Brown 	 "32-Bit Memory Range", NULL},
18995b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect),
19095b482a8SLen Brown 	 "Write Protect", acpi_gbl_rw_decode},
19195b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum",
19295b482a8SLen Brown 	 NULL},
19395b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum",
19495b482a8SLen Brown 	 NULL},
19595b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment",
19695b482a8SLen Brown 	 NULL},
19795b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length),
19895b482a8SLen Brown 	 "Address Length", NULL}
19995b482a8SLen Brown };
20095b482a8SLen Brown 
20195b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = {
20295b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32),
20395b482a8SLen Brown 	 "32-Bit Fixed Memory Range", NULL},
20495b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect),
20595b482a8SLen Brown 	 "Write Protect", acpi_gbl_rw_decode},
20695b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address",
20795b482a8SLen Brown 	 NULL},
20895b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length),
20995b482a8SLen Brown 	 "Address Length", NULL}
21095b482a8SLen Brown };
21195b482a8SLen Brown 
21295b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_address16[8] = {
21395b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16),
21495b482a8SLen Brown 	 "16-Bit WORD Address Space", NULL},
21595b482a8SLen Brown 	{ACPI_RSD_ADDRESS, 0, NULL, NULL},
21695b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity",
21795b482a8SLen Brown 	 NULL},
21895b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum",
21995b482a8SLen Brown 	 NULL},
22095b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum",
22195b482a8SLen Brown 	 NULL},
22295b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset),
22395b482a8SLen Brown 	 "Translation Offset", NULL},
22495b482a8SLen Brown 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length),
22595b482a8SLen Brown 	 "Address Length", NULL},
22695b482a8SLen Brown 	{ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL}
22795b482a8SLen Brown };
22895b482a8SLen Brown 
22995b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_address32[8] = {
23095b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32),
23195b482a8SLen Brown 	 "32-Bit DWORD Address Space", NULL},
23295b482a8SLen Brown 	{ACPI_RSD_ADDRESS, 0, NULL, NULL},
23395b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity",
23495b482a8SLen Brown 	 NULL},
23595b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum",
23695b482a8SLen Brown 	 NULL},
23795b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum",
23895b482a8SLen Brown 	 NULL},
23995b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset),
24095b482a8SLen Brown 	 "Translation Offset", NULL},
24195b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length),
24295b482a8SLen Brown 	 "Address Length", NULL},
24395b482a8SLen Brown 	{ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL}
24495b482a8SLen Brown };
24595b482a8SLen Brown 
24695b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_address64[8] = {
24795b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64),
24895b482a8SLen Brown 	 "64-Bit QWORD Address Space", NULL},
24995b482a8SLen Brown 	{ACPI_RSD_ADDRESS, 0, NULL, NULL},
25095b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity",
25195b482a8SLen Brown 	 NULL},
25295b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum",
25395b482a8SLen Brown 	 NULL},
25495b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum",
25595b482a8SLen Brown 	 NULL},
25695b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset),
25795b482a8SLen Brown 	 "Translation Offset", NULL},
25895b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length),
25995b482a8SLen Brown 	 "Address Length", NULL},
26095b482a8SLen Brown 	{ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL}
26195b482a8SLen Brown };
26295b482a8SLen Brown 
26395b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = {
26495b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64),
26595b482a8SLen Brown 	 "64-Bit Extended Address Space", NULL},
26695b482a8SLen Brown 	{ACPI_RSD_ADDRESS, 0, NULL, NULL},
26795b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity),
26895b482a8SLen Brown 	 "Granularity", NULL},
26995b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum),
27095b482a8SLen Brown 	 "Address Minimum", NULL},
27195b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum),
27295b482a8SLen Brown 	 "Address Maximum", NULL},
27395b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset),
27495b482a8SLen Brown 	 "Translation Offset", NULL},
27595b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length),
27695b482a8SLen Brown 	 "Address Length", NULL},
27795b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific),
27895b482a8SLen Brown 	 "Type-Specific Attribute", NULL}
27995b482a8SLen Brown };
28095b482a8SLen Brown 
28195b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = {
28295b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq),
28395b482a8SLen Brown 	 "Extended IRQ", NULL},
28495b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer),
28595b482a8SLen Brown 	 "Type", acpi_gbl_consume_decode},
28695b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering),
28795b482a8SLen Brown 	 "Triggering", acpi_gbl_he_decode},
28895b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity",
28995b482a8SLen Brown 	 acpi_gbl_ll_decode},
29095b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing",
29195b482a8SLen Brown 	 acpi_gbl_shr_decode},
29295b482a8SLen Brown 	{ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL,
29395b482a8SLen Brown 	 NULL},
29495b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count),
29595b482a8SLen Brown 	 "Interrupt Count", NULL},
29695b482a8SLen Brown 	{ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]),
29795b482a8SLen Brown 	 "Interrupt List", NULL}
29895b482a8SLen Brown };
29995b482a8SLen Brown 
30095b482a8SLen Brown struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = {
30195b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg),
30295b482a8SLen Brown 	 "Generic Register", NULL},
30395b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID",
30495b482a8SLen Brown 	 NULL},
30595b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width",
30695b482a8SLen Brown 	 NULL},
30795b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset",
30895b482a8SLen Brown 	 NULL},
30995b482a8SLen Brown 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size),
31095b482a8SLen Brown 	 "Access Size", NULL},
31195b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL}
31295b482a8SLen Brown };
31395b482a8SLen Brown 
314e0fe0a8dSLin Ming struct acpi_rsdump_info acpi_rs_dump_gpio[16] = {
315e0fe0a8dSLin Ming 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_gpio), "GPIO", NULL},
316e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.revision_id), "RevisionId", NULL},
317e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.connection_type),
318e0fe0a8dSLin Ming 	 "ConnectionType", acpi_gbl_ct_decode},
319e0fe0a8dSLin Ming 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.producer_consumer),
320e0fe0a8dSLin Ming 	 "ProducerConsumer", acpi_gbl_consume_decode},
321e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(gpio.pin_config), "PinConfig",
322e0fe0a8dSLin Ming 	 acpi_gbl_ppc_decode},
323e0fe0a8dSLin Ming 	{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.sharable), "Sharable",
324e0fe0a8dSLin Ming 	 acpi_gbl_shr_decode},
325e0fe0a8dSLin Ming 	{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.io_restriction),
326e0fe0a8dSLin Ming 	 "IoRestriction", acpi_gbl_ior_decode},
327e0fe0a8dSLin Ming 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(gpio.triggering), "Triggering",
328e0fe0a8dSLin Ming 	 acpi_gbl_he_decode},
329e0fe0a8dSLin Ming 	{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(gpio.polarity), "Polarity",
330e0fe0a8dSLin Ming 	 acpi_gbl_ll_decode},
331e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.drive_strength), "DriveStrength",
332e0fe0a8dSLin Ming 	 NULL},
333e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.debounce_timeout),
334e0fe0a8dSLin Ming 	 "DebounceTimeout", NULL},
335e0fe0a8dSLin Ming 	{ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(gpio.resource_source),
336e0fe0a8dSLin Ming 	 "ResourceSource", NULL},
337e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.pin_table_length),
338e0fe0a8dSLin Ming 	 "PinTableLength", NULL},
339e0fe0a8dSLin Ming 	{ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET(gpio.pin_table), "PinTable", NULL},
340e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(gpio.vendor_length), "VendorLength",
341e0fe0a8dSLin Ming 	 NULL},
342e0fe0a8dSLin Ming 	{ACPI_RSD_SHORTLISTX, ACPI_RSD_OFFSET(gpio.vendor_data), "VendorData",
343e0fe0a8dSLin Ming 	 NULL},
344e0fe0a8dSLin Ming };
345e0fe0a8dSLin Ming 
346e0fe0a8dSLin Ming struct acpi_rsdump_info acpi_rs_dump_fixed_dma[4] = {
347e0fe0a8dSLin Ming 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_dma),
348e0fe0a8dSLin Ming 	 "FixedDma", NULL},
349e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.request_lines),
350e0fe0a8dSLin Ming 	 "RequestLines", NULL},
351e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_dma.channels), "Channels",
352e0fe0a8dSLin Ming 	 NULL},
353e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_dma.width), "TransferWidth",
354e0fe0a8dSLin Ming 	 acpi_gbl_dts_decode},
355e0fe0a8dSLin Ming };
356e0fe0a8dSLin Ming 
357e0fe0a8dSLin Ming #define ACPI_RS_DUMP_COMMON_SERIAL_BUS \
358e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (common_serial_bus.revision_id),    "RevisionId",               NULL}, \
359e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (common_serial_bus.type),           "Type",                     acpi_gbl_sbt_decode}, \
360e0fe0a8dSLin Ming 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.producer_consumer), "ProducerConsumer",      acpi_gbl_consume_decode}, \
361e0fe0a8dSLin Ming 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (common_serial_bus.slave_mode),     "SlaveMode",                acpi_gbl_sm_decode}, \
362e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8,    ACPI_RSD_OFFSET (common_serial_bus.type_revision_id), "TypeRevisionId",         NULL}, \
363e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (common_serial_bus.type_data_length), "TypeDataLength",         NULL}, \
364e0fe0a8dSLin Ming 	{ACPI_RSD_SOURCE,   ACPI_RSD_OFFSET (common_serial_bus.resource_source), "ResourceSource",          NULL}, \
365e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16,   ACPI_RSD_OFFSET (common_serial_bus.vendor_length),  "VendorLength",             NULL}, \
366e0fe0a8dSLin Ming 	{ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (common_serial_bus.vendor_data),   "VendorData",               NULL},
367e0fe0a8dSLin Ming 
368e0fe0a8dSLin Ming struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[10] = {
369e0fe0a8dSLin Ming 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_common_serial_bus),
370e0fe0a8dSLin Ming 	 "Common Serial Bus", NULL},
371e0fe0a8dSLin Ming 	ACPI_RS_DUMP_COMMON_SERIAL_BUS
372e0fe0a8dSLin Ming };
373e0fe0a8dSLin Ming 
374e0fe0a8dSLin Ming struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[13] = {
375e0fe0a8dSLin Ming 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_i2c_serial_bus),
376e0fe0a8dSLin Ming 	 "I2C Serial Bus", NULL},
377e0fe0a8dSLin Ming 	ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
378e0fe0a8dSLin Ming 					ACPI_RSD_OFFSET(i2c_serial_bus.
379e0fe0a8dSLin Ming 							access_mode),
380e0fe0a8dSLin Ming 					"AccessMode", acpi_gbl_am_decode},
381e0fe0a8dSLin Ming 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(i2c_serial_bus.connection_speed),
382e0fe0a8dSLin Ming 	 "ConnectionSpeed", NULL},
383e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(i2c_serial_bus.slave_address),
384e0fe0a8dSLin Ming 	 "SlaveAddress", NULL},
385e0fe0a8dSLin Ming };
386e0fe0a8dSLin Ming 
387e0fe0a8dSLin Ming struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[17] = {
388e0fe0a8dSLin Ming 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_spi_serial_bus),
389e0fe0a8dSLin Ming 	 "Spi Serial Bus", NULL},
390e0fe0a8dSLin Ming 	ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_1BITFLAG,
391e0fe0a8dSLin Ming 					ACPI_RSD_OFFSET(spi_serial_bus.
392e0fe0a8dSLin Ming 							wire_mode), "WireMode",
393e0fe0a8dSLin Ming 					acpi_gbl_wm_decode},
394e0fe0a8dSLin Ming 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(spi_serial_bus.device_polarity),
395e0fe0a8dSLin Ming 	 "DevicePolarity", acpi_gbl_dp_decode},
396e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.data_bit_length),
397e0fe0a8dSLin Ming 	 "DataBitLength", NULL},
398e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_phase),
399e0fe0a8dSLin Ming 	 "ClockPhase", acpi_gbl_cph_decode},
400e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(spi_serial_bus.clock_polarity),
401e0fe0a8dSLin Ming 	 "ClockPolarity", acpi_gbl_cpo_decode},
402e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(spi_serial_bus.device_selection),
403e0fe0a8dSLin Ming 	 "DeviceSelection", NULL},
404e0fe0a8dSLin Ming 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(spi_serial_bus.connection_speed),
405e0fe0a8dSLin Ming 	 "ConnectionSpeed", NULL},
406e0fe0a8dSLin Ming };
407e0fe0a8dSLin Ming 
408e0fe0a8dSLin Ming struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[19] = {
409e0fe0a8dSLin Ming 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_uart_serial_bus),
410e0fe0a8dSLin Ming 	 "Uart Serial Bus", NULL},
411e0fe0a8dSLin Ming 	ACPI_RS_DUMP_COMMON_SERIAL_BUS {ACPI_RSD_2BITFLAG,
412e0fe0a8dSLin Ming 					ACPI_RSD_OFFSET(uart_serial_bus.
413e0fe0a8dSLin Ming 							flow_control),
414e0fe0a8dSLin Ming 					"FlowControl", acpi_gbl_fc_decode},
415e0fe0a8dSLin Ming 	{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.stop_bits),
416e0fe0a8dSLin Ming 	 "StopBits", acpi_gbl_sb_decode},
417e0fe0a8dSLin Ming 	{ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.data_bits),
418e0fe0a8dSLin Ming 	 "DataBits", acpi_gbl_bpb_decode},
419e0fe0a8dSLin Ming 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(uart_serial_bus.endian), "Endian",
420e0fe0a8dSLin Ming 	 acpi_gbl_ed_decode},
421e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.parity), "Parity",
422e0fe0a8dSLin Ming 	 acpi_gbl_pt_decode},
423e0fe0a8dSLin Ming 	{ACPI_RSD_UINT8, ACPI_RSD_OFFSET(uart_serial_bus.lines_enabled),
424e0fe0a8dSLin Ming 	 "LinesEnabled", NULL},
425e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.rx_fifo_size),
426e0fe0a8dSLin Ming 	 "RxFifoSize", NULL},
427e0fe0a8dSLin Ming 	{ACPI_RSD_UINT16, ACPI_RSD_OFFSET(uart_serial_bus.tx_fifo_size),
428e0fe0a8dSLin Ming 	 "TxFifoSize", NULL},
429e0fe0a8dSLin Ming 	{ACPI_RSD_UINT32, ACPI_RSD_OFFSET(uart_serial_bus.default_baud_rate),
430e0fe0a8dSLin Ming 	 "ConnectionSpeed", NULL},
431e0fe0a8dSLin Ming };
432e0fe0a8dSLin Ming 
43395b482a8SLen Brown /*
43495b482a8SLen Brown  * Tables used for common address descriptor flag fields
43595b482a8SLen Brown  */
43695b482a8SLen Brown static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = {
43795b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL,
43895b482a8SLen Brown 	 NULL},
43995b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer),
44095b482a8SLen Brown 	 "Consumer/Producer", acpi_gbl_consume_decode},
44195b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode",
44295b482a8SLen Brown 	 acpi_gbl_dec_decode},
44395b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed),
44495b482a8SLen Brown 	 "Min Relocatability", acpi_gbl_min_decode},
44595b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed),
44695b482a8SLen Brown 	 "Max Relocatability", acpi_gbl_max_decode}
44795b482a8SLen Brown };
44895b482a8SLen Brown 
44995b482a8SLen Brown static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = {
45095b482a8SLen Brown 	{ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags),
45195b482a8SLen Brown 	 "Resource Type", (void *)"Memory Range"},
45295b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect),
45395b482a8SLen Brown 	 "Write Protect", acpi_gbl_rw_decode},
45495b482a8SLen Brown 	{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching),
45595b482a8SLen Brown 	 "Caching", acpi_gbl_mem_decode},
45695b482a8SLen Brown 	{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type),
45795b482a8SLen Brown 	 "Range Type", acpi_gbl_mtp_decode},
45895b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation),
45995b482a8SLen Brown 	 "Translation", acpi_gbl_ttp_decode}
46095b482a8SLen Brown };
46195b482a8SLen Brown 
46295b482a8SLen Brown static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = {
46395b482a8SLen Brown 	{ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags),
46495b482a8SLen Brown 	 "Resource Type", (void *)"I/O Range"},
46595b482a8SLen Brown 	{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type),
46695b482a8SLen Brown 	 "Range Type", acpi_gbl_rng_decode},
46795b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation),
46895b482a8SLen Brown 	 "Translation", acpi_gbl_ttp_decode},
46995b482a8SLen Brown 	{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type),
47095b482a8SLen Brown 	 "Translation Type", acpi_gbl_trs_decode}
47195b482a8SLen Brown };
47295b482a8SLen Brown 
47395b482a8SLen Brown /*
47495b482a8SLen Brown  * Table used to dump _PRT contents
47595b482a8SLen Brown  */
47695b482a8SLen Brown static struct acpi_rsdump_info acpi_rs_dump_prt[5] = {
47795b482a8SLen Brown 	{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL},
47895b482a8SLen Brown 	{ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL},
47995b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL},
48095b482a8SLen Brown 	{ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL},
48195b482a8SLen Brown 	{ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL}
48295b482a8SLen Brown };
48395b482a8SLen Brown 
48495b482a8SLen Brown /*******************************************************************************
48595b482a8SLen Brown  *
48695b482a8SLen Brown  * FUNCTION:    acpi_rs_dump_descriptor
48795b482a8SLen Brown  *
48895b482a8SLen Brown  * PARAMETERS:  Resource
48995b482a8SLen Brown  *
49095b482a8SLen Brown  * RETURN:      None
49195b482a8SLen Brown  *
49295b482a8SLen Brown  * DESCRIPTION:
49395b482a8SLen Brown  *
49495b482a8SLen Brown  ******************************************************************************/
49595b482a8SLen Brown 
49695b482a8SLen Brown static void
49795b482a8SLen Brown acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table)
49895b482a8SLen Brown {
49995b482a8SLen Brown 	u8 *target = NULL;
50095b482a8SLen Brown 	u8 *previous_target;
50195b482a8SLen Brown 	char *name;
50295b482a8SLen Brown 	u8 count;
50395b482a8SLen Brown 
50495b482a8SLen Brown 	/* First table entry must contain the table length (# of table entries) */
50595b482a8SLen Brown 
50695b482a8SLen Brown 	count = table->offset;
50795b482a8SLen Brown 
50895b482a8SLen Brown 	while (count) {
50995b482a8SLen Brown 		previous_target = target;
51095b482a8SLen Brown 		target = ACPI_ADD_PTR(u8, resource, table->offset);
51195b482a8SLen Brown 		name = table->name;
51295b482a8SLen Brown 
51395b482a8SLen Brown 		switch (table->opcode) {
51495b482a8SLen Brown 		case ACPI_RSD_TITLE:
51595b482a8SLen Brown 			/*
51695b482a8SLen Brown 			 * Optional resource title
51795b482a8SLen Brown 			 */
51895b482a8SLen Brown 			if (table->name) {
51995b482a8SLen Brown 				acpi_os_printf("%s Resource\n", name);
52095b482a8SLen Brown 			}
52195b482a8SLen Brown 			break;
52295b482a8SLen Brown 
52395b482a8SLen Brown 			/* Strings */
52495b482a8SLen Brown 
52595b482a8SLen Brown 		case ACPI_RSD_LITERAL:
52695b482a8SLen Brown 			acpi_rs_out_string(name,
52795b482a8SLen Brown 					   ACPI_CAST_PTR(char, table->pointer));
52895b482a8SLen Brown 			break;
52995b482a8SLen Brown 
53095b482a8SLen Brown 		case ACPI_RSD_STRING:
53195b482a8SLen Brown 			acpi_rs_out_string(name, ACPI_CAST_PTR(char, target));
53295b482a8SLen Brown 			break;
53395b482a8SLen Brown 
53495b482a8SLen Brown 			/* Data items, 8/16/32/64 bit */
53595b482a8SLen Brown 
53695b482a8SLen Brown 		case ACPI_RSD_UINT8:
537e0fe0a8dSLin Ming 			if (table->pointer) {
538e0fe0a8dSLin Ming 				acpi_rs_out_string(name, ACPI_CAST_PTR(char,
539e0fe0a8dSLin Ming 								       table->
540e0fe0a8dSLin Ming 								       pointer
541e0fe0a8dSLin Ming 								       [*target]));
542e0fe0a8dSLin Ming 			} else {
54395b482a8SLen Brown 				acpi_rs_out_integer8(name, ACPI_GET8(target));
544e0fe0a8dSLin Ming 			}
54595b482a8SLen Brown 			break;
54695b482a8SLen Brown 
54795b482a8SLen Brown 		case ACPI_RSD_UINT16:
54895b482a8SLen Brown 			acpi_rs_out_integer16(name, ACPI_GET16(target));
54995b482a8SLen Brown 			break;
55095b482a8SLen Brown 
55195b482a8SLen Brown 		case ACPI_RSD_UINT32:
55295b482a8SLen Brown 			acpi_rs_out_integer32(name, ACPI_GET32(target));
55395b482a8SLen Brown 			break;
55495b482a8SLen Brown 
55595b482a8SLen Brown 		case ACPI_RSD_UINT64:
55695b482a8SLen Brown 			acpi_rs_out_integer64(name, ACPI_GET64(target));
55795b482a8SLen Brown 			break;
55895b482a8SLen Brown 
55995b482a8SLen Brown 			/* Flags: 1-bit and 2-bit flags supported */
56095b482a8SLen Brown 
56195b482a8SLen Brown 		case ACPI_RSD_1BITFLAG:
56295b482a8SLen Brown 			acpi_rs_out_string(name, ACPI_CAST_PTR(char,
56395b482a8SLen Brown 							       table->
56495b482a8SLen Brown 							       pointer[*target &
56595b482a8SLen Brown 								       0x01]));
56695b482a8SLen Brown 			break;
56795b482a8SLen Brown 
56895b482a8SLen Brown 		case ACPI_RSD_2BITFLAG:
56995b482a8SLen Brown 			acpi_rs_out_string(name, ACPI_CAST_PTR(char,
57095b482a8SLen Brown 							       table->
57195b482a8SLen Brown 							       pointer[*target &
57295b482a8SLen Brown 								       0x03]));
57395b482a8SLen Brown 			break;
57495b482a8SLen Brown 
575e0fe0a8dSLin Ming 		case ACPI_RSD_3BITFLAG:
576e0fe0a8dSLin Ming 			acpi_rs_out_string(name, ACPI_CAST_PTR(char,
577e0fe0a8dSLin Ming 							       table->
578e0fe0a8dSLin Ming 							       pointer[*target &
579e0fe0a8dSLin Ming 								       0x07]));
580e0fe0a8dSLin Ming 			break;
581e0fe0a8dSLin Ming 
58295b482a8SLen Brown 		case ACPI_RSD_SHORTLIST:
58395b482a8SLen Brown 			/*
58495b482a8SLen Brown 			 * Short byte list (single line output) for DMA and IRQ resources
58595b482a8SLen Brown 			 * Note: The list length is obtained from the previous table entry
58695b482a8SLen Brown 			 */
58795b482a8SLen Brown 			if (previous_target) {
58895b482a8SLen Brown 				acpi_rs_out_title(name);
58995b482a8SLen Brown 				acpi_rs_dump_short_byte_list(*previous_target,
59095b482a8SLen Brown 							     target);
59195b482a8SLen Brown 			}
59295b482a8SLen Brown 			break;
59395b482a8SLen Brown 
594e0fe0a8dSLin Ming 		case ACPI_RSD_SHORTLISTX:
595e0fe0a8dSLin Ming 			/*
596e0fe0a8dSLin Ming 			 * Short byte list (single line output) for GPIO vendor data
597e0fe0a8dSLin Ming 			 * Note: The list length is obtained from the previous table entry
598e0fe0a8dSLin Ming 			 */
599e0fe0a8dSLin Ming 			if (previous_target) {
600e0fe0a8dSLin Ming 				acpi_rs_out_title(name);
601e0fe0a8dSLin Ming 				acpi_rs_dump_short_byte_list(*previous_target,
602e0fe0a8dSLin Ming 							     *
603e0fe0a8dSLin Ming 							     (ACPI_CAST_INDIRECT_PTR
604e0fe0a8dSLin Ming 							      (u8, target)));
605e0fe0a8dSLin Ming 			}
606e0fe0a8dSLin Ming 			break;
607e0fe0a8dSLin Ming 
60895b482a8SLen Brown 		case ACPI_RSD_LONGLIST:
60995b482a8SLen Brown 			/*
61095b482a8SLen Brown 			 * Long byte list for Vendor resource data
61195b482a8SLen Brown 			 * Note: The list length is obtained from the previous table entry
61295b482a8SLen Brown 			 */
61395b482a8SLen Brown 			if (previous_target) {
61495b482a8SLen Brown 				acpi_rs_dump_byte_list(ACPI_GET16
61595b482a8SLen Brown 						       (previous_target),
61695b482a8SLen Brown 						       target);
61795b482a8SLen Brown 			}
61895b482a8SLen Brown 			break;
61995b482a8SLen Brown 
62095b482a8SLen Brown 		case ACPI_RSD_DWORDLIST:
62195b482a8SLen Brown 			/*
62295b482a8SLen Brown 			 * Dword list for Extended Interrupt resources
62395b482a8SLen Brown 			 * Note: The list length is obtained from the previous table entry
62495b482a8SLen Brown 			 */
62595b482a8SLen Brown 			if (previous_target) {
62695b482a8SLen Brown 				acpi_rs_dump_dword_list(*previous_target,
62795b482a8SLen Brown 							ACPI_CAST_PTR(u32,
62895b482a8SLen Brown 								      target));
62995b482a8SLen Brown 			}
63095b482a8SLen Brown 			break;
63195b482a8SLen Brown 
632e0fe0a8dSLin Ming 		case ACPI_RSD_WORDLIST:
633e0fe0a8dSLin Ming 			/*
634e0fe0a8dSLin Ming 			 * Word list for GPIO Pin Table
635e0fe0a8dSLin Ming 			 * Note: The list length is obtained from the previous table entry
636e0fe0a8dSLin Ming 			 */
637e0fe0a8dSLin Ming 			if (previous_target) {
638e0fe0a8dSLin Ming 				acpi_rs_dump_word_list(*previous_target,
639e0fe0a8dSLin Ming 						       *(ACPI_CAST_INDIRECT_PTR
640e0fe0a8dSLin Ming 							 (u16, target)));
641e0fe0a8dSLin Ming 			}
642e0fe0a8dSLin Ming 			break;
643e0fe0a8dSLin Ming 
64495b482a8SLen Brown 		case ACPI_RSD_ADDRESS:
64595b482a8SLen Brown 			/*
64695b482a8SLen Brown 			 * Common flags for all Address resources
64795b482a8SLen Brown 			 */
64895b482a8SLen Brown 			acpi_rs_dump_address_common(ACPI_CAST_PTR
64995b482a8SLen Brown 						    (union acpi_resource_data,
65095b482a8SLen Brown 						     target));
65195b482a8SLen Brown 			break;
65295b482a8SLen Brown 
65395b482a8SLen Brown 		case ACPI_RSD_SOURCE:
65495b482a8SLen Brown 			/*
65595b482a8SLen Brown 			 * Optional resource_source for Address resources
65695b482a8SLen Brown 			 */
65795b482a8SLen Brown 			acpi_rs_dump_resource_source(ACPI_CAST_PTR(struct
65895b482a8SLen Brown 								   acpi_resource_source,
65995b482a8SLen Brown 								   target));
66095b482a8SLen Brown 			break;
66195b482a8SLen Brown 
66295b482a8SLen Brown 		default:
66395b482a8SLen Brown 			acpi_os_printf("**** Invalid table opcode [%X] ****\n",
66495b482a8SLen Brown 				       table->opcode);
66595b482a8SLen Brown 			return;
66695b482a8SLen Brown 		}
66795b482a8SLen Brown 
66895b482a8SLen Brown 		table++;
66995b482a8SLen Brown 		count--;
67095b482a8SLen Brown 	}
67195b482a8SLen Brown }
67295b482a8SLen Brown 
67395b482a8SLen Brown /*******************************************************************************
67495b482a8SLen Brown  *
67595b482a8SLen Brown  * FUNCTION:    acpi_rs_dump_resource_source
67695b482a8SLen Brown  *
67795b482a8SLen Brown  * PARAMETERS:  resource_source     - Pointer to a Resource Source struct
67895b482a8SLen Brown  *
67995b482a8SLen Brown  * RETURN:      None
68095b482a8SLen Brown  *
68195b482a8SLen Brown  * DESCRIPTION: Common routine for dumping the optional resource_source and the
68295b482a8SLen Brown  *              corresponding resource_source_index.
68395b482a8SLen Brown  *
68495b482a8SLen Brown  ******************************************************************************/
68595b482a8SLen Brown 
68695b482a8SLen Brown static void
68795b482a8SLen Brown acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source)
68895b482a8SLen Brown {
68995b482a8SLen Brown 	ACPI_FUNCTION_ENTRY();
69095b482a8SLen Brown 
69195b482a8SLen Brown 	if (resource_source->index == 0xFF) {
69295b482a8SLen Brown 		return;
69395b482a8SLen Brown 	}
69495b482a8SLen Brown 
69595b482a8SLen Brown 	acpi_rs_out_integer8("Resource Source Index", resource_source->index);
69695b482a8SLen Brown 
69795b482a8SLen Brown 	acpi_rs_out_string("Resource Source",
69895b482a8SLen Brown 			   resource_source->string_ptr ?
69995b482a8SLen Brown 			   resource_source->string_ptr : "[Not Specified]");
70095b482a8SLen Brown }
70195b482a8SLen Brown 
70295b482a8SLen Brown /*******************************************************************************
70395b482a8SLen Brown  *
70495b482a8SLen Brown  * FUNCTION:    acpi_rs_dump_address_common
70595b482a8SLen Brown  *
706*ba494beeSBob Moore  * PARAMETERS:  resource        - Pointer to an internal resource descriptor
70795b482a8SLen Brown  *
70895b482a8SLen Brown  * RETURN:      None
70995b482a8SLen Brown  *
71095b482a8SLen Brown  * DESCRIPTION: Dump the fields that are common to all Address resource
71195b482a8SLen Brown  *              descriptors
71295b482a8SLen Brown  *
71395b482a8SLen Brown  ******************************************************************************/
71495b482a8SLen Brown 
71595b482a8SLen Brown static void acpi_rs_dump_address_common(union acpi_resource_data *resource)
71695b482a8SLen Brown {
71795b482a8SLen Brown 	ACPI_FUNCTION_ENTRY();
71895b482a8SLen Brown 
71995b482a8SLen Brown 	/* Decode the type-specific flags */
72095b482a8SLen Brown 
72195b482a8SLen Brown 	switch (resource->address.resource_type) {
72295b482a8SLen Brown 	case ACPI_MEMORY_RANGE:
72395b482a8SLen Brown 
72495b482a8SLen Brown 		acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags);
72595b482a8SLen Brown 		break;
72695b482a8SLen Brown 
72795b482a8SLen Brown 	case ACPI_IO_RANGE:
72895b482a8SLen Brown 
72995b482a8SLen Brown 		acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags);
73095b482a8SLen Brown 		break;
73195b482a8SLen Brown 
73295b482a8SLen Brown 	case ACPI_BUS_NUMBER_RANGE:
73395b482a8SLen Brown 
73495b482a8SLen Brown 		acpi_rs_out_string("Resource Type", "Bus Number Range");
73595b482a8SLen Brown 		break;
73695b482a8SLen Brown 
73795b482a8SLen Brown 	default:
73895b482a8SLen Brown 
73995b482a8SLen Brown 		acpi_rs_out_integer8("Resource Type",
74095b482a8SLen Brown 				     (u8) resource->address.resource_type);
74195b482a8SLen Brown 		break;
74295b482a8SLen Brown 	}
74395b482a8SLen Brown 
74495b482a8SLen Brown 	/* Decode the general flags */
74595b482a8SLen Brown 
74695b482a8SLen Brown 	acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags);
74795b482a8SLen Brown }
74895b482a8SLen Brown 
74995b482a8SLen Brown /*******************************************************************************
75095b482a8SLen Brown  *
75195b482a8SLen Brown  * FUNCTION:    acpi_rs_dump_resource_list
75295b482a8SLen Brown  *
75395b482a8SLen Brown  * PARAMETERS:  resource_list       - Pointer to a resource descriptor list
75495b482a8SLen Brown  *
75595b482a8SLen Brown  * RETURN:      None
75695b482a8SLen Brown  *
75795b482a8SLen Brown  * DESCRIPTION: Dispatches the structure to the correct dump routine.
75895b482a8SLen Brown  *
75995b482a8SLen Brown  ******************************************************************************/
76095b482a8SLen Brown 
76195b482a8SLen Brown void acpi_rs_dump_resource_list(struct acpi_resource *resource_list)
76295b482a8SLen Brown {
76395b482a8SLen Brown 	u32 count = 0;
76495b482a8SLen Brown 	u32 type;
76595b482a8SLen Brown 
76695b482a8SLen Brown 	ACPI_FUNCTION_ENTRY();
76795b482a8SLen Brown 
76895b482a8SLen Brown 	if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
76995b482a8SLen Brown 	    || !(_COMPONENT & acpi_dbg_layer)) {
77095b482a8SLen Brown 		return;
77195b482a8SLen Brown 	}
77295b482a8SLen Brown 
77395b482a8SLen Brown 	/* Walk list and dump all resource descriptors (END_TAG terminates) */
77495b482a8SLen Brown 
77595b482a8SLen Brown 	do {
77695b482a8SLen Brown 		acpi_os_printf("\n[%02X] ", count);
77795b482a8SLen Brown 		count++;
77895b482a8SLen Brown 
77995b482a8SLen Brown 		/* Validate Type before dispatch */
78095b482a8SLen Brown 
78195b482a8SLen Brown 		type = resource_list->type;
78295b482a8SLen Brown 		if (type > ACPI_RESOURCE_TYPE_MAX) {
78395b482a8SLen Brown 			acpi_os_printf
78495b482a8SLen Brown 			    ("Invalid descriptor type (%X) in resource list\n",
78595b482a8SLen Brown 			     resource_list->type);
78695b482a8SLen Brown 			return;
78795b482a8SLen Brown 		}
78895b482a8SLen Brown 
78995b482a8SLen Brown 		/* Dump the resource descriptor */
79095b482a8SLen Brown 
791e0fe0a8dSLin Ming 		if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) {
79295b482a8SLen Brown 			acpi_rs_dump_descriptor(&resource_list->data,
793e0fe0a8dSLin Ming 						acpi_gbl_dump_serial_bus_dispatch
794e0fe0a8dSLin Ming 						[resource_list->data.
795e0fe0a8dSLin Ming 						 common_serial_bus.type]);
796e0fe0a8dSLin Ming 		} else {
797e0fe0a8dSLin Ming 			acpi_rs_dump_descriptor(&resource_list->data,
798e0fe0a8dSLin Ming 						acpi_gbl_dump_resource_dispatch
799e0fe0a8dSLin Ming 						[type]);
800e0fe0a8dSLin Ming 		}
80195b482a8SLen Brown 
80295b482a8SLen Brown 		/* Point to the next resource structure */
80395b482a8SLen Brown 
804e0fe0a8dSLin Ming 		resource_list = ACPI_NEXT_RESOURCE(resource_list);
80595b482a8SLen Brown 
80695b482a8SLen Brown 		/* Exit when END_TAG descriptor is reached */
80795b482a8SLen Brown 
80895b482a8SLen Brown 	} while (type != ACPI_RESOURCE_TYPE_END_TAG);
80995b482a8SLen Brown }
81095b482a8SLen Brown 
81195b482a8SLen Brown /*******************************************************************************
81295b482a8SLen Brown  *
81395b482a8SLen Brown  * FUNCTION:    acpi_rs_dump_irq_list
81495b482a8SLen Brown  *
81595b482a8SLen Brown  * PARAMETERS:  route_table     - Pointer to the routing table to dump.
81695b482a8SLen Brown  *
81795b482a8SLen Brown  * RETURN:      None
81895b482a8SLen Brown  *
81995b482a8SLen Brown  * DESCRIPTION: Print IRQ routing table
82095b482a8SLen Brown  *
82195b482a8SLen Brown  ******************************************************************************/
82295b482a8SLen Brown 
82395b482a8SLen Brown void acpi_rs_dump_irq_list(u8 * route_table)
82495b482a8SLen Brown {
82595b482a8SLen Brown 	struct acpi_pci_routing_table *prt_element;
82695b482a8SLen Brown 	u8 count;
82795b482a8SLen Brown 
82895b482a8SLen Brown 	ACPI_FUNCTION_ENTRY();
82995b482a8SLen Brown 
83095b482a8SLen Brown 	if (!(acpi_dbg_level & ACPI_LV_RESOURCES)
83195b482a8SLen Brown 	    || !(_COMPONENT & acpi_dbg_layer)) {
83295b482a8SLen Brown 		return;
83395b482a8SLen Brown 	}
83495b482a8SLen Brown 
83595b482a8SLen Brown 	prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table);
83695b482a8SLen Brown 
83795b482a8SLen Brown 	/* Dump all table elements, Exit on zero length element */
83895b482a8SLen Brown 
83995b482a8SLen Brown 	for (count = 0; prt_element->length; count++) {
84095b482a8SLen Brown 		acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n",
84195b482a8SLen Brown 			       count);
84295b482a8SLen Brown 		acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt);
84395b482a8SLen Brown 
84495b482a8SLen Brown 		prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table,
84595b482a8SLen Brown 					   prt_element, prt_element->length);
84695b482a8SLen Brown 	}
84795b482a8SLen Brown }
84895b482a8SLen Brown 
84995b482a8SLen Brown /*******************************************************************************
85095b482a8SLen Brown  *
85195b482a8SLen Brown  * FUNCTION:    acpi_rs_out*
85295b482a8SLen Brown  *
853*ba494beeSBob Moore  * PARAMETERS:  title       - Name of the resource field
854*ba494beeSBob Moore  *              value       - Value of the resource field
85595b482a8SLen Brown  *
85695b482a8SLen Brown  * RETURN:      None
85795b482a8SLen Brown  *
85895b482a8SLen Brown  * DESCRIPTION: Miscellaneous helper functions to consistently format the
85995b482a8SLen Brown  *              output of the resource dump routines
86095b482a8SLen Brown  *
86195b482a8SLen Brown  ******************************************************************************/
86295b482a8SLen Brown 
86395b482a8SLen Brown static void acpi_rs_out_string(char *title, char *value)
86495b482a8SLen Brown {
86595b482a8SLen Brown 	acpi_os_printf("%27s : %s", title, value);
86695b482a8SLen Brown 	if (!*value) {
86795b482a8SLen Brown 		acpi_os_printf("[NULL NAMESTRING]");
86895b482a8SLen Brown 	}
86995b482a8SLen Brown 	acpi_os_printf("\n");
87095b482a8SLen Brown }
87195b482a8SLen Brown 
87295b482a8SLen Brown static void acpi_rs_out_integer8(char *title, u8 value)
87395b482a8SLen Brown {
87495b482a8SLen Brown 	acpi_os_printf("%27s : %2.2X\n", title, value);
87595b482a8SLen Brown }
87695b482a8SLen Brown 
87795b482a8SLen Brown static void acpi_rs_out_integer16(char *title, u16 value)
87895b482a8SLen Brown {
87995b482a8SLen Brown 	acpi_os_printf("%27s : %4.4X\n", title, value);
88095b482a8SLen Brown }
88195b482a8SLen Brown 
88295b482a8SLen Brown static void acpi_rs_out_integer32(char *title, u32 value)
88395b482a8SLen Brown {
88495b482a8SLen Brown 	acpi_os_printf("%27s : %8.8X\n", title, value);
88595b482a8SLen Brown }
88695b482a8SLen Brown 
88795b482a8SLen Brown static void acpi_rs_out_integer64(char *title, u64 value)
88895b482a8SLen Brown {
88995b482a8SLen Brown 	acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value));
89095b482a8SLen Brown }
89195b482a8SLen Brown 
89295b482a8SLen Brown static void acpi_rs_out_title(char *title)
89395b482a8SLen Brown {
89495b482a8SLen Brown 	acpi_os_printf("%27s : ", title);
89595b482a8SLen Brown }
89695b482a8SLen Brown 
89795b482a8SLen Brown /*******************************************************************************
89895b482a8SLen Brown  *
89995b482a8SLen Brown  * FUNCTION:    acpi_rs_dump*List
90095b482a8SLen Brown  *
901*ba494beeSBob Moore  * PARAMETERS:  length      - Number of elements in the list
902*ba494beeSBob Moore  *              data        - Start of the list
90395b482a8SLen Brown  *
90495b482a8SLen Brown  * RETURN:      None
90595b482a8SLen Brown  *
90695b482a8SLen Brown  * DESCRIPTION: Miscellaneous functions to dump lists of raw data
90795b482a8SLen Brown  *
90895b482a8SLen Brown  ******************************************************************************/
90995b482a8SLen Brown 
91095b482a8SLen Brown static void acpi_rs_dump_byte_list(u16 length, u8 * data)
91195b482a8SLen Brown {
91295b482a8SLen Brown 	u8 i;
91395b482a8SLen Brown 
91495b482a8SLen Brown 	for (i = 0; i < length; i++) {
91595b482a8SLen Brown 		acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]);
91695b482a8SLen Brown 	}
91795b482a8SLen Brown }
91895b482a8SLen Brown 
91995b482a8SLen Brown static void acpi_rs_dump_short_byte_list(u8 length, u8 * data)
92095b482a8SLen Brown {
92195b482a8SLen Brown 	u8 i;
92295b482a8SLen Brown 
92395b482a8SLen Brown 	for (i = 0; i < length; i++) {
92495b482a8SLen Brown 		acpi_os_printf("%X ", data[i]);
92595b482a8SLen Brown 	}
92695b482a8SLen Brown 	acpi_os_printf("\n");
92795b482a8SLen Brown }
92895b482a8SLen Brown 
92995b482a8SLen Brown static void acpi_rs_dump_dword_list(u8 length, u32 * data)
93095b482a8SLen Brown {
93195b482a8SLen Brown 	u8 i;
93295b482a8SLen Brown 
93395b482a8SLen Brown 	for (i = 0; i < length; i++) {
93495b482a8SLen Brown 		acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]);
93595b482a8SLen Brown 	}
93695b482a8SLen Brown }
93795b482a8SLen Brown 
938e0fe0a8dSLin Ming static void acpi_rs_dump_word_list(u16 length, u16 *data)
939e0fe0a8dSLin Ming {
940e0fe0a8dSLin Ming 	u16 i;
941e0fe0a8dSLin Ming 
942e0fe0a8dSLin Ming 	for (i = 0; i < length; i++) {
943e0fe0a8dSLin Ming 		acpi_os_printf("%25s%2.2X : %4.4X\n", "Word", i, data[i]);
944e0fe0a8dSLin Ming 	}
945e0fe0a8dSLin Ming }
946e0fe0a8dSLin Ming 
94795b482a8SLen Brown #endif
948