aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/utilities/utglobal.c118
-rw-r--r--drivers/acpi/utilities/utmisc.c73
-rw-r--r--include/acpi/acglobal.h8
-rw-r--r--include/acpi/acutils.h2
4 files changed, 119 insertions, 82 deletions
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 5b83f86470d7..509a85d6b01f 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -52,87 +52,6 @@ ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
52 52
53/******************************************************************************* 53/*******************************************************************************
54 * 54 *
55 * FUNCTION: acpi_format_exception
56 *
57 * PARAMETERS: Status - The acpi_status code to be formatted
58 *
59 * RETURN: A string containing the exception text. A valid pointer is
60 * always returned.
61 *
62 * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
63 *
64 ******************************************************************************/
65const char *acpi_format_exception(acpi_status status)
66{
67 acpi_status sub_status;
68 const char *exception = NULL;
69
70 ACPI_FUNCTION_ENTRY();
71
72 /*
73 * Status is composed of two parts, a "type" and an actual code
74 */
75 sub_status = (status & ~AE_CODE_MASK);
76
77 switch (status & AE_CODE_MASK) {
78 case AE_CODE_ENVIRONMENTAL:
79
80 if (sub_status <= AE_CODE_ENV_MAX) {
81 exception = acpi_gbl_exception_names_env[sub_status];
82 }
83 break;
84
85 case AE_CODE_PROGRAMMER:
86
87 if (sub_status <= AE_CODE_PGM_MAX) {
88 exception =
89 acpi_gbl_exception_names_pgm[sub_status - 1];
90 }
91 break;
92
93 case AE_CODE_ACPI_TABLES:
94
95 if (sub_status <= AE_CODE_TBL_MAX) {
96 exception =
97 acpi_gbl_exception_names_tbl[sub_status - 1];
98 }
99 break;
100
101 case AE_CODE_AML:
102
103 if (sub_status <= AE_CODE_AML_MAX) {
104 exception =
105 acpi_gbl_exception_names_aml[sub_status - 1];
106 }
107 break;
108
109 case AE_CODE_CONTROL:
110
111 if (sub_status <= AE_CODE_CTRL_MAX) {
112 exception =
113 acpi_gbl_exception_names_ctrl[sub_status - 1];
114 }
115 break;
116
117 default:
118 break;
119 }
120
121 if (!exception) {
122
123 /* Exception code was not recognized */
124
125 ACPI_ERROR((AE_INFO,
126 "Unknown exception code: 0x%8.8X", status));
127
128 exception = "UNKNOWN_STATUS_CODE";
129 }
130
131 return (ACPI_CAST_PTR(const char, exception));
132}
133
134/*******************************************************************************
135 *
136 * Static global variable initialization. 55 * Static global variable initialization.
137 * 56 *
138 ******************************************************************************/ 57 ******************************************************************************/
@@ -182,10 +101,45 @@ const char *acpi_gbl_highest_dstate_names[4] = {
182 101
183/******************************************************************************* 102/*******************************************************************************
184 * 103 *
185 * Namespace globals 104 * FUNCTION: acpi_format_exception
105 *
106 * PARAMETERS: Status - The acpi_status code to be formatted
107 *
108 * RETURN: A string containing the exception text. A valid pointer is
109 * always returned.
110 *
111 * DESCRIPTION: This function translates an ACPI exception into an ASCII string
112 * It is here instead of utxface.c so it is always present.
186 * 113 *
187 ******************************************************************************/ 114 ******************************************************************************/
188 115
116const char *acpi_format_exception(acpi_status status)
117{
118 const char *exception = NULL;
119
120 ACPI_FUNCTION_ENTRY();
121
122 exception = acpi_ut_validate_exception(status);
123 if (!exception) {
124
125 /* Exception code was not recognized */
126
127 ACPI_ERROR((AE_INFO,
128 "Unknown exception code: 0x%8.8X", status));
129
130 exception = "UNKNOWN_STATUS_CODE";
131 }
132
133 return (ACPI_CAST_PTR(const char, exception));
134}
135
136ACPI_EXPORT_SYMBOL(acpi_format_exception)
137
138/*******************************************************************************
139 *
140 * Namespace globals
141 *
142 ******************************************************************************/
189/* 143/*
190 * Predefined ACPI Names (Built-in to the Interpreter) 144 * Predefined ACPI Names (Built-in to the Interpreter)
191 * 145 *
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index 36d88158f9f4..e437bc703928 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -51,6 +51,78 @@ ACPI_MODULE_NAME("utmisc")
51 51
52/******************************************************************************* 52/*******************************************************************************
53 * 53 *
54 * FUNCTION: acpi_ut_validate_exception
55 *
56 * PARAMETERS: Status - The acpi_status code to be formatted
57 *
58 * RETURN: A string containing the exception text. NULL if exception is
59 * not valid.
60 *
61 * DESCRIPTION: This function validates and translates an ACPI exception into
62 * an ASCII string.
63 *
64 ******************************************************************************/
65const char *acpi_ut_validate_exception(acpi_status status)
66{
67 acpi_status sub_status;
68 const char *exception = NULL;
69
70 ACPI_FUNCTION_ENTRY();
71
72 /*
73 * Status is composed of two parts, a "type" and an actual code
74 */
75 sub_status = (status & ~AE_CODE_MASK);
76
77 switch (status & AE_CODE_MASK) {
78 case AE_CODE_ENVIRONMENTAL:
79
80 if (sub_status <= AE_CODE_ENV_MAX) {
81 exception = acpi_gbl_exception_names_env[sub_status];
82 }
83 break;
84
85 case AE_CODE_PROGRAMMER:
86
87 if (sub_status <= AE_CODE_PGM_MAX) {
88 exception =
89 acpi_gbl_exception_names_pgm[sub_status - 1];
90 }
91 break;
92
93 case AE_CODE_ACPI_TABLES:
94
95 if (sub_status <= AE_CODE_TBL_MAX) {
96 exception =
97 acpi_gbl_exception_names_tbl[sub_status - 1];
98 }
99 break;
100
101 case AE_CODE_AML:
102
103 if (sub_status <= AE_CODE_AML_MAX) {
104 exception =
105 acpi_gbl_exception_names_aml[sub_status - 1];
106 }
107 break;
108
109 case AE_CODE_CONTROL:
110
111 if (sub_status <= AE_CODE_CTRL_MAX) {
112 exception =
113 acpi_gbl_exception_names_ctrl[sub_status - 1];
114 }
115 break;
116
117 default:
118 break;
119 }
120
121 return (ACPI_CAST_PTR(const char, exception));
122}
123
124/*******************************************************************************
125 *
54 * FUNCTION: acpi_ut_is_aml_table 126 * FUNCTION: acpi_ut_is_aml_table
55 * 127 *
56 * PARAMETERS: Table - An ACPI table 128 * PARAMETERS: Table - An ACPI table
@@ -62,6 +134,7 @@ ACPI_MODULE_NAME("utmisc")
62 * data tables that do not contain AML code. 134 * data tables that do not contain AML code.
63 * 135 *
64 ******************************************************************************/ 136 ******************************************************************************/
137
65u8 acpi_ut_is_aml_table(struct acpi_table_header *table) 138u8 acpi_ut_is_aml_table(struct acpi_table_header *table)
66{ 139{
67 140
diff --git a/include/acpi/acglobal.h b/include/acpi/acglobal.h
index 0c2e1ae72c3d..8dab29a02e3c 100644
--- a/include/acpi/acglobal.h
+++ b/include/acpi/acglobal.h
@@ -245,6 +245,14 @@ extern const char *acpi_gbl_highest_dstate_names[4];
245extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES]; 245extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
246extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS]; 246extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
247 247
248/* Exception codes */
249
250extern char const *acpi_gbl_exception_names_env[];
251extern char const *acpi_gbl_exception_names_pgm[];
252extern char const *acpi_gbl_exception_names_tbl[];
253extern char const *acpi_gbl_exception_names_aml[];
254extern char const *acpi_gbl_exception_names_ctrl[];
255
248/***************************************************************************** 256/*****************************************************************************
249 * 257 *
250 * Namespace globals 258 * Namespace globals
diff --git a/include/acpi/acutils.h b/include/acpi/acutils.h
index beb07ac83b8a..3c66f54e1fd7 100644
--- a/include/acpi/acutils.h
+++ b/include/acpi/acutils.h
@@ -453,6 +453,8 @@ acpi_ut_short_divide(acpi_integer in_dividend,
453/* 453/*
454 * utmisc 454 * utmisc
455 */ 455 */
456const char *acpi_ut_validate_exception(acpi_status status);
457
456u8 acpi_ut_is_aml_table(struct acpi_table_header *table); 458u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
457 459
458acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id); 460acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);