dmresrcs.c revision 151937
1210967Spjd/*******************************************************************************
2210967Spjd *
3210967Spjd * Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
4210967Spjd *              $Revision: 1.10 $
5210967Spjd *
6210967Spjd ******************************************************************************/
7210967Spjd
8210967Spjd/******************************************************************************
9210967Spjd *
10210967Spjd * 1. Copyright Notice
11210967Spjd *
12210967Spjd * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
13210967Spjd * All rights reserved.
14210967Spjd *
15210967Spjd * 2. License
16210967Spjd *
17210967Spjd * 2.1. This is your license from Intel Corp. under its intellectual property
18210967Spjd * rights.  You may have additional license terms from the party that provided
19210967Spjd * you this software, covering your right to use that party's intellectual
20210967Spjd * property rights.
21210967Spjd *
22210967Spjd * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23210967Spjd * copy of the source code appearing in this file ("Covered Code") an
24210967Spjd * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25210967Spjd * base code distributed originally by Intel ("Original Intel Code") to copy,
26210967Spjd * make derivatives, distribute, use and display any portion of the Covered
27210967Spjd * Code in any form, with the right to sublicense such rights; and
28210967Spjd *
29210967Spjd * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30210967Spjd * license (with the right to sublicense), under only those claims of Intel
31210967Spjd * patents that are infringed by the Original Intel Code, to make, use, sell,
32210967Spjd * offer to sell, and import the Covered Code and derivative works thereof
33210967Spjd * solely to the minimum extent necessary to exercise the above copyright
34210967Spjd * license, and in no event shall the patent license extend to any additions
35210967Spjd * to or modifications of the Original Intel Code.  No other license or right
36210967Spjd * is granted directly or by implication, estoppel or otherwise;
37210967Spjd *
38210967Spjd * The above copyright and patent license is granted only if the following
39210967Spjd * conditions are met:
40210967Spjd *
41210967Spjd * 3. Conditions
42210967Spjd *
43210967Spjd * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44210967Spjd * Redistribution of source code of any substantial portion of the Covered
45210967Spjd * Code or modification with rights to further distribute source must include
46210967Spjd * the above Copyright Notice, the above License, this list of Conditions,
47210967Spjd * and the following Disclaimer and Export Compliance provision.  In addition,
48210967Spjd * Licensee must cause all Covered Code to which Licensee contributes to
49210967Spjd * contain a file documenting the changes Licensee made to create that Covered
50210967Spjd * Code and the date of any change.  Licensee must include in that file the
51210967Spjd * documentation of any changes made by any predecessor Licensee.  Licensee
52210967Spjd * must include a prominent statement that the modification is derived,
53210967Spjd * directly or indirectly, from Original Intel Code.
54210967Spjd *
55210967Spjd * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56210967Spjd * Redistribution of source code of any substantial portion of the Covered
57210967Spjd * Code or modification without rights to further distribute source must
58210967Spjd * include the following Disclaimer and Export Compliance provision in the
59210967Spjd * documentation and/or other materials provided with distribution.  In
60210967Spjd * addition, Licensee may not authorize further sublicense of source of any
61210967Spjd * portion of the Covered Code, and must include terms to the effect that the
62210967Spjd * license from Licensee to its licensee is limited to the intellectual
63210967Spjd * property embodied in the software Licensee provides to its licensee, and
64210967Spjd * not to intellectual property embodied in modifications its licensee may
65210967Spjd * make.
66210967Spjd *
67210967Spjd * 3.3. Redistribution of Executable. Redistribution in executable form of any
68210967Spjd * substantial portion of the Covered Code or modification must reproduce the
69210967Spjd * above Copyright Notice, and the following Disclaimer and Export Compliance
70210967Spjd * provision in the documentation and/or other materials provided with the
71210967Spjd * distribution.
72210967Spjd *
73210967Spjd * 3.4. Intel retains all right, title, and interest in and to the Original
74210967Spjd * Intel Code.
75210967Spjd *
76210967Spjd * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77210967Spjd * Intel shall be used in advertising or otherwise to promote the sale, use or
78210967Spjd * other dealings in products derived from or relating to the Covered Code
79210967Spjd * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government.  In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117
118#include <contrib/dev/acpica/acpi.h>
119#include <contrib/dev/acpica/acdisasm.h>
120
121
122#ifdef ACPI_DISASSEMBLER
123
124#define _COMPONENT          ACPI_CA_DEBUGGER
125        ACPI_MODULE_NAME    ("dbresrcs")
126
127
128/*******************************************************************************
129 *
130 * FUNCTION:    AcpiDmIrqDescriptor
131 *
132 * PARAMETERS:  Resource            - Pointer to the resource descriptor
133 *              Length              - Length of the descriptor in bytes
134 *              Level               - Current source code indentation level
135 *
136 * RETURN:      None
137 *
138 * DESCRIPTION: Decode a IRQ descriptor, either Irq() or IrqNoFlags()
139 *
140 ******************************************************************************/
141
142void
143AcpiDmIrqDescriptor (
144    AML_RESOURCE            *Resource,
145    UINT32                  Length,
146    UINT32                  Level)
147{
148
149    AcpiDmIndent (Level);
150    AcpiOsPrintf ("%s (",
151        AcpiGbl_IrqDecode [Length & 1]);
152
153    /* Decode flags byte if present */
154
155    if (Length & 1)
156    {
157        AcpiOsPrintf ("%s, %s, %s",
158            AcpiGbl_HEDecode [Resource->Irq.Flags & 1],
159            AcpiGbl_LLDecode [(Resource->Irq.Flags >> 3) & 1],
160            AcpiGbl_SHRDecode [(Resource->Irq.Flags >> 4) & 1]);
161    }
162    AcpiOsPrintf (")\n");
163
164    AcpiDmIndent (Level + 1);
165    AcpiDmBitList (Resource->Irq.IrqMask);
166}
167
168
169/*******************************************************************************
170 *
171 * FUNCTION:    AcpiDmDmaDescriptor
172 *
173 * PARAMETERS:  Resource            - Pointer to the resource descriptor
174 *              Length              - Length of the descriptor in bytes
175 *              Level               - Current source code indentation level
176 *
177 * RETURN:      None
178 *
179 * DESCRIPTION: Decode a DMA descriptor
180 *
181 ******************************************************************************/
182
183void
184AcpiDmDmaDescriptor (
185    AML_RESOURCE            *Resource,
186    UINT32                  Length,
187    UINT32                  Level)
188{
189
190    AcpiDmIndent (Level);
191    AcpiOsPrintf ("DMA (%s, %s, %s)\n",
192            AcpiGbl_TYPDecode [(Resource->Dma.Flags >> 5) & 3],
193            AcpiGbl_BMDecode  [(Resource->Dma.Flags >> 2) & 1],
194            AcpiGbl_SIZDecode [(Resource->Dma.Flags >> 0) & 3]);
195
196    AcpiDmIndent (Level + 1);
197    AcpiDmBitList (Resource->Dma.DmaChannelMask);
198}
199
200
201/*******************************************************************************
202 *
203 * FUNCTION:    AcpiDmIoDescriptor
204 *
205 * PARAMETERS:  Resource            - Pointer to the resource descriptor
206 *              Length              - Length of the descriptor in bytes
207 *              Level               - Current source code indentation level
208 *
209 * RETURN:      None
210 *
211 * DESCRIPTION: Decode an IO descriptor
212 *
213 ******************************************************************************/
214
215void
216AcpiDmIoDescriptor (
217    AML_RESOURCE            *Resource,
218    UINT32                  Length,
219    UINT32                  Level)
220{
221
222    AcpiDmIndent (Level);
223    AcpiOsPrintf ("IO (%s,\n",
224        AcpiGbl_IoDecode [(Resource->Io.Flags & 1)]);
225
226    AcpiDmIndent (Level + 1);
227    AcpiDmDumpInteger16 (Resource->Io.Minimum, "Address Range Minimum");
228
229    AcpiDmIndent (Level + 1);
230    AcpiDmDumpInteger16 (Resource->Io.Maximum, "Address Range Maximum");
231
232    AcpiDmIndent (Level + 1);
233    AcpiDmDumpInteger8 (Resource->Io.Alignment, "Address Alignment");
234
235    AcpiDmIndent (Level + 1);
236    AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Address Length");
237
238    AcpiDmIndent (Level + 1);
239    AcpiOsPrintf (")\n");
240}
241
242
243/*******************************************************************************
244 *
245 * FUNCTION:    AcpiDmFixedIoDescriptor
246 *
247 * PARAMETERS:  Resource            - Pointer to the resource descriptor
248 *              Length              - Length of the descriptor in bytes
249 *              Level               - Current source code indentation level
250 *
251 * RETURN:      None
252 *
253 * DESCRIPTION: Decode a Fixed IO descriptor
254 *
255 ******************************************************************************/
256
257void
258AcpiDmFixedIoDescriptor (
259    AML_RESOURCE            *Resource,
260    UINT32                  Length,
261    UINT32                  Level)
262{
263
264    AcpiDmIndent (Level);
265    AcpiOsPrintf ("FixedIO (\n");
266
267    AcpiDmIndent (Level + 1);
268    AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address Base");
269
270    AcpiDmIndent (Level + 1);
271    AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Address Length");
272
273    AcpiDmIndent (Level + 1);
274    AcpiOsPrintf (")\n");
275}
276
277
278/*******************************************************************************
279 *
280 * FUNCTION:    AcpiDmStartDependentDescriptor
281 *
282 * PARAMETERS:  Resource            - Pointer to the resource descriptor
283 *              Length              - Length of the descriptor in bytes
284 *              Level               - Current source code indentation level
285 *
286 * RETURN:      None
287 *
288 * DESCRIPTION: Decode a Start Dependendent functions descriptor
289 *
290 ******************************************************************************/
291
292void
293AcpiDmStartDependentDescriptor (
294    AML_RESOURCE            *Resource,
295    UINT32                  Length,
296    UINT32                  Level)
297{
298
299    AcpiDmIndent (Level);
300
301    if (Length & 1)
302    {
303        AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n",
304            (UINT32) Resource->StartDpf.Flags & 3,
305            (UINT32) (Resource->StartDpf.Flags >> 2) & 3);
306    }
307    else
308    {
309        AcpiOsPrintf ("StartDependentFnNoPri ()\n");
310    }
311
312    AcpiDmIndent (Level);
313    AcpiOsPrintf ("{\n");
314}
315
316
317/*******************************************************************************
318 *
319 * FUNCTION:    AcpiDmEndDependentDescriptor
320 *
321 * PARAMETERS:  Resource            - Pointer to the resource descriptor
322 *              Length              - Length of the descriptor in bytes
323 *              Level               - Current source code indentation level
324 *
325 * RETURN:      None
326 *
327 * DESCRIPTION: Decode an End Dependent functions descriptor
328 *
329 ******************************************************************************/
330
331void
332AcpiDmEndDependentDescriptor (
333    AML_RESOURCE            *Resource,
334    UINT32                  Length,
335    UINT32                  Level)
336{
337
338    AcpiDmIndent (Level);
339    AcpiOsPrintf ("}\n");
340    AcpiDmIndent (Level);
341    AcpiOsPrintf ("EndDependentFn ()\n");
342}
343
344
345/*******************************************************************************
346 *
347 * FUNCTION:    AcpiDmVendorSmallDescriptor
348 *
349 * PARAMETERS:  Resource            - Pointer to the resource descriptor
350 *              Length              - Length of the descriptor in bytes
351 *              Level               - Current source code indentation level
352 *
353 * RETURN:      None
354 *
355 * DESCRIPTION: Decode a Vendor Small Descriptor
356 *
357 ******************************************************************************/
358
359void
360AcpiDmVendorSmallDescriptor (
361    AML_RESOURCE            *Resource,
362    UINT32                  Length,
363    UINT32                  Level)
364{
365
366    AcpiDmVendorCommon ("Short ()",
367        ((UINT8 *) Resource) + sizeof (AML_RESOURCE_SMALL_HEADER),
368        Length, Level);
369}
370
371#endif
372
373