PATCH 2.3.23.5: ACPI iomap fix

Jeff Garzik (jgarzik@mandrakesoft.com)
Thu, 21 Oct 1999 05:13:53 -0400


This is a multi-part message in MIME format.
--------------9EF2040B9C1059771B790B6A
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Attached is a patch against 2.3.23 pre5 which fixes ACPI with regards to
iomapping. The warning messages added in pre5 brought to light this
bug. This patch works on my K6 w/ ACPI.

Note that isa_readl was not used because there is not a corresponding
isa_memcpy_fromio.

DaveM-- I believe sbus_memcpy_fromio and variants are missing from
Sparc as well. only sbus_memset_io is present in addition to
sbus_{read,write}[bwl]

Jeff

Changelog:

include/linux/acpi.h:
* physical addresses should be unsigned long

drivers/misc/acpi.c:
* already ioremap() before calling readl() or memcpy_fromio()
--------------9EF2040B9C1059771B790B6A
Content-Type: text/plain; charset=us-ascii;
name="2.3.23.pre5-acpi-iomap-fix.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="2.3.23.pre5-acpi-iomap-fix.patch"

diff -urN linux-2.3.23-pre5/include/linux/acpi.h linux_2_3/include/linux/acpi.h
--- linux-2.3.23-pre5/include/linux/acpi.h Fri Oct 8 16:37:00 1999
+++ linux_2_3/include/linux/acpi.h Thu Oct 21 04:37:01 1999
@@ -28,8 +28,8 @@
#define ACPI_MINOR_DEV 167

/* RSDP location */
-#define ACPI_BIOS_ROM_BASE ((__u8*) 0xe0000)
-#define ACPI_BIOS_ROM_END ((__u8*) 0x100000)
+#define ACPI_BIOS_ROM_BASE 0xE0000L
+#define ACPI_BIOS_ROM_END 0x100000L

/* Table signatures */
#define ACPI_RSDP1_SIG 0x20445352 /* 'RSD ' */
diff -urN linux-2.3.23-pre5/drivers/misc/acpi.c linux_2_3/drivers/misc/acpi.c
--- linux-2.3.23-pre5/drivers/misc/acpi.c Thu Oct 21 04:59:42 1999
+++ linux_2_3/drivers/misc/acpi.c Thu Oct 21 05:05:18 1999
@@ -246,11 +246,11 @@
struct acpi_table *rsdt;
u32 *rsdt_entry;
int rsdt_entry_count;
- u8 *i;
+ unsigned long i;

// search BIOS memory for RSDP
for (i = ACPI_BIOS_ROM_BASE; i < ACPI_BIOS_ROM_END; i += 16) {
- rsdp = (struct acpi_rsdp *) i;
+ rsdp = (struct acpi_rsdp *) ioremap (i, sizeof (*rsdp));
if (readl(rsdp->signature) == ACPI_RSDP1_SIG
&& readl(rsdp->signature + 1) == ACPI_RSDP2_SIG) {
char oem[7];
@@ -268,14 +268,18 @@
oem, (void *) i);

break;
+ } else {
+ iounmap (rsdp);
+ rsdp = NULL;
}
}
- if (i >= ACPI_BIOS_ROM_END) {
+ if (!rsdp) {
printk(KERN_ERR "ACPI: no RSDP found\n");
return -ENODEV;
}
// fetch RSDT from RSDP
rsdt = acpi_map_table(readl(&rsdp->rsdt));
+ iounmap (rsdp);
if (!rsdt || rsdt->signature != ACPI_RSDT_SIG) {
printk(KERN_ERR "ACPI: no RSDT found\n");
acpi_unmap_table(rsdt);

--------------9EF2040B9C1059771B790B6A--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/