diff options
Diffstat (limited to 'drivers/acpi')
| -rw-r--r-- | drivers/acpi/acpica/Makefile | 2 | ||||
| -rw-r--r-- | drivers/acpi/acpica/utclib.c | 749 |
2 files changed, 1 insertions, 750 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index c8bc24bd1f72..bc7a03ded064 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
| @@ -162,5 +162,5 @@ acpi-y += \ | |||
| 162 | utxferror.o \ | 162 | utxferror.o \ |
| 163 | utxfmutex.o | 163 | utxfmutex.o |
| 164 | 164 | ||
| 165 | acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o utclib.o | 165 | acpi-$(ACPI_FUTURE_USAGE) += uttrack.o utcache.o |
| 166 | 166 | ||
diff --git a/drivers/acpi/acpica/utclib.c b/drivers/acpi/acpica/utclib.c deleted file mode 100644 index 19ea4755aa73..000000000000 --- a/drivers/acpi/acpica/utclib.c +++ /dev/null | |||
| @@ -1,749 +0,0 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * Module Name: cmclib - Local implementation of C library functions | ||
| 4 | * | ||
| 5 | *****************************************************************************/ | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Copyright (C) 2000 - 2012, Intel Corp. | ||
| 9 | * All rights reserved. | ||
| 10 | * | ||
| 11 | * Redistribution and use in source and binary forms, with or without | ||
| 12 | * modification, are permitted provided that the following conditions | ||
| 13 | * are met: | ||
| 14 | * 1. Redistributions of source code must retain the above copyright | ||
| 15 | * notice, this list of conditions, and the following disclaimer, | ||
| 16 | * without modification. | ||
| 17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
| 18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
| 19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
| 20 | * including a substantially similar Disclaimer requirement for further | ||
| 21 | * binary redistribution. | ||
| 22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
| 23 | * of any contributors may be used to endorse or promote products derived | ||
| 24 | * from this software without specific prior written permission. | ||
| 25 | * | ||
| 26 | * Alternatively, this software may be distributed under the terms of the | ||
| 27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
| 28 | * Software Foundation. | ||
| 29 | * | ||
| 30 | * NO WARRANTY | ||
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
| 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
| 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
| 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
| 35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
| 39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
| 40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 41 | * POSSIBILITY OF SUCH DAMAGES. | ||
| 42 | */ | ||
| 43 | |||
| 44 | #include <acpi/acpi.h> | ||
| 45 | #include "accommon.h" | ||
| 46 | |||
| 47 | /* | ||
| 48 | * These implementations of standard C Library routines can optionally be | ||
| 49 | * used if a C library is not available. In general, they are less efficient | ||
| 50 | * than an inline or assembly implementation | ||
| 51 | */ | ||
| 52 | |||
| 53 | #define _COMPONENT ACPI_UTILITIES | ||
| 54 | ACPI_MODULE_NAME("cmclib") | ||
| 55 | |||
| 56 | #ifndef ACPI_USE_SYSTEM_CLIBRARY | ||
| 57 | #define NEGATIVE 1 | ||
| 58 | #define POSITIVE 0 | ||
| 59 | /******************************************************************************* | ||
| 60 | * | ||
| 61 | * FUNCTION: acpi_ut_memcmp (memcmp) | ||
| 62 | * | ||
| 63 | * PARAMETERS: buffer1 - First Buffer | ||
| 64 | * buffer2 - Second Buffer | ||
| 65 | * count - Maximum # of bytes to compare | ||
| 66 | * | ||
| 67 | * RETURN: Index where Buffers mismatched, or 0 if Buffers matched | ||
| 68 | * | ||
| 69 | * DESCRIPTION: Compare two Buffers, with a maximum length | ||
| 70 | * | ||
| 71 | ******************************************************************************/ | ||
| 72 | int acpi_ut_memcmp(const char *buffer1, const char *buffer2, acpi_size count) | ||
| 73 | { | ||
| 74 | |||
| 75 | return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*buffer1 - | ||
| 76 | (unsigned char)*buffer2)); | ||
| 77 | } | ||
| 78 | |||
| 79 | /******************************************************************************* | ||
| 80 | * | ||
| 81 | * FUNCTION: acpi_ut_memcpy (memcpy) | ||
| 82 | * | ||
| 83 | * PARAMETERS: dest - Target of the copy | ||
| 84 | * src - Source buffer to copy | ||
| 85 | * count - Number of bytes to copy | ||
| 86 | * | ||
| 87 | * RETURN: Dest | ||
| 88 | * | ||
| 89 | * DESCRIPTION: Copy arbitrary bytes of memory | ||
| 90 | * | ||
| 91 | ******************************************************************************/ | ||
| 92 | |||
| 93 | void *acpi_ut_memcpy(void *dest, const void *src, acpi_size count) | ||
| 94 | { | ||
| 95 | char *new = (char *)dest; | ||
| 96 | char *old = (char *)src; | ||
| 97 | |||
| 98 | while (count) { | ||
| 99 | *new = *old; | ||
| 100 | new++; | ||
| 101 | old++; | ||
| 102 | count--; | ||
| 103 | } | ||
| 104 | |||
| 105 | return (dest); | ||
| 106 | } | ||
| 107 | |||
| 108 | /******************************************************************************* | ||
| 109 | * | ||
| 110 | * FUNCTION: acpi_ut_memset (memset) | ||
| 111 | * | ||
| 112 | * PARAMETERS: dest - Buffer to set | ||
| 113 | * value - Value to set each byte of memory | ||
| 114 | * count - Number of bytes to set | ||
| 115 | * | ||
| 116 | * RETURN: Dest | ||
| 117 | * | ||
| 118 | * DESCRIPTION: Initialize a buffer to a known value. | ||
| 119 | * | ||
| 120 | ******************************************************************************/ | ||
| 121 | |||
| 122 | void *acpi_ut_memset(void *dest, u8 value, acpi_size count) | ||
| 123 | { | ||
| 124 | char *new = (char *)dest; | ||
| 125 | |||
| 126 | while (count) { | ||
| 127 | *new = (char)value; | ||
| 128 | new++; | ||
| 129 | count--; | ||
| 130 | } | ||
| 131 | |||
| 132 | return (dest); | ||
| 133 | } | ||
| 134 | |||
| 135 | /******************************************************************************* | ||
| 136 | * | ||
| 137 | * FUNCTION: acpi_ut_strlen (strlen) | ||
| 138 | * | ||
| 139 | * PARAMETERS: string - Null terminated string | ||
| 140 | * | ||
| 141 | * RETURN: Length | ||
| 142 | * | ||
| 143 | * DESCRIPTION: Returns the length of the input string | ||
| 144 | * | ||
| 145 | ******************************************************************************/ | ||
| 146 | |||
| 147 | acpi_size acpi_ut_strlen(const char *string) | ||
| 148 | { | ||
| 149 | u32 length = 0; | ||
| 150 | |||
| 151 | /* Count the string until a null is encountered */ | ||
| 152 | |||
| 153 | while (*string) { | ||
| 154 | length++; | ||
| 155 | string++; | ||
| 156 | } | ||
| 157 | |||
| 158 | return (length); | ||
| 159 | } | ||
| 160 | |||
| 161 | /******************************************************************************* | ||
| 162 | * | ||
| 163 | * FUNCTION: acpi_ut_strcpy (strcpy) | ||
| 164 | * | ||
| 165 | * PARAMETERS: dst_string - Target of the copy | ||
| 166 | * src_string - The source string to copy | ||
| 167 | * | ||
| 168 | * RETURN: dst_string | ||
| 169 | * | ||
| 170 | * DESCRIPTION: Copy a null terminated string | ||
| 171 | * | ||
| 172 | ******************************************************************************/ | ||
| 173 | |||
| 174 | char *acpi_ut_strcpy(char *dst_string, const char *src_string) | ||
| 175 | { | ||
| 176 | char *string = dst_string; | ||
| 177 | |||
| 178 | /* Move bytes brute force */ | ||
| 179 | |||
| 180 | while (*src_string) { | ||
| 181 | *string = *src_string; | ||
| 182 | |||
| 183 | string++; | ||
| 184 | src_string++; | ||
| 185 | } | ||
| 186 | |||
| 187 | /* Null terminate */ | ||
| 188 | |||
| 189 | *string = 0; | ||
| 190 | return (dst_string); | ||
| 191 | } | ||
| 192 | |||
| 193 | /******************************************************************************* | ||
| 194 | * | ||
| 195 | * FUNCTION: acpi_ut_strncpy (strncpy) | ||
| 196 | * | ||
| 197 | * PARAMETERS: dst_string - Target of the copy | ||
| 198 | * src_string - The source string to copy | ||
| 199 | * count - Maximum # of bytes to copy | ||
| 200 | * | ||
| 201 | * RETURN: dst_string | ||
| 202 | * | ||
| 203 | * DESCRIPTION: Copy a null terminated string, with a maximum length | ||
| 204 | * | ||
| 205 | ******************************************************************************/ | ||
| 206 | |||
| 207 | char *acpi_ut_strncpy(char *dst_string, const char *src_string, acpi_size count) | ||
| 208 | { | ||
| 209 | char *string = dst_string; | ||
| 210 | |||
| 211 | /* Copy the string */ | ||
| 212 | |||
| 213 | for (string = dst_string; | ||
| 214 | count && (count--, (*string++ = *src_string++));) {; | ||
| 215 | } | ||
| 216 | |||
| 217 | /* Pad with nulls if necessary */ | ||
| 218 | |||
| 219 | while (count--) { | ||
| 220 | *string = 0; | ||
| 221 | string++; | ||
| 222 | } | ||
| 223 | |||
| 224 | /* Return original pointer */ | ||
| 225 | |||
| 226 | return (dst_string); | ||
| 227 | } | ||
| 228 | |||
| 229 | /******************************************************************************* | ||
| 230 | * | ||
| 231 | * FUNCTION: acpi_ut_strcmp (strcmp) | ||
| 232 | * | ||
| 233 | * PARAMETERS: string1 - First string | ||
| 234 | * string2 - Second string | ||
| 235 | * | ||
| 236 | * RETURN: Index where strings mismatched, or 0 if strings matched | ||
| 237 | * | ||
| 238 | * DESCRIPTION: Compare two null terminated strings | ||
| 239 | * | ||
| 240 | ******************************************************************************/ | ||
| 241 | |||
| 242 | int acpi_ut_strcmp(const char *string1, const char *string2) | ||
| 243 | { | ||
| 244 | |||
| 245 | for (; (*string1 == *string2); string2++) { | ||
| 246 | if (!*string1++) { | ||
| 247 | return (0); | ||
| 248 | } | ||
| 249 | } | ||
| 250 | |||
| 251 | return ((unsigned char)*string1 - (unsigned char)*string2); | ||
| 252 | } | ||
| 253 | |||
| 254 | #ifdef ACPI_FUTURE_IMPLEMENTATION | ||
| 255 | /* Not used at this time */ | ||
| 256 | /******************************************************************************* | ||
| 257 | * | ||
| 258 | * FUNCTION: acpi_ut_strchr (strchr) | ||
| 259 | * | ||
| 260 | * PARAMETERS: string - Search string | ||
| 261 | * ch - character to search for | ||
| 262 | * | ||
| 263 | * RETURN: Ptr to char or NULL if not found | ||
| 264 | * | ||
| 265 | * DESCRIPTION: Search a string for a character | ||
| 266 | * | ||
| 267 | ******************************************************************************/ | ||
| 268 | |||
| 269 | char *acpi_ut_strchr(const char *string, int ch) | ||
| 270 | { | ||
| 271 | |||
| 272 | for (; (*string); string++) { | ||
| 273 | if ((*string) == (char)ch) { | ||
| 274 | return ((char *)string); | ||
| 275 | } | ||
| 276 | } | ||
| 277 | |||
| 278 | return (NULL); | ||
| 279 | } | ||
| 280 | #endif | ||
| 281 | |||
| 282 | /******************************************************************************* | ||
| 283 | * | ||
| 284 | * FUNCTION: acpi_ut_strncmp (strncmp) | ||
| 285 | * | ||
| 286 | * PARAMETERS: string1 - First string | ||
| 287 | * string2 - Second string | ||
| 288 | * count - Maximum # of bytes to compare | ||
| 289 | * | ||
| 290 | * RETURN: Index where strings mismatched, or 0 if strings matched | ||
| 291 | * | ||
| 292 | * DESCRIPTION: Compare two null terminated strings, with a maximum length | ||
| 293 | * | ||
| 294 | ******************************************************************************/ | ||
| 295 | |||
| 296 | int acpi_ut_strncmp(const char *string1, const char *string2, acpi_size count) | ||
| 297 | { | ||
| 298 | |||
| 299 | for (; count-- && (*string1 == *string2); string2++) { | ||
| 300 | if (!*string1++) { | ||
| 301 | return (0); | ||
| 302 | } | ||
| 303 | } | ||
| 304 | |||
| 305 | return ((count == ACPI_SIZE_MAX) ? 0 : ((unsigned char)*string1 - | ||
| 306 | (unsigned char)*string2)); | ||
| 307 | } | ||
| 308 | |||
| 309 | /******************************************************************************* | ||
| 310 | * | ||
| 311 | * FUNCTION: acpi_ut_strcat (Strcat) | ||
| 312 | * | ||
| 313 | * PARAMETERS: dst_string - Target of the copy | ||
| 314 | * src_string - The source string to copy | ||
| 315 | * | ||
| 316 | * RETURN: dst_string | ||
| 317 | * | ||
| 318 | * DESCRIPTION: Append a null terminated string to a null terminated string | ||
| 319 | * | ||
| 320 | ******************************************************************************/ | ||
| 321 | |||
| 322 | char *acpi_ut_strcat(char *dst_string, const char *src_string) | ||
| 323 | { | ||
| 324 | char *string; | ||
| 325 | |||
| 326 | /* Find end of the destination string */ | ||
| 327 | |||
| 328 | for (string = dst_string; *string++;) {; | ||
| 329 | } | ||
| 330 | |||
| 331 | /* Concatenate the string */ | ||
| 332 | |||
| 333 | for (--string; (*string++ = *src_string++);) {; | ||
| 334 | } | ||
| 335 | |||
| 336 | return (dst_string); | ||
| 337 | } | ||
| 338 | |||
| 339 | /******************************************************************************* | ||
| 340 | * | ||
| 341 | * FUNCTION: acpi_ut_strncat (strncat) | ||
| 342 | * | ||
| 343 | * PARAMETERS: dst_string - Target of the copy | ||
| 344 | * src_string - The source string to copy | ||
| 345 | * count - Maximum # of bytes to copy | ||
| 346 | * | ||
| 347 | * RETURN: dst_string | ||
| 348 | * | ||
| 349 | * DESCRIPTION: Append a null terminated string to a null terminated string, | ||
| 350 | * with a maximum count. | ||
| 351 | * | ||
| 352 | ******************************************************************************/ | ||
| 353 | |||
| 354 | char *acpi_ut_strncat(char *dst_string, const char *src_string, acpi_size count) | ||
| 355 | { | ||
| 356 | char *string; | ||
| 357 | |||
| 358 | if (count) { | ||
| 359 | |||
| 360 | /* Find end of the destination string */ | ||
| 361 | |||
| 362 | for (string = dst_string; *string++;) {; | ||
| 363 | } | ||
| 364 | |||
| 365 | /* Concatenate the string */ | ||
| 366 | |||
| 367 | for (--string; (*string++ = *src_string++) && --count;) {; | ||
| 368 | } | ||
| 369 | |||
| 370 | /* Null terminate if necessary */ | ||
| 371 | |||
| 372 | if (!count) { | ||
| 373 | *string = 0; | ||
| 374 | } | ||
| 375 | } | ||
| 376 | |||
| 377 | return (dst_string); | ||
| 378 | } | ||
| 379 | |||
| 380 | /******************************************************************************* | ||
| 381 | * | ||
| 382 | * FUNCTION: acpi_ut_strstr (strstr) | ||
| 383 | * | ||
| 384 | * PARAMETERS: string1 - Target string | ||
| 385 | * string2 - Substring to search for | ||
| 386 | * | ||
| 387 | * RETURN: Where substring match starts, Null if no match found | ||
| 388 | * | ||
| 389 | * DESCRIPTION: Checks if String2 occurs in String1. This is not really a | ||
| 390 | * full implementation of strstr, only sufficient for command | ||
| 391 | * matching | ||
| 392 | * | ||
| 393 | ******************************************************************************/ | ||
| 394 | |||
| 395 | char *acpi_ut_strstr(char *string1, char *string2) | ||
| 396 | { | ||
| 397 | char *string; | ||
| 398 | |||
| 399 | if (acpi_ut_strlen(string2) > acpi_ut_strlen(string1)) { | ||
| 400 | return (NULL); | ||
| 401 | } | ||
| 402 | |||
| 403 | /* Walk entire string, comparing the letters */ | ||
| 404 | |||
| 405 | for (string = string1; *string2;) { | ||
| 406 | if (*string2 != *string) { | ||
| 407 | return (NULL); | ||
| 408 | } | ||
| 409 | |||
| 410 | string2++; | ||
| 411 | string++; | ||
| 412 | } | ||
| 413 | |||
| 414 | return (string1); | ||
| 415 | } | ||
| 416 | |||
| 417 | /******************************************************************************* | ||
| 418 | * | ||
| 419 | * FUNCTION: acpi_ut_strtoul (strtoul) | ||
| 420 | * | ||
| 421 | * PARAMETERS: string - Null terminated string | ||
| 422 | * terminater - Where a pointer to the terminating byte is | ||
| 423 | * returned | ||
| 424 | * base - Radix of the string | ||
| 425 | * | ||
| 426 | * RETURN: Converted value | ||
| 427 | * | ||
| 428 | * DESCRIPTION: Convert a string into a 32-bit unsigned value. | ||
| 429 | * Note: use acpi_ut_strtoul64 for 64-bit integers. | ||
| 430 | * | ||
| 431 | ******************************************************************************/ | ||
| 432 | |||
| 433 | u32 acpi_ut_strtoul(const char *string, char **terminator, u32 base) | ||
| 434 | { | ||
| 435 | u32 converted = 0; | ||
| 436 | u32 index; | ||
| 437 | u32 sign; | ||
| 438 | const char *string_start; | ||
| 439 | u32 return_value = 0; | ||
| 440 | acpi_status status = AE_OK; | ||
| 441 | |||
| 442 | /* | ||
| 443 | * Save the value of the pointer to the buffer's first | ||
| 444 | * character, save the current errno value, and then | ||
| 445 | * skip over any white space in the buffer: | ||
| 446 | */ | ||
| 447 | string_start = string; | ||
| 448 | while (ACPI_IS_SPACE(*string) || *string == '\t') { | ||
| 449 | ++string; | ||
| 450 | } | ||
| 451 | |||
| 452 | /* | ||
| 453 | * The buffer may contain an optional plus or minus sign. | ||
| 454 | * If it does, then skip over it but remember what is was: | ||
| 455 | */ | ||
| 456 | if (*string == '-') { | ||
| 457 | sign = NEGATIVE; | ||
| 458 | ++string; | ||
| 459 | } else if (*string == '+') { | ||
| 460 | ++string; | ||
| 461 | sign = POSITIVE; | ||
| 462 | } else { | ||
| 463 | sign = POSITIVE; | ||
| 464 | } | ||
| 465 | |||
| 466 | /* | ||
| 467 | * If the input parameter Base is zero, then we need to | ||
| 468 | * determine if it is octal, decimal, or hexadecimal: | ||
| 469 | */ | ||
| 470 | if (base == 0) { | ||
| 471 | if (*string == '0') { | ||
| 472 | if (acpi_ut_to_lower(*(++string)) == 'x') { | ||
| 473 | base = 16; | ||
| 474 | ++string; | ||
| 475 | } else { | ||
| 476 | base = 8; | ||
| 477 | } | ||
| 478 | } else { | ||
| 479 | base = 10; | ||
| 480 | } | ||
| 481 | } else if (base < 2 || base > 36) { | ||
| 482 | /* | ||
| 483 | * The specified Base parameter is not in the domain of | ||
| 484 | * this function: | ||
| 485 | */ | ||
| 486 | goto done; | ||
| 487 | } | ||
| 488 | |||
| 489 | /* | ||
| 490 | * For octal and hexadecimal bases, skip over the leading | ||
| 491 | * 0 or 0x, if they are present. | ||
| 492 | */ | ||
| 493 | if (base == 8 && *string == '0') { | ||
| 494 | string++; | ||
| 495 | } | ||
| 496 | |||
| 497 | if (base == 16 && | ||
| 498 | *string == '0' && acpi_ut_to_lower(*(++string)) == 'x') { | ||
| 499 | string++; | ||
| 500 | } | ||
| 501 | |||
| 502 | /* | ||
| 503 | * Main loop: convert the string to an unsigned long: | ||
| 504 | */ | ||
| 505 | while (*string) { | ||
| 506 | if (ACPI_IS_DIGIT(*string)) { | ||
| 507 | index = (u32)((u8)*string - '0'); | ||
| 508 | } else { | ||
| 509 | index = (u32)acpi_ut_to_upper(*string); | ||
| 510 | if (ACPI_IS_UPPER(index)) { | ||
| 511 | index = index - 'A' + 10; | ||
| 512 | } else { | ||
| 513 | goto done; | ||
| 514 | } | ||
| 515 | } | ||
| 516 | |||
| 517 | if (index >= base) { | ||
| 518 | goto done; | ||
| 519 | } | ||
| 520 | |||
| 521 | /* | ||
| 522 | * Check to see if value is out of range: | ||
| 523 | */ | ||
| 524 | |||
| 525 | if (return_value > ((ACPI_UINT32_MAX - (u32)index) / (u32)base)) { | ||
| 526 | status = AE_ERROR; | ||
| 527 | return_value = 0; /* reset */ | ||
| 528 | } else { | ||
| 529 | return_value *= base; | ||
| 530 | return_value += index; | ||
| 531 | converted = 1; | ||
| 532 | } | ||
| 533 | |||
| 534 | ++string; | ||
| 535 | } | ||
| 536 | |||
| 537 | done: | ||
| 538 | /* | ||
| 539 | * If appropriate, update the caller's pointer to the next | ||
| 540 | * unconverted character in the buffer. | ||
| 541 | */ | ||
| 542 | if (terminator) { | ||
| 543 | if (converted == 0 && return_value == 0 && string != NULL) { | ||
| 544 | *terminator = (char *)string_start; | ||
| 545 | } else { | ||
| 546 | *terminator = (char *)string; | ||
| 547 | } | ||
| 548 | } | ||
| 549 | |||
| 550 | if (status == AE_ERROR) { | ||
| 551 | return_value = ACPI_UINT32_MAX; | ||
| 552 | } | ||
| 553 | |||
| 554 | /* | ||
| 555 | * If a minus sign was present, then "the conversion is negated": | ||
| 556 | */ | ||
| 557 | if (sign == NEGATIVE) { | ||
| 558 | return_value = (ACPI_UINT32_MAX - return_value) + 1; | ||
| 559 | } | ||
| 560 | |||
| 561 | return (return_value); | ||
| 562 | } | ||
| 563 | |||
| 564 | /******************************************************************************* | ||
| 565 | * | ||
| 566 | * FUNCTION: acpi_ut_to_upper (TOUPPER) | ||
| 567 | * | ||
| 568 | * PARAMETERS: c - Character to convert | ||
| 569 | * | ||
| 570 | * RETURN: Converted character as an int | ||
| 571 | * | ||
| 572 | * DESCRIPTION: Convert character to uppercase | ||
| 573 | * | ||
| 574 | ******************************************************************************/ | ||
| 575 | |||
| 576 | int acpi_ut_to_upper(int c) | ||
| 577 | { | ||
| 578 | |||
| 579 | return (ACPI_IS_LOWER(c) ? ((c) - 0x20) : (c)); | ||
| 580 | } | ||
| 581 | |||
| 582 | /******************************************************************************* | ||
| 583 | * | ||
| 584 | * FUNCTION: acpi_ut_to_lower (TOLOWER) | ||
| 585 | * | ||
| 586 | * PARAMETERS: c - Character to convert | ||
| 587 | * | ||
| 588 | * RETURN: Converted character as an int | ||
| 589 | * | ||
| 590 | * DESCRIPTION: Convert character to lowercase | ||
| 591 | * | ||
| 592 | ******************************************************************************/ | ||
| 593 | |||
| 594 | int acpi_ut_to_lower(int c) | ||
| 595 | { | ||
| 596 | |||
| 597 | return (ACPI_IS_UPPER(c) ? ((c) + 0x20) : (c)); | ||
| 598 | } | ||
| 599 | |||
| 600 | /******************************************************************************* | ||
| 601 | * | ||
| 602 | * FUNCTION: is* functions | ||
| 603 | * | ||
| 604 | * DESCRIPTION: is* functions use the ctype table below | ||
| 605 | * | ||
| 606 | ******************************************************************************/ | ||
| 607 | |||
| 608 | const u8 _acpi_ctype[257] = { | ||
| 609 | _ACPI_CN, /* 0x00 0 NUL */ | ||
| 610 | _ACPI_CN, /* 0x01 1 SOH */ | ||
| 611 | _ACPI_CN, /* 0x02 2 STX */ | ||
| 612 | _ACPI_CN, /* 0x03 3 ETX */ | ||
| 613 | _ACPI_CN, /* 0x04 4 EOT */ | ||
| 614 | _ACPI_CN, /* 0x05 5 ENQ */ | ||
| 615 | _ACPI_CN, /* 0x06 6 ACK */ | ||
| 616 | _ACPI_CN, /* 0x07 7 BEL */ | ||
| 617 | _ACPI_CN, /* 0x08 8 BS */ | ||
| 618 | _ACPI_CN | _ACPI_SP, /* 0x09 9 TAB */ | ||
| 619 | _ACPI_CN | _ACPI_SP, /* 0x0A 10 LF */ | ||
| 620 | _ACPI_CN | _ACPI_SP, /* 0x0B 11 VT */ | ||
| 621 | _ACPI_CN | _ACPI_SP, /* 0x0C 12 FF */ | ||
| 622 | _ACPI_CN | _ACPI_SP, /* 0x0D 13 CR */ | ||
| 623 | _ACPI_CN, /* 0x0E 14 SO */ | ||
| 624 | _ACPI_CN, /* 0x0F 15 SI */ | ||
| 625 | _ACPI_CN, /* 0x10 16 DLE */ | ||
| 626 | _ACPI_CN, /* 0x11 17 DC1 */ | ||
| 627 | _ACPI_CN, /* 0x12 18 DC2 */ | ||
| 628 | _ACPI_CN, /* 0x13 19 DC3 */ | ||
| 629 | _ACPI_CN, /* 0x14 20 DC4 */ | ||
| 630 | _ACPI_CN, /* 0x15 21 NAK */ | ||
| 631 | _ACPI_CN, /* 0x16 22 SYN */ | ||
| 632 | _ACPI_CN, /* 0x17 23 ETB */ | ||
| 633 | _ACPI_CN, /* 0x18 24 CAN */ | ||
| 634 | _ACPI_CN, /* 0x19 25 EM */ | ||
| 635 | _ACPI_CN, /* 0x1A 26 SUB */ | ||
| 636 | _ACPI_CN, /* 0x1B 27 ESC */ | ||
| 637 | _ACPI_CN, /* 0x1C 28 FS */ | ||
| 638 | _ACPI_CN, /* 0x1D 29 GS */ | ||
| 639 | _ACPI_CN, /* 0x1E 30 RS */ | ||
| 640 | _ACPI_CN, /* 0x1F 31 US */ | ||
| 641 | _ACPI_XS | _ACPI_SP, /* 0x20 32 ' ' */ | ||
| 642 | _ACPI_PU, /* 0x21 33 '!' */ | ||
| 643 | _ACPI_PU, /* 0x22 34 '"' */ | ||
| 644 | _ACPI_PU, /* 0x23 35 '#' */ | ||
| 645 | _ACPI_PU, /* 0x24 36 '$' */ | ||
| 646 | _ACPI_PU, /* 0x25 37 '%' */ | ||
| 647 | _ACPI_PU, /* 0x26 38 '&' */ | ||
| 648 | _ACPI_PU, /* 0x27 39 ''' */ | ||
| 649 | _ACPI_PU, /* 0x28 40 '(' */ | ||
| 650 | _ACPI_PU, /* 0x29 41 ')' */ | ||
| 651 | _ACPI_PU, /* 0x2A 42 '*' */ | ||
| 652 | _ACPI_PU, /* 0x2B 43 '+' */ | ||
| 653 | _ACPI_PU, /* 0x2C 44 ',' */ | ||
| 654 | _ACPI_PU, /* 0x2D 45 '-' */ | ||
| 655 | _ACPI_PU, /* 0x2E 46 '.' */ | ||
| 656 | _ACPI_PU, /* 0x2F 47 '/' */ | ||
| 657 | _ACPI_XD | _ACPI_DI, /* 0x30 48 '0' */ | ||
| 658 | _ACPI_XD | _ACPI_DI, /* 0x31 49 '1' */ | ||
| 659 | _ACPI_XD | _ACPI_DI, /* 0x32 50 '2' */ | ||
| 660 | _ACPI_XD | _ACPI_DI, /* 0x33 51 '3' */ | ||
| 661 | _ACPI_XD | _ACPI_DI, /* 0x34 52 '4' */ | ||
| 662 | _ACPI_XD | _ACPI_DI, /* 0x35 53 '5' */ | ||
| 663 | _ACPI_XD | _ACPI_DI, /* 0x36 54 '6' */ | ||
| 664 | _ACPI_XD | _ACPI_DI, /* 0x37 55 '7' */ | ||
| 665 | _ACPI_XD | _ACPI_DI, /* 0x38 56 '8' */ | ||
| 666 | _ACPI_XD | _ACPI_DI, /* 0x39 57 '9' */ | ||
| 667 | _ACPI_PU, /* 0x3A 58 ':' */ | ||
| 668 | _ACPI_PU, /* 0x3B 59 ';' */ | ||
| 669 | _ACPI_PU, /* 0x3C 60 '<' */ | ||
| 670 | _ACPI_PU, /* 0x3D 61 '=' */ | ||
| 671 | _ACPI_PU, /* 0x3E 62 '>' */ | ||
| 672 | _ACPI_PU, /* 0x3F 63 '?' */ | ||
| 673 | _ACPI_PU, /* 0x40 64 '@' */ | ||
| 674 | _ACPI_XD | _ACPI_UP, /* 0x41 65 'A' */ | ||
| 675 | _ACPI_XD | _ACPI_UP, /* 0x42 66 'B' */ | ||
| 676 | _ACPI_XD | _ACPI_UP, /* 0x43 67 'C' */ | ||
| 677 | _ACPI_XD | _ACPI_UP, /* 0x44 68 'D' */ | ||
| 678 | _ACPI_XD | _ACPI_UP, /* 0x45 69 'E' */ | ||
| 679 | _ACPI_XD | _ACPI_UP, /* 0x46 70 'F' */ | ||
| 680 | _ACPI_UP, /* 0x47 71 'G' */ | ||
| 681 | _ACPI_UP, /* 0x48 72 'H' */ | ||
| 682 | _ACPI_UP, /* 0x49 73 'I' */ | ||
| 683 | _ACPI_UP, /* 0x4A 74 'J' */ | ||
| 684 | _ACPI_UP, /* 0x4B 75 'K' */ | ||
| 685 | _ACPI_UP, /* 0x4C 76 'L' */ | ||
| 686 | _ACPI_UP, /* 0x4D 77 'M' */ | ||
| 687 | _ACPI_UP, /* 0x4E 78 'N' */ | ||
| 688 | _ACPI_UP, /* 0x4F 79 'O' */ | ||
| 689 | _ACPI_UP, /* 0x50 80 'P' */ | ||
| 690 | _ACPI_UP, /* 0x51 81 'Q' */ | ||
| 691 | _ACPI_UP, /* 0x52 82 'R' */ | ||
| 692 | _ACPI_UP, /* 0x53 83 'S' */ | ||
| 693 | _ACPI_UP, /* 0x54 84 'T' */ | ||
| 694 | _ACPI_UP, /* 0x55 85 'U' */ | ||
| 695 | _ACPI_UP, /* 0x56 86 'V' */ | ||
| 696 | _ACPI_UP, /* 0x57 87 'W' */ | ||
| 697 | _ACPI_UP, /* 0x58 88 'X' */ | ||
| 698 | _ACPI_UP, /* 0x59 89 'Y' */ | ||
| 699 | _ACPI_UP, /* 0x5A 90 'Z' */ | ||
| 700 | _ACPI_PU, /* 0x5B 91 '[' */ | ||
| 701 | _ACPI_PU, /* 0x5C 92 '\' */ | ||
| 702 | _ACPI_PU, /* 0x5D 93 ']' */ | ||
| 703 | _ACPI_PU, /* 0x5E 94 '^' */ | ||
| 704 | _ACPI_PU, /* 0x5F 95 '_' */ | ||
| 705 | _ACPI_PU, /* 0x60 96 '`' */ | ||
| 706 | _ACPI_XD | _ACPI_LO, /* 0x61 97 'a' */ | ||
| 707 | _ACPI_XD | _ACPI_LO, /* 0x62 98 'b' */ | ||
| 708 | _ACPI_XD | _ACPI_LO, /* 0x63 99 'c' */ | ||
| 709 | _ACPI_XD | _ACPI_LO, /* 0x64 100 'd' */ | ||
| 710 | _ACPI_XD | _ACPI_LO, /* 0x65 101 'e' */ | ||
| 711 | _ACPI_XD | _ACPI_LO, /* 0x66 102 'f' */ | ||
| 712 | _ACPI_LO, /* 0x67 103 'g' */ | ||
| 713 | _ACPI_LO, /* 0x68 104 'h' */ | ||
| 714 | _ACPI_LO, /* 0x69 105 'i' */ | ||
| 715 | _ACPI_LO, /* 0x6A 106 'j' */ | ||
| 716 | _ACPI_LO, /* 0x6B 107 'k' */ | ||
| 717 | _ACPI_LO, /* 0x6C 108 'l' */ | ||
| 718 | _ACPI_LO, /* 0x6D 109 'm' */ | ||
| 719 | _ACPI_LO, /* 0x6E 110 'n' */ | ||
| 720 | _ACPI_LO, /* 0x6F 111 'o' */ | ||
| 721 | _ACPI_LO, /* 0x70 112 'p' */ | ||
| 722 | _ACPI_LO, /* 0x71 113 'q' */ | ||
| 723 | _ACPI_LO, /* 0x72 114 'r' */ | ||
| 724 | _ACPI_LO, /* 0x73 115 's' */ | ||
| 725 | _ACPI_LO, /* 0x74 116 't' */ | ||
| 726 | _ACPI_LO, /* 0x75 117 'u' */ | ||
| 727 | _ACPI_LO, /* 0x76 118 'v' */ | ||
| 728 | _ACPI_LO, /* 0x77 119 'w' */ | ||
| 729 | _ACPI_LO, /* 0x78 120 'x' */ | ||
| 730 | _ACPI_LO, /* 0x79 121 'y' */ | ||
| 731 | _ACPI_LO, /* 0x7A 122 'z' */ | ||
| 732 | _ACPI_PU, /* 0x7B 123 '{' */ | ||
| 733 | _ACPI_PU, /* 0x7C 124 '|' */ | ||
| 734 | _ACPI_PU, /* 0x7D 125 '}' */ | ||
| 735 | _ACPI_PU, /* 0x7E 126 '~' */ | ||
| 736 | _ACPI_CN, /* 0x7F 127 DEL */ | ||
| 737 | |||
| 738 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 to 0x8F */ | ||
| 739 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 to 0x9F */ | ||
| 740 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 to 0xAF */ | ||
| 741 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 to 0xBF */ | ||
| 742 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 to 0xCF */ | ||
| 743 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 to 0xDF */ | ||
| 744 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 to 0xEF */ | ||
| 745 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xF0 to 0xFF */ | ||
| 746 | 0 /* 0x100 */ | ||
| 747 | }; | ||
| 748 | |||
| 749 | #endif /* ACPI_USE_SYSTEM_CLIBRARY */ | ||
