xref: /titanic_50/usr/src/uts/intel/io/acpica/utilities/utclib.c (revision 385cc6b4ad1792caef3f84eb61eed3f27085801f)
1ae115bc7Smrj /******************************************************************************
2ae115bc7Smrj  *
3*385cc6b4SJerry Jelinek  * Module Name: utclib - ACPICA implementations of C library functions
4ae115bc7Smrj  *
5ae115bc7Smrj  *****************************************************************************/
6ae115bc7Smrj 
726f3cdf0SGordon Ross /*
8*385cc6b4SJerry Jelinek  * Copyright (C) 2000 - 2016, Intel Corp.
9ae115bc7Smrj  * All rights reserved.
10ae115bc7Smrj  *
1126f3cdf0SGordon Ross  * Redistribution and use in source and binary forms, with or without
1226f3cdf0SGordon Ross  * modification, are permitted provided that the following conditions
1326f3cdf0SGordon Ross  * are met:
1426f3cdf0SGordon Ross  * 1. Redistributions of source code must retain the above copyright
1526f3cdf0SGordon Ross  *    notice, this list of conditions, and the following disclaimer,
1626f3cdf0SGordon Ross  *    without modification.
1726f3cdf0SGordon Ross  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1826f3cdf0SGordon Ross  *    substantially similar to the "NO WARRANTY" disclaimer below
1926f3cdf0SGordon Ross  *    ("Disclaimer") and any redistribution must be conditioned upon
2026f3cdf0SGordon Ross  *    including a substantially similar Disclaimer requirement for further
2126f3cdf0SGordon Ross  *    binary redistribution.
2226f3cdf0SGordon Ross  * 3. Neither the names of the above-listed copyright holders nor the names
2326f3cdf0SGordon Ross  *    of any contributors may be used to endorse or promote products derived
2426f3cdf0SGordon Ross  *    from this software without specific prior written permission.
25ae115bc7Smrj  *
2626f3cdf0SGordon Ross  * Alternatively, this software may be distributed under the terms of the
2726f3cdf0SGordon Ross  * GNU General Public License ("GPL") version 2 as published by the Free
2826f3cdf0SGordon Ross  * Software Foundation.
29ae115bc7Smrj  *
3026f3cdf0SGordon Ross  * NO WARRANTY
3126f3cdf0SGordon Ross  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3226f3cdf0SGordon Ross  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3326f3cdf0SGordon Ross  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3426f3cdf0SGordon Ross  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3526f3cdf0SGordon Ross  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3626f3cdf0SGordon Ross  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3726f3cdf0SGordon Ross  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3826f3cdf0SGordon Ross  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
3926f3cdf0SGordon Ross  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
4026f3cdf0SGordon Ross  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4126f3cdf0SGordon Ross  * POSSIBILITY OF SUCH DAMAGES.
4226f3cdf0SGordon Ross  */
43ae115bc7Smrj 
44*385cc6b4SJerry Jelinek #define ACPI_CLIBRARY
45ae115bc7Smrj #include "acpi.h"
46aa2aa9a6SDana Myers #include "accommon.h"
47ae115bc7Smrj 
48ae115bc7Smrj /*
49*385cc6b4SJerry Jelinek  * This module contains implementations of the standard C library functions
50*385cc6b4SJerry Jelinek  * that are required by the ACPICA code at both application level and kernel
51*385cc6b4SJerry Jelinek  * level.
52*385cc6b4SJerry Jelinek  *
53*385cc6b4SJerry Jelinek  * The module is an optional feature that can be used if a local/system
54*385cc6b4SJerry Jelinek  * C library is not available. Some operating system kernels may not have
55*385cc6b4SJerry Jelinek  * an internal C library.
56*385cc6b4SJerry Jelinek  *
57*385cc6b4SJerry Jelinek  * In general, these functions are less efficient than an inline or assembly
58*385cc6b4SJerry Jelinek  * code implementation.
59*385cc6b4SJerry Jelinek  *
60*385cc6b4SJerry Jelinek  * These C functions and the associated prototypes are enabled by default
61*385cc6b4SJerry Jelinek  * unless the ACPI_USE_SYSTEM_CLIBRARY symbol is defined. This is usually
62*385cc6b4SJerry Jelinek  * automatically defined for the ACPICA applications such as iASL and
63*385cc6b4SJerry Jelinek  * AcpiExec, so that these user-level applications use the local C library
64*385cc6b4SJerry Jelinek  * instead of the functions in this module.
65ae115bc7Smrj  */
66ae115bc7Smrj 
67*385cc6b4SJerry Jelinek /*******************************************************************************
68*385cc6b4SJerry Jelinek  *
69*385cc6b4SJerry Jelinek  * Functions implemented in this module:
70*385cc6b4SJerry Jelinek  *
71*385cc6b4SJerry Jelinek  * FUNCTION:    memcmp
72*385cc6b4SJerry Jelinek  * FUNCTION:    memcpy
73*385cc6b4SJerry Jelinek  * FUNCTION:    memset
74*385cc6b4SJerry Jelinek  * FUNCTION:    strlen
75*385cc6b4SJerry Jelinek  * FUNCTION:    strcpy
76*385cc6b4SJerry Jelinek  * FUNCTION:    strncpy
77*385cc6b4SJerry Jelinek  * FUNCTION:    strcmp
78*385cc6b4SJerry Jelinek  * FUNCTION:    strchr
79*385cc6b4SJerry Jelinek  * FUNCTION:    strncmp
80*385cc6b4SJerry Jelinek  * FUNCTION:    strcat
81*385cc6b4SJerry Jelinek  * FUNCTION:    strncat
82*385cc6b4SJerry Jelinek  * FUNCTION:    strstr
83*385cc6b4SJerry Jelinek  * FUNCTION:    strtoul
84*385cc6b4SJerry Jelinek  * FUNCTION:    toupper
85*385cc6b4SJerry Jelinek  * FUNCTION:    tolower
86*385cc6b4SJerry Jelinek  * FUNCTION:    is* functions
87*385cc6b4SJerry Jelinek  *
88*385cc6b4SJerry Jelinek  ******************************************************************************/
89*385cc6b4SJerry Jelinek 
90ae115bc7Smrj #define _COMPONENT          ACPI_UTILITIES
91*385cc6b4SJerry Jelinek         ACPI_MODULE_NAME    ("utclib")
92ae115bc7Smrj 
93ae115bc7Smrj 
94*385cc6b4SJerry Jelinek #ifndef ACPI_USE_SYSTEM_CLIBRARY    /* Entire module */
95ae115bc7Smrj 
96ae115bc7Smrj 
97ae115bc7Smrj /*******************************************************************************
98ae115bc7Smrj  *
99*385cc6b4SJerry Jelinek  * FUNCTION:    memcmp
100ae115bc7Smrj  *
101ae115bc7Smrj  * PARAMETERS:  Buffer1         - First Buffer
102ae115bc7Smrj  *              Buffer2         - Second Buffer
103ae115bc7Smrj  *              Count           - Maximum # of bytes to compare
104ae115bc7Smrj  *
105ae115bc7Smrj  * RETURN:      Index where Buffers mismatched, or 0 if Buffers matched
106ae115bc7Smrj  *
107ae115bc7Smrj  * DESCRIPTION: Compare two Buffers, with a maximum length
108ae115bc7Smrj  *
109ae115bc7Smrj  ******************************************************************************/
110ae115bc7Smrj 
111ae115bc7Smrj int
memcmp(void * VBuffer1,void * VBuffer2,ACPI_SIZE Count)112*385cc6b4SJerry Jelinek memcmp (
113*385cc6b4SJerry Jelinek     void                    *VBuffer1,
114*385cc6b4SJerry Jelinek     void                    *VBuffer2,
115ae115bc7Smrj     ACPI_SIZE               Count)
116ae115bc7Smrj {
117*385cc6b4SJerry Jelinek     char                    *Buffer1 = (char *) VBuffer1;
118*385cc6b4SJerry Jelinek     char                    *Buffer2 = (char *) VBuffer2;
119*385cc6b4SJerry Jelinek 
120ae115bc7Smrj 
121ae115bc7Smrj     for ( ; Count-- && (*Buffer1 == *Buffer2); Buffer1++, Buffer2++)
122ae115bc7Smrj     {
123ae115bc7Smrj     }
124ae115bc7Smrj 
125ae115bc7Smrj     return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *Buffer1 -
126ae115bc7Smrj         (unsigned char) *Buffer2));
127ae115bc7Smrj }
128ae115bc7Smrj 
129ae115bc7Smrj 
130ae115bc7Smrj /*******************************************************************************
131ae115bc7Smrj  *
132*385cc6b4SJerry Jelinek  * FUNCTION:    memcpy
133ae115bc7Smrj  *
134ae115bc7Smrj  * PARAMETERS:  Dest        - Target of the copy
135ae115bc7Smrj  *              Src         - Source buffer to copy
136ae115bc7Smrj  *              Count       - Number of bytes to copy
137ae115bc7Smrj  *
138ae115bc7Smrj  * RETURN:      Dest
139ae115bc7Smrj  *
140ae115bc7Smrj  * DESCRIPTION: Copy arbitrary bytes of memory
141ae115bc7Smrj  *
142ae115bc7Smrj  ******************************************************************************/
143ae115bc7Smrj 
144ae115bc7Smrj void *
memcpy(void * Dest,const void * Src,ACPI_SIZE Count)145*385cc6b4SJerry Jelinek memcpy (
146ae115bc7Smrj     void                    *Dest,
147ae115bc7Smrj     const void              *Src,
148ae115bc7Smrj     ACPI_SIZE               Count)
149ae115bc7Smrj {
150ae115bc7Smrj     char                    *New = (char *) Dest;
151ae115bc7Smrj     char                    *Old = (char *) Src;
152ae115bc7Smrj 
153ae115bc7Smrj 
154ae115bc7Smrj     while (Count)
155ae115bc7Smrj     {
156ae115bc7Smrj         *New = *Old;
157ae115bc7Smrj         New++;
158ae115bc7Smrj         Old++;
159ae115bc7Smrj         Count--;
160ae115bc7Smrj     }
161ae115bc7Smrj 
162ae115bc7Smrj     return (Dest);
163ae115bc7Smrj }
164ae115bc7Smrj 
165ae115bc7Smrj 
166ae115bc7Smrj /*******************************************************************************
167ae115bc7Smrj  *
168*385cc6b4SJerry Jelinek  * FUNCTION:    memset
169ae115bc7Smrj  *
170ae115bc7Smrj  * PARAMETERS:  Dest        - Buffer to set
171ae115bc7Smrj  *              Value       - Value to set each byte of memory
172ae115bc7Smrj  *              Count       - Number of bytes to set
173ae115bc7Smrj  *
174ae115bc7Smrj  * RETURN:      Dest
175ae115bc7Smrj  *
176ae115bc7Smrj  * DESCRIPTION: Initialize a buffer to a known value.
177ae115bc7Smrj  *
178ae115bc7Smrj  ******************************************************************************/
179ae115bc7Smrj 
180ae115bc7Smrj void *
memset(void * Dest,int Value,ACPI_SIZE Count)181*385cc6b4SJerry Jelinek memset (
182ae115bc7Smrj     void                    *Dest,
183*385cc6b4SJerry Jelinek     int                     Value,
184ae115bc7Smrj     ACPI_SIZE               Count)
185ae115bc7Smrj {
186ae115bc7Smrj     char                    *New = (char *) Dest;
187ae115bc7Smrj 
188ae115bc7Smrj 
189ae115bc7Smrj     while (Count)
190ae115bc7Smrj     {
191ae115bc7Smrj         *New = (char) Value;
192ae115bc7Smrj         New++;
193ae115bc7Smrj         Count--;
194ae115bc7Smrj     }
195ae115bc7Smrj 
196ae115bc7Smrj     return (Dest);
197ae115bc7Smrj }
198ae115bc7Smrj 
199ae115bc7Smrj 
200ae115bc7Smrj /*******************************************************************************
201ae115bc7Smrj  *
202*385cc6b4SJerry Jelinek  * FUNCTION:    strlen
203ae115bc7Smrj  *
204ae115bc7Smrj  * PARAMETERS:  String              - Null terminated string
205ae115bc7Smrj  *
206ae115bc7Smrj  * RETURN:      Length
207ae115bc7Smrj  *
208ae115bc7Smrj  * DESCRIPTION: Returns the length of the input string
209ae115bc7Smrj  *
210ae115bc7Smrj  ******************************************************************************/
211ae115bc7Smrj 
212ae115bc7Smrj 
213ae115bc7Smrj ACPI_SIZE
strlen(const char * String)214*385cc6b4SJerry Jelinek strlen (
215ae115bc7Smrj     const char              *String)
216ae115bc7Smrj {
217ae115bc7Smrj     UINT32                  Length = 0;
218ae115bc7Smrj 
219ae115bc7Smrj 
220ae115bc7Smrj     /* Count the string until a null is encountered */
221ae115bc7Smrj 
222ae115bc7Smrj     while (*String)
223ae115bc7Smrj     {
224ae115bc7Smrj         Length++;
225ae115bc7Smrj         String++;
226ae115bc7Smrj     }
227ae115bc7Smrj 
228ae115bc7Smrj     return (Length);
229ae115bc7Smrj }
230ae115bc7Smrj 
231ae115bc7Smrj 
232ae115bc7Smrj /*******************************************************************************
233ae115bc7Smrj  *
234*385cc6b4SJerry Jelinek  * FUNCTION:    strcpy
235ae115bc7Smrj  *
236ae115bc7Smrj  * PARAMETERS:  DstString       - Target of the copy
237ae115bc7Smrj  *              SrcString       - The source string to copy
238ae115bc7Smrj  *
239ae115bc7Smrj  * RETURN:      DstString
240ae115bc7Smrj  *
241ae115bc7Smrj  * DESCRIPTION: Copy a null terminated string
242ae115bc7Smrj  *
243ae115bc7Smrj  ******************************************************************************/
244ae115bc7Smrj 
245ae115bc7Smrj char *
strcpy(char * DstString,const char * SrcString)246*385cc6b4SJerry Jelinek strcpy (
247ae115bc7Smrj     char                    *DstString,
248ae115bc7Smrj     const char              *SrcString)
249ae115bc7Smrj {
250ae115bc7Smrj     char                    *String = DstString;
251ae115bc7Smrj 
252ae115bc7Smrj 
253ae115bc7Smrj     /* Move bytes brute force */
254ae115bc7Smrj 
255ae115bc7Smrj     while (*SrcString)
256ae115bc7Smrj     {
257ae115bc7Smrj         *String = *SrcString;
258ae115bc7Smrj 
259ae115bc7Smrj         String++;
260ae115bc7Smrj         SrcString++;
261ae115bc7Smrj     }
262ae115bc7Smrj 
263ae115bc7Smrj     /* Null terminate */
264ae115bc7Smrj 
265ae115bc7Smrj     *String = 0;
266ae115bc7Smrj     return (DstString);
267ae115bc7Smrj }
268ae115bc7Smrj 
269ae115bc7Smrj 
270ae115bc7Smrj /*******************************************************************************
271ae115bc7Smrj  *
272*385cc6b4SJerry Jelinek  * FUNCTION:    strncpy
273ae115bc7Smrj  *
274ae115bc7Smrj  * PARAMETERS:  DstString       - Target of the copy
275ae115bc7Smrj  *              SrcString       - The source string to copy
276ae115bc7Smrj  *              Count           - Maximum # of bytes to copy
277ae115bc7Smrj  *
278ae115bc7Smrj  * RETURN:      DstString
279ae115bc7Smrj  *
280ae115bc7Smrj  * DESCRIPTION: Copy a null terminated string, with a maximum length
281ae115bc7Smrj  *
282ae115bc7Smrj  ******************************************************************************/
283ae115bc7Smrj 
284ae115bc7Smrj char *
strncpy(char * DstString,const char * SrcString,ACPI_SIZE Count)285*385cc6b4SJerry Jelinek strncpy (
286ae115bc7Smrj     char                    *DstString,
287ae115bc7Smrj     const char              *SrcString,
288ae115bc7Smrj     ACPI_SIZE               Count)
289ae115bc7Smrj {
290ae115bc7Smrj     char                    *String = DstString;
291ae115bc7Smrj 
292ae115bc7Smrj 
293ae115bc7Smrj     /* Copy the string */
294ae115bc7Smrj 
295ae115bc7Smrj     for (String = DstString;
296ae115bc7Smrj         Count && (Count--, (*String++ = *SrcString++)); )
297ae115bc7Smrj     {;}
298ae115bc7Smrj 
299ae115bc7Smrj     /* Pad with nulls if necessary */
300ae115bc7Smrj 
301ae115bc7Smrj     while (Count--)
302ae115bc7Smrj     {
303ae115bc7Smrj         *String = 0;
304ae115bc7Smrj         String++;
305ae115bc7Smrj     }
306ae115bc7Smrj 
307ae115bc7Smrj     /* Return original pointer */
308ae115bc7Smrj 
309ae115bc7Smrj     return (DstString);
310ae115bc7Smrj }
311ae115bc7Smrj 
312ae115bc7Smrj 
313ae115bc7Smrj /*******************************************************************************
314ae115bc7Smrj  *
315*385cc6b4SJerry Jelinek  * FUNCTION:    strcmp
316ae115bc7Smrj  *
317ae115bc7Smrj  * PARAMETERS:  String1         - First string
318ae115bc7Smrj  *              String2         - Second string
319ae115bc7Smrj  *
320ae115bc7Smrj  * RETURN:      Index where strings mismatched, or 0 if strings matched
321ae115bc7Smrj  *
322ae115bc7Smrj  * DESCRIPTION: Compare two null terminated strings
323ae115bc7Smrj  *
324ae115bc7Smrj  ******************************************************************************/
325ae115bc7Smrj 
326ae115bc7Smrj int
strcmp(const char * String1,const char * String2)327*385cc6b4SJerry Jelinek strcmp (
328ae115bc7Smrj     const char              *String1,
329ae115bc7Smrj     const char              *String2)
330ae115bc7Smrj {
331ae115bc7Smrj 
332ae115bc7Smrj 
333ae115bc7Smrj     for ( ; (*String1 == *String2); String2++)
334ae115bc7Smrj     {
335ae115bc7Smrj         if (!*String1++)
336ae115bc7Smrj         {
337ae115bc7Smrj             return (0);
338ae115bc7Smrj         }
339ae115bc7Smrj     }
340ae115bc7Smrj 
341ae115bc7Smrj     return ((unsigned char) *String1 - (unsigned char) *String2);
342ae115bc7Smrj }
343ae115bc7Smrj 
344ae115bc7Smrj 
345ae115bc7Smrj /*******************************************************************************
346ae115bc7Smrj  *
347*385cc6b4SJerry Jelinek  * FUNCTION:    strchr
348ae115bc7Smrj  *
349ae115bc7Smrj  * PARAMETERS:  String          - Search string
350ae115bc7Smrj  *              ch              - character to search for
351ae115bc7Smrj  *
352ae115bc7Smrj  * RETURN:      Ptr to char or NULL if not found
353ae115bc7Smrj  *
354ae115bc7Smrj  * DESCRIPTION: Search a string for a character
355ae115bc7Smrj  *
356ae115bc7Smrj  ******************************************************************************/
357ae115bc7Smrj 
358ae115bc7Smrj char *
strchr(const char * String,int ch)359*385cc6b4SJerry Jelinek strchr (
360ae115bc7Smrj     const char              *String,
361ae115bc7Smrj     int                     ch)
362ae115bc7Smrj {
363ae115bc7Smrj 
364ae115bc7Smrj 
365ae115bc7Smrj     for ( ; (*String); String++)
366ae115bc7Smrj     {
367ae115bc7Smrj         if ((*String) == (char) ch)
368ae115bc7Smrj         {
369ae115bc7Smrj             return ((char *) String);
370ae115bc7Smrj         }
371ae115bc7Smrj     }
372ae115bc7Smrj 
373ae115bc7Smrj     return (NULL);
374ae115bc7Smrj }
375*385cc6b4SJerry Jelinek 
376ae115bc7Smrj 
377ae115bc7Smrj /*******************************************************************************
378ae115bc7Smrj  *
379*385cc6b4SJerry Jelinek  * FUNCTION:    strncmp
380ae115bc7Smrj  *
381ae115bc7Smrj  * PARAMETERS:  String1         - First string
382ae115bc7Smrj  *              String2         - Second string
383ae115bc7Smrj  *              Count           - Maximum # of bytes to compare
384ae115bc7Smrj  *
385ae115bc7Smrj  * RETURN:      Index where strings mismatched, or 0 if strings matched
386ae115bc7Smrj  *
387ae115bc7Smrj  * DESCRIPTION: Compare two null terminated strings, with a maximum length
388ae115bc7Smrj  *
389ae115bc7Smrj  ******************************************************************************/
390ae115bc7Smrj 
391ae115bc7Smrj int
strncmp(const char * String1,const char * String2,ACPI_SIZE Count)392*385cc6b4SJerry Jelinek strncmp (
393ae115bc7Smrj     const char              *String1,
394ae115bc7Smrj     const char              *String2,
395ae115bc7Smrj     ACPI_SIZE               Count)
396ae115bc7Smrj {
397ae115bc7Smrj 
398ae115bc7Smrj 
399ae115bc7Smrj     for ( ; Count-- && (*String1 == *String2); String2++)
400ae115bc7Smrj     {
401ae115bc7Smrj         if (!*String1++)
402ae115bc7Smrj         {
403ae115bc7Smrj             return (0);
404ae115bc7Smrj         }
405ae115bc7Smrj     }
406ae115bc7Smrj 
407ae115bc7Smrj     return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *String1 -
408ae115bc7Smrj         (unsigned char) *String2));
409ae115bc7Smrj }
410ae115bc7Smrj 
411ae115bc7Smrj 
412ae115bc7Smrj /*******************************************************************************
413ae115bc7Smrj  *
414*385cc6b4SJerry Jelinek  * FUNCTION:    strcat
415ae115bc7Smrj  *
416ae115bc7Smrj  * PARAMETERS:  DstString       - Target of the copy
417ae115bc7Smrj  *              SrcString       - The source string to copy
418ae115bc7Smrj  *
419ae115bc7Smrj  * RETURN:      DstString
420ae115bc7Smrj  *
421ae115bc7Smrj  * DESCRIPTION: Append a null terminated string to a null terminated string
422ae115bc7Smrj  *
423ae115bc7Smrj  ******************************************************************************/
424ae115bc7Smrj 
425ae115bc7Smrj char *
strcat(char * DstString,const char * SrcString)426*385cc6b4SJerry Jelinek strcat (
427ae115bc7Smrj     char                    *DstString,
428ae115bc7Smrj     const char              *SrcString)
429ae115bc7Smrj {
430ae115bc7Smrj     char                    *String;
431ae115bc7Smrj 
432ae115bc7Smrj 
433ae115bc7Smrj     /* Find end of the destination string */
434ae115bc7Smrj 
435ae115bc7Smrj     for (String = DstString; *String++; )
436ae115bc7Smrj     { ; }
437ae115bc7Smrj 
438ae115bc7Smrj     /* Concatenate the string */
439ae115bc7Smrj 
440ae115bc7Smrj     for (--String; (*String++ = *SrcString++); )
441ae115bc7Smrj     { ; }
442ae115bc7Smrj 
443ae115bc7Smrj     return (DstString);
444ae115bc7Smrj }
445ae115bc7Smrj 
446ae115bc7Smrj 
447ae115bc7Smrj /*******************************************************************************
448ae115bc7Smrj  *
449*385cc6b4SJerry Jelinek  * FUNCTION:    strncat
450ae115bc7Smrj  *
451ae115bc7Smrj  * PARAMETERS:  DstString       - Target of the copy
452ae115bc7Smrj  *              SrcString       - The source string to copy
453ae115bc7Smrj  *              Count           - Maximum # of bytes to copy
454ae115bc7Smrj  *
455ae115bc7Smrj  * RETURN:      DstString
456ae115bc7Smrj  *
457ae115bc7Smrj  * DESCRIPTION: Append a null terminated string to a null terminated string,
458ae115bc7Smrj  *              with a maximum count.
459ae115bc7Smrj  *
460ae115bc7Smrj  ******************************************************************************/
461ae115bc7Smrj 
462ae115bc7Smrj char *
strncat(char * DstString,const char * SrcString,ACPI_SIZE Count)463*385cc6b4SJerry Jelinek strncat (
464ae115bc7Smrj     char                    *DstString,
465ae115bc7Smrj     const char              *SrcString,
466ae115bc7Smrj     ACPI_SIZE               Count)
467ae115bc7Smrj {
468ae115bc7Smrj     char                    *String;
469ae115bc7Smrj 
470ae115bc7Smrj 
471ae115bc7Smrj     if (Count)
472ae115bc7Smrj     {
473ae115bc7Smrj         /* Find end of the destination string */
474ae115bc7Smrj 
475ae115bc7Smrj         for (String = DstString; *String++; )
476ae115bc7Smrj         { ; }
477ae115bc7Smrj 
478ae115bc7Smrj         /* Concatenate the string */
479ae115bc7Smrj 
480ae115bc7Smrj         for (--String; (*String++ = *SrcString++) && --Count; )
481ae115bc7Smrj         { ; }
482ae115bc7Smrj 
483ae115bc7Smrj         /* Null terminate if necessary */
484ae115bc7Smrj 
485ae115bc7Smrj         if (!Count)
486ae115bc7Smrj         {
487ae115bc7Smrj             *String = 0;
488ae115bc7Smrj         }
489ae115bc7Smrj     }
490ae115bc7Smrj 
491ae115bc7Smrj     return (DstString);
492ae115bc7Smrj }
493ae115bc7Smrj 
494ae115bc7Smrj 
495ae115bc7Smrj /*******************************************************************************
496ae115bc7Smrj  *
497*385cc6b4SJerry Jelinek  * FUNCTION:    strstr
498ae115bc7Smrj  *
499ae115bc7Smrj  * PARAMETERS:  String1         - Target string
500ae115bc7Smrj  *              String2         - Substring to search for
501ae115bc7Smrj  *
502ae115bc7Smrj  * RETURN:      Where substring match starts, Null if no match found
503ae115bc7Smrj  *
504ae115bc7Smrj  * DESCRIPTION: Checks if String2 occurs in String1. This is not really a
505ae115bc7Smrj  *              full implementation of strstr, only sufficient for command
506ae115bc7Smrj  *              matching
507ae115bc7Smrj  *
508ae115bc7Smrj  ******************************************************************************/
509ae115bc7Smrj 
510ae115bc7Smrj char *
strstr(char * String1,char * String2)511*385cc6b4SJerry Jelinek strstr (
512ae115bc7Smrj     char                    *String1,
513ae115bc7Smrj     char                    *String2)
514ae115bc7Smrj {
515*385cc6b4SJerry Jelinek     UINT32                  Length;
516ae115bc7Smrj 
517ae115bc7Smrj 
518*385cc6b4SJerry Jelinek     Length = strlen (String2);
519*385cc6b4SJerry Jelinek     if (!Length)
520ae115bc7Smrj     {
521ae115bc7Smrj         return (String1);
522ae115bc7Smrj     }
523ae115bc7Smrj 
524*385cc6b4SJerry Jelinek     while (strlen (String1) >= Length)
525*385cc6b4SJerry Jelinek     {
526*385cc6b4SJerry Jelinek         if (memcmp (String1, String2, Length) == 0)
527*385cc6b4SJerry Jelinek         {
528*385cc6b4SJerry Jelinek             return (String1);
529*385cc6b4SJerry Jelinek         }
530*385cc6b4SJerry Jelinek         String1++;
531*385cc6b4SJerry Jelinek     }
532*385cc6b4SJerry Jelinek 
533*385cc6b4SJerry Jelinek     return (NULL);
534*385cc6b4SJerry Jelinek }
535*385cc6b4SJerry Jelinek 
536ae115bc7Smrj 
537ae115bc7Smrj /*******************************************************************************
538ae115bc7Smrj  *
539*385cc6b4SJerry Jelinek  * FUNCTION:    strtoul
540ae115bc7Smrj  *
541ae115bc7Smrj  * PARAMETERS:  String          - Null terminated string
542ae115bc7Smrj  *              Terminater      - Where a pointer to the terminating byte is
543ae115bc7Smrj  *                                returned
544ae115bc7Smrj  *              Base            - Radix of the string
545ae115bc7Smrj  *
546ae115bc7Smrj  * RETURN:      Converted value
547ae115bc7Smrj  *
548ae115bc7Smrj  * DESCRIPTION: Convert a string into a 32-bit unsigned value.
549*385cc6b4SJerry Jelinek  *              Note: use strtoul64 for 64-bit integers.
550ae115bc7Smrj  *
551ae115bc7Smrj  ******************************************************************************/
552ae115bc7Smrj 
553ae115bc7Smrj UINT32
strtoul(const char * String,char ** Terminator,UINT32 Base)554*385cc6b4SJerry Jelinek strtoul (
555ae115bc7Smrj     const char              *String,
556ae115bc7Smrj     char                    **Terminator,
557ae115bc7Smrj     UINT32                  Base)
558ae115bc7Smrj {
559ae115bc7Smrj     UINT32                  converted = 0;
560ae115bc7Smrj     UINT32                  index;
561ae115bc7Smrj     UINT32                  sign;
562ae115bc7Smrj     const char              *StringStart;
563ae115bc7Smrj     UINT32                  ReturnValue = 0;
564ae115bc7Smrj     ACPI_STATUS             Status = AE_OK;
565ae115bc7Smrj 
566ae115bc7Smrj 
567ae115bc7Smrj     /*
568ae115bc7Smrj      * Save the value of the pointer to the buffer's first
569ae115bc7Smrj      * character, save the current errno value, and then
570ae115bc7Smrj      * skip over any white space in the buffer:
571ae115bc7Smrj      */
572ae115bc7Smrj     StringStart = String;
573*385cc6b4SJerry Jelinek     while (isspace (*String) || *String == '\t')
574ae115bc7Smrj     {
575ae115bc7Smrj         ++String;
576ae115bc7Smrj     }
577ae115bc7Smrj 
578ae115bc7Smrj     /*
579ae115bc7Smrj      * The buffer may contain an optional plus or minus sign.
580ae115bc7Smrj      * If it does, then skip over it but remember what is was:
581ae115bc7Smrj      */
582ae115bc7Smrj     if (*String == '-')
583ae115bc7Smrj     {
584*385cc6b4SJerry Jelinek         sign = ACPI_SIGN_NEGATIVE;
585ae115bc7Smrj         ++String;
586ae115bc7Smrj     }
587ae115bc7Smrj     else if (*String == '+')
588ae115bc7Smrj     {
589ae115bc7Smrj         ++String;
590*385cc6b4SJerry Jelinek         sign = ACPI_SIGN_POSITIVE;
591ae115bc7Smrj     }
592ae115bc7Smrj     else
593ae115bc7Smrj     {
594*385cc6b4SJerry Jelinek         sign = ACPI_SIGN_POSITIVE;
595ae115bc7Smrj     }
596ae115bc7Smrj 
597ae115bc7Smrj     /*
598ae115bc7Smrj      * If the input parameter Base is zero, then we need to
599ae115bc7Smrj      * determine if it is octal, decimal, or hexadecimal:
600ae115bc7Smrj      */
601ae115bc7Smrj     if (Base == 0)
602ae115bc7Smrj     {
603ae115bc7Smrj         if (*String == '0')
604ae115bc7Smrj         {
605*385cc6b4SJerry Jelinek             if (tolower (*(++String)) == 'x')
606ae115bc7Smrj             {
607ae115bc7Smrj                 Base = 16;
608ae115bc7Smrj                 ++String;
609ae115bc7Smrj             }
610ae115bc7Smrj             else
611ae115bc7Smrj             {
612ae115bc7Smrj                 Base = 8;
613ae115bc7Smrj             }
614ae115bc7Smrj         }
615ae115bc7Smrj         else
616ae115bc7Smrj         {
617ae115bc7Smrj             Base = 10;
618ae115bc7Smrj         }
619ae115bc7Smrj     }
620ae115bc7Smrj     else if (Base < 2 || Base > 36)
621ae115bc7Smrj     {
622ae115bc7Smrj         /*
623ae115bc7Smrj          * The specified Base parameter is not in the domain of
624ae115bc7Smrj          * this function:
625ae115bc7Smrj          */
626ae115bc7Smrj         goto done;
627ae115bc7Smrj     }
628ae115bc7Smrj 
629ae115bc7Smrj     /*
630ae115bc7Smrj      * For octal and hexadecimal bases, skip over the leading
631ae115bc7Smrj      * 0 or 0x, if they are present.
632ae115bc7Smrj      */
633ae115bc7Smrj     if (Base == 8 && *String == '0')
634ae115bc7Smrj     {
635ae115bc7Smrj         String++;
636ae115bc7Smrj     }
637ae115bc7Smrj 
638ae115bc7Smrj     if (Base == 16 &&
639ae115bc7Smrj         *String == '0' &&
640*385cc6b4SJerry Jelinek         tolower (*(++String)) == 'x')
641ae115bc7Smrj     {
642ae115bc7Smrj         String++;
643ae115bc7Smrj     }
644ae115bc7Smrj 
645ae115bc7Smrj     /*
646ae115bc7Smrj      * Main loop: convert the string to an unsigned long:
647ae115bc7Smrj      */
648ae115bc7Smrj     while (*String)
649ae115bc7Smrj     {
650*385cc6b4SJerry Jelinek         if (isdigit (*String))
651ae115bc7Smrj         {
652ae115bc7Smrj             index = (UINT32) ((UINT8) *String - '0');
653ae115bc7Smrj         }
654ae115bc7Smrj         else
655ae115bc7Smrj         {
656*385cc6b4SJerry Jelinek             index = (UINT32) toupper (*String);
657*385cc6b4SJerry Jelinek             if (isupper (index))
658ae115bc7Smrj             {
659ae115bc7Smrj                 index = index - 'A' + 10;
660ae115bc7Smrj             }
661ae115bc7Smrj             else
662ae115bc7Smrj             {
663ae115bc7Smrj                 goto done;
664ae115bc7Smrj             }
665ae115bc7Smrj         }
666ae115bc7Smrj 
667ae115bc7Smrj         if (index >= Base)
668ae115bc7Smrj         {
669ae115bc7Smrj             goto done;
670ae115bc7Smrj         }
671ae115bc7Smrj 
672ae115bc7Smrj         /*
673ae115bc7Smrj          * Check to see if value is out of range:
674ae115bc7Smrj          */
675ae115bc7Smrj 
676ae115bc7Smrj         if (ReturnValue > ((ACPI_UINT32_MAX - (UINT32) index) /
677ae115bc7Smrj                             (UINT32) Base))
678ae115bc7Smrj         {
679ae115bc7Smrj             Status = AE_ERROR;
680ae115bc7Smrj             ReturnValue = 0;           /* reset */
681ae115bc7Smrj         }
682ae115bc7Smrj         else
683ae115bc7Smrj         {
684ae115bc7Smrj             ReturnValue *= Base;
685ae115bc7Smrj             ReturnValue += index;
686ae115bc7Smrj             converted = 1;
687ae115bc7Smrj         }
688ae115bc7Smrj 
689ae115bc7Smrj         ++String;
690ae115bc7Smrj     }
691ae115bc7Smrj 
692ae115bc7Smrj done:
693ae115bc7Smrj     /*
694ae115bc7Smrj      * If appropriate, update the caller's pointer to the next
695ae115bc7Smrj      * unconverted character in the buffer.
696ae115bc7Smrj      */
697ae115bc7Smrj     if (Terminator)
698ae115bc7Smrj     {
699ae115bc7Smrj         if (converted == 0 && ReturnValue == 0 && String != NULL)
700ae115bc7Smrj         {
701ae115bc7Smrj             *Terminator = (char *) StringStart;
702ae115bc7Smrj         }
703ae115bc7Smrj         else
704ae115bc7Smrj         {
705ae115bc7Smrj             *Terminator = (char *) String;
706ae115bc7Smrj         }
707ae115bc7Smrj     }
708ae115bc7Smrj 
709ae115bc7Smrj     if (Status == AE_ERROR)
710ae115bc7Smrj     {
711ae115bc7Smrj         ReturnValue = ACPI_UINT32_MAX;
712ae115bc7Smrj     }
713ae115bc7Smrj 
714ae115bc7Smrj     /*
715ae115bc7Smrj      * If a minus sign was present, then "the conversion is negated":
716ae115bc7Smrj      */
717*385cc6b4SJerry Jelinek     if (sign == ACPI_SIGN_NEGATIVE)
718ae115bc7Smrj     {
719ae115bc7Smrj         ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
720ae115bc7Smrj     }
721ae115bc7Smrj 
722ae115bc7Smrj     return (ReturnValue);
723ae115bc7Smrj }
724ae115bc7Smrj 
725ae115bc7Smrj 
726ae115bc7Smrj /*******************************************************************************
727ae115bc7Smrj  *
728*385cc6b4SJerry Jelinek  * FUNCTION:    toupper
729ae115bc7Smrj  *
730ae115bc7Smrj  * PARAMETERS:  c           - Character to convert
731ae115bc7Smrj  *
732ae115bc7Smrj  * RETURN:      Converted character as an int
733ae115bc7Smrj  *
734ae115bc7Smrj  * DESCRIPTION: Convert character to uppercase
735ae115bc7Smrj  *
736ae115bc7Smrj  ******************************************************************************/
737ae115bc7Smrj 
738ae115bc7Smrj int
toupper(int c)739*385cc6b4SJerry Jelinek toupper (
740ae115bc7Smrj     int                     c)
741ae115bc7Smrj {
742ae115bc7Smrj 
743*385cc6b4SJerry Jelinek     return (islower(c) ? ((c)-0x20) : (c));
744ae115bc7Smrj }
745ae115bc7Smrj 
746ae115bc7Smrj 
747ae115bc7Smrj /*******************************************************************************
748ae115bc7Smrj  *
749*385cc6b4SJerry Jelinek  * FUNCTION:    tolower
750ae115bc7Smrj  *
751ae115bc7Smrj  * PARAMETERS:  c           - Character to convert
752ae115bc7Smrj  *
753ae115bc7Smrj  * RETURN:      Converted character as an int
754ae115bc7Smrj  *
755ae115bc7Smrj  * DESCRIPTION: Convert character to lowercase
756ae115bc7Smrj  *
757ae115bc7Smrj  ******************************************************************************/
758ae115bc7Smrj 
759ae115bc7Smrj int
tolower(int c)760*385cc6b4SJerry Jelinek tolower (
761ae115bc7Smrj     int                     c)
762ae115bc7Smrj {
763ae115bc7Smrj 
764*385cc6b4SJerry Jelinek     return (isupper(c) ? ((c)+0x20) : (c));
765ae115bc7Smrj }
766ae115bc7Smrj 
767ae115bc7Smrj 
768ae115bc7Smrj /*******************************************************************************
769ae115bc7Smrj  *
770*385cc6b4SJerry Jelinek  * FUNCTION:    is* function array
771ae115bc7Smrj  *
772ae115bc7Smrj  * DESCRIPTION: is* functions use the ctype table below
773ae115bc7Smrj  *
774ae115bc7Smrj  ******************************************************************************/
775ae115bc7Smrj 
776*385cc6b4SJerry Jelinek const UINT8 AcpiGbl_Ctypes[257] = {
777*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x00     0 NUL */
778*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x01     1 SOH */
779*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x02     2 STX */
780*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x03     3 ETX */
781*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x04     4 EOT */
782*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x05     5 ENQ */
783*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x06     6 ACK */
784*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x07     7 BEL */
785*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x08     8 BS  */
786*385cc6b4SJerry Jelinek     _ACPI_CN|_ACPI_SP,   /* 0x09     9 TAB */
787*385cc6b4SJerry Jelinek     _ACPI_CN|_ACPI_SP,   /* 0x0A    10 LF  */
788*385cc6b4SJerry Jelinek     _ACPI_CN|_ACPI_SP,   /* 0x0B    11 VT  */
789*385cc6b4SJerry Jelinek     _ACPI_CN|_ACPI_SP,   /* 0x0C    12 FF  */
790*385cc6b4SJerry Jelinek     _ACPI_CN|_ACPI_SP,   /* 0x0D    13 CR  */
791*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x0E    14 SO  */
792*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x0F    15 SI  */
793*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x10    16 DLE */
794*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x11    17 DC1 */
795*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x12    18 DC2 */
796*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x13    19 DC3 */
797*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x14    20 DC4 */
798*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x15    21 NAK */
799*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x16    22 SYN */
800*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x17    23 ETB */
801*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x18    24 CAN */
802*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x19    25 EM  */
803*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x1A    26 SUB */
804*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x1B    27 ESC */
805*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x1C    28 FS  */
806*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x1D    29 GS  */
807*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x1E    30 RS  */
808*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x1F    31 US  */
809*385cc6b4SJerry Jelinek     _ACPI_XS|_ACPI_SP,   /* 0x20    32 ' ' */
810*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x21    33 '!' */
811*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x22    34 '"' */
812*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x23    35 '#' */
813*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x24    36 '$' */
814*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x25    37 '%' */
815*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x26    38 '&' */
816*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x27    39 ''' */
817*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x28    40 '(' */
818*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x29    41 ')' */
819*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x2A    42 '*' */
820*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x2B    43 '+' */
821*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x2C    44 ',' */
822*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x2D    45 '-' */
823*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x2E    46 '.' */
824*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x2F    47 '/' */
825*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_DI,   /* 0x30    48 '0' */
826*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_DI,   /* 0x31    49 '1' */
827*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_DI,   /* 0x32    50 '2' */
828*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_DI,   /* 0x33    51 '3' */
829*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_DI,   /* 0x34    52 '4' */
830*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_DI,   /* 0x35    53 '5' */
831*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_DI,   /* 0x36    54 '6' */
832*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_DI,   /* 0x37    55 '7' */
833*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_DI,   /* 0x38    56 '8' */
834*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_DI,   /* 0x39    57 '9' */
835*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x3A    58 ':' */
836*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x3B    59 ';' */
837*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x3C    60 '<' */
838*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x3D    61 '=' */
839*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x3E    62 '>' */
840*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x3F    63 '?' */
841*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x40    64 '@' */
842*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_UP,   /* 0x41    65 'A' */
843*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_UP,   /* 0x42    66 'B' */
844*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_UP,   /* 0x43    67 'C' */
845*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_UP,   /* 0x44    68 'D' */
846*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_UP,   /* 0x45    69 'E' */
847*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_UP,   /* 0x46    70 'F' */
848*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x47    71 'G' */
849*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x48    72 'H' */
850*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x49    73 'I' */
851*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x4A    74 'J' */
852*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x4B    75 'K' */
853*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x4C    76 'L' */
854*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x4D    77 'M' */
855*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x4E    78 'N' */
856*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x4F    79 'O' */
857*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x50    80 'P' */
858*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x51    81 'Q' */
859*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x52    82 'R' */
860*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x53    83 'S' */
861*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x54    84 'T' */
862*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x55    85 'U' */
863*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x56    86 'V' */
864*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x57    87 'W' */
865*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x58    88 'X' */
866*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x59    89 'Y' */
867*385cc6b4SJerry Jelinek     _ACPI_UP,            /* 0x5A    90 'Z' */
868*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x5B    91 '[' */
869*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x5C    92 '\' */
870*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x5D    93 ']' */
871*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x5E    94 '^' */
872*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x5F    95 '_' */
873*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x60    96 '`' */
874*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_LO,   /* 0x61    97 'a' */
875*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_LO,   /* 0x62    98 'b' */
876*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_LO,   /* 0x63    99 'c' */
877*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_LO,   /* 0x64   100 'd' */
878*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_LO,   /* 0x65   101 'e' */
879*385cc6b4SJerry Jelinek     _ACPI_XD|_ACPI_LO,   /* 0x66   102 'f' */
880*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x67   103 'g' */
881*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x68   104 'h' */
882*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x69   105 'i' */
883*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x6A   106 'j' */
884*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x6B   107 'k' */
885*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x6C   108 'l' */
886*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x6D   109 'm' */
887*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x6E   110 'n' */
888*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x6F   111 'o' */
889*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x70   112 'p' */
890*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x71   113 'q' */
891*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x72   114 'r' */
892*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x73   115 's' */
893*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x74   116 't' */
894*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x75   117 'u' */
895*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x76   118 'v' */
896*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x77   119 'w' */
897*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x78   120 'x' */
898*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x79   121 'y' */
899*385cc6b4SJerry Jelinek     _ACPI_LO,            /* 0x7A   122 'z' */
900*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x7B   123 '{' */
901*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x7C   124 '|' */
902*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x7D   125 '}' */
903*385cc6b4SJerry Jelinek     _ACPI_PU,            /* 0x7E   126 '~' */
904*385cc6b4SJerry Jelinek     _ACPI_CN,            /* 0x7F   127 DEL */
905ae115bc7Smrj 
906ae115bc7Smrj     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0x80 to 0x8F    */
907ae115bc7Smrj     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0x90 to 0x9F    */
908ae115bc7Smrj     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xA0 to 0xAF    */
909ae115bc7Smrj     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xB0 to 0xBF    */
910ae115bc7Smrj     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xC0 to 0xCF    */
911ae115bc7Smrj     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xD0 to 0xDF    */
912ae115bc7Smrj     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xE0 to 0xEF    */
913*385cc6b4SJerry Jelinek     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* 0xF0 to 0xFF    */
914*385cc6b4SJerry Jelinek     0                                 /* 0x100 */
915ae115bc7Smrj };
916ae115bc7Smrj 
917ae115bc7Smrj 
918ae115bc7Smrj #endif /* ACPI_USE_SYSTEM_CLIBRARY */
919