1 /*******************************************************************************
3 * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2016, 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 #define _COMPONENT ACPI_CA_DEBUGGER
50 ACPI_MODULE_NAME ("dbresrcs")
53 /*******************************************************************************
55 * FUNCTION: AcpiDmIrqDescriptor
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
64 * DESCRIPTION: Decode a IRQ descriptor, either Irq() or IrqNoFlags()
66 ******************************************************************************/
70 ACPI_OP_WALK_INFO *Info,
71 AML_RESOURCE *Resource,
78 AcpiGbl_IrqDecode [ACPI_GET_1BIT_FLAG (Length)]);
80 /* Decode flags byte if present */
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)]);
90 /* Insert a descriptor name */
92 AcpiDmDescriptorName ();
95 AcpiDmIndent (Level + 1);
96 AcpiDmBitList (Resource->Irq.IrqMask);
100 /*******************************************************************************
102 * FUNCTION: AcpiDmDmaDescriptor
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
111 * DESCRIPTION: Decode a DMA descriptor
113 ******************************************************************************/
116 AcpiDmDmaDescriptor (
117 ACPI_OP_WALK_INFO *Info,
118 AML_RESOURCE *Resource,
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)]);
129 /* Insert a descriptor name */
131 AcpiDmDescriptorName ();
132 AcpiOsPrintf (")\n");
134 AcpiDmIndent (Level + 1);
135 AcpiDmBitList (Resource->Dma.DmaChannelMask);
139 /*******************************************************************************
141 * FUNCTION: AcpiDmFixedDmaDescriptor
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
150 * DESCRIPTION: Decode a FixedDMA descriptor
152 ******************************************************************************/
155 AcpiDmFixedDmaDescriptor (
156 ACPI_OP_WALK_INFO *Info,
157 AML_RESOURCE *Resource,
162 AcpiDmIndent (Level);
163 AcpiOsPrintf ("FixedDMA (0x%4.4X, 0x%4.4X, ",
164 Resource->FixedDma.RequestLines,
165 Resource->FixedDma.Channels);
167 if (Resource->FixedDma.Width <= 5)
169 AcpiOsPrintf ("%s, ",
170 AcpiGbl_DtsDecode [Resource->FixedDma.Width]);
174 AcpiOsPrintf ("%X /* INVALID DMA WIDTH */, ",
175 Resource->FixedDma.Width);
178 /* Insert a descriptor name */
180 AcpiDmDescriptorName ();
181 AcpiOsPrintf (")\n");
185 /*******************************************************************************
187 * FUNCTION: AcpiDmIoDescriptor
189 * PARAMETERS: Info - Extra resource info
190 * Resource - Pointer to the resource descriptor
191 * Length - Length of the descriptor in bytes
192 * Level - Current source code indentation level
196 * DESCRIPTION: Decode an IO descriptor
198 ******************************************************************************/
202 ACPI_OP_WALK_INFO *Info,
203 AML_RESOURCE *Resource,
208 AcpiDmIndent (Level);
209 AcpiOsPrintf ("IO (%s,\n",
210 AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]);
212 AcpiDmIndent (Level + 1);
213 AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
215 AcpiDmIndent (Level + 1);
216 AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
218 AcpiDmIndent (Level + 1);
219 AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
221 AcpiDmIndent (Level + 1);
222 AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Length");
224 /* Insert a descriptor name */
226 AcpiDmIndent (Level + 1);
227 AcpiDmDescriptorName ();
228 AcpiOsPrintf (")\n");
232 /*******************************************************************************
234 * FUNCTION: AcpiDmFixedIoDescriptor
236 * PARAMETERS: Info - Extra resource info
237 * Resource - Pointer to the resource descriptor
238 * Length - Length of the descriptor in bytes
239 * Level - Current source code indentation level
243 * DESCRIPTION: Decode a Fixed IO descriptor
245 ******************************************************************************/
248 AcpiDmFixedIoDescriptor (
249 ACPI_OP_WALK_INFO *Info,
250 AML_RESOURCE *Resource,
255 AcpiDmIndent (Level);
256 AcpiOsPrintf ("FixedIO (\n");
258 AcpiDmIndent (Level + 1);
259 AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
261 AcpiDmIndent (Level + 1);
262 AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
264 /* Insert a descriptor name */
266 AcpiDmIndent (Level + 1);
267 AcpiDmDescriptorName ();
268 AcpiOsPrintf (")\n");
272 /*******************************************************************************
274 * FUNCTION: AcpiDmStartDependentDescriptor
276 * PARAMETERS: Info - Extra resource info
277 * Resource - Pointer to the resource descriptor
278 * Length - Length of the descriptor in bytes
279 * Level - Current source code indentation level
283 * DESCRIPTION: Decode a Start Dependendent functions descriptor
285 ******************************************************************************/
288 AcpiDmStartDependentDescriptor (
289 ACPI_OP_WALK_INFO *Info,
290 AML_RESOURCE *Resource,
295 AcpiDmIndent (Level);
299 AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n",
300 (UINT32) ACPI_GET_2BIT_FLAG (Resource->StartDpf.Flags),
301 (UINT32) ACPI_EXTRACT_2BIT_FLAG (Resource->StartDpf.Flags, 2));
305 AcpiOsPrintf ("StartDependentFnNoPri ()\n");
308 AcpiDmIndent (Level);
309 AcpiOsPrintf ("{\n");
313 /*******************************************************************************
315 * FUNCTION: AcpiDmEndDependentDescriptor
317 * PARAMETERS: Info - Extra resource info
318 * Resource - Pointer to the resource descriptor
319 * Length - Length of the descriptor in bytes
320 * Level - Current source code indentation level
324 * DESCRIPTION: Decode an End Dependent functions descriptor
326 ******************************************************************************/
329 AcpiDmEndDependentDescriptor (
330 ACPI_OP_WALK_INFO *Info,
331 AML_RESOURCE *Resource,
336 AcpiDmIndent (Level);
337 AcpiOsPrintf ("}\n");
338 AcpiDmIndent (Level);
339 AcpiOsPrintf ("EndDependentFn ()\n");
343 /*******************************************************************************
345 * FUNCTION: AcpiDmVendorSmallDescriptor
347 * PARAMETERS: Info - Extra resource info
348 * Resource - Pointer to the resource descriptor
349 * Length - Length of the descriptor in bytes
350 * Level - Current source code indentation level
354 * DESCRIPTION: Decode a Vendor Small Descriptor
356 ******************************************************************************/
359 AcpiDmVendorSmallDescriptor (
360 ACPI_OP_WALK_INFO *Info,
361 AML_RESOURCE *Resource,
366 AcpiDmVendorCommon ("Short",
367 ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)),