Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Dec 2001 18:13:21 -0800
From:      Kent Stewart <kstewart@owt.com>
To:        John Baldwin <jhb@FreeBSD.ORG>
Cc:        cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/dev/ata ata-pci.c
Message-ID:  <3C1FF7C1.7010807@owt.com>
References:  <200112190153.fBJ1rBl16771@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------050807030304040409000307
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit



John Baldwin wrote:

> jhb         2001/12/18 17:53:11 PST
> 
>   Modified files:
>     sys/dev/ata          ata-pci.c 
>   Log:
>   Display the right message for the SiS 645 chipset.
>   
>   Submitted by:   Kent Stewart <kstewart@owt.com>
>   
>   Revision  Changes    Path
>   1.23      +1 -0      src/sys/dev/ata/ata-pci.c


If you run -stable on your system, the same changes to -stable are 
attached. I probably should have finished making ata_find_dev look like 
current but I got lazy at that point. I have 3 systems running them. A 
Promise Ultra 100 is about 10% faster. That is a larger difference than 
the difference between ad0 at UDMA33 and 66.

The drives show up as

ad0: 19541MB <Maxtor 52049U4> [39703/16/63] at ata0-master UDMA66
ad1: 6679MB <Maxtor 87000D8> [14475/15/63] at ata0-slave UDMA33
ad2: 29311MB <Maxtor 5T030H3> [59554/16/63] at ata1-slave UDMA100


Kent



-- 
Kent Stewart
Richland, WA

mailto:kbstew99@hotmail.com
http://users.owt.com/kstewart/index.html
FreeBSD News http://daily.daemonnews.org/

--------------050807030304040409000307
Content-Type: text/plain;
 name="ata-all.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ata-all.patch"

--- ata-all.c.orig	Sat Dec 15 03:03:03 2001
+++ ata-all.c	Sat Dec 15 20:44:03 2001
@@ -216,7 +216,7 @@
 };
 
 int
-ata_find_dev(device_t dev, u_int32_t type, u_int32_t revid)
+ata_find_dev(device_t dev, u_int32_t devid, u_int32_t revid)
 {
     device_t *children, child;
     int nchildren, i;
@@ -228,9 +228,7 @@
 	child = children[i];
 
 	/* check that it's on the same silicon and the device we want */
-	if (pci_get_slot(dev) == pci_get_slot(child) &&
-	    pci_get_vendor(child) == (type & 0xffff) &&
-	    pci_get_device(child) == ((type & 0xffff0000) >> 16) &&
+	if (pci_get_devid(child) == devid &&
 	    pci_get_revid(child) >= revid) {
 	    free(children, M_TEMP);
 	    return 1;
@@ -297,6 +295,19 @@
 	return "VIA Apollo ATA controller";
 
     case 0x55131039:
+	if (ata_find_dev(dev, 0x06301039, 0x30) ||
+	    ata_find_dev(dev, 0x06331039, 0x00) ||
+	    ata_find_dev(dev, 0x06351039, 0x00) ||
+	    ata_find_dev(dev, 0x06451039, 0x00) ||
+	    ata_find_dev(dev, 0x07301039, 0x00) ||
+	    ata_find_dev(dev, 0x07331039, 0x00) ||
+	    ata_find_dev(dev, 0x07351039, 0x00))
+	    return "SiS 5591 ATA100 controller";
+	if (ata_find_dev(dev, 0x05301039, 0x00) ||
+	    ata_find_dev(dev, 0x05401039, 0x00) ||
+	    ata_find_dev(dev, 0x06201039, 0x00) ||
+	    ata_find_dev(dev, 0x06301039, 0x00))
+	    return "SiS 5591 ATA66 controller";
 	return "SiS 5591 ATA33 controller";
 
     case 0x06491095:

--------------050807030304040409000307
Content-Type: text/plain;
 name="ata-dma.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ata-dma.patch"

--- ata-dma.c.orig	Fri Dec 14 21:44:24 2001
+++ ata-dma.c	Sat Dec 15 22:13:55 2001
@@ -520,32 +520,104 @@
 	break;
 
     case 0x55131039:	/* SiS 5591 */
-	if (udmamode >= 2 && pci_get_revid(parent) > 0xc1) {
-	    error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
-				ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
-	    if (bootverbose)
-		ata_printf(scp, device,
-			   "%s setting UDMA2 on SiS chip\n",
-			   (error) ? "failed" : "success");
-	    if (!error) {
-		pci_write_config(parent, 0x40 + (devno << 1), 0xa301, 2);
-		scp->mode[ATA_DEV(device)] = ATA_UDMA2;
-		return;
+
+	if (ata_find_dev(parent, 0x06301039, 0x30) || 	/* SiS 630 */
+	    ata_find_dev(parent, 0x06331039, 0x00) || 	/* SiS 633 */
+	    ata_find_dev(parent, 0x06351039, 0x00) || 	/* SiS 635 */
+	    ata_find_dev(parent, 0x06451039, 0x00) || 	/* SiS 645 */
+	    ata_find_dev(parent, 0x07301039, 0x00) || 	/* SiS 730 */
+	    ata_find_dev(parent, 0x07331039, 0x00) || 	/* SiS 733 */
+	    ata_find_dev(parent, 0x07351039, 0x00)) { 	/* SiS 735 */
+	    int8_t reg = 0x40 + (devno << 1);
+	    int16_t val = pci_read_config(parent, reg, 2) & 0x0fff;
+
+	    if (udmamode >= 5) {
+		error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+				    ATA_UDMA5, ATA_C_F_SETXFER, ATA_WAIT_READY);
+		if (bootverbose)
+		    ata_printf(scp, device,
+			       "%s setting UDMA5 on SiS chip\n",
+			       (error) ? "failed" : "success");
+		if (!error) {
+		    pci_write_config(parent, reg, val | 0x8000, 2);
+		    scp->mode[ATA_DEV(device)] = ATA_UDMA5;
+		    return;
+		}
 	    }
-	}
-	if (wdmamode >=2 && apiomode >= 4) {
-	    error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
-				ATA_WDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
-	    if (bootverbose)
-		ata_printf(scp, device,
-			   "%s setting WDMA2 on SiS chip\n",
-			   (error) ? "failed" : "success");
-	    if (!error) {
-		pci_write_config(parent, 0x40 + (devno << 1), 0x0301, 2);
-		scp->mode[ATA_DEV(device)] = ATA_WDMA2;
-		return;
+	    if (udmamode >= 4) {
+		error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+				    ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
+		if (bootverbose)
+		    ata_printf(scp, device,
+			       "%s setting UDMA4 on SiS chip\n",
+			       (error) ? "failed" : "success");
+		if (!error) {
+		    pci_write_config(parent, reg, val | 0x9000, 2);
+		    scp->mode[ATA_DEV(device)] = ATA_UDMA4;
+		    return;
+		}
 	    }
-	}
+	    if (udmamode >= 2) {
+		error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+				    ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
+		if (bootverbose)
+		    ata_printf(scp, device,
+			       "%s setting UDMA2 on SiS chip\n",
+			       (error) ? "failed" : "success");
+		if (!error) {
+		    pci_write_config(parent, reg, val | 0xb000, 2);
+		    scp->mode[ATA_DEV(device)] = ATA_UDMA2;
+		    return;
+		}
+	    }
+	} else if (ata_find_dev(parent, 0x05301039, 0) || /* SiS 530 */
+		   ata_find_dev(parent, 0x05401039, 0) || /* SiS 540 */
+		   ata_find_dev(parent, 0x06201039, 0) || /* SiS 620 */
+		   ata_find_dev(parent, 0x06301039, 0)) { /* SiS 630 */
+	    int8_t reg = 0x40 + (devno << 1);
+	    int16_t val = pci_read_config(parent, reg, 2) & 0x0fff;
+
+	    if (udmamode >= 4) {
+		error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+				    ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
+		if (bootverbose)
+		    ata_printf(scp, device,
+			       "%s setting UDMA4 on SiS chip\n",
+			       (error) ? "failed" : "success");
+		if (!error) {
+		    pci_write_config(parent, reg, val | 0x9000, 2);
+		    scp->mode[ATA_DEV(device)] = ATA_UDMA4;
+		    return;
+		}
+	    }
+	    if (udmamode >= 2) {
+		error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+				    ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
+		if (bootverbose)
+		    ata_printf(scp, device,
+			       "%s setting UDMA2 on SiS chip\n",
+			       (error) ? "failed" : "success");
+		if (!error) {
+		    pci_write_config(parent, reg, val | 0xa000, 2);
+		    scp->mode[ATA_DEV(device)] = ATA_UDMA2;
+		    return;
+		}
+	    }
+	} else {	/* SiS 5591 */
+	    if (udmamode >= 2 && pci_get_revid(parent) > 0xc1) {
+		error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
+				    ATA_UDMA2, ATA_C_F_SETXFER, ATA_WAIT_READY);
+		if (bootverbose)
+		    ata_printf(scp, device,
+			       "%s setting UDMA2 on SiS chip\n",
+			       (error) ? "failed" : "success");
+		if (!error) {
+		    pci_write_config(parent, 0x40 + (devno << 1), 0xa301, 2);
+		    scp->mode[ATA_DEV(device)] = ATA_UDMA2;
+		    return;
+		}
+ 	    }
+ 	}
 	/* we could set PIO mode timings, but we assume the BIOS did that */
 	break;
 

--------------050807030304040409000307--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C1FF7C1.7010807>