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 | b4e104e | 2011-01-17 11:05:40 +0800 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2011, 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 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [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 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 66 | static void acpi_rs_dump_dword_list(u8 length, u32 * data); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 67 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 68 | static void acpi_rs_dump_short_byte_list(u8 length, u8 * data); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 69 | |
| 70 | static void |
| 71 | acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source); |
| 72 | |
| 73 | static void acpi_rs_dump_address_common(union acpi_resource_data *resource); |
| 74 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 75 | static void |
| 76 | acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table); |
| 77 | |
| 78 | #define ACPI_RSD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_resource_data,f) |
| 79 | #define ACPI_PRT_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_pci_routing_table,f) |
| 80 | #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_rsdump_info)) |
| 81 | |
| 82 | /******************************************************************************* |
| 83 | * |
| 84 | * Resource Descriptor info tables |
| 85 | * |
| 86 | * Note: The first table entry must be a Title or Literal and must contain |
| 87 | * the table length (number of table entries) |
| 88 | * |
| 89 | ******************************************************************************/ |
| 90 | |
Bob Moore | 1d5b285 | 2008-04-10 19:06:43 +0400 | [diff] [blame] | 91 | struct acpi_rsdump_info acpi_rs_dump_irq[7] = { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 92 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_irq), "IRQ", NULL}, |
Bob Moore | 1d5b285 | 2008-04-10 19:06:43 +0400 | [diff] [blame] | 93 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.descriptor_length), |
| 94 | "Descriptor Length", NULL}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 95 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.triggering), "Triggering", |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 96 | acpi_gbl_he_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 97 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.polarity), "Polarity", |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 98 | acpi_gbl_ll_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 99 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(irq.sharable), "Sharing", |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 100 | acpi_gbl_shr_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 101 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(irq.interrupt_count), |
| 102 | "Interrupt Count", NULL}, |
| 103 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(irq.interrupts[0]), |
| 104 | "Interrupt List", NULL} |
| 105 | }; |
| 106 | |
| 107 | struct acpi_rsdump_info acpi_rs_dump_dma[6] = { |
| 108 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_dma), "DMA", NULL}, |
| 109 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.type), "Speed", |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 110 | acpi_gbl_typ_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 111 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(dma.bus_master), "Mastering", |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 112 | acpi_gbl_bm_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 113 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(dma.transfer), "Transfer Type", |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 114 | acpi_gbl_siz_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 115 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(dma.channel_count), "Channel Count", |
| 116 | NULL}, |
| 117 | {ACPI_RSD_SHORTLIST, ACPI_RSD_OFFSET(dma.channels[0]), "Channel List", |
| 118 | NULL} |
| 119 | }; |
| 120 | |
Bob Moore | 1d5b285 | 2008-04-10 19:06:43 +0400 | [diff] [blame] | 121 | struct acpi_rsdump_info acpi_rs_dump_start_dpf[4] = { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 122 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_start_dpf), |
| 123 | "Start-Dependent-Functions", NULL}, |
Bob Moore | 1d5b285 | 2008-04-10 19:06:43 +0400 | [diff] [blame] | 124 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(start_dpf.descriptor_length), |
| 125 | "Descriptor Length", NULL}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 126 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.compatibility_priority), |
| 127 | "Compatibility Priority", acpi_gbl_config_decode}, |
| 128 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(start_dpf.performance_robustness), |
| 129 | "Performance/Robustness", acpi_gbl_config_decode} |
| 130 | }; |
| 131 | |
| 132 | struct acpi_rsdump_info acpi_rs_dump_end_dpf[1] = { |
| 133 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_dpf), |
| 134 | "End-Dependent-Functions", NULL} |
| 135 | }; |
| 136 | |
| 137 | struct acpi_rsdump_info acpi_rs_dump_io[6] = { |
| 138 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io), "I/O", NULL}, |
| 139 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(io.io_decode), "Address Decoding", |
| 140 | acpi_gbl_io_decode}, |
| 141 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.minimum), "Address Minimum", NULL}, |
| 142 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(io.maximum), "Address Maximum", NULL}, |
| 143 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.alignment), "Alignment", NULL}, |
| 144 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(io.address_length), "Address Length", |
| 145 | NULL} |
| 146 | }; |
| 147 | |
| 148 | struct acpi_rsdump_info acpi_rs_dump_fixed_io[3] = { |
| 149 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_io), |
| 150 | "Fixed I/O", NULL}, |
| 151 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(fixed_io.address), "Address", NULL}, |
| 152 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(fixed_io.address_length), |
| 153 | "Address Length", NULL} |
| 154 | }; |
| 155 | |
| 156 | struct acpi_rsdump_info acpi_rs_dump_vendor[3] = { |
| 157 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_vendor), |
| 158 | "Vendor Specific", NULL}, |
| 159 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(vendor.byte_length), "Length", NULL}, |
| 160 | {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET(vendor.byte_data[0]), "Vendor Data", |
| 161 | NULL} |
| 162 | }; |
| 163 | |
| 164 | struct acpi_rsdump_info acpi_rs_dump_end_tag[1] = { |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 165 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_end_tag), "EndTag", |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 166 | NULL} |
| 167 | }; |
| 168 | |
| 169 | struct acpi_rsdump_info acpi_rs_dump_memory24[6] = { |
| 170 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory24), |
| 171 | "24-Bit Memory Range", NULL}, |
| 172 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory24.write_protect), |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 173 | "Write Protect", acpi_gbl_rw_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 174 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.minimum), "Address Minimum", |
| 175 | NULL}, |
| 176 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.maximum), "Address Maximum", |
| 177 | NULL}, |
| 178 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.alignment), "Alignment", |
| 179 | NULL}, |
| 180 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(memory24.address_length), |
| 181 | "Address Length", NULL} |
| 182 | }; |
| 183 | |
| 184 | struct acpi_rsdump_info acpi_rs_dump_memory32[6] = { |
| 185 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory32), |
| 186 | "32-Bit Memory Range", NULL}, |
| 187 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(memory32.write_protect), |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 188 | "Write Protect", acpi_gbl_rw_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 189 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.minimum), "Address Minimum", |
| 190 | NULL}, |
| 191 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.maximum), "Address Maximum", |
| 192 | NULL}, |
| 193 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.alignment), "Alignment", |
| 194 | NULL}, |
| 195 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(memory32.address_length), |
| 196 | "Address Length", NULL} |
| 197 | }; |
| 198 | |
| 199 | struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[4] = { |
| 200 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_fixed_memory32), |
| 201 | "32-Bit Fixed Memory Range", NULL}, |
| 202 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(fixed_memory32.write_protect), |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 203 | "Write Protect", acpi_gbl_rw_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 204 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address), "Address", |
| 205 | NULL}, |
| 206 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(fixed_memory32.address_length), |
| 207 | "Address Length", NULL} |
| 208 | }; |
| 209 | |
| 210 | struct acpi_rsdump_info acpi_rs_dump_address16[8] = { |
| 211 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address16), |
| 212 | "16-Bit WORD Address Space", NULL}, |
| 213 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, |
| 214 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.granularity), "Granularity", |
| 215 | NULL}, |
| 216 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.minimum), "Address Minimum", |
| 217 | NULL}, |
| 218 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.maximum), "Address Maximum", |
| 219 | NULL}, |
| 220 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.translation_offset), |
| 221 | "Translation Offset", NULL}, |
| 222 | {ACPI_RSD_UINT16, ACPI_RSD_OFFSET(address16.address_length), |
| 223 | "Address Length", NULL}, |
| 224 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address16.resource_source), NULL, NULL} |
| 225 | }; |
| 226 | |
| 227 | struct acpi_rsdump_info acpi_rs_dump_address32[8] = { |
| 228 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address32), |
| 229 | "32-Bit DWORD Address Space", NULL}, |
| 230 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, |
| 231 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.granularity), "Granularity", |
| 232 | NULL}, |
| 233 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.minimum), "Address Minimum", |
| 234 | NULL}, |
| 235 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.maximum), "Address Maximum", |
| 236 | NULL}, |
| 237 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.translation_offset), |
| 238 | "Translation Offset", NULL}, |
| 239 | {ACPI_RSD_UINT32, ACPI_RSD_OFFSET(address32.address_length), |
| 240 | "Address Length", NULL}, |
| 241 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address32.resource_source), NULL, NULL} |
| 242 | }; |
| 243 | |
| 244 | struct acpi_rsdump_info acpi_rs_dump_address64[8] = { |
| 245 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_address64), |
| 246 | "64-Bit QWORD Address Space", NULL}, |
| 247 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, |
| 248 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.granularity), "Granularity", |
| 249 | NULL}, |
| 250 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.minimum), "Address Minimum", |
| 251 | NULL}, |
| 252 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.maximum), "Address Maximum", |
| 253 | NULL}, |
| 254 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.translation_offset), |
| 255 | "Translation Offset", NULL}, |
| 256 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(address64.address_length), |
| 257 | "Address Length", NULL}, |
| 258 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(address64.resource_source), NULL, NULL} |
| 259 | }; |
| 260 | |
| 261 | struct acpi_rsdump_info acpi_rs_dump_ext_address64[8] = { |
| 262 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_address64), |
| 263 | "64-Bit Extended Address Space", NULL}, |
| 264 | {ACPI_RSD_ADDRESS, 0, NULL, NULL}, |
| 265 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.granularity), |
| 266 | "Granularity", NULL}, |
| 267 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.minimum), |
| 268 | "Address Minimum", NULL}, |
| 269 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.maximum), |
| 270 | "Address Maximum", NULL}, |
| 271 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.translation_offset), |
| 272 | "Translation Offset", NULL}, |
| 273 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.address_length), |
| 274 | "Address Length", NULL}, |
| 275 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(ext_address64.type_specific), |
| 276 | "Type-Specific Attribute", NULL} |
| 277 | }; |
| 278 | |
| 279 | struct acpi_rsdump_info acpi_rs_dump_ext_irq[8] = { |
| 280 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_ext_irq), |
| 281 | "Extended IRQ", NULL}, |
| 282 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.producer_consumer), |
| 283 | "Type", acpi_gbl_consume_decode}, |
| 284 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.triggering), |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 285 | "Triggering", acpi_gbl_he_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 286 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.polarity), "Polarity", |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 287 | acpi_gbl_ll_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 288 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(extended_irq.sharable), "Sharing", |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 289 | acpi_gbl_shr_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 290 | {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET(extended_irq.resource_source), NULL, |
| 291 | NULL}, |
| 292 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(extended_irq.interrupt_count), |
| 293 | "Interrupt Count", NULL}, |
| 294 | {ACPI_RSD_DWORDLIST, ACPI_RSD_OFFSET(extended_irq.interrupts[0]), |
| 295 | "Interrupt List", NULL} |
| 296 | }; |
| 297 | |
| 298 | struct acpi_rsdump_info acpi_rs_dump_generic_reg[6] = { |
| 299 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_generic_reg), |
| 300 | "Generic Register", NULL}, |
| 301 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.space_id), "Space ID", |
| 302 | NULL}, |
| 303 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_width), "Bit Width", |
| 304 | NULL}, |
| 305 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.bit_offset), "Bit Offset", |
| 306 | NULL}, |
| 307 | {ACPI_RSD_UINT8, ACPI_RSD_OFFSET(generic_reg.access_size), |
| 308 | "Access Size", NULL}, |
| 309 | {ACPI_RSD_UINT64, ACPI_RSD_OFFSET(generic_reg.address), "Address", NULL} |
| 310 | }; |
| 311 | |
| 312 | /* |
| 313 | * Tables used for common address descriptor flag fields |
| 314 | */ |
| 315 | static struct acpi_rsdump_info acpi_rs_dump_general_flags[5] = { |
| 316 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_general_flags), NULL, |
| 317 | NULL}, |
| 318 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.producer_consumer), |
| 319 | "Consumer/Producer", acpi_gbl_consume_decode}, |
| 320 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.decode), "Address Decode", |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 321 | acpi_gbl_dec_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 322 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.min_address_fixed), |
| 323 | "Min Relocatability", acpi_gbl_min_decode}, |
| 324 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.max_address_fixed), |
| 325 | "Max Relocatability", acpi_gbl_max_decode} |
| 326 | }; |
| 327 | |
| 328 | static struct acpi_rsdump_info acpi_rs_dump_memory_flags[5] = { |
| 329 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_memory_flags), |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 330 | "Resource Type", (void *)"Memory Range"}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 331 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.write_protect), |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 332 | "Write Protect", acpi_gbl_rw_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 333 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.caching), |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 334 | "Caching", acpi_gbl_mem_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 335 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.mem.range_type), |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 336 | "Range Type", acpi_gbl_mtp_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 337 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.mem.translation), |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 338 | "Translation", acpi_gbl_ttp_decode} |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 339 | }; |
| 340 | |
| 341 | static struct acpi_rsdump_info acpi_rs_dump_io_flags[4] = { |
| 342 | {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_io_flags), |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 343 | "Resource Type", (void *)"I/O Range"}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 344 | {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET(address.info.io.range_type), |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 345 | "Range Type", acpi_gbl_rng_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 346 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation), |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 347 | "Translation", acpi_gbl_ttp_decode}, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 348 | {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET(address.info.io.translation_type), |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 349 | "Translation Type", acpi_gbl_trs_decode} |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 350 | }; |
| 351 | |
| 352 | /* |
| 353 | * Table used to dump _PRT contents |
| 354 | */ |
| 355 | static struct acpi_rsdump_info acpi_rs_dump_prt[5] = { |
| 356 | {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE(acpi_rs_dump_prt), NULL, NULL}, |
| 357 | {ACPI_RSD_UINT64, ACPI_PRT_OFFSET(address), "Address", NULL}, |
| 358 | {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(pin), "Pin", NULL}, |
| 359 | {ACPI_RSD_STRING, ACPI_PRT_OFFSET(source[0]), "Source", NULL}, |
| 360 | {ACPI_RSD_UINT32, ACPI_PRT_OFFSET(source_index), "Source Index", NULL} |
| 361 | }; |
| 362 | |
| 363 | /******************************************************************************* |
| 364 | * |
| 365 | * FUNCTION: acpi_rs_dump_descriptor |
| 366 | * |
| 367 | * PARAMETERS: Resource |
| 368 | * |
| 369 | * RETURN: None |
| 370 | * |
| 371 | * DESCRIPTION: |
| 372 | * |
| 373 | ******************************************************************************/ |
| 374 | |
| 375 | static void |
| 376 | acpi_rs_dump_descriptor(void *resource, struct acpi_rsdump_info *table) |
| 377 | { |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 378 | u8 *target = NULL; |
| 379 | u8 *previous_target; |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 380 | char *name; |
| 381 | u8 count; |
| 382 | |
| 383 | /* First table entry must contain the table length (# of table entries) */ |
| 384 | |
| 385 | count = table->offset; |
| 386 | |
| 387 | while (count) { |
| 388 | previous_target = target; |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 389 | target = ACPI_ADD_PTR(u8, resource, table->offset); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 390 | name = table->name; |
| 391 | |
| 392 | switch (table->opcode) { |
| 393 | case ACPI_RSD_TITLE: |
| 394 | /* |
| 395 | * Optional resource title |
| 396 | */ |
| 397 | if (table->name) { |
| 398 | acpi_os_printf("%s Resource\n", name); |
| 399 | } |
| 400 | break; |
| 401 | |
| 402 | /* Strings */ |
| 403 | |
| 404 | case ACPI_RSD_LITERAL: |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 405 | acpi_rs_out_string(name, |
| 406 | ACPI_CAST_PTR(char, table->pointer)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 407 | break; |
| 408 | |
| 409 | case ACPI_RSD_STRING: |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 410 | acpi_rs_out_string(name, ACPI_CAST_PTR(char, target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 411 | break; |
| 412 | |
| 413 | /* Data items, 8/16/32/64 bit */ |
| 414 | |
| 415 | case ACPI_RSD_UINT8: |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 416 | acpi_rs_out_integer8(name, ACPI_GET8(target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 417 | break; |
| 418 | |
| 419 | case ACPI_RSD_UINT16: |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 420 | acpi_rs_out_integer16(name, ACPI_GET16(target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 421 | break; |
| 422 | |
| 423 | case ACPI_RSD_UINT32: |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 424 | acpi_rs_out_integer32(name, ACPI_GET32(target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 425 | break; |
| 426 | |
| 427 | case ACPI_RSD_UINT64: |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 428 | acpi_rs_out_integer64(name, ACPI_GET64(target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 429 | break; |
| 430 | |
| 431 | /* Flags: 1-bit and 2-bit flags supported */ |
| 432 | |
| 433 | case ACPI_RSD_1BITFLAG: |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 434 | acpi_rs_out_string(name, ACPI_CAST_PTR(char, |
| 435 | table-> |
| 436 | pointer[*target & |
| 437 | 0x01])); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 438 | break; |
| 439 | |
| 440 | case ACPI_RSD_2BITFLAG: |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 441 | acpi_rs_out_string(name, ACPI_CAST_PTR(char, |
| 442 | table-> |
| 443 | pointer[*target & |
| 444 | 0x03])); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 445 | break; |
| 446 | |
| 447 | case ACPI_RSD_SHORTLIST: |
| 448 | /* |
| 449 | * Short byte list (single line output) for DMA and IRQ resources |
| 450 | * Note: The list length is obtained from the previous table entry |
| 451 | */ |
| 452 | if (previous_target) { |
| 453 | acpi_rs_out_title(name); |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 454 | acpi_rs_dump_short_byte_list(*previous_target, |
| 455 | target); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 456 | } |
| 457 | break; |
| 458 | |
| 459 | case ACPI_RSD_LONGLIST: |
| 460 | /* |
| 461 | * Long byte list for Vendor resource data |
| 462 | * Note: The list length is obtained from the previous table entry |
| 463 | */ |
| 464 | if (previous_target) { |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 465 | acpi_rs_dump_byte_list(ACPI_GET16 |
| 466 | (previous_target), |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 467 | target); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 468 | } |
| 469 | break; |
| 470 | |
| 471 | case ACPI_RSD_DWORDLIST: |
| 472 | /* |
| 473 | * Dword list for Extended Interrupt resources |
| 474 | * Note: The list length is obtained from the previous table entry |
| 475 | */ |
| 476 | if (previous_target) { |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 477 | acpi_rs_dump_dword_list(*previous_target, |
| 478 | ACPI_CAST_PTR(u32, |
| 479 | target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 480 | } |
| 481 | break; |
| 482 | |
| 483 | case ACPI_RSD_ADDRESS: |
| 484 | /* |
| 485 | * Common flags for all Address resources |
| 486 | */ |
Bob Moore | 96db255 | 2005-11-02 00:00:00 -0500 | [diff] [blame] | 487 | acpi_rs_dump_address_common(ACPI_CAST_PTR |
| 488 | (union acpi_resource_data, |
| 489 | target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 490 | break; |
| 491 | |
| 492 | case ACPI_RSD_SOURCE: |
| 493 | /* |
| 494 | * Optional resource_source for Address resources |
| 495 | */ |
Len Brown | fd35094 | 2007-05-09 23:34:35 -0400 | [diff] [blame] | 496 | acpi_rs_dump_resource_source(ACPI_CAST_PTR(struct |
| 497 | acpi_resource_source, |
| 498 | target)); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 499 | break; |
| 500 | |
| 501 | default: |
| 502 | acpi_os_printf("**** Invalid table opcode [%X] ****\n", |
| 503 | table->opcode); |
| 504 | return; |
| 505 | } |
| 506 | |
| 507 | table++; |
| 508 | count--; |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | /******************************************************************************* |
| 513 | * |
| 514 | * FUNCTION: acpi_rs_dump_resource_source |
| 515 | * |
| 516 | * PARAMETERS: resource_source - Pointer to a Resource Source struct |
| 517 | * |
| 518 | * RETURN: None |
| 519 | * |
| 520 | * DESCRIPTION: Common routine for dumping the optional resource_source and the |
| 521 | * corresponding resource_source_index. |
| 522 | * |
| 523 | ******************************************************************************/ |
| 524 | |
| 525 | static void |
| 526 | acpi_rs_dump_resource_source(struct acpi_resource_source *resource_source) |
| 527 | { |
| 528 | ACPI_FUNCTION_ENTRY(); |
| 529 | |
| 530 | if (resource_source->index == 0xFF) { |
| 531 | return; |
| 532 | } |
| 533 | |
| 534 | acpi_rs_out_integer8("Resource Source Index", resource_source->index); |
| 535 | |
| 536 | acpi_rs_out_string("Resource Source", |
| 537 | resource_source->string_ptr ? |
| 538 | resource_source->string_ptr : "[Not Specified]"); |
| 539 | } |
| 540 | |
| 541 | /******************************************************************************* |
| 542 | * |
| 543 | * FUNCTION: acpi_rs_dump_address_common |
| 544 | * |
| 545 | * PARAMETERS: Resource - Pointer to an internal resource descriptor |
| 546 | * |
| 547 | * RETURN: None |
| 548 | * |
| 549 | * DESCRIPTION: Dump the fields that are common to all Address resource |
| 550 | * descriptors |
| 551 | * |
| 552 | ******************************************************************************/ |
| 553 | |
| 554 | static void acpi_rs_dump_address_common(union acpi_resource_data *resource) |
| 555 | { |
| 556 | ACPI_FUNCTION_ENTRY(); |
| 557 | |
| 558 | /* Decode the type-specific flags */ |
| 559 | |
| 560 | switch (resource->address.resource_type) { |
| 561 | case ACPI_MEMORY_RANGE: |
| 562 | |
| 563 | acpi_rs_dump_descriptor(resource, acpi_rs_dump_memory_flags); |
| 564 | break; |
| 565 | |
| 566 | case ACPI_IO_RANGE: |
| 567 | |
| 568 | acpi_rs_dump_descriptor(resource, acpi_rs_dump_io_flags); |
| 569 | break; |
| 570 | |
| 571 | case ACPI_BUS_NUMBER_RANGE: |
| 572 | |
| 573 | acpi_rs_out_string("Resource Type", "Bus Number Range"); |
| 574 | break; |
| 575 | |
| 576 | default: |
| 577 | |
| 578 | acpi_rs_out_integer8("Resource Type", |
| 579 | (u8) resource->address.resource_type); |
| 580 | break; |
| 581 | } |
| 582 | |
| 583 | /* Decode the general flags */ |
| 584 | |
| 585 | acpi_rs_dump_descriptor(resource, acpi_rs_dump_general_flags); |
| 586 | } |
| 587 | |
| 588 | /******************************************************************************* |
| 589 | * |
| 590 | * FUNCTION: acpi_rs_dump_resource_list |
| 591 | * |
| 592 | * PARAMETERS: resource_list - Pointer to a resource descriptor list |
| 593 | * |
| 594 | * RETURN: None |
| 595 | * |
| 596 | * DESCRIPTION: Dispatches the structure to the correct dump routine. |
| 597 | * |
| 598 | ******************************************************************************/ |
| 599 | |
| 600 | void acpi_rs_dump_resource_list(struct acpi_resource *resource_list) |
| 601 | { |
| 602 | u32 count = 0; |
| 603 | u32 type; |
| 604 | |
| 605 | ACPI_FUNCTION_ENTRY(); |
| 606 | |
| 607 | if (!(acpi_dbg_level & ACPI_LV_RESOURCES) |
| 608 | || !(_COMPONENT & acpi_dbg_layer)) { |
| 609 | return; |
| 610 | } |
| 611 | |
| 612 | /* Walk list and dump all resource descriptors (END_TAG terminates) */ |
| 613 | |
| 614 | do { |
| 615 | acpi_os_printf("\n[%02X] ", count); |
| 616 | count++; |
| 617 | |
| 618 | /* Validate Type before dispatch */ |
| 619 | |
| 620 | type = resource_list->type; |
| 621 | if (type > ACPI_RESOURCE_TYPE_MAX) { |
| 622 | acpi_os_printf |
| 623 | ("Invalid descriptor type (%X) in resource list\n", |
| 624 | resource_list->type); |
| 625 | return; |
| 626 | } |
| 627 | |
| 628 | /* Dump the resource descriptor */ |
| 629 | |
| 630 | acpi_rs_dump_descriptor(&resource_list->data, |
| 631 | acpi_gbl_dump_resource_dispatch[type]); |
| 632 | |
| 633 | /* Point to the next resource structure */ |
| 634 | |
| 635 | resource_list = |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 636 | ACPI_ADD_PTR(struct acpi_resource, resource_list, |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 637 | resource_list->length); |
| 638 | |
| 639 | /* Exit when END_TAG descriptor is reached */ |
| 640 | |
| 641 | } while (type != ACPI_RESOURCE_TYPE_END_TAG); |
| 642 | } |
| 643 | |
| 644 | /******************************************************************************* |
| 645 | * |
| 646 | * FUNCTION: acpi_rs_dump_irq_list |
| 647 | * |
| 648 | * PARAMETERS: route_table - Pointer to the routing table to dump. |
| 649 | * |
| 650 | * RETURN: None |
| 651 | * |
| 652 | * DESCRIPTION: Print IRQ routing table |
| 653 | * |
| 654 | ******************************************************************************/ |
| 655 | |
| 656 | void acpi_rs_dump_irq_list(u8 * route_table) |
| 657 | { |
| 658 | struct acpi_pci_routing_table *prt_element; |
| 659 | u8 count; |
| 660 | |
| 661 | ACPI_FUNCTION_ENTRY(); |
| 662 | |
| 663 | if (!(acpi_dbg_level & ACPI_LV_RESOURCES) |
| 664 | || !(_COMPONENT & acpi_dbg_layer)) { |
| 665 | return; |
| 666 | } |
| 667 | |
| 668 | prt_element = ACPI_CAST_PTR(struct acpi_pci_routing_table, route_table); |
| 669 | |
| 670 | /* Dump all table elements, Exit on zero length element */ |
| 671 | |
| 672 | for (count = 0; prt_element->length; count++) { |
| 673 | acpi_os_printf("\n[%02X] PCI IRQ Routing Table Package\n", |
| 674 | count); |
| 675 | acpi_rs_dump_descriptor(prt_element, acpi_rs_dump_prt); |
| 676 | |
Bob Moore | c51a4de | 2005-11-17 13:07:00 -0500 | [diff] [blame] | 677 | prt_element = ACPI_ADD_PTR(struct acpi_pci_routing_table, |
| 678 | prt_element, prt_element->length); |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 679 | } |
| 680 | } |
| 681 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 682 | /******************************************************************************* |
| 683 | * |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 684 | * FUNCTION: acpi_rs_out* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 685 | * |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 686 | * PARAMETERS: Title - Name of the resource field |
| 687 | * Value - Value of the resource field |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 688 | * |
| 689 | * RETURN: None |
| 690 | * |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 691 | * DESCRIPTION: Miscellaneous helper functions to consistently format the |
| 692 | * output of the resource dump routines |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 693 | * |
| 694 | ******************************************************************************/ |
| 695 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 696 | static void acpi_rs_out_string(char *title, char *value) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 697 | { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 698 | acpi_os_printf("%27s : %s", title, value); |
| 699 | if (!*value) { |
| 700 | acpi_os_printf("[NULL NAMESTRING]"); |
| 701 | } |
| 702 | acpi_os_printf("\n"); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 703 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 704 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 705 | static void acpi_rs_out_integer8(char *title, u8 value) |
| 706 | { |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 707 | acpi_os_printf("%27s : %2.2X\n", title, value); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 708 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 709 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 710 | static void acpi_rs_out_integer16(char *title, u16 value) |
| 711 | { |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 712 | acpi_os_printf("%27s : %4.4X\n", title, value); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 713 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 714 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 715 | static void acpi_rs_out_integer32(char *title, u32 value) |
| 716 | { |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 717 | acpi_os_printf("%27s : %8.8X\n", title, value); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 718 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 719 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 720 | static void acpi_rs_out_integer64(char *title, u64 value) |
| 721 | { |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 722 | 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] | 723 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 724 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 725 | static void acpi_rs_out_title(char *title) |
| 726 | { |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 727 | acpi_os_printf("%27s : ", title); |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 728 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 729 | |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 730 | /******************************************************************************* |
| 731 | * |
| 732 | * FUNCTION: acpi_rs_dump*List |
| 733 | * |
| 734 | * PARAMETERS: Length - Number of elements in the list |
| 735 | * Data - Start of the list |
| 736 | * |
| 737 | * RETURN: None |
| 738 | * |
| 739 | * DESCRIPTION: Miscellaneous functions to dump lists of raw data |
| 740 | * |
| 741 | ******************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 742 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 743 | static void acpi_rs_dump_byte_list(u16 length, u8 * data) |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 744 | { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 745 | u8 i; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 746 | |
| 747 | for (i = 0; i < length; i++) { |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 748 | 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] | 749 | } |
| 750 | } |
| 751 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 752 | static void acpi_rs_dump_short_byte_list(u8 length, u8 * data) |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 753 | { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 754 | u8 i; |
Robert Moore | bda663d | 2005-09-16 16:51:15 -0400 | [diff] [blame] | 755 | |
| 756 | for (i = 0; i < length; i++) { |
| 757 | acpi_os_printf("%X ", data[i]); |
| 758 | } |
| 759 | acpi_os_printf("\n"); |
| 760 | } |
| 761 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 762 | static void acpi_rs_dump_dword_list(u8 length, u32 * data) |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 763 | { |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 764 | u8 i; |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame] | 765 | |
Bob Moore | 0897831 | 2005-10-21 00:00:00 -0400 | [diff] [blame] | 766 | for (i = 0; i < length; i++) { |
| 767 | 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] | 768 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 769 | } |
| 770 | |
| 771 | #endif |