Date: Mon, 24 Aug 1998 18:56:28 +0200 (CEST)
From: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>
To: "Andre M. Hedrick" <hedrick@Astro.Dyer.Vanderbilt.Edu>
cc: Linux/m68k <linux-m68k@lists.linux-m68k.org>,
        Linux/APUS <linux-apus@SunSITE.auc.dk>
Subject: L68K: Re: IDE-Driver Update :: Testing Requested
In-Reply-To: <Pine.LNX.3.96.980822150538.19039B-100000@Astro.Dyer.Vanderbilt.Edu>
Sender: owner-linux-m68k@phil.uni-sb.de

On Sat, 22 Aug 1998, Andre M. Hedrick wrote:
> Thank you for the report, and I will setup a download load point as
> requested.  I have been lazy about doing this......(reality is that
> I am fighting the integration)  2.1.117.ide+apm.patch.13 is the last
> on to flood the list-serve until "final"
> 
> http://www.dyer.vanderbilt.edu/server/udma/
> 
> This has patches for 2.0.X and 2.1.11X
> 
> "2.1.117.ide+apm.patch.14" and "2.1.117.ide+apm.patch.15"

Here are my patches, against 2.1.117.ide+apm.patch.15. And this time it works!

The main bug that caused lock ups was in drivers/block/ide.c. Because the irq
field was zero, the probe routine used irq probing which must not be done on
m68k. The other things are clean ups.

I tested it on the Gayle interface only, but I have good reasons to believe
it'll work on the other m68k interfaces too. Anybody care to test?

BTW, is it really necessary to have two sets of io_ports[] and irqs, one in
hwif and one in hwif.hw? Without this, the irq bug wouldn't have happened in
the first place.

--- /mnt/tmp/ide-2.1.117/drivers/block/buddha.c	Mon Aug 24 00:03:16 1998
+++ drivers/block/buddha.c	Mon Aug 24 18:31:13 1998
@@ -99,7 +99,7 @@
 {
     unsigned char ch;
 
-    ch = inb(hwif->hw.io_ports[IDE_IRQ_OFFSET]);
+    ch = inb(hwif->io_ports[IDE_IRQ_OFFSET]);
     if (!(ch & 0x80))
 	return 0;
     return 1;
--- /mnt/tmp/ide-2.1.117/drivers/block/gayle.c	Mon Aug 24 00:03:16 1998
+++ drivers/block/gayle.c	Mon Aug 24 18:31:04 1998
@@ -84,7 +84,7 @@
 {
     unsigned char ch;
 
-    ch = inb(hwif->hw.io_ports[IDE_IRQ_OFFSET]);
+    ch = inb(hwif->io_ports[IDE_IRQ_OFFSET]);
     if (!(ch & 0x80))
 	return 0;
     return 1;
@@ -94,11 +94,11 @@
 {
     unsigned char ch;
 
-    ch = inb(hwif->hw.io_ports[IDE_IRQ_OFFSET]);
+    ch = inb(hwif->io_ports[IDE_IRQ_OFFSET]);
     if (!(ch & 0x80))
 	return 0;
-    (void)inb(hwif->hw.io_ports[IDE_STATUS_OFFSET]);
-    outb(0x7c | (ch & 0x03), hwif->hw.io_ports[IDE_IRQ_OFFSET]);
+    (void)inb(hwif->io_ports[IDE_STATUS_OFFSET]);
+    outb(0x7c | (ch & 0x03), hwif->io_ports[IDE_IRQ_OFFSET]);
     return 1;
 }
 
--- /mnt/tmp/ide-2.1.117/drivers/block/ide.c	Mon Aug 24 00:03:16 1998
+++ drivers/block/ide.c	Mon Aug 24 18:43:51 1998
@@ -1842,6 +1842,7 @@
 		return -1;
 	memcpy(&hwif->hw, hw, sizeof(*hw));
 	memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->hw.io_ports));
+	hwif->irq = hw->irq;
 	hwif->noprobe = 0;
 
 	if (!initializing) {
--- /mnt/tmp/ide-2.1.117/drivers/block/macide.c	Mon Aug 24 00:03:16 1998
+++ drivers/block/macide.c	Mon Aug 24 18:31:09 1998
@@ -123,7 +123,7 @@
 {
     unsigned char ch;
 
-    ch = inb(hwif->hw.io_ports[IDE_IRQ_OFFSET]);
+    ch = inb(hwif->io_ports[IDE_IRQ_OFFSET]);
     if (!(ch & 0x20))
 	return 0;
     return 1;
--- /mnt/tmp/ide-2.1.117/include/asm-m68k/ide.h	Mon Aug 24 00:03:16 1998
+++ include/asm-m68k/ide.h	Mon Aug 24 18:24:19 1998
@@ -68,7 +68,6 @@
 						ide_ioreg_t ctrl_port,
 						int *irq)
 {
-	printk("ide_init_hwif_ports: must not be called\n");
 }
 
 /*

Greetings,

						Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP}  http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium

