195b482a8SLen Brown /******************************************************************************* 295b482a8SLen Brown * 395b482a8SLen Brown * Module Name: rsdump - Functions to display the resource structures. 495b482a8SLen Brown * 595b482a8SLen Brown ******************************************************************************/ 695b482a8SLen Brown 795b482a8SLen Brown /* 8fbb7a2dcSBob Moore * Copyright (C) 2000 - 2014, 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") 50*3334861bSLv Zheng 51*3334861bSLv Zheng #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBER) || defined(ACPI_DEBUGGER) 5295b482a8SLen Brown /* Local prototypes */ 5395b482a8SLen Brown static void acpi_rs_out_string(char *title, char *value); 5495b482a8SLen Brown 5595b482a8SLen Brown static void acpi_rs_out_integer8(char *title, u8 value); 5695b482a8SLen Brown 5795b482a8SLen Brown static void acpi_rs_out_integer16(char *title, u16 value); 5895b482a8SLen Brown 5995b482a8SLen Brown static void acpi_rs_out_integer32(char *title, u32 value); 6095b482a8SLen Brown 6195b482a8SLen Brown static void acpi_rs_out_integer64(char *title, u64 value); 6295b482a8SLen Brown 6395b482a8SLen Brown static void acpi_rs_out_title(char *title); 6495b482a8SLen Brown 6595b482a8SLen Brown static void acpi_rs_dump_byte_list(u16 length, u8 *data); 6695b482a8SLen Brown 67e0fe0a8dSLin Ming static void acpi_rs_dump_word_list(u16 length, u16 *data); 68e0fe0a8dSLin Ming 6995b482a8SLen Brown static void acpi_rs_dump_dword_list(u8 length, u32 *data); 7095b482a8SLen Brown 7195b482a8SLen Brown static void acpi_rs_dump_short_byte_list(u8 length, u8 *data); 7295b482a8SLen Brown 7395b482a8SLen Brown static void 7495b482a8SLen Brown acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); 7595b482a8SLen Brown 7695b482a8SLen Brown static void acpi_rs_dump_address_common(union acpi_resource_data *resource); 7795b482a8SLen Brown 7895b482a8SLen Brown static void 7995b482a8SLen Brown acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); 8095b482a8SLen Brown 8195b482a8SLen Brown /******************************************************************************* 8295b482a8SLen Brown * 8395b482a8SLen Brown * FUNCTION: acpi_rs_dump_descriptor 8495b482a8SLen Brown * 8542f8fb75SBob Moore * PARAMETERS: resource - Buffer containing the resource 8642f8fb75SBob Moore * table - Table entry to decode the resource 8795b482a8SLen Brown * 8895b482a8SLen Brown * RETURN: None 8995b482a8SLen Brown * 9042f8fb75SBob Moore * DESCRIPTION: Dump a resource descriptor based on a dump table entry. 9195b482a8SLen Brown * 9295b482a8SLen Brown ******************************************************************************/ 9395b482a8SLen Brown 9495b482a8SLen Brown static void 9595b482a8SLen Brown acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) 9695b482a8SLen Brown { 9795b482a8SLen Brown u8 *target = NULL; 9895b482a8SLen Brown u8 *previous_target; 9995b482a8SLen Brown char *name; 10095b482a8SLen Brown u8 count; 10195b482a8SLen Brown 10295b482a8SLen Brown /* First table entry must contain the table length (# of table entries) */ 10395b482a8SLen Brown 10495b482a8SLen Brown count = table->offset; 10595b482a8SLen Brown 10695b482a8SLen Brown while (count) { 10795b482a8SLen Brown previous_target = target; 10895b482a8SLen Brown target = ACPI_ADD_PTR(u8, resource, table->offset); 10995b482a8SLen Brown name = table->name; 11095b482a8SLen Brown 11195b482a8SLen Brown switch (table->opcode) { 11295b482a8SLen Brown case ACPI_RSD_TITLE: 11395b482a8SLen Brown /* 11495b482a8SLen Brown * Optional resource title 11595b482a8SLen Brown */ 11695b482a8SLen Brown if (table->name) { 11795b482a8SLen Brown acpi_os_printf("%s Resource\n", name); 11895b482a8SLen Brown } 11995b482a8SLen Brown break; 12095b482a8SLen Brown 12195b482a8SLen Brown /* Strings */ 12295b482a8SLen Brown 12395b482a8SLen Brown case ACPI_RSD_LITERAL: 1241d1ea1b7SChao Guan 12595b482a8SLen Brown acpi_rs_out_string(name, 12695b482a8SLen Brown ACPI_CAST_PTR(char, table->pointer)); 12795b482a8SLen Brown break; 12895b482a8SLen Brown 12995b482a8SLen Brown case ACPI_RSD_STRING: 1301d1ea1b7SChao Guan 13195b482a8SLen Brown acpi_rs_out_string(name, ACPI_CAST_PTR(char, target)); 13295b482a8SLen Brown break; 13395b482a8SLen Brown 13495b482a8SLen Brown /* Data items, 8/16/32/64 bit */ 13595b482a8SLen Brown 13695b482a8SLen Brown case ACPI_RSD_UINT8: 1371d1ea1b7SChao Guan 138e0fe0a8dSLin Ming if (table->pointer) { 139e0fe0a8dSLin Ming acpi_rs_out_string(name, ACPI_CAST_PTR(char, 140e0fe0a8dSLin Ming table-> 141e0fe0a8dSLin Ming pointer 142e0fe0a8dSLin Ming [*target])); 143e0fe0a8dSLin Ming } else { 14495b482a8SLen Brown acpi_rs_out_integer8(name, ACPI_GET8(target)); 145e0fe0a8dSLin Ming } 14695b482a8SLen Brown break; 14795b482a8SLen Brown 14895b482a8SLen Brown case ACPI_RSD_UINT16: 1491d1ea1b7SChao Guan 15095b482a8SLen Brown acpi_rs_out_integer16(name, ACPI_GET16(target)); 15195b482a8SLen Brown break; 15295b482a8SLen Brown 15395b482a8SLen Brown case ACPI_RSD_UINT32: 1541d1ea1b7SChao Guan 15595b482a8SLen Brown acpi_rs_out_integer32(name, ACPI_GET32(target)); 15695b482a8SLen Brown break; 15795b482a8SLen Brown 15895b482a8SLen Brown case ACPI_RSD_UINT64: 1591d1ea1b7SChao Guan 16095b482a8SLen Brown acpi_rs_out_integer64(name, ACPI_GET64(target)); 16195b482a8SLen Brown break; 16295b482a8SLen Brown 16395b482a8SLen Brown /* Flags: 1-bit and 2-bit flags supported */ 16495b482a8SLen Brown 16595b482a8SLen Brown case ACPI_RSD_1BITFLAG: 1661d1ea1b7SChao Guan 16795b482a8SLen Brown acpi_rs_out_string(name, ACPI_CAST_PTR(char, 16895b482a8SLen Brown table-> 16995b482a8SLen Brown pointer[*target & 17095b482a8SLen Brown 0x01])); 17195b482a8SLen Brown break; 17295b482a8SLen Brown 17395b482a8SLen Brown case ACPI_RSD_2BITFLAG: 1741d1ea1b7SChao Guan 17595b482a8SLen Brown acpi_rs_out_string(name, ACPI_CAST_PTR(char, 17695b482a8SLen Brown table-> 17795b482a8SLen Brown pointer[*target & 17895b482a8SLen Brown 0x03])); 17995b482a8SLen Brown break; 18095b482a8SLen Brown 181e0fe0a8dSLin Ming case ACPI_RSD_3BITFLAG: 1821d1ea1b7SChao Guan 183e0fe0a8dSLin Ming acpi_rs_out_string(name, ACPI_CAST_PTR(char, 184e0fe0a8dSLin Ming table-> 185e0fe0a8dSLin Ming pointer[*target & 186e0fe0a8dSLin Ming 0x07])); 187e0fe0a8dSLin Ming break; 188e0fe0a8dSLin Ming 18995b482a8SLen Brown case ACPI_RSD_SHORTLIST: 19095b482a8SLen Brown /* 19195b482a8SLen Brown * Short byte list (single line output) for DMA and IRQ resources 19295b482a8SLen Brown * Note: The list length is obtained from the previous table entry 19395b482a8SLen Brown */ 19495b482a8SLen Brown if (previous_target) { 19595b482a8SLen Brown acpi_rs_out_title(name); 19695b482a8SLen Brown acpi_rs_dump_short_byte_list(*previous_target, 19795b482a8SLen Brown target); 19895b482a8SLen Brown } 19995b482a8SLen Brown break; 20095b482a8SLen Brown 201e0fe0a8dSLin Ming case ACPI_RSD_SHORTLISTX: 202e0fe0a8dSLin Ming /* 203e0fe0a8dSLin Ming * Short byte list (single line output) for GPIO vendor data 204e0fe0a8dSLin Ming * Note: The list length is obtained from the previous table entry 205e0fe0a8dSLin Ming */ 206e0fe0a8dSLin Ming if (previous_target) { 207e0fe0a8dSLin Ming acpi_rs_out_title(name); 208e0fe0a8dSLin Ming acpi_rs_dump_short_byte_list(*previous_target, 209e0fe0a8dSLin Ming * 210e0fe0a8dSLin Ming (ACPI_CAST_INDIRECT_PTR 211e0fe0a8dSLin Ming (u8, target))); 212e0fe0a8dSLin Ming } 213e0fe0a8dSLin Ming break; 214e0fe0a8dSLin Ming 21595b482a8SLen Brown case ACPI_RSD_LONGLIST: 21695b482a8SLen Brown /* 21795b482a8SLen Brown * Long byte list for Vendor resource data 21895b482a8SLen Brown * Note: The list length is obtained from the previous table entry 21995b482a8SLen Brown */ 22095b482a8SLen Brown if (previous_target) { 22195b482a8SLen Brown acpi_rs_dump_byte_list(ACPI_GET16 22295b482a8SLen Brown (previous_target), 22395b482a8SLen Brown target); 22495b482a8SLen Brown } 22595b482a8SLen Brown break; 22695b482a8SLen Brown 22795b482a8SLen Brown case ACPI_RSD_DWORDLIST: 22895b482a8SLen Brown /* 22995b482a8SLen Brown * Dword list for Extended Interrupt resources 23095b482a8SLen Brown * Note: The list length is obtained from the previous table entry 23195b482a8SLen Brown */ 23295b482a8SLen Brown if (previous_target) { 23395b482a8SLen Brown acpi_rs_dump_dword_list(*previous_target, 23495b482a8SLen Brown ACPI_CAST_PTR(u32, 23595b482a8SLen Brown target)); 23695b482a8SLen Brown } 23795b482a8SLen Brown break; 23895b482a8SLen Brown 239e0fe0a8dSLin Ming case ACPI_RSD_WORDLIST: 240e0fe0a8dSLin Ming /* 241e0fe0a8dSLin Ming * Word list for GPIO Pin Table 242e0fe0a8dSLin Ming * Note: The list length is obtained from the previous table entry 243e0fe0a8dSLin Ming */ 244e0fe0a8dSLin Ming if (previous_target) { 245e0fe0a8dSLin Ming acpi_rs_dump_word_list(*previous_target, 246e0fe0a8dSLin Ming *(ACPI_CAST_INDIRECT_PTR 247e0fe0a8dSLin Ming (u16, target))); 248e0fe0a8dSLin Ming } 249e0fe0a8dSLin Ming break; 250e0fe0a8dSLin Ming 25195b482a8SLen Brown case ACPI_RSD_ADDRESS: 25295b482a8SLen Brown /* 25395b482a8SLen Brown * Common flags for all Address resources 25495b482a8SLen Brown */ 25595b482a8SLen Brown acpi_rs_dump_address_common(ACPI_CAST_PTR 25695b482a8SLen Brown (union acpi_resource_data, 25795b482a8SLen Brown target)); 25895b482a8SLen Brown break; 25995b482a8SLen Brown 26095b482a8SLen Brown case ACPI_RSD_SOURCE: 26195b482a8SLen Brown /* 26295b482a8SLen Brown * Optional resource_source for Address resources 26395b482a8SLen Brown */ 2643e8214e5SLv Zheng acpi_rs_dump_resource_source(ACPI_CAST_PTR 2653e8214e5SLv Zheng (struct 26695b482a8SLen Brown acpi_resource_source, 26795b482a8SLen Brown target)); 26895b482a8SLen Brown break; 26995b482a8SLen Brown 27095b482a8SLen Brown default: 2711d1ea1b7SChao Guan 27295b482a8SLen Brown acpi_os_printf("**** Invalid table opcode [%X] ****\n", 27395b482a8SLen Brown table->opcode); 27495b482a8SLen Brown return; 27595b482a8SLen Brown } 27695b482a8SLen Brown 27795b482a8SLen Brown table++; 27895b482a8SLen Brown count--; 27995b482a8SLen Brown } 28095b482a8SLen Brown } 28195b482a8SLen Brown 28295b482a8SLen Brown /******************************************************************************* 28395b482a8SLen Brown * 28495b482a8SLen Brown * FUNCTION: acpi_rs_dump_resource_source 28595b482a8SLen Brown * 28695b482a8SLen Brown * PARAMETERS: resource_source - Pointer to a Resource Source struct 28795b482a8SLen Brown * 28895b482a8SLen Brown * RETURN: None 28995b482a8SLen Brown * 29095b482a8SLen Brown * DESCRIPTION: Common routine for dumping the optional resource_source and the 29195b482a8SLen Brown * corresponding resource_source_index. 29295b482a8SLen Brown * 29395b482a8SLen Brown ******************************************************************************/ 29495b482a8SLen Brown 29595b482a8SLen Brown static void 29695b482a8SLen Brown acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) 29795b482a8SLen Brown { 29895b482a8SLen Brown ACPI_FUNCTION_ENTRY(); 29995b482a8SLen Brown 30095b482a8SLen Brown if (resource_source->index == 0xFF) { 30195b482a8SLen Brown return; 30295b482a8SLen Brown } 30395b482a8SLen Brown 30495b482a8SLen Brown acpi_rs_out_integer8("Resource Source Index", resource_source->index); 30595b482a8SLen Brown 30695b482a8SLen Brown acpi_rs_out_string("Resource Source", 30795b482a8SLen Brown resource_source->string_ptr ? 30895b482a8SLen Brown resource_source->string_ptr : "[Not Specified]"); 30995b482a8SLen Brown } 31095b482a8SLen Brown 31195b482a8SLen Brown /******************************************************************************* 31295b482a8SLen Brown * 31395b482a8SLen Brown * FUNCTION: acpi_rs_dump_address_common 31495b482a8SLen Brown * 315ba494beeSBob Moore * PARAMETERS: resource - Pointer to an internal resource descriptor 31695b482a8SLen Brown * 31795b482a8SLen Brown * RETURN: None 31895b482a8SLen Brown * 31995b482a8SLen Brown * DESCRIPTION: Dump the fields that are common to all Address resource 32095b482a8SLen Brown * descriptors 32195b482a8SLen Brown * 32295b482a8SLen Brown ******************************************************************************/ 32395b482a8SLen Brown 32495b482a8SLen Brown static void acpi_rs_dump_address_common(union acpi_resource_data *resource) 32595b482a8SLen Brown { 32695b482a8SLen Brown ACPI_FUNCTION_ENTRY(); 32795b482a8SLen Brown 32895b482a8SLen Brown /* Decode the type-specific flags */ 32995b482a8SLen Brown 33095b482a8SLen Brown switch (resource->address.resource_type) { 33195b482a8SLen Brown case ACPI_MEMORY_RANGE: 33295b482a8SLen Brown 33395b482a8SLen Brown acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags); 33495b482a8SLen Brown break; 33595b482a8SLen Brown 33695b482a8SLen Brown case ACPI_IO_RANGE: 33795b482a8SLen Brown 33895b482a8SLen Brown acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags); 33995b482a8SLen Brown break; 34095b482a8SLen Brown 34195b482a8SLen Brown case ACPI_BUS_NUMBER_RANGE: 34295b482a8SLen Brown 34395b482a8SLen Brown acpi_rs_out_string("Resource Type", "Bus Number Range"); 34495b482a8SLen Brown break; 34595b482a8SLen Brown 34695b482a8SLen Brown default: 34795b482a8SLen Brown 34895b482a8SLen Brown acpi_rs_out_integer8("Resource Type", 34995b482a8SLen Brown (u8) resource->address.resource_type); 35095b482a8SLen Brown break; 35195b482a8SLen Brown } 35295b482a8SLen Brown 35395b482a8SLen Brown /* Decode the general flags */ 35495b482a8SLen Brown 35595b482a8SLen Brown acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags); 35695b482a8SLen Brown } 35795b482a8SLen Brown 35895b482a8SLen Brown /******************************************************************************* 35995b482a8SLen Brown * 36095b482a8SLen Brown * FUNCTION: acpi_rs_dump_resource_list 36195b482a8SLen Brown * 36295b482a8SLen Brown * PARAMETERS: resource_list - Pointer to a resource descriptor list 36395b482a8SLen Brown * 36495b482a8SLen Brown * RETURN: None 36595b482a8SLen Brown * 36695b482a8SLen Brown * DESCRIPTION: Dispatches the structure to the correct dump routine. 36795b482a8SLen Brown * 36895b482a8SLen Brown ******************************************************************************/ 36995b482a8SLen Brown 37095b482a8SLen Brown void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) 37195b482a8SLen Brown { 37295b482a8SLen Brown u32 count = 0; 37395b482a8SLen Brown u32 type; 37495b482a8SLen Brown 37595b482a8SLen Brown ACPI_FUNCTION_ENTRY(); 37695b482a8SLen Brown 37710e9e759SBob Moore /* Check if debug output enabled */ 37810e9e759SBob Moore 37910e9e759SBob Moore if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) { 38095b482a8SLen Brown return; 38195b482a8SLen Brown } 38295b482a8SLen Brown 38395b482a8SLen Brown /* Walk list and dump all resource descriptors (END_TAG terminates) */ 38495b482a8SLen Brown 38595b482a8SLen Brown do { 38695b482a8SLen Brown acpi_os_printf("\n[%02X] ", count); 38795b482a8SLen Brown count++; 38895b482a8SLen Brown 38995b482a8SLen Brown /* Validate Type before dispatch */ 39095b482a8SLen Brown 39195b482a8SLen Brown type = resource_list->type; 39295b482a8SLen Brown if (type > ACPI_RESOURCE_TYPE_MAX) { 39395b482a8SLen Brown acpi_os_printf 39495b482a8SLen Brown ("Invalid descriptor type (%X) in resource list\n", 39595b482a8SLen Brown resource_list->type); 39695b482a8SLen Brown return; 39795b482a8SLen Brown } 39895b482a8SLen Brown 399c13085e5SBob Moore /* Sanity check the length. It must not be zero, or we loop forever */ 400c13085e5SBob Moore 401c13085e5SBob Moore if (!resource_list->length) { 402c13085e5SBob Moore acpi_os_printf 403c13085e5SBob Moore ("Invalid zero length descriptor in resource list\n"); 404c13085e5SBob Moore return; 405c13085e5SBob Moore } 406c13085e5SBob Moore 40795b482a8SLen Brown /* Dump the resource descriptor */ 40895b482a8SLen Brown 409e0fe0a8dSLin Ming if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { 41095b482a8SLen Brown acpi_rs_dump_descriptor(&resource_list->data, 411e0fe0a8dSLin Ming acpi_gbl_dump_serial_bus_dispatch 412e0fe0a8dSLin Ming [resource_list->data. 413e0fe0a8dSLin Ming common_serial_bus.type]); 414e0fe0a8dSLin Ming } else { 415e0fe0a8dSLin Ming acpi_rs_dump_descriptor(&resource_list->data, 416e0fe0a8dSLin Ming acpi_gbl_dump_resource_dispatch 417e0fe0a8dSLin Ming [type]); 418e0fe0a8dSLin Ming } 41995b482a8SLen Brown 42095b482a8SLen Brown /* Point to the next resource structure */ 42195b482a8SLen Brown 422e0fe0a8dSLin Ming resource_list = ACPI_NEXT_RESOURCE(resource_list); 42395b482a8SLen Brown 42495b482a8SLen Brown /* Exit when END_TAG descriptor is reached */ 42595b482a8SLen Brown 42695b482a8SLen Brown } while (type != ACPI_RESOURCE_TYPE_END_TAG); 42795b482a8SLen Brown } 42895b482a8SLen Brown 42995b482a8SLen Brown /******************************************************************************* 43095b482a8SLen Brown * 43195b482a8SLen Brown * FUNCTION: acpi_rs_dump_irq_list 43295b482a8SLen Brown * 43395b482a8SLen Brown * PARAMETERS: route_table - Pointer to the routing table to dump. 43495b482a8SLen Brown * 43595b482a8SLen Brown * RETURN: None 43695b482a8SLen Brown * 43795b482a8SLen Brown * DESCRIPTION: Print IRQ routing table 43895b482a8SLen Brown * 43995b482a8SLen Brown ******************************************************************************/ 44095b482a8SLen Brown 44195b482a8SLen Brown void acpi_rs_dump_irq_list(u8 * route_table) 44295b482a8SLen Brown { 44395b482a8SLen Brown struct acpi_pci_routing_table *prt_element; 44495b482a8SLen Brown u8 count; 44595b482a8SLen Brown 44695b482a8SLen Brown ACPI_FUNCTION_ENTRY(); 44795b482a8SLen Brown 44810e9e759SBob Moore /* Check if debug output enabled */ 44910e9e759SBob Moore 45010e9e759SBob Moore if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) { 45195b482a8SLen Brown return; 45295b482a8SLen Brown } 45395b482a8SLen Brown 45495b482a8SLen Brown prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table); 45595b482a8SLen Brown 45695b482a8SLen Brown /* Dump all table elements, Exit on zero length element */ 45795b482a8SLen Brown 45895b482a8SLen Brown for (count = 0; prt_element->length; count++) { 45995b482a8SLen Brown acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n", 46095b482a8SLen Brown count); 46195b482a8SLen Brown acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt); 46295b482a8SLen Brown 46395b482a8SLen Brown prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table, 46495b482a8SLen Brown prt_element, prt_element->length); 46595b482a8SLen Brown } 46695b482a8SLen Brown } 46795b482a8SLen Brown 46895b482a8SLen Brown /******************************************************************************* 46995b482a8SLen Brown * 47095b482a8SLen Brown * FUNCTION: acpi_rs_out* 47195b482a8SLen Brown * 472ba494beeSBob Moore * PARAMETERS: title - Name of the resource field 473ba494beeSBob Moore * value - Value of the resource field 47495b482a8SLen Brown * 47595b482a8SLen Brown * RETURN: None 47695b482a8SLen Brown * 47795b482a8SLen Brown * DESCRIPTION: Miscellaneous helper functions to consistently format the 47895b482a8SLen Brown * output of the resource dump routines 47995b482a8SLen Brown * 48095b482a8SLen Brown ******************************************************************************/ 48195b482a8SLen Brown 48295b482a8SLen Brown static void acpi_rs_out_string(char *title, char *value) 48395b482a8SLen Brown { 48495b482a8SLen Brown acpi_os_printf("%27s : %s", title, value); 48595b482a8SLen Brown if (!*value) { 48695b482a8SLen Brown acpi_os_printf("[NULL NAMESTRING]"); 48795b482a8SLen Brown } 48895b482a8SLen Brown acpi_os_printf("\n"); 48995b482a8SLen Brown } 49095b482a8SLen Brown 49195b482a8SLen Brown static void acpi_rs_out_integer8(char *title, u8 value) 49295b482a8SLen Brown { 49395b482a8SLen Brown acpi_os_printf("%27s : %2.2X\n", title, value); 49495b482a8SLen Brown } 49595b482a8SLen Brown 49695b482a8SLen Brown static void acpi_rs_out_integer16(char *title, u16 value) 49795b482a8SLen Brown { 49895b482a8SLen Brown acpi_os_printf("%27s : %4.4X\n", title, value); 49995b482a8SLen Brown } 50095b482a8SLen Brown 50195b482a8SLen Brown static void acpi_rs_out_integer32(char *title, u32 value) 50295b482a8SLen Brown { 50395b482a8SLen Brown acpi_os_printf("%27s : %8.8X\n", title, value); 50495b482a8SLen Brown } 50595b482a8SLen Brown 50695b482a8SLen Brown static void acpi_rs_out_integer64(char *title, u64 value) 50795b482a8SLen Brown { 50895b482a8SLen Brown acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); 50995b482a8SLen Brown } 51095b482a8SLen Brown 51195b482a8SLen Brown static void acpi_rs_out_title(char *title) 51295b482a8SLen Brown { 51395b482a8SLen Brown acpi_os_printf("%27s : ", title); 51495b482a8SLen Brown } 51595b482a8SLen Brown 51695b482a8SLen Brown /******************************************************************************* 51795b482a8SLen Brown * 51895b482a8SLen Brown * FUNCTION: acpi_rs_dump*List 51995b482a8SLen Brown * 520ba494beeSBob Moore * PARAMETERS: length - Number of elements in the list 521ba494beeSBob Moore * data - Start of the list 52295b482a8SLen Brown * 52395b482a8SLen Brown * RETURN: None 52495b482a8SLen Brown * 52595b482a8SLen Brown * DESCRIPTION: Miscellaneous functions to dump lists of raw data 52695b482a8SLen Brown * 52795b482a8SLen Brown ******************************************************************************/ 52895b482a8SLen Brown 52995b482a8SLen Brown static void acpi_rs_dump_byte_list(u16 length, u8 * data) 53095b482a8SLen Brown { 53195b482a8SLen Brown u8 i; 53295b482a8SLen Brown 53395b482a8SLen Brown for (i = 0; i < length; i++) { 53495b482a8SLen Brown acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]); 53595b482a8SLen Brown } 53695b482a8SLen Brown } 53795b482a8SLen Brown 53895b482a8SLen Brown static void acpi_rs_dump_short_byte_list(u8 length, u8 * data) 53995b482a8SLen Brown { 54095b482a8SLen Brown u8 i; 54195b482a8SLen Brown 54295b482a8SLen Brown for (i = 0; i < length; i++) { 54395b482a8SLen Brown acpi_os_printf("%X ", data[i]); 54495b482a8SLen Brown } 54595b482a8SLen Brown acpi_os_printf("\n"); 54695b482a8SLen Brown } 54795b482a8SLen Brown 54895b482a8SLen Brown static void acpi_rs_dump_dword_list(u8 length, u32 * data) 54995b482a8SLen Brown { 55095b482a8SLen Brown u8 i; 55195b482a8SLen Brown 55295b482a8SLen Brown for (i = 0; i < length; i++) { 55395b482a8SLen Brown acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); 55495b482a8SLen Brown } 55595b482a8SLen Brown } 55695b482a8SLen Brown 557e0fe0a8dSLin Ming static void acpi_rs_dump_word_list(u16 length, u16 *data) 558e0fe0a8dSLin Ming { 559e0fe0a8dSLin Ming u16 i; 560e0fe0a8dSLin Ming 561e0fe0a8dSLin Ming for (i = 0; i < length; i++) { 562e0fe0a8dSLin Ming acpi_os_printf("%25s%2.2X : %4.4X\n", "Word", i, data[i]); 563e0fe0a8dSLin Ming } 564e0fe0a8dSLin Ming } 565e0fe0a8dSLin Ming 56695b482a8SLen Brown #endif 567