From nobody@FreeBSD.org  Mon Dec 27 14:27:19 2004
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A0CB016A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Dec 2004 14:27:19 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 626AA43D1F
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Dec 2004 14:27:19 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id iBRERIph060223
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 27 Dec 2004 14:27:19 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id iBRERIH4060222;
	Mon, 27 Dec 2004 14:27:18 GMT
	(envelope-from nobody)
Message-Id: <200412271427.iBRERIH4060222@www.freebsd.org>
Date: Mon, 27 Dec 2004 14:27:18 GMT
From: Sergiy Vyshnevetskiy <serg@vostok.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Incorrect probing/configuration of nVidia nForce3/4 SATA controller
X-Send-Pr-Version: www-2.3

>Number:         75540
>Category:       kern
>Synopsis:       [patch] Incorrect probing/configuration of nVidia nForce3/4 SATA controller
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    sos
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 27 14:30:23 GMT 2004
>Closed-Date:    Mon Apr 11 11:13:55 GMT 2005
>Last-Modified:  Mon Apr 11 11:13:55 GMT 2005
>Originator:     Sergiy Vyshnevetskiy
>Release:        5-stable
>Organization:
>Environment:
FreeBSD serg.vostok.net 5.3-STABLE FreeBSD 5.3-STABLE #0: Mon Dec  6 11:01:12 EET 2004     root@serg.vostok.net:/usr/5/src/sys/i386/compile/SERG  i386
>Description:
Kernel detects nVidia nForce3/nForce4 SATA controller as generic ATA controller - fixed by the first part of the patch.
Then it would say, that you managed to connect an ATA-133(!) disk to SATA controller with 40-pin cable(!), so DMA would be limited to UDMA33. That nonsence is corrected by the second part of the patch.
>How-To-Repeat:
Install FreeBSD on a box with nForce3/nForce4 chipset and attach a SATA HDD to it.
>Fix:
--- sys/dev/ata/ata-chipset.c.orig      Sun Oct 10 18:01:47 2004
+++ sys/dev/ata/ata-chipset.c   Sun Dec  5 23:24:15 2004
@@ -1114,8 +1114,14 @@
      { ATA_NFORCE2_MCP, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce2 MCP" },
      { ATA_NFORCE3,     0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3" },
      { ATA_NFORCE3_PRO, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3 Pro" },
+     { ATA_NFORCE3_PRO_S1, 0, AMDNVIDIA, NVIDIA, ATA_SA150, "nVidia nForce3 Pro" },
+     { ATA_NFORCE3_PRO_S2, 0, AMDNVIDIA, NVIDIA, ATA_SA150, "nVidia nForce3 Pro" },
      { ATA_NFORCE3_MCP, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3 MCP" },
+     { ATA_NFORCE3_MCP_S1, 0, AMDNVIDIA, NVIDIA, ATA_SA150, "nVidia nForce3 MCP" },
+     { ATA_NFORCE3_MCP_S2, 0, AMDNVIDIA, NVIDIA, ATA_SA150, "nVidia nForce3 MCP" },
      { ATA_NFORCE4,     0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce4" },
+     { ATA_NFORCE4_S1,     0, AMDNVIDIA, NVIDIA, ATA_SA150, "nVidia nForce4" },
+     { ATA_NFORCE4_S2,     0, AMDNVIDIA, NVIDIA, ATA_SA150, "nVidia nForce4" },
      { 0, 0, 0, 0, 0, 0}};
     char buffer[64];
 
@@ -2861,9 +2867,17 @@
 static int
 ata_check_80pin(struct ata_device *atadev, int mode)
 {
+    device_t parent = device_get_parent(atadev->channel->dev);
+    struct ata_pci_controller *ctlr = device_get_softc(parent);
+
+    if (mode >= ATA_UDMA2 && mode < ATA_SA150 && ctlr->chip->max_dma >= ATA_SA150) {
+       ata_prtdev(atadev,"DMA set to SA150 for any device attached to SATA controller\n");
+       return ATA_SA150;
+    }
+
     if (mode > ATA_UDMA2 && !(atadev->param->hwres & ATA_CABLE_ID)) {
        ata_prtdev(atadev,"DMA limited to UDMA33, non-ATA66 cable or device\n");
-       mode = ATA_UDMA2;
+       return ATA_UDMA2;
     }
     return mode;
 }


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->sos 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Apr 3 08:12:13 GMT 2005 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=75540 
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Mon Apr 11 11:12:31 GMT 2005 
State-Changed-Why:  
Nforce SATA support including proper PHY handling has been committed to 
-current. 

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