diff options
| -rw-r--r-- | drivers/acpi/acpica/Makefile | 1 | ||||
| -rw-r--r-- | drivers/acpi/acpica/acglobal.h | 8 | ||||
| -rw-r--r-- | drivers/acpi/acpica/utdecode.c | 35 | ||||
| -rw-r--r-- | drivers/acpi/acpica/utexcep.c | 153 | ||||
| -rw-r--r-- | drivers/acpi/acpica/utmisc.c | 69 | ||||
| -rw-r--r-- | include/acpi/acexcep.h | 5 |
6 files changed, 157 insertions, 114 deletions
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 793b8cc8e256..fa9a7d5afeb8 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
| @@ -140,6 +140,7 @@ acpi-y += \ | |||
| 140 | utaddress.o \ | 140 | utaddress.o \ |
| 141 | utalloc.o \ | 141 | utalloc.o \ |
| 142 | utcopy.o \ | 142 | utcopy.o \ |
| 143 | utexcep.o \ | ||
| 143 | utdebug.o \ | 144 | utdebug.o \ |
| 144 | utdecode.o \ | 145 | utdecode.o \ |
| 145 | utdelete.o \ | 146 | utdelete.o \ |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 92fab6a8114f..ce79100fb5eb 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
| @@ -326,14 +326,6 @@ extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; | |||
| 326 | 326 | ||
| 327 | #endif | 327 | #endif |
| 328 | 328 | ||
| 329 | /* Exception codes */ | ||
| 330 | |||
| 331 | extern char const *acpi_gbl_exception_names_env[]; | ||
| 332 | extern char const *acpi_gbl_exception_names_pgm[]; | ||
| 333 | extern char const *acpi_gbl_exception_names_tbl[]; | ||
| 334 | extern char const *acpi_gbl_exception_names_aml[]; | ||
| 335 | extern char const *acpi_gbl_exception_names_ctrl[]; | ||
| 336 | |||
| 337 | /***************************************************************************** | 329 | /***************************************************************************** |
| 338 | * | 330 | * |
| 339 | * Namespace globals | 331 | * Namespace globals |
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c index 684849949bf3..c8c130cc6560 100644 --- a/drivers/acpi/acpica/utdecode.c +++ b/drivers/acpi/acpica/utdecode.c | |||
| @@ -49,41 +49,6 @@ | |||
| 49 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
| 50 | ACPI_MODULE_NAME("utdecode") | 50 | ACPI_MODULE_NAME("utdecode") |
| 51 | 51 | ||
| 52 | /******************************************************************************* | ||
| 53 | * | ||
| 54 | * FUNCTION: acpi_format_exception | ||
| 55 | * | ||
| 56 | * PARAMETERS: Status - The acpi_status code to be formatted | ||
| 57 | * | ||
| 58 | * RETURN: A string containing the exception text. A valid pointer is | ||
| 59 | * always returned. | ||
| 60 | * | ||
| 61 | * DESCRIPTION: This function translates an ACPI exception into an ASCII string | ||
| 62 | * It is here instead of utxface.c so it is always present. | ||
| 63 | * | ||
| 64 | ******************************************************************************/ | ||
| 65 | const char *acpi_format_exception(acpi_status status) | ||
| 66 | { | ||
| 67 | const char *exception = NULL; | ||
| 68 | |||
| 69 | ACPI_FUNCTION_ENTRY(); | ||
| 70 | |||
| 71 | exception = acpi_ut_validate_exception(status); | ||
| 72 | if (!exception) { | ||
| 73 | |||
| 74 | /* Exception code was not recognized */ | ||
| 75 | |||
| 76 | ACPI_ERROR((AE_INFO, | ||
| 77 | "Unknown exception code: 0x%8.8X", status)); | ||
| 78 | |||
| 79 | exception = "UNKNOWN_STATUS_CODE"; | ||
| 80 | } | ||
| 81 | |||
| 82 | return (ACPI_CAST_PTR(const char, exception)); | ||
| 83 | } | ||
| 84 | |||
| 85 | ACPI_EXPORT_SYMBOL(acpi_format_exception) | ||
| 86 | |||
| 87 | /* | 52 | /* |
| 88 | * Properties of the ACPI Object Types, both internal and external. | 53 | * Properties of the ACPI Object Types, both internal and external. |
| 89 | * The table is indexed by values of acpi_object_type | 54 | * The table is indexed by values of acpi_object_type |
diff --git a/drivers/acpi/acpica/utexcep.c b/drivers/acpi/acpica/utexcep.c new file mode 100644 index 000000000000..23b98945f6b7 --- /dev/null +++ b/drivers/acpi/acpica/utexcep.c | |||
| @@ -0,0 +1,153 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * | ||
| 3 | * Module Name: utexcep - Exception code support | ||
| 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 | #define ACPI_DEFINE_EXCEPTION_TABLE | ||
| 45 | #include <linux/export.h> | ||
| 46 | #include <acpi/acpi.h> | ||
| 47 | #include "accommon.h" | ||
| 48 | |||
| 49 | #define _COMPONENT ACPI_UTILITIES | ||
| 50 | ACPI_MODULE_NAME("utexcep") | ||
| 51 | |||
| 52 | /******************************************************************************* | ||
| 53 | * | ||
| 54 | * FUNCTION: acpi_format_exception | ||
| 55 | * | ||
| 56 | * PARAMETERS: status - The acpi_status code to be formatted | ||
| 57 | * | ||
| 58 | * RETURN: A string containing the exception text. A valid pointer is | ||
| 59 | * always returned. | ||
| 60 | * | ||
| 61 | * DESCRIPTION: This function translates an ACPI exception into an ASCII | ||
| 62 | * string. Returns "unknown status" string for invalid codes. | ||
| 63 | * | ||
| 64 | ******************************************************************************/ | ||
| 65 | const char *acpi_format_exception(acpi_status status) | ||
| 66 | { | ||
| 67 | const char *exception = NULL; | ||
| 68 | |||
| 69 | ACPI_FUNCTION_ENTRY(); | ||
| 70 | |||
| 71 | exception = acpi_ut_validate_exception(status); | ||
| 72 | if (!exception) { | ||
| 73 | |||
| 74 | /* Exception code was not recognized */ | ||
| 75 | |||
| 76 | ACPI_ERROR((AE_INFO, | ||
| 77 | "Unknown exception code: 0x%8.8X", status)); | ||
| 78 | |||
| 79 | exception = "UNKNOWN_STATUS_CODE"; | ||
| 80 | } | ||
| 81 | |||
| 82 | return (ACPI_CAST_PTR(const char, exception)); | ||
| 83 | } | ||
| 84 | |||
| 85 | ACPI_EXPORT_SYMBOL(acpi_format_exception) | ||
| 86 | |||
| 87 | /******************************************************************************* | ||
| 88 | * | ||
| 89 | * FUNCTION: acpi_ut_validate_exception | ||
| 90 | * | ||
| 91 | * PARAMETERS: status - The acpi_status code to be formatted | ||
| 92 | * | ||
| 93 | * RETURN: A string containing the exception text. NULL if exception is | ||
| 94 | * not valid. | ||
| 95 | * | ||
| 96 | * DESCRIPTION: This function validates and translates an ACPI exception into | ||
| 97 | * an ASCII string. | ||
| 98 | * | ||
| 99 | ******************************************************************************/ | ||
| 100 | const char *acpi_ut_validate_exception(acpi_status status) | ||
| 101 | { | ||
| 102 | u32 sub_status; | ||
| 103 | const char *exception = NULL; | ||
| 104 | |||
| 105 | ACPI_FUNCTION_ENTRY(); | ||
| 106 | |||
| 107 | /* | ||
| 108 | * Status is composed of two parts, a "type" and an actual code | ||
| 109 | */ | ||
| 110 | sub_status = (status & ~AE_CODE_MASK); | ||
| 111 | |||
| 112 | switch (status & AE_CODE_MASK) { | ||
| 113 | case AE_CODE_ENVIRONMENTAL: | ||
| 114 | |||
| 115 | if (sub_status <= AE_CODE_ENV_MAX) { | ||
| 116 | exception = acpi_gbl_exception_names_env[sub_status]; | ||
| 117 | } | ||
| 118 | break; | ||
| 119 | |||
| 120 | case AE_CODE_PROGRAMMER: | ||
| 121 | |||
| 122 | if (sub_status <= AE_CODE_PGM_MAX) { | ||
| 123 | exception = acpi_gbl_exception_names_pgm[sub_status]; | ||
| 124 | } | ||
| 125 | break; | ||
| 126 | |||
| 127 | case AE_CODE_ACPI_TABLES: | ||
| 128 | |||
| 129 | if (sub_status <= AE_CODE_TBL_MAX) { | ||
| 130 | exception = acpi_gbl_exception_names_tbl[sub_status]; | ||
| 131 | } | ||
| 132 | break; | ||
| 133 | |||
| 134 | case AE_CODE_AML: | ||
| 135 | |||
| 136 | if (sub_status <= AE_CODE_AML_MAX) { | ||
| 137 | exception = acpi_gbl_exception_names_aml[sub_status]; | ||
| 138 | } | ||
| 139 | break; | ||
| 140 | |||
| 141 | case AE_CODE_CONTROL: | ||
| 142 | |||
| 143 | if (sub_status <= AE_CODE_CTRL_MAX) { | ||
| 144 | exception = acpi_gbl_exception_names_ctrl[sub_status]; | ||
| 145 | } | ||
| 146 | break; | ||
| 147 | |||
| 148 | default: | ||
| 149 | break; | ||
| 150 | } | ||
| 151 | |||
| 152 | return (ACPI_CAST_PTR(const char, exception)); | ||
| 153 | } | ||
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index 577a44e56909..e30c060b7bef 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c | |||
| @@ -82,75 +82,6 @@ void ut_convert_backslashes(char *pathname) | |||
| 82 | 82 | ||
| 83 | /******************************************************************************* | 83 | /******************************************************************************* |
| 84 | * | 84 | * |
| 85 | * FUNCTION: acpi_ut_validate_exception | ||
| 86 | * | ||
| 87 | * PARAMETERS: Status - The acpi_status code to be formatted | ||
| 88 | * | ||
| 89 | * RETURN: A string containing the exception text. NULL if exception is | ||
| 90 | * not valid. | ||
| 91 | * | ||
| 92 | * DESCRIPTION: This function validates and translates an ACPI exception into | ||
| 93 | * an ASCII string. | ||
| 94 | * | ||
| 95 | ******************************************************************************/ | ||
| 96 | |||
| 97 | const char *acpi_ut_validate_exception(acpi_status status) | ||
| 98 | { | ||
| 99 | u32 sub_status; | ||
| 100 | const char *exception = NULL; | ||
| 101 | |||
| 102 | ACPI_FUNCTION_ENTRY(); | ||
| 103 | |||
| 104 | /* | ||
| 105 | * Status is composed of two parts, a "type" and an actual code | ||
| 106 | */ | ||
| 107 | sub_status = (status & ~AE_CODE_MASK); | ||
| 108 | |||
| 109 | switch (status & AE_CODE_MASK) { | ||
| 110 | case AE_CODE_ENVIRONMENTAL: | ||
| 111 | |||
| 112 | if (sub_status <= AE_CODE_ENV_MAX) { | ||
| 113 | exception = acpi_gbl_exception_names_env[sub_status]; | ||
| 114 | } | ||
| 115 | break; | ||
| 116 | |||
| 117 | case AE_CODE_PROGRAMMER: | ||
| 118 | |||
| 119 | if (sub_status <= AE_CODE_PGM_MAX) { | ||
| 120 | exception = acpi_gbl_exception_names_pgm[sub_status]; | ||
| 121 | } | ||
| 122 | break; | ||
| 123 | |||
| 124 | case AE_CODE_ACPI_TABLES: | ||
| 125 | |||
| 126 | if (sub_status <= AE_CODE_TBL_MAX) { | ||
| 127 | exception = acpi_gbl_exception_names_tbl[sub_status]; | ||
| 128 | } | ||
| 129 | break; | ||
| 130 | |||
| 131 | case AE_CODE_AML: | ||
| 132 | |||
| 133 | if (sub_status <= AE_CODE_AML_MAX) { | ||
| 134 | exception = acpi_gbl_exception_names_aml[sub_status]; | ||
| 135 | } | ||
| 136 | break; | ||
| 137 | |||
| 138 | case AE_CODE_CONTROL: | ||
| 139 | |||
| 140 | if (sub_status <= AE_CODE_CTRL_MAX) { | ||
| 141 | exception = acpi_gbl_exception_names_ctrl[sub_status]; | ||
| 142 | } | ||
| 143 | break; | ||
| 144 | |||
| 145 | default: | ||
| 146 | break; | ||
| 147 | } | ||
| 148 | |||
| 149 | return (ACPI_CAST_PTR(const char, exception)); | ||
| 150 | } | ||
| 151 | |||
| 152 | /******************************************************************************* | ||
| 153 | * | ||
| 154 | * FUNCTION: acpi_ut_is_pci_root_bridge | 85 | * FUNCTION: acpi_ut_is_pci_root_bridge |
| 155 | * | 86 | * |
| 156 | * PARAMETERS: Id - The HID/CID in string format | 87 | * PARAMETERS: Id - The HID/CID in string format |
diff --git a/include/acpi/acexcep.h b/include/acpi/acexcep.h index 92d6e1d701ff..0b5dcb613d31 100644 --- a/include/acpi/acexcep.h +++ b/include/acpi/acexcep.h | |||
| @@ -52,6 +52,7 @@ | |||
| 52 | #define AE_CODE_ACPI_TABLES 0x2000 | 52 | #define AE_CODE_ACPI_TABLES 0x2000 |
| 53 | #define AE_CODE_AML 0x3000 | 53 | #define AE_CODE_AML 0x3000 |
| 54 | #define AE_CODE_CONTROL 0x4000 | 54 | #define AE_CODE_CONTROL 0x4000 |
| 55 | #define AE_CODE_MAX 0x4000 | ||
| 55 | #define AE_CODE_MASK 0xF000 | 56 | #define AE_CODE_MASK 0xF000 |
| 56 | 57 | ||
| 57 | #define ACPI_SUCCESS(a) (!(a)) | 58 | #define ACPI_SUCCESS(a) (!(a)) |
| @@ -181,7 +182,7 @@ | |||
| 181 | 182 | ||
| 182 | /* Exception strings for acpi_format_exception */ | 183 | /* Exception strings for acpi_format_exception */ |
| 183 | 184 | ||
| 184 | #ifdef DEFINE_ACPI_GLOBALS | 185 | #ifdef ACPI_DEFINE_EXCEPTION_TABLE |
| 185 | 186 | ||
| 186 | /* | 187 | /* |
| 187 | * String versions of the exception codes above | 188 | * String versions of the exception codes above |
| @@ -295,6 +296,6 @@ char const *acpi_gbl_exception_names_ctrl[] = { | |||
| 295 | "AE_CTRL_PARSE_PENDING" | 296 | "AE_CTRL_PARSE_PENDING" |
| 296 | }; | 297 | }; |
| 297 | 298 | ||
| 298 | #endif /* ACPI GLOBALS */ | 299 | #endif /* EXCEPTION_TABLE */ |
| 299 | 300 | ||
| 300 | #endif /* __ACEXCEP_H__ */ | 301 | #endif /* __ACEXCEP_H__ */ |
