1 /******************************************************************************* 2 * 3 * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly 4 * 5 ******************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2015, 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 #include <contrib/dev/acpica/include/acpi.h> 45 #include <contrib/dev/acpica/include/accommon.h> 46 #include <contrib/dev/acpica/include/acdisasm.h> 47 48 49 #define _COMPONENT ACPI_CA_DEBUGGER 50 ACPI_MODULE_NAME ("dbresrcs") 51 52 53 /******************************************************************************* 54 * 55 * FUNCTION: AcpiDmIrqDescriptor 56 * 57 * PARAMETERS: Info - Extra resource info 58 * Resource - Pointer to the resource descriptor 59 * Length - Length of the descriptor in bytes 60 * Level - Current source code indentation level 61 * 62 * RETURN: None 63 * 64 * DESCRIPTION: Decode a IRQ descriptor, either Irq() or IrqNoFlags() 65 * 66 ******************************************************************************/ 67 68 void 69 AcpiDmIrqDescriptor ( 70 ACPI_OP_WALK_INFO *Info, 71 AML_RESOURCE *Resource, 72 UINT32 Length, 73 UINT32 Level) 74 { 75 76 AcpiDmIndent (Level); 77 AcpiOsPrintf ("%s (", 78 AcpiGbl_IrqDecode [ACPI_GET_1BIT_FLAG (Length)]); 79 80 /* Decode flags byte if present */ 81 82 if (Length & 1) 83 { 84 AcpiOsPrintf ("%s, %s, %s, ", 85 AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Irq.Flags)], 86 AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Irq.Flags, 3)], 87 AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Irq.Flags, 4)]); 88 } 89 90 /* Insert a descriptor name */ 91 92 AcpiDmDescriptorName (); 93 AcpiOsPrintf (")\n"); 94 95 AcpiDmIndent (Level + 1); 96 AcpiDmBitList (Resource->Irq.IrqMask); 97 } 98 99 100 /******************************************************************************* 101 * 102 * FUNCTION: AcpiDmDmaDescriptor 103 * 104 * PARAMETERS: Info - Extra resource info 105 * Resource - Pointer to the resource descriptor 106 * Length - Length of the descriptor in bytes 107 * Level - Current source code indentation level 108 * 109 * RETURN: None 110 * 111 * DESCRIPTION: Decode a DMA descriptor 112 * 113 ******************************************************************************/ 114 115 void 116 AcpiDmDmaDescriptor ( 117 ACPI_OP_WALK_INFO *Info, 118 AML_RESOURCE *Resource, 119 UINT32 Length, 120 UINT32 Level) 121 { 122 123 AcpiDmIndent (Level); 124 AcpiOsPrintf ("DMA (%s, %s, %s, ", 125 AcpiGbl_TypDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Dma.Flags, 5)], 126 AcpiGbl_BmDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Dma.Flags, 2)], 127 AcpiGbl_SizDecode [ACPI_GET_2BIT_FLAG (Resource->Dma.Flags)]); 128 129 /* Insert a descriptor name */ 130 131 AcpiDmDescriptorName (); 132 AcpiOsPrintf (")\n"); 133 134 AcpiDmIndent (Level + 1); 135 AcpiDmBitList (Resource->Dma.DmaChannelMask); 136 } 137 138 139 /******************************************************************************* 140 * 141 * FUNCTION: AcpiDmFixedDmaDescriptor 142 * 143 * PARAMETERS: Info - Extra resource info 144 * Resource - Pointer to the resource descriptor 145 * Length - Length of the descriptor in bytes 146 * Level - Current source code indentation level 147 * 148 * RETURN: None 149 * 150 * DESCRIPTION: Decode a FixedDMA descriptor 151 * 152 ******************************************************************************/ 153 154 void 155 AcpiDmFixedDmaDescriptor ( 156 ACPI_OP_WALK_INFO *Info, 157 AML_RESOURCE *Resource, 158 UINT32 Length, 159 UINT32 Level) 160 { 161 162 AcpiDmIndent (Level); 163 AcpiOsPrintf ("FixedDMA (0x%4.4X, 0x%4.4X, ", 164 Resource->FixedDma.RequestLines, 165 Resource->FixedDma.Channels); 166 167 if (Resource->FixedDma.Width <= 5) 168 { 169 AcpiOsPrintf ("%s, ", 170 AcpiGbl_DtsDecode [Resource->FixedDma.Width]); 171 } 172 else 173 { 174 AcpiOsPrintf ("%X /* INVALID DMA WIDTH */, ", Resource->FixedDma.Width); 175 } 176 177 /* Insert a descriptor name */ 178 179 AcpiDmDescriptorName (); 180 AcpiOsPrintf (")\n"); 181 } 182 183 184 /******************************************************************************* 185 * 186 * FUNCTION: AcpiDmIoDescriptor 187 * 188 * PARAMETERS: Info - Extra resource info 189 * Resource - Pointer to the resource descriptor 190 * Length - Length of the descriptor in bytes 191 * Level - Current source code indentation level 192 * 193 * RETURN: None 194 * 195 * DESCRIPTION: Decode an IO descriptor 196 * 197 ******************************************************************************/ 198 199 void 200 AcpiDmIoDescriptor ( 201 ACPI_OP_WALK_INFO *Info, 202 AML_RESOURCE *Resource, 203 UINT32 Length, 204 UINT32 Level) 205 { 206 207 AcpiDmIndent (Level); 208 AcpiOsPrintf ("IO (%s,\n", 209 AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]); 210 211 AcpiDmIndent (Level + 1); 212 AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum"); 213 214 AcpiDmIndent (Level + 1); 215 AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum"); 216 217 AcpiDmIndent (Level + 1); 218 AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment"); 219 220 AcpiDmIndent (Level + 1); 221 AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Length"); 222 223 /* Insert a descriptor name */ 224 225 AcpiDmIndent (Level + 1); 226 AcpiDmDescriptorName (); 227 AcpiOsPrintf (")\n"); 228 } 229 230 231 /******************************************************************************* 232 * 233 * FUNCTION: AcpiDmFixedIoDescriptor 234 * 235 * PARAMETERS: Info - Extra resource info 236 * Resource - Pointer to the resource descriptor 237 * Length - Length of the descriptor in bytes 238 * Level - Current source code indentation level 239 * 240 * RETURN: None 241 * 242 * DESCRIPTION: Decode a Fixed IO descriptor 243 * 244 ******************************************************************************/ 245 246 void 247 AcpiDmFixedIoDescriptor ( 248 ACPI_OP_WALK_INFO *Info, 249 AML_RESOURCE *Resource, 250 UINT32 Length, 251 UINT32 Level) 252 { 253 254 AcpiDmIndent (Level); 255 AcpiOsPrintf ("FixedIO (\n"); 256 257 AcpiDmIndent (Level + 1); 258 AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address"); 259 260 AcpiDmIndent (Level + 1); 261 AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length"); 262 263 /* Insert a descriptor name */ 264 265 AcpiDmIndent (Level + 1); 266 AcpiDmDescriptorName (); 267 AcpiOsPrintf (")\n"); 268 } 269 270 271 /******************************************************************************* 272 * 273 * FUNCTION: AcpiDmStartDependentDescriptor 274 * 275 * PARAMETERS: Info - Extra resource info 276 * Resource - Pointer to the resource descriptor 277 * Length - Length of the descriptor in bytes 278 * Level - Current source code indentation level 279 * 280 * RETURN: None 281 * 282 * DESCRIPTION: Decode a Start Dependendent functions descriptor 283 * 284 ******************************************************************************/ 285 286 void 287 AcpiDmStartDependentDescriptor ( 288 ACPI_OP_WALK_INFO *Info, 289 AML_RESOURCE *Resource, 290 UINT32 Length, 291 UINT32 Level) 292 { 293 294 AcpiDmIndent (Level); 295 296 if (Length & 1) 297 { 298 AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n", 299 (UINT32) ACPI_GET_2BIT_FLAG (Resource->StartDpf.Flags), 300 (UINT32) ACPI_EXTRACT_2BIT_FLAG (Resource->StartDpf.Flags, 2)); 301 } 302 else 303 { 304 AcpiOsPrintf ("StartDependentFnNoPri ()\n"); 305 } 306 307 AcpiDmIndent (Level); 308 AcpiOsPrintf ("{\n"); 309 } 310 311 312 /******************************************************************************* 313 * 314 * FUNCTION: AcpiDmEndDependentDescriptor 315 * 316 * PARAMETERS: Info - Extra resource info 317 * Resource - Pointer to the resource descriptor 318 * Length - Length of the descriptor in bytes 319 * Level - Current source code indentation level 320 * 321 * RETURN: None 322 * 323 * DESCRIPTION: Decode an End Dependent functions descriptor 324 * 325 ******************************************************************************/ 326 327 void 328 AcpiDmEndDependentDescriptor ( 329 ACPI_OP_WALK_INFO *Info, 330 AML_RESOURCE *Resource, 331 UINT32 Length, 332 UINT32 Level) 333 { 334 335 AcpiDmIndent (Level); 336 AcpiOsPrintf ("}\n"); 337 AcpiDmIndent (Level); 338 AcpiOsPrintf ("EndDependentFn ()\n"); 339 } 340 341 342 /******************************************************************************* 343 * 344 * FUNCTION: AcpiDmVendorSmallDescriptor 345 * 346 * PARAMETERS: Info - Extra resource info 347 * Resource - Pointer to the resource descriptor 348 * Length - Length of the descriptor in bytes 349 * Level - Current source code indentation level 350 * 351 * RETURN: None 352 * 353 * DESCRIPTION: Decode a Vendor Small Descriptor 354 * 355 ******************************************************************************/ 356 357 void 358 AcpiDmVendorSmallDescriptor ( 359 ACPI_OP_WALK_INFO *Info, 360 AML_RESOURCE *Resource, 361 UINT32 Length, 362 UINT32 Level) 363 { 364 365 AcpiDmVendorCommon ("Short", 366 ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)), 367 Length, Level); 368 } 369