diff options
Diffstat (limited to 'drivers/acpi/tables/tbutils.c')
-rw-r--r-- | drivers/acpi/tables/tbutils.c | 97 |
1 files changed, 56 insertions, 41 deletions
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index fede5804c783..e69d01d443d2 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -49,48 +49,14 @@ | |||
49 | #define _COMPONENT ACPI_TABLES | 49 | #define _COMPONENT ACPI_TABLES |
50 | ACPI_MODULE_NAME ("tbutils") | 50 | ACPI_MODULE_NAME ("tbutils") |
51 | 51 | ||
52 | /* Local prototypes */ | ||
52 | 53 | ||
53 | /******************************************************************************* | 54 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
54 | * | ||
55 | * FUNCTION: acpi_tb_handle_to_object | ||
56 | * | ||
57 | * PARAMETERS: table_id - Id for which the function is searching | ||
58 | * table_desc - Pointer to return the matching table | ||
59 | * descriptor. | ||
60 | * | ||
61 | * RETURN: Search the tables to find one with a matching table_id and | ||
62 | * return a pointer to that table descriptor. | ||
63 | * | ||
64 | ******************************************************************************/ | ||
65 | #ifdef ACPI_FUTURE_USAGE | ||
66 | acpi_status | 55 | acpi_status |
67 | acpi_tb_handle_to_object ( | 56 | acpi_tb_handle_to_object ( |
68 | u16 table_id, | 57 | u16 table_id, |
69 | struct acpi_table_desc **return_table_desc) | 58 | struct acpi_table_desc **table_desc); |
70 | { | 59 | #endif |
71 | u32 i; | ||
72 | struct acpi_table_desc *table_desc; | ||
73 | |||
74 | |||
75 | ACPI_FUNCTION_NAME ("tb_handle_to_object"); | ||
76 | |||
77 | |||
78 | for (i = 0; i < ACPI_TABLE_MAX; i++) { | ||
79 | table_desc = acpi_gbl_table_lists[i].next; | ||
80 | while (table_desc) { | ||
81 | if (table_desc->table_id == table_id) { | ||
82 | *return_table_desc = table_desc; | ||
83 | return (AE_OK); | ||
84 | } | ||
85 | |||
86 | table_desc = table_desc->next; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id)); | ||
91 | return (AE_BAD_PARAMETER); | ||
92 | } | ||
93 | #endif /* ACPI_FUTURE_USAGE */ | ||
94 | 60 | ||
95 | 61 | ||
96 | /******************************************************************************* | 62 | /******************************************************************************* |
@@ -128,6 +94,7 @@ acpi_tb_validate_table_header ( | |||
128 | if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) { | 94 | if (!acpi_os_readable (table_header, sizeof (struct acpi_table_header))) { |
129 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | 95 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, |
130 | "Cannot read table header at %p\n", table_header)); | 96 | "Cannot read table header at %p\n", table_header)); |
97 | |||
131 | return (AE_BAD_ADDRESS); | 98 | return (AE_BAD_ADDRESS); |
132 | } | 99 | } |
133 | 100 | ||
@@ -141,6 +108,7 @@ acpi_tb_validate_table_header ( | |||
141 | 108 | ||
142 | ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", | 109 | ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n", |
143 | (char *) &signature)); | 110 | (char *) &signature)); |
111 | |||
144 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); | 112 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); |
145 | return (AE_BAD_SIGNATURE); | 113 | return (AE_BAD_SIGNATURE); |
146 | } | 114 | } |
@@ -154,6 +122,7 @@ acpi_tb_validate_table_header ( | |||
154 | 122 | ||
155 | ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", | 123 | ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n", |
156 | (u32) table_header->length)); | 124 | (u32) table_header->length)); |
125 | |||
157 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); | 126 | ACPI_DUMP_BUFFER (table_header, sizeof (struct acpi_table_header)); |
158 | return (AE_BAD_HEADER); | 127 | return (AE_BAD_HEADER); |
159 | } | 128 | } |
@@ -193,8 +162,10 @@ acpi_tb_verify_table_checksum ( | |||
193 | /* Return the appropriate exception */ | 162 | /* Return the appropriate exception */ |
194 | 163 | ||
195 | if (checksum) { | 164 | if (checksum) { |
196 | ACPI_REPORT_WARNING (("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", | 165 | ACPI_REPORT_WARNING (( |
197 | table_header->signature, (u32) table_header->checksum, (u32) checksum)); | 166 | "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", |
167 | table_header->signature, (u32) table_header->checksum, | ||
168 | (u32) checksum)); | ||
198 | 169 | ||
199 | status = AE_BAD_CHECKSUM; | 170 | status = AE_BAD_CHECKSUM; |
200 | } | 171 | } |
@@ -209,7 +180,7 @@ acpi_tb_verify_table_checksum ( | |||
209 | * PARAMETERS: Buffer - Buffer to checksum | 180 | * PARAMETERS: Buffer - Buffer to checksum |
210 | * Length - Size of the buffer | 181 | * Length - Size of the buffer |
211 | * | 182 | * |
212 | * RETURNS 8 bit checksum of buffer | 183 | * RETURN: 8 bit checksum of buffer |
213 | * | 184 | * |
214 | * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. | 185 | * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it. |
215 | * | 186 | * |
@@ -238,3 +209,47 @@ acpi_tb_checksum ( | |||
238 | } | 209 | } |
239 | 210 | ||
240 | 211 | ||
212 | #ifdef ACPI_OBSOLETE_FUNCTIONS | ||
213 | /******************************************************************************* | ||
214 | * | ||
215 | * FUNCTION: acpi_tb_handle_to_object | ||
216 | * | ||
217 | * PARAMETERS: table_id - Id for which the function is searching | ||
218 | * table_desc - Pointer to return the matching table | ||
219 | * descriptor. | ||
220 | * | ||
221 | * RETURN: Search the tables to find one with a matching table_id and | ||
222 | * return a pointer to that table descriptor. | ||
223 | * | ||
224 | ******************************************************************************/ | ||
225 | |||
226 | acpi_status | ||
227 | acpi_tb_handle_to_object ( | ||
228 | u16 table_id, | ||
229 | struct acpi_table_desc **return_table_desc) | ||
230 | { | ||
231 | u32 i; | ||
232 | struct acpi_table_desc *table_desc; | ||
233 | |||
234 | |||
235 | ACPI_FUNCTION_NAME ("tb_handle_to_object"); | ||
236 | |||
237 | |||
238 | for (i = 0; i < ACPI_TABLE_MAX; i++) { | ||
239 | table_desc = acpi_gbl_table_lists[i].next; | ||
240 | while (table_desc) { | ||
241 | if (table_desc->table_id == table_id) { | ||
242 | *return_table_desc = table_desc; | ||
243 | return (AE_OK); | ||
244 | } | ||
245 | |||
246 | table_desc = table_desc->next; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "table_id=%X does not exist\n", table_id)); | ||
251 | return (AE_BAD_PARAMETER); | ||
252 | } | ||
253 | #endif | ||
254 | |||
255 | |||