diff options
| author | Bob Moore <robert.moore@intel.com> | 2014-07-30 00:21:13 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-07-30 18:50:23 -0400 |
| commit | 73bbca04867d2f75443cc7dadcf115258f06b25e (patch) | |
| tree | 188949fe6d8db1569e74ea0bbef66bf7faa71808 | |
| parent | 3589b8b8af6bdc3aafe520d76a73b77d965006b6 (diff) | |
ACPICA: acpihelp: Add UUID support, restructure some existing files.
This adds a -u option to acpi_help to display all known ACPI UUIDs.
Some existing files in the core code have been restructured.
Three new files.
[zetalog: changing drivers/acpi/acpica/Makefile accordingly]
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| -rw-r--r-- | drivers/acpi/acpica/Makefile | 8 | ||||
| -rw-r--r-- | drivers/acpi/acpica/aclocal.h | 5 | ||||
| -rw-r--r-- | drivers/acpi/acpica/acutils.h | 9 | ||||
| -rw-r--r-- | drivers/acpi/acpica/utdecode.c | 27 | ||||
| -rw-r--r-- | drivers/acpi/acpica/uthex.c | 100 | ||||
| -rw-r--r-- | drivers/acpi/acpica/utuuid.c | 96 |
6 files changed, 217 insertions, 28 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 6b9ec239d578..f2bb97812dd6 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
| @@ -157,6 +157,7 @@ acpi-y += \ | |||
| 157 | uterror.o \ | 157 | uterror.o \ |
| 158 | uteval.o \ | 158 | uteval.o \ |
| 159 | utglobal.o \ | 159 | utglobal.o \ |
| 160 | uthex.o \ | ||
| 160 | utids.o \ | 161 | utids.o \ |
| 161 | utinit.o \ | 162 | utinit.o \ |
| 162 | utlock.o \ | 163 | utlock.o \ |
| @@ -175,5 +176,10 @@ acpi-y += \ | |||
| 175 | utxferror.o \ | 176 | utxferror.o \ |
| 176 | utxfmutex.o | 177 | utxfmutex.o |
| 177 | 178 | ||
| 178 | acpi-$(ACPI_FUTURE_USAGE) += utfileio.o utprint.o uttrack.o utcache.o | 179 | acpi-$(ACPI_FUTURE_USAGE) += \ |
| 180 | utcache.o \ | ||
| 181 | utfileio.o \ | ||
| 182 | utprint.o \ | ||
| 183 | uttrack.o \ | ||
| 184 | utuuid.o | ||
| 179 | 185 | ||
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 4c9fd7ceeb24..1f9aba5fb81f 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
| @@ -1155,4 +1155,9 @@ struct ah_device_id { | |||
| 1155 | char *description; | 1155 | char *description; |
| 1156 | }; | 1156 | }; |
| 1157 | 1157 | ||
| 1158 | struct ah_uuid { | ||
| 1159 | char *description; | ||
| 1160 | char *string; | ||
| 1161 | }; | ||
| 1162 | |||
| 1158 | #endif /* __ACLOCAL_H__ */ | 1163 | #endif /* __ACLOCAL_H__ */ |
diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index ed614f4b2182..486d342e74b6 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h | |||
| @@ -194,6 +194,8 @@ char *acpi_ut_get_event_name(u32 event_id); | |||
| 194 | 194 | ||
| 195 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position); | 195 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position); |
| 196 | 196 | ||
| 197 | u8 acpi_ut_ascii_char_to_hex(int hex_char); | ||
| 198 | |||
| 197 | u8 acpi_ut_valid_object_type(acpi_object_type type); | 199 | u8 acpi_ut_valid_object_type(acpi_object_type type); |
| 198 | 200 | ||
| 199 | /* | 201 | /* |
| @@ -759,6 +761,8 @@ const struct ah_predefined_name *acpi_ah_match_predefined_name(char *nameseg); | |||
| 759 | 761 | ||
| 760 | const struct ah_device_id *acpi_ah_match_hardware_id(char *hid); | 762 | const struct ah_device_id *acpi_ah_match_hardware_id(char *hid); |
| 761 | 763 | ||
| 764 | const char *acpi_ah_match_uuid(u8 *data); | ||
| 765 | |||
| 762 | /* | 766 | /* |
| 763 | * utprint - printf/vprintf output functions | 767 | * utprint - printf/vprintf output functions |
| 764 | */ | 768 | */ |
| @@ -778,4 +782,9 @@ int acpi_ut_file_vprintf(ACPI_FILE file, const char *format, va_list args); | |||
| 778 | int acpi_ut_file_printf(ACPI_FILE file, const char *format, ...); | 782 | int acpi_ut_file_printf(ACPI_FILE file, const char *format, ...); |
| 779 | #endif | 783 | #endif |
| 780 | 784 | ||
| 785 | /* | ||
| 786 | * utuuid -- UUID support functions | ||
| 787 | */ | ||
| 788 | void acpi_ut_convert_string_to_uuid(char *in_string, u8 *uuid_buffer); | ||
| 789 | |||
| 781 | #endif /* _ACUTILS_H */ | 790 | #endif /* _ACUTILS_H */ |
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c index 90ec37c473c6..98f541873810 100644 --- a/drivers/acpi/acpica/utdecode.c +++ b/drivers/acpi/acpica/utdecode.c | |||
| @@ -88,33 +88,6 @@ const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES] = { | |||
| 88 | 88 | ||
| 89 | /******************************************************************************* | 89 | /******************************************************************************* |
| 90 | * | 90 | * |
| 91 | * FUNCTION: acpi_ut_hex_to_ascii_char | ||
| 92 | * | ||
| 93 | * PARAMETERS: integer - Contains the hex digit | ||
| 94 | * position - bit position of the digit within the | ||
| 95 | * integer (multiple of 4) | ||
| 96 | * | ||
| 97 | * RETURN: The converted Ascii character | ||
| 98 | * | ||
| 99 | * DESCRIPTION: Convert a hex digit to an Ascii character | ||
| 100 | * | ||
| 101 | ******************************************************************************/ | ||
| 102 | |||
| 103 | /* Hex to ASCII conversion table */ | ||
| 104 | |||
| 105 | static const char acpi_gbl_hex_to_ascii[] = { | ||
| 106 | '0', '1', '2', '3', '4', '5', '6', '7', | ||
| 107 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' | ||
| 108 | }; | ||
| 109 | |||
| 110 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position) | ||
| 111 | { | ||
| 112 | |||
| 113 | return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); | ||
| 114 | } | ||
| 115 | |||
| 116 | /******************************************************************************* | ||
| 117 | * | ||
| 118 | * FUNCTION: acpi_ut_get_region_name | 91 | * FUNCTION: acpi_ut_get_region_name |
| 119 | * | 92 | * |
| 120 | * PARAMETERS: Space ID - ID for the region | 93 | * PARAMETERS: Space ID - ID for the region |
diff --git a/drivers/acpi/acpica/uthex.c b/drivers/acpi/acpica/uthex.c new file mode 100644 index 000000000000..9afa9441b183 --- /dev/null +++ b/drivers/acpi/acpica/uthex.c | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * Module Name: uthex -- Hex/ASCII support functions | ||
| 4 | * | ||
| 5 | *****************************************************************************/ | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Copyright (C) 2000 - 2014, 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 | #define _COMPONENT ACPI_COMPILER | ||
| 48 | ACPI_MODULE_NAME("uthex") | ||
| 49 | |||
| 50 | /* Hex to ASCII conversion table */ | ||
| 51 | static char acpi_gbl_hex_to_ascii[] = { | ||
| 52 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', | ||
| 53 | 'E', 'F' | ||
| 54 | }; | ||
| 55 | |||
| 56 | /******************************************************************************* | ||
| 57 | * | ||
| 58 | * FUNCTION: acpi_ut_hex_to_ascii_char | ||
| 59 | * | ||
| 60 | * PARAMETERS: integer - Contains the hex digit | ||
| 61 | * position - bit position of the digit within the | ||
| 62 | * integer (multiple of 4) | ||
| 63 | * | ||
| 64 | * RETURN: The converted Ascii character | ||
| 65 | * | ||
| 66 | * DESCRIPTION: Convert a hex digit to an Ascii character | ||
| 67 | * | ||
| 68 | ******************************************************************************/ | ||
| 69 | |||
| 70 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position) | ||
| 71 | { | ||
| 72 | |||
| 73 | return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); | ||
| 74 | } | ||
| 75 | |||
| 76 | /******************************************************************************* | ||
| 77 | * | ||
| 78 | * FUNCTION: acpi_ut_hex_char_to_value | ||
| 79 | * | ||
| 80 | * PARAMETERS: ascii_char - Hex character in Ascii | ||
| 81 | * | ||
| 82 | * RETURN: The binary value of the ascii/hex character | ||
| 83 | * | ||
| 84 | * DESCRIPTION: Perform ascii-to-hex translation | ||
| 85 | * | ||
| 86 | ******************************************************************************/ | ||
| 87 | |||
| 88 | u8 acpi_ut_ascii_char_to_hex(int hex_char) | ||
| 89 | { | ||
| 90 | |||
| 91 | if (hex_char <= 0x39) { | ||
| 92 | return ((u8)(hex_char - 0x30)); | ||
| 93 | } | ||
| 94 | |||
| 95 | if (hex_char <= 0x46) { | ||
| 96 | return ((u8)(hex_char - 0x37)); | ||
| 97 | } | ||
| 98 | |||
| 99 | return ((u8)(hex_char - 0x57)); | ||
| 100 | } | ||
diff --git a/drivers/acpi/acpica/utuuid.c b/drivers/acpi/acpica/utuuid.c new file mode 100644 index 000000000000..4dc33130f134 --- /dev/null +++ b/drivers/acpi/acpica/utuuid.c | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | /****************************************************************************** | ||
| 2 | * | ||
| 3 | * Module Name: utuuid -- UUID support functions | ||
| 4 | * | ||
| 5 | *****************************************************************************/ | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Copyright (C) 2000 - 2014, 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 | #define _COMPONENT ACPI_COMPILER | ||
| 48 | ACPI_MODULE_NAME("utuuid") | ||
| 49 | |||
| 50 | /* | ||
| 51 | * UUID support functions. | ||
| 52 | * | ||
| 53 | * This table is used to convert an input UUID ascii string to a 16 byte | ||
| 54 | * buffer and the reverse. The table maps a UUID buffer index 0-15 to | ||
| 55 | * the index within the 36-byte UUID string where the associated 2-byte | ||
| 56 | * hex value can be found. | ||
| 57 | * | ||
| 58 | * 36-byte UUID strings are of the form: | ||
| 59 | * aabbccdd-eeff-gghh-iijj-kkllmmnnoopp | ||
| 60 | * Where aa-pp are one byte hex numbers, made up of two hex digits | ||
| 61 | * | ||
| 62 | * Note: This table is basically the inverse of the string-to-offset table | ||
| 63 | * found in the ACPI spec in the description of the to_UUID macro. | ||
| 64 | */ | ||
| 65 | const u8 acpi_gbl_map_to_uuid_offset[UUID_BUFFER_LENGTH] = { | ||
| 66 | 6, 4, 2, 0, 11, 9, 16, 14, 19, 21, 24, 26, 28, 30, 32, 34 | ||
| 67 | }; | ||
| 68 | |||
| 69 | /******************************************************************************* | ||
| 70 | * | ||
| 71 | * FUNCTION: acpi_ut_convert_string_to_uuid | ||
| 72 | * | ||
| 73 | * PARAMETERS: in_string - 36-byte formatted UUID string | ||
| 74 | * uuid_buffer - Where the 16-byte UUID buffer is returned | ||
| 75 | * | ||
| 76 | * RETURN: None. Output data is returned in the uuid_buffer | ||
| 77 | * | ||
| 78 | * DESCRIPTION: Convert a 36-byte formatted UUID string to 16-byte UUID buffer | ||
| 79 | * | ||
| 80 | ******************************************************************************/ | ||
| 81 | |||
| 82 | void acpi_ut_convert_string_to_uuid(char *in_string, u8 *uuid_buffer) | ||
| 83 | { | ||
| 84 | u32 i; | ||
| 85 | |||
| 86 | for (i = 0; i < UUID_BUFFER_LENGTH; i++) { | ||
| 87 | uuid_buffer[i] = | ||
| 88 | (acpi_ut_ascii_char_to_hex | ||
| 89 | (in_string[acpi_gbl_map_to_uuid_offset[i]]) << 4); | ||
| 90 | |||
| 91 | uuid_buffer[i] |= | ||
| 92 | acpi_ut_ascii_char_to_hex(in_string | ||
| 93 | [acpi_gbl_map_to_uuid_offset[i] + | ||
| 94 | 1]); | ||
| 95 | } | ||
| 96 | } | ||
