<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Bartlomiej Zolnierkiewicz &lt;B.Zolnierkiewicz@elka.pw.edu.pl&gt;

- fix brown paper bug introduced by my last patch, drive information was
  checked before drive was probed so Seagate errata fix was never applied
  (noticed by Bob Johnson &lt;livewire@gentoo.org&gt;)

- limit rqsize only on affected controller/drive combo (fix from
  sata_sil.c)

- limit mode to UDMA5 only on Maxtor 4D060H3 (fix from sata_sil.c)

Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 25-akpm/drivers/ide/ide-probe.c   |    8 ++++-
 25-akpm/drivers/ide/pci/siimage.c |   53 ++++++++++++++++++++++----------------
 25-akpm/include/linux/ide.h       |    1 
 3 files changed, 38 insertions(+), 24 deletions(-)

diff -puN drivers/ide/ide-probe.c~siimage-update drivers/ide/ide-probe.c
--- 25/drivers/ide/ide-probe.c~siimage-update	2004-06-06 23:08:41.196063888 -0700
+++ 25-akpm/drivers/ide/ide-probe.c	2004-06-06 23:08:41.204062672 -0700
@@ -896,8 +896,12 @@ static int ide_init_queue(ide_drive_t *d
 	q-&gt;queuedata = HWGROUP(drive);
 	blk_queue_segment_boundary(q, 0xffff);
 
-	if (!hwif-&gt;rqsize)
-		hwif-&gt;rqsize = hwif-&gt;no_lba48 ? 256 : 65536;
+	if (!hwif-&gt;rqsize) {
+		if (hwif-&gt;max_rqsize)
+			hwif-&gt;rqsize = hwif-&gt;max_rqsize(drive);
+		else
+			hwif-&gt;rqsize = hwif-&gt;no_lba48 ? 256 : 65536;
+	}
 	if (hwif-&gt;rqsize &lt; max_sectors)
 		max_sectors = hwif-&gt;rqsize;
 	blk_queue_max_sectors(q, max_sectors);
diff -puN drivers/ide/pci/siimage.c~siimage-update drivers/ide/pci/siimage.c
--- 25/drivers/ide/pci/siimage.c~siimage-update	2004-06-06 23:08:41.198063584 -0700
+++ 25-akpm/drivers/ide/pci/siimage.c	2004-06-06 23:08:41.205062520 -0700
@@ -132,13 +132,12 @@ static byte siimage_ratemask (ide_drive_
 	else
 		pci_read_config_byte(hwif-&gt;pci_dev, 0x8A, &amp;scsc);
 
-	if(is_sata(hwif))
-	{
-		if(strstr(drive-&gt;id-&gt;model, "Maxtor"))
+	if (is_sata(hwif)) {
+		if (strstr(drive-&gt;id-&gt;model, "Maxtor 4D060H3"))
 			return 3;
 		return 4;
 	}
-	
+
 	if ((scsc &amp; 0x30) == 0x10)	/* 133 */
 		mode = 4;
 	else if ((scsc &amp; 0x30) == 0x20)	/* 2xPCI */
@@ -966,25 +965,34 @@ static void __init init_mmio_iops_siimag
 	hwif-&gt;mmio			= 2;
 }
 
-static int is_dev_seagate_sata(ide_drive_t *drive)
+/* TODO firmware versions should be added - eric */
+static const char * sil_blacklist [] = {
+	"ST320012AS",
+	"ST330013AS",
+	"ST340017AS",
+	"ST360015AS",
+	"ST380023AS",
+	"ST3120023AS",
+	"ST340014ASL",
+	"ST360014ASL",
+	"ST380011ASL",
+	"ST3120022ASL",
+	"ST3160021ASL",
+};
+
+static unsigned int siimage_sata_max_rqsize(ide_drive_t *drive)
 {
 	const char *s = &amp;drive-&gt;id-&gt;model[0];
-	unsigned len;
+	unsigned int n;
 
-	if (!drive-&gt;present)
-		return 0;
-
-	len = strnlen(s, sizeof(drive-&gt;id-&gt;model));
-
-	if ((len &gt; 4) &amp;&amp; (!memcmp(s, "ST", 2))) {
-		if ((!memcmp(s + len - 2, "AS", 2)) ||
-		    (!memcmp(s + len - 3, "ASL", 3))) {
-			printk(KERN_INFO "%s: applying pessimistic Seagate "
-					 "errata fix\n", drive-&gt;name);
-			return 1;
+	for (n = 0; n &lt; ARRAY_SIZE(sil_blacklist); n++)
+		if (!memcmp(sil_blacklist[n], s, strlen(sil_blacklist[n]))) {
+			printk(KERN_INFO "%s: applying Seagate errata fix\n",
+					 drive-&gt;name);
+			return 15;
 		}
-	}
-	return 0;
+
+	return 128;
 }
 
 /**
@@ -1007,9 +1015,10 @@ static void __init init_iops_siimage (id
 	
 	hwif-&gt;hwif_data = 0;
 
-	hwif-&gt;rqsize = 128;
-	if (is_sata(hwif) &amp;&amp; is_dev_seagate_sata(&amp;hwif-&gt;drives[0]))
-		hwif-&gt;rqsize = 15;
+	if (is_sata(hwif) &amp;&amp; (class_rev &lt;= 0x01))
+		hwif-&gt;max_rqsize = siimage_sata_max_rqsize;
+	else
+		hwif-&gt;rqsize = 128;
 
 	if (pci_get_drvdata(dev) == NULL)
 		return;
diff -puN include/linux/ide.h~siimage-update include/linux/ide.h
--- 25/include/linux/ide.h~siimage-update	2004-06-06 23:08:41.200063280 -0700
+++ 25-akpm/include/linux/ide.h	2004-06-06 23:08:41.208062064 -0700
@@ -1015,6 +1015,7 @@ typedef struct hwif_s {
 	unsigned dma;
 
 	void (*led_act)(void *data, int rw);
+	unsigned int (*max_rqsize)(ide_drive_t *);
 } ide_hwif_t;
 
 /*
_
</pre></body></html>