mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [AMD64 2/3] Fix build broken due to ACPI changes
@ 2003-10-25 18:27 Jeff Garzik
  0 siblings, 0 replies; only message in thread
From: Jeff Garzik @ 2003-10-25 18:27 UTC (permalink / raw)
  To: ak, linux-kernel; +Cc: len.brown


# --------------------------------------------
# 03/10/25	jgarzik@redhat.com	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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-10-25 18:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-25 18:27 [AMD64 2/3] Fix build broken due to ACPI changes Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome