[AMD64 2/3] Fix build broken due to ACPI changes

From: Jeff Garzik
Date: Sat Oct 25 2003 - 13:30:21 EST



# --------------------------------------------
# 03/10/25 jgarzik@xxxxxxxxxx 1.1352
# [AMD64] add acpi_pic_set_level_irq
#
# ACPI guys broke the AMD64 build. Adding this function fixes it.
# --------------------------------------------

diff -Nru a/arch/x86_64/kernel/acpi/boot.c b/arch/x86_64/kernel/acpi/boot.c
--- a/arch/x86_64/kernel/acpi/boot.c Sat Oct 25 06:08:24 2003
+++ b/arch/x86_64/kernel/acpi/boot.c Sat Oct 25 06:08:24 2003
@@ -226,30 +226,33 @@

#endif /*CONFIG_X86_IO_APIC*/

-#ifdef CONFIG_HPET_TIMER
-static int __init
-acpi_parse_hpet (
- unsigned long phys_addr,
- unsigned long size)
-{
- struct acpi_table_hpet *hpet_tbl;
-
- hpet_tbl = __va(phys_addr);
+#ifdef CONFIG_ACPI_BUS
+/*
+ * Set specified PIC IRQ to level triggered mode.
+ *
+ * Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers
+ * for the 8259 PIC. bit[n] = 1 means irq[n] is Level, otherwise Edge.
+ * ECLR1 is IRQ's 0-7 (IRQ 0, 1, 2 must be 0)
+ * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0)
+ *
+ * As the BIOS should have done this for us,
+ * print a warning if the IRQ wasn't already set to level.
+ */

- if (hpet_tbl->addr.space_id != ACPI_SPACE_MEM) {
- printk(KERN_WARNING "acpi: HPET timers must be located in memory.\n");
- return -1;
+void acpi_pic_set_level_irq(unsigned int irq)
+{
+ unsigned char mask = 1 << (irq & 7);
+ unsigned int port = 0x4d0 + (irq >> 3);
+ unsigned char val = inb(port);
+
+ if (!(val & mask)) {
+ printk(KERN_WARNING PREFIX "IRQ %d was Edge Triggered, "
+ "setting to Level Triggerd\n", irq);
+ outb(val | mask, port);
}
+}
+#endif /* CONFIG_ACPI_BUS */

- vxtime.hpet_address = hpet_tbl->addr.addrl |
- ((long) hpet_tbl->addr.addrh << 32);
-
- printk(KERN_INFO "acpi: HPET id: %#x base: %#lx\n",
- hpet_tbl->id, vxtime.hpet_address);
-
- return 0;
-}
-#endif

static unsigned long __init
acpi_scan_rsdp (
@@ -272,6 +275,30 @@
return 0;
}

+#ifdef CONFIG_HPET_TIMER
+static int __init
+acpi_parse_hpet (
+ unsigned long phys_addr,
+ unsigned long size)
+{
+ struct acpi_table_hpet *hpet_tbl;
+
+ hpet_tbl = __va(phys_addr);
+
+ if (hpet_tbl->addr.space_id != ACPI_SPACE_MEM) {
+ printk(KERN_WARNING "acpi: HPET timers must be located in memory.\n");
+ return -1;
+ }
+
+ vxtime.hpet_address = hpet_tbl->addr.addrl |
+ ((long) hpet_tbl->addr.addrh << 32);
+
+ printk(KERN_INFO "acpi: HPET id: %#x base: %#lx\n",
+ hpet_tbl->id, vxtime.hpet_address);
+
+ return 0;
+}
+#endif

unsigned long __init
acpi_find_rsdp (void)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/