Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 Dec 2001 17:53:37 +1030
From:      Richard Sharpe <sharpe@ns.aus.com>
To:        Greg Lehey <grog@FreeBSD.org>
Cc:        =?ISO-8859-1?Q?S=F8ren?= Schmidt <sos@freebsd.dk>, Zwane Mwaikambo <zwane@linux.realnet.co.sz>, freebsd-hackers@FreeBSD.org
Subject:   Re: UDMA33 and SiS5591 on FreeBSD 4.4-RELEASE
Message-ID:  <3C09D6F9.7070504@ns.aus.com>
References:  <Pine.LNX.4.33.0112011343270.11026-100000@netfinity.realnet.co.sz> <200112011205.fB1C5r243828@freebsd.dk> <20011202115509.B61248@monorchid.lemis.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------040102020405080608020000
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Greg Lehey wrote:

> On Saturday,  1 December 2001 at 13:05:53 +0100, Søren Schmidt wrote:
> 
>>It seems Zwane Mwaikambo wrote:
>>
>>>Hi,
>>>	I've got a box which boots up with UDMA33 but during the boot
>>>sequence gets write problems and ends up disabling it and i presume
>>>falling back to PIO4. I've tested the same box on Linux 2.4.2+ and have
>>>had no problems running it at UDMA33.
>>>
>>>Host: SiS 5591 (revision?)
>>>Disk: Seagate 3.2G ATA2
>>>
>>Ohhh, I need alot more info before I can tell whats going on..
>>I need at least the dmesg from a verbosely booted system and
>>also a pciconf -l to tell what chips you have.
>>
> 
> Note that there are other chips out there which return the same PCI
> information but which appear to be capable of ATA 100.  I recently
> gave a patch to Richard Sharpe (copied) which he says was able to get
> his "SiS 5591" to run at ATA 100.  I'm still waiting for feedback from
> him before forwarding it to you.  I also have a machine with a "SiS
> 5591" which can't go beyond ATA 33.  Here are the pciconf outputs for
> each chip:
> 
> Mine (ATA 33):
> 
> atapci0@pci0:0:1:       class=0x01018a card=0x00000000 chip=0x55131039 rev=0xd0 hdr=0x00
> 
> Richard's (ATA 100):
>                pci0:0:1 Class=0x010180 card=0x55131039 chip=0x55131039 red=0xd0 hdr=0x00
> 
> Dwayne's:
> 
> atapci0@pci0:0:1:       class=0x010180 card=0x55131039 chip=0x55131039 rev=0xd0 hdr=0x00
> 
> I don't understand why Richard's output is missing the atapci@ at the
> beginning.  I believe he was using 4.3-RELEASE at this point; mine was
> from 4-STABLE of May this year.

Here is what pciconf gives me:

atapci0@pci0:0:1:     class=0x010180 card=0x55131039 chip=0x55131039 
rev=0xd0 hdr=0x00

Attached is the patch I am using, which is based on what Greg gave me. 
It tries UDMA5 first, and steps down ...

-- 
Richard Sharpe, rsharpe@ns.aus.com, LPIC-1
www.samba.org, www.ethereal.com, SAMS Teach Yourself Samba
in 24 Hours, Special Edition, Using Samba

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

--- ata-dma.c.orig	Wed Oct 31 07:29:52 2001
+++ ata-dma.c	Fri Nov 30 14:38:52 2001
@@ -519,30 +519,61 @@
 	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 (bootverbose)
+	    printf ("SiS 5513/5591, udmamode %d\n", udmamode);
+	if (pci_get_revid(parent) > 0xc1) {
+	    udmamode = 5;                   /* Force it to 100 */
+	    if (udmamode >= 5) {            /* Claims UDMA 100 */
+		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, 0x40 + (devno << 1), 0xa301, 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) {            /* Claims UDMA 66 */
+		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, 0x40 + (devno << 1), 0xa301, 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, 0x40 + (devno << 1), 0xa301, 2);
+		    scp->mode[ATA_DEV(device)] = ATA_UDMA2;
+		    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;
+		}
 	    }
 	}
 	/* we could set PIO mode timings, but we assume the BIOS did that */

--------------040102020405080608020000--


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




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