17c478bdstevel@tonic-gate/******************************************************************************
27c478bdstevel@tonic-gate *
37b1019aJerry Jelinek * Module Name: utclib - ACPICA implementations of C library functions
47c478bdstevel@tonic-gate *
57c478bdstevel@tonic-gate *****************************************************************************/
67c478bdstevel@tonic-gate
735786f6Robert Mustacchi/******************************************************************************
835786f6Robert Mustacchi *
935786f6Robert Mustacchi * 1. Copyright Notice
1035786f6Robert Mustacchi *
1135786f6Robert Mustacchi * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
127c478bdstevel@tonic-gate * All rights reserved.
137c478bdstevel@tonic-gate *
1435786f6Robert Mustacchi * 2. License
1535786f6Robert Mustacchi *
1635786f6Robert Mustacchi * 2.1. This is your license from Intel Corp. under its intellectual property
1735786f6Robert Mustacchi * rights. You may have additional license terms from the party that provided
1835786f6Robert Mustacchi * you this software, covering your right to use that party's intellectual
1935786f6Robert Mustacchi * property rights.
2035786f6Robert Mustacchi *
2135786f6Robert Mustacchi * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2235786f6Robert Mustacchi * copy of the source code appearing in this file ("Covered Code") an
2335786f6Robert Mustacchi * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2435786f6Robert Mustacchi * base code distributed originally by Intel ("Original Intel Code") to copy,
2535786f6Robert Mustacchi * make derivatives, distribute, use and display any portion of the Covered
2635786f6Robert Mustacchi * Code in any form, with the right to sublicense such rights; and
2735786f6Robert Mustacchi *
2835786f6Robert Mustacchi * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
2935786f6Robert Mustacchi * license (with the right to sublicense), under only those claims of Intel
3035786f6Robert Mustacchi * patents that are infringed by the Original Intel Code, to make, use, sell,
3135786f6Robert Mustacchi * offer to sell, and import the Covered Code and derivative works thereof
3235786f6Robert Mustacchi * solely to the minimum extent necessary to exercise the above copyright
3335786f6Robert Mustacchi * license, and in no event shall the patent license extend to any additions
3435786f6Robert Mustacchi * to or modifications of the Original Intel Code. No other license or right
3535786f6Robert Mustacchi * is granted directly or by implication, estoppel or otherwise;
3635786f6Robert Mustacchi *
3735786f6Robert Mustacchi * The above copyright and patent license is granted only if the following
3835786f6Robert Mustacchi * conditions are met:
3935786f6Robert Mustacchi *
4035786f6Robert Mustacchi * 3. Conditions
4135786f6Robert Mustacchi *
4235786f6Robert Mustacchi * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4335786f6Robert Mustacchi * Redistribution of source code of any substantial portion of the Covered
4435786f6Robert Mustacchi * Code or modification with rights to further distribute source must include
4535786f6Robert Mustacchi * the above Copyright Notice, the above License, this list of Conditions,
4635786f6Robert Mustacchi * and the following Disclaimer and Export Compliance provision. In addition,
4735786f6Robert Mustacchi * Licensee must cause all Covered Code to which Licensee contributes to
4835786f6Robert Mustacchi * contain a file documenting the changes Licensee made to create that Covered
4935786f6Robert Mustacchi * Code and the date of any change. Licensee must include in that file the
5035786f6Robert Mustacchi * documentation of any changes made by any predecessor Licensee. Licensee
5135786f6Robert Mustacchi * must include a prominent statement that the modification is derived,
5235786f6Robert Mustacchi * directly or indirectly, from Original Intel Code.
5335786f6Robert Mustacchi *
5435786f6Robert Mustacchi * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5535786f6Robert Mustacchi * Redistribution of source code of any substantial portion of the Covered
5635786f6Robert Mustacchi * Code or modification without rights to further distribute source must
5735786f6Robert Mustacchi * include the following Disclaimer and Export Compliance provision in the
5835786f6Robert Mustacchi * documentation and/or other materials provided with distribution. In
5935786f6Robert Mustacchi * addition, Licensee may not authorize further sublicense of source of any
6035786f6Robert Mustacchi * portion of the Covered Code, and must include terms to the effect that the
6135786f6Robert Mustacchi * license from Licensee to its licensee is limited to the intellectual
6235786f6Robert Mustacchi * property embodied in the software Licensee provides to its licensee, and
6335786f6Robert Mustacchi * not to intellectual property embodied in modifications its licensee may
6435786f6Robert Mustacchi * make.
6535786f6Robert Mustacchi *
6635786f6Robert Mustacchi * 3.3. Redistribution of Executable. Redistribution in executable form of any
6735786f6Robert Mustacchi * substantial portion of the Covered Code or modification must reproduce the
6835786f6Robert Mustacchi * above Copyright Notice, and the following Disclaimer and Export Compliance
6935786f6Robert Mustacchi * provision in the documentation and/or other materials provided with the
7035786f6Robert Mustacchi * distribution.
7135786f6Robert Mustacchi *
7235786f6Robert Mustacchi * 3.4. Intel retains all right, title, and interest in and to the Original
7335786f6Robert Mustacchi * Intel Code.
7435786f6Robert Mustacchi *
7535786f6Robert Mustacchi * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7635786f6Robert Mustacchi * Intel shall be used in advertising or otherwise to promote the sale, use or
7735786f6Robert Mustacchi * other dealings in products derived from or relating to the Covered Code
7835786f6Robert Mustacchi * without prior written authorization from Intel.
7935786f6Robert Mustacchi *
8035786f6Robert Mustacchi * 4. Disclaimer and Export Compliance
8135786f6Robert Mustacchi *
8235786f6Robert Mustacchi * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8335786f6Robert Mustacchi * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8435786f6Robert Mustacchi * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
8535786f6Robert Mustacchi * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
8635786f6Robert Mustacchi * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
8735786f6Robert Mustacchi * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8835786f6Robert Mustacchi * PARTICULAR PURPOSE.
8935786f6Robert Mustacchi *
9035786f6Robert Mustacchi * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9135786f6Robert Mustacchi * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9235786f6Robert Mustacchi * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9335786f6Robert Mustacchi * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9435786f6Robert Mustacchi * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9535786f6Robert Mustacchi * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
9635786f6Robert Mustacchi * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9735786f6Robert Mustacchi * LIMITED REMEDY.
9835786f6Robert Mustacchi *
9935786f6Robert Mustacchi * 4.3. Licensee shall not export, either directly or indirectly, any of this
10035786f6Robert Mustacchi * software or system incorporating such software without first obtaining any
10135786f6Robert Mustacchi * required license or other approval from the U. S. Department of Commerce or
10235786f6Robert Mustacchi * any other agency or department of the United States Government. In the
10335786f6Robert Mustacchi * event Licensee exports any such software from the United States or
10435786f6Robert Mustacchi * re-exports any such software from a foreign destination, Licensee shall
10535786f6Robert Mustacchi * ensure that the distribution and export/re-export of the software is in
10635786f6Robert Mustacchi * compliance with all laws, regulations, orders, or other restrictions of the
10735786f6Robert Mustacchi * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10835786f6Robert Mustacchi * any of its subsidiaries will export/re-export any technical data, process,
10935786f6Robert Mustacchi * software, or service, directly or indirectly, to any country for which the
11035786f6Robert Mustacchi * United States government or any agency thereof requires an export license,
11135786f6Robert Mustacchi * other governmental approval, or letter of assurance, without first obtaining
11235786f6Robert Mustacchi * such license, approval or letter.
11335786f6Robert Mustacchi *
11435786f6Robert Mustacchi *****************************************************************************
11535786f6Robert Mustacchi *
11635786f6Robert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
11735786f6Robert Mustacchi * following license:
11835786f6Robert Mustacchi *
11926f3cdfGordon Ross * Redistribution and use in source and binary forms, with or without
12026f3cdfGordon Ross * modification, are permitted provided that the following conditions
12126f3cdfGordon Ross * are met:
12226f3cdfGordon Ross * 1. Redistributions of source code must retain the above copyright
12326f3cdfGordon Ross *    notice, this list of conditions, and the following disclaimer,
12426f3cdfGordon Ross *    without modification.
12526f3cdfGordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12626f3cdfGordon Ross *    substantially similar to the "NO WARRANTY" disclaimer below
12726f3cdfGordon Ross *    ("Disclaimer") and any redistribution must be conditioned upon
12826f3cdfGordon Ross *    including a substantially similar Disclaimer requirement for further
12926f3cdfGordon Ross *    binary redistribution.
13026f3cdfGordon Ross * 3. Neither the names of the above-listed copyright holders nor the names
13126f3cdfGordon Ross *    of any contributors may be used to endorse or promote products derived
13226f3cdfGordon Ross *    from this software without specific prior written permission.
13326f3cdfGordon Ross *
13426f3cdfGordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13526f3cdfGordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13635786f6Robert Mustacchi * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
13726f3cdfGordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
13835786f6Robert Mustacchi * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
13935786f6Robert Mustacchi * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
14035786f6Robert Mustacchi * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14135786f6Robert Mustacchi * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
14235786f6Robert Mustacchi * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14335786f6Robert Mustacchi * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14435786f6Robert Mustacchi * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14535786f6Robert Mustacchi *
14635786f6Robert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
14735786f6Robert Mustacchi * GNU General Public License ("GPL") version 2 as published by the Free
14835786f6Robert Mustacchi * Software Foundation.
14935786f6Robert Mustacchi *
15035786f6Robert Mustacchi *****************************************************************************/
1517c478bdstevel@tonic-gate
1527b1019aJerry Jelinek#define ACPI_CLIBRARY
1537c478bdstevel@tonic-gate#include "acpi.h"
154aa2aa9aDana Myers#include "accommon.h"
1557c478bdstevel@tonic-gate
1567c478bdstevel@tonic-gate/*
1577b1019aJerry Jelinek * This module contains implementations of the standard C library functions
1587b1019aJerry Jelinek * that are required by the ACPICA code at both application level and kernel
1597b1019aJerry Jelinek * level.
1607b1019aJerry Jelinek *
1617b1019aJerry Jelinek * The module is an optional feature that can be used if a local/system
1627b1019aJerry Jelinek * C library is not available. Some operating system kernels may not have
1637b1019aJerry Jelinek * an internal C library.
1647b1019aJerry Jelinek *
1657b1019aJerry Jelinek * In general, these functions are less efficient than an inline or assembly
1667b1019aJerry Jelinek * code implementation.
1677b1019aJerry Jelinek *
1687b1019aJerry Jelinek * These C functions and the associated prototypes are enabled by default
1697b1019aJerry Jelinek * unless the ACPI_USE_SYSTEM_CLIBRARY symbol is defined. This is usually
1707b1019aJerry Jelinek * automatically defined for the ACPICA applications such as iASL and
1717b1019aJerry Jelinek * AcpiExec, so that these user-level applications use the local C library
1727b1019aJerry Jelinek * instead of the functions in this module.
1737c478bdstevel@tonic-gate */
1747c478bdstevel@tonic-gate
1757b1019aJerry Jelinek/*******************************************************************************
1767b1019aJerry Jelinek *
1777b1019aJerry Jelinek * Functions implemented in this module:
1787b1019aJerry Jelinek *
1797b1019aJerry Jelinek * FUNCTION:    memcmp
1807b1019aJerry Jelinek * FUNCTION:    memcpy
1817b1019aJerry Jelinek * FUNCTION:    memset
1827b1019aJerry Jelinek * FUNCTION:    strlen
1837b1019aJerry Jelinek * FUNCTION:    strcpy
1847b1019aJerry Jelinek * FUNCTION:    strncpy
1857b1019aJerry Jelinek * FUNCTION:    strcmp
1867b1019aJerry Jelinek * FUNCTION:    strchr
1877b1019aJerry Jelinek * FUNCTION:    strncmp
1887b1019aJerry Jelinek * FUNCTION:    strcat
1897b1019aJerry Jelinek * FUNCTION:    strncat
1907b1019aJerry Jelinek * FUNCTION:    strstr
1917b1019aJerry Jelinek * FUNCTION:    strtoul
1927b1019aJerry Jelinek * FUNCTION:    toupper
1937b1019aJerry Jelinek * FUNCTION:    tolower
1947b1019aJerry Jelinek * FUNCTION:    is* functions
1957b1019aJerry Jelinek *
1967b1019aJerry Jelinek ******************************************************************************/
1977c478bdstevel@tonic-gate
1987b1019aJerry Jelinek#define _COMPONENT          ACPI_UTILITIES
1997b1019aJerry Jelinek        ACPI_MODULE_NAME    ("utclib")
2007c478bdstevel@tonic-gate
2017c478bdstevel@tonic-gate
2027b1019aJerry Jelinek#ifndef ACPI_USE_SYSTEM_CLIBRARY    /* Entire module */
2037c478bdstevel@tonic-gate
2047c478bdstevel@tonic-gate
2057c478bdstevel@tonic-gate/*******************************************************************************
2067c478bdstevel@tonic-gate *
2077b1019aJerry Jelinek * FUNCTION:    memcmp
2087c478bdstevel@tonic-gate *
2097c478bdstevel@tonic-gate * PARAMETERS:  Buffer1         - First Buffer
2107c478bdstevel@tonic-gate *              Buffer2         - Second Buffer
2117c478bdstevel@tonic-gate *              Count           - Maximum # of bytes to compare
2127c478bdstevel@tonic-gate *
2137c478bdstevel@tonic-gate * RETURN:      Index where Buffers mismatched, or 0 if Buffers matched
2147c478bdstevel@tonic-gate *
2157c478bdstevel@tonic-gate * DESCRIPTION: Compare two Buffers, with a maximum length
2167c478bdstevel@tonic-gate *
2177c478bdstevel@tonic-gate ******************************************************************************/
2187c478bdstevel@tonic-gate
2197c478bdstevel@tonic-gateint
2207b1019aJerry Jelinekmemcmp (
2217b1019aJerry Jelinek    void                    *VBuffer1,
2227b1019aJerry Jelinek    void                    *VBuffer2,
2237c478bdstevel@tonic-gate    ACPI_SIZE               Count)
2247c478bdstevel@tonic-gate{
2257b1019aJerry Jelinek    char                    *Buffer1 = (char *) VBuffer1;
2267b1019aJerry Jelinek    char                    *Buffer2 = (char *) VBuffer2;
2277b1019aJerry Jelinek
2287c478bdstevel@tonic-gate
2297c478bdstevel@tonic-gate    for ( ; Count-- && (*Buffer1 == *Buffer2); Buffer1++, Buffer2++)
2307c478bdstevel@tonic-gate    {
2317c478bdstevel@tonic-gate    }
2327c478bdstevel@tonic-gate
2337c478bdstevel@tonic-gate    return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *Buffer1 -
2347c478bdstevel@tonic-gate        (unsigned char) *Buffer2));
2357c478bdstevel@tonic-gate}
2367c478bdstevel@tonic-gate
2377c478bdstevel@tonic-gate
2387c478bdstevel@tonic-gate/*******************************************************************************
2397c478bdstevel@tonic-gate *
24035786f6Robert Mustacchi * FUNCTION:    memmove
24135786f6Robert Mustacchi *
24235786f6Robert Mustacchi * PARAMETERS:  Dest        - Target of the copy
24335786f6Robert Mustacchi *              Src         - Source buffer to copy
24435786f6Robert Mustacchi *              Count       - Number of bytes to copy
24535786f6Robert Mustacchi *
24635786f6Robert Mustacchi * RETURN:      Dest
24735786f6Robert Mustacchi *
24835786f6Robert Mustacchi * DESCRIPTION: Copy arbitrary bytes of memory with respect to the overlapping
24935786f6Robert Mustacchi *
25035786f6Robert Mustacchi ******************************************************************************/
25135786f6Robert Mustacchi
25235786f6Robert Mustacchivoid *
25335786f6Robert Mustacchimemmove (
25435786f6Robert Mustacchi    void                    *Dest,
25535786f6Robert Mustacchi    const void              *Src,
25635786f6Robert Mustacchi    ACPI_SIZE               Count)
25735786f6Robert Mustacchi{
25835786f6Robert Mustacchi    char                    *New = (char *) Dest;
25935786f6Robert Mustacchi    char                    *Old = (char *) Src;
26035786f6Robert Mustacchi
26135786f6Robert Mustacchi
26235786f6Robert Mustacchi    if (Old > New)
26335786f6Robert Mustacchi    {
26435786f6Robert Mustacchi        /* Copy from the beginning */
26535786f6Robert Mustacchi
26635786f6Robert Mustacchi        while (Count)
26735786f6Robert Mustacchi        {
26835786f6Robert Mustacchi            *New = *Old;
26935786f6Robert Mustacchi            New++;
27035786f6Robert Mustacchi            Old++;
27135786f6Robert Mustacchi            Count--;
27235786f6Robert Mustacchi        }
27335786f6Robert Mustacchi    }
27435786f6Robert Mustacchi    else if (Old < New)
27535786f6Robert Mustacchi    {
27635786f6Robert Mustacchi        /* Copy from the end */
27735786f6Robert Mustacchi
27835786f6Robert Mustacchi        New = New + Count - 1;
27935786f6Robert Mustacchi        Old = Old + Count - 1;
28035786f6Robert Mustacchi        while (Count)
28135786f6Robert Mustacchi        {
28235786f6Robert Mustacchi            *New = *Old;
28335786f6Robert Mustacchi            New--;
28435786f6Robert Mustacchi            Old--;
28535786f6Robert Mustacchi            Count--;
28635786f6Robert Mustacchi        }
28735786f6Robert Mustacchi    }
28835786f6Robert Mustacchi
28935786f6Robert Mustacchi    return (Dest);
29035786f6Robert Mustacchi}
29135786f6Robert Mustacchi
29235786f6Robert Mustacchi
29335786f6Robert Mustacchi/*******************************************************************************
29435786f6Robert Mustacchi *
2957b1019aJerry Jelinek * FUNCTION:    memcpy
2967c478bdstevel@tonic-gate *
2977c478bdstevel@tonic-gate * PARAMETERS:  Dest        - Target of the copy
2987c478bdstevel@tonic-gate *              Src         - Source buffer to copy
2997c478bdstevel@tonic-gate *              Count       - Number of bytes to copy
3007c478bdstevel@tonic-gate *
3017c478bdstevel@tonic-gate * RETURN:      Dest
3027c478bdstevel@tonic-gate *
3037c478bdstevel@tonic-gate * DESCRIPTION: Copy arbitrary bytes of memory
3047c478bdstevel@tonic-gate *
3057c478bdstevel@tonic-gate ******************************************************************************/
3067c478bdstevel@tonic-gate
3077c478bdstevel@tonic-gatevoid *
3087b1019aJerry Jelinekmemcpy (
3097c478bdstevel@tonic-gate    void                    *Dest,
3107c478bdstevel@tonic-gate    const void              *Src,
3117c478bdstevel@tonic-gate    ACPI_SIZE               Count)
3127c478bdstevel@tonic-gate{
3137c478bdstevel@tonic-gate    char                    *New = (char *) Dest;
3147c478bdstevel@tonic-gate    char                    *Old = (char *) Src;
3157c478bdstevel@tonic-gate
3167c478bdstevel@tonic-gate
3177c478bdstevel@tonic-gate    while (Count)
3187c478bdstevel@tonic-gate    {
3197c478bdstevel@tonic-gate        *New = *Old;
3207c478bdstevel@tonic-gate        New++;
3217c478bdstevel@tonic-gate        Old++;
3227c478bdstevel@tonic-gate        Count--;
3237c478bdstevel@tonic-gate    }
3247c478bdstevel@tonic-gate
3257c478bdstevel@tonic-gate    return (Dest);
3267c478bdstevel@tonic-gate}
3277c478bdstevel@tonic-gate
3287c478bdstevel@tonic-gate
3297c478bdstevel@tonic-gate/*******************************************************************************
3307c478bdstevel@tonic-gate *
3317b1019aJerry Jelinek * FUNCTION:    memset
3327c478bdstevel@tonic-gate *
3337c478bdstevel@tonic-gate * PARAMETERS:  Dest        - Buffer to set
3347c478bdstevel@tonic-gate *              Value       - Value to set each byte of memory
3357c478bdstevel@tonic-gate *              Count       - Number of bytes to set
3367c478bdstevel@tonic-gate *
3377c478bdstevel@tonic-gate * RETURN:      Dest
3387c478bdstevel@tonic-gate *
3397c478bdstevel@tonic-gate * DESCRIPTION: Initialize a buffer to a known value.
3407c478bdstevel@tonic-gate *
3417c478bdstevel@tonic-gate ******************************************************************************/
3427c478bdstevel@tonic-gate
3437c478bdstevel@tonic-gatevoid *
3447b1019aJerry Jelinekmemset (
3457c478bdstevel@tonic-gate    void                    *Dest,
3467b1019aJerry Jelinek    int                     Value,
3477c478bdstevel@tonic-gate    ACPI_SIZE               Count)
3487c478bdstevel@tonic-gate{
3497c478bdstevel@tonic-gate    char                    *New = (char *) Dest;
3507c478bdstevel@tonic-gate
3517c478bdstevel@tonic-gate
3527c478bdstevel@tonic-gate    while (Count)
3537c478bdstevel@tonic-gate    {
3547c478bdstevel@tonic-gate        *New = (char) Value;
3557c478bdstevel@tonic-gate        New++;
3567c478bdstevel@tonic-gate        Count--;
3577c478bdstevel@tonic-gate    }
3587c478bdstevel@tonic-gate
3597c478bdstevel@tonic-gate    return (Dest);
3607c478bdstevel@tonic-gate}
3617c478bdstevel@tonic-gate
3627c478bdstevel@tonic-gate
3637c478bdstevel@tonic-gate/*******************************************************************************
3647c478bdstevel@tonic-gate *
3657b1019aJerry Jelinek * FUNCTION:    strlen
3667c478bdstevel@tonic-gate *
3677c478bdstevel@tonic-gate * PARAMETERS:  String              - Null terminated string
3687c478bdstevel@tonic-gate *
3697c478bdstevel@tonic-gate * RETURN:      Length
3707c478bdstevel@tonic-gate *
3717c478bdstevel@tonic-gate * DESCRIPTION: Returns the length of the input string
3727c478bdstevel@tonic-gate *
3737c478bdstevel@tonic-gate ******************************************************************************/
3747c478bdstevel@tonic-gate
3757c478bdstevel@tonic-gate
3767c478bdstevel@tonic-gateACPI_SIZE
3777b1019aJerry Jelinekstrlen (
3787c478bdstevel@tonic-gate    const char              *String)
3797c478bdstevel@tonic-gate{
3807c478bdstevel@tonic-gate    UINT32                  Length = 0;
3817c478bdstevel@tonic-gate
3827c478bdstevel@tonic-gate
3837c478bdstevel@tonic-gate    /* Count the string until a null is encountered */
3847c478bdstevel@tonic-gate
3857c478bdstevel@tonic-gate    while (*String)
3867c478bdstevel@tonic-gate    {
3877c478bdstevel@tonic-gate        Length++;
3887c478bdstevel@tonic-gate        String++;
3897c478bdstevel@tonic-gate    }
3907c478bdstevel@tonic-gate
3917c478bdstevel@tonic-gate    return (Length);
3927c478bdstevel@tonic-gate}
3937c478bdstevel@tonic-gate
3947c478bdstevel@tonic-gate
3957c478bdstevel@tonic-gate/*******************************************************************************
3967c478bdstevel@tonic-gate *
39735786f6Robert Mustacchi * FUNCTION:    strpbrk
39835786f6Robert Mustacchi *
39935786f6Robert Mustacchi * PARAMETERS:  String              - Null terminated string
40035786f6Robert Mustacchi *              Delimiters          - Delimiters to match
40135786f6Robert Mustacchi *
40235786f6Robert Mustacchi * RETURN:      The first occurance in the string of any of the bytes in the
40335786f6Robert Mustacchi *              delimiters
40435786f6Robert Mustacchi *
40535786f6Robert Mustacchi * DESCRIPTION: Search a string for any of a set of the delimiters
40635786f6Robert Mustacchi *
40735786f6Robert Mustacchi ******************************************************************************/
40835786f6Robert Mustacchi
40935786f6Robert Mustacchichar *
41035786f6Robert Mustacchistrpbrk (
41135786f6Robert Mustacchi    const char              *String,
41235786f6Robert Mustacchi    const char              *Delimiters)
41335786f6Robert Mustacchi{
41435786f6Robert Mustacchi    const char              *Delimiter;
41535786f6Robert Mustacchi
41635786f6Robert Mustacchi
41735786f6Robert Mustacchi    for ( ; *String != '\0'; ++String)
41835786f6Robert Mustacchi    {
41935786f6Robert Mustacchi        for (Delimiter = Delimiters; *Delimiter != '\0'; Delimiter++)
42035786f6Robert Mustacchi        {
42135786f6Robert Mustacchi            if (*String == *Delimiter)
42235786f6Robert Mustacchi            {
42335786f6Robert Mustacchi                return (ACPI_CAST_PTR (char, String));
42435786f6Robert Mustacchi            }
42535786f6Robert Mustacchi        }
42635786f6Robert Mustacchi    }
42735786f6Robert Mustacchi
42835786f6Robert Mustacchi    return (NULL);
42935786f6Robert Mustacchi}
43035786f6Robert Mustacchi
43135786f6Robert Mustacchi
43235786f6Robert Mustacchi/*******************************************************************************
43335786f6Robert Mustacchi *
43435786f6Robert Mustacchi * FUNCTION:    strtok
43535786f6Robert Mustacchi *
43635786f6Robert Mustacchi * PARAMETERS:  String              - Null terminated string
43735786f6Robert Mustacchi *              Delimiters          - Delimiters to match
43835786f6Robert Mustacchi *
43935786f6Robert Mustacchi * RETURN:      Pointer to the next token
44035786f6Robert Mustacchi *
44135786f6Robert Mustacchi * DESCRIPTION: Split string into tokens
44235786f6Robert Mustacchi *
44335786f6Robert Mustacchi ******************************************************************************/
44435786f6Robert Mustacchi
44535786f6Robert Mustacchichar*
44635786f6Robert Mustacchistrtok (
44735786f6Robert Mustacchi    char                    *String,
44835786f6Robert Mustacchi    const char              *Delimiters)
44935786f6Robert Mustacchi{
45035786f6Robert Mustacchi    char                    *Begin = String;
45135786f6Robert Mustacchi    static char             *SavedPtr;
45235786f6Robert Mustacchi
45335786f6Robert Mustacchi
45435786f6Robert Mustacchi    if (Begin == NULL)
45535786f6Robert Mustacchi    {
45635786f6Robert Mustacchi        if (SavedPtr == NULL)
45735786f6Robert Mustacchi        {
45835786f6Robert Mustacchi            return (NULL);
45935786f6Robert Mustacchi        }
46035786f6Robert Mustacchi        Begin = SavedPtr;
46135786f6Robert Mustacchi    }
46235786f6Robert Mustacchi
46335786f6Robert Mustacchi    SavedPtr = strpbrk (Begin, Delimiters);
46435786f6Robert Mustacchi    while (SavedPtr == Begin)
46535786f6Robert Mustacchi    {
46635786f6Robert Mustacchi        *Begin++ = '\0';
46735786f6Robert Mustacchi        SavedPtr = strpbrk (Begin, Delimiters);
46835786f6Robert Mustacchi    }
46935786f6Robert Mustacchi
47035786f6Robert Mustacchi    if (SavedPtr)
47135786f6Robert Mustacchi    {
47235786f6Robert Mustacchi        *SavedPtr++ = '\0';
47335786f6Robert Mustacchi        return (Begin);
47435786f6Robert Mustacchi    }
47535786f6Robert Mustacchi    else
47635786f6Robert Mustacchi    {
47735786f6Robert Mustacchi        return (NULL);
47835786f6Robert Mustacchi    }
47935786f6Robert Mustacchi}
48035786f6Robert Mustacchi
48135786f6Robert Mustacchi
48235786f6Robert Mustacchi/*******************************************************************************
48335786f6Robert Mustacchi *
4847b1019aJerry Jelinek * FUNCTION:    strcpy
4857c478bdstevel@tonic-gate *
4867c478bdstevel@tonic-gate * PARAMETERS:  DstString       - Target of the copy
4877c478bdstevel@tonic-gate *              SrcString       - The source string to copy
4887c478bdstevel@tonic-gate *
4897c478bdstevel@tonic-gate * RETURN:      DstString
4907c478bdstevel@tonic-gate *
4917c478bdstevel@tonic-gate * DESCRIPTION: Copy a null terminated string
4927c478bdstevel@tonic-gate *
4937c478bdstevel@tonic-gate ******************************************************************************/
4947c478bdstevel@tonic-gate
4957c478bdstevel@tonic-gatechar *
4967b1019aJerry Jelinekstrcpy (
4977c478bdstevel@tonic-gate    char                    *DstString,
4987c478bdstevel@tonic-gate    const char              *SrcString)
4997c478bdstevel@tonic-gate{
5007c478bdstevel@tonic-gate    char                    *String = DstString;
5017c478bdstevel@tonic-gate
5027c478bdstevel@tonic-gate
5037c478bdstevel@tonic-gate    /* Move bytes brute force */
5047c478bdstevel@tonic-gate
5057c478bdstevel@tonic-gate    while (*SrcString)
5067c478bdstevel@tonic-gate    {
5077c478bdstevel@tonic-gate        *String = *SrcString;
5087c478bdstevel@tonic-gate
5097c478bdstevel@tonic-gate        String++;
5107c478bdstevel@tonic-gate        SrcString++;
5117c478bdstevel@tonic-gate    }
5127c478bdstevel@tonic-gate
5137c478bdstevel@tonic-gate    /* Null terminate */
5147c478bdstevel@tonic-gate
5157c478bdstevel@tonic-gate    *String = 0;
5167c478bdstevel@tonic-gate    return (DstString);
5177c478bdstevel@tonic-gate}
5187c478bdstevel@tonic-gate
5197c478bdstevel@tonic-gate
5207c478bdstevel@tonic-gate/*******************************************************************************
5217c478bdstevel@tonic-gate *
5227b1019aJerry Jelinek * FUNCTION:    strncpy
5237c478bdstevel@tonic-gate *
5247c478bdstevel@tonic-gate * PARAMETERS:  DstString       - Target of the copy
5257c478bdstevel@tonic-gate *              SrcString       - The source string to copy
5267c478bdstevel@tonic-gate *              Count           - Maximum # of bytes to copy
5277c478bdstevel@tonic-gate *
5287c478bdstevel@tonic-gate * RETURN:      DstString
5297c478bdstevel@tonic-gate *
5307c478bdstevel@tonic-gate * DESCRIPTION: Copy a null terminated string, with a maximum length
5317c478bdstevel@tonic-gate *
5327c478bdstevel@tonic-gate ******************************************************************************/
5337c478bdstevel@tonic-gate
5347c478bdstevel@tonic-gatechar *
5357b1019aJerry Jelinekstrncpy (
5367c478bdstevel@tonic-gate    char                    *DstString,
5377c478bdstevel@tonic-gate    const char              *SrcString,
5387c478bdstevel@tonic-gate    ACPI_SIZE               Count)
5397c478bdstevel@tonic-gate{
5407c478bdstevel@tonic-gate    char                    *String = DstString;
5417c478bdstevel@tonic-gate
5427c478bdstevel@tonic-gate
5437c478bdstevel@tonic-gate    /* Copy the string */
5447c478bdstevel@tonic-gate
5457c478bdstevel@tonic-gate    for (String = DstString;
5467c478bdstevel@tonic-gate        Count && (Count--, (*String++ = *SrcString++)); )
5477c478bdstevel@tonic-gate    {;}
5487c478bdstevel@tonic-gate
5497c478bdstevel@tonic-gate    /* Pad with nulls if necessary */
5507c478bdstevel@tonic-gate
5517c478bdstevel@tonic-gate    while (Count--)
5527c478bdstevel@tonic-gate    {
5537c478bdstevel@tonic-gate        *String = 0;
5547c478bdstevel@tonic-gate        String++;
5557c478bdstevel@tonic-gate    }
5567c478bdstevel@tonic-gate
5577c478bdstevel@tonic-gate    /* Return original pointer */
5587c478bdstevel@tonic-gate
5597c478bdstevel@tonic-gate    return (DstString);
5607c478bdstevel@tonic-gate}
5617c478bdstevel@tonic-gate
5627c478bdstevel@tonic-gate
5637c478bdstevel@tonic-gate/*******************************************************************************
5647c478bdstevel@tonic-gate *
5657b1019aJerry Jelinek * FUNCTION:    strcmp
5667c478bdstevel@tonic-gate *
5677c478bdstevel@tonic-gate * PARAMETERS:  String1         - First string
5687c478bdstevel@tonic-gate *              String2         - Second string
5697c478bdstevel@tonic-gate *
5707c478bdstevel@tonic-gate * RETURN:      Index where strings mismatched, or 0 if strings matched
5717c478bdstevel@tonic-gate *
5727c478bdstevel@tonic-gate * DESCRIPTION: Compare two null terminated strings
5737c478bdstevel@tonic-gate *
5747c478bdstevel@tonic-gate ******************************************************************************/
5757c478bdstevel@tonic-gate
5767c478bdstevel@tonic-gateint
5777b1019aJerry Jelinekstrcmp (
5787c478bdstevel@tonic-gate    const char              *String1,
5797c478bdstevel@tonic-gate    const char              *String2)
5807c478bdstevel@tonic-gate{
5817c478bdstevel@tonic-gate
5827c478bdstevel@tonic-gate
5837c478bdstevel@tonic-gate    for ( ; (*String1 == *String2); String2++)
5847c478bdstevel@tonic-gate    {
5857c478bdstevel@tonic-gate        if (!*String1++)
5867c478bdstevel@tonic-gate        {
5877c478bdstevel@tonic-gate            return (0);
5887c478bdstevel@tonic-gate        }
5897c478bdstevel@tonic-gate    }
5907c478bdstevel@tonic-gate
5917c478bdstevel@tonic-gate    return ((unsigned char) *String1 - (unsigned char) *String2);
5927c478bdstevel@tonic-gate}
5937c478bdstevel@tonic-gate
5947c478bdstevel@tonic-gate
5957c478bdstevel@tonic-gate/*******************************************************************************
5967c478bdstevel@tonic-gate *
5977b1019aJerry Jelinek * FUNCTION:    strchr
5987c478bdstevel@tonic-gate *
5997c478bdstevel@tonic-gate * PARAMETERS:  String          - Search string
6007c478bdstevel@tonic-gate *              ch              - character to search for
6017c478bdstevel@tonic-gate *
6027c478bdstevel@tonic-gate * RETURN:      Ptr to char or NULL if not found
6037c478bdstevel@tonic-gate *
6047c478bdstevel@tonic-gate * DESCRIPTION: Search a string for a character
6057c478bdstevel@tonic-gate *
6067c478bdstevel@tonic-gate ******************************************************************************/
6077c478bdstevel@tonic-gate
6087c478bdstevel@tonic-gatechar *
6097b1019aJerry Jelinekstrchr (
6107c478bdstevel@tonic-gate    const char              *String,
6117c478bdstevel@tonic-gate    int                     ch)
6127c478bdstevel@tonic-gate{
6137c478bdstevel@tonic-gate
6147c478bdstevel@tonic-gate
6157c478bdstevel@tonic-gate    for ( ; (*String); String++)
6167c478bdstevel@tonic-gate    {
6177c478bdstevel@tonic-gate        if ((*String) == (char) ch)
6187c478bdstevel@tonic-gate        {
6197c478bdstevel@tonic-gate            return ((char *) String);
6207c478bdstevel@tonic-gate        }
6217c478bdstevel@tonic-gate    }
6227c478bdstevel@tonic-gate
6237c478bdstevel@tonic-gate    return (NULL);
6247c478bdstevel@tonic-gate}
6257b1019aJerry Jelinek
6267c478bdstevel@tonic-gate
6277c478bdstevel@tonic-gate/*******************************************************************************
6287c478bdstevel@tonic-gate *
6297b1019aJerry Jelinek * FUNCTION:    strncmp
6307c478bdstevel@tonic-gate *
6317c478bdstevel@tonic-gate * PARAMETERS:  String1         - First string
6327c478bdstevel@tonic-gate *              String2         - Second string
6337c478bdstevel@tonic-gate *              Count           - Maximum # of bytes to compare
6347c478bdstevel@tonic-gate *
6357c478bdstevel@tonic-gate * RETURN:      Index where strings mismatched, or 0 if strings matched
6367c478bdstevel@tonic-gate *
6377c478bdstevel@tonic-gate * DESCRIPTION: Compare two null terminated strings, with a maximum length
6387c478bdstevel@tonic-gate *
6397c478bdstevel@tonic-gate ******************************************************************************/
6407c478bdstevel@tonic-gate
6417c478bdstevel@tonic-gateint
6427b1019aJerry Jelinekstrncmp (
6437c478bdstevel@tonic-gate    const char              *String1,
6447c478bdstevel@tonic-gate    const char              *String2,
6457c478bdstevel@tonic-gate    ACPI_SIZE               Count)
6467c478bdstevel@tonic-gate{
6477c478bdstevel@tonic-gate
6487c478bdstevel@tonic-gate
6497c478bdstevel@tonic-gate    for ( ; Count-- && (*String1 == *String2); String2++)
6507c478bdstevel@tonic-gate    {
6517c478bdstevel@tonic-gate        if (!*String1++)
6527c478bdstevel@tonic-gate        {
6537c478bdstevel@tonic-gate            return (0);
6547c478bdstevel@tonic-gate        }
6557c478bdstevel@tonic-gate    }
6567c478bdstevel@tonic-gate
6577c478bdstevel@tonic-gate    return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *String1 -
6587c478bdstevel@tonic-gate        (unsigned char) *String2));
6597c478bdstevel@tonic-gate}
6607c478bdstevel@tonic-gate
6617c478bdstevel@tonic-gate
6627c478bdstevel@tonic-gate/*******************************************************************************
6637c478bdstevel@tonic-gate *
6647b1019aJerry Jelinek * FUNCTION:    strcat
6657c478bdstevel@tonic-gate *
6667c478bdstevel@tonic-gate * PARAMETERS:  DstString       - Target of the copy
6677c478bdstevel@tonic-gate *              SrcString       - The source string to copy
6687c478bdstevel@tonic-gate *
6697c478bdstevel@tonic-gate * RETURN:      DstString
6707c478bdstevel@tonic-gate *
6717c478bdstevel@tonic-gate * DESCRIPTION: Append a null terminated string to a null terminated string
6727c478bdstevel@tonic-gate *
6737c478bdstevel@tonic-gate ******************************************************************************/
6747c478bdstevel@tonic-gate
6757c478bdstevel@tonic-gatechar *
6767b1019aJerry Jelinekstrcat (
6777c478bdstevel@tonic-gate    char                    *DstString,
6787c478bdstevel@tonic-gate    const char              *SrcString)
6797c478bdstevel@tonic-gate{
6807c478bdstevel@tonic-gate    char                    *String;
6817c478bdstevel@tonic-gate
6827c478bdstevel@tonic-gate
6837c478bdstevel@tonic-gate    /* Find end of the destination string */
6847c478bdstevel@tonic-gate
6857c478bdstevel@tonic-gate    for (String = DstString; *String++; )
6867c478bdstevel@tonic-gate    { ; }
6877c478bdstevel@tonic-gate
6887c478bdstevel@tonic-gate    /* Concatenate the string */
6897c478bdstevel@tonic-gate
6907c478bdstevel@tonic-gate    for (--String; (*String++ = *SrcString++); )
6917c478bdstevel@tonic-gate    { ; }
6927c478bdstevel@tonic-gate
6937c478bdstevel@tonic-gate    return (DstString);
6947c478bdstevel@tonic-gate}
6957c478bdstevel@tonic-gate
6967c478bdstevel@tonic-gate
6977c478bdstevel@tonic-gate/*******************************************************************************
6987c478bdstevel@tonic-gate *
6997b1019aJerry Jelinek * FUNCTION:    strncat
7007c478bdstevel@tonic-gate *
7017c478bdstevel@tonic-gate * PARAMETERS:  DstString       - Target of the copy
7027c478bdstevel@tonic-gate *              SrcString       - The source string to copy
7037c478bdstevel@tonic-gate *              Count           - Maximum # of bytes to copy
7047c478bdstevel@tonic-gate *
7057c478bdstevel@tonic-gate * RETURN:      DstString
7067c478bdstevel@tonic-gate *
7077c478bdstevel@tonic-gate * DESCRIPTION: Append a null terminated string to a null terminated string,
7087c478bdstevel@tonic-gate *              with a maximum count.
7097c478bdstevel@tonic-gate *
7107c478bdstevel@tonic-gate ******************************************************************************/
7117c478bdstevel@tonic-gate
7127c478bdstevel@tonic-gatechar *
7137b1019aJerry Jelinekstrncat (
7147c478bdstevel@tonic-gate    char                    *DstString,
7157c478bdstevel@tonic-gate    const char              *SrcString,
7167c478bdstevel@tonic-gate    ACPI_SIZE               Count)
7177c478bdstevel@tonic-gate{
7187c478bdstevel@tonic-gate    char                    *String;
7197c478bdstevel@tonic-gate
7207c478bdstevel@tonic-gate
7217c478bdstevel@tonic-gate    if (Count)
7227c478bdstevel@tonic-gate    {
7237c478bdstevel@tonic-gate        /* Find end of the destination string */
7247c478bdstevel@tonic-gate
7257c478bdstevel@tonic-gate        for (String = DstString; *String++; )
7267c478bdstevel@tonic-gate        { ; }
7277c478bdstevel@tonic-gate
7287c478bdstevel@tonic-gate        /* Concatenate the string */
7297c478bdstevel@tonic-gate
7307c478bdstevel@tonic-gate        for (--String; (*String++ = *SrcString++) && --Count; )
7317c478bdstevel@tonic-gate        { ; }
7327c478bdstevel@tonic-gate
7337c478bdstevel@tonic-gate        /* Null terminate if necessary */
7347c478bdstevel@tonic-gate
7357c478bdstevel@tonic-gate        if (!Count)
7367c478bdstevel@tonic-gate        {
7377c478bdstevel@tonic-gate            *String = 0;
7387c478bdstevel@tonic-gate        }
7397c478bdstevel@tonic-gate    }
7407c478bdstevel@tonic-gate
7417c478bdstevel@tonic-gate    return (DstString);
7427c478bdstevel@tonic-gate}
7437c478bdstevel@tonic-gate
7447c478bdstevel@tonic-gate
7457c478bdstevel@tonic-gate/*******************************************************************************
7467c478bdstevel@tonic-gate *
7477b1019aJerry Jelinek * FUNCTION:    strstr
7487c478bdstevel@tonic-gate *
7497c478bdstevel@tonic-gate * PARAMETERS:  String1         - Target string
7507c478bdstevel@tonic-gate *              String2         - Substring to search for
7517c478bdstevel@tonic-gate *
7527c478bdstevel@tonic-gate * RETURN:      Where substring match starts, Null if no match found
7537c478bdstevel@tonic-gate *
7547c478bdstevel@tonic-gate * DESCRIPTION: Checks if String2 occurs in String1. This is not really a
7557c478bdstevel@tonic-gate *              full implementation of strstr, only sufficient for command
7567c478bdstevel@tonic-gate *              matching
7577c478bdstevel@tonic-gate *
7587c478bdstevel@tonic-gate ******************************************************************************/
7597c478bdstevel@tonic-gate
7607c478bdstevel@tonic-gatechar *
7617b1019aJerry Jelinekstrstr (
7627c478bdstevel@tonic-gate    char                    *String1,
7637c478bdstevel@tonic-gate    char                    *String2)
7647c478bdstevel@tonic-gate{
76535786f6Robert Mustacchi    ACPI_SIZE               Length;
7667c478bdstevel@tonic-gate
7677c478bdstevel@tonic-gate
7687b1019aJerry Jelinek    Length = strlen (String2);
7697b1019aJerry Jelinek    if (!Length)
7707c478bdstevel@tonic-gate    {
7717b1019aJerry Jelinek        return (String1);
7727c478bdstevel@tonic-gate    }
7737c478bdstevel@tonic-gate
7747b1019aJerry Jelinek    while (strlen (String1) >= Length)
7757c478bdstevel@tonic-gate    {
7767b1019aJerry Jelinek        if (memcmp (String1, String2, Length) == 0)
7777c478bdstevel@tonic-gate        {
7787b1019aJerry Jelinek            return (String1);
7797c478bdstevel@tonic-gate        }
7807b1019aJerry Jelinek        String1++;
7817c478bdstevel@tonic-gate    }
7827c478bdstevel@tonic-gate
7837b1019aJerry Jelinek    return (NULL);
7847c478bdstevel@tonic-gate}
7857c478bdstevel@tonic-gate
7867c478bdstevel@tonic-gate
7877c478bdstevel@tonic-gate/*******************************************************************************
7887c478bdstevel@tonic-gate *
7897b1019aJerry Jelinek * FUNCTION:    strtoul
7907c478bdstevel@tonic-gate *
7917c478bdstevel@tonic-gate * PARAMETERS:  String          - Null terminated string
7927c478bdstevel@tonic-gate *              Terminater      - Where a pointer to the terminating byte is
7937c478bdstevel@tonic-gate *                                returned
7947c478bdstevel@tonic-gate *              Base            - Radix of the string
7957c478bdstevel@tonic-gate *
7967c478bdstevel@tonic-gate * RETURN:      Converted value
7977c478bdstevel@tonic-gate *
7987c478bdstevel@tonic-gate * DESCRIPTION: Convert a string into a 32-bit unsigned value.
7997b1019aJerry Jelinek *              Note: use strtoul64 for 64-bit integers.
8007c478bdstevel@tonic-gate *
8017c478bdstevel@tonic-gate ******************************************************************************/
8027c478bdstevel@tonic-gate
8037c478bdstevel@tonic-gateUINT32
8047b1019aJerry Jelinekstrtoul (
8057c478bdstevel@tonic-gate    const char              *String,
8067c478bdstevel@tonic-gate    char                    **Terminator,
8077c478bdstevel@tonic-gate    UINT32                  Base)
8087c478bdstevel@tonic-gate{
8097c478bdstevel@tonic-gate    UINT32                  converted = 0;
8107c478bdstevel@tonic-gate    UINT32                  index;
8117c478bdstevel@tonic-gate    UINT32                  sign;
8127c478bdstevel@tonic-gate    const char              *StringStart;
8137c478bdstevel@tonic-gate    UINT32                  ReturnValue = 0;
8147c478bdstevel@tonic-gate    ACPI_STATUS             Status = AE_OK;
8157c478bdstevel@tonic-gate
8167c478bdstevel@tonic-gate
8177c478bdstevel@tonic-gate    /*
8187c478bdstevel@tonic-gate     * Save the value of the pointer to the buffer's first
8197c478bdstevel@tonic-gate     * character, save the current errno value, and then
8207c478bdstevel@tonic-gate     * skip over any white space in the buffer:
8217c478bdstevel@tonic-gate     */
8227c478bdstevel@tonic-gate    StringStart = String;
8237b1019aJerry Jelinek    while (isspace (*String) || *String == '\t')
8247c478bdstevel@tonic-gate    {
8257c478bdstevel@tonic-gate        ++String;
8267c478bdstevel@tonic-gate    }
8277c478bdstevel@tonic-gate
8287c478bdstevel@tonic-gate    /*
8297c478bdstevel@tonic-gate     * The buffer may contain an optional plus or minus sign.
8307c478bdstevel@tonic-gate     * If it does, then skip over it but remember what is was:
8317c478bdstevel@tonic-gate     */
8327c478bdstevel@tonic-gate    if (*String == '-')
8337c478bdstevel@tonic-gate    {
8347b1019aJerry Jelinek        sign = ACPI_SIGN_NEGATIVE;
8357c478bdstevel@tonic-gate        ++String;
8367c478bdstevel@tonic-gate    }
8377c478bdstevel@tonic-gate    else if (*String == '+')
8387c478bdstevel@tonic-gate    {
8397c478bdstevel@tonic-gate        ++String;
8407b1019aJerry Jelinek        sign = ACPI_SIGN_POSITIVE;
8417c478bdstevel@tonic-gate    }
8427c478bdstevel@tonic-gate    else
8437c478bdstevel@tonic-gate    {
8447b1019aJerry Jelinek        sign = ACPI_SIGN_POSITIVE;
8457c478bdstevel@tonic-gate    }
8467c478bdstevel@tonic-gate
8477c478bdstevel@tonic-gate    /*
8487c478bdstevel@tonic-gate     * If the input parameter Base is zero, then we need to
8497c478bdstevel@tonic-gate     * determine if it is octal, decimal, or hexadecimal:
8507c478bdstevel@tonic-gate     */
8517c478bdstevel@tonic-gate    if (Base == 0)
8527c478bdstevel@tonic-gate    {
8537c478bdstevel@tonic-gate        if (*String == '0')
8547c478bdstevel@tonic-gate        {
8557b1019aJerry Jelinek            if (tolower (*(++String)) == 'x')
8567c478bdstevel@tonic-gate            {
8577c478bdstevel@tonic-gate                Base = 16;
8587c478bdstevel@tonic-gate                ++String;
8597c478bdstevel@tonic-gate            }
8607c478bdstevel@tonic-gate            else
8617c478bdstevel@tonic-gate            {
8627c478bdstevel@tonic-gate                Base = 8;
8637c478bdstevel@tonic-gate            }
8647c478bdstevel@tonic-gate        }
8657c478bdstevel@tonic-gate        else
8667c478bdstevel@tonic-gate        {
8677c478bdstevel@tonic-gate            Base = 10;
8687c478bdstevel@tonic-gate        }
8697c478bdstevel@tonic-gate    }
8707c478bdstevel@tonic-gate    else if (Base < 2 || Base > 36)
8717c478bdstevel@tonic-gate    {
8727c478bdstevel@tonic-gate        /*
8737c478bdstevel@tonic-gate         * The specified Base parameter is not in the domain of
8747c478bdstevel@tonic-gate         * this function:
8757c478bdstevel@tonic-gate         */
8767c478bdstevel@tonic-gate        goto done;
8777c478bdstevel@tonic-gate    }
8787c478bdstevel@tonic-gate
8797c478bdstevel@tonic-gate    /*
8807c478bdstevel@tonic-gate     * For octal and hexadecimal bases, skip over the leading
8817c478bdstevel@tonic-gate     * 0 or 0x, if they are present.
8827c478bdstevel@tonic-gate     */
8837c478bdstevel@tonic-gate    if (Base == 8 && *String == '0')
8847c478bdstevel@tonic-gate    {
8857c478bdstevel@tonic-gate        String++;
8867c478bdstevel@tonic-gate    }
8877c478bdstevel@tonic-gate
8887c478bdstevel@tonic-gate    if (Base == 16 &&
8897c478bdstevel@tonic-gate        *String == '0' &&
8907b1019aJerry Jelinek        tolower (*(++String)) == 'x')
8917c478bdstevel@tonic-gate    {
8927c478bdstevel@tonic-gate        String++;
8937c478bdstevel@tonic-gate    }
8947c478bdstevel@tonic-gate
8957c478bdstevel@tonic-gate    /*
8967c478bdstevel@tonic-gate     * Main loop: convert the string to an unsigned long:
8977c478bdstevel@tonic-gate     */
8987c478bdstevel@tonic-gate    while (*String)
8997c478bdstevel@tonic-gate    {
9007b1019aJerry Jelinek        if (isdigit (*String))
9017c478bdstevel@tonic-gate        {
9027c478bdstevel@tonic-gate            index = (UINT32) ((UINT8) *String - '0');
9037c478bdstevel@tonic-gate        }
9047c478bdstevel@tonic-gate        else
9057c478bdstevel@tonic-gate        {
9067b1019aJerry Jelinek            index = (UINT32) toupper (*String);
9077b1019aJerry Jelinek            if (isupper (index))
9087c478bdstevel@tonic-gate            {
9097c478bdstevel@tonic-gate                index = index - 'A' + 10;
9107c478bdstevel@tonic-gate            }
9117c478bdstevel@tonic-gate            else
9127c478bdstevel@tonic-gate            {
9137c478bdstevel@tonic-gate                goto done;
9147c478bdstevel@tonic-gate            }
9157c478bdstevel@tonic-gate        }
9167c478bdstevel@tonic-gate
9177c478bdstevel@tonic-gate        if (index >= Base)
9187c478bdstevel@tonic-gate        {
9197c478bdstevel@tonic-gate            goto done;
9207c478bdstevel@tonic-gate        }
9217c478bdstevel@tonic-gate
9227c478bdstevel@tonic-gate        /*
9237c478bdstevel@tonic-gate         * Check to see if value is out of range:
9247c478bdstevel@tonic-gate         */
9257c478bdstevel@tonic-gate
9267c478bdstevel@tonic-gate        if (ReturnValue > ((ACPI_UINT32_MAX - (UINT32) index) /
9277c478bdstevel@tonic-gate                            (UINT32) Base))
9287c478bdstevel@tonic-gate        {
9297c478bdstevel@tonic-gate            Status = AE_ERROR;
9307c478bdstevel@tonic-gate            ReturnValue = 0;           /* reset */
9317c478bdstevel@tonic-gate        }
9327c478bdstevel@tonic-gate        else
9337c478bdstevel@tonic-gate        {
9347c478bdstevel@tonic-gate            ReturnValue *= Base;
9357c478bdstevel@tonic-gate            ReturnValue += index;
9367c478bdstevel@tonic-gate            converted = 1;
9377c478bdstevel@tonic-gate        }
9387c478bdstevel@tonic-gate
9397c478bdstevel@tonic-gate        ++String;
9407c478bdstevel@tonic-gate    }
9417c478bdstevel@tonic-gate
9427c478bdstevel@tonic-gatedone:
9437c478bdstevel@tonic-gate    /*
9447c478bdstevel@tonic-gate     * If appropriate, update the caller's pointer to the next
9457c478bdstevel@tonic-gate     * unconverted character in the buffer.
9467c478bdstevel@tonic-gate     */
9477c478bdstevel@tonic-gate    if (Terminator)
9487c478bdstevel@tonic-gate    {
9497c478bdstevel@tonic-gate        if (converted == 0 && ReturnValue == 0 && String != NULL)
9507c478bdstevel@tonic-gate        {
9517c478bdstevel@tonic-gate            *Terminator = (char *) StringStart;
9527c478bdstevel@tonic-gate        }
9537c478bdstevel@tonic-gate        else
9547c478bdstevel@tonic-gate        {
9557c478bdstevel@tonic-gate            *Terminator = (char *) String;
9567c478bdstevel@tonic-gate        }
9577c478bdstevel@tonic-gate    }
9587c478bdstevel@tonic-gate
9597c478bdstevel@tonic-gate    if (Status == AE_ERROR)
9607c478bdstevel@tonic-gate    {
9617c478bdstevel@tonic-gate        ReturnValue = ACPI_UINT32_MAX;
9627c478bdstevel@tonic-gate    }
9637c478bdstevel@tonic-gate
9647c478bdstevel@tonic-gate    /*
9657c478bdstevel@tonic-gate     * If a minus sign was present, then "the conversion is negated":
9667c478bdstevel@tonic-gate     */
9677b1019aJerry Jelinek    if (sign == ACPI_SIGN_NEGATIVE)
9687c478bdstevel@tonic-gate    {
9697c478bdstevel@tonic-gate        ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
9707c478bdstevel@tonic-gate    }
9717c478bdstevel@tonic-gate
9727c478bdstevel@tonic-gate    return (ReturnValue);
9737c478bdstevel@tonic-gate}
9747c478bdstevel@tonic-gate
9757c478bdstevel@tonic-gate
9767c478bdstevel@tonic-gate/*******************************************************************************
9777c478bdstevel@tonic-gate *
9787b1019aJerry Jelinek * FUNCTION:    toupper
9797c478bdstevel@tonic-gate *
9807c478bdstevel@tonic-gate * PARAMETERS:  c           - Character to convert
9817c478bdstevel@tonic-gate *
9827c478bdstevel@tonic-gate * RETURN:      Converted character as an int
9837c478bdstevel@tonic-gate *
9847c478bdstevel@tonic-gate * DESCRIPTION: Convert character to uppercase
9857c478bdstevel@tonic-gate *
9867c478bdstevel@tonic-gate ******************************************************************************/
9877c478bdstevel@tonic-gate
9887c478bdstevel@tonic-gateint
9897b1019aJerry Jelinektoupper (
9907c478bdstevel@tonic-gate    int                     c)
9917c478bdstevel@tonic-gate{
9927c478bdstevel@tonic-gate
9937b1019aJerry Jelinek    return (islower(c) ? ((c)-0x20) : (c));
9947c478bdstevel@tonic-gate}
9957c478bdstevel@tonic-gate
9967c478bdstevel@tonic-gate
9977c478bdstevel@tonic-gate/*******************************************************************************
9987c478bdstevel@tonic-gate *
9997b1019aJerry Jelinek * FUNCTION:    tolower
10007c478bdstevel@tonic-gate *
10017c478bdstevel@tonic-gate * PARAMETERS:  c           - Character to convert
10027c478bdstevel@tonic-gate *
10037c478bdstevel@tonic-gate * RETURN:      Converted character as an int
10047c478bdstevel@tonic-gate *
10057c478bdstevel@tonic-gate * DESCRIPTION: Convert character to lowercase
10067c478bdstevel@tonic-gate *
10077c478bdstevel@tonic-gate ******************************************************************************/
10087c478bdstevel@tonic-gate
10097c478bdstevel@tonic-gateint
10107b1019aJerry Jelinektolower (
10117c478bdstevel@tonic-gate    int                     c)
10127c478bdstevel@tonic-gate{
10137c478bdstevel@tonic-gate
10147b1019aJerry Jelinek    return (isupper(c) ? ((c)+0x20) : (c));
10157c478bdstevel@tonic-gate}
10167c478bdstevel@tonic-gate
10177c478bdstevel@tonic-gate
10187c478bdstevel@tonic-gate/*******************************************************************************
10197c478bdstevel@tonic-gate *
10207b1019aJerry Jelinek * FUNCTION:    is* function array
10217c478bdstevel@tonic-gate *
10227c478bdstevel@tonic-gate * DESCRIPTION: is* functions use the ctype table below
10237c478bdstevel@tonic-gate *
10247c478bdstevel@tonic-gate ******************************************************************************/
10257c478bdstevel@tonic-gate
10267b1019aJerry Jelinekconst UINT8 AcpiGbl_Ctypes[257] = {
10277b1019aJerry Jelinek    _ACPI_CN,            /* 0x00     0 NUL */
10287b1019aJerry Jelinek    _ACPI_CN,            /* 0x01     1 SOH */
10297b1019aJerry Jelinek    _ACPI_CN,            /* 0x02     2 STX */
10307b1019aJerry Jelinek    _ACPI_CN,            /* 0x03     3 ETX */
10317b1019aJerry Jelinek    _ACPI_CN,            /* 0x04     4 EOT */
10327b1019aJerry Jelinek    _ACPI_CN,            /* 0x05     5 ENQ */
10337b1019aJerry Jelinek    _ACPI_CN,            /* 0x06     6 ACK */
10347b1019aJerry Jelinek    _ACPI_CN,            /* 0x07     7 BEL */
10357b1019aJerry Jelinek    _ACPI_CN,            /* 0x08     8 BS  */
10367b1019aJerry Jelinek    _ACPI_CN|_ACPI_SP,   /* 0x09     9 TAB */
10377b1019aJerry Jelinek    _ACPI_CN|_ACPI_SP,   /* 0x0A    10 LF  */
10387b1019aJerry Jelinek    _ACPI_CN|_ACPI_SP,   /* 0x0B    11 VT  */
10397b1019aJerry Jelinek    _ACPI_CN|_ACPI_SP,   /* 0x0C    12 FF  */
10407b1019aJerry Jelinek    _ACPI_CN|_ACPI_SP,   /* 0x0D    13 CR  */
10417b1019aJerry Jelinek    _ACPI_CN,            /* 0x0E    14 SO  */
10427b1019aJerry Jelinek    _ACPI_CN,            /* 0x0F    15 SI  */
10437b1019aJerry Jelinek    _ACPI_CN,            /* 0x10    16 DLE */
10447b1019aJerry Jelinek    _ACPI_CN,            /* 0x11    17 DC1 */
10457b1019aJerry Jelinek    _ACPI_CN,            /* 0x12    18 DC2 */
10467b1019aJerry Jelinek    _ACPI_CN,            /* 0x13    19 DC3 */
10477b1019aJerry Jelinek    _ACPI_CN,            /* 0x14    20 DC4 */
10487b1019aJerry Jelinek    _ACPI_CN,            /* 0x15    21 NAK */
10497b1019aJerry Jelinek    _ACPI_CN,            /* 0x16    22 SYN */
10507b1019aJerry Jelinek    _ACPI_CN,            /* 0x17    23 ETB */
10517b1019aJerry Jelinek    _ACPI_CN,            /* 0x18    24 CAN */
10527b1019aJerry Jelinek    _ACPI_CN,            /* 0x19    25 EM  */
10537b1019aJerry Jelinek    _ACPI_CN,            /* 0x1A    26 SUB */
10547b1019aJerry Jelinek    _ACPI_CN,            /* 0x1B    27 ESC */
10557b1019aJerry Jelinek    _ACPI_CN,            /* 0x1C    28 FS  */
10567b1019aJerry Jelinek    _ACPI_CN,            /* 0x1D    29 GS  */
10577b1019aJerry Jelinek    _ACPI_CN,            /* 0x1E    30 RS  */
10587b1019aJerry Jelinek    _ACPI_CN,            /* 0x1F    31 US  */
10597b1019aJerry Jelinek    _ACPI_XS|_ACPI_SP,   /* 0x20    32 ' ' */
10607b1019aJerry Jelinek    _ACPI_PU,            /* 0x21    33 '!' */
10617b1019aJerry Jelinek    _ACPI_PU,            /* 0x22    34 '"' */
10627b1019aJerry Jelinek    _ACPI_PU,            /* 0x23    35 '#' */
10637b1019aJerry Jelinek    _ACPI_PU,            /* 0x24    36 '$' */
10647b1019aJerry Jelinek    _ACPI_PU,            /* 0x25    37 '%' */
10657b1019aJerry Jelinek    _ACPI_PU,            /* 0x26    38 '&' */
10667b1019aJerry Jelinek    _ACPI_PU,            /* 0x27    39 ''' */
10677b1019aJerry Jelinek    _ACPI_PU,            /* 0x28    40 '(' */
10687b1019aJerry Jelinek    _ACPI_PU,            /* 0x29    41 ')' */
10697b1019aJerry Jelinek    _ACPI_PU,            /* 0x2A    42 '*' */
10707b1019aJerry Jelinek    _ACPI_PU,            /* 0x2B    43 '+' */
10717b1019aJerry Jelinek    _ACPI_PU,            /* 0x2C    44 ',' */
10727b1019aJerry Jelinek    _ACPI_PU,            /* 0x2D    45 '-' */
10737b1019aJerry Jelinek    _ACPI_PU,            /* 0x2E    46 '.' */
10747b1019aJerry Jelinek    _ACPI_PU,            /* 0x2F    47 '/' */
10757b1019aJerry Jelinek    _ACPI_XD|_ACPI_DI,   /* 0x30    48 '0' */
10767b1019aJerry Jelinek    _ACPI_XD|_ACPI_DI,   /* 0x31    49 '1' */
10777b1019aJerry Jelinek    _ACPI_XD|_ACPI_DI,   /* 0x32    50 '2' */
10787b1019aJerry Jelinek    _ACPI_XD|_ACPI_DI,   /* 0x33    51 '3' */
10797b1019aJerry Jelinek    _ACPI_XD|_ACPI_DI,   /* 0x34    52 '4' */
10807b1019aJerry Jelinek    _ACPI_XD|_ACPI_DI,   /* 0x35    53 '5' */
10817b1019aJerry Jelinek    _ACPI_XD|_ACPI_DI,   /* 0x36    54 '6' */
10827b1019aJerry Jelinek    _ACPI_XD|_ACPI_DI,   /* 0x37    55 '7' */
10837b1019aJerry Jelinek    _ACPI_XD|_ACPI_DI,   /* 0x38    56 '8' */
10847b1019aJerry Jelinek    _ACPI_XD|_ACPI_DI,   /* 0x39    57 '9' */
10857b1019aJerry Jelinek    _ACPI_PU,            /* 0x3A    58 ':' */
10867b1019aJerry Jelinek    _ACPI_PU,            /* 0x3B    59 ';' */
10877b1019aJerry Jelinek    _ACPI_PU,            /* 0x3C    60 '<' */
10887b1019aJerry Jelinek    _ACPI_PU,            /* 0x3D    61 '=' */
10897b1019aJerry Jelinek    _ACPI_PU,            /* 0x3E    62 '>' */
10907b1019aJerry Jelinek    _ACPI_PU,            /* 0x3F    63 '?' */
10917b1019aJerry Jelinek    _ACPI_PU,            /* 0x40    64 '@' */
10927b1019aJerry Jelinek    _ACPI_XD|_ACPI_UP,   /* 0x41    65 'A' */
10937b1019aJerry Jelinek    _ACPI_XD|_ACPI_UP,   /* 0x42    66 'B' */
10947b1019aJerry Jelinek    _ACPI_XD|_ACPI_UP,   /* 0x43    67 'C' */
10957b1019aJerry Jelinek    _ACPI_XD|_ACPI_UP,   /* 0x44    68 'D' */
10967b1019aJerry Jelinek    _ACPI_XD|_ACPI_UP,   /* 0x45    69 'E' */
10977b1019aJerry Jelinek    _ACPI_XD|_ACPI_UP,   /* 0x46    70 'F' */
10987b1019aJerry Jelinek    _ACPI_UP,            /* 0x47    71 'G' */
10997b1019aJerry Jelinek    _ACPI_UP,            /* 0x48    72 'H' */
11007b1019aJerry Jelinek    _ACPI_UP,            /* 0x49    73 'I' */
11017b1019aJerry Jelinek    _ACPI_UP,            /* 0x4A    74 'J' */
11027b1019aJerry Jelinek    _ACPI_UP,            /* 0x4B    75 'K' */
11037b1019aJerry Jelinek    _ACPI_UP,            /* 0x4C    76 'L' */
11047b1019aJerry Jelinek    _ACPI_UP,            /* 0x4D    77 'M' */
11057b1019aJerry Jelinek    _ACPI_UP,            /* 0x4E    78 'N' */
11067b1019aJerry Jelinek    _ACPI_UP,            /* 0x4F    79 'O' */
11077b1019aJerry Jelinek    _ACPI_UP,            /* 0x50    80 'P' */
11087b1019aJerry Jelinek    _ACPI_UP,            /* 0x51    81 'Q' */
11097b1019aJerry Jelinek    _ACPI_UP,            /* 0x52    82 'R' */
11107b1019aJerry Jelinek    _ACPI_UP,            /* 0x53    83 'S' */
11117b1019aJerry Jelinek    _ACPI_UP,            /* 0x54    84 'T' */
11127b1019aJerry Jelinek    _ACPI_UP,            /* 0x55    85 'U' */
11137b1019aJerry Jelinek    _ACPI_UP,            /* 0x56    86 'V' */
11147b1019aJerry Jelinek    _ACPI_UP,            /* 0x57    87 'W' */
11157b1019aJerry Jelinek    _ACPI_UP,            /* 0x58    88 'X' */
11167b1019aJerry Jelinek    _ACPI_UP,            /* 0x59    89 'Y' */
11177b1019aJerry Jelinek    _ACPI_UP,            /* 0x5A    90 'Z' */
11187b1019aJerry Jelinek    _ACPI_PU,            /* 0x5B    91 '[' */
11197b1019aJerry Jelinek    _ACPI_PU,            /* 0x5C    92 '\' */
11207b1019aJerry Jelinek    _ACPI_PU,            /* 0x5D    93 ']' */
11217b1019aJerry Jelinek    _ACPI_PU,            /* 0x5E    94 '^' */
11227b1019aJerry Jelinek    _ACPI_PU,            /* 0x5F    95 '_' */
11237b1019aJerry Jelinek    _ACPI_PU,            /* 0x60    96 '`' */
11247b1019aJerry Jelinek    _ACPI_XD|_ACPI_LO,   /* 0x61    97 'a' */
11257b1019aJerry Jelinek    _ACPI_XD|_ACPI_LO,   /* 0x62    98 'b' */
11267b1019aJerry Jelinek    _ACPI_XD|_ACPI_LO,   /* 0x63    99 'c' */
11277b1019aJerry Jelinek    _ACPI_XD|_ACPI_LO,   /* 0x64   100 'd' */
11287b1019aJerry Jelinek    _ACPI_XD|_ACPI_LO,   /* 0x65   101 'e' */
11297b1019aJerry Jelinek    _ACPI_XD|_ACPI_LO,   /* 0x66   102 'f' */
11307b1019aJerry Jelinek    _ACPI_LO,            /* 0x67   103 'g' */
11317b1019aJerry Jelinek    _ACPI_LO,            /* 0x68   104 'h' */
11327b1019aJerry Jelinek    _ACPI_LO,            /* 0x69   105 'i' */
11337b1019aJerry Jelinek    _ACPI_LO,            /* 0x6A   106 'j' */
11347b1019aJerry Jelinek    _ACPI_LO,            /* 0x6B   107 'k' */
11357b1019aJerry Jelinek    _ACPI_LO,            /* 0x6C   108 'l' */
11367b1019aJerry Jelinek    _ACPI_LO,            /* 0x6D   109 'm' */
11377b1019aJerry Jelinek    _ACPI_LO,            /* 0x6E   110 'n' */
11387b1019aJerry Jelinek    _ACPI_LO,            /* 0x6F   111 'o' */
11397b1019aJerry Jelinek    _ACPI_LO,            /* 0x70   112 'p' */
11407b1019aJerry Jelinek    _ACPI_LO,            /* 0x71   113 'q' */
11417b1019aJerry Jelinek    _ACPI_LO,            /* 0x72   114 'r' */
11427b1019aJerry Jelinek    _ACPI_LO,            /* 0x73   115 's' */
11437b1019aJerry Jelinek    _ACPI_LO,            /* 0x74   116 't' */
11447b1019aJerry Jelinek    _ACPI_LO,            /* 0x75   117 'u' */
11457b1019aJerry Jelinek    _ACPI_LO,            /* 0x76   118 'v' */
11467b1019aJerry Jelinek    _ACPI_LO,            /* 0x77   119 'w' */
11477b1019aJerry Jelinek    _ACPI_LO,            /* 0x78   120 'x' */
11487b1019aJerry Jelinek    _ACPI_LO,            /* 0x79   121 'y' */
11497b1019aJerry Jelinek    _ACPI_LO,            /* 0x7A   122 'z' */
11507b1019aJerry Jelinek    _ACPI_PU,            /* 0x7B   123 '{' */
11517b1019aJerry Jelinek    _ACPI_PU,            /* 0x7C   124 '|' */
11527b1019aJerry Jelinek    _ACPI_PU,            /* 0x7D   125 '}' */
11537b1019aJerry Jelinek    _ACPI_PU,            /* 0x7E   126 '~' */
11547b1019aJerry Jelinek    _ACPI_CN,            /* 0x7F   127 DEL */
11557c478bdstevel@tonic-gate
11567c478bdstevel@tonic-gate    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0x80 to 0x8F    */
11577c478bdstevel@tonic-gate    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0x90 to 0x9F    */
11587c478bdstevel@tonic-gate    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xA0 to 0xAF    */
11597c478bdstevel@tonic-gate    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xB0 to 0xBF    */
11607c478bdstevel@tonic-gate    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xC0 to 0xCF    */
11617c478bdstevel@tonic-gate    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xD0 to 0xDF    */
11627c478bdstevel@tonic-gate    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xE0 to 0xEF    */
11637b1019aJerry Jelinek    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xF0 to 0xFF    */
11647b1019aJerry Jelinek    0                                 /* 0x100 */
11657c478bdstevel@tonic-gate};
11667c478bdstevel@tonic-gate
11677c478bdstevel@tonic-gate
11687c478bdstevel@tonic-gate#endif /* ACPI_USE_SYSTEM_CLIBRARY */
1169