xref: /illumos-gate/usr/src/common/acpica/utilities/utclib.c (revision 35786f6866ae52207d0f1a25fe7ca5f652f32ce0)
1bc36eafdSMike Gerdts /******************************************************************************
2bc36eafdSMike Gerdts  *
3bc36eafdSMike Gerdts  * Module Name: utclib - ACPICA implementations of C library functions
4bc36eafdSMike Gerdts  *
5bc36eafdSMike Gerdts  *****************************************************************************/
6bc36eafdSMike Gerdts 
7*35786f68SRobert Mustacchi /******************************************************************************
8*35786f68SRobert Mustacchi  *
9*35786f68SRobert Mustacchi  * 1. Copyright Notice
10*35786f68SRobert Mustacchi  *
11*35786f68SRobert Mustacchi  * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
12bc36eafdSMike Gerdts  * All rights reserved.
13bc36eafdSMike Gerdts  *
14*35786f68SRobert Mustacchi  * 2. License
15*35786f68SRobert Mustacchi  *
16*35786f68SRobert Mustacchi  * 2.1. This is your license from Intel Corp. under its intellectual property
17*35786f68SRobert Mustacchi  * rights. You may have additional license terms from the party that provided
18*35786f68SRobert Mustacchi  * you this software, covering your right to use that party's intellectual
19*35786f68SRobert Mustacchi  * property rights.
20*35786f68SRobert Mustacchi  *
21*35786f68SRobert Mustacchi  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22*35786f68SRobert Mustacchi  * copy of the source code appearing in this file ("Covered Code") an
23*35786f68SRobert Mustacchi  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24*35786f68SRobert Mustacchi  * base code distributed originally by Intel ("Original Intel Code") to copy,
25*35786f68SRobert Mustacchi  * make derivatives, distribute, use and display any portion of the Covered
26*35786f68SRobert Mustacchi  * Code in any form, with the right to sublicense such rights; and
27*35786f68SRobert Mustacchi  *
28*35786f68SRobert Mustacchi  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29*35786f68SRobert Mustacchi  * license (with the right to sublicense), under only those claims of Intel
30*35786f68SRobert Mustacchi  * patents that are infringed by the Original Intel Code, to make, use, sell,
31*35786f68SRobert Mustacchi  * offer to sell, and import the Covered Code and derivative works thereof
32*35786f68SRobert Mustacchi  * solely to the minimum extent necessary to exercise the above copyright
33*35786f68SRobert Mustacchi  * license, and in no event shall the patent license extend to any additions
34*35786f68SRobert Mustacchi  * to or modifications of the Original Intel Code. No other license or right
35*35786f68SRobert Mustacchi  * is granted directly or by implication, estoppel or otherwise;
36*35786f68SRobert Mustacchi  *
37*35786f68SRobert Mustacchi  * The above copyright and patent license is granted only if the following
38*35786f68SRobert Mustacchi  * conditions are met:
39*35786f68SRobert Mustacchi  *
40*35786f68SRobert Mustacchi  * 3. Conditions
41*35786f68SRobert Mustacchi  *
42*35786f68SRobert Mustacchi  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43*35786f68SRobert Mustacchi  * Redistribution of source code of any substantial portion of the Covered
44*35786f68SRobert Mustacchi  * Code or modification with rights to further distribute source must include
45*35786f68SRobert Mustacchi  * the above Copyright Notice, the above License, this list of Conditions,
46*35786f68SRobert Mustacchi  * and the following Disclaimer and Export Compliance provision. In addition,
47*35786f68SRobert Mustacchi  * Licensee must cause all Covered Code to which Licensee contributes to
48*35786f68SRobert Mustacchi  * contain a file documenting the changes Licensee made to create that Covered
49*35786f68SRobert Mustacchi  * Code and the date of any change. Licensee must include in that file the
50*35786f68SRobert Mustacchi  * documentation of any changes made by any predecessor Licensee. Licensee
51*35786f68SRobert Mustacchi  * must include a prominent statement that the modification is derived,
52*35786f68SRobert Mustacchi  * directly or indirectly, from Original Intel Code.
53*35786f68SRobert Mustacchi  *
54*35786f68SRobert Mustacchi  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55*35786f68SRobert Mustacchi  * Redistribution of source code of any substantial portion of the Covered
56*35786f68SRobert Mustacchi  * Code or modification without rights to further distribute source must
57*35786f68SRobert Mustacchi  * include the following Disclaimer and Export Compliance provision in the
58*35786f68SRobert Mustacchi  * documentation and/or other materials provided with distribution. In
59*35786f68SRobert Mustacchi  * addition, Licensee may not authorize further sublicense of source of any
60*35786f68SRobert Mustacchi  * portion of the Covered Code, and must include terms to the effect that the
61*35786f68SRobert Mustacchi  * license from Licensee to its licensee is limited to the intellectual
62*35786f68SRobert Mustacchi  * property embodied in the software Licensee provides to its licensee, and
63*35786f68SRobert Mustacchi  * not to intellectual property embodied in modifications its licensee may
64*35786f68SRobert Mustacchi  * make.
65*35786f68SRobert Mustacchi  *
66*35786f68SRobert Mustacchi  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67*35786f68SRobert Mustacchi  * substantial portion of the Covered Code or modification must reproduce the
68*35786f68SRobert Mustacchi  * above Copyright Notice, and the following Disclaimer and Export Compliance
69*35786f68SRobert Mustacchi  * provision in the documentation and/or other materials provided with the
70*35786f68SRobert Mustacchi  * distribution.
71*35786f68SRobert Mustacchi  *
72*35786f68SRobert Mustacchi  * 3.4. Intel retains all right, title, and interest in and to the Original
73*35786f68SRobert Mustacchi  * Intel Code.
74*35786f68SRobert Mustacchi  *
75*35786f68SRobert Mustacchi  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76*35786f68SRobert Mustacchi  * Intel shall be used in advertising or otherwise to promote the sale, use or
77*35786f68SRobert Mustacchi  * other dealings in products derived from or relating to the Covered Code
78*35786f68SRobert Mustacchi  * without prior written authorization from Intel.
79*35786f68SRobert Mustacchi  *
80*35786f68SRobert Mustacchi  * 4. Disclaimer and Export Compliance
81*35786f68SRobert Mustacchi  *
82*35786f68SRobert Mustacchi  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83*35786f68SRobert Mustacchi  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84*35786f68SRobert Mustacchi  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85*35786f68SRobert Mustacchi  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86*35786f68SRobert Mustacchi  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87*35786f68SRobert Mustacchi  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88*35786f68SRobert Mustacchi  * PARTICULAR PURPOSE.
89*35786f68SRobert Mustacchi  *
90*35786f68SRobert Mustacchi  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91*35786f68SRobert Mustacchi  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92*35786f68SRobert Mustacchi  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93*35786f68SRobert Mustacchi  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94*35786f68SRobert Mustacchi  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95*35786f68SRobert Mustacchi  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96*35786f68SRobert Mustacchi  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97*35786f68SRobert Mustacchi  * LIMITED REMEDY.
98*35786f68SRobert Mustacchi  *
99*35786f68SRobert Mustacchi  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100*35786f68SRobert Mustacchi  * software or system incorporating such software without first obtaining any
101*35786f68SRobert Mustacchi  * required license or other approval from the U. S. Department of Commerce or
102*35786f68SRobert Mustacchi  * any other agency or department of the United States Government. In the
103*35786f68SRobert Mustacchi  * event Licensee exports any such software from the United States or
104*35786f68SRobert Mustacchi  * re-exports any such software from a foreign destination, Licensee shall
105*35786f68SRobert Mustacchi  * ensure that the distribution and export/re-export of the software is in
106*35786f68SRobert Mustacchi  * compliance with all laws, regulations, orders, or other restrictions of the
107*35786f68SRobert Mustacchi  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108*35786f68SRobert Mustacchi  * any of its subsidiaries will export/re-export any technical data, process,
109*35786f68SRobert Mustacchi  * software, or service, directly or indirectly, to any country for which the
110*35786f68SRobert Mustacchi  * United States government or any agency thereof requires an export license,
111*35786f68SRobert Mustacchi  * other governmental approval, or letter of assurance, without first obtaining
112*35786f68SRobert Mustacchi  * such license, approval or letter.
113*35786f68SRobert Mustacchi  *
114*35786f68SRobert Mustacchi  *****************************************************************************
115*35786f68SRobert Mustacchi  *
116*35786f68SRobert Mustacchi  * Alternatively, you may choose to be licensed under the terms of the
117*35786f68SRobert Mustacchi  * following license:
118*35786f68SRobert Mustacchi  *
119bc36eafdSMike Gerdts  * Redistribution and use in source and binary forms, with or without
120bc36eafdSMike Gerdts  * modification, are permitted provided that the following conditions
121bc36eafdSMike Gerdts  * are met:
122bc36eafdSMike Gerdts  * 1. Redistributions of source code must retain the above copyright
123bc36eafdSMike Gerdts  *    notice, this list of conditions, and the following disclaimer,
124bc36eafdSMike Gerdts  *    without modification.
125bc36eafdSMike Gerdts  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126bc36eafdSMike Gerdts  *    substantially similar to the "NO WARRANTY" disclaimer below
127bc36eafdSMike Gerdts  *    ("Disclaimer") and any redistribution must be conditioned upon
128bc36eafdSMike Gerdts  *    including a substantially similar Disclaimer requirement for further
129bc36eafdSMike Gerdts  *    binary redistribution.
130bc36eafdSMike Gerdts  * 3. Neither the names of the above-listed copyright holders nor the names
131bc36eafdSMike Gerdts  *    of any contributors may be used to endorse or promote products derived
132bc36eafdSMike Gerdts  *    from this software without specific prior written permission.
133bc36eafdSMike Gerdts  *
134*35786f68SRobert Mustacchi  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135*35786f68SRobert Mustacchi  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136*35786f68SRobert Mustacchi  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137*35786f68SRobert Mustacchi  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138*35786f68SRobert Mustacchi  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139*35786f68SRobert Mustacchi  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140*35786f68SRobert Mustacchi  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141*35786f68SRobert Mustacchi  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142*35786f68SRobert Mustacchi  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143*35786f68SRobert Mustacchi  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144*35786f68SRobert Mustacchi  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145*35786f68SRobert Mustacchi  *
146*35786f68SRobert Mustacchi  * Alternatively, you may choose to be licensed under the terms of the
147bc36eafdSMike Gerdts  * GNU General Public License ("GPL") version 2 as published by the Free
148bc36eafdSMike Gerdts  * Software Foundation.
149bc36eafdSMike Gerdts  *
150*35786f68SRobert Mustacchi  *****************************************************************************/
151bc36eafdSMike Gerdts 
152bc36eafdSMike Gerdts #define ACPI_CLIBRARY
153bc36eafdSMike Gerdts #include "acpi.h"
154bc36eafdSMike Gerdts #include "accommon.h"
155bc36eafdSMike Gerdts 
156bc36eafdSMike Gerdts /*
157bc36eafdSMike Gerdts  * This module contains implementations of the standard C library functions
158bc36eafdSMike Gerdts  * that are required by the ACPICA code at both application level and kernel
159bc36eafdSMike Gerdts  * level.
160bc36eafdSMike Gerdts  *
161bc36eafdSMike Gerdts  * The module is an optional feature that can be used if a local/system
162bc36eafdSMike Gerdts  * C library is not available. Some operating system kernels may not have
163bc36eafdSMike Gerdts  * an internal C library.
164bc36eafdSMike Gerdts  *
165bc36eafdSMike Gerdts  * In general, these functions are less efficient than an inline or assembly
166bc36eafdSMike Gerdts  * code implementation.
167bc36eafdSMike Gerdts  *
168bc36eafdSMike Gerdts  * These C functions and the associated prototypes are enabled by default
169bc36eafdSMike Gerdts  * unless the ACPI_USE_SYSTEM_CLIBRARY symbol is defined. This is usually
170bc36eafdSMike Gerdts  * automatically defined for the ACPICA applications such as iASL and
171bc36eafdSMike Gerdts  * AcpiExec, so that these user-level applications use the local C library
172bc36eafdSMike Gerdts  * instead of the functions in this module.
173bc36eafdSMike Gerdts  */
174bc36eafdSMike Gerdts 
175bc36eafdSMike Gerdts /*******************************************************************************
176bc36eafdSMike Gerdts  *
177bc36eafdSMike Gerdts  * Functions implemented in this module:
178bc36eafdSMike Gerdts  *
179bc36eafdSMike Gerdts  * FUNCTION:    memcmp
180bc36eafdSMike Gerdts  * FUNCTION:    memcpy
181bc36eafdSMike Gerdts  * FUNCTION:    memset
182bc36eafdSMike Gerdts  * FUNCTION:    strlen
183bc36eafdSMike Gerdts  * FUNCTION:    strcpy
184bc36eafdSMike Gerdts  * FUNCTION:    strncpy
185bc36eafdSMike Gerdts  * FUNCTION:    strcmp
186bc36eafdSMike Gerdts  * FUNCTION:    strchr
187bc36eafdSMike Gerdts  * FUNCTION:    strncmp
188bc36eafdSMike Gerdts  * FUNCTION:    strcat
189bc36eafdSMike Gerdts  * FUNCTION:    strncat
190bc36eafdSMike Gerdts  * FUNCTION:    strstr
191bc36eafdSMike Gerdts  * FUNCTION:    strtoul
192bc36eafdSMike Gerdts  * FUNCTION:    toupper
193bc36eafdSMike Gerdts  * FUNCTION:    tolower
194bc36eafdSMike Gerdts  * FUNCTION:    is* functions
195bc36eafdSMike Gerdts  *
196bc36eafdSMike Gerdts  ******************************************************************************/
197bc36eafdSMike Gerdts 
198bc36eafdSMike Gerdts #define _COMPONENT          ACPI_UTILITIES
199bc36eafdSMike Gerdts         ACPI_MODULE_NAME    ("utclib")
200bc36eafdSMike Gerdts 
201bc36eafdSMike Gerdts 
202bc36eafdSMike Gerdts #ifndef ACPI_USE_SYSTEM_CLIBRARY    /* Entire module */
203bc36eafdSMike Gerdts 
204bc36eafdSMike Gerdts 
205bc36eafdSMike Gerdts /*******************************************************************************
206bc36eafdSMike Gerdts  *
207bc36eafdSMike Gerdts  * FUNCTION:    memcmp
208bc36eafdSMike Gerdts  *
209bc36eafdSMike Gerdts  * PARAMETERS:  Buffer1         - First Buffer
210bc36eafdSMike Gerdts  *              Buffer2         - Second Buffer
211bc36eafdSMike Gerdts  *              Count           - Maximum # of bytes to compare
212bc36eafdSMike Gerdts  *
213bc36eafdSMike Gerdts  * RETURN:      Index where Buffers mismatched, or 0 if Buffers matched
214bc36eafdSMike Gerdts  *
215bc36eafdSMike Gerdts  * DESCRIPTION: Compare two Buffers, with a maximum length
216bc36eafdSMike Gerdts  *
217bc36eafdSMike Gerdts  ******************************************************************************/
218bc36eafdSMike Gerdts 
219bc36eafdSMike Gerdts int
memcmp(void * VBuffer1,void * VBuffer2,ACPI_SIZE Count)220bc36eafdSMike Gerdts memcmp (
221bc36eafdSMike Gerdts     void                    *VBuffer1,
222bc36eafdSMike Gerdts     void                    *VBuffer2,
223bc36eafdSMike Gerdts     ACPI_SIZE               Count)
224bc36eafdSMike Gerdts {
225bc36eafdSMike Gerdts     char                    *Buffer1 = (char *) VBuffer1;
226bc36eafdSMike Gerdts     char                    *Buffer2 = (char *) VBuffer2;
227bc36eafdSMike Gerdts 
228bc36eafdSMike Gerdts 
229bc36eafdSMike Gerdts     for ( ; Count-- && (*Buffer1 == *Buffer2); Buffer1++, Buffer2++)
230bc36eafdSMike Gerdts     {
231bc36eafdSMike Gerdts     }
232bc36eafdSMike Gerdts 
233bc36eafdSMike Gerdts     return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *Buffer1 -
234bc36eafdSMike Gerdts         (unsigned char) *Buffer2));
235bc36eafdSMike Gerdts }
236bc36eafdSMike Gerdts 
237bc36eafdSMike Gerdts 
238bc36eafdSMike Gerdts /*******************************************************************************
239bc36eafdSMike Gerdts  *
240*35786f68SRobert Mustacchi  * FUNCTION:    memmove
241*35786f68SRobert Mustacchi  *
242*35786f68SRobert Mustacchi  * PARAMETERS:  Dest        - Target of the copy
243*35786f68SRobert Mustacchi  *              Src         - Source buffer to copy
244*35786f68SRobert Mustacchi  *              Count       - Number of bytes to copy
245*35786f68SRobert Mustacchi  *
246*35786f68SRobert Mustacchi  * RETURN:      Dest
247*35786f68SRobert Mustacchi  *
248*35786f68SRobert Mustacchi  * DESCRIPTION: Copy arbitrary bytes of memory with respect to the overlapping
249*35786f68SRobert Mustacchi  *
250*35786f68SRobert Mustacchi  ******************************************************************************/
251*35786f68SRobert Mustacchi 
252*35786f68SRobert Mustacchi void *
memmove(void * Dest,const void * Src,ACPI_SIZE Count)253*35786f68SRobert Mustacchi memmove (
254*35786f68SRobert Mustacchi     void                    *Dest,
255*35786f68SRobert Mustacchi     const void              *Src,
256*35786f68SRobert Mustacchi     ACPI_SIZE               Count)
257*35786f68SRobert Mustacchi {
258*35786f68SRobert Mustacchi     char                    *New = (char *) Dest;
259*35786f68SRobert Mustacchi     char                    *Old = (char *) Src;
260*35786f68SRobert Mustacchi 
261*35786f68SRobert Mustacchi 
262*35786f68SRobert Mustacchi     if (Old > New)
263*35786f68SRobert Mustacchi     {
264*35786f68SRobert Mustacchi         /* Copy from the beginning */
265*35786f68SRobert Mustacchi 
266*35786f68SRobert Mustacchi         while (Count)
267*35786f68SRobert Mustacchi         {
268*35786f68SRobert Mustacchi             *New = *Old;
269*35786f68SRobert Mustacchi             New++;
270*35786f68SRobert Mustacchi             Old++;
271*35786f68SRobert Mustacchi             Count--;
272*35786f68SRobert Mustacchi         }
273*35786f68SRobert Mustacchi     }
274*35786f68SRobert Mustacchi     else if (Old < New)
275*35786f68SRobert Mustacchi     {
276*35786f68SRobert Mustacchi         /* Copy from the end */
277*35786f68SRobert Mustacchi 
278*35786f68SRobert Mustacchi         New = New + Count - 1;
279*35786f68SRobert Mustacchi         Old = Old + Count - 1;
280*35786f68SRobert Mustacchi         while (Count)
281*35786f68SRobert Mustacchi         {
282*35786f68SRobert Mustacchi             *New = *Old;
283*35786f68SRobert Mustacchi             New--;
284*35786f68SRobert Mustacchi             Old--;
285*35786f68SRobert Mustacchi             Count--;
286*35786f68SRobert Mustacchi         }
287*35786f68SRobert Mustacchi     }
288*35786f68SRobert Mustacchi 
289*35786f68SRobert Mustacchi     return (Dest);
290*35786f68SRobert Mustacchi }
291*35786f68SRobert Mustacchi 
292*35786f68SRobert Mustacchi 
293*35786f68SRobert Mustacchi /*******************************************************************************
294*35786f68SRobert Mustacchi  *
295bc36eafdSMike Gerdts  * FUNCTION:    memcpy
296bc36eafdSMike Gerdts  *
297bc36eafdSMike Gerdts  * PARAMETERS:  Dest        - Target of the copy
298bc36eafdSMike Gerdts  *              Src         - Source buffer to copy
299bc36eafdSMike Gerdts  *              Count       - Number of bytes to copy
300bc36eafdSMike Gerdts  *
301bc36eafdSMike Gerdts  * RETURN:      Dest
302bc36eafdSMike Gerdts  *
303bc36eafdSMike Gerdts  * DESCRIPTION: Copy arbitrary bytes of memory
304bc36eafdSMike Gerdts  *
305bc36eafdSMike Gerdts  ******************************************************************************/
306bc36eafdSMike Gerdts 
307bc36eafdSMike Gerdts void *
memcpy(void * Dest,const void * Src,ACPI_SIZE Count)308bc36eafdSMike Gerdts memcpy (
309bc36eafdSMike Gerdts     void                    *Dest,
310bc36eafdSMike Gerdts     const void              *Src,
311bc36eafdSMike Gerdts     ACPI_SIZE               Count)
312bc36eafdSMike Gerdts {
313bc36eafdSMike Gerdts     char                    *New = (char *) Dest;
314bc36eafdSMike Gerdts     char                    *Old = (char *) Src;
315bc36eafdSMike Gerdts 
316bc36eafdSMike Gerdts 
317bc36eafdSMike Gerdts     while (Count)
318bc36eafdSMike Gerdts     {
319bc36eafdSMike Gerdts         *New = *Old;
320bc36eafdSMike Gerdts         New++;
321bc36eafdSMike Gerdts         Old++;
322bc36eafdSMike Gerdts         Count--;
323bc36eafdSMike Gerdts     }
324bc36eafdSMike Gerdts 
325bc36eafdSMike Gerdts     return (Dest);
326bc36eafdSMike Gerdts }
327bc36eafdSMike Gerdts 
328bc36eafdSMike Gerdts 
329bc36eafdSMike Gerdts /*******************************************************************************
330bc36eafdSMike Gerdts  *
331bc36eafdSMike Gerdts  * FUNCTION:    memset
332bc36eafdSMike Gerdts  *
333bc36eafdSMike Gerdts  * PARAMETERS:  Dest        - Buffer to set
334bc36eafdSMike Gerdts  *              Value       - Value to set each byte of memory
335bc36eafdSMike Gerdts  *              Count       - Number of bytes to set
336bc36eafdSMike Gerdts  *
337bc36eafdSMike Gerdts  * RETURN:      Dest
338bc36eafdSMike Gerdts  *
339bc36eafdSMike Gerdts  * DESCRIPTION: Initialize a buffer to a known value.
340bc36eafdSMike Gerdts  *
341bc36eafdSMike Gerdts  ******************************************************************************/
342bc36eafdSMike Gerdts 
343bc36eafdSMike Gerdts void *
memset(void * Dest,int Value,ACPI_SIZE Count)344bc36eafdSMike Gerdts memset (
345bc36eafdSMike Gerdts     void                    *Dest,
346bc36eafdSMike Gerdts     int                     Value,
347bc36eafdSMike Gerdts     ACPI_SIZE               Count)
348bc36eafdSMike Gerdts {
349bc36eafdSMike Gerdts     char                    *New = (char *) Dest;
350bc36eafdSMike Gerdts 
351bc36eafdSMike Gerdts 
352bc36eafdSMike Gerdts     while (Count)
353bc36eafdSMike Gerdts     {
354bc36eafdSMike Gerdts         *New = (char) Value;
355bc36eafdSMike Gerdts         New++;
356bc36eafdSMike Gerdts         Count--;
357bc36eafdSMike Gerdts     }
358bc36eafdSMike Gerdts 
359bc36eafdSMike Gerdts     return (Dest);
360bc36eafdSMike Gerdts }
361bc36eafdSMike Gerdts 
362bc36eafdSMike Gerdts 
363bc36eafdSMike Gerdts /*******************************************************************************
364bc36eafdSMike Gerdts  *
365bc36eafdSMike Gerdts  * FUNCTION:    strlen
366bc36eafdSMike Gerdts  *
367bc36eafdSMike Gerdts  * PARAMETERS:  String              - Null terminated string
368bc36eafdSMike Gerdts  *
369bc36eafdSMike Gerdts  * RETURN:      Length
370bc36eafdSMike Gerdts  *
371bc36eafdSMike Gerdts  * DESCRIPTION: Returns the length of the input string
372bc36eafdSMike Gerdts  *
373bc36eafdSMike Gerdts  ******************************************************************************/
374bc36eafdSMike Gerdts 
375bc36eafdSMike Gerdts 
376bc36eafdSMike Gerdts ACPI_SIZE
strlen(const char * String)377bc36eafdSMike Gerdts strlen (
378bc36eafdSMike Gerdts     const char              *String)
379bc36eafdSMike Gerdts {
380bc36eafdSMike Gerdts     UINT32                  Length = 0;
381bc36eafdSMike Gerdts 
382bc36eafdSMike Gerdts 
383bc36eafdSMike Gerdts     /* Count the string until a null is encountered */
384bc36eafdSMike Gerdts 
385bc36eafdSMike Gerdts     while (*String)
386bc36eafdSMike Gerdts     {
387bc36eafdSMike Gerdts         Length++;
388bc36eafdSMike Gerdts         String++;
389bc36eafdSMike Gerdts     }
390bc36eafdSMike Gerdts 
391bc36eafdSMike Gerdts     return (Length);
392bc36eafdSMike Gerdts }
393bc36eafdSMike Gerdts 
394bc36eafdSMike Gerdts 
395bc36eafdSMike Gerdts /*******************************************************************************
396bc36eafdSMike Gerdts  *
397*35786f68SRobert Mustacchi  * FUNCTION:    strpbrk
398*35786f68SRobert Mustacchi  *
399*35786f68SRobert Mustacchi  * PARAMETERS:  String              - Null terminated string
400*35786f68SRobert Mustacchi  *              Delimiters          - Delimiters to match
401*35786f68SRobert Mustacchi  *
402*35786f68SRobert Mustacchi  * RETURN:      The first occurance in the string of any of the bytes in the
403*35786f68SRobert Mustacchi  *              delimiters
404*35786f68SRobert Mustacchi  *
405*35786f68SRobert Mustacchi  * DESCRIPTION: Search a string for any of a set of the delimiters
406*35786f68SRobert Mustacchi  *
407*35786f68SRobert Mustacchi  ******************************************************************************/
408*35786f68SRobert Mustacchi 
409*35786f68SRobert Mustacchi char *
strpbrk(const char * String,const char * Delimiters)410*35786f68SRobert Mustacchi strpbrk (
411*35786f68SRobert Mustacchi     const char              *String,
412*35786f68SRobert Mustacchi     const char              *Delimiters)
413*35786f68SRobert Mustacchi {
414*35786f68SRobert Mustacchi     const char              *Delimiter;
415*35786f68SRobert Mustacchi 
416*35786f68SRobert Mustacchi 
417*35786f68SRobert Mustacchi     for ( ; *String != '\0'; ++String)
418*35786f68SRobert Mustacchi     {
419*35786f68SRobert Mustacchi         for (Delimiter = Delimiters; *Delimiter != '\0'; Delimiter++)
420*35786f68SRobert Mustacchi         {
421*35786f68SRobert Mustacchi             if (*String == *Delimiter)
422*35786f68SRobert Mustacchi             {
423*35786f68SRobert Mustacchi                 return (ACPI_CAST_PTR (char, String));
424*35786f68SRobert Mustacchi             }
425*35786f68SRobert Mustacchi         }
426*35786f68SRobert Mustacchi     }
427*35786f68SRobert Mustacchi 
428*35786f68SRobert Mustacchi     return (NULL);
429*35786f68SRobert Mustacchi }
430*35786f68SRobert Mustacchi 
431*35786f68SRobert Mustacchi 
432*35786f68SRobert Mustacchi /*******************************************************************************
433*35786f68SRobert Mustacchi  *
434*35786f68SRobert Mustacchi  * FUNCTION:    strtok
435*35786f68SRobert Mustacchi  *
436*35786f68SRobert Mustacchi  * PARAMETERS:  String              - Null terminated string
437*35786f68SRobert Mustacchi  *              Delimiters          - Delimiters to match
438*35786f68SRobert Mustacchi  *
439*35786f68SRobert Mustacchi  * RETURN:      Pointer to the next token
440*35786f68SRobert Mustacchi  *
441*35786f68SRobert Mustacchi  * DESCRIPTION: Split string into tokens
442*35786f68SRobert Mustacchi  *
443*35786f68SRobert Mustacchi  ******************************************************************************/
444*35786f68SRobert Mustacchi 
445*35786f68SRobert Mustacchi char*
strtok(char * String,const char * Delimiters)446*35786f68SRobert Mustacchi strtok (
447*35786f68SRobert Mustacchi     char                    *String,
448*35786f68SRobert Mustacchi     const char              *Delimiters)
449*35786f68SRobert Mustacchi {
450*35786f68SRobert Mustacchi     char                    *Begin = String;
451*35786f68SRobert Mustacchi     static char             *SavedPtr;
452*35786f68SRobert Mustacchi 
453*35786f68SRobert Mustacchi 
454*35786f68SRobert Mustacchi     if (Begin == NULL)
455*35786f68SRobert Mustacchi     {
456*35786f68SRobert Mustacchi         if (SavedPtr == NULL)
457*35786f68SRobert Mustacchi         {
458*35786f68SRobert Mustacchi             return (NULL);
459*35786f68SRobert Mustacchi         }
460*35786f68SRobert Mustacchi         Begin = SavedPtr;
461*35786f68SRobert Mustacchi     }
462*35786f68SRobert Mustacchi 
463*35786f68SRobert Mustacchi     SavedPtr = strpbrk (Begin, Delimiters);
464*35786f68SRobert Mustacchi     while (SavedPtr == Begin)
465*35786f68SRobert Mustacchi     {
466*35786f68SRobert Mustacchi         *Begin++ = '\0';
467*35786f68SRobert Mustacchi         SavedPtr = strpbrk (Begin, Delimiters);
468*35786f68SRobert Mustacchi     }
469*35786f68SRobert Mustacchi 
470*35786f68SRobert Mustacchi     if (SavedPtr)
471*35786f68SRobert Mustacchi     {
472*35786f68SRobert Mustacchi         *SavedPtr++ = '\0';
473*35786f68SRobert Mustacchi         return (Begin);
474*35786f68SRobert Mustacchi     }
475*35786f68SRobert Mustacchi     else
476*35786f68SRobert Mustacchi     {
477*35786f68SRobert Mustacchi         return (NULL);
478*35786f68SRobert Mustacchi     }
479*35786f68SRobert Mustacchi }
480*35786f68SRobert Mustacchi 
481*35786f68SRobert Mustacchi 
482*35786f68SRobert Mustacchi /*******************************************************************************
483*35786f68SRobert Mustacchi  *
484bc36eafdSMike Gerdts  * FUNCTION:    strcpy
485bc36eafdSMike Gerdts  *
486bc36eafdSMike Gerdts  * PARAMETERS:  DstString       - Target of the copy
487bc36eafdSMike Gerdts  *              SrcString       - The source string to copy
488bc36eafdSMike Gerdts  *
489bc36eafdSMike Gerdts  * RETURN:      DstString
490bc36eafdSMike Gerdts  *
491bc36eafdSMike Gerdts  * DESCRIPTION: Copy a null terminated string
492bc36eafdSMike Gerdts  *
493bc36eafdSMike Gerdts  ******************************************************************************/
494bc36eafdSMike Gerdts 
495bc36eafdSMike Gerdts char *
strcpy(char * DstString,const char * SrcString)496bc36eafdSMike Gerdts strcpy (
497bc36eafdSMike Gerdts     char                    *DstString,
498bc36eafdSMike Gerdts     const char              *SrcString)
499bc36eafdSMike Gerdts {
500bc36eafdSMike Gerdts     char                    *String = DstString;
501bc36eafdSMike Gerdts 
502bc36eafdSMike Gerdts 
503bc36eafdSMike Gerdts     /* Move bytes brute force */
504bc36eafdSMike Gerdts 
505bc36eafdSMike Gerdts     while (*SrcString)
506bc36eafdSMike Gerdts     {
507bc36eafdSMike Gerdts         *String = *SrcString;
508bc36eafdSMike Gerdts 
509bc36eafdSMike Gerdts         String++;
510bc36eafdSMike Gerdts         SrcString++;
511bc36eafdSMike Gerdts     }
512bc36eafdSMike Gerdts 
513bc36eafdSMike Gerdts     /* Null terminate */
514bc36eafdSMike Gerdts 
515bc36eafdSMike Gerdts     *String = 0;
516bc36eafdSMike Gerdts     return (DstString);
517bc36eafdSMike Gerdts }
518bc36eafdSMike Gerdts 
519bc36eafdSMike Gerdts 
520bc36eafdSMike Gerdts /*******************************************************************************
521bc36eafdSMike Gerdts  *
522bc36eafdSMike Gerdts  * FUNCTION:    strncpy
523bc36eafdSMike Gerdts  *
524bc36eafdSMike Gerdts  * PARAMETERS:  DstString       - Target of the copy
525bc36eafdSMike Gerdts  *              SrcString       - The source string to copy
526bc36eafdSMike Gerdts  *              Count           - Maximum # of bytes to copy
527bc36eafdSMike Gerdts  *
528bc36eafdSMike Gerdts  * RETURN:      DstString
529bc36eafdSMike Gerdts  *
530bc36eafdSMike Gerdts  * DESCRIPTION: Copy a null terminated string, with a maximum length
531bc36eafdSMike Gerdts  *
532bc36eafdSMike Gerdts  ******************************************************************************/
533bc36eafdSMike Gerdts 
534bc36eafdSMike Gerdts char *
strncpy(char * DstString,const char * SrcString,ACPI_SIZE Count)535bc36eafdSMike Gerdts strncpy (
536bc36eafdSMike Gerdts     char                    *DstString,
537bc36eafdSMike Gerdts     const char              *SrcString,
538bc36eafdSMike Gerdts     ACPI_SIZE               Count)
539bc36eafdSMike Gerdts {
540bc36eafdSMike Gerdts     char                    *String = DstString;
541bc36eafdSMike Gerdts 
542bc36eafdSMike Gerdts 
543bc36eafdSMike Gerdts     /* Copy the string */
544bc36eafdSMike Gerdts 
545bc36eafdSMike Gerdts     for (String = DstString;
546bc36eafdSMike Gerdts         Count && (Count--, (*String++ = *SrcString++)); )
547bc36eafdSMike Gerdts     {;}
548bc36eafdSMike Gerdts 
549bc36eafdSMike Gerdts     /* Pad with nulls if necessary */
550bc36eafdSMike Gerdts 
551bc36eafdSMike Gerdts     while (Count--)
552bc36eafdSMike Gerdts     {
553bc36eafdSMike Gerdts         *String = 0;
554bc36eafdSMike Gerdts         String++;
555bc36eafdSMike Gerdts     }
556bc36eafdSMike Gerdts 
557bc36eafdSMike Gerdts     /* Return original pointer */
558bc36eafdSMike Gerdts 
559bc36eafdSMike Gerdts     return (DstString);
560bc36eafdSMike Gerdts }
561bc36eafdSMike Gerdts 
562bc36eafdSMike Gerdts 
563bc36eafdSMike Gerdts /*******************************************************************************
564bc36eafdSMike Gerdts  *
565bc36eafdSMike Gerdts  * FUNCTION:    strcmp
566bc36eafdSMike Gerdts  *
567bc36eafdSMike Gerdts  * PARAMETERS:  String1         - First string
568bc36eafdSMike Gerdts  *              String2         - Second string
569bc36eafdSMike Gerdts  *
570bc36eafdSMike Gerdts  * RETURN:      Index where strings mismatched, or 0 if strings matched
571bc36eafdSMike Gerdts  *
572bc36eafdSMike Gerdts  * DESCRIPTION: Compare two null terminated strings
573bc36eafdSMike Gerdts  *
574bc36eafdSMike Gerdts  ******************************************************************************/
575bc36eafdSMike Gerdts 
576bc36eafdSMike Gerdts int
strcmp(const char * String1,const char * String2)577bc36eafdSMike Gerdts strcmp (
578bc36eafdSMike Gerdts     const char              *String1,
579bc36eafdSMike Gerdts     const char              *String2)
580bc36eafdSMike Gerdts {
581bc36eafdSMike Gerdts 
582bc36eafdSMike Gerdts 
583bc36eafdSMike Gerdts     for ( ; (*String1 == *String2); String2++)
584bc36eafdSMike Gerdts     {
585bc36eafdSMike Gerdts         if (!*String1++)
586bc36eafdSMike Gerdts         {
587bc36eafdSMike Gerdts             return (0);
588bc36eafdSMike Gerdts         }
589bc36eafdSMike Gerdts     }
590bc36eafdSMike Gerdts 
591bc36eafdSMike Gerdts     return ((unsigned char) *String1 - (unsigned char) *String2);
592bc36eafdSMike Gerdts }
593bc36eafdSMike Gerdts 
594bc36eafdSMike Gerdts 
595bc36eafdSMike Gerdts /*******************************************************************************
596bc36eafdSMike Gerdts  *
597bc36eafdSMike Gerdts  * FUNCTION:    strchr
598bc36eafdSMike Gerdts  *
599bc36eafdSMike Gerdts  * PARAMETERS:  String          - Search string
600bc36eafdSMike Gerdts  *              ch              - character to search for
601bc36eafdSMike Gerdts  *
602bc36eafdSMike Gerdts  * RETURN:      Ptr to char or NULL if not found
603bc36eafdSMike Gerdts  *
604bc36eafdSMike Gerdts  * DESCRIPTION: Search a string for a character
605bc36eafdSMike Gerdts  *
606bc36eafdSMike Gerdts  ******************************************************************************/
607bc36eafdSMike Gerdts 
608bc36eafdSMike Gerdts char *
strchr(const char * String,int ch)609bc36eafdSMike Gerdts strchr (
610bc36eafdSMike Gerdts     const char              *String,
611bc36eafdSMike Gerdts     int                     ch)
612bc36eafdSMike Gerdts {
613bc36eafdSMike Gerdts 
614bc36eafdSMike Gerdts 
615bc36eafdSMike Gerdts     for ( ; (*String); String++)
616bc36eafdSMike Gerdts     {
617bc36eafdSMike Gerdts         if ((*String) == (char) ch)
618bc36eafdSMike Gerdts         {
619bc36eafdSMike Gerdts             return ((char *) String);
620bc36eafdSMike Gerdts         }
621bc36eafdSMike Gerdts     }
622bc36eafdSMike Gerdts 
623bc36eafdSMike Gerdts     return (NULL);
624bc36eafdSMike Gerdts }
625bc36eafdSMike Gerdts 
626bc36eafdSMike Gerdts 
627bc36eafdSMike Gerdts /*******************************************************************************
628bc36eafdSMike Gerdts  *
629bc36eafdSMike Gerdts  * FUNCTION:    strncmp
630bc36eafdSMike Gerdts  *
631bc36eafdSMike Gerdts  * PARAMETERS:  String1         - First string
632bc36eafdSMike Gerdts  *              String2         - Second string
633bc36eafdSMike Gerdts  *              Count           - Maximum # of bytes to compare
634bc36eafdSMike Gerdts  *
635bc36eafdSMike Gerdts  * RETURN:      Index where strings mismatched, or 0 if strings matched
636bc36eafdSMike Gerdts  *
637bc36eafdSMike Gerdts  * DESCRIPTION: Compare two null terminated strings, with a maximum length
638bc36eafdSMike Gerdts  *
639bc36eafdSMike Gerdts  ******************************************************************************/
640bc36eafdSMike Gerdts 
641bc36eafdSMike Gerdts int
strncmp(const char * String1,const char * String2,ACPI_SIZE Count)642bc36eafdSMike Gerdts strncmp (
643bc36eafdSMike Gerdts     const char              *String1,
644bc36eafdSMike Gerdts     const char              *String2,
645bc36eafdSMike Gerdts     ACPI_SIZE               Count)
646bc36eafdSMike Gerdts {
647bc36eafdSMike Gerdts 
648bc36eafdSMike Gerdts 
649bc36eafdSMike Gerdts     for ( ; Count-- && (*String1 == *String2); String2++)
650bc36eafdSMike Gerdts     {
651bc36eafdSMike Gerdts         if (!*String1++)
652bc36eafdSMike Gerdts         {
653bc36eafdSMike Gerdts             return (0);
654bc36eafdSMike Gerdts         }
655bc36eafdSMike Gerdts     }
656bc36eafdSMike Gerdts 
657bc36eafdSMike Gerdts     return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *String1 -
658bc36eafdSMike Gerdts         (unsigned char) *String2));
659bc36eafdSMike Gerdts }
660bc36eafdSMike Gerdts 
661bc36eafdSMike Gerdts 
662bc36eafdSMike Gerdts /*******************************************************************************
663bc36eafdSMike Gerdts  *
664bc36eafdSMike Gerdts  * FUNCTION:    strcat
665bc36eafdSMike Gerdts  *
666bc36eafdSMike Gerdts  * PARAMETERS:  DstString       - Target of the copy
667bc36eafdSMike Gerdts  *              SrcString       - The source string to copy
668bc36eafdSMike Gerdts  *
669bc36eafdSMike Gerdts  * RETURN:      DstString
670bc36eafdSMike Gerdts  *
671bc36eafdSMike Gerdts  * DESCRIPTION: Append a null terminated string to a null terminated string
672bc36eafdSMike Gerdts  *
673bc36eafdSMike Gerdts  ******************************************************************************/
674bc36eafdSMike Gerdts 
675bc36eafdSMike Gerdts char *
strcat(char * DstString,const char * SrcString)676bc36eafdSMike Gerdts strcat (
677bc36eafdSMike Gerdts     char                    *DstString,
678bc36eafdSMike Gerdts     const char              *SrcString)
679bc36eafdSMike Gerdts {
680bc36eafdSMike Gerdts     char                    *String;
681bc36eafdSMike Gerdts 
682bc36eafdSMike Gerdts 
683bc36eafdSMike Gerdts     /* Find end of the destination string */
684bc36eafdSMike Gerdts 
685bc36eafdSMike Gerdts     for (String = DstString; *String++; )
686bc36eafdSMike Gerdts     { ; }
687bc36eafdSMike Gerdts 
688bc36eafdSMike Gerdts     /* Concatenate the string */
689bc36eafdSMike Gerdts 
690bc36eafdSMike Gerdts     for (--String; (*String++ = *SrcString++); )
691bc36eafdSMike Gerdts     { ; }
692bc36eafdSMike Gerdts 
693bc36eafdSMike Gerdts     return (DstString);
694bc36eafdSMike Gerdts }
695bc36eafdSMike Gerdts 
696bc36eafdSMike Gerdts 
697bc36eafdSMike Gerdts /*******************************************************************************
698bc36eafdSMike Gerdts  *
699bc36eafdSMike Gerdts  * FUNCTION:    strncat
700bc36eafdSMike Gerdts  *
701bc36eafdSMike Gerdts  * PARAMETERS:  DstString       - Target of the copy
702bc36eafdSMike Gerdts  *              SrcString       - The source string to copy
703bc36eafdSMike Gerdts  *              Count           - Maximum # of bytes to copy
704bc36eafdSMike Gerdts  *
705bc36eafdSMike Gerdts  * RETURN:      DstString
706bc36eafdSMike Gerdts  *
707bc36eafdSMike Gerdts  * DESCRIPTION: Append a null terminated string to a null terminated string,
708bc36eafdSMike Gerdts  *              with a maximum count.
709bc36eafdSMike Gerdts  *
710bc36eafdSMike Gerdts  ******************************************************************************/
711bc36eafdSMike Gerdts 
712bc36eafdSMike Gerdts char *
strncat(char * DstString,const char * SrcString,ACPI_SIZE Count)713bc36eafdSMike Gerdts strncat (
714bc36eafdSMike Gerdts     char                    *DstString,
715bc36eafdSMike Gerdts     const char              *SrcString,
716bc36eafdSMike Gerdts     ACPI_SIZE               Count)
717bc36eafdSMike Gerdts {
718bc36eafdSMike Gerdts     char                    *String;
719bc36eafdSMike Gerdts 
720bc36eafdSMike Gerdts 
721bc36eafdSMike Gerdts     if (Count)
722bc36eafdSMike Gerdts     {
723bc36eafdSMike Gerdts         /* Find end of the destination string */
724bc36eafdSMike Gerdts 
725bc36eafdSMike Gerdts         for (String = DstString; *String++; )
726bc36eafdSMike Gerdts         { ; }
727bc36eafdSMike Gerdts 
728bc36eafdSMike Gerdts         /* Concatenate the string */
729bc36eafdSMike Gerdts 
730bc36eafdSMike Gerdts         for (--String; (*String++ = *SrcString++) && --Count; )
731bc36eafdSMike Gerdts         { ; }
732bc36eafdSMike Gerdts 
733bc36eafdSMike Gerdts         /* Null terminate if necessary */
734bc36eafdSMike Gerdts 
735bc36eafdSMike Gerdts         if (!Count)
736bc36eafdSMike Gerdts         {
737bc36eafdSMike Gerdts             *String = 0;
738bc36eafdSMike Gerdts         }
739bc36eafdSMike Gerdts     }
740bc36eafdSMike Gerdts 
741bc36eafdSMike Gerdts     return (DstString);
742bc36eafdSMike Gerdts }
743bc36eafdSMike Gerdts 
744bc36eafdSMike Gerdts 
745bc36eafdSMike Gerdts /*******************************************************************************
746bc36eafdSMike Gerdts  *
747bc36eafdSMike Gerdts  * FUNCTION:    strstr
748bc36eafdSMike Gerdts  *
749bc36eafdSMike Gerdts  * PARAMETERS:  String1         - Target string
750bc36eafdSMike Gerdts  *              String2         - Substring to search for
751bc36eafdSMike Gerdts  *
752bc36eafdSMike Gerdts  * RETURN:      Where substring match starts, Null if no match found
753bc36eafdSMike Gerdts  *
754bc36eafdSMike Gerdts  * DESCRIPTION: Checks if String2 occurs in String1. This is not really a
755bc36eafdSMike Gerdts  *              full implementation of strstr, only sufficient for command
756bc36eafdSMike Gerdts  *              matching
757bc36eafdSMike Gerdts  *
758bc36eafdSMike Gerdts  ******************************************************************************/
759bc36eafdSMike Gerdts 
760bc36eafdSMike Gerdts char *
strstr(char * String1,char * String2)761bc36eafdSMike Gerdts strstr (
762bc36eafdSMike Gerdts     char                    *String1,
763bc36eafdSMike Gerdts     char                    *String2)
764bc36eafdSMike Gerdts {
765*35786f68SRobert Mustacchi     ACPI_SIZE               Length;
766bc36eafdSMike Gerdts 
767bc36eafdSMike Gerdts 
768bc36eafdSMike Gerdts     Length = strlen (String2);
769bc36eafdSMike Gerdts     if (!Length)
770bc36eafdSMike Gerdts     {
771bc36eafdSMike Gerdts         return (String1);
772bc36eafdSMike Gerdts     }
773bc36eafdSMike Gerdts 
774bc36eafdSMike Gerdts     while (strlen (String1) >= Length)
775bc36eafdSMike Gerdts     {
776bc36eafdSMike Gerdts         if (memcmp (String1, String2, Length) == 0)
777bc36eafdSMike Gerdts         {
778bc36eafdSMike Gerdts             return (String1);
779bc36eafdSMike Gerdts         }
780bc36eafdSMike Gerdts         String1++;
781bc36eafdSMike Gerdts     }
782bc36eafdSMike Gerdts 
783bc36eafdSMike Gerdts     return (NULL);
784bc36eafdSMike Gerdts }
785bc36eafdSMike Gerdts 
786bc36eafdSMike Gerdts 
787bc36eafdSMike Gerdts /*******************************************************************************
788bc36eafdSMike Gerdts  *
789bc36eafdSMike Gerdts  * FUNCTION:    strtoul
790bc36eafdSMike Gerdts  *
791bc36eafdSMike Gerdts  * PARAMETERS:  String          - Null terminated string
792bc36eafdSMike Gerdts  *              Terminater      - Where a pointer to the terminating byte is
793bc36eafdSMike Gerdts  *                                returned
794bc36eafdSMike Gerdts  *              Base            - Radix of the string
795bc36eafdSMike Gerdts  *
796bc36eafdSMike Gerdts  * RETURN:      Converted value
797bc36eafdSMike Gerdts  *
798bc36eafdSMike Gerdts  * DESCRIPTION: Convert a string into a 32-bit unsigned value.
799bc36eafdSMike Gerdts  *              Note: use strtoul64 for 64-bit integers.
800bc36eafdSMike Gerdts  *
801bc36eafdSMike Gerdts  ******************************************************************************/
802bc36eafdSMike Gerdts 
803bc36eafdSMike Gerdts UINT32
strtoul(const char * String,char ** Terminator,UINT32 Base)804bc36eafdSMike Gerdts strtoul (
805bc36eafdSMike Gerdts     const char              *String,
806bc36eafdSMike Gerdts     char                    **Terminator,
807bc36eafdSMike Gerdts     UINT32                  Base)
808bc36eafdSMike Gerdts {
809bc36eafdSMike Gerdts     UINT32                  converted = 0;
810bc36eafdSMike Gerdts     UINT32                  index;
811bc36eafdSMike Gerdts     UINT32                  sign;
812bc36eafdSMike Gerdts     const char              *StringStart;
813bc36eafdSMike Gerdts     UINT32                  ReturnValue = 0;
814bc36eafdSMike Gerdts     ACPI_STATUS             Status = AE_OK;
815bc36eafdSMike Gerdts 
816bc36eafdSMike Gerdts 
817bc36eafdSMike Gerdts     /*
818bc36eafdSMike Gerdts      * Save the value of the pointer to the buffer's first
819bc36eafdSMike Gerdts      * character, save the current errno value, and then
820bc36eafdSMike Gerdts      * skip over any white space in the buffer:
821bc36eafdSMike Gerdts      */
822bc36eafdSMike Gerdts     StringStart = String;
823bc36eafdSMike Gerdts     while (isspace (*String) || *String == '\t')
824bc36eafdSMike Gerdts     {
825bc36eafdSMike Gerdts         ++String;
826bc36eafdSMike Gerdts     }
827bc36eafdSMike Gerdts 
828bc36eafdSMike Gerdts     /*
829bc36eafdSMike Gerdts      * The buffer may contain an optional plus or minus sign.
830bc36eafdSMike Gerdts      * If it does, then skip over it but remember what is was:
831bc36eafdSMike Gerdts      */
832bc36eafdSMike Gerdts     if (*String == '-')
833bc36eafdSMike Gerdts     {
834bc36eafdSMike Gerdts         sign = ACPI_SIGN_NEGATIVE;
835bc36eafdSMike Gerdts         ++String;
836bc36eafdSMike Gerdts     }
837bc36eafdSMike Gerdts     else if (*String == '+')
838bc36eafdSMike Gerdts     {
839bc36eafdSMike Gerdts         ++String;
840bc36eafdSMike Gerdts         sign = ACPI_SIGN_POSITIVE;
841bc36eafdSMike Gerdts     }
842bc36eafdSMike Gerdts     else
843bc36eafdSMike Gerdts     {
844bc36eafdSMike Gerdts         sign = ACPI_SIGN_POSITIVE;
845bc36eafdSMike Gerdts     }
846bc36eafdSMike Gerdts 
847bc36eafdSMike Gerdts     /*
848bc36eafdSMike Gerdts      * If the input parameter Base is zero, then we need to
849bc36eafdSMike Gerdts      * determine if it is octal, decimal, or hexadecimal:
850bc36eafdSMike Gerdts      */
851bc36eafdSMike Gerdts     if (Base == 0)
852bc36eafdSMike Gerdts     {
853bc36eafdSMike Gerdts         if (*String == '0')
854bc36eafdSMike Gerdts         {
855bc36eafdSMike Gerdts             if (tolower (*(++String)) == 'x')
856bc36eafdSMike Gerdts             {
857bc36eafdSMike Gerdts                 Base = 16;
858bc36eafdSMike Gerdts                 ++String;
859bc36eafdSMike Gerdts             }
860bc36eafdSMike Gerdts             else
861bc36eafdSMike Gerdts             {
862bc36eafdSMike Gerdts                 Base = 8;
863bc36eafdSMike Gerdts             }
864bc36eafdSMike Gerdts         }
865bc36eafdSMike Gerdts         else
866bc36eafdSMike Gerdts         {
867bc36eafdSMike Gerdts             Base = 10;
868bc36eafdSMike Gerdts         }
869bc36eafdSMike Gerdts     }
870bc36eafdSMike Gerdts     else if (Base < 2 || Base > 36)
871bc36eafdSMike Gerdts     {
872bc36eafdSMike Gerdts         /*
873bc36eafdSMike Gerdts          * The specified Base parameter is not in the domain of
874bc36eafdSMike Gerdts          * this function:
875bc36eafdSMike Gerdts          */
876bc36eafdSMike Gerdts         goto done;
877bc36eafdSMike Gerdts     }
878bc36eafdSMike Gerdts 
879bc36eafdSMike Gerdts     /*
880bc36eafdSMike Gerdts      * For octal and hexadecimal bases, skip over the leading
881bc36eafdSMike Gerdts      * 0 or 0x, if they are present.
882bc36eafdSMike Gerdts      */
883bc36eafdSMike Gerdts     if (Base == 8 && *String == '0')
884bc36eafdSMike Gerdts     {
885bc36eafdSMike Gerdts         String++;
886bc36eafdSMike Gerdts     }
887bc36eafdSMike Gerdts 
888bc36eafdSMike Gerdts     if (Base == 16 &&
889bc36eafdSMike Gerdts         *String == '0' &&
890bc36eafdSMike Gerdts         tolower (*(++String)) == 'x')
891bc36eafdSMike Gerdts     {
892bc36eafdSMike Gerdts         String++;
893bc36eafdSMike Gerdts     }
894bc36eafdSMike Gerdts 
895bc36eafdSMike Gerdts     /*
896bc36eafdSMike Gerdts      * Main loop: convert the string to an unsigned long:
897bc36eafdSMike Gerdts      */
898bc36eafdSMike Gerdts     while (*String)
899bc36eafdSMike Gerdts     {
900bc36eafdSMike Gerdts         if (isdigit (*String))
901bc36eafdSMike Gerdts         {
902bc36eafdSMike Gerdts             index = (UINT32) ((UINT8) *String - '0');
903bc36eafdSMike Gerdts         }
904bc36eafdSMike Gerdts         else
905bc36eafdSMike Gerdts         {
906bc36eafdSMike Gerdts             index = (UINT32) toupper (*String);
907bc36eafdSMike Gerdts             if (isupper (index))
908bc36eafdSMike Gerdts             {
909bc36eafdSMike Gerdts                 index = index - 'A' + 10;
910bc36eafdSMike Gerdts             }
911bc36eafdSMike Gerdts             else
912bc36eafdSMike Gerdts             {
913bc36eafdSMike Gerdts                 goto done;
914bc36eafdSMike Gerdts             }
915bc36eafdSMike Gerdts         }
916bc36eafdSMike Gerdts 
917bc36eafdSMike Gerdts         if (index >= Base)
918bc36eafdSMike Gerdts         {
919bc36eafdSMike Gerdts             goto done;
920bc36eafdSMike Gerdts         }
921bc36eafdSMike Gerdts 
922bc36eafdSMike Gerdts         /*
923bc36eafdSMike Gerdts          * Check to see if value is out of range:
924bc36eafdSMike Gerdts          */
925bc36eafdSMike Gerdts 
926bc36eafdSMike Gerdts         if (ReturnValue > ((ACPI_UINT32_MAX - (UINT32) index) /
927bc36eafdSMike Gerdts                             (UINT32) Base))
928bc36eafdSMike Gerdts         {
929bc36eafdSMike Gerdts             Status = AE_ERROR;
930bc36eafdSMike Gerdts             ReturnValue = 0;           /* reset */
931bc36eafdSMike Gerdts         }
932bc36eafdSMike Gerdts         else
933bc36eafdSMike Gerdts         {
934bc36eafdSMike Gerdts             ReturnValue *= Base;
935bc36eafdSMike Gerdts             ReturnValue += index;
936bc36eafdSMike Gerdts             converted = 1;
937bc36eafdSMike Gerdts         }
938bc36eafdSMike Gerdts 
939bc36eafdSMike Gerdts         ++String;
940bc36eafdSMike Gerdts     }
941bc36eafdSMike Gerdts 
942bc36eafdSMike Gerdts done:
943bc36eafdSMike Gerdts     /*
944bc36eafdSMike Gerdts      * If appropriate, update the caller's pointer to the next
945bc36eafdSMike Gerdts      * unconverted character in the buffer.
946bc36eafdSMike Gerdts      */
947bc36eafdSMike Gerdts     if (Terminator)
948bc36eafdSMike Gerdts     {
949bc36eafdSMike Gerdts         if (converted == 0 && ReturnValue == 0 && String != NULL)
950bc36eafdSMike Gerdts         {
951bc36eafdSMike Gerdts             *Terminator = (char *) StringStart;
952bc36eafdSMike Gerdts         }
953bc36eafdSMike Gerdts         else
954bc36eafdSMike Gerdts         {
955bc36eafdSMike Gerdts             *Terminator = (char *) String;
956bc36eafdSMike Gerdts         }
957bc36eafdSMike Gerdts     }
958bc36eafdSMike Gerdts 
959bc36eafdSMike Gerdts     if (Status == AE_ERROR)
960bc36eafdSMike Gerdts     {
961bc36eafdSMike Gerdts         ReturnValue = ACPI_UINT32_MAX;
962bc36eafdSMike Gerdts     }
963bc36eafdSMike Gerdts 
964bc36eafdSMike Gerdts     /*
965bc36eafdSMike Gerdts      * If a minus sign was present, then "the conversion is negated":
966bc36eafdSMike Gerdts      */
967bc36eafdSMike Gerdts     if (sign == ACPI_SIGN_NEGATIVE)
968bc36eafdSMike Gerdts     {
969bc36eafdSMike Gerdts         ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
970bc36eafdSMike Gerdts     }
971bc36eafdSMike Gerdts 
972bc36eafdSMike Gerdts     return (ReturnValue);
973bc36eafdSMike Gerdts }
974bc36eafdSMike Gerdts 
975bc36eafdSMike Gerdts 
976bc36eafdSMike Gerdts /*******************************************************************************
977bc36eafdSMike Gerdts  *
978bc36eafdSMike Gerdts  * FUNCTION:    toupper
979bc36eafdSMike Gerdts  *
980bc36eafdSMike Gerdts  * PARAMETERS:  c           - Character to convert
981bc36eafdSMike Gerdts  *
982bc36eafdSMike Gerdts  * RETURN:      Converted character as an int
983bc36eafdSMike Gerdts  *
984bc36eafdSMike Gerdts  * DESCRIPTION: Convert character to uppercase
985bc36eafdSMike Gerdts  *
986bc36eafdSMike Gerdts  ******************************************************************************/
987bc36eafdSMike Gerdts 
988bc36eafdSMike Gerdts int
toupper(int c)989bc36eafdSMike Gerdts toupper (
990bc36eafdSMike Gerdts     int                     c)
991bc36eafdSMike Gerdts {
992bc36eafdSMike Gerdts 
993bc36eafdSMike Gerdts     return (islower(c) ? ((c)-0x20) : (c));
994bc36eafdSMike Gerdts }
995bc36eafdSMike Gerdts 
996bc36eafdSMike Gerdts 
997bc36eafdSMike Gerdts /*******************************************************************************
998bc36eafdSMike Gerdts  *
999bc36eafdSMike Gerdts  * FUNCTION:    tolower
1000bc36eafdSMike Gerdts  *
1001bc36eafdSMike Gerdts  * PARAMETERS:  c           - Character to convert
1002bc36eafdSMike Gerdts  *
1003bc36eafdSMike Gerdts  * RETURN:      Converted character as an int
1004bc36eafdSMike Gerdts  *
1005bc36eafdSMike Gerdts  * DESCRIPTION: Convert character to lowercase
1006bc36eafdSMike Gerdts  *
1007bc36eafdSMike Gerdts  ******************************************************************************/
1008bc36eafdSMike Gerdts 
1009bc36eafdSMike Gerdts int
tolower(int c)1010bc36eafdSMike Gerdts tolower (
1011bc36eafdSMike Gerdts     int                     c)
1012bc36eafdSMike Gerdts {
1013bc36eafdSMike Gerdts 
1014bc36eafdSMike Gerdts     return (isupper(c) ? ((c)+0x20) : (c));
1015bc36eafdSMike Gerdts }
1016bc36eafdSMike Gerdts 
1017bc36eafdSMike Gerdts 
1018bc36eafdSMike Gerdts /*******************************************************************************
1019bc36eafdSMike Gerdts  *
1020bc36eafdSMike Gerdts  * FUNCTION:    is* function array
1021bc36eafdSMike Gerdts  *
1022bc36eafdSMike Gerdts  * DESCRIPTION: is* functions use the ctype table below
1023bc36eafdSMike Gerdts  *
1024bc36eafdSMike Gerdts  ******************************************************************************/
1025bc36eafdSMike Gerdts 
1026bc36eafdSMike Gerdts const UINT8 AcpiGbl_Ctypes[257] = {
1027bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x00     0 NUL */
1028bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x01     1 SOH */
1029bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x02     2 STX */
1030bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x03     3 ETX */
1031bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x04     4 EOT */
1032bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x05     5 ENQ */
1033bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x06     6 ACK */
1034bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x07     7 BEL */
1035bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x08     8 BS  */
1036bc36eafdSMike Gerdts     _ACPI_CN|_ACPI_SP,   /* 0x09     9 TAB */
1037bc36eafdSMike Gerdts     _ACPI_CN|_ACPI_SP,   /* 0x0A    10 LF  */
1038bc36eafdSMike Gerdts     _ACPI_CN|_ACPI_SP,   /* 0x0B    11 VT  */
1039bc36eafdSMike Gerdts     _ACPI_CN|_ACPI_SP,   /* 0x0C    12 FF  */
1040bc36eafdSMike Gerdts     _ACPI_CN|_ACPI_SP,   /* 0x0D    13 CR  */
1041bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x0E    14 SO  */
1042bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x0F    15 SI  */
1043bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x10    16 DLE */
1044bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x11    17 DC1 */
1045bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x12    18 DC2 */
1046bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x13    19 DC3 */
1047bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x14    20 DC4 */
1048bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x15    21 NAK */
1049bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x16    22 SYN */
1050bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x17    23 ETB */
1051bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x18    24 CAN */
1052bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x19    25 EM  */
1053bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x1A    26 SUB */
1054bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x1B    27 ESC */
1055bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x1C    28 FS  */
1056bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x1D    29 GS  */
1057bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x1E    30 RS  */
1058bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x1F    31 US  */
1059bc36eafdSMike Gerdts     _ACPI_XS|_ACPI_SP,   /* 0x20    32 ' ' */
1060bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x21    33 '!' */
1061bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x22    34 '"' */
1062bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x23    35 '#' */
1063bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x24    36 '$' */
1064bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x25    37 '%' */
1065bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x26    38 '&' */
1066bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x27    39 ''' */
1067bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x28    40 '(' */
1068bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x29    41 ')' */
1069bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x2A    42 '*' */
1070bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x2B    43 '+' */
1071bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x2C    44 ',' */
1072bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x2D    45 '-' */
1073bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x2E    46 '.' */
1074bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x2F    47 '/' */
1075bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_DI,   /* 0x30    48 '0' */
1076bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_DI,   /* 0x31    49 '1' */
1077bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_DI,   /* 0x32    50 '2' */
1078bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_DI,   /* 0x33    51 '3' */
1079bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_DI,   /* 0x34    52 '4' */
1080bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_DI,   /* 0x35    53 '5' */
1081bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_DI,   /* 0x36    54 '6' */
1082bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_DI,   /* 0x37    55 '7' */
1083bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_DI,   /* 0x38    56 '8' */
1084bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_DI,   /* 0x39    57 '9' */
1085bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x3A    58 ':' */
1086bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x3B    59 ';' */
1087bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x3C    60 '<' */
1088bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x3D    61 '=' */
1089bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x3E    62 '>' */
1090bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x3F    63 '?' */
1091bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x40    64 '@' */
1092bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_UP,   /* 0x41    65 'A' */
1093bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_UP,   /* 0x42    66 'B' */
1094bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_UP,   /* 0x43    67 'C' */
1095bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_UP,   /* 0x44    68 'D' */
1096bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_UP,   /* 0x45    69 'E' */
1097bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_UP,   /* 0x46    70 'F' */
1098bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x47    71 'G' */
1099bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x48    72 'H' */
1100bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x49    73 'I' */
1101bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x4A    74 'J' */
1102bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x4B    75 'K' */
1103bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x4C    76 'L' */
1104bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x4D    77 'M' */
1105bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x4E    78 'N' */
1106bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x4F    79 'O' */
1107bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x50    80 'P' */
1108bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x51    81 'Q' */
1109bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x52    82 'R' */
1110bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x53    83 'S' */
1111bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x54    84 'T' */
1112bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x55    85 'U' */
1113bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x56    86 'V' */
1114bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x57    87 'W' */
1115bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x58    88 'X' */
1116bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x59    89 'Y' */
1117bc36eafdSMike Gerdts     _ACPI_UP,            /* 0x5A    90 'Z' */
1118bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x5B    91 '[' */
1119bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x5C    92 '\' */
1120bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x5D    93 ']' */
1121bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x5E    94 '^' */
1122bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x5F    95 '_' */
1123bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x60    96 '`' */
1124bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_LO,   /* 0x61    97 'a' */
1125bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_LO,   /* 0x62    98 'b' */
1126bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_LO,   /* 0x63    99 'c' */
1127bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_LO,   /* 0x64   100 'd' */
1128bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_LO,   /* 0x65   101 'e' */
1129bc36eafdSMike Gerdts     _ACPI_XD|_ACPI_LO,   /* 0x66   102 'f' */
1130bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x67   103 'g' */
1131bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x68   104 'h' */
1132bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x69   105 'i' */
1133bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x6A   106 'j' */
1134bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x6B   107 'k' */
1135bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x6C   108 'l' */
1136bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x6D   109 'm' */
1137bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x6E   110 'n' */
1138bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x6F   111 'o' */
1139bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x70   112 'p' */
1140bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x71   113 'q' */
1141bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x72   114 'r' */
1142bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x73   115 's' */
1143bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x74   116 't' */
1144bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x75   117 'u' */
1145bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x76   118 'v' */
1146bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x77   119 'w' */
1147bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x78   120 'x' */
1148bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x79   121 'y' */
1149bc36eafdSMike Gerdts     _ACPI_LO,            /* 0x7A   122 'z' */
1150bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x7B   123 '{' */
1151bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x7C   124 '|' */
1152bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x7D   125 '}' */
1153bc36eafdSMike Gerdts     _ACPI_PU,            /* 0x7E   126 '~' */
1154bc36eafdSMike Gerdts     _ACPI_CN,            /* 0x7F   127 DEL */
1155bc36eafdSMike Gerdts 
1156bc36eafdSMike Gerdts     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0x80 to 0x8F    */
1157bc36eafdSMike Gerdts     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0x90 to 0x9F    */
1158bc36eafdSMike Gerdts     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xA0 to 0xAF    */
1159bc36eafdSMike Gerdts     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xB0 to 0xBF    */
1160bc36eafdSMike Gerdts     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xC0 to 0xCF    */
1161bc36eafdSMike Gerdts     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xD0 to 0xDF    */
1162bc36eafdSMike Gerdts     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xE0 to 0xEF    */
1163bc36eafdSMike Gerdts     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xF0 to 0xFF    */
1164bc36eafdSMike Gerdts     0                                 /* 0x100 */
1165bc36eafdSMike Gerdts };
1166bc36eafdSMike Gerdts 
1167bc36eafdSMike Gerdts 
1168bc36eafdSMike Gerdts #endif /* ACPI_USE_SYSTEM_CLIBRARY */
1169