From frank@dynamical-systems.org  Wed Dec  5 13:43:08 2007
Return-Path: <frank@dynamical-systems.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E4FC816A469
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  5 Dec 2007 13:43:08 +0000 (UTC)
	(envelope-from frank@dynamical-systems.org)
Received: from mout0.freenet.de (mout0.freenet.de [IPv6:2001:748:100:40::2:2])
	by mx1.freebsd.org (Postfix) with ESMTP id 511E513C474
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  5 Dec 2007 13:43:08 +0000 (UTC)
	(envelope-from frank@dynamical-systems.org)
Received: from [195.4.92.10] (helo=0.mx.freenet.de)
	by mout0.freenet.de with esmtpa (Exim 4.68)
	(envelope-from <frank@dynamical-systems.org>)
	id 1IzuWo-000836-On
	for FreeBSD-gnats-submit@freebsd.org; Wed, 05 Dec 2007 14:43:06 +0100
Received: from p508e8c7c.dip0.t-ipconnect.de ([80.142.140.124]:62685 helo=pollux.senax.net)
	by 0.mx.freenet.de with esmtpsa (ID jr-relay@freenet.de) (TLSv1:AES256-SHA:256) (port 25) (Exim 4.68 #1)
	id 1IzuWo-0001Pe-Es
	for FreeBSD-gnats-submit@freebsd.org; Wed, 05 Dec 2007 14:43:06 +0100
Received: from pollux.senax.net (localhost.senax.net [127.0.0.1])
	by pollux.senax.net (8.13.6/8.13.6) with ESMTP id lB5Dh4sD001385;
	Wed, 5 Dec 2007 14:43:04 +0100 (CET)
	(envelope-from frank@dynamical-systems.org)
Received: (from josellis@localhost)
	by pollux.senax.net (8.13.6/8.13.6/Submit) id lB5Dh3lX001384;
	Wed, 5 Dec 2007 14:43:03 +0100 (CET)
	(envelope-from frank@dynamical-systems.org)
Message-Id: <200712051343.lB5Dh3lX001384@pollux.senax.net>
Date: Wed, 5 Dec 2007 14:43:03 +0100 (CET)
From: "Frank W. Josellis" <frank@dynamical-systems.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Troublesome DMA modes with VIA Apollo VP
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         118447
>Category:       kern
>Synopsis:       [ata] [patch] Troublesome DMA modes with VIA Apollo VP
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 05 13:50:01 UTC 2007
>Closed-Date:    
>Last-Modified:  Thu Jan 31 13:58:03 UTC 2013
>Originator:     Frank W. Josellis
>Release:        FreeBSD 5.5-STABLE i386
>Organization:
>Environment:
System: FreeBSD pollux.senax.net 5.5-STABLE FreeBSD 5.5-STABLE #17: Wed Oct 31 16:22:23 CET 2007 root@pollux.senax.net:/usr/obj/usr/src/sys/POLLUX i386


	
>Description:
Currently FreeBSD appears to have a problem distinguishing correctly between
the various revisions of the VIA VT82C586 southbridge. The chip id table in 
src/sys/dev/ata/ata-chipset.c assigns rev=0x02 to the 82C586B,

    static struct ata_chip_id ids[] =
    {{ ATA_VIA82C586, 0x02, VIA33,  0x00,    ATA_UDMA2, "82C586B" },
     { ATA_VIA82C586, 0x00, VIA33,  0x00,    ATA_WDMA2, "82C586" },

whereas rev=0x02 actually describes the 82C586A which, unfortunately, is not 
fully UDMA2 compliant. As a consequence, such a system with an Ultra DMA HDD 
attached fails to boot unless ATA DMA is disabled by the loader. By the way,
rev=0x03 was correctly assigned to the 82C586B in FreeBSD 4. 

Thus WDMA2 seems to be a safe setting for the 82C586A. However, in contrast 
to the rev=0x00 chip it offers the possiblity to use a bus master IDE driver.
I couldn't find any related technical documentation at via.com -- maybe it's
gone -- but as my board is actually a FIC PA-2005, I got some information on
this from the manufacturer:
http://taiwan.fic.com.tw/support/motherboard/faq.aspx?type=udma#qid496

As a side remark, the bus master mode is also what the Linux kernel is using 
here, that's what I see from booting a Linux Live-CD for diagnostics.  

>How-To-Repeat:
	
>Fix:

	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Dec 17 04:19:53 UTC 2007 
Responsible-Changed-Why:  
This does not sound i386-specific. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118447 

From: "Frank W. Josellis" <frank@dynamical-systems.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/118447: [ata] Troublesome DMA modes with VIA Apollo VP
Date: Sat, 5 Jan 2008 16:28:41 +0100 (CET)

 ERRATUM:
 Meanwhile I learned that my southbridge "chip=0x05861106 rev=0x02" is just 
 a VT82C586, without a trailing 'A'. There is indeed no such letter marked 
 on the chip, and according to the web article [1] the A-chip is actually 
 supposed to support UDMA:
 
 <quote>
 The 586 originally had no USB or Ultra DMA.  VIA added these features with 
 the 586A, and then ACPI with the 586B.  The 586B is the same as an AMD-645 
 chip.
 </quote>
 
 Last but not least, the Linux kernel assigns the following revs to the 
 various chips:
 
 rev 0x00 - 0x0f -> 82C586
 rev 0x20 - 0x2f -> 82C586A
 rev 0x30 - 0x4f -> 82C586B
 
 Provided that this is correct, the below patch presumably solves the whole 
 problem for FreeBSD.
 
 Frank Josellis
 
 References:
 [1] http://www.ds-computing.com/chipset.htm
 
 
 --- patch begins here ---
 --- ata-chipset.c.orig	Wed Jun  1 16:39:01 2005
 +++ ata-chipset.c	Sat Jan  5 16:11:28 2008
 @@ -2784,7 +2784,7 @@
      struct ata_pci_controller *ctlr = device_get_softc(dev);
      struct ata_chip_id *idx;
      static struct ata_chip_id ids[] =
 -    {{ ATA_VIA82C586, 0x02, VIA33,  0x00,   ATA_UDMA2, "VIA 82C586B" },
 +    {{ ATA_VIA82C586, 0x20, VIA33,  0x00,   ATA_UDMA2, "VIA 82C586A" },
       { ATA_VIA82C586, 0x00, VIA33,  0x00,   ATA_WDMA2, "VIA 82C586" },
       { ATA_VIA82C596, 0x12, VIA66,  VIACLK, ATA_UDMA4, "VIA 82C596B" },
       { ATA_VIA82C596, 0x00, VIA33,  0x00,   ATA_UDMA2, "VIA 82C596" },
 --- patch ends here ---
 
Responsible-Changed-From-To: freebsd-bugs->sos 
Responsible-Changed-By: remko 
Responsible-Changed-When: Mon Jan 7 17:30:16 UTC 2008 
Responsible-Changed-Why:  
Over to Soren for evaluation 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118447 
Responsible-Changed-From-To: sos->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Tue May 12 04:45:07 UTC 2009 
Responsible-Changed-Why:  
sos@ is not actively working on ATA-related PRs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118447 
Responsible-Changed-From-To: freebsd-bugs->eadler 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Fri Nov 9 13:34:56 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118447 
Responsible-Changed-From-To: eadler->freebsd-bugs 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Thu Jan 31 13:58:02 UTC 2013 
Responsible-Changed-Why:  
sorry I held on to this for so long;   at the moment I have no time to 
look at this PR so return to the pool 

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