diff options
-rw-r--r-- | arch/ia64/kernel/acpi.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 17 | ||||
-rw-r--r-- | drivers/acpi/acpica/tbxface.c | 17 | ||||
-rw-r--r-- | drivers/acpi/bus.c | 6 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 11 | ||||
-rw-r--r-- | drivers/acpi/tables.c | 20 | ||||
-rw-r--r-- | include/acpi/acpiosxf.h | 1 | ||||
-rw-r--r-- | include/acpi/acpixf.h | 4 | ||||
-rw-r--r-- | include/linux/acpi.h | 1 |
9 files changed, 54 insertions, 27 deletions
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c index d541671caf4a..2363ed173198 100644 --- a/arch/ia64/kernel/acpi.c +++ b/arch/ia64/kernel/acpi.c | |||
@@ -199,6 +199,10 @@ char *__init __acpi_map_table(unsigned long phys_addr, unsigned long size) | |||
199 | return __va(phys_addr); | 199 | return __va(phys_addr); |
200 | } | 200 | } |
201 | 201 | ||
202 | char *__init __acpi_unmap_table(unsigned long virt_addr, unsigned long size) | ||
203 | { | ||
204 | } | ||
205 | |||
202 | /* -------------------------------------------------------------------------- | 206 | /* -------------------------------------------------------------------------- |
203 | Boot-time Table Parsing | 207 | Boot-time Table Parsing |
204 | -------------------------------------------------------------------------- */ | 208 | -------------------------------------------------------------------------- */ |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 7217834f6b1d..4c2aaea42930 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -121,21 +121,18 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC; | |||
121 | */ | 121 | */ |
122 | char *__init __acpi_map_table(unsigned long phys, unsigned long size) | 122 | char *__init __acpi_map_table(unsigned long phys, unsigned long size) |
123 | { | 123 | { |
124 | static char *prev_map; | ||
125 | static unsigned long prev_size; | ||
126 | |||
127 | if (prev_map) { | ||
128 | early_iounmap(prev_map, prev_size); | ||
129 | prev_map = NULL; | ||
130 | } | ||
131 | 124 | ||
132 | if (!phys || !size) | 125 | if (!phys || !size) |
133 | return NULL; | 126 | return NULL; |
134 | 127 | ||
135 | prev_size = size; | 128 | return early_ioremap(phys, size); |
136 | prev_map = early_ioremap(phys, size); | 129 | } |
130 | void __init __acpi_unmap_table(char *map, unsigned long size) | ||
131 | { | ||
132 | if (!map || !size) | ||
133 | return; | ||
137 | 134 | ||
138 | return prev_map; | 135 | early_iounmap(map, size); |
139 | } | 136 | } |
140 | 137 | ||
141 | #ifdef CONFIG_PCI_MMCONFIG | 138 | #ifdef CONFIG_PCI_MMCONFIG |
diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index c3e841f3cde9..ab0aff3c7d6a 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c | |||
@@ -365,7 +365,7 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table_id) | |||
365 | 365 | ||
366 | /******************************************************************************* | 366 | /******************************************************************************* |
367 | * | 367 | * |
368 | * FUNCTION: acpi_get_table | 368 | * FUNCTION: acpi_get_table_with_size |
369 | * | 369 | * |
370 | * PARAMETERS: Signature - ACPI signature of needed table | 370 | * PARAMETERS: Signature - ACPI signature of needed table |
371 | * Instance - Which instance (for SSDTs) | 371 | * Instance - Which instance (for SSDTs) |
@@ -377,8 +377,9 @@ ACPI_EXPORT_SYMBOL(acpi_unload_table_id) | |||
377 | * | 377 | * |
378 | *****************************************************************************/ | 378 | *****************************************************************************/ |
379 | acpi_status | 379 | acpi_status |
380 | acpi_get_table(char *signature, | 380 | acpi_get_table_with_size(char *signature, |
381 | u32 instance, struct acpi_table_header **out_table) | 381 | u32 instance, struct acpi_table_header **out_table, |
382 | acpi_size *tbl_size) | ||
382 | { | 383 | { |
383 | u32 i; | 384 | u32 i; |
384 | u32 j; | 385 | u32 j; |
@@ -408,6 +409,7 @@ acpi_get_table(char *signature, | |||
408 | acpi_tb_verify_table(&acpi_gbl_root_table_list.tables[i]); | 409 | acpi_tb_verify_table(&acpi_gbl_root_table_list.tables[i]); |
409 | if (ACPI_SUCCESS(status)) { | 410 | if (ACPI_SUCCESS(status)) { |
410 | *out_table = acpi_gbl_root_table_list.tables[i].pointer; | 411 | *out_table = acpi_gbl_root_table_list.tables[i].pointer; |
412 | *tbl_size = acpi_gbl_root_table_list.tables[i].length; | ||
411 | } | 413 | } |
412 | 414 | ||
413 | if (!acpi_gbl_permanent_mmap) { | 415 | if (!acpi_gbl_permanent_mmap) { |
@@ -420,6 +422,15 @@ acpi_get_table(char *signature, | |||
420 | return (AE_NOT_FOUND); | 422 | return (AE_NOT_FOUND); |
421 | } | 423 | } |
422 | 424 | ||
425 | acpi_status | ||
426 | acpi_get_table(char *signature, | ||
427 | u32 instance, struct acpi_table_header **out_table) | ||
428 | { | ||
429 | acpi_size tbl_size; | ||
430 | |||
431 | return acpi_get_table_with_size(signature, | ||
432 | instance, out_table, &tbl_size); | ||
433 | } | ||
423 | ACPI_EXPORT_SYMBOL(acpi_get_table) | 434 | ACPI_EXPORT_SYMBOL(acpi_get_table) |
424 | 435 | ||
425 | /******************************************************************************* | 436 | /******************************************************************************* |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index fb1be7b5dbc1..765fd1c56cd6 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -694,12 +694,6 @@ void __init acpi_early_init(void) | |||
694 | if (!acpi_strict) | 694 | if (!acpi_strict) |
695 | acpi_gbl_enable_interpreter_slack = TRUE; | 695 | acpi_gbl_enable_interpreter_slack = TRUE; |
696 | 696 | ||
697 | /* | ||
698 | * Doing a zero-sized mapping will clear out the previous | ||
699 | * __acpi_map_table() mapping, if any. | ||
700 | */ | ||
701 | __acpi_map_table(0, 0); | ||
702 | |||
703 | acpi_gbl_permanent_mmap = 1; | 697 | acpi_gbl_permanent_mmap = 1; |
704 | 698 | ||
705 | status = acpi_reallocate_root_table(); | 699 | status = acpi_reallocate_root_table(); |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index b3193ec0a2ef..d1dd5160daa9 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -274,12 +274,19 @@ EXPORT_SYMBOL_GPL(acpi_os_map_memory); | |||
274 | 274 | ||
275 | void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) | 275 | void acpi_os_unmap_memory(void __iomem * virt, acpi_size size) |
276 | { | 276 | { |
277 | if (acpi_gbl_permanent_mmap) { | 277 | if (acpi_gbl_permanent_mmap) |
278 | iounmap(virt); | 278 | iounmap(virt); |
279 | } | 279 | else |
280 | __acpi_unmap_table(virt, size); | ||
280 | } | 281 | } |
281 | EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); | 282 | EXPORT_SYMBOL_GPL(acpi_os_unmap_memory); |
282 | 283 | ||
284 | void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size) | ||
285 | { | ||
286 | if (!acpi_gbl_permanent_mmap) | ||
287 | __acpi_unmap_table(virt, size); | ||
288 | } | ||
289 | |||
283 | #ifdef ACPI_FUTURE_USAGE | 290 | #ifdef ACPI_FUTURE_USAGE |
284 | acpi_status | 291 | acpi_status |
285 | acpi_os_get_physical_address(void *virt, acpi_physical_address * phys) | 292 | acpi_os_get_physical_address(void *virt, acpi_physical_address * phys) |
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c index a8852952fac4..fec1ae36d431 100644 --- a/drivers/acpi/tables.c +++ b/drivers/acpi/tables.c | |||
@@ -181,14 +181,15 @@ acpi_table_parse_entries(char *id, | |||
181 | struct acpi_subtable_header *entry; | 181 | struct acpi_subtable_header *entry; |
182 | unsigned int count = 0; | 182 | unsigned int count = 0; |
183 | unsigned long table_end; | 183 | unsigned long table_end; |
184 | acpi_size tbl_size; | ||
184 | 185 | ||
185 | if (!handler) | 186 | if (!handler) |
186 | return -EINVAL; | 187 | return -EINVAL; |
187 | 188 | ||
188 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) | 189 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) |
189 | acpi_get_table(id, acpi_apic_instance, &table_header); | 190 | acpi_get_table_with_size(id, acpi_apic_instance, &table_header, &tbl_size); |
190 | else | 191 | else |
191 | acpi_get_table(id, 0, &table_header); | 192 | acpi_get_table_with_size(id, 0, &table_header, &tbl_size); |
192 | 193 | ||
193 | if (!table_header) { | 194 | if (!table_header) { |
194 | printk(KERN_WARNING PREFIX "%4.4s not present\n", id); | 195 | printk(KERN_WARNING PREFIX "%4.4s not present\n", id); |
@@ -206,8 +207,10 @@ acpi_table_parse_entries(char *id, | |||
206 | table_end) { | 207 | table_end) { |
207 | if (entry->type == entry_id | 208 | if (entry->type == entry_id |
208 | && (!max_entries || count++ < max_entries)) | 209 | && (!max_entries || count++ < max_entries)) |
209 | if (handler(entry, table_end)) | 210 | if (handler(entry, table_end)) { |
211 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); | ||
210 | return -EINVAL; | 212 | return -EINVAL; |
213 | } | ||
211 | 214 | ||
212 | entry = (struct acpi_subtable_header *) | 215 | entry = (struct acpi_subtable_header *) |
213 | ((unsigned long)entry + entry->length); | 216 | ((unsigned long)entry + entry->length); |
@@ -217,6 +220,7 @@ acpi_table_parse_entries(char *id, | |||
217 | "%i found\n", id, entry_id, count - max_entries, count); | 220 | "%i found\n", id, entry_id, count - max_entries, count); |
218 | } | 221 | } |
219 | 222 | ||
223 | early_acpi_os_unmap_memory((char *)table_header, tbl_size); | ||
220 | return count; | 224 | return count; |
221 | } | 225 | } |
222 | 226 | ||
@@ -241,17 +245,19 @@ acpi_table_parse_madt(enum acpi_madt_type id, | |||
241 | int __init acpi_table_parse(char *id, acpi_table_handler handler) | 245 | int __init acpi_table_parse(char *id, acpi_table_handler handler) |
242 | { | 246 | { |
243 | struct acpi_table_header *table = NULL; | 247 | struct acpi_table_header *table = NULL; |
248 | acpi_size tbl_size; | ||
244 | 249 | ||
245 | if (!handler) | 250 | if (!handler) |
246 | return -EINVAL; | 251 | return -EINVAL; |
247 | 252 | ||
248 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) | 253 | if (strncmp(id, ACPI_SIG_MADT, 4) == 0) |
249 | acpi_get_table(id, acpi_apic_instance, &table); | 254 | acpi_get_table_with_size(id, acpi_apic_instance, &table, &tbl_size); |
250 | else | 255 | else |
251 | acpi_get_table(id, 0, &table); | 256 | acpi_get_table_with_size(id, 0, &table, &tbl_size); |
252 | 257 | ||
253 | if (table) { | 258 | if (table) { |
254 | handler(table); | 259 | handler(table); |
260 | early_acpi_os_unmap_memory(table, tbl_size); | ||
255 | return 0; | 261 | return 0; |
256 | } else | 262 | } else |
257 | return 1; | 263 | return 1; |
@@ -265,8 +271,9 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler) | |||
265 | static void __init check_multiple_madt(void) | 271 | static void __init check_multiple_madt(void) |
266 | { | 272 | { |
267 | struct acpi_table_header *table = NULL; | 273 | struct acpi_table_header *table = NULL; |
274 | acpi_size tbl_size; | ||
268 | 275 | ||
269 | acpi_get_table(ACPI_SIG_MADT, 2, &table); | 276 | acpi_get_table_with_size(ACPI_SIG_MADT, 2, &table, &tbl_size); |
270 | if (table) { | 277 | if (table) { |
271 | printk(KERN_WARNING PREFIX | 278 | printk(KERN_WARNING PREFIX |
272 | "BIOS bug: multiple APIC/MADT found," | 279 | "BIOS bug: multiple APIC/MADT found," |
@@ -275,6 +282,7 @@ static void __init check_multiple_madt(void) | |||
275 | "If \"acpi_apic_instance=%d\" works better, " | 282 | "If \"acpi_apic_instance=%d\" works better, " |
276 | "notify linux-acpi@vger.kernel.org\n", | 283 | "notify linux-acpi@vger.kernel.org\n", |
277 | acpi_apic_instance ? 0 : 2); | 284 | acpi_apic_instance ? 0 : 2); |
285 | early_acpi_os_unmap_memory(table, tbl_size); | ||
278 | 286 | ||
279 | } else | 287 | } else |
280 | acpi_apic_instance = 0; | 288 | acpi_apic_instance = 0; |
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index a62720a7edc0..ab0b85cf21f3 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h | |||
@@ -144,6 +144,7 @@ void __iomem *acpi_os_map_memory(acpi_physical_address where, | |||
144 | acpi_size length); | 144 | acpi_size length); |
145 | 145 | ||
146 | void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); | 146 | void acpi_os_unmap_memory(void __iomem * logical_address, acpi_size size); |
147 | void early_acpi_os_unmap_memory(void __iomem * virt, acpi_size size); | ||
147 | 148 | ||
148 | #ifdef ACPI_FUTURE_USAGE | 149 | #ifdef ACPI_FUTURE_USAGE |
149 | acpi_status | 150 | acpi_status |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index c8e8cf45830f..cc40102fe2f3 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -130,6 +130,10 @@ acpi_get_table_header(acpi_string signature, | |||
130 | struct acpi_table_header *out_table_header); | 130 | struct acpi_table_header *out_table_header); |
131 | 131 | ||
132 | acpi_status | 132 | acpi_status |
133 | acpi_get_table_with_size(acpi_string signature, | ||
134 | u32 instance, struct acpi_table_header **out_table, | ||
135 | acpi_size *tbl_size); | ||
136 | acpi_status | ||
133 | acpi_get_table(acpi_string signature, | 137 | acpi_get_table(acpi_string signature, |
134 | u32 instance, struct acpi_table_header **out_table); | 138 | u32 instance, struct acpi_table_header **out_table); |
135 | 139 | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6fce2fc2d124..d59f0fa4d772 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -79,6 +79,7 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *table); | |||
79 | typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); | 79 | typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end); |
80 | 80 | ||
81 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); | 81 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); |
82 | void __init __acpi_unmap_table(char *map, unsigned long size); | ||
82 | int early_acpi_boot_init(void); | 83 | int early_acpi_boot_init(void); |
83 | int acpi_boot_init (void); | 84 | int acpi_boot_init (void); |
84 | int acpi_boot_table_init (void); | 85 | int acpi_boot_table_init (void); |