psutils.c revision 80062
1/******************************************************************************
2 *
3 * Module Name: psutils - Parser miscellaneous utilities (Parser only)
4 *              $Revision: 38 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights.  You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code.  No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision.  In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change.  Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee.  Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution.  In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * 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 "acpi.h"
119#include "acparser.h"
120#include "amlcode.h"
121
122#define _COMPONENT          ACPI_PARSER
123        MODULE_NAME         ("psutils")
124
125
126#define PARSEOP_GENERIC     0x01
127#define PARSEOP_NAMED       0x02
128#define PARSEOP_DEFERRED    0x03
129#define PARSEOP_BYTELIST    0x04
130#define PARSEOP_IN_CACHE    0x80
131
132
133/*******************************************************************************
134 *
135 * FUNCTION:    AcpiPsInitOp
136 *
137 * PARAMETERS:  Op              - A newly allocated Op object
138 *              Opcode          - Opcode to store in the Op
139 *
140 * RETURN:      Status
141 *
142 * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on
143 *              opcode
144 *
145 ******************************************************************************/
146
147void
148AcpiPsInitOp (
149    ACPI_PARSE_OBJECT       *Op,
150    UINT16                  Opcode)
151{
152    ACPI_OPCODE_INFO        *AmlOp;
153
154
155    Op->DataType = ACPI_DESC_TYPE_PARSER;
156    Op->Opcode = Opcode;
157
158    AmlOp = AcpiPsGetOpcodeInfo (Opcode);
159
160    DEBUG_ONLY_MEMBERS (STRNCPY (Op->OpName, AmlOp->Name,
161                        sizeof (Op->OpName)));
162}
163
164
165/*******************************************************************************
166 *
167 * FUNCTION:    AcpiPsAllocOp
168 *
169 * PARAMETERS:  Opcode          - Opcode that will be stored in the new Op
170 *
171 * RETURN:      Pointer to the new Op.
172 *
173 * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on
174 *              opcode.  A cache of opcodes is available for the pure
175 *              GENERIC_OP, since this is by far the most commonly used.
176 *
177 ******************************************************************************/
178
179ACPI_PARSE_OBJECT*
180AcpiPsAllocOp (
181    UINT16                  Opcode)
182{
183    ACPI_PARSE_OBJECT       *Op = NULL;
184    UINT32                  Size;
185    UINT8                   Flags;
186
187
188    PROC_NAME ("PsAllocOp");
189
190
191    /* Allocate the minimum required size object */
192
193    if (AcpiPsIsDeferredOp (Opcode))
194    {
195        Size = sizeof (ACPI_PARSE2_OBJECT);
196        Flags = PARSEOP_DEFERRED;
197    }
198
199    else if (AcpiPsIsNamedOp (Opcode))
200    {
201        Size = sizeof (ACPI_PARSE2_OBJECT);
202        Flags = PARSEOP_NAMED;
203    }
204
205    else if (AcpiPsIsBytelistOp (Opcode))
206    {
207        Size = sizeof (ACPI_PARSE2_OBJECT);
208        Flags = PARSEOP_BYTELIST;
209    }
210
211    else
212    {
213        Size = sizeof (ACPI_PARSE_OBJECT);
214        Flags = PARSEOP_GENERIC;
215    }
216
217
218    if (Size == sizeof (ACPI_PARSE_OBJECT))
219    {
220        /*
221         * The generic op is by far the most common (16 to 1), and therefore
222         * the op cache is implemented with this type.
223         *
224         * Check if there is an Op already available in the cache
225         */
226
227        AcpiUtAcquireMutex (ACPI_MTX_CACHES);
228        AcpiGbl_ParseCacheRequests++;
229        if (AcpiGbl_ParseCache)
230        {
231            /* Extract an op from the front of the cache list */
232
233            AcpiGbl_ParseCacheDepth--;
234            AcpiGbl_ParseCacheHits++;
235
236            Op = AcpiGbl_ParseCache;
237            AcpiGbl_ParseCache = Op->Next;
238
239            if (Op->DataType == 0xFF)
240            {
241                DEBUG_PRINTP (ACPI_ERROR, ("Op %p deleted while in cache!\n", Op));
242            }
243
244            /* Clear the previously used Op */
245
246            MEMSET (Op, 0, sizeof (ACPI_PARSE_OBJECT));
247
248            DEBUG_PRINTP (TRACE_PARSE, ("Op %p from Parse Cache\n", Op));
249        }
250        AcpiUtReleaseMutex (ACPI_MTX_CACHES);
251    }
252
253    else
254    {
255        /*
256         * The generic op is by far the most common (16 to 1), and therefore
257         * the op cache is implemented with this type.
258         *
259         * Check if there is an Op already available in the cache
260         */
261
262        AcpiUtAcquireMutex (ACPI_MTX_CACHES);
263        AcpiGbl_ExtParseCacheRequests++;
264        if (AcpiGbl_ExtParseCache)
265        {
266            /* Extract an op from the front of the cache list */
267
268            AcpiGbl_ExtParseCacheDepth--;
269            AcpiGbl_ExtParseCacheHits++;
270
271            Op = (ACPI_PARSE_OBJECT *) AcpiGbl_ExtParseCache;
272            AcpiGbl_ExtParseCache = (ACPI_PARSE2_OBJECT *) Op->Next;
273
274            if (Op->DataType == 0xFF)
275            {
276                DEBUG_PRINTP (ACPI_ERROR, ("Op %p deleted while in cache!\n", Op));
277            }
278
279            /* Clear the previously used Op */
280
281            MEMSET (Op, 0, sizeof (ACPI_PARSE2_OBJECT));
282
283            DEBUG_PRINTP (TRACE_PARSE, ("Op %p from ExtParse Cache\n", Op));
284        }
285        AcpiUtReleaseMutex (ACPI_MTX_CACHES);
286    }
287
288
289    /* Allocate a new Op if necessary */
290
291    if (!Op)
292    {
293        Op = ACPI_MEM_CALLOCATE (Size);
294    }
295
296    /* Initialize the Op */
297    if (Op)
298    {
299        AcpiPsInitOp (Op, Opcode);
300        Op->Flags = Flags;
301    }
302
303    return (Op);
304}
305
306
307/*******************************************************************************
308 *
309 * FUNCTION:    AcpiPsFreeOp
310 *
311 * PARAMETERS:  Op              - Op to be freed
312 *
313 * RETURN:      None.
314 *
315 * DESCRIPTION: Free an Op object.  Either put it on the GENERIC_OP cache list
316 *              or actually free it.
317 *
318 ******************************************************************************/
319
320void
321AcpiPsFreeOp (
322    ACPI_PARSE_OBJECT       *Op)
323{
324    PROC_NAME ("PsFreeOp");
325
326
327    if (Op->Opcode == AML_INT_RETURN_VALUE_OP)
328    {
329        DEBUG_PRINTP (ACPI_INFO, ("Free retval op: %p\n", Op));
330    }
331
332    if (Op->Flags == PARSEOP_GENERIC)
333    {
334        /* Is the cache full? */
335
336        if (AcpiGbl_ParseCacheDepth < MAX_PARSE_CACHE_DEPTH)
337        {
338            /* Put a GENERIC_OP back into the cache */
339
340            /* Clear the previously used Op */
341
342            MEMSET (Op, 0, sizeof (ACPI_PARSE_OBJECT));
343            Op->Flags = PARSEOP_IN_CACHE;
344
345            AcpiUtAcquireMutex (ACPI_MTX_CACHES);
346            AcpiGbl_ParseCacheDepth++;
347
348            Op->Next = AcpiGbl_ParseCache;
349            AcpiGbl_ParseCache = Op;
350
351            AcpiUtReleaseMutex (ACPI_MTX_CACHES);
352            return;
353        }
354    }
355
356    else
357    {
358        /* Is the cache full? */
359
360        if (AcpiGbl_ExtParseCacheDepth < MAX_EXTPARSE_CACHE_DEPTH)
361        {
362            /* Put a GENERIC_OP back into the cache */
363
364            /* Clear the previously used Op */
365
366            MEMSET (Op, 0, sizeof (ACPI_PARSE2_OBJECT));
367            Op->Flags = PARSEOP_IN_CACHE;
368
369            AcpiUtAcquireMutex (ACPI_MTX_CACHES);
370            AcpiGbl_ExtParseCacheDepth++;
371
372            Op->Next = (ACPI_PARSE_OBJECT *) AcpiGbl_ExtParseCache;
373            AcpiGbl_ExtParseCache = (ACPI_PARSE2_OBJECT *) Op;
374
375            AcpiUtReleaseMutex (ACPI_MTX_CACHES);
376            return;
377        }
378    }
379
380
381    /*
382     * Not a GENERIC OP, or the cache is full, just free the Op
383     */
384    ACPI_MEM_FREE (Op);
385}
386
387
388/*******************************************************************************
389 *
390 * FUNCTION:    AcpiPsDeleteParseCache
391 *
392 * PARAMETERS:  None
393 *
394 * RETURN:      None
395 *
396 * DESCRIPTION: Free all objects that are on the parse cache list.
397 *
398 ******************************************************************************/
399
400void
401AcpiPsDeleteParseCache (
402    void)
403{
404    ACPI_PARSE_OBJECT       *Next;
405
406
407    FUNCTION_TRACE ("PsDeleteParseCache");
408
409
410    /* Traverse the global cache list */
411
412    while (AcpiGbl_ParseCache)
413    {
414        /* Delete one cached state object */
415
416        Next = AcpiGbl_ParseCache->Next;
417        ACPI_MEM_FREE (AcpiGbl_ParseCache);
418
419        AcpiGbl_ParseCache = Next;
420        AcpiGbl_ParseCacheDepth--;
421    }
422
423    /* Traverse the global cache list */
424
425    while (AcpiGbl_ExtParseCache)
426    {
427        /* Delete one cached state object */
428
429        Next = AcpiGbl_ExtParseCache->Next;
430        ACPI_MEM_FREE (AcpiGbl_ExtParseCache);
431
432        AcpiGbl_ExtParseCache = (ACPI_PARSE2_OBJECT *) Next;
433        AcpiGbl_ExtParseCacheDepth--;
434    }
435
436    return_VOID;
437}
438
439
440/*******************************************************************************
441 *
442 * FUNCTION:    Utility functions
443 *
444 * DESCRIPTION: Low level functions
445 *
446 * TBD: [Restructure]
447 * 1) Some of these functions should be macros
448 * 2) Some can be simplified
449 *
450 ******************************************************************************/
451
452
453/*
454 * Is "c" a namestring lead character?
455 */
456
457
458BOOLEAN
459AcpiPsIsLeadingChar (
460    UINT32                  c)
461{
462    return ((BOOLEAN) (c == '_' || (c >= 'A' && c <= 'Z')));
463}
464
465
466/*
467 * Is "c" a namestring prefix character?
468 */
469BOOLEAN
470AcpiPsIsPrefixChar (
471    UINT32                  c)
472{
473    return ((BOOLEAN) (c == '\\' || c == '^'));
474}
475
476
477BOOLEAN
478AcpiPsIsNamespaceObjectOp (
479    UINT16                  Opcode)
480{
481    return ((BOOLEAN)
482           (Opcode == AML_SCOPE_OP              ||
483            Opcode == AML_DEVICE_OP             ||
484            Opcode == AML_THERMAL_ZONE_OP       ||
485            Opcode == AML_METHOD_OP             ||
486            Opcode == AML_POWER_RES_OP          ||
487            Opcode == AML_PROCESSOR_OP          ||
488            Opcode == AML_FIELD_OP              ||
489            Opcode == AML_INDEX_FIELD_OP        ||
490            Opcode == AML_BANK_FIELD_OP         ||
491            Opcode == AML_INT_NAMEDFIELD_OP     ||
492            Opcode == AML_NAME_OP               ||
493            Opcode == AML_ALIAS_OP              ||
494            Opcode == AML_MUTEX_OP              ||
495            Opcode == AML_EVENT_OP              ||
496            Opcode == AML_REGION_OP             ||
497            Opcode == AML_CREATE_FIELD_OP       ||
498            Opcode == AML_CREATE_BIT_FIELD_OP   ||
499            Opcode == AML_CREATE_BYTE_FIELD_OP  ||
500            Opcode == AML_CREATE_WORD_FIELD_OP  ||
501            Opcode == AML_CREATE_DWORD_FIELD_OP ||
502            Opcode == AML_CREATE_QWORD_FIELD_OP ||
503            Opcode == AML_INT_METHODCALL_OP     ||
504            Opcode == AML_INT_NAMEPATH_OP));
505}
506
507BOOLEAN
508AcpiPsIsNamespaceOp (
509    UINT16                  Opcode)
510{
511    return ((BOOLEAN)
512           (Opcode == AML_SCOPE_OP          ||
513            Opcode == AML_DEVICE_OP         ||
514            Opcode == AML_THERMAL_ZONE_OP   ||
515            Opcode == AML_METHOD_OP         ||
516            Opcode == AML_POWER_RES_OP      ||
517            Opcode == AML_PROCESSOR_OP      ||
518            Opcode == AML_FIELD_OP          ||
519            Opcode == AML_INDEX_FIELD_OP    ||
520            Opcode == AML_BANK_FIELD_OP     ||
521            Opcode == AML_NAME_OP           ||
522            Opcode == AML_ALIAS_OP          ||
523            Opcode == AML_MUTEX_OP          ||
524            Opcode == AML_EVENT_OP          ||
525            Opcode == AML_REGION_OP         ||
526            Opcode == AML_INT_NAMEDFIELD_OP));
527}
528
529
530/*
531 * Is opcode for a named object Op?
532 * (Includes all named object opcodes)
533 *
534 * TBD: [Restructure] Need a better way than this brute force approach!
535 */
536BOOLEAN
537AcpiPsIsNodeOp (
538    UINT16                  Opcode)
539{
540    return ((BOOLEAN)
541           (Opcode == AML_SCOPE_OP              ||
542            Opcode == AML_DEVICE_OP             ||
543            Opcode == AML_THERMAL_ZONE_OP       ||
544            Opcode == AML_METHOD_OP             ||
545            Opcode == AML_POWER_RES_OP          ||
546            Opcode == AML_PROCESSOR_OP          ||
547            Opcode == AML_INT_NAMEDFIELD_OP     ||
548            Opcode == AML_NAME_OP               ||
549            Opcode == AML_ALIAS_OP              ||
550            Opcode == AML_MUTEX_OP              ||
551            Opcode == AML_EVENT_OP              ||
552            Opcode == AML_REGION_OP             ||
553
554
555            Opcode == AML_CREATE_FIELD_OP       ||
556            Opcode == AML_CREATE_BIT_FIELD_OP   ||
557            Opcode == AML_CREATE_BYTE_FIELD_OP  ||
558            Opcode == AML_CREATE_WORD_FIELD_OP  ||
559            Opcode == AML_CREATE_DWORD_FIELD_OP ||
560            Opcode == AML_CREATE_QWORD_FIELD_OP ||
561            Opcode == AML_INT_METHODCALL_OP     ||
562            Opcode == AML_INT_NAMEPATH_OP));
563}
564
565
566/*
567 * Is opcode for a named Op?
568 */
569BOOLEAN
570AcpiPsIsNamedOp (
571    UINT16                  Opcode)
572{
573    return ((BOOLEAN)
574           (Opcode == AML_SCOPE_OP          ||
575            Opcode == AML_DEVICE_OP         ||
576            Opcode == AML_THERMAL_ZONE_OP   ||
577            Opcode == AML_METHOD_OP         ||
578            Opcode == AML_POWER_RES_OP      ||
579            Opcode == AML_PROCESSOR_OP      ||
580            Opcode == AML_NAME_OP           ||
581            Opcode == AML_ALIAS_OP          ||
582            Opcode == AML_MUTEX_OP          ||
583            Opcode == AML_EVENT_OP          ||
584            Opcode == AML_REGION_OP         ||
585            Opcode == AML_INT_NAMEDFIELD_OP));
586}
587
588
589BOOLEAN
590AcpiPsIsDeferredOp (
591    UINT16                  Opcode)
592{
593    return ((BOOLEAN)
594           (Opcode == AML_METHOD_OP                 ||
595            Opcode == AML_CREATE_FIELD_OP           ||
596            Opcode == AML_CREATE_BIT_FIELD_OP       ||
597            Opcode == AML_CREATE_BYTE_FIELD_OP      ||
598            Opcode == AML_CREATE_WORD_FIELD_OP      ||
599            Opcode == AML_CREATE_DWORD_FIELD_OP     ||
600            Opcode == AML_CREATE_QWORD_FIELD_OP     ||
601            Opcode == AML_REGION_OP));
602}
603
604
605/*
606 * Is opcode for a bytelist?
607 */
608BOOLEAN
609AcpiPsIsBytelistOp (
610    UINT16                  Opcode)
611{
612    return ((BOOLEAN) (Opcode == AML_INT_BYTELIST_OP));
613}
614
615
616/*
617 * Is opcode for a Field, IndexField, or BankField
618 */
619BOOLEAN
620AcpiPsIsFieldOp (
621    UINT16                  Opcode)
622{
623    return ((BOOLEAN)
624              (Opcode == AML_CREATE_FIELD_OP
625            || Opcode == AML_FIELD_OP
626            || Opcode == AML_INDEX_FIELD_OP
627            || Opcode == AML_BANK_FIELD_OP));
628}
629
630
631/*
632 * Is field creation op
633 */
634BOOLEAN
635AcpiPsIsCreateFieldOp (
636    UINT16                  Opcode)
637{
638    return ((BOOLEAN)
639           (Opcode == AML_CREATE_FIELD_OP           ||
640            Opcode == AML_CREATE_BIT_FIELD_OP       ||
641            Opcode == AML_CREATE_BYTE_FIELD_OP      ||
642            Opcode == AML_CREATE_WORD_FIELD_OP      ||
643            Opcode == AML_CREATE_DWORD_FIELD_OP     ||
644            Opcode == AML_CREATE_QWORD_FIELD_OP));
645}
646
647
648/*
649 * Cast an acpi_op to an acpi_extended_op if possible
650 */
651
652/* TBD: This is very inefficient, fix */
653ACPI_PARSE2_OBJECT *
654AcpiPsToExtendedOp (
655    ACPI_PARSE_OBJECT       *Op)
656{
657    return ((AcpiPsIsDeferredOp (Op->Opcode) || AcpiPsIsNamedOp (Op->Opcode) || AcpiPsIsBytelistOp (Op->Opcode))
658            ? ( (ACPI_PARSE2_OBJECT *) Op) : NULL);
659}
660
661
662/*
663 * Get op's name (4-byte name segment) or 0 if unnamed
664 */
665UINT32
666AcpiPsGetName (
667    ACPI_PARSE_OBJECT       *Op)
668{
669    ACPI_PARSE2_OBJECT      *Named = AcpiPsToExtendedOp (Op);
670
671    return (Named ? Named->Name : 0);
672}
673
674
675/*
676 * Set op's name
677 */
678void
679AcpiPsSetName (
680    ACPI_PARSE_OBJECT       *Op,
681    UINT32                  name)
682{
683    ACPI_PARSE2_OBJECT      *Named = AcpiPsToExtendedOp (Op);
684
685    if (Named)
686    {
687        Named->Name = name;
688    }
689}
690
691