diff options
Diffstat (limited to 'drivers/acpi/tables.c')
-rw-r--r-- | drivers/acpi/tables.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index 991c006a301b..646d39c031ca 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -211,14 +211,15 @@ acpi_table_parse_entries(char *id, | |||
211 | struct acpi_subtable_header *entry; | 211 | struct acpi_subtable_header *entry; |
212 | unsigned int count = 0; | 212 | unsigned int count = 0; |
213 | unsigned long table_end; | 213 | unsigned long table_end; |
214 | acpi_size tbl_size; | ||
214 | 215 | ||
215 | if (!handler) | 216 | if (!handler) |
216 | return -EINVAL; | 217 | return -EINVAL; |
217 | 218 | ||
218 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) | 219 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) |
219 | acpi_get_table(id, acpi_apic_instance, &table_header); | 220 | acpi_get_table_with_size(id, acpi_apic_instance, &table_header, &tbl_size); |
220 | else | 221 | else |
221 | acpi_get_table(id, 0, &table_header); | 222 | acpi_get_table_with_size(id, 0, &table_header, &tbl_size); |
222 | 223 | ||
223 | if (!table_header) { | 224 | if (!table_header) { |
224 | printk(KERN_WARNING PREFIX "%4.4s not present\n", id); | 225 | printk(KERN_WARNING PREFIX "%4.4s not present\n", id); |
@@ -236,8 +237,10 @@ acpi_table_parse_entries(char *id, | |||
236 | table_end) { | 237 | table_end) { |
237 | if (entry->type == entry_id | 238 | if (entry->type == entry_id |
238 | && (!max_entries || count++ < max_entries)) | 239 | && (!max_entries || count++ < max_entries)) |
239 | if (handler(entry, table_end)) | 240 | if (handler(entry, table_end)) { |
241 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); | ||
240 | return -EINVAL; | 242 | return -EINVAL; |
243 | } | ||
241 | 244 | ||
242 | entry = (struct acpi_subtable_header *) | 245 | entry = (struct acpi_subtable_header *) |
243 | ((unsigned long)entry + entry->length); | 246 | ((unsigned long)entry + entry->length); |
@@ -247,6 +250,7 @@ acpi_table_parse_entries(char *id, | |||
247 | "%i found\n", id, entry_id, count - max_entries, count); | 250 | "%i found\n", id, entry_id, count - max_entries, count); |
248 | } | 251 | } |
249 | 252 | ||
253 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); | ||
250 | return count; | 254 | return count; |
251 | } | 255 | } |
252 | 256 | ||
@@ -271,17 +275,19 @@ acpi_table_parse_madt(enum acpi_madt_type id, | |||
271 | int __init acpi_table_parse(char *id, acpi_table_handler handler) | 275 | int __init acpi_table_parse(char *id, acpi_table_handler handler) |
272 | { | 276 | { |
273 | struct acpi_table_header *table = NULL; | 277 | struct acpi_table_header *table = NULL; |
278 | acpi_size tbl_size; | ||
274 | 279 | ||
275 | if (!handler) | 280 | if (!handler) |
276 | return -EINVAL; | 281 | return -EINVAL; |
277 | 282 | ||
278 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) | 283 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) |
279 | acpi_get_table(id, acpi_apic_instance, &table); | 284 | acpi_get_table_with_size(id, acpi_apic_instance, &table, &tbl_size); |
280 | else | 285 | else |
281 | acpi_get_table(id, 0, &table); | 286 | acpi_get_table_with_size(id, 0, &table, &tbl_size); |
282 | 287 | ||
283 | if (table) { | 288 | if (table) { |
284 | handler(table); | 289 | handler(table); |
290 | early_acpi_os_unmap_memory(table, tbl_size); | ||
285 | return 0; | 291 | return 0; |
286 | } else | 292 | } else |
287 | return 1; | 293 | return 1; |
@@ -295,8 +301,9 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler) | |||
295 | static void __init check_multiple_madt(void) | 301 | static void __init check_multiple_madt(void) |
296 | { | 302 | { |
297 | struct acpi_table_header *table = NULL; | 303 | struct acpi_table_header *table = NULL; |
304 | acpi_size tbl_size; | ||
298 | 305 | ||
299 | acpi_get_table(ACPI_SIG_MADT, 2, &table); | 306 | acpi_get_table_with_size(ACPI_SIG_MADT, 2, &table, &tbl_size); |
300 | if (table) { | 307 | if (table) { |
301 | printk(KERN_WARNING PREFIX | 308 | printk(KERN_WARNING PREFIX |
302 | "BIOS bug: multiple APIC/MADT found," | 309 | "BIOS bug: multiple APIC/MADT found," |
@@ -305,6 +312,7 @@ static void __init check_multiple_madt(void) | |||
305 | "If \"acpi_apic_instance=%d\" works better, " | 312 | "If \"acpi_apic_instance=%d\" works better, " |
306 | "notify linux-acpi@vger.kernel.org\n", | 313 | "notify linux-acpi@vger.kernel.org\n", |
307 | acpi_apic_instance ? 0 : 2); | 314 | acpi_apic_instance ? 0 : 2); |
315 | early_acpi_os_unmap_memory(table, tbl_size); | ||
308 | 316 | ||
309 | } else | 317 | } else |
310 | acpi_apic_instance = 0; | 318 | acpi_apic_instance = 0; |