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