1ae115bc7Smrj /*******************************************************************************
2ae115bc7Smrj *
3ae115bc7Smrj * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
4ae115bc7Smrj *
5ae115bc7Smrj ******************************************************************************/
6ae115bc7Smrj
726f3cdf0SGordon Ross /*
8*385cc6b4SJerry Jelinek * Copyright (C) 2000 - 2016, Intel Corp.
9ae115bc7Smrj * All rights reserved.
10ae115bc7Smrj *
1126f3cdf0SGordon Ross * Redistribution and use in source and binary forms, with or without
1226f3cdf0SGordon Ross * modification, are permitted provided that the following conditions
1326f3cdf0SGordon Ross * are met:
1426f3cdf0SGordon Ross * 1. Redistributions of source code must retain the above copyright
1526f3cdf0SGordon Ross * notice, this list of conditions, and the following disclaimer,
1626f3cdf0SGordon Ross * without modification.
1726f3cdf0SGordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1826f3cdf0SGordon Ross * substantially similar to the "NO WARRANTY" disclaimer below
1926f3cdf0SGordon Ross * ("Disclaimer") and any redistribution must be conditioned upon
2026f3cdf0SGordon Ross * including a substantially similar Disclaimer requirement for further
2126f3cdf0SGordon Ross * binary redistribution.
2226f3cdf0SGordon Ross * 3. Neither the names of the above-listed copyright holders nor the names
2326f3cdf0SGordon Ross * of any contributors may be used to endorse or promote products derived
2426f3cdf0SGordon Ross * from this software without specific prior written permission.
25ae115bc7Smrj *
2626f3cdf0SGordon Ross * Alternatively, this software may be distributed under the terms of the
2726f3cdf0SGordon Ross * GNU General Public License ("GPL") version 2 as published by the Free
2826f3cdf0SGordon Ross * Software Foundation.
29ae115bc7Smrj *
3026f3cdf0SGordon Ross * NO WARRANTY
3126f3cdf0SGordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3226f3cdf0SGordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3326f3cdf0SGordon Ross * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3426f3cdf0SGordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3526f3cdf0SGordon Ross * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3626f3cdf0SGordon Ross * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3726f3cdf0SGordon Ross * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3826f3cdf0SGordon Ross * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3926f3cdf0SGordon Ross * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
4026f3cdf0SGordon Ross * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4126f3cdf0SGordon Ross * POSSIBILITY OF SUCH DAMAGES.
4226f3cdf0SGordon Ross */
43ae115bc7Smrj
44ae115bc7Smrj #include "acpi.h"
45aa2aa9a6SDana Myers #include "accommon.h"
46ae115bc7Smrj #include "acdisasm.h"
47ae115bc7Smrj
48ae115bc7Smrj
49ae115bc7Smrj #define _COMPONENT ACPI_CA_DEBUGGER
50ae115bc7Smrj ACPI_MODULE_NAME ("dbresrcs")
51ae115bc7Smrj
52ae115bc7Smrj
53ae115bc7Smrj /*******************************************************************************
54ae115bc7Smrj *
55ae115bc7Smrj * FUNCTION: AcpiDmIrqDescriptor
56ae115bc7Smrj *
57*385cc6b4SJerry Jelinek * PARAMETERS: Info - Extra resource info
58*385cc6b4SJerry Jelinek * Resource - Pointer to the resource descriptor
59ae115bc7Smrj * Length - Length of the descriptor in bytes
60ae115bc7Smrj * Level - Current source code indentation level
61ae115bc7Smrj *
62ae115bc7Smrj * RETURN: None
63ae115bc7Smrj *
64ae115bc7Smrj * DESCRIPTION: Decode a IRQ descriptor, either Irq() or IrqNoFlags()
65ae115bc7Smrj *
66ae115bc7Smrj ******************************************************************************/
67ae115bc7Smrj
68ae115bc7Smrj void
AcpiDmIrqDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)69ae115bc7Smrj AcpiDmIrqDescriptor (
70*385cc6b4SJerry Jelinek ACPI_OP_WALK_INFO *Info,
71ae115bc7Smrj AML_RESOURCE *Resource,
72ae115bc7Smrj UINT32 Length,
73ae115bc7Smrj UINT32 Level)
74ae115bc7Smrj {
75ae115bc7Smrj
76ae115bc7Smrj AcpiDmIndent (Level);
77ae115bc7Smrj AcpiOsPrintf ("%s (",
78*385cc6b4SJerry Jelinek AcpiGbl_IrqDecode [ACPI_GET_1BIT_FLAG (Length)]);
79ae115bc7Smrj
80ae115bc7Smrj /* Decode flags byte if present */
81ae115bc7Smrj
82ae115bc7Smrj if (Length & 1)
83ae115bc7Smrj {
84ae115bc7Smrj AcpiOsPrintf ("%s, %s, %s, ",
85*385cc6b4SJerry Jelinek AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Irq.Flags)],
86*385cc6b4SJerry Jelinek AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Irq.Flags, 3)],
87*385cc6b4SJerry Jelinek AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Irq.Flags, 4)]);
88ae115bc7Smrj }
89ae115bc7Smrj
90ae115bc7Smrj /* Insert a descriptor name */
91ae115bc7Smrj
92ae115bc7Smrj AcpiDmDescriptorName ();
93ae115bc7Smrj AcpiOsPrintf (")\n");
94ae115bc7Smrj
95ae115bc7Smrj AcpiDmIndent (Level + 1);
96ae115bc7Smrj AcpiDmBitList (Resource->Irq.IrqMask);
97ae115bc7Smrj }
98ae115bc7Smrj
99ae115bc7Smrj
100ae115bc7Smrj /*******************************************************************************
101ae115bc7Smrj *
102ae115bc7Smrj * FUNCTION: AcpiDmDmaDescriptor
103ae115bc7Smrj *
104*385cc6b4SJerry Jelinek * PARAMETERS: Info - Extra resource info
105*385cc6b4SJerry Jelinek * Resource - Pointer to the resource descriptor
106ae115bc7Smrj * Length - Length of the descriptor in bytes
107ae115bc7Smrj * Level - Current source code indentation level
108ae115bc7Smrj *
109ae115bc7Smrj * RETURN: None
110ae115bc7Smrj *
111ae115bc7Smrj * DESCRIPTION: Decode a DMA descriptor
112ae115bc7Smrj *
113ae115bc7Smrj ******************************************************************************/
114ae115bc7Smrj
115ae115bc7Smrj void
AcpiDmDmaDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)116ae115bc7Smrj AcpiDmDmaDescriptor (
117*385cc6b4SJerry Jelinek ACPI_OP_WALK_INFO *Info,
118ae115bc7Smrj AML_RESOURCE *Resource,
119ae115bc7Smrj UINT32 Length,
120ae115bc7Smrj UINT32 Level)
121ae115bc7Smrj {
122ae115bc7Smrj
123ae115bc7Smrj AcpiDmIndent (Level);
124ae115bc7Smrj AcpiOsPrintf ("DMA (%s, %s, %s, ",
125*385cc6b4SJerry Jelinek AcpiGbl_TypDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Dma.Flags, 5)],
126*385cc6b4SJerry Jelinek AcpiGbl_BmDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->Dma.Flags, 2)],
127*385cc6b4SJerry Jelinek AcpiGbl_SizDecode [ACPI_GET_2BIT_FLAG (Resource->Dma.Flags)]);
128ae115bc7Smrj
129ae115bc7Smrj /* Insert a descriptor name */
130ae115bc7Smrj
131ae115bc7Smrj AcpiDmDescriptorName ();
132ae115bc7Smrj AcpiOsPrintf (")\n");
133ae115bc7Smrj
134ae115bc7Smrj AcpiDmIndent (Level + 1);
135ae115bc7Smrj AcpiDmBitList (Resource->Dma.DmaChannelMask);
136ae115bc7Smrj }
137ae115bc7Smrj
138ae115bc7Smrj
139ae115bc7Smrj /*******************************************************************************
140ae115bc7Smrj *
141*385cc6b4SJerry Jelinek * FUNCTION: AcpiDmFixedDmaDescriptor
142*385cc6b4SJerry Jelinek *
143*385cc6b4SJerry Jelinek * PARAMETERS: Info - Extra resource info
144*385cc6b4SJerry Jelinek * Resource - Pointer to the resource descriptor
145*385cc6b4SJerry Jelinek * Length - Length of the descriptor in bytes
146*385cc6b4SJerry Jelinek * Level - Current source code indentation level
147*385cc6b4SJerry Jelinek *
148*385cc6b4SJerry Jelinek * RETURN: None
149*385cc6b4SJerry Jelinek *
150*385cc6b4SJerry Jelinek * DESCRIPTION: Decode a FixedDMA descriptor
151*385cc6b4SJerry Jelinek *
152*385cc6b4SJerry Jelinek ******************************************************************************/
153*385cc6b4SJerry Jelinek
154*385cc6b4SJerry Jelinek void
AcpiDmFixedDmaDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)155*385cc6b4SJerry Jelinek AcpiDmFixedDmaDescriptor (
156*385cc6b4SJerry Jelinek ACPI_OP_WALK_INFO *Info,
157*385cc6b4SJerry Jelinek AML_RESOURCE *Resource,
158*385cc6b4SJerry Jelinek UINT32 Length,
159*385cc6b4SJerry Jelinek UINT32 Level)
160*385cc6b4SJerry Jelinek {
161*385cc6b4SJerry Jelinek
162*385cc6b4SJerry Jelinek AcpiDmIndent (Level);
163*385cc6b4SJerry Jelinek AcpiOsPrintf ("FixedDMA (0x%4.4X, 0x%4.4X, ",
164*385cc6b4SJerry Jelinek Resource->FixedDma.RequestLines,
165*385cc6b4SJerry Jelinek Resource->FixedDma.Channels);
166*385cc6b4SJerry Jelinek
167*385cc6b4SJerry Jelinek if (Resource->FixedDma.Width <= 5)
168*385cc6b4SJerry Jelinek {
169*385cc6b4SJerry Jelinek AcpiOsPrintf ("%s, ",
170*385cc6b4SJerry Jelinek AcpiGbl_DtsDecode [Resource->FixedDma.Width]);
171*385cc6b4SJerry Jelinek }
172*385cc6b4SJerry Jelinek else
173*385cc6b4SJerry Jelinek {
174*385cc6b4SJerry Jelinek AcpiOsPrintf ("%X /* INVALID DMA WIDTH */, ",
175*385cc6b4SJerry Jelinek Resource->FixedDma.Width);
176*385cc6b4SJerry Jelinek }
177*385cc6b4SJerry Jelinek
178*385cc6b4SJerry Jelinek /* Insert a descriptor name */
179*385cc6b4SJerry Jelinek
180*385cc6b4SJerry Jelinek AcpiDmDescriptorName ();
181*385cc6b4SJerry Jelinek AcpiOsPrintf (")\n");
182*385cc6b4SJerry Jelinek }
183*385cc6b4SJerry Jelinek
184*385cc6b4SJerry Jelinek
185*385cc6b4SJerry Jelinek /*******************************************************************************
186*385cc6b4SJerry Jelinek *
187ae115bc7Smrj * FUNCTION: AcpiDmIoDescriptor
188ae115bc7Smrj *
189*385cc6b4SJerry Jelinek * PARAMETERS: Info - Extra resource info
190*385cc6b4SJerry Jelinek * Resource - Pointer to the resource descriptor
191ae115bc7Smrj * Length - Length of the descriptor in bytes
192ae115bc7Smrj * Level - Current source code indentation level
193ae115bc7Smrj *
194ae115bc7Smrj * RETURN: None
195ae115bc7Smrj *
196ae115bc7Smrj * DESCRIPTION: Decode an IO descriptor
197ae115bc7Smrj *
198ae115bc7Smrj ******************************************************************************/
199ae115bc7Smrj
200ae115bc7Smrj void
AcpiDmIoDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)201ae115bc7Smrj AcpiDmIoDescriptor (
202*385cc6b4SJerry Jelinek ACPI_OP_WALK_INFO *Info,
203ae115bc7Smrj AML_RESOURCE *Resource,
204ae115bc7Smrj UINT32 Length,
205ae115bc7Smrj UINT32 Level)
206ae115bc7Smrj {
207ae115bc7Smrj
208ae115bc7Smrj AcpiDmIndent (Level);
209ae115bc7Smrj AcpiOsPrintf ("IO (%s,\n",
210*385cc6b4SJerry Jelinek AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]);
211ae115bc7Smrj
212ae115bc7Smrj AcpiDmIndent (Level + 1);
213ae115bc7Smrj AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
214ae115bc7Smrj
215ae115bc7Smrj AcpiDmIndent (Level + 1);
216ae115bc7Smrj AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
217ae115bc7Smrj
218ae115bc7Smrj AcpiDmIndent (Level + 1);
219ae115bc7Smrj AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
220ae115bc7Smrj
221ae115bc7Smrj AcpiDmIndent (Level + 1);
222ae115bc7Smrj AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Length");
223ae115bc7Smrj
224ae115bc7Smrj /* Insert a descriptor name */
225ae115bc7Smrj
226ae115bc7Smrj AcpiDmIndent (Level + 1);
227ae115bc7Smrj AcpiDmDescriptorName ();
228ae115bc7Smrj AcpiOsPrintf (")\n");
229ae115bc7Smrj }
230ae115bc7Smrj
231ae115bc7Smrj
232ae115bc7Smrj /*******************************************************************************
233ae115bc7Smrj *
234ae115bc7Smrj * FUNCTION: AcpiDmFixedIoDescriptor
235ae115bc7Smrj *
236*385cc6b4SJerry Jelinek * PARAMETERS: Info - Extra resource info
237*385cc6b4SJerry Jelinek * Resource - Pointer to the resource descriptor
238ae115bc7Smrj * Length - Length of the descriptor in bytes
239ae115bc7Smrj * Level - Current source code indentation level
240ae115bc7Smrj *
241ae115bc7Smrj * RETURN: None
242ae115bc7Smrj *
243ae115bc7Smrj * DESCRIPTION: Decode a Fixed IO descriptor
244ae115bc7Smrj *
245ae115bc7Smrj ******************************************************************************/
246ae115bc7Smrj
247ae115bc7Smrj void
AcpiDmFixedIoDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)248ae115bc7Smrj AcpiDmFixedIoDescriptor (
249*385cc6b4SJerry Jelinek ACPI_OP_WALK_INFO *Info,
250ae115bc7Smrj AML_RESOURCE *Resource,
251ae115bc7Smrj UINT32 Length,
252ae115bc7Smrj UINT32 Level)
253ae115bc7Smrj {
254ae115bc7Smrj
255ae115bc7Smrj AcpiDmIndent (Level);
256ae115bc7Smrj AcpiOsPrintf ("FixedIO (\n");
257ae115bc7Smrj
258ae115bc7Smrj AcpiDmIndent (Level + 1);
259ae115bc7Smrj AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
260ae115bc7Smrj
261ae115bc7Smrj AcpiDmIndent (Level + 1);
262ae115bc7Smrj AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
263ae115bc7Smrj
264ae115bc7Smrj /* Insert a descriptor name */
265ae115bc7Smrj
266ae115bc7Smrj AcpiDmIndent (Level + 1);
267ae115bc7Smrj AcpiDmDescriptorName ();
268ae115bc7Smrj AcpiOsPrintf (")\n");
269ae115bc7Smrj }
270ae115bc7Smrj
271ae115bc7Smrj
272ae115bc7Smrj /*******************************************************************************
273ae115bc7Smrj *
274ae115bc7Smrj * FUNCTION: AcpiDmStartDependentDescriptor
275ae115bc7Smrj *
276*385cc6b4SJerry Jelinek * PARAMETERS: Info - Extra resource info
277*385cc6b4SJerry Jelinek * Resource - Pointer to the resource descriptor
278ae115bc7Smrj * Length - Length of the descriptor in bytes
279ae115bc7Smrj * Level - Current source code indentation level
280ae115bc7Smrj *
281ae115bc7Smrj * RETURN: None
282ae115bc7Smrj *
283ae115bc7Smrj * DESCRIPTION: Decode a Start Dependendent functions descriptor
284ae115bc7Smrj *
285ae115bc7Smrj ******************************************************************************/
286ae115bc7Smrj
287ae115bc7Smrj void
AcpiDmStartDependentDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)288ae115bc7Smrj AcpiDmStartDependentDescriptor (
289*385cc6b4SJerry Jelinek ACPI_OP_WALK_INFO *Info,
290ae115bc7Smrj AML_RESOURCE *Resource,
291ae115bc7Smrj UINT32 Length,
292ae115bc7Smrj UINT32 Level)
293ae115bc7Smrj {
294ae115bc7Smrj
295ae115bc7Smrj AcpiDmIndent (Level);
296ae115bc7Smrj
297ae115bc7Smrj if (Length & 1)
298ae115bc7Smrj {
299ae115bc7Smrj AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n",
300*385cc6b4SJerry Jelinek (UINT32) ACPI_GET_2BIT_FLAG (Resource->StartDpf.Flags),
301*385cc6b4SJerry Jelinek (UINT32) ACPI_EXTRACT_2BIT_FLAG (Resource->StartDpf.Flags, 2));
302ae115bc7Smrj }
303ae115bc7Smrj else
304ae115bc7Smrj {
305ae115bc7Smrj AcpiOsPrintf ("StartDependentFnNoPri ()\n");
306ae115bc7Smrj }
307ae115bc7Smrj
308ae115bc7Smrj AcpiDmIndent (Level);
309ae115bc7Smrj AcpiOsPrintf ("{\n");
310ae115bc7Smrj }
311ae115bc7Smrj
312ae115bc7Smrj
313ae115bc7Smrj /*******************************************************************************
314ae115bc7Smrj *
315ae115bc7Smrj * FUNCTION: AcpiDmEndDependentDescriptor
316ae115bc7Smrj *
317*385cc6b4SJerry Jelinek * PARAMETERS: Info - Extra resource info
318*385cc6b4SJerry Jelinek * Resource - Pointer to the resource descriptor
319ae115bc7Smrj * Length - Length of the descriptor in bytes
320ae115bc7Smrj * Level - Current source code indentation level
321ae115bc7Smrj *
322ae115bc7Smrj * RETURN: None
323ae115bc7Smrj *
324ae115bc7Smrj * DESCRIPTION: Decode an End Dependent functions descriptor
325ae115bc7Smrj *
326ae115bc7Smrj ******************************************************************************/
327ae115bc7Smrj
328ae115bc7Smrj void
AcpiDmEndDependentDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)329ae115bc7Smrj AcpiDmEndDependentDescriptor (
330*385cc6b4SJerry Jelinek ACPI_OP_WALK_INFO *Info,
331ae115bc7Smrj AML_RESOURCE *Resource,
332ae115bc7Smrj UINT32 Length,
333ae115bc7Smrj UINT32 Level)
334ae115bc7Smrj {
335ae115bc7Smrj
336ae115bc7Smrj AcpiDmIndent (Level);
337ae115bc7Smrj AcpiOsPrintf ("}\n");
338ae115bc7Smrj AcpiDmIndent (Level);
339ae115bc7Smrj AcpiOsPrintf ("EndDependentFn ()\n");
340ae115bc7Smrj }
341ae115bc7Smrj
342ae115bc7Smrj
343ae115bc7Smrj /*******************************************************************************
344ae115bc7Smrj *
345ae115bc7Smrj * FUNCTION: AcpiDmVendorSmallDescriptor
346ae115bc7Smrj *
347*385cc6b4SJerry Jelinek * PARAMETERS: Info - Extra resource info
348*385cc6b4SJerry Jelinek * Resource - Pointer to the resource descriptor
349ae115bc7Smrj * Length - Length of the descriptor in bytes
350ae115bc7Smrj * Level - Current source code indentation level
351ae115bc7Smrj *
352ae115bc7Smrj * RETURN: None
353ae115bc7Smrj *
354ae115bc7Smrj * DESCRIPTION: Decode a Vendor Small Descriptor
355ae115bc7Smrj *
356ae115bc7Smrj ******************************************************************************/
357ae115bc7Smrj
358ae115bc7Smrj void
AcpiDmVendorSmallDescriptor(ACPI_OP_WALK_INFO * Info,AML_RESOURCE * Resource,UINT32 Length,UINT32 Level)359ae115bc7Smrj AcpiDmVendorSmallDescriptor (
360*385cc6b4SJerry Jelinek ACPI_OP_WALK_INFO *Info,
361ae115bc7Smrj AML_RESOURCE *Resource,
362ae115bc7Smrj UINT32 Length,
363ae115bc7Smrj UINT32 Level)
364ae115bc7Smrj {
365ae115bc7Smrj
366ae115bc7Smrj AcpiDmVendorCommon ("Short",
367ae115bc7Smrj ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)),
368ae115bc7Smrj Length, Level);
369ae115bc7Smrj }
370