1100966Siwasaki/*******************************************************************************
2100966Siwasaki *
3100966Siwasaki * Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
4100966Siwasaki *
5100966Siwasaki ******************************************************************************/
6100966Siwasaki
7316303Sjkim/******************************************************************************
8316303Sjkim *
9316303Sjkim * 1. Copyright Notice
10316303Sjkim *
11316303Sjkim * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
12100966Siwasaki * All rights reserved.
13100966Siwasaki *
14316303Sjkim * 2. License
15316303Sjkim *
16316303Sjkim * 2.1. This is your license from Intel Corp. under its intellectual property
17316303Sjkim * rights. You may have additional license terms from the party that provided
18316303Sjkim * you this software, covering your right to use that party's intellectual
19316303Sjkim * property rights.
20316303Sjkim *
21316303Sjkim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22316303Sjkim * copy of the source code appearing in this file ("Covered Code") an
23316303Sjkim * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24316303Sjkim * base code distributed originally by Intel ("Original Intel Code") to copy,
25316303Sjkim * make derivatives, distribute, use and display any portion of the Covered
26316303Sjkim * Code in any form, with the right to sublicense such rights; and
27316303Sjkim *
28316303Sjkim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29316303Sjkim * license (with the right to sublicense), under only those claims of Intel
30316303Sjkim * patents that are infringed by the Original Intel Code, to make, use, sell,
31316303Sjkim * offer to sell, and import the Covered Code and derivative works thereof
32316303Sjkim * solely to the minimum extent necessary to exercise the above copyright
33316303Sjkim * license, and in no event shall the patent license extend to any additions
34316303Sjkim * to or modifications of the Original Intel Code. No other license or right
35316303Sjkim * is granted directly or by implication, estoppel or otherwise;
36316303Sjkim *
37316303Sjkim * The above copyright and patent license is granted only if the following
38316303Sjkim * conditions are met:
39316303Sjkim *
40316303Sjkim * 3. Conditions
41316303Sjkim *
42316303Sjkim * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43316303Sjkim * Redistribution of source code of any substantial portion of the Covered
44316303Sjkim * Code or modification with rights to further distribute source must include
45316303Sjkim * the above Copyright Notice, the above License, this list of Conditions,
46316303Sjkim * and the following Disclaimer and Export Compliance provision. In addition,
47316303Sjkim * Licensee must cause all Covered Code to which Licensee contributes to
48316303Sjkim * contain a file documenting the changes Licensee made to create that Covered
49316303Sjkim * Code and the date of any change. Licensee must include in that file the
50316303Sjkim * documentation of any changes made by any predecessor Licensee. Licensee
51316303Sjkim * must include a prominent statement that the modification is derived,
52316303Sjkim * directly or indirectly, from Original Intel Code.
53316303Sjkim *
54316303Sjkim * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55316303Sjkim * Redistribution of source code of any substantial portion of the Covered
56316303Sjkim * Code or modification without rights to further distribute source must
57316303Sjkim * include the following Disclaimer and Export Compliance provision in the
58316303Sjkim * documentation and/or other materials provided with distribution. In
59316303Sjkim * addition, Licensee may not authorize further sublicense of source of any
60316303Sjkim * portion of the Covered Code, and must include terms to the effect that the
61316303Sjkim * license from Licensee to its licensee is limited to the intellectual
62316303Sjkim * property embodied in the software Licensee provides to its licensee, and
63316303Sjkim * not to intellectual property embodied in modifications its licensee may
64316303Sjkim * make.
65316303Sjkim *
66316303Sjkim * 3.3. Redistribution of Executable. Redistribution in executable form of any
67316303Sjkim * substantial portion of the Covered Code or modification must reproduce the
68316303Sjkim * above Copyright Notice, and the following Disclaimer and Export Compliance
69316303Sjkim * provision in the documentation and/or other materials provided with the
70316303Sjkim * distribution.
71316303Sjkim *
72316303Sjkim * 3.4. Intel retains all right, title, and interest in and to the Original
73316303Sjkim * Intel Code.
74316303Sjkim *
75316303Sjkim * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76316303Sjkim * Intel shall be used in advertising or otherwise to promote the sale, use or
77316303Sjkim * other dealings in products derived from or relating to the Covered Code
78316303Sjkim * without prior written authorization from Intel.
79316303Sjkim *
80316303Sjkim * 4. Disclaimer and Export Compliance
81316303Sjkim *
82316303Sjkim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83316303Sjkim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84316303Sjkim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85316303Sjkim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86316303Sjkim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87316303Sjkim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88316303Sjkim * PARTICULAR PURPOSE.
89316303Sjkim *
90316303Sjkim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91316303Sjkim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92316303Sjkim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93316303Sjkim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94316303Sjkim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95316303Sjkim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96316303Sjkim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97316303Sjkim * LIMITED REMEDY.
98316303Sjkim *
99316303Sjkim * 4.3. Licensee shall not export, either directly or indirectly, any of this
100316303Sjkim * software or system incorporating such software without first obtaining any
101316303Sjkim * required license or other approval from the U. S. Department of Commerce or
102316303Sjkim * any other agency or department of the United States Government. In the
103316303Sjkim * event Licensee exports any such software from the United States or
104316303Sjkim * re-exports any such software from a foreign destination, Licensee shall
105316303Sjkim * ensure that the distribution and export/re-export of the software is in
106316303Sjkim * compliance with all laws, regulations, orders, or other restrictions of the
107316303Sjkim * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108316303Sjkim * any of its subsidiaries will export/re-export any technical data, process,
109316303Sjkim * software, or service, directly or indirectly, to any country for which the
110316303Sjkim * United States government or any agency thereof requires an export license,
111316303Sjkim * other governmental approval, or letter of assurance, without first obtaining
112316303Sjkim * such license, approval or letter.
113316303Sjkim *
114316303Sjkim *****************************************************************************
115316303Sjkim *
116316303Sjkim * Alternatively, you may choose to be licensed under the terms of the
117316303Sjkim * following license:
118316303Sjkim *
119217365Sjkim * Redistribution and use in source and binary forms, with or without
120217365Sjkim * modification, are permitted provided that the following conditions
121217365Sjkim * are met:
122217365Sjkim * 1. Redistributions of source code must retain the above copyright
123217365Sjkim *    notice, this list of conditions, and the following disclaimer,
124217365Sjkim *    without modification.
125217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126217365Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
127217365Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
128217365Sjkim *    including a substantially similar Disclaimer requirement for further
129217365Sjkim *    binary redistribution.
130217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
131217365Sjkim *    of any contributors may be used to endorse or promote products derived
132217365Sjkim *    from this software without specific prior written permission.
133100966Siwasaki *
134316303Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135316303Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136316303Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137316303Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138316303Sjkim * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139316303Sjkim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140316303Sjkim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141316303Sjkim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142316303Sjkim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143316303Sjkim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144316303Sjkim * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145316303Sjkim *
146316303Sjkim * Alternatively, you may choose to be licensed under the terms of the
147217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
148217365Sjkim * Software Foundation.
149100966Siwasaki *
150316303Sjkim *****************************************************************************/
151100966Siwasaki
152193341Sjkim#include <contrib/dev/acpica/include/acpi.h>
153193341Sjkim#include <contrib/dev/acpica/include/accommon.h>
154193341Sjkim#include <contrib/dev/acpica/include/acdisasm.h>
155100966Siwasaki
156100966Siwasaki
157102550Siwasaki#define _COMPONENT          ACPI_CA_DEBUGGER
158100966Siwasaki        ACPI_MODULE_NAME    ("dbresrcl")
159100966Siwasaki
160100966Siwasaki
161151937Sjkim/* Common names for address and memory descriptors */
162151937Sjkim
163298714Sjkimstatic const char           *AcpiDmAddressNames[] =
164151937Sjkim{
165167802Sjkim    "Granularity",
166167802Sjkim    "Range Minimum",
167167802Sjkim    "Range Maximum",
168167802Sjkim    "Translation Offset",
169167802Sjkim    "Length"
170151937Sjkim};
171151937Sjkim
172298714Sjkimstatic const char           *AcpiDmMemoryNames[] =
173151937Sjkim{
174167802Sjkim    "Range Minimum",
175167802Sjkim    "Range Maximum",
176167802Sjkim    "Alignment",
177167802Sjkim    "Length"
178151937Sjkim};
179151937Sjkim
180151937Sjkim
181151937Sjkim/* Local prototypes */
182151937Sjkim
183151937Sjkimstatic void
184151937SjkimAcpiDmSpaceFlags (
185151937Sjkim        UINT8               Flags);
186151937Sjkim
187151937Sjkimstatic void
188151937SjkimAcpiDmIoFlags (
189151937Sjkim        UINT8               Flags);
190151937Sjkim
191151937Sjkimstatic void
192151937SjkimAcpiDmIoFlags2 (
193151937Sjkim        UINT8               SpecificFlags);
194151937Sjkim
195151937Sjkimstatic void
196151937SjkimAcpiDmMemoryFlags (
197151937Sjkim    UINT8                   Flags,
198151937Sjkim    UINT8                   SpecificFlags);
199151937Sjkim
200151937Sjkimstatic void
201151937SjkimAcpiDmMemoryFlags2 (
202151937Sjkim    UINT8                   SpecificFlags);
203151937Sjkim
204151937Sjkimstatic void
205151937SjkimAcpiDmResourceSource (
206151937Sjkim    AML_RESOURCE            *Resource,
207151937Sjkim    ACPI_SIZE               MinimumLength,
208151937Sjkim    UINT32                  Length);
209151937Sjkim
210151937Sjkimstatic void
211151937SjkimAcpiDmAddressFields (
212151937Sjkim    void                    *Source,
213151937Sjkim    UINT8                   Type,
214151937Sjkim    UINT32                  Level);
215151937Sjkim
216151937Sjkimstatic void
217151937SjkimAcpiDmAddressPrefix (
218151937Sjkim    UINT8                   Type);
219151937Sjkim
220151937Sjkimstatic void
221151937SjkimAcpiDmAddressCommon (
222151937Sjkim    AML_RESOURCE            *Resource,
223151937Sjkim    UINT8                   Type,
224151937Sjkim    UINT32                  Level);
225151937Sjkim
226151937Sjkimstatic void
227151937SjkimAcpiDmAddressFlags (
228151937Sjkim    AML_RESOURCE            *Resource);
229151937Sjkim
230151937Sjkim
231100966Siwasaki/*******************************************************************************
232100966Siwasaki *
233151937Sjkim * FUNCTION:    AcpiDmMemoryFields
234151937Sjkim *
235151937Sjkim * PARAMETERS:  Source              - Pointer to the contiguous data fields
236151937Sjkim *              Type                - 16 or 32 (bit)
237151937Sjkim *              Level               - Current source code indentation level
238151937Sjkim *
239151937Sjkim * RETURN:      None
240151937Sjkim *
241151937Sjkim * DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors
242151937Sjkim *
243151937Sjkim ******************************************************************************/
244151937Sjkim
245151937Sjkimstatic void
246151937SjkimAcpiDmMemoryFields (
247151937Sjkim    void                    *Source,
248151937Sjkim    UINT8                   Type,
249151937Sjkim    UINT32                  Level)
250151937Sjkim{
251193267Sjkim    UINT32                  i;
252151937Sjkim
253151937Sjkim
254151937Sjkim    for (i = 0; i < 4; i++)
255151937Sjkim    {
256151937Sjkim        AcpiDmIndent (Level + 1);
257151937Sjkim
258151937Sjkim        switch (Type)
259151937Sjkim        {
260151937Sjkim        case 16:
261250838Sjkim
262167802Sjkim            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
263167802Sjkim                AcpiDmMemoryNames[i]);
264151937Sjkim            break;
265151937Sjkim
266151937Sjkim        case 32:
267250838Sjkim
268167802Sjkim            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
269167802Sjkim                AcpiDmMemoryNames[i]);
270151937Sjkim            break;
271151937Sjkim
272151937Sjkim        default:
273250838Sjkim
274151937Sjkim            return;
275151937Sjkim        }
276151937Sjkim    }
277151937Sjkim}
278151937Sjkim
279151937Sjkim
280151937Sjkim/*******************************************************************************
281151937Sjkim *
282167802Sjkim * FUNCTION:    AcpiDmAddressFields
283151937Sjkim *
284151937Sjkim * PARAMETERS:  Source              - Pointer to the contiguous data fields
285151937Sjkim *              Type                - 16, 32, or 64 (bit)
286151937Sjkim *              Level               - Current source code indentation level
287151937Sjkim *
288151937Sjkim * RETURN:      None
289151937Sjkim *
290151937Sjkim * DESCRIPTION: Decode fields common to address descriptors
291151937Sjkim *
292151937Sjkim ******************************************************************************/
293151937Sjkim
294151937Sjkimstatic void
295151937SjkimAcpiDmAddressFields (
296151937Sjkim    void                    *Source,
297151937Sjkim    UINT8                   Type,
298151937Sjkim    UINT32                  Level)
299151937Sjkim{
300193267Sjkim    UINT32                  i;
301151937Sjkim
302151937Sjkim
303151937Sjkim    AcpiOsPrintf ("\n");
304151937Sjkim
305151937Sjkim    for (i = 0; i < 5; i++)
306151937Sjkim    {
307151937Sjkim        AcpiDmIndent (Level + 1);
308151937Sjkim
309151937Sjkim        switch (Type)
310151937Sjkim        {
311151937Sjkim        case 16:
312250838Sjkim
313167802Sjkim            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
314167802Sjkim                AcpiDmAddressNames[i]);
315151937Sjkim            break;
316151937Sjkim
317151937Sjkim        case 32:
318250838Sjkim
319167802Sjkim            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
320167802Sjkim                AcpiDmAddressNames[i]);
321151937Sjkim            break;
322151937Sjkim
323151937Sjkim        case 64:
324250838Sjkim
325167802Sjkim            AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
326167802Sjkim                AcpiDmAddressNames[i]);
327151937Sjkim            break;
328151937Sjkim
329151937Sjkim        default:
330250838Sjkim
331151937Sjkim            return;
332151937Sjkim        }
333151937Sjkim    }
334151937Sjkim}
335151937Sjkim
336151937Sjkim
337151937Sjkim/*******************************************************************************
338151937Sjkim *
339151937Sjkim * FUNCTION:    AcpiDmAddressPrefix
340151937Sjkim *
341151937Sjkim * PARAMETERS:  Type                - Descriptor type
342151937Sjkim *
343151937Sjkim * RETURN:      None
344151937Sjkim *
345151937Sjkim * DESCRIPTION: Emit name prefix representing the address descriptor type
346151937Sjkim *
347151937Sjkim ******************************************************************************/
348151937Sjkim
349151937Sjkimstatic void
350151937SjkimAcpiDmAddressPrefix (
351151937Sjkim    UINT8                   Type)
352151937Sjkim{
353151937Sjkim
354151937Sjkim    switch (Type)
355151937Sjkim    {
356151937Sjkim    case ACPI_RESOURCE_TYPE_ADDRESS16:
357250838Sjkim
358151937Sjkim        AcpiOsPrintf ("Word");
359151937Sjkim        break;
360151937Sjkim
361151937Sjkim    case ACPI_RESOURCE_TYPE_ADDRESS32:
362250838Sjkim
363151937Sjkim        AcpiOsPrintf ("DWord");
364151937Sjkim        break;
365151937Sjkim
366151937Sjkim    case ACPI_RESOURCE_TYPE_ADDRESS64:
367250838Sjkim
368151937Sjkim        AcpiOsPrintf ("QWord");
369151937Sjkim        break;
370151937Sjkim
371151937Sjkim    case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
372250838Sjkim
373151937Sjkim        AcpiOsPrintf ("Extended");
374151937Sjkim        break;
375151937Sjkim
376151937Sjkim    default:
377250838Sjkim
378151937Sjkim        return;
379151937Sjkim    }
380151937Sjkim}
381151937Sjkim
382151937Sjkim
383151937Sjkim/*******************************************************************************
384151937Sjkim *
385151937Sjkim * FUNCTION:    AcpiDmAddressCommon
386151937Sjkim *
387151937Sjkim * PARAMETERS:  Resource            - Raw AML descriptor
388151937Sjkim *              Type                - Descriptor type
389151937Sjkim *              Level               - Current source code indentation level
390151937Sjkim *
391151937Sjkim * RETURN:      None
392151937Sjkim *
393151937Sjkim * DESCRIPTION: Emit common name and flag fields common to address descriptors
394151937Sjkim *
395151937Sjkim ******************************************************************************/
396151937Sjkim
397151937Sjkimstatic void
398151937SjkimAcpiDmAddressCommon (
399151937Sjkim    AML_RESOURCE            *Resource,
400151937Sjkim    UINT8                   Type,
401151937Sjkim    UINT32                  Level)
402151937Sjkim{
403151937Sjkim    UINT8                   ResourceType;
404151937Sjkim    UINT8                   SpecificFlags;
405151937Sjkim    UINT8                   Flags;
406151937Sjkim
407151937Sjkim
408151937Sjkim    ResourceType = Resource->Address.ResourceType;
409151937Sjkim    SpecificFlags = Resource->Address.SpecificFlags;
410151937Sjkim    Flags = Resource->Address.Flags;
411151937Sjkim
412151937Sjkim    AcpiDmIndent (Level);
413151937Sjkim
414151937Sjkim    /* Validate ResourceType */
415151937Sjkim
416151937Sjkim    if ((ResourceType > 2) && (ResourceType < 0xC0))
417151937Sjkim    {
418298714Sjkim        AcpiOsPrintf (
419298714Sjkim            "/**** Invalid Resource Type: 0x%X ****/", ResourceType);
420151937Sjkim        return;
421151937Sjkim    }
422151937Sjkim
423151937Sjkim    /* Prefix is either Word, DWord, QWord, or Extended */
424151937Sjkim
425151937Sjkim    AcpiDmAddressPrefix (Type);
426151937Sjkim
427151937Sjkim    /* Resource Types above 0xC0 are vendor-defined */
428151937Sjkim
429151937Sjkim    if (ResourceType > 2)
430151937Sjkim    {
431151937Sjkim        AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);
432151937Sjkim        AcpiDmSpaceFlags (Flags);
433151937Sjkim        AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);
434151937Sjkim        return;
435151937Sjkim    }
436151937Sjkim
437151937Sjkim    /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
438151937Sjkim
439298714Sjkim    AcpiOsPrintf ("%s (",
440298714Sjkim        AcpiGbl_WordDecode [ACPI_GET_2BIT_FLAG (ResourceType)]);
441151937Sjkim
442151937Sjkim    /* Decode the general and type-specific flags */
443151937Sjkim
444151937Sjkim    if (ResourceType == ACPI_MEMORY_RANGE)
445151937Sjkim    {
446151937Sjkim        AcpiDmMemoryFlags (Flags, SpecificFlags);
447151937Sjkim    }
448151937Sjkim    else /* IO range or BusNumberRange */
449151937Sjkim    {
450151937Sjkim        AcpiDmIoFlags (Flags);
451151937Sjkim        if (ResourceType == ACPI_IO_RANGE)
452151937Sjkim        {
453298714Sjkim            AcpiOsPrintf (" %s,",
454298714Sjkim                AcpiGbl_RngDecode [ACPI_GET_2BIT_FLAG (SpecificFlags)]);
455151937Sjkim        }
456151937Sjkim    }
457151937Sjkim}
458151937Sjkim
459151937Sjkim
460151937Sjkim/*******************************************************************************
461151937Sjkim *
462151937Sjkim * FUNCTION:    AcpiDmAddressFlags
463151937Sjkim *
464151937Sjkim * PARAMETERS:  Resource        - Raw AML descriptor
465151937Sjkim *
466151937Sjkim * RETURN:      None
467151937Sjkim *
468151937Sjkim * DESCRIPTION: Emit flags common to address descriptors
469151937Sjkim *
470151937Sjkim ******************************************************************************/
471151937Sjkim
472151937Sjkimstatic void
473151937SjkimAcpiDmAddressFlags (
474151937Sjkim    AML_RESOURCE            *Resource)
475151937Sjkim{
476151937Sjkim
477151937Sjkim    if (Resource->Address.ResourceType == ACPI_IO_RANGE)
478151937Sjkim    {
479151937Sjkim        AcpiDmIoFlags2 (Resource->Address.SpecificFlags);
480151937Sjkim    }
481151937Sjkim    else if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE)
482151937Sjkim    {
483151937Sjkim        AcpiDmMemoryFlags2 (Resource->Address.SpecificFlags);
484151937Sjkim    }
485151937Sjkim}
486151937Sjkim
487151937Sjkim
488151937Sjkim/*******************************************************************************
489151937Sjkim *
490151937Sjkim * FUNCTION:    AcpiDmSpaceFlags
491151937Sjkim *
492151937Sjkim * PARAMETERS:  Flags               - Flag byte to be decoded
493151937Sjkim *
494151937Sjkim * RETURN:      None
495151937Sjkim *
496151937Sjkim * DESCRIPTION: Decode the flags specific to Space Address space descriptors
497151937Sjkim *
498151937Sjkim ******************************************************************************/
499151937Sjkim
500151937Sjkimstatic void
501151937SjkimAcpiDmSpaceFlags (
502151937Sjkim    UINT8                   Flags)
503151937Sjkim{
504151937Sjkim
505151937Sjkim    AcpiOsPrintf ("%s, %s, %s, %s,",
506243347Sjkim        AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
507243347Sjkim        AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
508243347Sjkim        AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
509243347Sjkim        AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)]);
510151937Sjkim}
511151937Sjkim
512151937Sjkim
513151937Sjkim/*******************************************************************************
514151937Sjkim *
515100966Siwasaki * FUNCTION:    AcpiDmIoFlags
516100966Siwasaki *
517100966Siwasaki * PARAMETERS:  Flags               - Flag byte to be decoded
518100966Siwasaki *
519100966Siwasaki * RETURN:      None
520100966Siwasaki *
521100966Siwasaki * DESCRIPTION: Decode the flags specific to IO Address space descriptors
522100966Siwasaki *
523100966Siwasaki ******************************************************************************/
524100966Siwasaki
525151937Sjkimstatic void
526100966SiwasakiAcpiDmIoFlags (
527100966Siwasaki        UINT8               Flags)
528100966Siwasaki{
529100966Siwasaki    AcpiOsPrintf ("%s, %s, %s, %s,",
530243347Sjkim        AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
531243347Sjkim        AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
532243347Sjkim        AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
533243347Sjkim        AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)]);
534100966Siwasaki}
535100966Siwasaki
536100966Siwasaki
537100966Siwasaki/*******************************************************************************
538100966Siwasaki *
539151937Sjkim * FUNCTION:    AcpiDmIoFlags2
540151937Sjkim *
541151937Sjkim * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
542151937Sjkim *
543151937Sjkim * RETURN:      None
544151937Sjkim *
545151937Sjkim * DESCRIPTION: Decode the flags specific to IO Address space descriptors
546151937Sjkim *
547151937Sjkim ******************************************************************************/
548151937Sjkim
549151937Sjkimstatic void
550151937SjkimAcpiDmIoFlags2 (
551151937Sjkim        UINT8               SpecificFlags)
552151937Sjkim{
553151937Sjkim
554316303Sjkim    /* _TTP */
555316303Sjkim
556151937Sjkim    AcpiOsPrintf (", %s",
557243347Sjkim        AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 4)]);
558151937Sjkim
559316303Sjkim    /*
560316303Sjkim     * TRS is only used if TTP is TypeTranslation. However, the disassembler
561316303Sjkim     * always emits exactly what is in the AML.
562316303Sjkim     */
563316303Sjkim    AcpiOsPrintf (", %s",
564316303Sjkim        AcpiGbl_TrsDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
565151937Sjkim}
566151937Sjkim
567151937Sjkim
568151937Sjkim/*******************************************************************************
569151937Sjkim *
570100966Siwasaki * FUNCTION:    AcpiDmMemoryFlags
571100966Siwasaki *
572100966Siwasaki * PARAMETERS:  Flags               - Flag byte to be decoded
573100966Siwasaki *              SpecificFlags       - "Specific" flag byte to be decoded
574100966Siwasaki *
575100966Siwasaki * RETURN:      None
576100966Siwasaki *
577100966Siwasaki * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
578100966Siwasaki *
579100966Siwasaki ******************************************************************************/
580100966Siwasaki
581151937Sjkimstatic void
582100966SiwasakiAcpiDmMemoryFlags (
583100966Siwasaki    UINT8                   Flags,
584100966Siwasaki    UINT8                   SpecificFlags)
585100966Siwasaki{
586151937Sjkim
587100966Siwasaki    AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
588243347Sjkim        AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Flags)],
589243347Sjkim        AcpiGbl_DecDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 1)],
590243347Sjkim        AcpiGbl_MinDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 2)],
591243347Sjkim        AcpiGbl_MaxDecode [ACPI_EXTRACT_1BIT_FLAG (Flags, 3)],
592243347Sjkim        AcpiGbl_MemDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 1)],
593243347Sjkim        AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (SpecificFlags)]);
594100966Siwasaki}
595100966Siwasaki
596100966Siwasaki
597100966Siwasaki/*******************************************************************************
598100966Siwasaki *
599151937Sjkim * FUNCTION:    AcpiDmMemoryFlags2
600151937Sjkim *
601151937Sjkim * PARAMETERS:  SpecificFlags       - "Specific" flag byte to be decoded
602151937Sjkim *
603151937Sjkim * RETURN:      None
604151937Sjkim *
605151937Sjkim * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
606151937Sjkim *
607151937Sjkim ******************************************************************************/
608151937Sjkim
609151937Sjkimstatic void
610151937SjkimAcpiDmMemoryFlags2 (
611151937Sjkim    UINT8                   SpecificFlags)
612151937Sjkim{
613151937Sjkim
614151937Sjkim    AcpiOsPrintf (", %s, %s",
615243347Sjkim        AcpiGbl_MtpDecode [ACPI_EXTRACT_2BIT_FLAG (SpecificFlags, 3)],
616243347Sjkim        AcpiGbl_TtpDecode [ACPI_EXTRACT_1BIT_FLAG (SpecificFlags, 5)]);
617151937Sjkim}
618151937Sjkim
619151937Sjkim
620151937Sjkim/*******************************************************************************
621151937Sjkim *
622151937Sjkim * FUNCTION:    AcpiDmResourceSource
623151937Sjkim *
624151937Sjkim * PARAMETERS:  Resource        - Raw AML descriptor
625151937Sjkim *              MinimumLength   - descriptor length without optional fields
626151937Sjkim *              ResourceLength
627151937Sjkim *
628151937Sjkim * RETURN:      None
629151937Sjkim *
630151937Sjkim * DESCRIPTION: Dump optional ResourceSource fields of an address descriptor
631151937Sjkim *
632151937Sjkim ******************************************************************************/
633151937Sjkim
634151937Sjkimstatic void
635151937SjkimAcpiDmResourceSource (
636151937Sjkim    AML_RESOURCE            *Resource,
637151937Sjkim    ACPI_SIZE               MinimumTotalLength,
638151937Sjkim    UINT32                  ResourceLength)
639151937Sjkim{
640151937Sjkim    UINT8                   *AmlResourceSource;
641151937Sjkim    UINT32                  TotalLength;
642151937Sjkim
643151937Sjkim
644151937Sjkim    TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
645151937Sjkim
646151937Sjkim    /* Check if the optional ResourceSource fields are present */
647151937Sjkim
648151937Sjkim    if (TotalLength <= MinimumTotalLength)
649151937Sjkim    {
650151937Sjkim        /* The two optional fields are not used */
651151937Sjkim
652167802Sjkim        AcpiOsPrintf (",, ");
653151937Sjkim        return;
654151937Sjkim    }
655151937Sjkim
656151937Sjkim    /* Get a pointer to the ResourceSource */
657151937Sjkim
658167802Sjkim    AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);
659151937Sjkim
660151937Sjkim    /*
661151937Sjkim     * Always emit the ResourceSourceIndex (Byte)
662151937Sjkim     *
663151937Sjkim     * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the
664151937Sjkim     * Index even if the String does not exist. Although this is in violation
665151937Sjkim     * of the ACPI specification, it is very important to emit ASL code that
666151937Sjkim     * can be compiled back to the identical AML. There may be fields and/or
667151937Sjkim     * indexes into the resource template buffer that are compiled to absolute
668151937Sjkim     * offsets, and these will be broken if the AML length is changed.
669151937Sjkim     */
670151937Sjkim    AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);
671151937Sjkim
672151937Sjkim    /* Make sure that the ResourceSource string exists before dumping it */
673151937Sjkim
674151937Sjkim    if (TotalLength > (MinimumTotalLength + 1))
675151937Sjkim    {
676151937Sjkim        AcpiOsPrintf (" ");
677252279Sjkim        AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT16_MAX);
678151937Sjkim    }
679151937Sjkim
680167802Sjkim    AcpiOsPrintf (", ");
681151937Sjkim}
682151937Sjkim
683151937Sjkim
684151937Sjkim/*******************************************************************************
685151937Sjkim *
686100966Siwasaki * FUNCTION:    AcpiDmWordDescriptor
687100966Siwasaki *
688272444Sjkim * PARAMETERS:  Info                - Extra resource info
689272444Sjkim *              Resource            - Pointer to the resource descriptor
690100966Siwasaki *              Length              - Length of the descriptor in bytes
691100966Siwasaki *              Level               - Current source code indentation level
692100966Siwasaki *
693100966Siwasaki * RETURN:      None
694100966Siwasaki *
695100966Siwasaki * DESCRIPTION: Decode a Word Address Space descriptor
696100966Siwasaki *
697100966Siwasaki ******************************************************************************/
698100966Siwasaki
699100966Siwasakivoid
700100966SiwasakiAcpiDmWordDescriptor (
701272444Sjkim    ACPI_OP_WALK_INFO       *Info,
702151937Sjkim    AML_RESOURCE            *Resource,
703100966Siwasaki    UINT32                  Length,
704100966Siwasaki    UINT32                  Level)
705100966Siwasaki{
706100966Siwasaki
707151937Sjkim    /* Dump resource name and flags */
708100966Siwasaki
709151937Sjkim    AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS16, Level);
710100966Siwasaki
711151937Sjkim    /* Dump the 5 contiguous WORD values */
712100966Siwasaki
713151937Sjkim    AcpiDmAddressFields (&Resource->Address16.Granularity, 16, Level);
714100966Siwasaki
715151937Sjkim    /* The ResourceSource fields are optional */
716151937Sjkim
717100966Siwasaki    AcpiDmIndent (Level + 1);
718151937Sjkim    AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS16), Length);
719100966Siwasaki
720167802Sjkim    /* Insert a descriptor name */
721167802Sjkim
722167802Sjkim    AcpiDmDescriptorName ();
723167802Sjkim
724151937Sjkim    /* Type-specific flags */
725100966Siwasaki
726151937Sjkim    AcpiDmAddressFlags (Resource);
727100966Siwasaki    AcpiOsPrintf (")\n");
728100966Siwasaki}
729100966Siwasaki
730100966Siwasaki
731100966Siwasaki/*******************************************************************************
732100966Siwasaki *
733100966Siwasaki * FUNCTION:    AcpiDmDwordDescriptor
734100966Siwasaki *
735272444Sjkim * PARAMETERS:  Info                - Extra resource info
736272444Sjkim *              Resource            - Pointer to the resource descriptor
737100966Siwasaki *              Length              - Length of the descriptor in bytes
738100966Siwasaki *              Level               - Current source code indentation level
739100966Siwasaki *
740100966Siwasaki * RETURN:      None
741100966Siwasaki *
742100966Siwasaki * DESCRIPTION: Decode a DWord Address Space descriptor
743100966Siwasaki *
744100966Siwasaki ******************************************************************************/
745100966Siwasaki
746100966Siwasakivoid
747100966SiwasakiAcpiDmDwordDescriptor (
748272444Sjkim    ACPI_OP_WALK_INFO       *Info,
749151937Sjkim    AML_RESOURCE            *Resource,
750100966Siwasaki    UINT32                  Length,
751100966Siwasaki    UINT32                  Level)
752100966Siwasaki{
753100966Siwasaki
754151937Sjkim    /* Dump resource name and flags */
755100966Siwasaki
756151937Sjkim    AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS32, Level);
757100966Siwasaki
758151937Sjkim    /* Dump the 5 contiguous DWORD values */
759100966Siwasaki
760151937Sjkim    AcpiDmAddressFields (&Resource->Address32.Granularity, 32, Level);
761151937Sjkim
762151937Sjkim    /* The ResourceSource fields are optional */
763151937Sjkim
764100966Siwasaki    AcpiDmIndent (Level + 1);
765151937Sjkim    AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS32), Length);
766100966Siwasaki
767167802Sjkim    /* Insert a descriptor name */
768167802Sjkim
769167802Sjkim    AcpiDmDescriptorName ();
770167802Sjkim
771151937Sjkim    /* Type-specific flags */
772100966Siwasaki
773151937Sjkim    AcpiDmAddressFlags (Resource);
774100966Siwasaki    AcpiOsPrintf (")\n");
775100966Siwasaki}
776100966Siwasaki
777100966Siwasaki
778100966Siwasaki/*******************************************************************************
779100966Siwasaki *
780100966Siwasaki * FUNCTION:    AcpiDmQwordDescriptor
781100966Siwasaki *
782272444Sjkim * PARAMETERS:  Info                - Extra resource info
783272444Sjkim *              Resource            - Pointer to the resource descriptor
784100966Siwasaki *              Length              - Length of the descriptor in bytes
785100966Siwasaki *              Level               - Current source code indentation level
786100966Siwasaki *
787100966Siwasaki * RETURN:      None
788100966Siwasaki *
789100966Siwasaki * DESCRIPTION: Decode a QWord Address Space descriptor
790100966Siwasaki *
791100966Siwasaki ******************************************************************************/
792100966Siwasaki
793100966Siwasakivoid
794100966SiwasakiAcpiDmQwordDescriptor (
795272444Sjkim    ACPI_OP_WALK_INFO       *Info,
796151937Sjkim    AML_RESOURCE            *Resource,
797100966Siwasaki    UINT32                  Length,
798100966Siwasaki    UINT32                  Level)
799100966Siwasaki{
800100966Siwasaki
801151937Sjkim    /* Dump resource name and flags */
802100966Siwasaki
803151937Sjkim    AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS64, Level);
804100966Siwasaki
805151937Sjkim    /* Dump the 5 contiguous QWORD values */
806100966Siwasaki
807151937Sjkim    AcpiDmAddressFields (&Resource->Address64.Granularity, 64, Level);
808100966Siwasaki
809151937Sjkim    /* The ResourceSource fields are optional */
810100966Siwasaki
811100966Siwasaki    AcpiDmIndent (Level + 1);
812151937Sjkim    AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS64), Length);
813100966Siwasaki
814167802Sjkim    /* Insert a descriptor name */
815167802Sjkim
816167802Sjkim    AcpiDmDescriptorName ();
817167802Sjkim
818151937Sjkim    /* Type-specific flags */
819100966Siwasaki
820151937Sjkim    AcpiDmAddressFlags (Resource);
821151937Sjkim    AcpiOsPrintf (")\n");
822151937Sjkim}
823151937Sjkim
824151937Sjkim
825151937Sjkim/*******************************************************************************
826151937Sjkim *
827151937Sjkim * FUNCTION:    AcpiDmExtendedDescriptor
828151937Sjkim *
829272444Sjkim * PARAMETERS:  Info                - Extra resource info
830272444Sjkim *              Resource            - Pointer to the resource descriptor
831151937Sjkim *              Length              - Length of the descriptor in bytes
832151937Sjkim *              Level               - Current source code indentation level
833151937Sjkim *
834151937Sjkim * RETURN:      None
835151937Sjkim *
836151937Sjkim * DESCRIPTION: Decode a Extended Address Space descriptor
837151937Sjkim *
838151937Sjkim ******************************************************************************/
839151937Sjkim
840151937Sjkimvoid
841151937SjkimAcpiDmExtendedDescriptor (
842272444Sjkim    ACPI_OP_WALK_INFO       *Info,
843151937Sjkim    AML_RESOURCE            *Resource,
844151937Sjkim    UINT32                  Length,
845151937Sjkim    UINT32                  Level)
846151937Sjkim{
847151937Sjkim
848151937Sjkim    /* Dump resource name and flags */
849151937Sjkim
850298714Sjkim    AcpiDmAddressCommon (
851298714Sjkim        Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level);
852151937Sjkim
853151937Sjkim    /* Dump the 5 contiguous QWORD values */
854151937Sjkim
855151937Sjkim    AcpiDmAddressFields (&Resource->ExtAddress64.Granularity, 64, Level);
856151937Sjkim
857151937Sjkim    /* Extra field for this descriptor only */
858151937Sjkim
859100966Siwasaki    AcpiDmIndent (Level + 1);
860151937Sjkim    AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,
861151937Sjkim        "Type-Specific Attributes");
862100966Siwasaki
863167802Sjkim    /* Insert a descriptor name */
864167802Sjkim
865167802Sjkim    AcpiDmIndent (Level + 1);
866167802Sjkim    AcpiDmDescriptorName ();
867167802Sjkim
868151937Sjkim    /* Type-specific flags */
869100966Siwasaki
870151937Sjkim    AcpiDmAddressFlags (Resource);
871100966Siwasaki    AcpiOsPrintf (")\n");
872100966Siwasaki}
873100966Siwasaki
874100966Siwasaki
875100966Siwasaki/*******************************************************************************
876100966Siwasaki *
877100966Siwasaki * FUNCTION:    AcpiDmMemory24Descriptor
878100966Siwasaki *
879272444Sjkim * PARAMETERS:  Info                - Extra resource info
880272444Sjkim *              Resource            - Pointer to the resource descriptor
881100966Siwasaki *              Length              - Length of the descriptor in bytes
882100966Siwasaki *              Level               - Current source code indentation level
883100966Siwasaki *
884100966Siwasaki * RETURN:      None
885100966Siwasaki *
886100966Siwasaki * DESCRIPTION: Decode a Memory24 descriptor
887100966Siwasaki *
888100966Siwasaki ******************************************************************************/
889100966Siwasaki
890100966Siwasakivoid
891100966SiwasakiAcpiDmMemory24Descriptor (
892272444Sjkim    ACPI_OP_WALK_INFO       *Info,
893151937Sjkim    AML_RESOURCE            *Resource,
894100966Siwasaki    UINT32                  Length,
895100966Siwasaki    UINT32                  Level)
896100966Siwasaki{
897100966Siwasaki
898151937Sjkim    /* Dump name and read/write flag */
899151937Sjkim
900100966Siwasaki    AcpiDmIndent (Level);
901151937Sjkim    AcpiOsPrintf ("Memory24 (%s,\n",
902243347Sjkim        AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory24.Flags)]);
903151937Sjkim
904151937Sjkim    /* Dump the 4 contiguous WORD values */
905151937Sjkim
906151937Sjkim    AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
907151937Sjkim
908167802Sjkim    /* Insert a descriptor name */
909167802Sjkim
910151937Sjkim    AcpiDmIndent (Level + 1);
911167802Sjkim    AcpiDmDescriptorName ();
912151937Sjkim    AcpiOsPrintf (")\n");
913100966Siwasaki}
914100966Siwasaki
915100966Siwasaki
916100966Siwasaki/*******************************************************************************
917100966Siwasaki *
918100966Siwasaki * FUNCTION:    AcpiDmMemory32Descriptor
919100966Siwasaki *
920272444Sjkim * PARAMETERS:  Info                - Extra resource info
921272444Sjkim *              Resource            - Pointer to the resource descriptor
922100966Siwasaki *              Length              - Length of the descriptor in bytes
923100966Siwasaki *              Level               - Current source code indentation level
924100966Siwasaki *
925100966Siwasaki * RETURN:      None
926100966Siwasaki *
927100966Siwasaki * DESCRIPTION: Decode a Memory32 descriptor
928100966Siwasaki *
929100966Siwasaki ******************************************************************************/
930100966Siwasaki
931100966Siwasakivoid
932100966SiwasakiAcpiDmMemory32Descriptor (
933272444Sjkim    ACPI_OP_WALK_INFO       *Info,
934151937Sjkim    AML_RESOURCE            *Resource,
935100966Siwasaki    UINT32                  Length,
936100966Siwasaki    UINT32                  Level)
937100966Siwasaki{
938100966Siwasaki
939151937Sjkim    /* Dump name and read/write flag */
940151937Sjkim
941100966Siwasaki    AcpiDmIndent (Level);
942151937Sjkim    AcpiOsPrintf ("Memory32 (%s,\n",
943243347Sjkim        AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->Memory32.Flags)]);
944151937Sjkim
945151937Sjkim    /* Dump the 4 contiguous DWORD values */
946151937Sjkim
947151937Sjkim    AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
948151937Sjkim
949167802Sjkim    /* Insert a descriptor name */
950167802Sjkim
951151937Sjkim    AcpiDmIndent (Level + 1);
952167802Sjkim    AcpiDmDescriptorName ();
953151937Sjkim    AcpiOsPrintf (")\n");
954100966Siwasaki}
955100966Siwasaki
956100966Siwasaki
957100966Siwasaki/*******************************************************************************
958100966Siwasaki *
959151937Sjkim * FUNCTION:    AcpiDmFixedMemory32Descriptor
960100966Siwasaki *
961272444Sjkim * PARAMETERS:  Info                - Extra resource info
962272444Sjkim *              Resource            - Pointer to the resource descriptor
963100966Siwasaki *              Length              - Length of the descriptor in bytes
964100966Siwasaki *              Level               - Current source code indentation level
965100966Siwasaki *
966100966Siwasaki * RETURN:      None
967100966Siwasaki *
968100966Siwasaki * DESCRIPTION: Decode a Fixed Memory32 descriptor
969100966Siwasaki *
970100966Siwasaki ******************************************************************************/
971100966Siwasaki
972100966Siwasakivoid
973151937SjkimAcpiDmFixedMemory32Descriptor (
974272444Sjkim    ACPI_OP_WALK_INFO       *Info,
975151937Sjkim    AML_RESOURCE            *Resource,
976100966Siwasaki    UINT32                  Length,
977100966Siwasaki    UINT32                  Level)
978100966Siwasaki{
979100966Siwasaki
980151937Sjkim    /* Dump name and read/write flag */
981151937Sjkim
982100966Siwasaki    AcpiDmIndent (Level);
983151937Sjkim    AcpiOsPrintf ("Memory32Fixed (%s,\n",
984243347Sjkim        AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
985151937Sjkim
986151937Sjkim    AcpiDmIndent (Level + 1);
987298714Sjkim    AcpiDmDumpInteger32 (Resource->FixedMemory32.Address,
988298714Sjkim        "Address Base");
989151937Sjkim
990151937Sjkim    AcpiDmIndent (Level + 1);
991298714Sjkim    AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength,
992298714Sjkim        "Address Length");
993151937Sjkim
994167802Sjkim    /* Insert a descriptor name */
995167802Sjkim
996151937Sjkim    AcpiDmIndent (Level + 1);
997167802Sjkim    AcpiDmDescriptorName ();
998151937Sjkim    AcpiOsPrintf (")\n");
999100966Siwasaki}
1000100966Siwasaki
1001100966Siwasaki
1002100966Siwasaki/*******************************************************************************
1003100966Siwasaki *
1004100966Siwasaki * FUNCTION:    AcpiDmGenericRegisterDescriptor
1005100966Siwasaki *
1006272444Sjkim * PARAMETERS:  Info                - Extra resource info
1007272444Sjkim *              Resource            - Pointer to the resource descriptor
1008100966Siwasaki *              Length              - Length of the descriptor in bytes
1009100966Siwasaki *              Level               - Current source code indentation level
1010100966Siwasaki *
1011100966Siwasaki * RETURN:      None
1012100966Siwasaki *
1013100966Siwasaki * DESCRIPTION: Decode a Generic Register descriptor
1014100966Siwasaki *
1015100966Siwasaki ******************************************************************************/
1016100966Siwasaki
1017100966Siwasakivoid
1018100966SiwasakiAcpiDmGenericRegisterDescriptor (
1019272444Sjkim    ACPI_OP_WALK_INFO       *Info,
1020151937Sjkim    AML_RESOURCE            *Resource,
1021100966Siwasaki    UINT32                  Length,
1022100966Siwasaki    UINT32                  Level)
1023100966Siwasaki{
1024100966Siwasaki
1025100966Siwasaki    AcpiDmIndent (Level);
1026100966Siwasaki    AcpiOsPrintf ("Register (");
1027151937Sjkim    AcpiDmAddressSpace (Resource->GenericReg.AddressSpaceId);
1028151937Sjkim    AcpiOsPrintf ("\n");
1029102550Siwasaki
1030151937Sjkim    AcpiDmIndent (Level + 1);
1031167802Sjkim    AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Bit Width");
1032102550Siwasaki
1033151937Sjkim    AcpiDmIndent (Level + 1);
1034167802Sjkim    AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
1035151937Sjkim
1036151937Sjkim    AcpiDmIndent (Level + 1);
1037167802Sjkim    AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
1038151937Sjkim
1039151937Sjkim    /* Optional field for ACPI 3.0 */
1040151937Sjkim
1041167802Sjkim    AcpiDmIndent (Level + 1);
1042151937Sjkim    if (Resource->GenericReg.AccessSize)
1043151937Sjkim    {
1044167802Sjkim        AcpiOsPrintf ("0x%2.2X,               // %s\n",
1045167802Sjkim            Resource->GenericReg.AccessSize, "Access Size");
1046151937Sjkim        AcpiDmIndent (Level + 1);
1047151937Sjkim    }
1048167802Sjkim    else
1049167802Sjkim    {
1050167802Sjkim        AcpiOsPrintf (",");
1051167802Sjkim    }
1052151937Sjkim
1053167802Sjkim    /* DescriptorName was added for ACPI 3.0+ */
1054167802Sjkim
1055167802Sjkim    AcpiDmDescriptorName ();
1056151937Sjkim    AcpiOsPrintf (")\n");
1057100966Siwasaki}
1058100966Siwasaki
1059100966Siwasaki
1060100966Siwasaki/*******************************************************************************
1061100966Siwasaki *
1062100966Siwasaki * FUNCTION:    AcpiDmInterruptDescriptor
1063100966Siwasaki *
1064272444Sjkim * PARAMETERS:  Info                - Extra resource info
1065272444Sjkim *              Resource            - Pointer to the resource descriptor
1066100966Siwasaki *              Length              - Length of the descriptor in bytes
1067100966Siwasaki *              Level               - Current source code indentation level
1068100966Siwasaki *
1069100966Siwasaki * RETURN:      None
1070100966Siwasaki *
1071100966Siwasaki * DESCRIPTION: Decode a extended Interrupt descriptor
1072100966Siwasaki *
1073100966Siwasaki ******************************************************************************/
1074100966Siwasaki
1075100966Siwasakivoid
1076100966SiwasakiAcpiDmInterruptDescriptor (
1077272444Sjkim    ACPI_OP_WALK_INFO       *Info,
1078151937Sjkim    AML_RESOURCE            *Resource,
1079100966Siwasaki    UINT32                  Length,
1080100966Siwasaki    UINT32                  Level)
1081100966Siwasaki{
1082100966Siwasaki    UINT32                  i;
1083100966Siwasaki
1084100966Siwasaki
1085100966Siwasaki    AcpiDmIndent (Level);
1086151937Sjkim    AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
1087243347Sjkim        AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->ExtendedIrq.Flags)],
1088243347Sjkim        AcpiGbl_HeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 1)],
1089243347Sjkim        AcpiGbl_LlDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->ExtendedIrq.Flags, 2)],
1090243347Sjkim        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->ExtendedIrq.Flags, 3)]);
1091100966Siwasaki
1092151937Sjkim    /*
1093151937Sjkim     * The ResourceSource fields are optional and appear after the interrupt
1094151937Sjkim     * list. Must compute length based on length of the list. First xrupt
1095151937Sjkim     * is included in the struct (reason for -1 below)
1096151937Sjkim     */
1097151937Sjkim    AcpiDmResourceSource (Resource,
1098151937Sjkim        sizeof (AML_RESOURCE_EXTENDED_IRQ) +
1099193267Sjkim            ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
1100151937Sjkim        Resource->ExtendedIrq.ResourceLength);
1101100966Siwasaki
1102167802Sjkim    /* Insert a descriptor name */
1103167802Sjkim
1104167802Sjkim    AcpiDmDescriptorName ();
1105167802Sjkim    AcpiOsPrintf (")\n");
1106167802Sjkim
1107151937Sjkim    /* Dump the interrupt list */
1108114237Snjl
1109100966Siwasaki    AcpiDmIndent (Level);
1110100966Siwasaki    AcpiOsPrintf ("{\n");
1111151937Sjkim    for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
1112100966Siwasaki    {
1113100966Siwasaki        AcpiDmIndent (Level + 1);
1114151937Sjkim        AcpiOsPrintf ("0x%8.8X,\n",
1115151937Sjkim            (UINT32) Resource->ExtendedIrq.Interrupts[i]);
1116100966Siwasaki    }
1117100966Siwasaki
1118100966Siwasaki    AcpiDmIndent (Level);
1119100966Siwasaki    AcpiOsPrintf ("}\n");
1120100966Siwasaki}
1121100966Siwasaki
1122100966Siwasaki
1123100966Siwasaki/*******************************************************************************
1124100966Siwasaki *
1125151937Sjkim * FUNCTION:    AcpiDmVendorCommon
1126100966Siwasaki *
1127151937Sjkim * PARAMETERS:  Name                - Descriptor name suffix
1128151937Sjkim *              ByteData            - Pointer to the vendor byte data
1129151937Sjkim *              Length              - Length of the byte data
1130100966Siwasaki *              Level               - Current source code indentation level
1131100966Siwasaki *
1132100966Siwasaki * RETURN:      None
1133100966Siwasaki *
1134151937Sjkim * DESCRIPTION: Decode a Vendor descriptor, both Large and Small
1135100966Siwasaki *
1136100966Siwasaki ******************************************************************************/
1137100966Siwasaki
1138100966Siwasakivoid
1139151937SjkimAcpiDmVendorCommon (
1140298714Sjkim    const char              *Name,
1141151937Sjkim    UINT8                   *ByteData,
1142100966Siwasaki    UINT32                  Length,
1143100966Siwasaki    UINT32                  Level)
1144100966Siwasaki{
1145100966Siwasaki
1146167802Sjkim    /* Dump macro name */
1147151937Sjkim
1148100966Siwasaki    AcpiDmIndent (Level);
1149167802Sjkim    AcpiOsPrintf ("Vendor%s (", Name);
1150151937Sjkim
1151167802Sjkim    /* Insert a descriptor name */
1152167802Sjkim
1153167802Sjkim    AcpiDmDescriptorName ();
1154167802Sjkim    AcpiOsPrintf (")      // Length = 0x%.2X\n", Length);
1155167802Sjkim
1156151937Sjkim    /* Dump the vendor bytes */
1157151937Sjkim
1158100966Siwasaki    AcpiDmIndent (Level);
1159100966Siwasaki    AcpiOsPrintf ("{\n");
1160100966Siwasaki
1161151937Sjkim    AcpiDmDisasmByteList (Level + 1, ByteData, Length);
1162151937Sjkim
1163100966Siwasaki    AcpiDmIndent (Level);
1164100966Siwasaki    AcpiOsPrintf ("}\n");
1165100966Siwasaki}
1166100966Siwasaki
1167100966Siwasaki
1168151937Sjkim/*******************************************************************************
1169151937Sjkim *
1170151937Sjkim * FUNCTION:    AcpiDmVendorLargeDescriptor
1171151937Sjkim *
1172272444Sjkim * PARAMETERS:  Info                - Extra resource info
1173272444Sjkim *              Resource            - Pointer to the resource descriptor
1174151937Sjkim *              Length              - Length of the descriptor in bytes
1175151937Sjkim *              Level               - Current source code indentation level
1176151937Sjkim *
1177151937Sjkim * RETURN:      None
1178151937Sjkim *
1179151937Sjkim * DESCRIPTION: Decode a Vendor Large descriptor
1180151937Sjkim *
1181151937Sjkim ******************************************************************************/
1182151937Sjkim
1183151937Sjkimvoid
1184151937SjkimAcpiDmVendorLargeDescriptor (
1185272444Sjkim    ACPI_OP_WALK_INFO       *Info,
1186151937Sjkim    AML_RESOURCE            *Resource,
1187151937Sjkim    UINT32                  Length,
1188151937Sjkim    UINT32                  Level)
1189151937Sjkim{
1190151937Sjkim
1191167802Sjkim    AcpiDmVendorCommon ("Long ",
1192167802Sjkim        ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
1193151937Sjkim        Length, Level);
1194151937Sjkim}
1195