summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Grover <agrover@groveronline.com>2003-02-26 00:29:15 -0800
committerAndy Grover <agrover@groveronline.com>2003-02-26 00:29:15 -0800
commitfcc0694ce9fa89154dc9e09f815754dd54542074 (patch)
treeb95e47dad0145b7f8af2730e4ae89544acc60bd7
parenta32f4c3e61e94ed9c38acb322b5c4f05ab9059f2 (diff)
ACPI: Map in entire table before performing checksum (John Stultz)
-rw-r--r--drivers/acpi/tables.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index 5cc7467edd51..b858adf8b82d 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -379,6 +379,7 @@ acpi_table_get_sdt (
sdt.pa = ((struct acpi20_table_rsdp*)rsdp)->xsdt_address;
+ /* map in just the header */
header = (struct acpi_table_header *)
__acpi_map_table(sdt.pa, sizeof(struct acpi_table_header));
@@ -387,6 +388,15 @@ acpi_table_get_sdt (
return -ENODEV;
}
+ /* remap in the entire table before processing */
+ mapped_xsdt = (struct acpi_table_xsdt *)
+ __acpi_map_table(sdt.pa, header->length);
+ if (!mapped_xsdt) {
+ printk(KERN_WARNING PREFIX "Unable to map XSDT\n");
+ return -ENODEV;
+ }
+ header = &mapped_xsdt->header;
+
if (strncmp(header->signature, "XSDT", 4)) {
printk(KERN_WARNING PREFIX "XSDT signature incorrect\n");
return -ENODEV;
@@ -404,15 +414,6 @@ acpi_table_get_sdt (
sdt.count = ACPI_MAX_TABLES;
}
- mapped_xsdt = (struct acpi_table_xsdt *)
- __acpi_map_table(sdt.pa, header->length);
- if (!mapped_xsdt) {
- printk(KERN_WARNING PREFIX "Unable to map XSDT\n");
- return -ENODEV;
- }
-
- header = &mapped_xsdt->header;
-
for (i = 0; i < sdt.count; i++)
sdt.entry[i].pa = (unsigned long) mapped_xsdt->entry[i];
}
@@ -425,6 +426,7 @@ acpi_table_get_sdt (
sdt.pa = rsdp->rsdt_address;
+ /* map in just the header */
header = (struct acpi_table_header *)
__acpi_map_table(sdt.pa, sizeof(struct acpi_table_header));
if (!header) {
@@ -432,6 +434,15 @@ acpi_table_get_sdt (
return -ENODEV;
}
+ /* remap in the entire table before processing */
+ mapped_rsdt = (struct acpi_table_rsdt *)
+ __acpi_map_table(sdt.pa, header->length);
+ if (!mapped_rsdt) {
+ printk(KERN_WARNING PREFIX "Unable to map RSDT\n");
+ return -ENODEV;
+ }
+ header = &mapped_rsdt->header;
+
if (strncmp(header->signature, "RSDT", 4)) {
printk(KERN_WARNING PREFIX "RSDT signature incorrect\n");
return -ENODEV;
@@ -449,15 +460,6 @@ acpi_table_get_sdt (
sdt.count = ACPI_MAX_TABLES;
}
- mapped_rsdt = (struct acpi_table_rsdt *)
- __acpi_map_table(sdt.pa, header->length);
- if (!mapped_rsdt) {
- printk(KERN_WARNING PREFIX "Unable to map RSDT\n");
- return -ENODEV;
- }
-
- header = &mapped_rsdt->header;
-
for (i = 0; i < sdt.count; i++)
sdt.entry[i].pa = (unsigned long) mapped_rsdt->entry[i];
}
@@ -471,12 +473,20 @@ acpi_table_get_sdt (
for (i = 0; i < sdt.count; i++) {
+ /* map in just the header */
header = (struct acpi_table_header *)
__acpi_map_table(sdt.entry[i].pa,
sizeof(struct acpi_table_header));
if (!header)
continue;
+ /* remap in the entire table before processing */
+ header = (struct acpi_table_header *)
+ __acpi_map_table(sdt.entry[i].pa,
+ header->length);
+ if (!header)
+ continue;
+
acpi_table_print(header, sdt.entry[i].pa);
if (acpi_table_compute_checksum(header, header->length)) {