19c7c683cSJung-uk Kim /******************************************************************************
29c7c683cSJung-uk Kim *
39c7c683cSJung-uk Kim * Module Name: utpredef - support functions for predefined names
49c7c683cSJung-uk Kim *
59c7c683cSJung-uk Kim *****************************************************************************/
69c7c683cSJung-uk Kim
70d84335fSJung-uk Kim /******************************************************************************
80d84335fSJung-uk Kim *
90d84335fSJung-uk Kim * 1. Copyright Notice
100d84335fSJung-uk Kim *
11*58308fadSJung-uk Kim * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
129c7c683cSJung-uk Kim * All rights reserved.
139c7c683cSJung-uk Kim *
140d84335fSJung-uk Kim * 2. License
150d84335fSJung-uk Kim *
160d84335fSJung-uk Kim * 2.1. This is your license from Intel Corp. under its intellectual property
170d84335fSJung-uk Kim * rights. You may have additional license terms from the party that provided
180d84335fSJung-uk Kim * you this software, covering your right to use that party's intellectual
190d84335fSJung-uk Kim * property rights.
200d84335fSJung-uk Kim *
210d84335fSJung-uk Kim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
220d84335fSJung-uk Kim * copy of the source code appearing in this file ("Covered Code") an
230d84335fSJung-uk Kim * irrevocable, perpetual, worldwide license under Intel's copyrights in the
240d84335fSJung-uk Kim * base code distributed originally by Intel ("Original Intel Code") to copy,
250d84335fSJung-uk Kim * make derivatives, distribute, use and display any portion of the Covered
260d84335fSJung-uk Kim * Code in any form, with the right to sublicense such rights; and
270d84335fSJung-uk Kim *
280d84335fSJung-uk Kim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
290d84335fSJung-uk Kim * license (with the right to sublicense), under only those claims of Intel
300d84335fSJung-uk Kim * patents that are infringed by the Original Intel Code, to make, use, sell,
310d84335fSJung-uk Kim * offer to sell, and import the Covered Code and derivative works thereof
320d84335fSJung-uk Kim * solely to the minimum extent necessary to exercise the above copyright
330d84335fSJung-uk Kim * license, and in no event shall the patent license extend to any additions
340d84335fSJung-uk Kim * to or modifications of the Original Intel Code. No other license or right
350d84335fSJung-uk Kim * is granted directly or by implication, estoppel or otherwise;
360d84335fSJung-uk Kim *
370d84335fSJung-uk Kim * The above copyright and patent license is granted only if the following
380d84335fSJung-uk Kim * conditions are met:
390d84335fSJung-uk Kim *
400d84335fSJung-uk Kim * 3. Conditions
410d84335fSJung-uk Kim *
420d84335fSJung-uk Kim * 3.1. Redistribution of Source with Rights to Further Distribute Source.
430d84335fSJung-uk Kim * Redistribution of source code of any substantial portion of the Covered
440d84335fSJung-uk Kim * Code or modification with rights to further distribute source must include
450d84335fSJung-uk Kim * the above Copyright Notice, the above License, this list of Conditions,
460d84335fSJung-uk Kim * and the following Disclaimer and Export Compliance provision. In addition,
470d84335fSJung-uk Kim * Licensee must cause all Covered Code to which Licensee contributes to
480d84335fSJung-uk Kim * contain a file documenting the changes Licensee made to create that Covered
490d84335fSJung-uk Kim * Code and the date of any change. Licensee must include in that file the
500d84335fSJung-uk Kim * documentation of any changes made by any predecessor Licensee. Licensee
510d84335fSJung-uk Kim * must include a prominent statement that the modification is derived,
520d84335fSJung-uk Kim * directly or indirectly, from Original Intel Code.
530d84335fSJung-uk Kim *
540d84335fSJung-uk Kim * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
550d84335fSJung-uk Kim * Redistribution of source code of any substantial portion of the Covered
560d84335fSJung-uk Kim * Code or modification without rights to further distribute source must
570d84335fSJung-uk Kim * include the following Disclaimer and Export Compliance provision in the
580d84335fSJung-uk Kim * documentation and/or other materials provided with distribution. In
590d84335fSJung-uk Kim * addition, Licensee may not authorize further sublicense of source of any
600d84335fSJung-uk Kim * portion of the Covered Code, and must include terms to the effect that the
610d84335fSJung-uk Kim * license from Licensee to its licensee is limited to the intellectual
620d84335fSJung-uk Kim * property embodied in the software Licensee provides to its licensee, and
630d84335fSJung-uk Kim * not to intellectual property embodied in modifications its licensee may
640d84335fSJung-uk Kim * make.
650d84335fSJung-uk Kim *
660d84335fSJung-uk Kim * 3.3. Redistribution of Executable. Redistribution in executable form of any
670d84335fSJung-uk Kim * substantial portion of the Covered Code or modification must reproduce the
680d84335fSJung-uk Kim * above Copyright Notice, and the following Disclaimer and Export Compliance
690d84335fSJung-uk Kim * provision in the documentation and/or other materials provided with the
700d84335fSJung-uk Kim * distribution.
710d84335fSJung-uk Kim *
720d84335fSJung-uk Kim * 3.4. Intel retains all right, title, and interest in and to the Original
730d84335fSJung-uk Kim * Intel Code.
740d84335fSJung-uk Kim *
750d84335fSJung-uk Kim * 3.5. Neither the name Intel nor any other trademark owned or controlled by
760d84335fSJung-uk Kim * Intel shall be used in advertising or otherwise to promote the sale, use or
770d84335fSJung-uk Kim * other dealings in products derived from or relating to the Covered Code
780d84335fSJung-uk Kim * without prior written authorization from Intel.
790d84335fSJung-uk Kim *
800d84335fSJung-uk Kim * 4. Disclaimer and Export Compliance
810d84335fSJung-uk Kim *
820d84335fSJung-uk Kim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
830d84335fSJung-uk Kim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
840d84335fSJung-uk Kim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
850d84335fSJung-uk Kim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
860d84335fSJung-uk Kim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
870d84335fSJung-uk Kim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
880d84335fSJung-uk Kim * PARTICULAR PURPOSE.
890d84335fSJung-uk Kim *
900d84335fSJung-uk Kim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
910d84335fSJung-uk Kim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
920d84335fSJung-uk Kim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
930d84335fSJung-uk Kim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
940d84335fSJung-uk Kim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
950d84335fSJung-uk Kim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
960d84335fSJung-uk Kim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
970d84335fSJung-uk Kim * LIMITED REMEDY.
980d84335fSJung-uk Kim *
990d84335fSJung-uk Kim * 4.3. Licensee shall not export, either directly or indirectly, any of this
1000d84335fSJung-uk Kim * software or system incorporating such software without first obtaining any
1010d84335fSJung-uk Kim * required license or other approval from the U. S. Department of Commerce or
1020d84335fSJung-uk Kim * any other agency or department of the United States Government. In the
1030d84335fSJung-uk Kim * event Licensee exports any such software from the United States or
1040d84335fSJung-uk Kim * re-exports any such software from a foreign destination, Licensee shall
1050d84335fSJung-uk Kim * ensure that the distribution and export/re-export of the software is in
1060d84335fSJung-uk Kim * compliance with all laws, regulations, orders, or other restrictions of the
1070d84335fSJung-uk Kim * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1080d84335fSJung-uk Kim * any of its subsidiaries will export/re-export any technical data, process,
1090d84335fSJung-uk Kim * software, or service, directly or indirectly, to any country for which the
1100d84335fSJung-uk Kim * United States government or any agency thereof requires an export license,
1110d84335fSJung-uk Kim * other governmental approval, or letter of assurance, without first obtaining
1120d84335fSJung-uk Kim * such license, approval or letter.
1130d84335fSJung-uk Kim *
1140d84335fSJung-uk Kim *****************************************************************************
1150d84335fSJung-uk Kim *
1160d84335fSJung-uk Kim * Alternatively, you may choose to be licensed under the terms of the
1170d84335fSJung-uk Kim * following license:
1180d84335fSJung-uk Kim *
1199c7c683cSJung-uk Kim * Redistribution and use in source and binary forms, with or without
1209c7c683cSJung-uk Kim * modification, are permitted provided that the following conditions
1219c7c683cSJung-uk Kim * are met:
1229c7c683cSJung-uk Kim * 1. Redistributions of source code must retain the above copyright
1239c7c683cSJung-uk Kim * notice, this list of conditions, and the following disclaimer,
1249c7c683cSJung-uk Kim * without modification.
1259c7c683cSJung-uk Kim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1269c7c683cSJung-uk Kim * substantially similar to the "NO WARRANTY" disclaimer below
1279c7c683cSJung-uk Kim * ("Disclaimer") and any redistribution must be conditioned upon
1289c7c683cSJung-uk Kim * including a substantially similar Disclaimer requirement for further
1299c7c683cSJung-uk Kim * binary redistribution.
1309c7c683cSJung-uk Kim * 3. Neither the names of the above-listed copyright holders nor the names
1319c7c683cSJung-uk Kim * of any contributors may be used to endorse or promote products derived
1329c7c683cSJung-uk Kim * from this software without specific prior written permission.
1339c7c683cSJung-uk Kim *
1340d84335fSJung-uk Kim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1350d84335fSJung-uk Kim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1360d84335fSJung-uk Kim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1370d84335fSJung-uk Kim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1380d84335fSJung-uk Kim * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1390d84335fSJung-uk Kim * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1400d84335fSJung-uk Kim * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1410d84335fSJung-uk Kim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1420d84335fSJung-uk Kim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1430d84335fSJung-uk Kim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1440d84335fSJung-uk Kim * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1450d84335fSJung-uk Kim *
1460d84335fSJung-uk Kim * Alternatively, you may choose to be licensed under the terms of the
1479c7c683cSJung-uk Kim * GNU General Public License ("GPL") version 2 as published by the Free
1489c7c683cSJung-uk Kim * Software Foundation.
1499c7c683cSJung-uk Kim *
1500d84335fSJung-uk Kim *****************************************************************************/
1519c7c683cSJung-uk Kim
1529c7c683cSJung-uk Kim #include <contrib/dev/acpica/include/acpi.h>
1539c7c683cSJung-uk Kim #include <contrib/dev/acpica/include/accommon.h>
1549c7c683cSJung-uk Kim #include <contrib/dev/acpica/include/acpredef.h>
1559c7c683cSJung-uk Kim
1569c7c683cSJung-uk Kim
1579c7c683cSJung-uk Kim #define _COMPONENT ACPI_UTILITIES
1589c7c683cSJung-uk Kim ACPI_MODULE_NAME ("utpredef")
1599c7c683cSJung-uk Kim
1609c7c683cSJung-uk Kim
1619c7c683cSJung-uk Kim /*
1629c7c683cSJung-uk Kim * Names for the types that can be returned by the predefined objects.
1639c7c683cSJung-uk Kim * Used for warning messages. Must be in the same order as the ACPI_RTYPEs
1649c7c683cSJung-uk Kim */
1659c7c683cSJung-uk Kim static const char *UtRtypeNames[] =
1669c7c683cSJung-uk Kim {
1679c7c683cSJung-uk Kim "/Integer",
1689c7c683cSJung-uk Kim "/String",
1699c7c683cSJung-uk Kim "/Buffer",
1709c7c683cSJung-uk Kim "/Package",
1719c7c683cSJung-uk Kim "/Reference",
1729c7c683cSJung-uk Kim };
1739c7c683cSJung-uk Kim
1749c7c683cSJung-uk Kim
1759c7c683cSJung-uk Kim /*******************************************************************************
1769c7c683cSJung-uk Kim *
1779c7c683cSJung-uk Kim * FUNCTION: AcpiUtGetNextPredefinedMethod
1789c7c683cSJung-uk Kim *
1799c7c683cSJung-uk Kim * PARAMETERS: ThisName - Entry in the predefined method/name table
1809c7c683cSJung-uk Kim *
1819c7c683cSJung-uk Kim * RETURN: Pointer to next entry in predefined table.
1829c7c683cSJung-uk Kim *
1839c7c683cSJung-uk Kim * DESCRIPTION: Get the next entry in the predefine method table. Handles the
1849c7c683cSJung-uk Kim * cases where a package info entry follows a method name that
1859c7c683cSJung-uk Kim * returns a package.
1869c7c683cSJung-uk Kim *
1879c7c683cSJung-uk Kim ******************************************************************************/
1889c7c683cSJung-uk Kim
1899c7c683cSJung-uk Kim const ACPI_PREDEFINED_INFO *
AcpiUtGetNextPredefinedMethod(const ACPI_PREDEFINED_INFO * ThisName)1909c7c683cSJung-uk Kim AcpiUtGetNextPredefinedMethod (
1919c7c683cSJung-uk Kim const ACPI_PREDEFINED_INFO *ThisName)
1929c7c683cSJung-uk Kim {
1939c7c683cSJung-uk Kim
1949c7c683cSJung-uk Kim /*
1959c7c683cSJung-uk Kim * Skip next entry in the table if this name returns a Package
1969c7c683cSJung-uk Kim * (next entry contains the package info)
1979c7c683cSJung-uk Kim */
1989c7c683cSJung-uk Kim if ((ThisName->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE) &&
1999c7c683cSJung-uk Kim (ThisName->Info.ExpectedBtypes != ACPI_RTYPE_ALL))
2009c7c683cSJung-uk Kim {
2019c7c683cSJung-uk Kim ThisName++;
2029c7c683cSJung-uk Kim }
2039c7c683cSJung-uk Kim
2049c7c683cSJung-uk Kim ThisName++;
2059c7c683cSJung-uk Kim return (ThisName);
2069c7c683cSJung-uk Kim }
2079c7c683cSJung-uk Kim
2089c7c683cSJung-uk Kim
2099c7c683cSJung-uk Kim /*******************************************************************************
2109c7c683cSJung-uk Kim *
2119c7c683cSJung-uk Kim * FUNCTION: AcpiUtMatchPredefinedMethod
2129c7c683cSJung-uk Kim *
2139c7c683cSJung-uk Kim * PARAMETERS: Name - Name to find
2149c7c683cSJung-uk Kim *
2159c7c683cSJung-uk Kim * RETURN: Pointer to entry in predefined table. NULL indicates not found.
2169c7c683cSJung-uk Kim *
2179c7c683cSJung-uk Kim * DESCRIPTION: Check an object name against the predefined object list.
2189c7c683cSJung-uk Kim *
2199c7c683cSJung-uk Kim ******************************************************************************/
2209c7c683cSJung-uk Kim
2219c7c683cSJung-uk Kim const ACPI_PREDEFINED_INFO *
AcpiUtMatchPredefinedMethod(char * Name)2229c7c683cSJung-uk Kim AcpiUtMatchPredefinedMethod (
2239c7c683cSJung-uk Kim char *Name)
2249c7c683cSJung-uk Kim {
2259c7c683cSJung-uk Kim const ACPI_PREDEFINED_INFO *ThisName;
2269c7c683cSJung-uk Kim
2279c7c683cSJung-uk Kim
2289c7c683cSJung-uk Kim /* Quick check for a predefined name, first character must be underscore */
2299c7c683cSJung-uk Kim
2309c7c683cSJung-uk Kim if (Name[0] != '_')
2319c7c683cSJung-uk Kim {
2329c7c683cSJung-uk Kim return (NULL);
2339c7c683cSJung-uk Kim }
2349c7c683cSJung-uk Kim
2359c7c683cSJung-uk Kim /* Search info table for a predefined method/object name */
2369c7c683cSJung-uk Kim
2379c7c683cSJung-uk Kim ThisName = AcpiGbl_PredefinedMethods;
2389c7c683cSJung-uk Kim while (ThisName->Info.Name[0])
2399c7c683cSJung-uk Kim {
240278f0de6SJung-uk Kim if (ACPI_COMPARE_NAMESEG (Name, ThisName->Info.Name))
2419c7c683cSJung-uk Kim {
2429c7c683cSJung-uk Kim return (ThisName);
2439c7c683cSJung-uk Kim }
2449c7c683cSJung-uk Kim
2459c7c683cSJung-uk Kim ThisName = AcpiUtGetNextPredefinedMethod (ThisName);
2469c7c683cSJung-uk Kim }
2479c7c683cSJung-uk Kim
2489c7c683cSJung-uk Kim return (NULL); /* Not found */
2499c7c683cSJung-uk Kim }
2509c7c683cSJung-uk Kim
2519c7c683cSJung-uk Kim
2529c7c683cSJung-uk Kim /*******************************************************************************
2539c7c683cSJung-uk Kim *
2549c7c683cSJung-uk Kim * FUNCTION: AcpiUtGetExpectedReturnTypes
2559c7c683cSJung-uk Kim *
2569c7c683cSJung-uk Kim * PARAMETERS: Buffer - Where the formatted string is returned
2579c7c683cSJung-uk Kim * ExpectedBTypes - Bitfield of expected data types
2589c7c683cSJung-uk Kim *
2599c7c683cSJung-uk Kim * RETURN: Formatted string in Buffer.
2609c7c683cSJung-uk Kim *
2619c7c683cSJung-uk Kim * DESCRIPTION: Format the expected object types into a printable string.
2629c7c683cSJung-uk Kim *
2639c7c683cSJung-uk Kim ******************************************************************************/
2649c7c683cSJung-uk Kim
2659c7c683cSJung-uk Kim void
AcpiUtGetExpectedReturnTypes(char * Buffer,UINT32 ExpectedBtypes)2669c7c683cSJung-uk Kim AcpiUtGetExpectedReturnTypes (
2679c7c683cSJung-uk Kim char *Buffer,
2689c7c683cSJung-uk Kim UINT32 ExpectedBtypes)
2699c7c683cSJung-uk Kim {
2709c7c683cSJung-uk Kim UINT32 ThisRtype;
2719c7c683cSJung-uk Kim UINT32 i;
2729c7c683cSJung-uk Kim UINT32 j;
2739c7c683cSJung-uk Kim
2749c7c683cSJung-uk Kim
275895f26a9SJung-uk Kim if (!ExpectedBtypes)
276895f26a9SJung-uk Kim {
2775ef50723SJung-uk Kim strcpy (Buffer, "NONE");
278895f26a9SJung-uk Kim return;
279895f26a9SJung-uk Kim }
280895f26a9SJung-uk Kim
2819c7c683cSJung-uk Kim j = 1;
2829c7c683cSJung-uk Kim Buffer[0] = 0;
2839c7c683cSJung-uk Kim ThisRtype = ACPI_RTYPE_INTEGER;
2849c7c683cSJung-uk Kim
2859c7c683cSJung-uk Kim for (i = 0; i < ACPI_NUM_RTYPES; i++)
2869c7c683cSJung-uk Kim {
2879c7c683cSJung-uk Kim /* If one of the expected types, concatenate the name of this type */
2889c7c683cSJung-uk Kim
2899c7c683cSJung-uk Kim if (ExpectedBtypes & ThisRtype)
2909c7c683cSJung-uk Kim {
2915ef50723SJung-uk Kim strcat (Buffer, &UtRtypeNames[i][j]);
2929c7c683cSJung-uk Kim j = 0; /* Use name separator from now on */
2939c7c683cSJung-uk Kim }
2949c7c683cSJung-uk Kim
2959c7c683cSJung-uk Kim ThisRtype <<= 1; /* Next Rtype */
2969c7c683cSJung-uk Kim }
2979c7c683cSJung-uk Kim }
2989c7c683cSJung-uk Kim
2999c7c683cSJung-uk Kim
3009c7c683cSJung-uk Kim /*******************************************************************************
3019c7c683cSJung-uk Kim *
3029c7c683cSJung-uk Kim * The remaining functions are used by iASL and AcpiHelp only
3039c7c683cSJung-uk Kim *
3049c7c683cSJung-uk Kim ******************************************************************************/
3059c7c683cSJung-uk Kim
3069c7c683cSJung-uk Kim #if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP)
3079c7c683cSJung-uk Kim
3089c7c683cSJung-uk Kim /* Local prototypes */
3099c7c683cSJung-uk Kim
3109c7c683cSJung-uk Kim static UINT32
3119c7c683cSJung-uk Kim AcpiUtGetArgumentTypes (
3129c7c683cSJung-uk Kim char *Buffer,
3139c7c683cSJung-uk Kim UINT16 ArgumentTypes);
3149c7c683cSJung-uk Kim
3159c7c683cSJung-uk Kim
3169c7c683cSJung-uk Kim /* Types that can be returned externally by a predefined name */
3179c7c683cSJung-uk Kim
3189c7c683cSJung-uk Kim static const char *UtExternalTypeNames[] = /* Indexed by ACPI_TYPE_* */
3199c7c683cSJung-uk Kim {
320f15e9afbSJung-uk Kim ", Type_ANY",
3219c7c683cSJung-uk Kim ", Integer",
3229c7c683cSJung-uk Kim ", String",
3239c7c683cSJung-uk Kim ", Buffer",
3249c7c683cSJung-uk Kim ", Package"
3259c7c683cSJung-uk Kim };
3269c7c683cSJung-uk Kim
3279c7c683cSJung-uk Kim /* Bit widths for resource descriptor predefined names */
3289c7c683cSJung-uk Kim
3299c7c683cSJung-uk Kim static const char *UtResourceTypeNames[] =
3309c7c683cSJung-uk Kim {
3319c7c683cSJung-uk Kim "/1",
3329c7c683cSJung-uk Kim "/2",
3339c7c683cSJung-uk Kim "/3",
3349c7c683cSJung-uk Kim "/8",
3359c7c683cSJung-uk Kim "/16",
3369c7c683cSJung-uk Kim "/32",
3379c7c683cSJung-uk Kim "/64",
3389c7c683cSJung-uk Kim "/variable",
3399c7c683cSJung-uk Kim };
3409c7c683cSJung-uk Kim
3419c7c683cSJung-uk Kim
3429c7c683cSJung-uk Kim /*******************************************************************************
3439c7c683cSJung-uk Kim *
3449c7c683cSJung-uk Kim * FUNCTION: AcpiUtMatchResourceName
3459c7c683cSJung-uk Kim *
3469c7c683cSJung-uk Kim * PARAMETERS: Name - Name to find
3479c7c683cSJung-uk Kim *
3489c7c683cSJung-uk Kim * RETURN: Pointer to entry in the resource table. NULL indicates not
3499c7c683cSJung-uk Kim * found.
3509c7c683cSJung-uk Kim *
3519c7c683cSJung-uk Kim * DESCRIPTION: Check an object name against the predefined resource
3529c7c683cSJung-uk Kim * descriptor object list.
3539c7c683cSJung-uk Kim *
3549c7c683cSJung-uk Kim ******************************************************************************/
3559c7c683cSJung-uk Kim
3569c7c683cSJung-uk Kim const ACPI_PREDEFINED_INFO *
AcpiUtMatchResourceName(char * Name)3579c7c683cSJung-uk Kim AcpiUtMatchResourceName (
3589c7c683cSJung-uk Kim char *Name)
3599c7c683cSJung-uk Kim {
3609c7c683cSJung-uk Kim const ACPI_PREDEFINED_INFO *ThisName;
3619c7c683cSJung-uk Kim
3629c7c683cSJung-uk Kim
363f8146b88SJung-uk Kim /*
364f8146b88SJung-uk Kim * Quick check for a predefined name, first character must
365f8146b88SJung-uk Kim * be underscore
366f8146b88SJung-uk Kim */
3679c7c683cSJung-uk Kim if (Name[0] != '_')
3689c7c683cSJung-uk Kim {
3699c7c683cSJung-uk Kim return (NULL);
3709c7c683cSJung-uk Kim }
3719c7c683cSJung-uk Kim
3729c7c683cSJung-uk Kim /* Search info table for a predefined method/object name */
3739c7c683cSJung-uk Kim
3749c7c683cSJung-uk Kim ThisName = AcpiGbl_ResourceNames;
3759c7c683cSJung-uk Kim while (ThisName->Info.Name[0])
3769c7c683cSJung-uk Kim {
377278f0de6SJung-uk Kim if (ACPI_COMPARE_NAMESEG (Name, ThisName->Info.Name))
3789c7c683cSJung-uk Kim {
3799c7c683cSJung-uk Kim return (ThisName);
3809c7c683cSJung-uk Kim }
3819c7c683cSJung-uk Kim
3829c7c683cSJung-uk Kim ThisName++;
3839c7c683cSJung-uk Kim }
3849c7c683cSJung-uk Kim
3859c7c683cSJung-uk Kim return (NULL); /* Not found */
3869c7c683cSJung-uk Kim }
3879c7c683cSJung-uk Kim
3889c7c683cSJung-uk Kim
3899c7c683cSJung-uk Kim /*******************************************************************************
3909c7c683cSJung-uk Kim *
3919c7c683cSJung-uk Kim * FUNCTION: AcpiUtDisplayPredefinedMethod
3929c7c683cSJung-uk Kim *
3939c7c683cSJung-uk Kim * PARAMETERS: Buffer - Scratch buffer for this function
3949c7c683cSJung-uk Kim * ThisName - Entry in the predefined method/name table
3959c7c683cSJung-uk Kim * MultiLine - TRUE if output should be on >1 line
3969c7c683cSJung-uk Kim *
3979c7c683cSJung-uk Kim * RETURN: None
3989c7c683cSJung-uk Kim *
3999c7c683cSJung-uk Kim * DESCRIPTION: Display information about a predefined method. Number and
4009c7c683cSJung-uk Kim * type of the input arguments, and expected type(s) for the
4019c7c683cSJung-uk Kim * return value, if any.
4029c7c683cSJung-uk Kim *
4039c7c683cSJung-uk Kim ******************************************************************************/
4049c7c683cSJung-uk Kim
4059c7c683cSJung-uk Kim void
AcpiUtDisplayPredefinedMethod(char * Buffer,const ACPI_PREDEFINED_INFO * ThisName,BOOLEAN MultiLine)4069c7c683cSJung-uk Kim AcpiUtDisplayPredefinedMethod (
4079c7c683cSJung-uk Kim char *Buffer,
4089c7c683cSJung-uk Kim const ACPI_PREDEFINED_INFO *ThisName,
4099c7c683cSJung-uk Kim BOOLEAN MultiLine)
4109c7c683cSJung-uk Kim {
4119c7c683cSJung-uk Kim UINT32 ArgCount;
4129c7c683cSJung-uk Kim
4139c7c683cSJung-uk Kim /*
4149c7c683cSJung-uk Kim * Get the argument count and the string buffer
4159c7c683cSJung-uk Kim * containing all argument types
4169c7c683cSJung-uk Kim */
4179c7c683cSJung-uk Kim ArgCount = AcpiUtGetArgumentTypes (Buffer,
4189c7c683cSJung-uk Kim ThisName->Info.ArgumentList);
4199c7c683cSJung-uk Kim
4209c7c683cSJung-uk Kim if (MultiLine)
4219c7c683cSJung-uk Kim {
4229c7c683cSJung-uk Kim printf (" ");
4239c7c683cSJung-uk Kim }
4249c7c683cSJung-uk Kim
4259c7c683cSJung-uk Kim printf ("%4.4s Requires %s%u argument%s",
4269c7c683cSJung-uk Kim ThisName->Info.Name,
4279c7c683cSJung-uk Kim (ThisName->Info.ArgumentList & ARG_COUNT_IS_MINIMUM) ?
4289c7c683cSJung-uk Kim "(at least) " : "",
4299c7c683cSJung-uk Kim ArgCount, ArgCount != 1 ? "s" : "");
4309c7c683cSJung-uk Kim
4319c7c683cSJung-uk Kim /* Display the types for any arguments */
4329c7c683cSJung-uk Kim
4339c7c683cSJung-uk Kim if (ArgCount > 0)
4349c7c683cSJung-uk Kim {
4359c7c683cSJung-uk Kim printf (" (%s)", Buffer);
4369c7c683cSJung-uk Kim }
4379c7c683cSJung-uk Kim
4389c7c683cSJung-uk Kim if (MultiLine)
4399c7c683cSJung-uk Kim {
4409c7c683cSJung-uk Kim printf ("\n ");
4419c7c683cSJung-uk Kim }
4429c7c683cSJung-uk Kim
4439c7c683cSJung-uk Kim /* Get the return value type(s) allowed */
4449c7c683cSJung-uk Kim
4459c7c683cSJung-uk Kim if (ThisName->Info.ExpectedBtypes)
4469c7c683cSJung-uk Kim {
4479c7c683cSJung-uk Kim AcpiUtGetExpectedReturnTypes (Buffer, ThisName->Info.ExpectedBtypes);
4489c7c683cSJung-uk Kim printf (" Return value types: %s\n", Buffer);
4499c7c683cSJung-uk Kim }
4509c7c683cSJung-uk Kim else
4519c7c683cSJung-uk Kim {
4529c7c683cSJung-uk Kim printf (" No return value\n");
4539c7c683cSJung-uk Kim }
4549c7c683cSJung-uk Kim }
4559c7c683cSJung-uk Kim
4569c7c683cSJung-uk Kim
4579c7c683cSJung-uk Kim /*******************************************************************************
4589c7c683cSJung-uk Kim *
4599c7c683cSJung-uk Kim * FUNCTION: AcpiUtGetArgumentTypes
4609c7c683cSJung-uk Kim *
4619c7c683cSJung-uk Kim * PARAMETERS: Buffer - Where to return the formatted types
4629c7c683cSJung-uk Kim * ArgumentTypes - Types field for this method
4639c7c683cSJung-uk Kim *
4649c7c683cSJung-uk Kim * RETURN: Count - the number of arguments required for this method
4659c7c683cSJung-uk Kim *
4669c7c683cSJung-uk Kim * DESCRIPTION: Format the required data types for this method (Integer,
4679c7c683cSJung-uk Kim * String, Buffer, or Package) and return the required argument
4689c7c683cSJung-uk Kim * count.
4699c7c683cSJung-uk Kim *
4709c7c683cSJung-uk Kim ******************************************************************************/
4719c7c683cSJung-uk Kim
4729c7c683cSJung-uk Kim static UINT32
AcpiUtGetArgumentTypes(char * Buffer,UINT16 ArgumentTypes)4739c7c683cSJung-uk Kim AcpiUtGetArgumentTypes (
4749c7c683cSJung-uk Kim char *Buffer,
4759c7c683cSJung-uk Kim UINT16 ArgumentTypes)
4769c7c683cSJung-uk Kim {
4779c7c683cSJung-uk Kim UINT16 ThisArgumentType;
4789c7c683cSJung-uk Kim UINT16 SubIndex;
4799c7c683cSJung-uk Kim UINT16 ArgCount;
4809c7c683cSJung-uk Kim UINT32 i;
4819c7c683cSJung-uk Kim
4829c7c683cSJung-uk Kim
4839c7c683cSJung-uk Kim *Buffer = 0;
4849c7c683cSJung-uk Kim SubIndex = 2;
4859c7c683cSJung-uk Kim
4869c7c683cSJung-uk Kim /* First field in the types list is the count of args to follow */
4879c7c683cSJung-uk Kim
488895f26a9SJung-uk Kim ArgCount = METHOD_GET_ARG_COUNT (ArgumentTypes);
4899c7c683cSJung-uk Kim if (ArgCount > METHOD_PREDEF_ARGS_MAX)
4909c7c683cSJung-uk Kim {
4919c7c683cSJung-uk Kim printf ("**** Invalid argument count (%u) "
4929c7c683cSJung-uk Kim "in predefined info structure\n", ArgCount);
4939c7c683cSJung-uk Kim return (ArgCount);
4949c7c683cSJung-uk Kim }
4959c7c683cSJung-uk Kim
4969c7c683cSJung-uk Kim /* Get each argument from the list, convert to ascii, store to buffer */
4979c7c683cSJung-uk Kim
4989c7c683cSJung-uk Kim for (i = 0; i < ArgCount; i++)
4999c7c683cSJung-uk Kim {
500895f26a9SJung-uk Kim ThisArgumentType = METHOD_GET_NEXT_TYPE (ArgumentTypes);
501895f26a9SJung-uk Kim
502f15e9afbSJung-uk Kim if (ThisArgumentType > METHOD_MAX_ARG_TYPE)
5039c7c683cSJung-uk Kim {
5049c7c683cSJung-uk Kim printf ("**** Invalid argument type (%u) "
5059c7c683cSJung-uk Kim "in predefined info structure\n", ThisArgumentType);
5069c7c683cSJung-uk Kim return (ArgCount);
5079c7c683cSJung-uk Kim }
5089c7c683cSJung-uk Kim
5099c7c683cSJung-uk Kim strcat (Buffer, UtExternalTypeNames[ThisArgumentType] + SubIndex);
5109c7c683cSJung-uk Kim SubIndex = 0;
5119c7c683cSJung-uk Kim }
5129c7c683cSJung-uk Kim
5139c7c683cSJung-uk Kim return (ArgCount);
5149c7c683cSJung-uk Kim }
5159c7c683cSJung-uk Kim
5169c7c683cSJung-uk Kim
5179c7c683cSJung-uk Kim /*******************************************************************************
5189c7c683cSJung-uk Kim *
5199c7c683cSJung-uk Kim * FUNCTION: AcpiUtGetResourceBitWidth
5209c7c683cSJung-uk Kim *
5219c7c683cSJung-uk Kim * PARAMETERS: Buffer - Where the formatted string is returned
5229c7c683cSJung-uk Kim * Types - Bitfield of expected data types
5239c7c683cSJung-uk Kim *
5249c7c683cSJung-uk Kim * RETURN: Count of return types. Formatted string in Buffer.
5259c7c683cSJung-uk Kim *
5269c7c683cSJung-uk Kim * DESCRIPTION: Format the resource bit widths into a printable string.
5279c7c683cSJung-uk Kim *
5289c7c683cSJung-uk Kim ******************************************************************************/
5299c7c683cSJung-uk Kim
5309c7c683cSJung-uk Kim UINT32
AcpiUtGetResourceBitWidth(char * Buffer,UINT16 Types)5319c7c683cSJung-uk Kim AcpiUtGetResourceBitWidth (
5329c7c683cSJung-uk Kim char *Buffer,
5339c7c683cSJung-uk Kim UINT16 Types)
5349c7c683cSJung-uk Kim {
5359c7c683cSJung-uk Kim UINT32 i;
5369c7c683cSJung-uk Kim UINT16 SubIndex;
5379c7c683cSJung-uk Kim UINT32 Found;
5389c7c683cSJung-uk Kim
5399c7c683cSJung-uk Kim
5409c7c683cSJung-uk Kim *Buffer = 0;
5419c7c683cSJung-uk Kim SubIndex = 1;
5429c7c683cSJung-uk Kim Found = 0;
5439c7c683cSJung-uk Kim
5449c7c683cSJung-uk Kim for (i = 0; i < NUM_RESOURCE_WIDTHS; i++)
5459c7c683cSJung-uk Kim {
5469c7c683cSJung-uk Kim if (Types & 1)
5479c7c683cSJung-uk Kim {
5489c7c683cSJung-uk Kim strcat (Buffer, &(UtResourceTypeNames[i][SubIndex]));
5499c7c683cSJung-uk Kim SubIndex = 0;
5509c7c683cSJung-uk Kim Found++;
5519c7c683cSJung-uk Kim }
5529c7c683cSJung-uk Kim
5539c7c683cSJung-uk Kim Types >>= 1;
5549c7c683cSJung-uk Kim }
5559c7c683cSJung-uk Kim
5569c7c683cSJung-uk Kim return (Found);
5579c7c683cSJung-uk Kim }
5589c7c683cSJung-uk Kim #endif
559