Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * |
Bob Moore | 39239fe | 2015-04-13 11:50:08 +0800 | [diff] [blame] | 3 | * Module Name: rsdump - AML debugger support for resource structures. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
| 5 | ******************************************************************************/ |
| 6 | |
| 7 | /* |
Bob Moore | c8100dc | 2016-01-15 08:17:03 +0800 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2016, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 45 | #include "accommon.h" |
| 46 | #include "acresrc.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | |
| 48 | #define _COMPONENT ACPI_RESOURCES |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 49 | ACPI_MODULE_NAME("rsdump") |
Lv Zheng | 3334861 | 2014-02-08 09:42:46 +0800 | [diff] [blame] | 50 | |
Bob Moore | 39239fe | 2015-04-13 11:50:08 +0800 | [diff] [blame] | 51 | /* |
| 52 | * All functions in this module are used by the AML Debugger only |
| 53 | */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 54 | /* Local prototypes */ |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 55 | static void acpi_rs_out_string(char *title, char *value); |
| 56 | |
| 57 | static void acpi_rs_out_integer8(char *title, u8 value); |
| 58 | |
| 59 | static void acpi_rs_out_integer16(char *title, u16 value); |
| 60 | |
| 61 | static void acpi_rs_out_integer32(char *title, u32 value); |
| 62 | |
| 63 | static void acpi_rs_out_integer64(char *title, u64 value); |
| 64 | |
| 65 | static void acpi_rs_out_title(char *title); |
| 66 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 67 | static void acpi_rs_dump_byte_list(u16 length, u8 *data); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 68 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 69 | static void acpi_rs_dump_word_list(u16 length, u16 *data); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 70 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 71 | static void acpi_rs_dump_dword_list(u8 length, u32 *data); |
| 72 | |
| 73 | static void acpi_rs_dump_short_byte_list(u8 length, u8 *data); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 74 | |
| 75 | static void |
| 76 | acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); |
| 77 | |
| 78 | static void acpi_rs_dump_address_common(union acpi_resource_data *resource); |
| 79 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 80 | static void |
| 81 | acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); |
| 82 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 83 | /******************************************************************************* |
| 84 | * |
Bob Moore | 39239fe | 2015-04-13 11:50:08 +0800 | [diff] [blame] | 85 | * FUNCTION: acpi_rs_dump_resource_list |
| 86 | * |
| 87 | * PARAMETERS: resource_list - Pointer to a resource descriptor list |
| 88 | * |
| 89 | * RETURN: None |
| 90 | * |
| 91 | * DESCRIPTION: Dispatches the structure to the correct dump routine. |
| 92 | * |
| 93 | ******************************************************************************/ |
| 94 | |
| 95 | void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) |
| 96 | { |
| 97 | u32 count = 0; |
| 98 | u32 type; |
| 99 | |
| 100 | ACPI_FUNCTION_ENTRY(); |
| 101 | |
| 102 | /* Check if debug output enabled */ |
| 103 | |
| 104 | if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) { |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | /* Walk list and dump all resource descriptors (END_TAG terminates) */ |
| 109 | |
| 110 | do { |
| 111 | acpi_os_printf("\n[%02X] ", count); |
| 112 | count++; |
| 113 | |
| 114 | /* Validate Type before dispatch */ |
| 115 | |
| 116 | type = resource_list->type; |
| 117 | if (type > ACPI_RESOURCE_TYPE_MAX) { |
| 118 | acpi_os_printf |
| 119 | ("Invalid descriptor type (%X) in resource list\n", |
| 120 | resource_list->type); |
| 121 | return; |
| 122 | } |
| 123 | |
| 124 | /* Sanity check the length. It must not be zero, or we loop forever */ |
| 125 | |
| 126 | if (!resource_list->length) { |
| 127 | acpi_os_printf |
| 128 | ("Invalid zero length descriptor in resource list\n"); |
| 129 | return; |
| 130 | } |
| 131 | |
| 132 | /* Dump the resource descriptor */ |
| 133 | |
| 134 | if (type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { |
| 135 | acpi_rs_dump_descriptor(&resource_list->data, |
| 136 | acpi_gbl_dump_serial_bus_dispatch |
| 137 | [resource_list->data. |
| 138 | common_serial_bus.type]); |
| 139 | } else { |
| 140 | acpi_rs_dump_descriptor(&resource_list->data, |
| 141 | acpi_gbl_dump_resource_dispatch |
| 142 | [type]); |
| 143 | } |
| 144 | |
| 145 | /* Point to the next resource structure */ |
| 146 | |
| 147 | resource_list = ACPI_NEXT_RESOURCE(resource_list); |
| 148 | |
| 149 | /* Exit when END_TAG descriptor is reached */ |
| 150 | |
| 151 | } while (type != ACPI_RESOURCE_TYPE_END_TAG); |
| 152 | } |
| 153 | |
| 154 | /******************************************************************************* |
| 155 | * |
| 156 | * FUNCTION: acpi_rs_dump_irq_list |
| 157 | * |
| 158 | * PARAMETERS: route_table - Pointer to the routing table to dump. |
| 159 | * |
| 160 | * RETURN: None |
| 161 | * |
| 162 | * DESCRIPTION: Print IRQ routing table |
| 163 | * |
| 164 | ******************************************************************************/ |
| 165 | |
| 166 | void acpi_rs_dump_irq_list(u8 *route_table) |
| 167 | { |
| 168 | struct acpi_pci_routing_table *prt_element; |
| 169 | u8 count; |
| 170 | |
| 171 | ACPI_FUNCTION_ENTRY(); |
| 172 | |
| 173 | /* Check if debug output enabled */ |
| 174 | |
| 175 | if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_RESOURCES, _COMPONENT)) { |
| 176 | return; |
| 177 | } |
| 178 | |
| 179 | prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table); |
| 180 | |
| 181 | /* Dump all table elements, Exit on zero length element */ |
| 182 | |
| 183 | for (count = 0; prt_element->length; count++) { |
| 184 | acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n", |
| 185 | count); |
| 186 | acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt); |
| 187 | |
| 188 | prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table, |
| 189 | prt_element, prt_element->length); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /******************************************************************************* |
| 194 | * |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 195 | * FUNCTION: acpi_rs_dump_descriptor |
| 196 | * |
Bob Moore | 42f8fb7 | 2013-01-11 13:08:51 +0100 | [diff] [blame] | 197 | * PARAMETERS: resource - Buffer containing the resource |
| 198 | * table - Table entry to decode the resource |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 199 | * |
| 200 | * RETURN: None |
| 201 | * |
Bob Moore | 42f8fb7 | 2013-01-11 13:08:51 +0100 | [diff] [blame] | 202 | * DESCRIPTION: Dump a resource descriptor based on a dump table entry. |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 203 | * |
| 204 | ******************************************************************************/ |
| 205 | |
| 206 | static void |
| 207 | acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) |
| 208 | { |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 209 | u8 *target = NULL; |
| 210 | u8 *previous_target; |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 211 | char *name; |
| 212 | u8 count; |
| 213 | |
| 214 | /* First table entry must contain the table length (# of table entries) */ |
| 215 | |
| 216 | count = table->offset; |
| 217 | |
| 218 | while (count) { |
| 219 | previous_target = target; |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 220 | target = ACPI_ADD_PTR(u8, resource, table->offset); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 221 | name = table->name; |
| 222 | |
| 223 | switch (table->opcode) { |
| 224 | case ACPI_RSD_TITLE: |
| 225 | /* |
| 226 | * Optional resource title |
| 227 | */ |
| 228 | if (table->name) { |
| 229 | acpi_os_printf("%s Resource\n", name); |
| 230 | } |
| 231 | break; |
| 232 | |
| 233 | /* Strings */ |
| 234 | |
| 235 | case ACPI_RSD_LITERAL: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame] | 236 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 237 | acpi_rs_out_string(name, |
| 238 | ACPI_CAST_PTR(char, table->pointer)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 239 | break; |
| 240 | |
| 241 | case ACPI_RSD_STRING: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame] | 242 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 243 | acpi_rs_out_string(name, ACPI_CAST_PTR(char, target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 244 | break; |
| 245 | |
| 246 | /* Data items, 8/16/32/64 bit */ |
| 247 | |
| 248 | case ACPI_RSD_UINT8: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame] | 249 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 250 | if (table->pointer) { |
| 251 | acpi_rs_out_string(name, ACPI_CAST_PTR(char, |
| 252 | table-> |
| 253 | pointer |
| 254 | [*target])); |
| 255 | } else { |
| 256 | acpi_rs_out_integer8(name, ACPI_GET8(target)); |
| 257 | } |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 258 | break; |
| 259 | |
| 260 | case ACPI_RSD_UINT16: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame] | 261 | |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 262 | acpi_rs_out_integer16(name, ACPI_GET16(target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 263 | break; |
| 264 | |
| 265 | case ACPI_RSD_UINT32: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame] | 266 | |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 267 | acpi_rs_out_integer32(name, ACPI_GET32(target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 268 | break; |
| 269 | |
| 270 | case ACPI_RSD_UINT64: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame] | 271 | |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 272 | acpi_rs_out_integer64(name, ACPI_GET64(target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 273 | break; |
| 274 | |
| 275 | /* Flags: 1-bit and 2-bit flags supported */ |
| 276 | |
| 277 | case ACPI_RSD_1BITFLAG: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame] | 278 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 279 | acpi_rs_out_string(name, ACPI_CAST_PTR(char, |
| 280 | table-> |
| 281 | pointer[*target & |
| 282 | 0x01])); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 283 | break; |
| 284 | |
| 285 | case ACPI_RSD_2BITFLAG: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame] | 286 | |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 287 | acpi_rs_out_string(name, ACPI_CAST_PTR(char, |
| 288 | table-> |
| 289 | pointer[*target & |
| 290 | 0x03])); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 291 | break; |
| 292 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 293 | case ACPI_RSD_3BITFLAG: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame] | 294 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 295 | acpi_rs_out_string(name, ACPI_CAST_PTR(char, |
| 296 | table-> |
| 297 | pointer[*target & |
| 298 | 0x07])); |
| 299 | break; |
| 300 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 301 | case ACPI_RSD_SHORTLIST: |
| 302 | /* |
| 303 | * Short byte list (single line output) for DMA and IRQ resources |
| 304 | * Note: The list length is obtained from the previous table entry |
| 305 | */ |
| 306 | if (previous_target) { |
| 307 | acpi_rs_out_title(name); |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 308 | acpi_rs_dump_short_byte_list(*previous_target, |
| 309 | target); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 310 | } |
| 311 | break; |
| 312 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 313 | case ACPI_RSD_SHORTLISTX: |
| 314 | /* |
| 315 | * Short byte list (single line output) for GPIO vendor data |
| 316 | * Note: The list length is obtained from the previous table entry |
| 317 | */ |
| 318 | if (previous_target) { |
| 319 | acpi_rs_out_title(name); |
| 320 | acpi_rs_dump_short_byte_list(*previous_target, |
| 321 | * |
| 322 | (ACPI_CAST_INDIRECT_PTR |
| 323 | (u8, target))); |
| 324 | } |
| 325 | break; |
| 326 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 327 | case ACPI_RSD_LONGLIST: |
| 328 | /* |
| 329 | * Long byte list for Vendor resource data |
| 330 | * Note: The list length is obtained from the previous table entry |
| 331 | */ |
| 332 | if (previous_target) { |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 333 | acpi_rs_dump_byte_list(ACPI_GET16 |
| 334 | (previous_target), |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 335 | target); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 336 | } |
| 337 | break; |
| 338 | |
| 339 | case ACPI_RSD_DWORDLIST: |
| 340 | /* |
| 341 | * Dword list for Extended Interrupt resources |
| 342 | * Note: The list length is obtained from the previous table entry |
| 343 | */ |
| 344 | if (previous_target) { |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 345 | acpi_rs_dump_dword_list(*previous_target, |
| 346 | ACPI_CAST_PTR(u32, |
| 347 | target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 348 | } |
| 349 | break; |
| 350 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 351 | case ACPI_RSD_WORDLIST: |
| 352 | /* |
| 353 | * Word list for GPIO Pin Table |
| 354 | * Note: The list length is obtained from the previous table entry |
| 355 | */ |
| 356 | if (previous_target) { |
| 357 | acpi_rs_dump_word_list(*previous_target, |
| 358 | *(ACPI_CAST_INDIRECT_PTR |
| 359 | (u16, target))); |
| 360 | } |
| 361 | break; |
| 362 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 363 | case ACPI_RSD_ADDRESS: |
| 364 | /* |
| 365 | * Common flags for all Address resources |
| 366 | */ |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 367 | acpi_rs_dump_address_common(ACPI_CAST_PTR |
| 368 | (union acpi_resource_data, |
| 369 | target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 370 | break; |
| 371 | |
| 372 | case ACPI_RSD_SOURCE: |
| 373 | /* |
| 374 | * Optional resource_source for Address resources |
| 375 | */ |
Lv Zheng | 3e8214e | 2012-12-19 05:37:15 +0000 | [diff] [blame] | 376 | acpi_rs_dump_resource_source(ACPI_CAST_PTR |
| 377 | (struct |
Len Brown | fd35094 | 2007-05-09 23:34:35 -0400 | [diff] [blame] | 378 | acpi_resource_source, |
| 379 | target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 380 | break; |
| 381 | |
| 382 | default: |
Chao Guan | 1d1ea1b | 2013-06-08 00:58:14 +0000 | [diff] [blame] | 383 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 384 | acpi_os_printf("**** Invalid table opcode [%X] ****\n", |
| 385 | table->opcode); |
| 386 | return; |
| 387 | } |
| 388 | |
| 389 | table++; |
| 390 | count--; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | /******************************************************************************* |
| 395 | * |
| 396 | * FUNCTION: acpi_rs_dump_resource_source |
| 397 | * |
| 398 | * PARAMETERS: resource_source - Pointer to a Resource Source struct |
| 399 | * |
| 400 | * RETURN: None |
| 401 | * |
| 402 | * DESCRIPTION: Common routine for dumping the optional resource_source and the |
| 403 | * corresponding resource_source_index. |
| 404 | * |
| 405 | ******************************************************************************/ |
| 406 | |
| 407 | static void |
| 408 | acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) |
| 409 | { |
| 410 | ACPI_FUNCTION_ENTRY(); |
| 411 | |
| 412 | if (resource_source->index == 0xFF) { |
| 413 | return; |
| 414 | } |
| 415 | |
| 416 | acpi_rs_out_integer8("Resource Source Index", resource_source->index); |
| 417 | |
| 418 | acpi_rs_out_string("Resource Source", |
| 419 | resource_source->string_ptr ? |
| 420 | resource_source->string_ptr : "[Not Specified]"); |
| 421 | } |
| 422 | |
| 423 | /******************************************************************************* |
| 424 | * |
| 425 | * FUNCTION: acpi_rs_dump_address_common |
| 426 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 427 | * PARAMETERS: resource - Pointer to an internal resource descriptor |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 428 | * |
| 429 | * RETURN: None |
| 430 | * |
| 431 | * DESCRIPTION: Dump the fields that are common to all Address resource |
| 432 | * descriptors |
| 433 | * |
| 434 | ******************************************************************************/ |
| 435 | |
| 436 | static void acpi_rs_dump_address_common(union acpi_resource_data *resource) |
| 437 | { |
| 438 | ACPI_FUNCTION_ENTRY(); |
| 439 | |
| 440 | /* Decode the type-specific flags */ |
| 441 | |
| 442 | switch (resource->address.resource_type) { |
| 443 | case ACPI_MEMORY_RANGE: |
| 444 | |
| 445 | acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags); |
| 446 | break; |
| 447 | |
| 448 | case ACPI_IO_RANGE: |
| 449 | |
| 450 | acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags); |
| 451 | break; |
| 452 | |
| 453 | case ACPI_BUS_NUMBER_RANGE: |
| 454 | |
| 455 | acpi_rs_out_string("Resource Type", "Bus Number Range"); |
| 456 | break; |
| 457 | |
| 458 | default: |
| 459 | |
| 460 | acpi_rs_out_integer8("Resource Type", |
| 461 | (u8) resource->address.resource_type); |
| 462 | break; |
| 463 | } |
| 464 | |
| 465 | /* Decode the general flags */ |
| 466 | |
| 467 | acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags); |
| 468 | } |
| 469 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 470 | /******************************************************************************* |
| 471 | * |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 472 | * FUNCTION: acpi_rs_out* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 473 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 474 | * PARAMETERS: title - Name of the resource field |
| 475 | * value - Value of the resource field |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 476 | * |
| 477 | * RETURN: None |
| 478 | * |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 479 | * DESCRIPTION: Miscellaneous helper functions to consistently format the |
| 480 | * output of the resource dump routines |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | * |
| 482 | ******************************************************************************/ |
| 483 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 484 | static void acpi_rs_out_string(char *title, char *value) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | { |
Bob Moore | 1fad873 | 2015-12-29 13:54:36 +0800 | [diff] [blame] | 486 | |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 487 | acpi_os_printf("%27s : %s", title, value); |
| 488 | if (!*value) { |
| 489 | acpi_os_printf("[NULL NAMESTRING]"); |
| 490 | } |
| 491 | acpi_os_printf("\n"); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 492 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 493 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 494 | static void acpi_rs_out_integer8(char *title, u8 value) |
| 495 | { |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 496 | acpi_os_printf("%27s : %2.2X\n", title, value); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 497 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 499 | static void acpi_rs_out_integer16(char *title, u16 value) |
| 500 | { |
Bob Moore | 1fad873 | 2015-12-29 13:54:36 +0800 | [diff] [blame] | 501 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 502 | acpi_os_printf("%27s : %4.4X\n", title, value); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 503 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 504 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 505 | static void acpi_rs_out_integer32(char *title, u32 value) |
| 506 | { |
Bob Moore | 1fad873 | 2015-12-29 13:54:36 +0800 | [diff] [blame] | 507 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 508 | acpi_os_printf("%27s : %8.8X\n", title, value); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 509 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 510 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 511 | static void acpi_rs_out_integer64(char *title, u64 value) |
| 512 | { |
Bob Moore | 1fad873 | 2015-12-29 13:54:36 +0800 | [diff] [blame] | 513 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 514 | acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 515 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 516 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 517 | static void acpi_rs_out_title(char *title) |
| 518 | { |
Bob Moore | 1fad873 | 2015-12-29 13:54:36 +0800 | [diff] [blame] | 519 | |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 520 | acpi_os_printf("%27s : ", title); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 521 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 523 | /******************************************************************************* |
| 524 | * |
| 525 | * FUNCTION: acpi_rs_dump*List |
| 526 | * |
Bob Moore | ba494be | 2012-07-12 09:40:10 +0800 | [diff] [blame] | 527 | * PARAMETERS: length - Number of elements in the list |
| 528 | * data - Start of the list |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 529 | * |
| 530 | * RETURN: None |
| 531 | * |
| 532 | * DESCRIPTION: Miscellaneous functions to dump lists of raw data |
| 533 | * |
| 534 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 536 | static void acpi_rs_dump_byte_list(u16 length, u8 * data) |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 537 | { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 538 | u8 i; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 539 | |
| 540 | for (i = 0; i < length; i++) { |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 541 | acpi_os_printf("%25s%2.2X : %2.2X\n", "Byte", i, data[i]); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 542 | } |
| 543 | } |
| 544 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 545 | static void acpi_rs_dump_short_byte_list(u8 length, u8 * data) |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 546 | { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 547 | u8 i; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 548 | |
| 549 | for (i = 0; i < length; i++) { |
| 550 | acpi_os_printf("%X ", data[i]); |
| 551 | } |
Bob Moore | 1fad873 | 2015-12-29 13:54:36 +0800 | [diff] [blame] | 552 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 553 | acpi_os_printf("\n"); |
| 554 | } |
| 555 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 556 | static void acpi_rs_dump_dword_list(u8 length, u32 * data) |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 557 | { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 558 | u8 i; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 559 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 560 | for (i = 0; i < length; i++) { |
| 561 | acpi_os_printf("%25s%2.2X : %8.8X\n", "Dword", i, data[i]); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 562 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 563 | } |
| 564 | |
Lin Ming | e0fe0a8 | 2011-11-16 14:38:13 +0800 | [diff] [blame] | 565 | static void acpi_rs_dump_word_list(u16 length, u16 *data) |
| 566 | { |
| 567 | u16 i; |
| 568 | |
| 569 | for (i = 0; i < length; i++) { |
| 570 | acpi_os_printf("%25s%2.2X : %4.4X\n", "Word", i, data[i]); |
| 571 | } |
| 572 | } |