diff options
author | Bob Moore <robert.moore@intel.com> | 2007-02-02 11:48:19 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-02-02 21:14:23 -0500 |
commit | 84fb2c97731c1631c5548c15f3698ad82c274245 (patch) | |
tree | 278daeb9211489c9caefc13e8d6eb5d4bbd8d72f /drivers/acpi/utilities/utmisc.c | |
parent | 69874165ab953a62f9adb3096ccd84ed2561a602 (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/utmisc.c')
-rw-r--r-- | drivers/acpi/utilities/utmisc.c | 73 |
1 files changed, 73 insertions, 0 deletions
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 | ******************************************************************************/ | ||
65 | const 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 | |||
65 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table) | 138 | u8 acpi_ut_is_aml_table(struct acpi_table_header *table) |
66 | { | 139 | { |
67 | 140 | ||