diff options
Diffstat (limited to 'drivers/acpi/tables/tbutils.c')
-rw-r--r-- | drivers/acpi/tables/tbutils.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 4b2fbb592f49..38c6749e43d5 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -5,7 +5,7 @@ | |||
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | 8 | * Copyright (C) 2000 - 2006, R. Byron Moore |
9 | * All rights reserved. | 9 | * All rights reserved. |
10 | * | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without |
@@ -94,9 +94,8 @@ acpi_status acpi_tb_is_table_installed(struct acpi_table_desc *new_table_desc) | |||
94 | new_table_desc->pointer->length) | 94 | new_table_desc->pointer->length) |
95 | && | 95 | && |
96 | (!ACPI_MEMCMP | 96 | (!ACPI_MEMCMP |
97 | ((const char *)table_desc->pointer, | 97 | (table_desc->pointer, new_table_desc->pointer, |
98 | (const char *)new_table_desc->pointer, | 98 | new_table_desc->pointer->length))) { |
99 | (acpi_size) new_table_desc->pointer->length))) { | ||
100 | /* Match: this table is already installed */ | 99 | /* Match: this table is already installed */ |
101 | 100 | ||
102 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, | 101 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
@@ -145,14 +144,13 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
145 | { | 144 | { |
146 | acpi_name signature; | 145 | acpi_name signature; |
147 | 146 | ||
148 | ACPI_FUNCTION_NAME("tb_validate_table_header"); | 147 | ACPI_FUNCTION_ENTRY(); |
149 | 148 | ||
150 | /* Verify that this is a valid address */ | 149 | /* Verify that this is a valid address */ |
151 | 150 | ||
152 | if (!acpi_os_readable(table_header, sizeof(struct acpi_table_header))) { | 151 | if (!acpi_os_readable(table_header, sizeof(struct acpi_table_header))) { |
153 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 152 | ACPI_REPORT_ERROR(("Cannot read table header at %p\n", |
154 | "Cannot read table header at %p\n", | 153 | table_header)); |
155 | table_header)); | ||
156 | 154 | ||
157 | return (AE_BAD_ADDRESS); | 155 | return (AE_BAD_ADDRESS); |
158 | } | 156 | } |
@@ -161,12 +159,10 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
161 | 159 | ||
162 | ACPI_MOVE_32_TO_32(&signature, table_header->signature); | 160 | ACPI_MOVE_32_TO_32(&signature, table_header->signature); |
163 | if (!acpi_ut_valid_acpi_name(signature)) { | 161 | if (!acpi_ut_valid_acpi_name(signature)) { |
164 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 162 | ACPI_REPORT_ERROR(("Table signature at %p [%p] has invalid characters\n", table_header, &signature)); |
165 | "Table signature at %p [%p] has invalid characters\n", | ||
166 | table_header, &signature)); | ||
167 | 163 | ||
168 | ACPI_REPORT_WARNING(("Invalid table signature found: [%4.4s]\n", | 164 | ACPI_REPORT_WARNING(("Invalid table signature found: [%4.4s]\n", |
169 | (char *)&signature)); | 165 | ACPI_CAST_PTR(char, &signature))); |
170 | 166 | ||
171 | ACPI_DUMP_BUFFER(table_header, | 167 | ACPI_DUMP_BUFFER(table_header, |
172 | sizeof(struct acpi_table_header)); | 168 | sizeof(struct acpi_table_header)); |
@@ -176,9 +172,7 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
176 | /* Validate the table length */ | 172 | /* Validate the table length */ |
177 | 173 | ||
178 | if (table_header->length < sizeof(struct acpi_table_header)) { | 174 | if (table_header->length < sizeof(struct acpi_table_header)) { |
179 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 175 | ACPI_REPORT_ERROR(("Invalid length in table header %p name %4.4s\n", table_header, (char *)&signature)); |
180 | "Invalid length in table header %p name %4.4s\n", | ||
181 | table_header, (char *)&signature)); | ||
182 | 176 | ||
183 | ACPI_REPORT_WARNING(("Invalid table header length (0x%X) found\n", (u32) table_header->length)); | 177 | ACPI_REPORT_WARNING(("Invalid table header length (0x%X) found\n", (u32) table_header->length)); |
184 | 178 | ||
@@ -241,16 +235,16 @@ acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) | |||
241 | 235 | ||
242 | u8 acpi_tb_generate_checksum(void *buffer, u32 length) | 236 | u8 acpi_tb_generate_checksum(void *buffer, u32 length) |
243 | { | 237 | { |
244 | const u8 *limit; | 238 | u8 *end_buffer; |
245 | const u8 *rover; | 239 | u8 *rover; |
246 | u8 sum = 0; | 240 | u8 sum = 0; |
247 | 241 | ||
248 | if (buffer && length) { | 242 | if (buffer && length) { |
249 | /* Buffer and Length are valid */ | 243 | /* Buffer and Length are valid */ |
250 | 244 | ||
251 | limit = (u8 *) buffer + length; | 245 | end_buffer = ACPI_ADD_PTR(u8, buffer, length); |
252 | 246 | ||
253 | for (rover = buffer; rover < limit; rover++) { | 247 | for (rover = buffer; rover < end_buffer; rover++) { |
254 | sum = (u8) (sum + *rover); | 248 | sum = (u8) (sum + *rover); |
255 | } | 249 | } |
256 | } | 250 | } |
@@ -292,8 +286,7 @@ acpi_tb_handle_to_object(u16 table_id, | |||
292 | } | 286 | } |
293 | } | 287 | } |
294 | 288 | ||
295 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "table_id=%X does not exist\n", | 289 | ACPI_REPORT_ERROR(("table_id=%X does not exist\n", table_id)); |
296 | table_id)); | ||
297 | return (AE_BAD_PARAMETER); | 290 | return (AE_BAD_PARAMETER); |
298 | } | 291 | } |
299 | #endif | 292 | #endif |