From xdivac02@stud.fit.vutbr.cz  Sat Jul 17 12:52:33 2004
Return-Path: <xdivac02@stud.fit.vutbr.cz>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0B99B16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 17 Jul 2004 12:52:33 +0000 (GMT)
Received: from eva.fit.vutbr.cz (eva.fit.vutbr.cz [147.229.10.14])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 09D6F43D41
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 17 Jul 2004 12:52:32 +0000 (GMT)
	(envelope-from xdivac02@stud.fit.vutbr.cz)
Received: from eva.fit.vutbr.cz (localhost [127.0.0.1])
	by eva.fit.vutbr.cz (8.12.11/8.12.11) with ESMTP id i6HCqSqV078201
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 17 Jul 2004 14:52:28 +0200 (CEST)
Received: (from xdivac02@localhost)
	by eva.fit.vutbr.cz (8.12.11/8.12.5/Submit) id i6HCqSPu078200;
	Sat, 17 Jul 2004 14:52:28 +0200 (CEST)
Message-Id: <200407171252.i6HCqSPu078200@eva.fit.vutbr.cz>
Date: Sat, 17 Jul 2004 14:52:28 +0200 (CEST)
From: Divacky Roman <xdivac02@stud.fit.vutbr.cz>
Reply-To: Divacky Roman <xdivac02@stud.fit.vutbr.cz>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: repair of broken via ata controllers
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         69180
>Category:       kern
>Synopsis:       repair of broken via ata controllers
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jul 17 13:00:35 GMT 2004
>Closed-Date:    Sat Jul 17 14:49:20 GMT 2004
>Last-Modified:  Sat Jul 17 14:49:20 GMT 2004
>Originator:     Divacky Roman
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
home
>Environment:
5.2-CURRENT

	
>Description:
Patch which repairs broken via ata controllers (8237, 8235 and 8233a).
These controllers are broken, we cannot reprogram their timing settings.

>How-To-Repeat:
Try one of these atacontrollers (8237, 8235 or 8233a) with udma higher than
udma2 (aka udma33). It hangs...

>Fix:

--- /root/ata-pci.h	Sat Jul 17 14:39:06 2004
+++ ata-pci.h	Sat Jul 17 14:38:03 2004
@@ -291,6 +291,7 @@
 #define NVIDIA		0x04
 #define VIACLK		0x08
 #define VIABUG		0x10
+#define VIAAST		0x20
 
 /* global prototypes */
 int ata_legacy(device_t);
--- /root/ata-chipset.c	Sat Jul 17 14:34:12 2004
+++ ata-chipset.c	Sat Jul 17 14:36:00 2004
@@ -2565,9 +2565,9 @@
      { ATA_VIA8231,   0x00, VIA100, VIABUG, ATA_UDMA5, "VIA 8231" },
      { ATA_VIA8233,   0x00, VIA100, 0x00,   ATA_UDMA5, "VIA 8233" },
      { ATA_VIA8233C,  0x00, VIA100, 0x00,   ATA_UDMA5, "VIA 8233C" },
-     { ATA_VIA8233A,  0x00, VIA133, 0x00,   ATA_UDMA6, "VIA 8233A" },
-     { ATA_VIA8235,   0x00, VIA133, 0x00,   ATA_UDMA6, "VIA 8235" },
-     { ATA_VIA8237,   0x00, VIA133, 0x00,   ATA_UDMA6, "VIA 8237" },
+     { ATA_VIA8233A,  0x00, VIA133, VIAAST,   ATA_UDMA6, "VIA 8233A" },
+     { ATA_VIA8235,   0x00, VIA133, VIAAST,   ATA_UDMA6, "VIA 8235" },
+     { ATA_VIA8237,   0x00, VIA133, VIAAST,   ATA_UDMA6, "VIA 8237" },
      { 0, 0, 0, 0, 0, 0 }};
     static struct ata_chip_id new_ids[] =
     {{ ATA_VIA6410, 0x00, 0x00,	  0x00,	  ATA_UDMA6, "VIA 6410" },
@@ -2695,7 +2695,8 @@
     if (ctlr->chip->cfg2 & NVIDIA)
 	reg += 0x10;
 
-    pci_write_config(parent, reg - 0x08, timings[ata_mode2idx(mode)], 1);
i+    if (~ctlr->chip->cfg2 & VIAAST)
+       pci_write_config(parent, reg - 0x08, timings[ata_mode2idx(mode)], 1);
 
     error = ata_controlcmd(atadev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode);
 
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Sat Jul 17 13:57:13 GMT 2004 
State-Changed-Why:  
Fixed in -current (but differently than this patch). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=69180 
>Unformatted:
