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