diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-02-07 01:47:12 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-07 01:47:12 -0500 |
commit | 3c9b3a8575b4f2551e3b5b74ffa1c3559c6338eb (patch) | |
tree | 7f8d84353852401ec74e005f6f0b1eb958b9a70d /drivers/acpi/tables/tbutils.c | |
parent | c0d3c0c0ce94d3db893577ae98e64414d92e49d8 (diff) | |
parent | c03296a868ae7c91aa2d8b372184763b18f16d7a (diff) |
Merge branch 'master'
Diffstat (limited to 'drivers/acpi/tables/tbutils.c')
-rw-r--r-- | drivers/acpi/tables/tbutils.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 4b2fbb592f49..bc571592f087 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_ERROR((AE_INFO, |
154 | "Cannot read table header at %p\n", | 153 | "Cannot read table header at %p", table_header)); |
155 | table_header)); | ||
156 | 154 | ||
157 | return (AE_BAD_ADDRESS); | 155 | return (AE_BAD_ADDRESS); |
158 | } | 156 | } |
@@ -161,12 +159,12 @@ 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_ERROR((AE_INFO, |
165 | "Table signature at %p [%p] has invalid characters\n", | 163 | "Table signature at %p [%p] has invalid characters", |
166 | table_header, &signature)); | 164 | table_header, &signature)); |
167 | 165 | ||
168 | ACPI_REPORT_WARNING(("Invalid table signature found: [%4.4s]\n", | 166 | ACPI_WARNING((AE_INFO, "Invalid table signature found: [%4.4s]", |
169 | (char *)&signature)); | 167 | ACPI_CAST_PTR(char, &signature))); |
170 | 168 | ||
171 | ACPI_DUMP_BUFFER(table_header, | 169 | ACPI_DUMP_BUFFER(table_header, |
172 | sizeof(struct acpi_table_header)); | 170 | sizeof(struct acpi_table_header)); |
@@ -176,11 +174,13 @@ acpi_tb_validate_table_header(struct acpi_table_header *table_header) | |||
176 | /* Validate the table length */ | 174 | /* Validate the table length */ |
177 | 175 | ||
178 | if (table_header->length < sizeof(struct acpi_table_header)) { | 176 | if (table_header->length < sizeof(struct acpi_table_header)) { |
179 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 177 | ACPI_ERROR((AE_INFO, |
180 | "Invalid length in table header %p name %4.4s\n", | 178 | "Invalid length in table header %p name %4.4s", |
181 | table_header, (char *)&signature)); | 179 | table_header, (char *)&signature)); |
182 | 180 | ||
183 | ACPI_REPORT_WARNING(("Invalid table header length (0x%X) found\n", (u32) table_header->length)); | 181 | ACPI_WARNING((AE_INFO, |
182 | "Invalid table header length (0x%X) found", | ||
183 | (u32) table_header->length)); | ||
184 | 184 | ||
185 | ACPI_DUMP_BUFFER(table_header, | 185 | ACPI_DUMP_BUFFER(table_header, |
186 | sizeof(struct acpi_table_header)); | 186 | sizeof(struct acpi_table_header)); |
@@ -219,7 +219,10 @@ acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) | |||
219 | /* Return the appropriate exception */ | 219 | /* Return the appropriate exception */ |
220 | 220 | ||
221 | if (checksum) { | 221 | if (checksum) { |
222 | ACPI_REPORT_WARNING(("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n", table_header->signature, (u32) table_header->checksum, (u32) checksum)); | 222 | ACPI_WARNING((AE_INFO, |
223 | "Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)", | ||
224 | table_header->signature, | ||
225 | (u32) table_header->checksum, (u32) checksum)); | ||
223 | 226 | ||
224 | status = AE_BAD_CHECKSUM; | 227 | status = AE_BAD_CHECKSUM; |
225 | } | 228 | } |
@@ -241,16 +244,16 @@ acpi_tb_verify_table_checksum(struct acpi_table_header * table_header) | |||
241 | 244 | ||
242 | u8 acpi_tb_generate_checksum(void *buffer, u32 length) | 245 | u8 acpi_tb_generate_checksum(void *buffer, u32 length) |
243 | { | 246 | { |
244 | const u8 *limit; | 247 | u8 *end_buffer; |
245 | const u8 *rover; | 248 | u8 *rover; |
246 | u8 sum = 0; | 249 | u8 sum = 0; |
247 | 250 | ||
248 | if (buffer && length) { | 251 | if (buffer && length) { |
249 | /* Buffer and Length are valid */ | 252 | /* Buffer and Length are valid */ |
250 | 253 | ||
251 | limit = (u8 *) buffer + length; | 254 | end_buffer = ACPI_ADD_PTR(u8, buffer, length); |
252 | 255 | ||
253 | for (rover = buffer; rover < limit; rover++) { | 256 | for (rover = buffer; rover < end_buffer; rover++) { |
254 | sum = (u8) (sum + *rover); | 257 | sum = (u8) (sum + *rover); |
255 | } | 258 | } |
256 | } | 259 | } |
@@ -292,8 +295,7 @@ acpi_tb_handle_to_object(u16 table_id, | |||
292 | } | 295 | } |
293 | } | 296 | } |
294 | 297 | ||
295 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "table_id=%X does not exist\n", | 298 | ACPI_ERROR((AE_INFO, "table_id=%X does not exist", table_id)); |
296 | table_id)); | ||
297 | return (AE_BAD_PARAMETER); | 299 | return (AE_BAD_PARAMETER); |
298 | } | 300 | } |
299 | #endif | 301 | #endif |