aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utglobal.c
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2007-02-02 11:48:19 -0500
committerLen Brown <len.brown@intel.com>2007-02-02 21:14:23 -0500
commit84fb2c97731c1631c5548c15f3698ad82c274245 (patch)
tree278daeb9211489c9caefc13e8d6eb5d4bbd8d72f /drivers/acpi/utilities/utglobal.c
parent69874165ab953a62f9adb3096ccd84ed2561a602 (diff)
ACPICA: Split acpi_format_exception into two parts
Split acpi_format_exception into two parts. New function is acpi_ut_verify_exception and will be used to verify exception codes returned by user. Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utilities/utglobal.c')
-rw-r--r--drivers/acpi/utilities/utglobal.c118
1 files changed, 36 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 *