dmutils.c revision 151937
1100966Siwasaki/*******************************************************************************
2100966Siwasaki *
3100966Siwasaki * Module Name: dmutils - AML disassembler utilities
4151937Sjkim *              $Revision: 1.19 $
5100966Siwasaki *
6100966Siwasaki ******************************************************************************/
7100966Siwasaki
8100966Siwasaki/******************************************************************************
9100966Siwasaki *
10100966Siwasaki * 1. Copyright Notice
11100966Siwasaki *
12151937Sjkim * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
13100966Siwasaki * All rights reserved.
14100966Siwasaki *
15100966Siwasaki * 2. License
16100966Siwasaki *
17100966Siwasaki * 2.1. This is your license from Intel Corp. under its intellectual property
18100966Siwasaki * rights.  You may have additional license terms from the party that provided
19100966Siwasaki * you this software, covering your right to use that party's intellectual
20100966Siwasaki * property rights.
21100966Siwasaki *
22100966Siwasaki * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23100966Siwasaki * copy of the source code appearing in this file ("Covered Code") an
24100966Siwasaki * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25100966Siwasaki * base code distributed originally by Intel ("Original Intel Code") to copy,
26100966Siwasaki * make derivatives, distribute, use and display any portion of the Covered
27100966Siwasaki * Code in any form, with the right to sublicense such rights; and
28100966Siwasaki *
29100966Siwasaki * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30100966Siwasaki * license (with the right to sublicense), under only those claims of Intel
31100966Siwasaki * patents that are infringed by the Original Intel Code, to make, use, sell,
32100966Siwasaki * offer to sell, and import the Covered Code and derivative works thereof
33100966Siwasaki * solely to the minimum extent necessary to exercise the above copyright
34100966Siwasaki * license, and in no event shall the patent license extend to any additions
35100966Siwasaki * to or modifications of the Original Intel Code.  No other license or right
36100966Siwasaki * is granted directly or by implication, estoppel or otherwise;
37100966Siwasaki *
38100966Siwasaki * The above copyright and patent license is granted only if the following
39100966Siwasaki * conditions are met:
40100966Siwasaki *
41100966Siwasaki * 3. Conditions
42100966Siwasaki *
43100966Siwasaki * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44100966Siwasaki * Redistribution of source code of any substantial portion of the Covered
45100966Siwasaki * Code or modification with rights to further distribute source must include
46100966Siwasaki * the above Copyright Notice, the above License, this list of Conditions,
47100966Siwasaki * and the following Disclaimer and Export Compliance provision.  In addition,
48100966Siwasaki * Licensee must cause all Covered Code to which Licensee contributes to
49100966Siwasaki * contain a file documenting the changes Licensee made to create that Covered
50100966Siwasaki * Code and the date of any change.  Licensee must include in that file the
51100966Siwasaki * documentation of any changes made by any predecessor Licensee.  Licensee
52100966Siwasaki * must include a prominent statement that the modification is derived,
53100966Siwasaki * directly or indirectly, from Original Intel Code.
54100966Siwasaki *
55100966Siwasaki * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56100966Siwasaki * Redistribution of source code of any substantial portion of the Covered
57100966Siwasaki * Code or modification without rights to further distribute source must
58100966Siwasaki * include the following Disclaimer and Export Compliance provision in the
59100966Siwasaki * documentation and/or other materials provided with distribution.  In
60100966Siwasaki * addition, Licensee may not authorize further sublicense of source of any
61100966Siwasaki * portion of the Covered Code, and must include terms to the effect that the
62100966Siwasaki * license from Licensee to its licensee is limited to the intellectual
63100966Siwasaki * property embodied in the software Licensee provides to its licensee, and
64100966Siwasaki * not to intellectual property embodied in modifications its licensee may
65100966Siwasaki * make.
66100966Siwasaki *
67100966Siwasaki * 3.3. Redistribution of Executable. Redistribution in executable form of any
68100966Siwasaki * substantial portion of the Covered Code or modification must reproduce the
69100966Siwasaki * above Copyright Notice, and the following Disclaimer and Export Compliance
70100966Siwasaki * provision in the documentation and/or other materials provided with the
71100966Siwasaki * distribution.
72100966Siwasaki *
73100966Siwasaki * 3.4. Intel retains all right, title, and interest in and to the Original
74100966Siwasaki * Intel Code.
75100966Siwasaki *
76100966Siwasaki * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77100966Siwasaki * Intel shall be used in advertising or otherwise to promote the sale, use or
78100966Siwasaki * other dealings in products derived from or relating to the Covered Code
79100966Siwasaki * without prior written authorization from Intel.
80100966Siwasaki *
81100966Siwasaki * 4. Disclaimer and Export Compliance
82100966Siwasaki *
83100966Siwasaki * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84100966Siwasaki * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85100966Siwasaki * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86100966Siwasaki * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87100966Siwasaki * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88100966Siwasaki * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89100966Siwasaki * PARTICULAR PURPOSE.
90100966Siwasaki *
91100966Siwasaki * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92100966Siwasaki * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93100966Siwasaki * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94100966Siwasaki * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95100966Siwasaki * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96100966Siwasaki * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97100966Siwasaki * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98100966Siwasaki * LIMITED REMEDY.
99100966Siwasaki *
100100966Siwasaki * 4.3. Licensee shall not export, either directly or indirectly, any of this
101100966Siwasaki * software or system incorporating such software without first obtaining any
102100966Siwasaki * required license or other approval from the U. S. Department of Commerce or
103100966Siwasaki * any other agency or department of the United States Government.  In the
104100966Siwasaki * event Licensee exports any such software from the United States or
105100966Siwasaki * re-exports any such software from a foreign destination, Licensee shall
106100966Siwasaki * ensure that the distribution and export/re-export of the software is in
107100966Siwasaki * compliance with all laws, regulations, orders, or other restrictions of the
108100966Siwasaki * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109100966Siwasaki * any of its subsidiaries will export/re-export any technical data, process,
110100966Siwasaki * software, or service, directly or indirectly, to any country for which the
111100966Siwasaki * United States government or any agency thereof requires an export license,
112100966Siwasaki * other governmental approval, or letter of assurance, without first obtaining
113100966Siwasaki * such license, approval or letter.
114100966Siwasaki *
115100966Siwasaki *****************************************************************************/
116100966Siwasaki
117100966Siwasaki
118151600Sobrien#include <contrib/dev/acpica/acpi.h>
119151600Sobrien#include <contrib/dev/acpica/amlcode.h>
120151600Sobrien#include <contrib/dev/acpica/acdisasm.h>
121151937Sjkim
122151937Sjkim#ifdef ACPI_ASL_COMPILER
123151600Sobrien#include <contrib/dev/acpica/acnamesp.h>
124151937Sjkim#endif
125100966Siwasaki
126100966Siwasaki#ifdef ACPI_DISASSEMBLER
127100966Siwasaki
128102550Siwasaki#define _COMPONENT          ACPI_CA_DEBUGGER
129100966Siwasaki        ACPI_MODULE_NAME    ("dmutils")
130100966Siwasaki
131100966Siwasaki
132128212SnjlACPI_EXTERNAL_LIST              *AcpiGbl_ExternalList = NULL;
133128212Snjl
134128212Snjl
135100966Siwasaki/* Data used in keeping track of fields */
136100966Siwasaki#if 0
137114237Snjlconst char                      *AcpiGbl_FENames[ACPI_NUM_FIELD_NAMES] =
138100966Siwasaki{
139100966Siwasaki    "skip",
140100966Siwasaki    "?access?"
141100966Siwasaki};              /* FE = Field Element */
142100966Siwasaki#endif
143100966Siwasaki
144100966Siwasaki
145114237Snjlconst char                      *AcpiGbl_MatchOps[ACPI_NUM_MATCH_OPS] =
146100966Siwasaki{
147100966Siwasaki    "MTR",
148100966Siwasaki    "MEQ",
149100966Siwasaki    "MLE",
150100966Siwasaki    "MLT",
151100966Siwasaki    "MGE",
152100966Siwasaki    "MGT"
153100966Siwasaki};
154100966Siwasaki
155100966Siwasaki
156100966Siwasaki/* Access type decoding */
157100966Siwasaki
158114237Snjlconst char                      *AcpiGbl_AccessTypes[ACPI_NUM_ACCESS_TYPES] =
159100966Siwasaki{
160100966Siwasaki    "AnyAcc",
161100966Siwasaki    "ByteAcc",
162100966Siwasaki    "WordAcc",
163100966Siwasaki    "DWordAcc",
164100966Siwasaki    "QWordAcc",
165100966Siwasaki    "BufferAcc",
166100966Siwasaki};
167100966Siwasaki
168100966Siwasaki
169100966Siwasaki/* Lock rule decoding */
170100966Siwasaki
171114237Snjlconst char                      *AcpiGbl_LockRule[ACPI_NUM_LOCK_RULES] =
172100966Siwasaki{
173100966Siwasaki    "NoLock",
174100966Siwasaki    "Lock"
175100966Siwasaki};
176100966Siwasaki
177100966Siwasaki/* Update rule decoding */
178100966Siwasaki
179114237Snjlconst char                      *AcpiGbl_UpdateRules[ACPI_NUM_UPDATE_RULES] =
180100966Siwasaki{
181100966Siwasaki    "Preserve",
182100966Siwasaki    "WriteAsOnes",
183100966Siwasaki    "WriteAsZeros"
184100966Siwasaki};
185100966Siwasaki
186100966Siwasaki/*
187100966Siwasaki * Strings used to decode resource descriptors
188100966Siwasaki */
189100966Siwasakiconst char                      *AcpiGbl_IoDecode[2] =
190100966Siwasaki{
191100966Siwasaki    "Decode10",
192100966Siwasaki    "Decode16"
193100966Siwasaki};
194100966Siwasaki
195100966Siwasakiconst char                      *AcpiGbl_WordDecode[4] =
196100966Siwasaki{
197151937Sjkim    "Memory",
198151937Sjkim    "IO",
199151937Sjkim    "BusNumber",
200100966Siwasaki    "Unknown-resource-type"
201100966Siwasaki};
202100966Siwasaki
203100966Siwasakiconst char                      *AcpiGbl_ConsumeDecode[2] =
204100966Siwasaki{
205100966Siwasaki    "ResourceProducer",
206100966Siwasaki    "ResourceConsumer"
207100966Siwasaki};
208100966Siwasaki
209100966Siwasakiconst char                      *AcpiGbl_MinDecode[2] =
210100966Siwasaki{
211100966Siwasaki    "MinNotFixed",
212100966Siwasaki    "MinFixed"
213100966Siwasaki};
214100966Siwasaki
215100966Siwasakiconst char                      *AcpiGbl_MaxDecode[2] =
216100966Siwasaki{
217100966Siwasaki    "MaxNotFixed",
218100966Siwasaki    "MaxFixed"
219100966Siwasaki};
220100966Siwasaki
221100966Siwasakiconst char                      *AcpiGbl_DECDecode[2] =
222100966Siwasaki{
223100966Siwasaki    "PosDecode",
224100966Siwasaki    "SubDecode"
225100966Siwasaki};
226100966Siwasaki
227100966Siwasakiconst char                      *AcpiGbl_IrqDecode[2] =
228100966Siwasaki{
229100966Siwasaki    "IRQNoFlags",
230100966Siwasaki    "IRQ"
231100966Siwasaki};
232100966Siwasaki
233100966Siwasakiconst char                      *AcpiGbl_HEDecode[2] =
234100966Siwasaki{
235100966Siwasaki    "Level",
236100966Siwasaki    "Edge"
237100966Siwasaki};
238100966Siwasaki
239100966Siwasakiconst char                      *AcpiGbl_LLDecode[2] =
240100966Siwasaki{
241100966Siwasaki    "ActiveHigh",
242100966Siwasaki    "ActiveLow"
243100966Siwasaki};
244100966Siwasaki
245100966Siwasakiconst char                      *AcpiGbl_SHRDecode[2] =
246100966Siwasaki{
247100966Siwasaki    "Exclusive",
248100966Siwasaki    "Shared"
249100966Siwasaki};
250100966Siwasaki
251100966Siwasakiconst char                      *AcpiGbl_TYPDecode[4] =
252100966Siwasaki{
253100966Siwasaki    "Compatibility",
254100966Siwasaki    "TypeA",
255100966Siwasaki    "TypeB",
256100966Siwasaki    "TypeF"
257100966Siwasaki};
258100966Siwasaki
259100966Siwasakiconst char                      *AcpiGbl_BMDecode[2] =
260100966Siwasaki{
261100966Siwasaki    "NotBusMaster",
262100966Siwasaki    "BusMaster"
263100966Siwasaki};
264100966Siwasaki
265100966Siwasakiconst char                      *AcpiGbl_SIZDecode[4] =
266100966Siwasaki{
267100966Siwasaki    "Transfer8",
268100966Siwasaki    "Transfer8_16",
269100966Siwasaki    "Transfer16",
270100966Siwasaki    "InvalidSize"
271100966Siwasaki};
272100966Siwasaki
273151937Sjkim/* Type Specific Flags */
274100966Siwasaki
275151937Sjkimconst char                      *AcpiGbl_TTPDecode[2] =
276151937Sjkim{
277151937Sjkim    "TypeStatic",
278151937Sjkim    "TypeTranslation"
279151937Sjkim};
280151937Sjkim
281151937Sjkimconst char                      *AcpiGbl_MTPDecode[4] =
282151937Sjkim{
283151937Sjkim    "AddressRangeMemory",
284151937Sjkim    "AddressRangeReserved",
285151937Sjkim    "AddressRangeACPI",
286151937Sjkim    "AddressRangeNVS"
287151937Sjkim};
288151937Sjkim
289151937Sjkimconst char                      *AcpiGbl_MEMDecode[4] =
290151937Sjkim{
291151937Sjkim    "NonCacheable",
292151937Sjkim    "Cacheable",
293151937Sjkim    "WriteCombining",
294151937Sjkim    "Prefetchable"
295151937Sjkim};
296151937Sjkim
297151937Sjkimconst char                      *AcpiGbl_RWDecode[2] =
298151937Sjkim{
299151937Sjkim    "ReadOnly",
300151937Sjkim    "ReadWrite"
301151937Sjkim};
302151937Sjkim
303151937Sjkimconst char                      *AcpiGbl_TRSDecode[2] =
304151937Sjkim{
305151937Sjkim    "DenseTranslation",
306151937Sjkim    "SparseTranslation"
307151937Sjkim};
308151937Sjkim
309151937Sjkimconst char                      *AcpiGbl_RNGDecode[4] =
310151937Sjkim{
311151937Sjkim    "InvalidRanges",
312151937Sjkim    "NonISAOnlyRanges",
313151937Sjkim    "ISAOnlyRanges",
314151937Sjkim    "EntireRange"
315151937Sjkim};
316151937Sjkim
317151937Sjkimconst char                      *AcpiGbl_ConfigDecode[4] =
318151937Sjkim{
319151937Sjkim    "0 - Good Configuration",
320151937Sjkim    "1 - Acceptable Configuration",
321151937Sjkim    "2 - Suboptimal Configuration",
322151937Sjkim    "3 - ***Invalid Configuration***",
323151937Sjkim};
324151937Sjkim
325151937Sjkim
326151937Sjkim#ifdef ACPI_ASL_COMPILER
327100966Siwasaki/*******************************************************************************
328100966Siwasaki *
329128212Snjl * FUNCTION:    AcpiDmAddToExternalList
330128212Snjl *
331128212Snjl * PARAMETERS:  Path            - Internal (AML) path to the object
332128212Snjl *
333128212Snjl * RETURN:      None
334128212Snjl *
335128212Snjl * DESCRIPTION: Insert a new path into the list of Externals which will in
336128212Snjl *              turn be emitted as an External() declaration in the disassembled
337128212Snjl *              output.
338128212Snjl *
339128212Snjl ******************************************************************************/
340128212Snjl
341128212Snjlvoid
342128212SnjlAcpiDmAddToExternalList (
343128212Snjl    char                    *Path)
344128212Snjl{
345128212Snjl    char                    *ExternalPath;
346128212Snjl    ACPI_EXTERNAL_LIST      *NewExternal;
347128212Snjl    ACPI_STATUS             Status;
348128212Snjl
349128212Snjl
350128212Snjl    if (!Path)
351128212Snjl    {
352128212Snjl        return;
353128212Snjl    }
354128212Snjl
355128212Snjl    /* Externalize the ACPI path */
356128212Snjl
357128212Snjl    Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
358128212Snjl                    NULL, &ExternalPath);
359128212Snjl    if (ACPI_SUCCESS (Status))
360128212Snjl    {
361128212Snjl        /* Allocate and init a new External() descriptor */
362128212Snjl
363128212Snjl        NewExternal = ACPI_MEM_CALLOCATE (sizeof (ACPI_EXTERNAL_LIST));
364128212Snjl        NewExternal->Path = ExternalPath;
365128212Snjl
366128212Snjl        /* Link the new descriptor into the global list */
367128212Snjl
368128212Snjl        if (AcpiGbl_ExternalList)
369128212Snjl        {
370128212Snjl            NewExternal->Next = AcpiGbl_ExternalList;
371128212Snjl        }
372128212Snjl        AcpiGbl_ExternalList = NewExternal;
373128212Snjl    }
374128212Snjl}
375151937Sjkim#endif
376128212Snjl
377128212Snjl/*******************************************************************************
378128212Snjl *
379107325Siwasaki * FUNCTION:    AcpiDmDecodeAttribute
380107325Siwasaki *
381107325Siwasaki * PARAMETERS:  Attribute       - Attribute field of AccessAs keyword
382107325Siwasaki *
383107325Siwasaki * RETURN:      None
384107325Siwasaki *
385107325Siwasaki * DESCRIPTION: Decode the AccessAs attribute byte.  (Mostly SMBus stuff)
386107325Siwasaki *
387107325Siwasaki ******************************************************************************/
388107325Siwasaki
389107325Siwasakivoid
390107325SiwasakiAcpiDmDecodeAttribute (
391107325Siwasaki    UINT8                   Attribute)
392107325Siwasaki{
393107325Siwasaki
394107325Siwasaki    switch (Attribute)
395107325Siwasaki    {
396107325Siwasaki    case AML_FIELD_ATTRIB_SMB_QUICK:
397107325Siwasaki
398107325Siwasaki        AcpiOsPrintf ("SMBQuick");
399107325Siwasaki        break;
400107325Siwasaki
401107325Siwasaki    case AML_FIELD_ATTRIB_SMB_SEND_RCV:
402107325Siwasaki
403107325Siwasaki        AcpiOsPrintf ("SMBSendReceive");
404107325Siwasaki        break;
405107325Siwasaki
406107325Siwasaki    case AML_FIELD_ATTRIB_SMB_BYTE:
407107325Siwasaki
408107325Siwasaki        AcpiOsPrintf ("SMBByte");
409107325Siwasaki        break;
410107325Siwasaki
411107325Siwasaki    case AML_FIELD_ATTRIB_SMB_WORD:
412107325Siwasaki
413107325Siwasaki        AcpiOsPrintf ("SMBWord");
414107325Siwasaki        break;
415107325Siwasaki
416107325Siwasaki    case AML_FIELD_ATTRIB_SMB_WORD_CALL:
417107325Siwasaki
418107325Siwasaki        AcpiOsPrintf ("SMBProcessCall");
419107325Siwasaki        break;
420107325Siwasaki
421107325Siwasaki    case AML_FIELD_ATTRIB_SMB_BLOCK:
422107325Siwasaki
423107325Siwasaki        AcpiOsPrintf ("SMBBlock");
424107325Siwasaki        break;
425107325Siwasaki
426107325Siwasaki    case AML_FIELD_ATTRIB_SMB_BLOCK_CALL:
427107325Siwasaki
428107325Siwasaki        AcpiOsPrintf ("SMBBlockProcessCall");
429107325Siwasaki        break;
430107325Siwasaki
431107325Siwasaki    default:
432107325Siwasaki
433107325Siwasaki        AcpiOsPrintf ("0x%.2X", Attribute);
434107325Siwasaki        break;
435107325Siwasaki    }
436107325Siwasaki}
437107325Siwasaki
438107325Siwasaki
439107325Siwasaki/*******************************************************************************
440107325Siwasaki *
441100966Siwasaki * FUNCTION:    AcpiDmIndent
442100966Siwasaki *
443100966Siwasaki * PARAMETERS:  Level               - Current source code indentation level
444100966Siwasaki *
445100966Siwasaki * RETURN:      None
446100966Siwasaki *
447100966Siwasaki * DESCRIPTION: Indent 4 spaces per indentation level.
448100966Siwasaki *
449100966Siwasaki ******************************************************************************/
450100966Siwasaki
451100966Siwasakivoid
452100966SiwasakiAcpiDmIndent (
453100966Siwasaki    UINT32                  Level)
454100966Siwasaki{
455100966Siwasaki
456100966Siwasaki    if (!Level)
457100966Siwasaki    {
458100966Siwasaki        return;
459100966Siwasaki    }
460100966Siwasaki
461100966Siwasaki    AcpiOsPrintf ("%*.s", ACPI_MUL_4 (Level), " ");
462100966Siwasaki}
463100966Siwasaki
464100966Siwasaki
465100966Siwasaki/*******************************************************************************
466100966Siwasaki *
467100966Siwasaki * FUNCTION:    AcpiDmCommaIfListMember
468100966Siwasaki *
469100966Siwasaki * PARAMETERS:  Op              - Current operator/operand
470100966Siwasaki *
471100966Siwasaki * RETURN:      TRUE if a comma was inserted
472100966Siwasaki *
473100966Siwasaki * DESCRIPTION: Insert a comma if this Op is a member of an argument list.
474100966Siwasaki *
475100966Siwasaki ******************************************************************************/
476100966Siwasaki
477100966SiwasakiBOOLEAN
478100966SiwasakiAcpiDmCommaIfListMember (
479100966Siwasaki    ACPI_PARSE_OBJECT       *Op)
480100966Siwasaki{
481100966Siwasaki
482100966Siwasaki    if (!Op->Common.Next)
483100966Siwasaki    {
484100966Siwasaki        return FALSE;
485100966Siwasaki    }
486100966Siwasaki
487100966Siwasaki    if (AcpiDmListType (Op->Common.Parent) & BLOCK_COMMA_LIST)
488100966Siwasaki    {
489100966Siwasaki        /* Check for a NULL target operand */
490100966Siwasaki
491100966Siwasaki        if ((Op->Common.Next->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
492100966Siwasaki            (!Op->Common.Next->Common.Value.String))
493100966Siwasaki        {
494100966Siwasaki            /*
495100966Siwasaki             * To handle the Divide() case where there are two optional
496100966Siwasaki             * targets, look ahead one more op.  If null, this null target
497100966Siwasaki             * is the one and only target -- no comma needed.  Otherwise,
498100966Siwasaki             * we need a comma to prepare for the next target.
499100966Siwasaki             */
500100966Siwasaki            if (!Op->Common.Next->Common.Next)
501100966Siwasaki            {
502100966Siwasaki                return FALSE;
503100966Siwasaki            }
504100966Siwasaki        }
505100966Siwasaki
506100966Siwasaki        if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
507100966Siwasaki            (!(Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)))
508100966Siwasaki        {
509100966Siwasaki            return FALSE;
510100966Siwasaki        }
511100966Siwasaki
512100966Siwasaki        AcpiOsPrintf (", ");
513100966Siwasaki        return (TRUE);
514100966Siwasaki    }
515100966Siwasaki
516100966Siwasaki    else if ((Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST) &&
517100966Siwasaki             (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST))
518100966Siwasaki    {
519100966Siwasaki        AcpiOsPrintf (", ");
520100966Siwasaki        return (TRUE);
521100966Siwasaki    }
522100966Siwasaki
523100966Siwasaki    return (FALSE);
524100966Siwasaki}
525100966Siwasaki
526100966Siwasaki
527100966Siwasaki/*******************************************************************************
528100966Siwasaki *
529100966Siwasaki * FUNCTION:    AcpiDmCommaIfFieldMember
530100966Siwasaki *
531100966Siwasaki * PARAMETERS:  Op              - Current operator/operand
532100966Siwasaki *
533100966Siwasaki * RETURN:      None
534100966Siwasaki *
535100966Siwasaki * DESCRIPTION: Insert a comma if this Op is a member of a Field argument list.
536100966Siwasaki *
537100966Siwasaki ******************************************************************************/
538100966Siwasaki
539100966Siwasakivoid
540100966SiwasakiAcpiDmCommaIfFieldMember (
541100966Siwasaki    ACPI_PARSE_OBJECT       *Op)
542100966Siwasaki{
543100966Siwasaki
544100966Siwasaki    if (Op->Common.Next)
545100966Siwasaki    {
546100966Siwasaki        AcpiOsPrintf (", ");
547100966Siwasaki    }
548100966Siwasaki}
549100966Siwasaki
550100966Siwasaki#endif
551