aslpredef.c revision 220663
1/******************************************************************************
2 *
3 * Module Name: aslpredef - support for ACPI predefined names
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2011, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 *    notice, this list of conditions, and the following disclaimer,
16 *    without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 *    substantially similar to the "NO WARRANTY" disclaimer below
19 *    ("Disclaimer") and any redistribution must be conditioned upon
20 *    including a substantially similar Disclaimer requirement for further
21 *    binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 *    of any contributors may be used to endorse or promote products derived
24 *    from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#define ACPI_CREATE_PREDEFINED_TABLE
45
46#include <contrib/dev/acpica/compiler/aslcompiler.h>
47#include "aslcompiler.y.h"
48#include <contrib/dev/acpica/include/acpredef.h>
49
50
51#define _COMPONENT          ACPI_COMPILER
52        ACPI_MODULE_NAME    ("aslpredef")
53
54
55/* Local prototypes */
56
57static void
58ApCheckForUnexpectedReturnValue (
59    ACPI_PARSE_OBJECT       *Op,
60    ASL_METHOD_INFO         *MethodInfo);
61
62static UINT32
63ApCheckForSpecialName (
64    ACPI_PARSE_OBJECT       *Op,
65    char                    *Name);
66
67static void
68ApCheckObjectType (
69    ACPI_PARSE_OBJECT       *Op,
70    UINT32                  ExpectedBtypes);
71
72static void
73ApGetExpectedTypes (
74    char                    *Buffer,
75    UINT32                  ExpectedBtypes);
76
77
78/*
79 * Names for the types that can be returned by the predefined objects.
80 * Used for warning messages. Must be in the same order as the ACPI_RTYPEs
81 */
82static const char   *AcpiRtypeNames[] =
83{
84    "/Integer",
85    "/String",
86    "/Buffer",
87    "/Package",
88    "/Reference",
89};
90
91/*
92 * Predefined names for use in Resource Descriptors. These names do not
93 * appear in the global Predefined Name table (since these names never
94 * appear in actual AML byte code, only in the original ASL)
95 */
96static const ACPI_PREDEFINED_INFO      ResourceNames[] = {
97    {{"_ALN",     0,      0}},
98    {{"_ASI",     0,      0}},
99    {{"_ASZ",     0,      0}},
100    {{"_ATT",     0,      0}},
101    {{"_BAS",     0,      0}},
102    {{"_BM_",     0,      0}},
103    {{"_DEC",     0,      0}},
104    {{"_GRA",     0,      0}},
105    {{"_HE_",     0,      0}},
106    {{"_INT",     0,      0}},
107    {{"_LEN",     0,      0}},
108    {{"_LL_",     0,      0}},
109    {{"_MAF",     0,      0}},
110    {{"_MAX",     0,      0}},
111    {{"_MEM",     0,      0}},
112    {{"_MIF",     0,      0}},
113    {{"_MIN",     0,      0}},
114    {{"_MTP",     0,      0}},
115    {{"_RBO",     0,      0}},
116    {{"_RBW",     0,      0}},
117    {{"_RNG",     0,      0}},
118    {{"_RT_",     0,      0}},  /* Acpi 3.0 */
119    {{"_RW_",     0,      0}},
120    {{"_SHR",     0,      0}},
121    {{"_SIZ",     0,      0}},
122    {{"_TRA",     0,      0}},
123    {{"_TRS",     0,      0}},
124    {{"_TSF",     0,      0}},  /* Acpi 3.0 */
125    {{"_TTP",     0,      0}},
126    {{"_TYP",     0,      0}},
127    {{{0,0,0,0},  0,      0}}   /* Table terminator */
128};
129
130static const ACPI_PREDEFINED_INFO      ScopeNames[] = {
131    {{"_SB_",     0,      0}},
132    {{"_SI_",     0,      0}},
133    {{"_TZ_",     0,      0}},
134    {{{0,0,0,0},  0,      0}}   /* Table terminator */
135};
136
137
138/*******************************************************************************
139 *
140 * FUNCTION:    ApCheckForPredefinedMethod
141 *
142 * PARAMETERS:  Op              - A parse node of type "METHOD".
143 *              MethodInfo      - Saved info about this method
144 *
145 * RETURN:      None
146 *
147 * DESCRIPTION: If method is a predefined name, check that the number of
148 *              arguments and the return type (returns a value or not)
149 *              is correct.
150 *
151 ******************************************************************************/
152
153BOOLEAN
154ApCheckForPredefinedMethod (
155    ACPI_PARSE_OBJECT       *Op,
156    ASL_METHOD_INFO         *MethodInfo)
157{
158    UINT32                  Index;
159    UINT32                  RequiredArgsCurrent;
160    UINT32                  RequiredArgsOld;
161
162
163    /* Check for a match against the predefined name list */
164
165    Index = ApCheckForPredefinedName (Op, Op->Asl.NameSeg);
166
167    switch (Index)
168    {
169    case ACPI_NOT_RESERVED_NAME:        /* No underscore or _Txx or _xxx name not matched */
170    case ACPI_PREDEFINED_NAME:          /* Resource Name or reserved scope name */
171    case ACPI_COMPILER_RESERVED_NAME:   /* A _Txx that was not emitted by compiler */
172
173        /* Just return, nothing to do */
174        return (FALSE);
175
176
177    case ACPI_EVENT_RESERVED_NAME:      /* _Lxx/_Exx/_Wxx/_Qxx methods */
178
179        Gbl_ReservedMethods++;
180
181        /* NumArguments must be zero for all _Lxx/_Exx/_Wxx/_Qxx methods */
182
183        if (MethodInfo->NumArguments != 0)
184        {
185            sprintf (MsgBuffer, "%s requires %u", Op->Asl.ExternalName, 0);
186
187            AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
188                MsgBuffer);
189        }
190        break;
191
192
193    default:
194        /*
195         * Matched a predefined method name
196         *
197         * Validate the ASL-defined argument count. Allow two different legal
198         * arg counts.
199         */
200        Gbl_ReservedMethods++;
201
202        RequiredArgsCurrent = PredefinedNames[Index].Info.ParamCount & 0x0F;
203        RequiredArgsOld = PredefinedNames[Index].Info.ParamCount >> 4;
204
205        if ((MethodInfo->NumArguments != RequiredArgsCurrent) &&
206            (MethodInfo->NumArguments != RequiredArgsOld))
207        {
208            sprintf (MsgBuffer, "%4.4s requires %u",
209                PredefinedNames[Index].Info.Name, RequiredArgsCurrent);
210
211            if (MethodInfo->NumArguments > RequiredArgsCurrent)
212            {
213                AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
214                    MsgBuffer);
215            }
216            else
217            {
218                AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op,
219                    MsgBuffer);
220            }
221        }
222
223        /*
224         * Check if method returns no value, but the predefined name is
225         * required to return a value
226         */
227        if (MethodInfo->NumReturnNoValue &&
228            PredefinedNames[Index].Info.ExpectedBtypes)
229        {
230            ApGetExpectedTypes (StringBuffer,
231                PredefinedNames[Index].Info.ExpectedBtypes);
232
233            sprintf (MsgBuffer, "%s required for %4.4s",
234                StringBuffer, PredefinedNames[Index].Info.Name);
235
236            AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op,
237                MsgBuffer);
238        }
239        break;
240    }
241
242    return (TRUE);
243}
244
245
246/*******************************************************************************
247 *
248 * FUNCTION:    ApCheckForUnexpectedReturnValue
249 *
250 * PARAMETERS:  Op              - A parse node of type "RETURN".
251 *              MethodInfo      - Saved info about this method
252 *
253 * RETURN:      None
254 *
255 * DESCRIPTION: Check for an unexpected return value from a predefined method.
256 *              Invoked for predefined methods that are defined to not return
257 *              any value. If there is a return value, issue a remark, since
258 *              the ASL writer may be confused as to the method definition
259 *              and/or functionality.
260 *
261 * Note: We ignore all return values of "Zero", since this is what a standalone
262 *       Return() statement will always generate -- so we ignore it here --
263 *       i.e., there is no difference between Return() and Return(Zero).
264 *       Also, a null Return() will be disassembled to return(Zero) -- so, we
265 *       don't want to generate extraneous remarks/warnings for a disassembled
266 *       ASL file.
267 *
268 ******************************************************************************/
269
270static void
271ApCheckForUnexpectedReturnValue (
272    ACPI_PARSE_OBJECT       *Op,
273    ASL_METHOD_INFO         *MethodInfo)
274{
275    ACPI_PARSE_OBJECT       *ReturnValueOp;
276
277
278    /* Ignore Return() and Return(Zero) (they are the same) */
279
280    ReturnValueOp = Op->Asl.Child;
281    if (ReturnValueOp->Asl.ParseOpcode == PARSEOP_ZERO)
282    {
283        return;
284    }
285
286    /* We have a valid return value, but the reserved name did not expect it */
287
288    AslError (ASL_WARNING, ASL_MSG_RESERVED_NO_RETURN_VAL,
289        Op, MethodInfo->Op->Asl.ExternalName);
290}
291
292
293/*******************************************************************************
294 *
295 * FUNCTION:    ApCheckPredefinedReturnValue
296 *
297 * PARAMETERS:  Op              - A parse node of type "RETURN".
298 *              MethodInfo      - Saved info about this method
299 *
300 * RETURN:      None
301 *
302 * DESCRIPTION: If method is a predefined name, attempt to validate the return
303 *              value. Only "static" types can be validated - a simple return
304 *              of an integer/string/buffer/package or a named reference to
305 *              a static object. Values such as a Localx or Argx or a control
306 *              method invocation are not checked. Issue a warning if there is
307 *              a valid return value, but the reserved method defines no
308 *              return value.
309 *
310 ******************************************************************************/
311
312void
313ApCheckPredefinedReturnValue (
314    ACPI_PARSE_OBJECT       *Op,
315    ASL_METHOD_INFO         *MethodInfo)
316{
317    UINT32                  Index;
318    ACPI_PARSE_OBJECT       *ReturnValueOp;
319
320
321    /* Check parent method for a match against the predefined name list */
322
323    Index = ApCheckForPredefinedName (MethodInfo->Op,
324                MethodInfo->Op->Asl.NameSeg);
325
326    switch (Index)
327    {
328    case ACPI_EVENT_RESERVED_NAME:      /* _Lxx/_Exx/_Wxx/_Qxx methods */
329
330        /* No return value expected, warn if there is one */
331
332        ApCheckForUnexpectedReturnValue (Op, MethodInfo);
333        return;
334
335    case ACPI_NOT_RESERVED_NAME:        /* No underscore or _Txx or _xxx name not matched */
336    case ACPI_PREDEFINED_NAME:          /* Resource Name or reserved scope name */
337    case ACPI_COMPILER_RESERVED_NAME:   /* A _Txx that was not emitted by compiler */
338
339        /* Just return, nothing to do */
340        return;
341
342    default: /* A standard predefined ACPI name */
343
344        if (!PredefinedNames[Index].Info.ExpectedBtypes)
345        {
346            /* No return value expected, warn if there is one */
347
348            ApCheckForUnexpectedReturnValue (Op, MethodInfo);
349            return;
350        }
351
352        /* Get the object returned, it is the next argument */
353
354        ReturnValueOp = Op->Asl.Child;
355        switch (ReturnValueOp->Asl.ParseOpcode)
356        {
357        case PARSEOP_ZERO:
358        case PARSEOP_ONE:
359        case PARSEOP_ONES:
360        case PARSEOP_INTEGER:
361        case PARSEOP_STRING_LITERAL:
362        case PARSEOP_BUFFER:
363        case PARSEOP_PACKAGE:
364
365            /* Static data return object - check against expected type */
366
367            ApCheckObjectType (ReturnValueOp,
368                PredefinedNames[Index].Info.ExpectedBtypes);
369            break;
370
371        default:
372
373            /*
374             * All other ops are very difficult or impossible to typecheck at
375             * compile time. These include all Localx, Argx, and method
376             * invocations. Also, NAMESEG and NAMESTRING because the type of
377             * any named object can be changed at runtime (for example,
378             * CopyObject will change the type of the target object.)
379             */
380            break;
381        }
382    }
383}
384
385
386/*******************************************************************************
387 *
388 * FUNCTION:    ApCheckForPredefinedObject
389 *
390 * PARAMETERS:  Op              - A parse node
391 *              Name            - The ACPI name to be checked
392 *
393 * RETURN:      None
394 *
395 * DESCRIPTION: Check for a predefined name for a static object (created via
396 *              the ASL Name operator). If it is a predefined ACPI name, ensure
397 *              that the name does not require any arguments (which would
398 *              require a control method implemenation of the name), and that
399 *              the type of the object is one of the expected types for the
400 *              predefined name.
401 *
402 ******************************************************************************/
403
404void
405ApCheckForPredefinedObject (
406    ACPI_PARSE_OBJECT       *Op,
407    char                    *Name)
408{
409    UINT32                  Index;
410
411
412    /*
413     * Check for a real predefined name -- not a resource descriptor name
414     * or a predefined scope name
415     */
416    Index = ApCheckForPredefinedName (Op, Name);
417
418    switch (Index)
419    {
420    case ACPI_NOT_RESERVED_NAME:        /* No underscore or _Txx or _xxx name not matched */
421    case ACPI_PREDEFINED_NAME:          /* Resource Name or reserved scope name */
422    case ACPI_COMPILER_RESERVED_NAME:   /* A _Txx that was not emitted by compiler */
423
424        /* Nothing to do */
425        return;
426
427    case ACPI_EVENT_RESERVED_NAME:      /* _Lxx/_Exx/_Wxx/_Qxx methods */
428
429        /*
430         * These names must be control methods, by definition in ACPI spec.
431         * Also because they are defined to return no value. None of them
432         * require any arguments.
433         */
434        AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
435            "with zero arguments");
436        return;
437
438    default: /* A standard predefined ACPI name */
439
440        /*
441         * If this predefined name requires input arguments, then
442         * it must be implemented as a control method
443         */
444        if (PredefinedNames[Index].Info.ParamCount > 0)
445        {
446            AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
447                "with arguments");
448            return;
449        }
450
451        /*
452         * If no return value is expected from this predefined name, then
453         * it follows that it must be implemented as a control method
454         * (with zero args, because the args > 0 case was handled above)
455         * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx
456         */
457        if (!PredefinedNames[Index].Info.ExpectedBtypes)
458        {
459            AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
460                "with zero arguments");
461            return;
462        }
463
464        /* Typecheck the actual object, it is the next argument */
465
466        ApCheckObjectType (Op->Asl.Child->Asl.Next,
467            PredefinedNames[Index].Info.ExpectedBtypes);
468        return;
469    }
470}
471
472
473/*******************************************************************************
474 *
475 * FUNCTION:    ApCheckForPredefinedName
476 *
477 * PARAMETERS:  Op              - A parse node
478 *              Name            - NameSeg to check
479 *
480 * RETURN:      None
481 *
482 * DESCRIPTION: Check a NameSeg against the reserved list.
483 *
484 ******************************************************************************/
485
486UINT32
487ApCheckForPredefinedName (
488    ACPI_PARSE_OBJECT       *Op,
489    char                    *Name)
490{
491    UINT32                  i;
492
493
494    if (Name[0] == 0)
495    {
496        AcpiOsPrintf ("Found a null name, external = %s\n",
497            Op->Asl.ExternalName);
498    }
499
500    /* All reserved names are prefixed with a single underscore */
501
502    if (Name[0] != '_')
503    {
504        return (ACPI_NOT_RESERVED_NAME);
505    }
506
507    /* Check for a standard predefined method name */
508
509    for (i = 0; PredefinedNames[i].Info.Name[0]; i++)
510    {
511        if (ACPI_COMPARE_NAME (Name, PredefinedNames[i].Info.Name))
512        {
513            /* Return index into predefined array */
514            return (i);
515        }
516    }
517
518    /* Check for resource names and predefined scope names */
519
520    for (i = 0; ResourceNames[i].Info.Name[0]; i++)
521    {
522        if (ACPI_COMPARE_NAME (Name, ResourceNames[i].Info.Name))
523        {
524            return (ACPI_PREDEFINED_NAME);
525        }
526    }
527
528    for (i = 0; ScopeNames[i].Info.Name[0]; i++)
529    {
530        if (ACPI_COMPARE_NAME (Name, ScopeNames[i].Info.Name))
531        {
532            return (ACPI_PREDEFINED_NAME);
533        }
534    }
535
536    /* Check for _Lxx/_Exx/_Wxx/_Qxx/_T_x. Warning if unknown predefined name */
537
538    return (ApCheckForSpecialName (Op, Name));
539}
540
541
542/*******************************************************************************
543 *
544 * FUNCTION:    ApCheckForSpecialName
545 *
546 * PARAMETERS:  Op              - A parse node
547 *              Name            - NameSeg to check
548 *
549 * RETURN:      None
550 *
551 * DESCRIPTION: Check for the "special" predefined names -
552 *              _Lxx, _Exx, _Qxx, _Wxx, and _T_x
553 *
554 ******************************************************************************/
555
556static UINT32
557ApCheckForSpecialName (
558    ACPI_PARSE_OBJECT       *Op,
559    char                    *Name)
560{
561
562    /*
563     * Check for the "special" predefined names. We already know that the
564     * first character is an underscore.
565     *   GPE:  _Lxx
566     *   GPE:  _Exx
567     *   GPE:  _Wxx
568     *   EC:   _Qxx
569     */
570    if ((Name[1] == 'L') ||
571        (Name[1] == 'E') ||
572        (Name[1] == 'W') ||
573        (Name[1] == 'Q'))
574    {
575        /* The next two characters must be hex digits */
576
577        if ((isxdigit ((int) Name[2])) &&
578            (isxdigit ((int) Name[3])))
579        {
580            return (ACPI_EVENT_RESERVED_NAME);
581        }
582    }
583
584    /* Check for the names reserved for the compiler itself: _T_x */
585
586    else if ((Op->Asl.ExternalName[1] == 'T') &&
587             (Op->Asl.ExternalName[2] == '_'))
588    {
589        /* Ignore if actually emitted by the compiler */
590
591        if (Op->Asl.CompileFlags & NODE_COMPILER_EMITTED)
592        {
593            return (ACPI_NOT_RESERVED_NAME);
594        }
595
596        /*
597         * Was not actually emitted by the compiler. This is a special case,
598         * however. If the ASL code being compiled was the result of a
599         * dissasembly, it may possibly contain valid compiler-emitted names
600         * of the form "_T_x". We don't want to issue an error or even a
601         * warning and force the user to manually change the names. So, we
602         * will issue a remark instead.
603         */
604        AslError (ASL_REMARK, ASL_MSG_COMPILER_RESERVED, Op, Op->Asl.ExternalName);
605        return (ACPI_COMPILER_RESERVED_NAME);
606    }
607
608    /*
609     * The name didn't match any of the known predefined names. Flag it as a
610     * warning, since the entire namespace starting with an underscore is
611     * reserved by the ACPI spec.
612     */
613    AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op,
614        Op->Asl.ExternalName);
615
616    return (ACPI_NOT_RESERVED_NAME);
617}
618
619
620/*******************************************************************************
621 *
622 * FUNCTION:    ApCheckObjectType
623 *
624 * PARAMETERS:  Op              - Current parse node
625 *              ExpectedBtypes  - Bitmap of expected return type(s)
626 *
627 * RETURN:      None
628 *
629 * DESCRIPTION: Check if the object type is one of the types that is expected
630 *              by the predefined name. Only a limited number of object types
631 *              can be returned by the predefined names.
632 *
633 ******************************************************************************/
634
635static void
636ApCheckObjectType (
637    ACPI_PARSE_OBJECT       *Op,
638    UINT32                  ExpectedBtypes)
639{
640    UINT32                  ReturnBtype;
641
642
643    switch (Op->Asl.ParseOpcode)
644    {
645    case PARSEOP_ZERO:
646    case PARSEOP_ONE:
647    case PARSEOP_ONES:
648    case PARSEOP_INTEGER:
649        ReturnBtype = ACPI_RTYPE_INTEGER;
650        break;
651
652    case PARSEOP_BUFFER:
653        ReturnBtype = ACPI_RTYPE_BUFFER;
654        break;
655
656    case PARSEOP_STRING_LITERAL:
657        ReturnBtype = ACPI_RTYPE_STRING;
658        break;
659
660    case PARSEOP_PACKAGE:
661        ReturnBtype = ACPI_RTYPE_PACKAGE;
662        break;
663
664    default:
665        /* Not one of the supported object types */
666
667        goto TypeErrorExit;
668    }
669
670    /* Exit if the object is one of the expected types */
671
672    if (ReturnBtype & ExpectedBtypes)
673    {
674        return;
675    }
676
677
678TypeErrorExit:
679
680    /* Format the expected types and emit an error message */
681
682    ApGetExpectedTypes (StringBuffer, ExpectedBtypes);
683
684    sprintf (MsgBuffer, "found %s, requires %s",
685        UtGetOpName (Op->Asl.ParseOpcode), StringBuffer);
686
687    AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Op,
688        MsgBuffer);
689}
690
691
692/*******************************************************************************
693 *
694 * FUNCTION:    ApDisplayReservedNames
695 *
696 * PARAMETERS:  None
697 *
698 * RETURN:      None
699 *
700 * DESCRIPTION: Dump information about the ACPI predefined names and predefined
701 *              resource descriptor names.
702 *
703 ******************************************************************************/
704
705void
706ApDisplayReservedNames (
707    void)
708{
709    const ACPI_PREDEFINED_INFO  *ThisName;
710    char                        TypeBuffer[48]; /* Room for 5 types */
711    UINT32                      Count;
712
713
714    /*
715     * Predefined names/methods
716     */
717    printf ("\nPredefined Name Information\n\n");
718
719    Count = 0;
720    ThisName = PredefinedNames;
721    while (ThisName->Info.Name[0])
722    {
723        printf ("%4.4s    Requires %u arguments, ",
724            ThisName->Info.Name, ThisName->Info.ParamCount & 0x0F);
725
726        if (ThisName->Info.ExpectedBtypes)
727        {
728            ApGetExpectedTypes (TypeBuffer, ThisName->Info.ExpectedBtypes);
729            printf ("Must return: %s\n", TypeBuffer);
730        }
731        else
732        {
733            printf ("No return value\n");
734        }
735
736        /*
737         * Skip next entry in the table if this name returns a Package
738         * (next entry contains the package info)
739         */
740        if (ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE)
741        {
742            ThisName++;
743        }
744
745        Count++;
746        ThisName++;
747    }
748
749    printf ("%u Predefined Names are recognized\n", Count);
750
751    /*
752     * Resource Descriptor names
753     */
754    printf ("\nResource Descriptor Predefined Names\n\n");
755
756    Count = 0;
757    ThisName = ResourceNames;
758    while (ThisName->Info.Name[0])
759    {
760        printf ("%4.4s    Resource Descriptor\n", ThisName->Info.Name);
761        Count++;
762        ThisName++;
763    }
764
765    printf ("%u Resource Descriptor Names are recognized\n", Count);
766
767    /*
768     * Predefined scope names
769     */
770    printf ("\nPredefined Scope Names\n\n");
771
772    ThisName = ScopeNames;
773    while (ThisName->Info.Name[0])
774    {
775        printf ("%4.4s    Scope\n", ThisName->Info.Name);
776        ThisName++;
777    }
778}
779
780
781/*******************************************************************************
782 *
783 * FUNCTION:    ApGetExpectedTypes
784 *
785 * PARAMETERS:  Buffer              - Where the formatted string is returned
786 *              ExpectedBTypes      - Bitfield of expected data types
787 *
788 * RETURN:      None, formatted string
789 *
790 * DESCRIPTION: Format the expected object types into a printable string.
791 *
792 ******************************************************************************/
793
794static void
795ApGetExpectedTypes (
796    char                        *Buffer,
797    UINT32                      ExpectedBtypes)
798{
799    UINT32                      ThisRtype;
800    UINT32                      i;
801    UINT32                      j;
802
803
804    j = 1;
805    Buffer[0] = 0;
806    ThisRtype = ACPI_RTYPE_INTEGER;
807
808    for (i = 0; i < ACPI_NUM_RTYPES; i++)
809    {
810        /* If one of the expected types, concatenate the name of this type */
811
812        if (ExpectedBtypes & ThisRtype)
813        {
814            ACPI_STRCAT (Buffer, &AcpiRtypeNames[i][j]);
815            j = 0;              /* Use name separator from now on */
816        }
817        ThisRtype <<= 1;    /* Next Rtype */
818    }
819}
820
821