dmresrcs.c revision 217365
1139823Simp/*******************************************************************************
225603Skjc *
325603Skjc * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
425603Skjc *
525603Skjc ******************************************************************************/
625603Skjc
725603Skjc/*
825603Skjc * Copyright (C) 2000 - 2011, Intel Corp.
925603Skjc * All rights reserved.
1025603Skjc *
1125603Skjc * Redistribution and use in source and binary forms, with or without
1225603Skjc * modification, are permitted provided that the following conditions
1325603Skjc * are met:
1425603Skjc * 1. Redistributions of source code must retain the above copyright
1525603Skjc *    notice, this list of conditions, and the following disclaimer,
1625603Skjc *    without modification.
1725603Skjc * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1825603Skjc *    substantially similar to the "NO WARRANTY" disclaimer below
1925603Skjc *    ("Disclaimer") and any redistribution must be conditioned upon
2025603Skjc *    including a substantially similar Disclaimer requirement for further
2125603Skjc *    binary redistribution.
2225603Skjc * 3. Neither the names of the above-listed copyright holders nor the names
2325603Skjc *    of any contributors may be used to endorse or promote products derived
2425603Skjc *    from this software without specific prior written permission.
2525603Skjc *
2625603Skjc * Alternatively, this software may be distributed under the terms of the
2725603Skjc * GNU General Public License ("GPL") version 2 as published by the Free
2825603Skjc * Software Foundation.
2925603Skjc *
30165900Srwatson * NO WARRANTY
31165900Srwatson * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3225603Skjc * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3325603Skjc * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3425603Skjc * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3525603Skjc * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3625603Skjc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3725603Skjc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38116189Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39116189Sobrien * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40116189Sobrien * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4125603Skjc * POSSIBILITY OF SUCH DAMAGES.
4225603Skjc */
4325603Skjc
4425603Skjc
4525603Skjc#include <contrib/dev/acpica/include/acpi.h>
4625603Skjc#include <contrib/dev/acpica/include/accommon.h>
4725603Skjc#include <contrib/dev/acpica/include/acdisasm.h>
4825603Skjc
49111888Sjlemon
5025603Skjc#ifdef ACPI_DISASSEMBLER
5125603Skjc
5225603Skjc#define _COMPONENT          ACPI_CA_DEBUGGER
5325603Skjc        ACPI_MODULE_NAME    ("dbresrcs")
5425603Skjc
5592745Salfred
5625603Skjc/*******************************************************************************
57149848Sobrien *
58149848Sobrien * FUNCTION:    AcpiDmIrqDescriptor
5933181Seivind *
60152242Sru * PARAMETERS:  Resource            - Pointer to the resource descriptor
61152242Sru *              Length              - Length of the descriptor in bytes
62152242Sru *              Level               - Current source code indentation level
63152242Sru *
64152242Sru * RETURN:      None
65152242Sru *
6625603Skjc * DESCRIPTION: Decode a IRQ descriptor, either Irq() or IrqNoFlags()
67152242Sru *
68152242Sru ******************************************************************************/
69152242Sru
70152242Sruvoid
71152242SruAcpiDmIrqDescriptor (
72152242Sru    AML_RESOURCE            *Resource,
7325603Skjc    UINT32                  Length,
74152242Sru    UINT32                  Level)
75152242Sru{
76152242Sru
77152242Sru    AcpiDmIndent (Level);
78152242Sru    AcpiOsPrintf ("%s (",
79152242Sru        AcpiGbl_IrqDecode [Length & 1]);
8025603Skjc
8125603Skjc    /* Decode flags byte if present */
8225603Skjc
83152242Sru    if (Length & 1)
84152242Sru    {
85152242Sru        AcpiOsPrintf ("%s, %s, %s, ",
86152242Sru            AcpiGbl_HeDecode [Resource->Irq.Flags & 1],
87152242Sru            AcpiGbl_LlDecode [(Resource->Irq.Flags >> 3) & 1],
88152242Sru            AcpiGbl_ShrDecode [(Resource->Irq.Flags >> 4) & 1]);
89152242Sru    }
9025603Skjc
91193219Srwatson    /* Insert a descriptor name */
92193219Srwatson
93193219Srwatson    AcpiDmDescriptorName ();
94193219Srwatson    AcpiOsPrintf (")\n");
95193219Srwatson
96193219Srwatson    AcpiDmIndent (Level + 1);
97193219Srwatson    AcpiDmBitList (Resource->Irq.IrqMask);
98193219Srwatson}
9925603Skjc
100118541Sharti
101118541Sharti/*******************************************************************************
102118541Sharti *
103118541Sharti * FUNCTION:    AcpiDmDmaDescriptor
10425603Skjc *
10525603Skjc * PARAMETERS:  Resource            - Pointer to the resource descriptor
106118541Sharti *              Length              - Length of the descriptor in bytes
107118541Sharti *              Level               - Current source code indentation level
10825603Skjc *
109118541Sharti * RETURN:      None
110148125Srwatson *
111193219Srwatson * DESCRIPTION: Decode a DMA descriptor
11225603Skjc *
11325603Skjc ******************************************************************************/
11425603Skjc
115void
116AcpiDmDmaDescriptor (
117    AML_RESOURCE            *Resource,
118    UINT32                  Length,
119    UINT32                  Level)
120{
121
122    AcpiDmIndent (Level);
123    AcpiOsPrintf ("DMA (%s, %s, %s, ",
124            AcpiGbl_TypDecode [(Resource->Dma.Flags >> 5) & 3],
125            AcpiGbl_BmDecode  [(Resource->Dma.Flags >> 2) & 1],
126            AcpiGbl_SizDecode [(Resource->Dma.Flags >> 0) & 3]);
127
128    /* Insert a descriptor name */
129
130    AcpiDmDescriptorName ();
131    AcpiOsPrintf (")\n");
132
133    AcpiDmIndent (Level + 1);
134    AcpiDmBitList (Resource->Dma.DmaChannelMask);
135}
136
137
138/*******************************************************************************
139 *
140 * FUNCTION:    AcpiDmIoDescriptor
141 *
142 * PARAMETERS:  Resource            - Pointer to the resource descriptor
143 *              Length              - Length of the descriptor in bytes
144 *              Level               - Current source code indentation level
145 *
146 * RETURN:      None
147 *
148 * DESCRIPTION: Decode an IO descriptor
149 *
150 ******************************************************************************/
151
152void
153AcpiDmIoDescriptor (
154    AML_RESOURCE            *Resource,
155    UINT32                  Length,
156    UINT32                  Level)
157{
158
159    AcpiDmIndent (Level);
160    AcpiOsPrintf ("IO (%s,\n",
161        AcpiGbl_IoDecode [(Resource->Io.Flags & 1)]);
162
163    AcpiDmIndent (Level + 1);
164    AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
165
166    AcpiDmIndent (Level + 1);
167    AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
168
169    AcpiDmIndent (Level + 1);
170    AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
171
172    AcpiDmIndent (Level + 1);
173    AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Length");
174
175    /* Insert a descriptor name */
176
177    AcpiDmIndent (Level + 1);
178    AcpiDmDescriptorName ();
179    AcpiOsPrintf (")\n");
180}
181
182
183/*******************************************************************************
184 *
185 * FUNCTION:    AcpiDmFixedIoDescriptor
186 *
187 * PARAMETERS:  Resource            - Pointer to the resource descriptor
188 *              Length              - Length of the descriptor in bytes
189 *              Level               - Current source code indentation level
190 *
191 * RETURN:      None
192 *
193 * DESCRIPTION: Decode a Fixed IO descriptor
194 *
195 ******************************************************************************/
196
197void
198AcpiDmFixedIoDescriptor (
199    AML_RESOURCE            *Resource,
200    UINT32                  Length,
201    UINT32                  Level)
202{
203
204    AcpiDmIndent (Level);
205    AcpiOsPrintf ("FixedIO (\n");
206
207    AcpiDmIndent (Level + 1);
208    AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
209
210    AcpiDmIndent (Level + 1);
211    AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
212
213    /* Insert a descriptor name */
214
215    AcpiDmIndent (Level + 1);
216    AcpiDmDescriptorName ();
217    AcpiOsPrintf (")\n");
218}
219
220
221/*******************************************************************************
222 *
223 * FUNCTION:    AcpiDmStartDependentDescriptor
224 *
225 * PARAMETERS:  Resource            - Pointer to the resource descriptor
226 *              Length              - Length of the descriptor in bytes
227 *              Level               - Current source code indentation level
228 *
229 * RETURN:      None
230 *
231 * DESCRIPTION: Decode a Start Dependendent functions descriptor
232 *
233 ******************************************************************************/
234
235void
236AcpiDmStartDependentDescriptor (
237    AML_RESOURCE            *Resource,
238    UINT32                  Length,
239    UINT32                  Level)
240{
241
242    AcpiDmIndent (Level);
243
244    if (Length & 1)
245    {
246        AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n",
247            (UINT32) Resource->StartDpf.Flags & 3,
248            (UINT32) (Resource->StartDpf.Flags >> 2) & 3);
249    }
250    else
251    {
252        AcpiOsPrintf ("StartDependentFnNoPri ()\n");
253    }
254
255    AcpiDmIndent (Level);
256    AcpiOsPrintf ("{\n");
257}
258
259
260/*******************************************************************************
261 *
262 * FUNCTION:    AcpiDmEndDependentDescriptor
263 *
264 * PARAMETERS:  Resource            - Pointer to the resource descriptor
265 *              Length              - Length of the descriptor in bytes
266 *              Level               - Current source code indentation level
267 *
268 * RETURN:      None
269 *
270 * DESCRIPTION: Decode an End Dependent functions descriptor
271 *
272 ******************************************************************************/
273
274void
275AcpiDmEndDependentDescriptor (
276    AML_RESOURCE            *Resource,
277    UINT32                  Length,
278    UINT32                  Level)
279{
280
281    AcpiDmIndent (Level);
282    AcpiOsPrintf ("}\n");
283    AcpiDmIndent (Level);
284    AcpiOsPrintf ("EndDependentFn ()\n");
285}
286
287
288/*******************************************************************************
289 *
290 * FUNCTION:    AcpiDmVendorSmallDescriptor
291 *
292 * PARAMETERS:  Resource            - Pointer to the resource descriptor
293 *              Length              - Length of the descriptor in bytes
294 *              Level               - Current source code indentation level
295 *
296 * RETURN:      None
297 *
298 * DESCRIPTION: Decode a Vendor Small Descriptor
299 *
300 ******************************************************************************/
301
302void
303AcpiDmVendorSmallDescriptor (
304    AML_RESOURCE            *Resource,
305    UINT32                  Length,
306    UINT32                  Level)
307{
308
309    AcpiDmVendorCommon ("Short",
310        ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)),
311        Length, Level);
312}
313
314#endif
315
316