1 /******************************************************************************* 2 * 3 * Module Name: rsdump - Functions to display the resource structures. 4 * 5 ******************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2012, Intel Corp. 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 44 45 #define __RSDUMP_C__ 46 47 #include <contrib/dev/acpica/include/acpi.h> 48 #include <contrib/dev/acpica/include/accommon.h> 49 #include <contrib/dev/acpica/include/acresrc.h> 50 51 #define _COMPONENT ACPI_RESOURCES 52 ACPI_MODULE_NAME ("rsdump") 53 54 55 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 56 57 /* Local prototypes */ 58 59 static void 60 AcpiRsOutString ( 61 char *Title, 62 char *Value); 63 64 static void 65 AcpiRsOutInteger8 ( 66 char *Title, 67 UINT8 Value); 68 69 static void 70 AcpiRsOutInteger16 ( 71 char *Title, 72 UINT16 Value); 73 74 static void 75 AcpiRsOutInteger32 ( 76 char *Title, 77 UINT32 Value); 78 79 static void 80 AcpiRsOutInteger64 ( 81 char *Title, 82 UINT64 Value); 83 84 static void 85 AcpiRsOutTitle ( 86 char *Title); 87 88 static void 89 AcpiRsDumpByteList ( 90 UINT16 Length, 91 UINT8 *Data); 92 93 static void 94 AcpiRsDumpWordList ( 95 UINT16 Length, 96 UINT16 *Data); 97 98 static void 99 AcpiRsDumpDwordList ( 100 UINT8 Length, 101 UINT32 *Data); 102 103 static void 104 AcpiRsDumpShortByteList ( 105 UINT8 Length, 106 UINT8 *Data); 107 108 static void 109 AcpiRsDumpResourceSource ( 110 ACPI_RESOURCE_SOURCE *ResourceSource); 111 112 static void 113 AcpiRsDumpAddressCommon ( 114 ACPI_RESOURCE_DATA *Resource); 115 116 static void 117 AcpiRsDumpDescriptor ( 118 void *Resource, 119 ACPI_RSDUMP_INFO *Table); 120 121 122 #define ACPI_RSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_RESOURCE_DATA,f) 123 #define ACPI_PRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PCI_ROUTING_TABLE,f) 124 #define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (ACPI_RSDUMP_INFO)) 125 126 127 /******************************************************************************* 128 * 129 * Resource Descriptor info tables 130 * 131 * Note: The first table entry must be a Title or Literal and must contain 132 * the table length (number of table entries) 133 * 134 ******************************************************************************/ 135 136 ACPI_RSDUMP_INFO AcpiRsDumpIrq[7] = 137 { 138 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq), "IRQ", NULL}, 139 {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.DescriptorLength), "Descriptor Length", NULL}, 140 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HeDecode}, 141 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode}, 142 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_ShrDecode}, 143 {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL}, 144 {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL} 145 }; 146 147 ACPI_RSDUMP_INFO AcpiRsDumpDma[6] = 148 { 149 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpDma), "DMA", NULL}, 150 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type), "Speed", AcpiGbl_TypDecode}, 151 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BmDecode}, 152 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SizDecode}, 153 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Dma.ChannelCount), "Channel Count", NULL}, 154 {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL} 155 }; 156 157 ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[4] = 158 { 159 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpStartDpf), "Start-Dependent-Functions",NULL}, 160 {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (StartDpf.DescriptorLength), "Descriptor Length", NULL}, 161 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.CompatibilityPriority), "Compatibility Priority", AcpiGbl_ConfigDecode}, 162 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.PerformanceRobustness), "Performance/Robustness", AcpiGbl_ConfigDecode} 163 }; 164 165 ACPI_RSDUMP_INFO AcpiRsDumpEndDpf[1] = 166 { 167 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndDpf), "End-Dependent-Functions", NULL} 168 }; 169 170 ACPI_RSDUMP_INFO AcpiRsDumpIo[6] = 171 { 172 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIo), "I/O", NULL}, 173 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Io.IoDecode), "Address Decoding", AcpiGbl_IoDecode}, 174 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Io.Minimum), "Address Minimum", NULL}, 175 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Io.Maximum), "Address Maximum", NULL}, 176 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Io.Alignment), "Alignment", NULL}, 177 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Io.AddressLength), "Address Length", NULL} 178 }; 179 180 ACPI_RSDUMP_INFO AcpiRsDumpFixedIo[3] = 181 { 182 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedIo), "Fixed I/O", NULL}, 183 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedIo.Address), "Address", NULL}, 184 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (FixedIo.AddressLength), "Address Length", NULL} 185 }; 186 187 ACPI_RSDUMP_INFO AcpiRsDumpVendor[3] = 188 { 189 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpVendor), "Vendor Specific", NULL}, 190 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Vendor.ByteLength), "Length", NULL}, 191 {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET (Vendor.ByteData[0]), "Vendor Data", NULL} 192 }; 193 194 ACPI_RSDUMP_INFO AcpiRsDumpEndTag[1] = 195 { 196 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndTag), "EndTag", NULL} 197 }; 198 199 ACPI_RSDUMP_INFO AcpiRsDumpMemory24[6] = 200 { 201 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory24), "24-Bit Memory Range", NULL}, 202 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, 203 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Minimum), "Address Minimum", NULL}, 204 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Maximum), "Address Maximum", NULL}, 205 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Alignment), "Alignment", NULL}, 206 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.AddressLength), "Address Length", NULL} 207 }; 208 209 ACPI_RSDUMP_INFO AcpiRsDumpMemory32[6] = 210 { 211 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory32), "32-Bit Memory Range", NULL}, 212 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, 213 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Minimum), "Address Minimum", NULL}, 214 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Maximum), "Address Maximum", NULL}, 215 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Alignment), "Alignment", NULL}, 216 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.AddressLength), "Address Length", NULL} 217 }; 218 219 ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[4] = 220 { 221 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedMemory32), "32-Bit Fixed Memory Range",NULL}, 222 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, 223 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.Address), "Address", NULL}, 224 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.AddressLength), "Address Length", NULL} 225 }; 226 227 ACPI_RSDUMP_INFO AcpiRsDumpAddress16[8] = 228 { 229 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress16), "16-Bit WORD Address Space",NULL}, 230 {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 231 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Granularity), "Granularity", NULL}, 232 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Minimum), "Address Minimum", NULL}, 233 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Maximum), "Address Maximum", NULL}, 234 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.TranslationOffset), "Translation Offset", NULL}, 235 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.AddressLength), "Address Length", NULL}, 236 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address16.ResourceSource), NULL, NULL} 237 }; 238 239 ACPI_RSDUMP_INFO AcpiRsDumpAddress32[8] = 240 { 241 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress32), "32-Bit DWORD Address Space", NULL}, 242 {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 243 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Granularity), "Granularity", NULL}, 244 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Minimum), "Address Minimum", NULL}, 245 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Maximum), "Address Maximum", NULL}, 246 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.TranslationOffset), "Translation Offset", NULL}, 247 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.AddressLength), "Address Length", NULL}, 248 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address32.ResourceSource), NULL, NULL} 249 }; 250 251 ACPI_RSDUMP_INFO AcpiRsDumpAddress64[8] = 252 { 253 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress64), "64-Bit QWORD Address Space", NULL}, 254 {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 255 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Granularity), "Granularity", NULL}, 256 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Minimum), "Address Minimum", NULL}, 257 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Maximum), "Address Maximum", NULL}, 258 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.TranslationOffset), "Translation Offset", NULL}, 259 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.AddressLength), "Address Length", NULL}, 260 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address64.ResourceSource), NULL, NULL} 261 }; 262 263 ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[8] = 264 { 265 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtAddress64), "64-Bit Extended Address Space", NULL}, 266 {ACPI_RSD_ADDRESS, 0, NULL, NULL}, 267 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Granularity), "Granularity", NULL}, 268 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Minimum), "Address Minimum", NULL}, 269 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Maximum), "Address Maximum", NULL}, 270 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.TranslationOffset), "Translation Offset", NULL}, 271 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.AddressLength), "Address Length", NULL}, 272 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.TypeSpecific), "Type-Specific Attribute", NULL} 273 }; 274 275 ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] = 276 { 277 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtIrq), "Extended IRQ", NULL}, 278 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer), "Type", AcpiGbl_ConsumeDecode}, 279 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HeDecode}, 280 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LlDecode}, 281 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_ShrDecode}, 282 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL}, 283 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL}, 284 {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL} 285 }; 286 287 ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[6] = 288 { 289 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGenericReg), "Generic Register", NULL}, 290 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.SpaceId), "Space ID", NULL}, 291 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.BitWidth), "Bit Width", NULL}, 292 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.BitOffset), "Bit Offset", NULL}, 293 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.AccessSize), "Access Size", NULL}, 294 {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (GenericReg.Address), "Address", NULL} 295 }; 296 297 ACPI_RSDUMP_INFO AcpiRsDumpGpio[16] = 298 { 299 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGpio), "GPIO", NULL}, 300 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.RevisionId), "RevisionId", NULL}, 301 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.ConnectionType), "ConnectionType", AcpiGbl_CtDecode}, 302 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, 303 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Gpio.PinConfig), "PinConfig", AcpiGbl_PpcDecode}, 304 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Sharable), "Sharing", AcpiGbl_ShrDecode}, 305 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.IoRestriction), "IoRestriction", AcpiGbl_IorDecode}, 306 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Gpio.Triggering), "Triggering", AcpiGbl_HeDecode}, 307 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Gpio.Polarity), "Polarity", AcpiGbl_LlDecode}, 308 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.DriveStrength), "DriveStrength", NULL}, 309 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.DebounceTimeout), "DebounceTimeout", NULL}, 310 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Gpio.ResourceSource), "ResourceSource", NULL}, 311 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.PinTableLength), "PinTableLength", NULL}, 312 {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (Gpio.PinTable), "PinTable", NULL}, 313 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Gpio.VendorLength), "VendorLength", NULL}, 314 {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (Gpio.VendorData), "VendorData", NULL}, 315 }; 316 317 ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[4] = 318 { 319 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedDma), "FixedDma", NULL}, 320 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedDma.RequestLines), "RequestLines", NULL}, 321 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedDma.Channels), "Channels", NULL}, 322 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (FixedDma.Width), "TransferWidth", AcpiGbl_DtsDecode}, 323 }; 324 325 #define ACPI_RS_DUMP_COMMON_SERIAL_BUS \ 326 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.RevisionId), "RevisionId", NULL}, \ 327 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.Type), "Type", AcpiGbl_SbtDecode}, \ 328 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, \ 329 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (CommonSerialBus.SlaveMode), "SlaveMode", AcpiGbl_SmDecode}, \ 330 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (CommonSerialBus.TypeRevisionId), "TypeRevisionId", NULL}, \ 331 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (CommonSerialBus.TypeDataLength), "TypeDataLength", NULL}, \ 332 {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (CommonSerialBus.ResourceSource), "ResourceSource", NULL}, \ 333 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (CommonSerialBus.VendorLength), "VendorLength", NULL}, \ 334 {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (CommonSerialBus.VendorData), "VendorData", NULL}, 335 336 ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[10] = 337 { 338 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpCommonSerialBus), "Common Serial Bus", NULL}, 339 ACPI_RS_DUMP_COMMON_SERIAL_BUS 340 }; 341 342 ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[13] = 343 { 344 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpI2cSerialBus), "I2C Serial Bus", NULL}, 345 ACPI_RS_DUMP_COMMON_SERIAL_BUS 346 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (I2cSerialBus.AccessMode), "AccessMode", AcpiGbl_AmDecode}, 347 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (I2cSerialBus.ConnectionSpeed), "ConnectionSpeed", NULL}, 348 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (I2cSerialBus.SlaveAddress), "SlaveAddress", NULL}, 349 }; 350 351 ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[17] = 352 { 353 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpSpiSerialBus), "Spi Serial Bus", NULL}, 354 ACPI_RS_DUMP_COMMON_SERIAL_BUS 355 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (SpiSerialBus.WireMode), "WireMode", AcpiGbl_WmDecode}, 356 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (SpiSerialBus.DevicePolarity), "DevicePolarity", AcpiGbl_DpDecode}, 357 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.DataBitLength), "DataBitLength", NULL}, 358 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.ClockPhase), "ClockPhase", AcpiGbl_CphDecode}, 359 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (SpiSerialBus.ClockPolarity), "ClockPolarity", AcpiGbl_CpoDecode}, 360 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (SpiSerialBus.DeviceSelection), "DeviceSelection", NULL}, 361 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (SpiSerialBus.ConnectionSpeed), "ConnectionSpeed", NULL}, 362 }; 363 364 ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[19] = 365 { 366 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpUartSerialBus), "Uart Serial Bus", NULL}, 367 ACPI_RS_DUMP_COMMON_SERIAL_BUS 368 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.FlowControl), "FlowControl", AcpiGbl_FcDecode}, 369 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.StopBits), "StopBits", AcpiGbl_SbDecode}, 370 {ACPI_RSD_3BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.DataBits), "DataBits", AcpiGbl_BpbDecode}, 371 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (UartSerialBus.Endian), "Endian", AcpiGbl_EdDecode}, 372 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (UartSerialBus.Parity), "Parity", AcpiGbl_PtDecode}, 373 {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (UartSerialBus.LinesEnabled), "LinesEnabled", NULL}, 374 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (UartSerialBus.RxFifoSize), "RxFifoSize", NULL}, 375 {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (UartSerialBus.TxFifoSize), "TxFifoSize", NULL}, 376 {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (UartSerialBus.DefaultBaudRate), "ConnectionSpeed", NULL}, 377 }; 378 379 /* 380 * Tables used for common address descriptor flag fields 381 */ 382 static ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[5] = 383 { 384 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGeneralFlags), NULL, NULL}, 385 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.ProducerConsumer), "Consumer/Producer", AcpiGbl_ConsumeDecode}, 386 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode), "Address Decode", AcpiGbl_DecDecode}, 387 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MinAddressFixed), "Min Relocatability", AcpiGbl_MinDecode}, 388 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MaxAddressFixed), "Max Relocatability", AcpiGbl_MaxDecode} 389 }; 390 391 static ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[5] = 392 { 393 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags), "Resource Type", (void *) "Memory Range"}, 394 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect), "Write Protect", AcpiGbl_RwDecode}, 395 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching), "Caching", AcpiGbl_MemDecode}, 396 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType), "Range Type", AcpiGbl_MtpDecode}, 397 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation), "Translation", AcpiGbl_TtpDecode} 398 }; 399 400 static ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[4] = 401 { 402 {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags), "Resource Type", (void *) "I/O Range"}, 403 {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType), "Range Type", AcpiGbl_RngDecode}, 404 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation), "Translation", AcpiGbl_TtpDecode}, 405 {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType), "Translation Type", AcpiGbl_TrsDecode} 406 }; 407 408 409 /* 410 * Table used to dump _PRT contents 411 */ 412 static ACPI_RSDUMP_INFO AcpiRsDumpPrt[5] = 413 { 414 {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPrt), NULL, NULL}, 415 {ACPI_RSD_UINT64, ACPI_PRT_OFFSET (Address), "Address", NULL}, 416 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (Pin), "Pin", NULL}, 417 {ACPI_RSD_STRING, ACPI_PRT_OFFSET (Source[0]), "Source", NULL}, 418 {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (SourceIndex), "Source Index", NULL} 419 }; 420 421 422 /******************************************************************************* 423 * 424 * FUNCTION: AcpiRsDumpDescriptor 425 * 426 * PARAMETERS: Resource 427 * 428 * RETURN: None 429 * 430 * DESCRIPTION: 431 * 432 ******************************************************************************/ 433 434 static void 435 AcpiRsDumpDescriptor ( 436 void *Resource, 437 ACPI_RSDUMP_INFO *Table) 438 { 439 UINT8 *Target = NULL; 440 UINT8 *PreviousTarget; 441 char *Name; 442 UINT8 Count; 443 444 445 /* First table entry must contain the table length (# of table entries) */ 446 447 Count = Table->Offset; 448 449 while (Count) 450 { 451 PreviousTarget = Target; 452 Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset); 453 Name = Table->Name; 454 455 switch (Table->Opcode) 456 { 457 case ACPI_RSD_TITLE: 458 /* 459 * Optional resource title 460 */ 461 if (Table->Name) 462 { 463 AcpiOsPrintf ("%s Resource\n", Name); 464 } 465 break; 466 467 /* Strings */ 468 469 case ACPI_RSD_LITERAL: 470 AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer)); 471 break; 472 473 case ACPI_RSD_STRING: 474 AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target)); 475 break; 476 477 /* Data items, 8/16/32/64 bit */ 478 479 case ACPI_RSD_UINT8: 480 if (Table->Pointer) 481 { 482 AcpiRsOutString (Name, ACPI_CAST_PTR (char, 483 Table->Pointer [*Target])); 484 } 485 else 486 { 487 AcpiRsOutInteger8 (Name, ACPI_GET8 (Target)); 488 } 489 break; 490 491 case ACPI_RSD_UINT16: 492 AcpiRsOutInteger16 (Name, ACPI_GET16 (Target)); 493 break; 494 495 case ACPI_RSD_UINT32: 496 AcpiRsOutInteger32 (Name, ACPI_GET32 (Target)); 497 break; 498 499 case ACPI_RSD_UINT64: 500 AcpiRsOutInteger64 (Name, ACPI_GET64 (Target)); 501 break; 502 503 /* Flags: 1-bit and 2-bit flags supported */ 504 505 case ACPI_RSD_1BITFLAG: 506 AcpiRsOutString (Name, ACPI_CAST_PTR (char, 507 Table->Pointer [*Target & 0x01])); 508 break; 509 510 case ACPI_RSD_2BITFLAG: 511 AcpiRsOutString (Name, ACPI_CAST_PTR (char, 512 Table->Pointer [*Target & 0x03])); 513 break; 514 515 case ACPI_RSD_3BITFLAG: 516 AcpiRsOutString (Name, ACPI_CAST_PTR (char, 517 Table->Pointer [*Target & 0x07])); 518 break; 519 520 case ACPI_RSD_SHORTLIST: 521 /* 522 * Short byte list (single line output) for DMA and IRQ resources 523 * Note: The list length is obtained from the previous table entry 524 */ 525 if (PreviousTarget) 526 { 527 AcpiRsOutTitle (Name); 528 AcpiRsDumpShortByteList (*PreviousTarget, Target); 529 } 530 break; 531 532 case ACPI_RSD_SHORTLISTX: 533 /* 534 * Short byte list (single line output) for GPIO vendor data 535 * Note: The list length is obtained from the previous table entry 536 */ 537 if (PreviousTarget) 538 { 539 AcpiRsOutTitle (Name); 540 AcpiRsDumpShortByteList (*PreviousTarget, 541 *(ACPI_CAST_INDIRECT_PTR (UINT8, Target))); 542 } 543 break; 544 545 case ACPI_RSD_LONGLIST: 546 /* 547 * Long byte list for Vendor resource data 548 * Note: The list length is obtained from the previous table entry 549 */ 550 if (PreviousTarget) 551 { 552 AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target); 553 } 554 break; 555 556 case ACPI_RSD_DWORDLIST: 557 /* 558 * Dword list for Extended Interrupt resources 559 * Note: The list length is obtained from the previous table entry 560 */ 561 if (PreviousTarget) 562 { 563 AcpiRsDumpDwordList (*PreviousTarget, 564 ACPI_CAST_PTR (UINT32, Target)); 565 } 566 break; 567 568 case ACPI_RSD_WORDLIST: 569 /* 570 * Word list for GPIO Pin Table 571 * Note: The list length is obtained from the previous table entry 572 */ 573 if (PreviousTarget) 574 { 575 AcpiRsDumpWordList (*PreviousTarget, 576 *(ACPI_CAST_INDIRECT_PTR (UINT16, Target))); 577 } 578 break; 579 580 case ACPI_RSD_ADDRESS: 581 /* 582 * Common flags for all Address resources 583 */ 584 AcpiRsDumpAddressCommon (ACPI_CAST_PTR (ACPI_RESOURCE_DATA, Target)); 585 break; 586 587 case ACPI_RSD_SOURCE: 588 /* 589 * Optional ResourceSource for Address resources 590 */ 591 AcpiRsDumpResourceSource (ACPI_CAST_PTR (ACPI_RESOURCE_SOURCE, Target)); 592 break; 593 594 default: 595 AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", 596 Table->Opcode); 597 return; 598 } 599 600 Table++; 601 Count--; 602 } 603 } 604 605 606 /******************************************************************************* 607 * 608 * FUNCTION: AcpiRsDumpResourceSource 609 * 610 * PARAMETERS: ResourceSource - Pointer to a Resource Source struct 611 * 612 * RETURN: None 613 * 614 * DESCRIPTION: Common routine for dumping the optional ResourceSource and the 615 * corresponding ResourceSourceIndex. 616 * 617 ******************************************************************************/ 618 619 static void 620 AcpiRsDumpResourceSource ( 621 ACPI_RESOURCE_SOURCE *ResourceSource) 622 { 623 ACPI_FUNCTION_ENTRY (); 624 625 626 if (ResourceSource->Index == 0xFF) 627 { 628 return; 629 } 630 631 AcpiRsOutInteger8 ("Resource Source Index", 632 ResourceSource->Index); 633 634 AcpiRsOutString ("Resource Source", 635 ResourceSource->StringPtr ? 636 ResourceSource->StringPtr : "[Not Specified]"); 637 } 638 639 640 /******************************************************************************* 641 * 642 * FUNCTION: AcpiRsDumpAddressCommon 643 * 644 * PARAMETERS: Resource - Pointer to an internal resource descriptor 645 * 646 * RETURN: None 647 * 648 * DESCRIPTION: Dump the fields that are common to all Address resource 649 * descriptors 650 * 651 ******************************************************************************/ 652 653 static void 654 AcpiRsDumpAddressCommon ( 655 ACPI_RESOURCE_DATA *Resource) 656 { 657 ACPI_FUNCTION_ENTRY (); 658 659 660 /* Decode the type-specific flags */ 661 662 switch (Resource->Address.ResourceType) 663 { 664 case ACPI_MEMORY_RANGE: 665 666 AcpiRsDumpDescriptor (Resource, AcpiRsDumpMemoryFlags); 667 break; 668 669 case ACPI_IO_RANGE: 670 671 AcpiRsDumpDescriptor (Resource, AcpiRsDumpIoFlags); 672 break; 673 674 case ACPI_BUS_NUMBER_RANGE: 675 676 AcpiRsOutString ("Resource Type", "Bus Number Range"); 677 break; 678 679 default: 680 681 AcpiRsOutInteger8 ("Resource Type", 682 (UINT8) Resource->Address.ResourceType); 683 break; 684 } 685 686 /* Decode the general flags */ 687 688 AcpiRsDumpDescriptor (Resource, AcpiRsDumpGeneralFlags); 689 } 690 691 692 /******************************************************************************* 693 * 694 * FUNCTION: AcpiRsDumpResourceList 695 * 696 * PARAMETERS: ResourceList - Pointer to a resource descriptor list 697 * 698 * RETURN: None 699 * 700 * DESCRIPTION: Dispatches the structure to the correct dump routine. 701 * 702 ******************************************************************************/ 703 704 void 705 AcpiRsDumpResourceList ( 706 ACPI_RESOURCE *ResourceList) 707 { 708 UINT32 Count = 0; 709 UINT32 Type; 710 711 712 ACPI_FUNCTION_ENTRY (); 713 714 715 if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer)) 716 { 717 return; 718 } 719 720 /* Walk list and dump all resource descriptors (END_TAG terminates) */ 721 722 do 723 { 724 AcpiOsPrintf ("\n[%02X] ", Count); 725 Count++; 726 727 /* Validate Type before dispatch */ 728 729 Type = ResourceList->Type; 730 if (Type > ACPI_RESOURCE_TYPE_MAX) 731 { 732 AcpiOsPrintf ( 733 "Invalid descriptor type (%X) in resource list\n", 734 ResourceList->Type); 735 return; 736 } 737 738 /* Dump the resource descriptor */ 739 740 if (Type == ACPI_RESOURCE_TYPE_SERIAL_BUS) 741 { 742 AcpiRsDumpDescriptor (&ResourceList->Data, 743 AcpiGbl_DumpSerialBusDispatch[ResourceList->Data.CommonSerialBus.Type]); 744 } 745 else 746 { 747 AcpiRsDumpDescriptor (&ResourceList->Data, 748 AcpiGbl_DumpResourceDispatch[Type]); 749 } 750 751 /* Point to the next resource structure */ 752 753 ResourceList = ACPI_NEXT_RESOURCE (ResourceList); 754 755 /* Exit when END_TAG descriptor is reached */ 756 757 } while (Type != ACPI_RESOURCE_TYPE_END_TAG); 758 } 759 760 761 /******************************************************************************* 762 * 763 * FUNCTION: AcpiRsDumpIrqList 764 * 765 * PARAMETERS: RouteTable - Pointer to the routing table to dump. 766 * 767 * RETURN: None 768 * 769 * DESCRIPTION: Print IRQ routing table 770 * 771 ******************************************************************************/ 772 773 void 774 AcpiRsDumpIrqList ( 775 UINT8 *RouteTable) 776 { 777 ACPI_PCI_ROUTING_TABLE *PrtElement; 778 UINT8 Count; 779 780 781 ACPI_FUNCTION_ENTRY (); 782 783 784 if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer)) 785 { 786 return; 787 } 788 789 PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable); 790 791 /* Dump all table elements, Exit on zero length element */ 792 793 for (Count = 0; PrtElement->Length; Count++) 794 { 795 AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count); 796 AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt); 797 798 PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE, 799 PrtElement, PrtElement->Length); 800 } 801 } 802 803 804 /******************************************************************************* 805 * 806 * FUNCTION: AcpiRsOut* 807 * 808 * PARAMETERS: Title - Name of the resource field 809 * Value - Value of the resource field 810 * 811 * RETURN: None 812 * 813 * DESCRIPTION: Miscellaneous helper functions to consistently format the 814 * output of the resource dump routines 815 * 816 ******************************************************************************/ 817 818 static void 819 AcpiRsOutString ( 820 char *Title, 821 char *Value) 822 { 823 AcpiOsPrintf ("%27s : %s", Title, Value); 824 if (!*Value) 825 { 826 AcpiOsPrintf ("[NULL NAMESTRING]"); 827 } 828 AcpiOsPrintf ("\n"); 829 } 830 831 static void 832 AcpiRsOutInteger8 ( 833 char *Title, 834 UINT8 Value) 835 { 836 AcpiOsPrintf ("%27s : %2.2X\n", Title, Value); 837 } 838 839 static void 840 AcpiRsOutInteger16 ( 841 char *Title, 842 UINT16 Value) 843 { 844 AcpiOsPrintf ("%27s : %4.4X\n", Title, Value); 845 } 846 847 static void 848 AcpiRsOutInteger32 ( 849 char *Title, 850 UINT32 Value) 851 { 852 AcpiOsPrintf ("%27s : %8.8X\n", Title, Value); 853 } 854 855 static void 856 AcpiRsOutInteger64 ( 857 char *Title, 858 UINT64 Value) 859 { 860 AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title, 861 ACPI_FORMAT_UINT64 (Value)); 862 } 863 864 static void 865 AcpiRsOutTitle ( 866 char *Title) 867 { 868 AcpiOsPrintf ("%27s : ", Title); 869 } 870 871 872 /******************************************************************************* 873 * 874 * FUNCTION: AcpiRsDump*List 875 * 876 * PARAMETERS: Length - Number of elements in the list 877 * Data - Start of the list 878 * 879 * RETURN: None 880 * 881 * DESCRIPTION: Miscellaneous functions to dump lists of raw data 882 * 883 ******************************************************************************/ 884 885 static void 886 AcpiRsDumpByteList ( 887 UINT16 Length, 888 UINT8 *Data) 889 { 890 UINT8 i; 891 892 893 for (i = 0; i < Length; i++) 894 { 895 AcpiOsPrintf ("%25s%2.2X : %2.2X\n", 896 "Byte", i, Data[i]); 897 } 898 } 899 900 static void 901 AcpiRsDumpShortByteList ( 902 UINT8 Length, 903 UINT8 *Data) 904 { 905 UINT8 i; 906 907 908 for (i = 0; i < Length; i++) 909 { 910 AcpiOsPrintf ("%X ", Data[i]); 911 } 912 AcpiOsPrintf ("\n"); 913 } 914 915 static void 916 AcpiRsDumpDwordList ( 917 UINT8 Length, 918 UINT32 *Data) 919 { 920 UINT8 i; 921 922 923 for (i = 0; i < Length; i++) 924 { 925 AcpiOsPrintf ("%25s%2.2X : %8.8X\n", 926 "Dword", i, Data[i]); 927 } 928 } 929 930 static void 931 AcpiRsDumpWordList ( 932 UINT16 Length, 933 UINT16 *Data) 934 { 935 UINT16 i; 936 937 938 for (i = 0; i < Length; i++) 939 { 940 AcpiOsPrintf ("%25s%2.2X : %4.4X\n", 941 "Word", i, Data[i]); 942 } 943 } 944 945 #endif 946