diff options
Diffstat (limited to 'drivers/acpi/acpica/exutils.c')
-rw-r--r-- | drivers/acpi/acpica/exutils.c | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 87730e944132..7d41f99f7052 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c | |||
@@ -358,50 +358,67 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base) | |||
358 | * | 358 | * |
359 | * FUNCTION: acpi_ex_eisa_id_to_string | 359 | * FUNCTION: acpi_ex_eisa_id_to_string |
360 | * | 360 | * |
361 | * PARAMETERS: numeric_id - EISA ID to be converted | 361 | * PARAMETERS: compressed_id - EISAID to be converted |
362 | * out_string - Where to put the converted string (8 bytes) | 362 | * out_string - Where to put the converted string (8 bytes) |
363 | * | 363 | * |
364 | * RETURN: None | 364 | * RETURN: None |
365 | * | 365 | * |
366 | * DESCRIPTION: Convert a numeric EISA ID to string representation | 366 | * DESCRIPTION: Convert a numeric EISAID to string representation. Return |
367 | * buffer must be large enough to hold the string. The string | ||
368 | * returned is always exactly of length ACPI_EISAID_STRING_SIZE | ||
369 | * (includes null terminator). The EISAID is always 32 bits. | ||
367 | * | 370 | * |
368 | ******************************************************************************/ | 371 | ******************************************************************************/ |
369 | 372 | ||
370 | void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string) | 373 | void acpi_ex_eisa_id_to_string(char *out_string, acpi_integer compressed_id) |
371 | { | 374 | { |
372 | u32 eisa_id; | 375 | u32 swapped_id; |
373 | 376 | ||
374 | ACPI_FUNCTION_ENTRY(); | 377 | ACPI_FUNCTION_ENTRY(); |
375 | 378 | ||
379 | /* The EISAID should be a 32-bit integer */ | ||
380 | |||
381 | if (compressed_id > ACPI_UINT32_MAX) { | ||
382 | ACPI_WARNING((AE_INFO, | ||
383 | "Expected EISAID is larger than 32 bits: 0x%8.8X%8.8X, truncating", | ||
384 | ACPI_FORMAT_UINT64(compressed_id))); | ||
385 | } | ||
386 | |||
376 | /* Swap ID to big-endian to get contiguous bits */ | 387 | /* Swap ID to big-endian to get contiguous bits */ |
377 | 388 | ||
378 | eisa_id = acpi_ut_dword_byte_swap(numeric_id); | 389 | swapped_id = acpi_ut_dword_byte_swap((u32)compressed_id); |
379 | 390 | ||
380 | out_string[0] = (char)('@' + (((unsigned long)eisa_id >> 26) & 0x1f)); | 391 | /* First 3 bytes are uppercase letters. Next 4 bytes are hexadecimal */ |
381 | out_string[1] = (char)('@' + ((eisa_id >> 21) & 0x1f)); | 392 | |
382 | out_string[2] = (char)('@' + ((eisa_id >> 16) & 0x1f)); | 393 | out_string[0] = |
383 | out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 12); | 394 | (char)(0x40 + (((unsigned long)swapped_id >> 26) & 0x1F)); |
384 | out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 8); | 395 | out_string[1] = (char)(0x40 + ((swapped_id >> 21) & 0x1F)); |
385 | out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 4); | 396 | out_string[2] = (char)(0x40 + ((swapped_id >> 16) & 0x1F)); |
386 | out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 0); | 397 | out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 12); |
398 | out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 8); | ||
399 | out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 4); | ||
400 | out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer)swapped_id, 0); | ||
387 | out_string[7] = 0; | 401 | out_string[7] = 0; |
388 | } | 402 | } |
389 | 403 | ||
390 | /******************************************************************************* | 404 | /******************************************************************************* |
391 | * | 405 | * |
392 | * FUNCTION: acpi_ex_unsigned_integer_to_string | 406 | * FUNCTION: acpi_ex_integer_to_string |
393 | * | 407 | * |
394 | * PARAMETERS: Value - Value to be converted | 408 | * PARAMETERS: out_string - Where to put the converted string. At least |
395 | * out_string - Where to put the converted string (8 bytes) | 409 | * 21 bytes are needed to hold the largest |
410 | * possible 64-bit integer. | ||
411 | * Value - Value to be converted | ||
396 | * | 412 | * |
397 | * RETURN: None, string | 413 | * RETURN: None, string |
398 | * | 414 | * |
399 | * DESCRIPTION: Convert a number to string representation. Assumes string | 415 | * DESCRIPTION: Convert a 64-bit integer to decimal string representation. |
400 | * buffer is large enough to hold the string. | 416 | * Assumes string buffer is large enough to hold the string. The |
417 | * largest string is (ACPI_MAX64_DECIMAL_DIGITS + 1). | ||
401 | * | 418 | * |
402 | ******************************************************************************/ | 419 | ******************************************************************************/ |
403 | 420 | ||
404 | void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string) | 421 | void acpi_ex_integer_to_string(char *out_string, acpi_integer value) |
405 | { | 422 | { |
406 | u32 count; | 423 | u32 count; |
407 | u32 digits_needed; | 424 | u32 digits_needed; |