1 /*******************************************************************************
3 * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2015, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
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.
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.
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.
44 #include <contrib/dev/acpica/include/acpi.h>
45 #include <contrib/dev/acpica/include/accommon.h>
46 #include <contrib/dev/acpica/include/acdisasm.h>
49 #ifdef ACPI_DISASSEMBLER
51 #define _COMPONENT ACPI_CA_DEBUGGER
52 ACPI_MODULE_NAME ("dbresrcs")
55 /*******************************************************************************
57 * FUNCTION: AcpiDmIrqDescriptor
59 * PARAMETERS: Info - Extra resource info
60 * Resource - Pointer to the resource descriptor
61 * Length - Length of the descriptor in bytes
62 * Level - Current source code indentation level
66 * DESCRIPTION: Decode a IRQ descriptor, either Irq() or IrqNoFlags()
68 ******************************************************************************/
72 ACPI_OP_WALK_INFO *Info,
73 AML_RESOURCE *Resource,
80 AcpiGbl_IrqDecode [ACPI_GET_1BIT_FLAG (Length)]);
82 /* Decode flags byte if present */
86 AcpiOsPrintf ("%s, %s, %s, ",
87 AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Irq.Flags)],
88 AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Irq.Flags, 3)],
89 AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Irq.Flags, 4)]);
92 /* Insert a descriptor name */
94 AcpiDmDescriptorName ();
97 AcpiDmIndent (Level + 1);
98 AcpiDmBitList (Resource->Irq.IrqMask);
102 /*******************************************************************************
104 * FUNCTION: AcpiDmDmaDescriptor
106 * PARAMETERS: Info - Extra resource info
107 * Resource - Pointer to the resource descriptor
108 * Length - Length of the descriptor in bytes
109 * Level - Current source code indentation level
113 * DESCRIPTION: Decode a DMA descriptor
115 ******************************************************************************/
118 AcpiDmDmaDescriptor (
119 ACPI_OP_WALK_INFO *Info,
120 AML_RESOURCE *Resource,
125 AcpiDmIndent (Level);
126 AcpiOsPrintf ("DMA (%s, %s, %s, ",
127 AcpiGbl_TypDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Dma.Flags, 5)],
128 AcpiGbl_BmDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Dma.Flags, 2)],
129 AcpiGbl_SizDecode [ACPI_GET_2BIT_FLAG (Resource->Dma.Flags)]);
131 /* Insert a descriptor name */
133 AcpiDmDescriptorName ();
134 AcpiOsPrintf (")\n");
136 AcpiDmIndent (Level + 1);
137 AcpiDmBitList (Resource->Dma.DmaChannelMask);
141 /*******************************************************************************
143 * FUNCTION: AcpiDmFixedDmaDescriptor
145 * PARAMETERS: Info - Extra resource info
146 * Resource - Pointer to the resource descriptor
147 * Length - Length of the descriptor in bytes
148 * Level - Current source code indentation level
152 * DESCRIPTION: Decode a FixedDMA descriptor
154 ******************************************************************************/
157 AcpiDmFixedDmaDescriptor (
158 ACPI_OP_WALK_INFO *Info,
159 AML_RESOURCE *Resource,
164 AcpiDmIndent (Level);
165 AcpiOsPrintf ("FixedDMA (0x%4.4X, 0x%4.4X, ",
166 Resource->FixedDma.RequestLines,
167 Resource->FixedDma.Channels);
169 if (Resource->FixedDma.Width <= 5)
171 AcpiOsPrintf ("%s, ",
172 AcpiGbl_DtsDecode [Resource->FixedDma.Width]);
176 AcpiOsPrintf ("%X /* INVALID DMA WIDTH */, ", Resource->FixedDma.Width);
179 /* Insert a descriptor name */
181 AcpiDmDescriptorName ();
182 AcpiOsPrintf (")\n");
186 /*******************************************************************************
188 * FUNCTION: AcpiDmIoDescriptor
190 * PARAMETERS: Info - Extra resource info
191 * Resource - Pointer to the resource descriptor
192 * Length - Length of the descriptor in bytes
193 * Level - Current source code indentation level
197 * DESCRIPTION: Decode an IO descriptor
199 ******************************************************************************/
203 ACPI_OP_WALK_INFO *Info,
204 AML_RESOURCE *Resource,
209 AcpiDmIndent (Level);
210 AcpiOsPrintf ("IO (%s,\n",
211 AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]);
213 AcpiDmIndent (Level + 1);
214 AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
216 AcpiDmIndent (Level + 1);
217 AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
219 AcpiDmIndent (Level + 1);
220 AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
222 AcpiDmIndent (Level + 1);
223 AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Length");
225 /* Insert a descriptor name */
227 AcpiDmIndent (Level + 1);
228 AcpiDmDescriptorName ();
229 AcpiOsPrintf (")\n");
233 /*******************************************************************************
235 * FUNCTION: AcpiDmFixedIoDescriptor
237 * PARAMETERS: Info - Extra resource info
238 * Resource - Pointer to the resource descriptor
239 * Length - Length of the descriptor in bytes
240 * Level - Current source code indentation level
244 * DESCRIPTION: Decode a Fixed IO descriptor
246 ******************************************************************************/
249 AcpiDmFixedIoDescriptor (
250 ACPI_OP_WALK_INFO *Info,
251 AML_RESOURCE *Resource,
256 AcpiDmIndent (Level);
257 AcpiOsPrintf ("FixedIO (\n");
259 AcpiDmIndent (Level + 1);
260 AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
262 AcpiDmIndent (Level + 1);
263 AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
265 /* Insert a descriptor name */
267 AcpiDmIndent (Level + 1);
268 AcpiDmDescriptorName ();
269 AcpiOsPrintf (")\n");
273 /*******************************************************************************
275 * FUNCTION: AcpiDmStartDependentDescriptor
277 * PARAMETERS: Info - Extra resource info
278 * Resource - Pointer to the resource descriptor
279 * Length - Length of the descriptor in bytes
280 * Level - Current source code indentation level
284 * DESCRIPTION: Decode a Start Dependendent functions descriptor
286 ******************************************************************************/
289 AcpiDmStartDependentDescriptor (
290 ACPI_OP_WALK_INFO *Info,
291 AML_RESOURCE *Resource,
296 AcpiDmIndent (Level);
300 AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n",
301 (UINT32) ACPI_GET_2BIT_FLAG (Resource->StartDpf.Flags),
302 (UINT32) ACPI_EXTRACT_2BIT_FLAG (Resource->StartDpf.Flags, 2));
306 AcpiOsPrintf ("StartDependentFnNoPri ()\n");
309 AcpiDmIndent (Level);
310 AcpiOsPrintf ("{\n");
314 /*******************************************************************************
316 * FUNCTION: AcpiDmEndDependentDescriptor
318 * PARAMETERS: Info - Extra resource info
319 * Resource - Pointer to the resource descriptor
320 * Length - Length of the descriptor in bytes
321 * Level - Current source code indentation level
325 * DESCRIPTION: Decode an End Dependent functions descriptor
327 ******************************************************************************/
330 AcpiDmEndDependentDescriptor (
331 ACPI_OP_WALK_INFO *Info,
332 AML_RESOURCE *Resource,
337 AcpiDmIndent (Level);
338 AcpiOsPrintf ("}\n");
339 AcpiDmIndent (Level);
340 AcpiOsPrintf ("EndDependentFn ()\n");
344 /*******************************************************************************
346 * FUNCTION: AcpiDmVendorSmallDescriptor
348 * PARAMETERS: Info - Extra resource info
349 * Resource - Pointer to the resource descriptor
350 * Length - Length of the descriptor in bytes
351 * Level - Current source code indentation level
355 * DESCRIPTION: Decode a Vendor Small Descriptor
357 ******************************************************************************/
360 AcpiDmVendorSmallDescriptor (
361 ACPI_OP_WALK_INFO *Info,
362 AML_RESOURCE *Resource,
367 AcpiDmVendorCommon ("Short",
368 ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)),