Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Apr 2000 08:45:11 +0200 (CEST)
From:      Soren Schmidt <sos@freebsd.dk>
To:        jhay@mikom.csir.co.za (John Hay)
Cc:        wkt@cs.adfa.edu.au, freebsd-current@FreeBSD.ORG
Subject:   Re: ATA & 82C596 bug in 4.0-RELEASE?
Message-ID:  <200004040645.IAA94288@freebsd.dk>
In-Reply-To: <200004040419.GAA58585@zibbi.mikom.csir.co.za> from John Hay at "Apr 4, 2000 06:19:36 am"

next in thread | previous in thread | raw e-mail | index | archive | help
It seems John Hay wrote:
> > 
> > I tried to install 4.0-RELEASE on a completely new PC system, but the
> > install failed with ATA write errors and resets. I moved the disk to another
> > PC and installed 4.0 via manual disklabels, newfs, bin + src extraction.
> > 4.0 booted fine on this system (a Dell Optiplex GX1).
> > 
> > Back on the new system, a 993AS motherboard with VIA 82C596 ATA33 controller,
> > and <ST313021A> [25232/16/63] 13Gig disk at ata0-master using UDMA33. It
> > boots and then takes out the root partition, again with ATA write errors and
> > resets.
> ...
> > Can anybody tell me if this 89C596 support is still experimental, or
> > alternatively are there any recent patches/changes which I should pick up?
> > I'm happy to cvsup either from 4.0-stable or 4.0-current if it would help
> > to fix this problem.

Yup VIA has a new version of the 82C596 chip, in their usual visdom they
change the interface, but not the chip ID (I'll nominate VIA for the 
way they do versioning). However I have worked out the solution with
Chris Wiener <cwiener@crlabs.com>, that had this problem also and
kindly helped testing. Se the patch belowm try it and let me know..

> Your question should include the VIA 82C586. :-) The answer will depend
> on who answer it. If it is Soren or one of the lucky ones that have it
> working, they will say everything is fine. For the rest of us with
> machines that don't want to install or that want to eat your disk if you
> install it somewhere else first, the answer is probably different. :-(

Woa! I havn't seen any reports of the '586 not working, please point
me at them. I've seen a couble of cases where it was other known bad
HW that caused trouble. So by all means please forward any problem 
to me, together with verbose boot logs etc and I'll take a look at
it, if there is a problem it should be fixed. However if it is on
HW I dont have access to here, I need someone that has a box that
can be used for testing, ie with filesystems that can be restored/
reinstalled etc etc and have the time and patience to work with me
one the problem.

Index: ata-all.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-all.c,v
retrieving revision 1.50.2.2
diff -u -r1.50.2.2 ata-all.c
--- ata-all.c	2000/03/18 22:26:28	1.50.2.2
+++ ata-all.c	2000/04/03 09:50:43
@@ -211,8 +211,8 @@
     int32_t irqcnt;
 };
 
-static int32_t
-ata_find_dev(device_t dev, int32_t type)
+int32_t
+ata_find_dev(device_t dev, int32_t type, int32_t revid)
 {
     device_t *children, child;
     int nchildren, i;
@@ -226,7 +226,8 @@
 	/* 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)) {
+	    pci_get_device(child) == ((type & 0xffff0000) >> 16) &&
+	    pci_get_revid(child) >= revid) {
 	    free(children, M_TEMP);
 	    return 1;
 	}
@@ -263,11 +264,13 @@
 	return "AcerLabs Aladdin ATA33 controller";
 
     case 0x05711106: 
-	if (ata_find_dev(dev, 0x05861106))
+	if (ata_find_dev(dev, 0x05861106, 0))
 	    return "VIA 82C586 ATA33 controller";
-	if (ata_find_dev(dev, 0x05961106))
+	if (ata_find_dev(dev, 0x05961106, 0x12))
+	    return "VIA 82C596B ATA66 controller";
+	if (ata_find_dev(dev, 0x05961106, 0))
 	    return "VIA 82C596 ATA33 controller";
-	if (ata_find_dev(dev, 0x06861106))
+	if (ata_find_dev(dev, 0x06861106, 0))
 	    return "VIA 82C686 ATA66 controller";
 	return "VIA Apollo ATA controller";
 
@@ -428,8 +431,9 @@
 	pci_write_config(dev, 0x60, DEV_BSIZE, 2);
 	pci_write_config(dev, 0x68, DEV_BSIZE, 2);
 	
-	/* prepare for ATA-66 on the 82C686 */
-	if (ata_find_dev(dev, 0x06861106)) {
+	/* prepare for ATA-66 on the 82C686 and rev 0x12 and newer 82C596's */
+	if (ata_find_dev(dev, 0x06861106, 0) || 
+	    ata_find_dev(dev, 0x05961106, 0x12)) {
 	    pci_write_config(dev, 0x50, 
 			     pci_read_config(dev, 0x50, 4) | 0x070f070f, 4);   
 	}
@@ -697,11 +701,11 @@
     scp->unit = (uintptr_t) device_get_ivars(dev);
 
     /* set the chiptype to the hostchip ID, makes life easier */
-    if (ata_find_dev(device_get_parent(dev), 0x05861106))
+    if (ata_find_dev(device_get_parent(dev), 0x05861106, 0))
 	scp->chiptype = 0x05861106;
-    else if (ata_find_dev(device_get_parent(dev), 0x05961106))
+    else if (ata_find_dev(device_get_parent(dev), 0x05961106, 0))
 	scp->chiptype = 0x05961106;
-    else if (ata_find_dev(device_get_parent(dev), 0x06861106))
+    else if (ata_find_dev(device_get_parent(dev), 0x06861106, 0))
 	scp->chiptype = 0x06861106;
     else
 	scp->chiptype = pci_get_devid(device_get_parent(dev));
Index: ata-all.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-all.h,v
retrieving revision 1.26
diff -u -r1.26 ata-all.h
--- ata-all.h	2000/03/05 16:52:23	1.26
+++ ata-all.h	2000/04/02 20:00:47
@@ -326,6 +326,9 @@
 int ata_pmode(struct ata_params *);
 int ata_wmode(struct ata_params *);
 int ata_umode(struct ata_params *);
+#if NPCI > 0
+int32_t ata_find_dev(device_t, int32_t, int32_t);
+#endif
 
 void ata_dmainit(struct ata_softc *, int32_t, int32_t, int32_t, int32_t);
 int32_t ata_dmasetup(struct ata_softc *, int32_t, int8_t *, int32_t, int32_t);
Index: ata-dma.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-dma.c,v
retrieving revision 1.35
diff -u -r1.35 ata-dma.c
--- ata-dma.c	2000/03/05 16:52:24	1.35
+++ ata-dma.c	2000/04/03 10:00:30
@@ -280,7 +280,24 @@
 	/* we could set PIO mode timings, but we assume the BIOS did that */
 	break;
 
+    case 0x74091022:	/* AMD 756 */
+	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 up UDMA4 mode on AMD chip\n",
+			   (error) ? "failed" : "success");
+	    if (!error) {
+	        pci_write_config(parent, 0x53 - devno, 0xc3, 1);
+		scp->mode[ATA_DEV(device)] = ATA_UDMA4;
+		return;
+	    }
+	}
+	goto via_82c586;
+
     case 0x06861106:	/* VIA 82C686 */
+via_82c686:
 	if (udmamode >= 4) {
 	    error = ata_command(scp, device, ATA_C_SETFEATURES, 0, 0, 0,
 				ATA_UDMA4, ATA_C_F_SETXFER, ATA_WAIT_READY);
@@ -309,25 +326,14 @@
 	}
 	goto via_generic;
 
-    case 0x74091022:	/* AMD 756 */
-	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 up UDMA4 mode on AMD chip\n",
-			   (error) ? "failed" : "success");
-	    if (!error) {
-	        pci_write_config(parent, 0x53 - devno, 0xc3, 1);
-		scp->mode[ATA_DEV(device)] = ATA_UDMA4;
-		return;
-	    }
-	}
+    case 0x05961106:	/* VIA 82C596 */
+	/* 82c596 revision >= 0x12 is like the 82c686 */
+	if (ata_find_dev(parent, 0x05961106, 0x12))
+	    goto via_82c686;
 	/* FALLTHROUGH */
 
-    case 0x05961106:	/* VIA 82C596 */
     case 0x05861106:	/* VIA 82C586 */
-
+via_82c586:
 	/* UDMA2 mode only on 82C586 > rev1, 82C596, AMD 756 */
 	if ((udmamode >= 2 && scp->chiptype == 0x05861106 &&
 	     pci_read_config(scp->dev, 0x08, 1) >= 0x01) ||

-Søren


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




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