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