From nobody@FreeBSD.org  Fri Mar 11 20:40:53 2005
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 063F116A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Mar 2005 20:40:53 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id DD3CA43D39
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Mar 2005 20:40:52 +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 j2BKeqcc033382
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Mar 2005 20:40:52 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j2BKeqNZ033381;
	Fri, 11 Mar 2005 20:40:52 GMT
	(envelope-from nobody)
Message-Id: <200503112040.j2BKeqNZ033381@www.freebsd.org>
Date: Fri, 11 Mar 2005 20:40:52 GMT
From: jim feldman <security@jim-liesl.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: New nvidia MCP2S chipset SATA no supported by 5.3 release
X-Send-Pr-Version: www-2.3

>Number:         78707
>Category:       kern
>Synopsis:       [patch] New nvidia MCP2S chipset SATA no supported by 5.3 release
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    sos
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 11 20:50:01 GMT 2005
>Closed-Date:    Mon Jun 27 12:34:30 GMT 2005
>Last-Modified:  Mon Jun 27 12:34:30 GMT 2005
>Originator:     jim feldman
>Release:        r.3 release
>Organization:
>Environment:
FreeBSD daemon.clspco.adelphia.net 5.3-RELEASE-p5 FreeBSD 5.3-RELEASE-p5 #2: Thu Mar 10 17:04:39 MST 2005     jmf@daemon.clspco.adelphia.net:/usr/obj/usr/src/sys/DAEMON  i386
>Description:
Abit NF7-S2G (NForce II chipset with embeded SATA, plus a Via Rhine gigE chip)

The embeded SATA controller is not recognised.  The ATA driver falls back to udma33 instead of SATA150.

pciconf -lv yields:
atapci0@pci0:9:0:       class=0x01018a card=0x1c08147b chip=0x008510de rev=0xa3 hdr=0x00
    vendor   = 'NVIDIA Corporation'
    device   = 'MCP2S Parallel ATA Controller'
    class    = mass storage
    subclass = ATA
atapci1@pci0:11:0:      class=0x010185 card=0x1c08147b chip=0x008e10de rev=0xa3 hdr=0x00
    vendor   = 'NVIDIA Corporation'
    device   = 'MCP2S Serial ATA Compatible Controller'
    class    = mass storage
    subclass = ATA

I tried to do a quick fix by adding the ID to ata-pci.h and ata-chipset.c, but that didn't help

>How-To-Repeat:
      
>Fix:
      
>Release-Note:
>Audit-Trail:

From: security@daemon.jim-liesl.org
To: freebsd-gnats-submit@FreeBSD.org, security@jim-liesl.org
Cc:  
Subject: Re: kern/78707: New nvidia MCP2S chipset SATA no supported by 5.3
	release
Date: Sun, 13 Mar 2005 14:05:35 -0700

 fixes based on 75540
 
 diff -Naur sys/dev/ata/ata-pci.h.orig sys/dev/ata/ata-pci.h
 --- sys/dev/ata/ata-pci.h.orig  Thu Mar 10 14:02:23 2005
 +++ sys/dev/ata/ata-pci.h       Sun Mar 13 12:18:14 2005
 @@ -132,6 +132,7 @@
  #define ATA_NFORCE1            0x01bc10de
  #define ATA_NFORCE2            0x006510de
  #define ATA_NFORCE2_MCP                0x008510de
 +#define ATA_NFORCE2_MCP_S2     0x008e10de
  #define ATA_NFORCE3            0x00d510de
  #define ATA_NFORCE3_PRO                0x00e510de
  #define ATA_NFORCE3_PRO_S1     0x00e310de
 
 diff -Naur sys/dev/ata/ata-chipset.c.orig sys/dev/ata/ata-chipset.c
 --- sys/dev/ata/ata-chipset.c.orig      Sun Mar 13 12:20:03 2005
 +++ sys/dev/ata/ata-chipset.c   Sun Mar 13 12:57:03 2005
 @@ -1112,6 +1112,7 @@
      {{ ATA_NFORCE1,     0, AMDNVIDIA, NVIDIA, ATA_UDMA5, "nVidia nForce" },
       { ATA_NFORCE2,     0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce2" },
       { ATA_NFORCE2_MCP, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce2 MCP"
 },
 +     { ATA_NFORCE2_MCP_S2, 0, AMDNVIDIA, NVIDIA, ATA_SA150, "nVidia nForce2
 MCP_S2" },
       { ATA_NFORCE3,     0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3" },
       { ATA_NFORCE3_PRO, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3 Pro"
 },
       { ATA_NFORCE3_MCP, 0, AMDNVIDIA, NVIDIA, ATA_UDMA6, "nVidia nForce3 MCP"
 },
 @@ -2861,9 +2862,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;
  }
 
 
 
 
 ----------------------------------------------------------------
 This message was sent using IMP, the Internet Messaging Program.
Responsible-Changed-From-To: freebsd-bugs->sos 
Responsible-Changed-By: matteo 
Responsible-Changed-When: Sun Jun 19 18:28:35 GMT 2005 
Responsible-Changed-Why:  
Assign this to sos@, since he takes care of ATA/SATA support. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=78707 
State-Changed-From-To: open->closed 
State-Changed-By: sos 
State-Changed-When: Mon Jun 27 12:32:38 GMT 2005 
State-Changed-Why:  
This patch doesn't quite cut it. See 6.0-current for a much better solution. 
The support might get backported to 5.4-stable, or the ATA mkIII patches 
can be used until then. 

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