0001
0002
0003
0004
0005
0006
0007
0008 #define EXPORT_ACPI_INTERFACES
0009
0010 #define ACPI_DEFINE_EXCEPTION_TABLE
0011 #include <acpi/acpi.h>
0012 #include "accommon.h"
0013
0014 #define _COMPONENT ACPI_UTILITIES
0015 ACPI_MODULE_NAME("utexcep")
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 const char *acpi_format_exception(acpi_status status)
0031 {
0032 const struct acpi_exception_info *exception;
0033
0034 ACPI_FUNCTION_ENTRY();
0035
0036 exception = acpi_ut_validate_exception(status);
0037 if (!exception) {
0038
0039
0040
0041 ACPI_ERROR((AE_INFO,
0042 "Unknown exception code: 0x%8.8X", status));
0043
0044 return ("UNKNOWN_STATUS_CODE");
0045 }
0046
0047 return (exception->name);
0048 }
0049
0050 ACPI_EXPORT_SYMBOL(acpi_format_exception)
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 const struct acpi_exception_info *acpi_ut_validate_exception(acpi_status status)
0066 {
0067 u32 sub_status;
0068 const struct acpi_exception_info *exception = NULL;
0069
0070 ACPI_FUNCTION_ENTRY();
0071
0072
0073
0074
0075 sub_status = (status & ~AE_CODE_MASK);
0076
0077 switch (status & AE_CODE_MASK) {
0078 case AE_CODE_ENVIRONMENTAL:
0079
0080 if (sub_status <= AE_CODE_ENV_MAX) {
0081 exception = &acpi_gbl_exception_names_env[sub_status];
0082 }
0083 break;
0084
0085 case AE_CODE_PROGRAMMER:
0086
0087 if (sub_status <= AE_CODE_PGM_MAX) {
0088 exception = &acpi_gbl_exception_names_pgm[sub_status];
0089 }
0090 break;
0091
0092 case AE_CODE_ACPI_TABLES:
0093
0094 if (sub_status <= AE_CODE_TBL_MAX) {
0095 exception = &acpi_gbl_exception_names_tbl[sub_status];
0096 }
0097 break;
0098
0099 case AE_CODE_AML:
0100
0101 if (sub_status <= AE_CODE_AML_MAX) {
0102 exception = &acpi_gbl_exception_names_aml[sub_status];
0103 }
0104 break;
0105
0106 case AE_CODE_CONTROL:
0107
0108 if (sub_status <= AE_CODE_CTRL_MAX) {
0109 exception = &acpi_gbl_exception_names_ctrl[sub_status];
0110 }
0111 break;
0112
0113 default:
0114
0115 break;
0116 }
0117
0118 if (!exception || !exception->name) {
0119 return (NULL);
0120 }
0121
0122 return (exception);
0123 }