xref: /titanic_50/usr/src/uts/intel/io/acpica/disassembler/dmresrcs.c (revision 385cc6b4ad1792caef3f84eb61eed3f27085801f)
1 /*******************************************************************************
2  *
3  * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
4  *
5  ******************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2016, 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 #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
AcpiDmIrqDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)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
AcpiDmDmaDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)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
AcpiDmFixedDmaDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)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 */, ",
175             Resource->FixedDma.Width);
176     }
177 
178     /* Insert a descriptor name */
179 
180     AcpiDmDescriptorName ();
181     AcpiOsPrintf (")\n");
182 }
183 
184 
185 /*******************************************************************************
186  *
187  * FUNCTION:    AcpiDmIoDescriptor
188  *
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
193  *
194  * RETURN:      None
195  *
196  * DESCRIPTION: Decode an IO descriptor
197  *
198  ******************************************************************************/
199 
200 void
AcpiDmIoDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)201 AcpiDmIoDescriptor (
202     ACPI_OP_WALK_INFO       *Info,
203     AML_RESOURCE            *Resource,
204     UINT32                  Length,
205     UINT32                  Level)
206 {
207 
208     AcpiDmIndent (Level);
209     AcpiOsPrintf ("IO (%s,\n",
210         AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]);
211 
212     AcpiDmIndent (Level + 1);
213     AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
214 
215     AcpiDmIndent (Level + 1);
216     AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
217 
218     AcpiDmIndent (Level + 1);
219     AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
220 
221     AcpiDmIndent (Level + 1);
222     AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Length");
223 
224     /* Insert a descriptor name */
225 
226     AcpiDmIndent (Level + 1);
227     AcpiDmDescriptorName ();
228     AcpiOsPrintf (")\n");
229 }
230 
231 
232 /*******************************************************************************
233  *
234  * FUNCTION:    AcpiDmFixedIoDescriptor
235  *
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
240  *
241  * RETURN:      None
242  *
243  * DESCRIPTION: Decode a Fixed IO descriptor
244  *
245  ******************************************************************************/
246 
247 void
AcpiDmFixedIoDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)248 AcpiDmFixedIoDescriptor (
249     ACPI_OP_WALK_INFO       *Info,
250     AML_RESOURCE            *Resource,
251     UINT32                  Length,
252     UINT32                  Level)
253 {
254 
255     AcpiDmIndent (Level);
256     AcpiOsPrintf ("FixedIO (\n");
257 
258     AcpiDmIndent (Level + 1);
259     AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
260 
261     AcpiDmIndent (Level + 1);
262     AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
263 
264     /* Insert a descriptor name */
265 
266     AcpiDmIndent (Level + 1);
267     AcpiDmDescriptorName ();
268     AcpiOsPrintf (")\n");
269 }
270 
271 
272 /*******************************************************************************
273  *
274  * FUNCTION:    AcpiDmStartDependentDescriptor
275  *
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
280  *
281  * RETURN:      None
282  *
283  * DESCRIPTION: Decode a Start Dependendent functions descriptor
284  *
285  ******************************************************************************/
286 
287 void
AcpiDmStartDependentDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)288 AcpiDmStartDependentDescriptor (
289     ACPI_OP_WALK_INFO       *Info,
290     AML_RESOURCE            *Resource,
291     UINT32                  Length,
292     UINT32                  Level)
293 {
294 
295     AcpiDmIndent (Level);
296 
297     if (Length & 1)
298     {
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));
302     }
303     else
304     {
305         AcpiOsPrintf ("StartDependentFnNoPri ()\n");
306     }
307 
308     AcpiDmIndent (Level);
309     AcpiOsPrintf ("{\n");
310 }
311 
312 
313 /*******************************************************************************
314  *
315  * FUNCTION:    AcpiDmEndDependentDescriptor
316  *
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
321  *
322  * RETURN:      None
323  *
324  * DESCRIPTION: Decode an End Dependent functions descriptor
325  *
326  ******************************************************************************/
327 
328 void
AcpiDmEndDependentDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)329 AcpiDmEndDependentDescriptor (
330     ACPI_OP_WALK_INFO       *Info,
331     AML_RESOURCE            *Resource,
332     UINT32                  Length,
333     UINT32                  Level)
334 {
335 
336     AcpiDmIndent (Level);
337     AcpiOsPrintf ("}\n");
338     AcpiDmIndent (Level);
339     AcpiOsPrintf ("EndDependentFn ()\n");
340 }
341 
342 
343 /*******************************************************************************
344  *
345  * FUNCTION:    AcpiDmVendorSmallDescriptor
346  *
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
351  *
352  * RETURN:      None
353  *
354  * DESCRIPTION: Decode a Vendor Small Descriptor
355  *
356  ******************************************************************************/
357 
358 void
AcpiDmVendorSmallDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)359 AcpiDmVendorSmallDescriptor (
360     ACPI_OP_WALK_INFO       *Info,
361     AML_RESOURCE            *Resource,
362     UINT32                  Length,
363     UINT32                  Level)
364 {
365 
366     AcpiDmVendorCommon ("Short",
367         ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)),
368         Length, Level);
369 }
370