From nobody@FreeBSD.org  Tue Feb  6 11:26:45 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 811DB16A403
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  6 Feb 2007 11:26:45 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id 70A6213C46B
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  6 Feb 2007 11:26:45 +0000 (UTC)
	(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 l16BQhmc093904
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 6 Feb 2007 11:26:43 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l16BQgxx093898;
	Tue, 6 Feb 2007 11:26:42 GMT
	(envelope-from nobody)
Message-Id: <200702061126.l16BQgxx093898@www.freebsd.org>
Date: Tue, 6 Feb 2007 11:26:42 GMT
From: Edwin Mons<freebsd@edwinm.ik.nu>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Add support for nForce MCP61 chipset
X-Send-Pr-Version: www-3.0

>Number:         108830
>Category:       kern
>Synopsis:       [patch] Add support for nForce MCP61 chipset (nve and smb)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    remko
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 06 11:30:15 GMT 2007
>Closed-Date:    Wed Nov 14 19:42:46 UTC 2007
>Last-Modified:  Wed Nov 14 19:50:00 UTC 2007
>Originator:     Edwin Mons
>Release:        6.2-RELEASE
>Organization:
IK.NU
>Environment:
FreeBSD mag5.ik.nu 6.2-RELEASE FreeBSD 6.2-RELEASE #4: Sun Feb  4 13:22:25 CET 2007     root@mag5.ik.nu:/usr/obj/usr/src/sys/MAG-V  i386

>Description:
Newer nForce chipsets made by nvidia are not yet supported by FreeBSD.
The attached patch adds the device id's of the smbus controller, ata
controllers and NIC of the MCP61 (amongst others).

The MCP19 version of the nForce NIC appears to have the MAC address stored
in the correct order.  Documentation suggests that others do not need the
reversal, either.  According to the Linux forcedeth.c driver, there's a
bit (0x0008000) in the NvRegTransmitPoll register (base + 0x10c) in the
PCI configuration, but I'm afraid I don't really know how to add this in
FreeBSD.  The hardcoded check on the MCP19 is certainly not the one that
should be used if this is added to the tree.

One thing I noticed with the nve on my chipset (nForce 6600 + 405), is
that using NFS over UDP results in an almost instant panic (when writing
a 256MB file, only 2~3 MB is received at the remote and before the machine
crashes with a register dump).  NFS over TCP is rock solid.

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- ./dev/ata/ata-pci.h.orig	Sat Feb  3 22:09:45 2007
+++ ./dev/ata/ata-pci.h	Sat Feb  3 22:11:20 2007
@@ -211,16 +211,19 @@
 #define ATA_NFORCE_CK804_S1     0x005410de
 #define ATA_NFORCE_CK804_S2     0x005510de
 #define ATA_NFORCE_MCP51        0x026510de
 #define ATA_NFORCE_MCP51_S1     0x026610de
 #define ATA_NFORCE_MCP51_S2     0x026710de
 #define ATA_NFORCE_MCP55        0x036e10de
 #define ATA_NFORCE_MCP55_S1     0x037e10de
 #define ATA_NFORCE_MCP55_S2     0x037f10de
+#define ATA_NFORCE_MCP61        0x03ec10de
+#define ATA_NFORCE_MCP61_S1     0x03f610de
+#define ATA_NFORCE_MCP61_S2     0x03f710de
 
 #define ATA_PROMISE_ID          0x105a
 #define ATA_PDC20246            0x4d33105a
 #define ATA_PDC20262            0x4d38105a
 #define ATA_PDC20263            0x0d38105a
 #define ATA_PDC20265            0x0d30105a
 #define ATA_PDC20267            0x4d30105a
 #define ATA_PDC20268            0x4d68105a
--- ./dev/ata/ata-chipset.c.orig	Sat Feb  3 22:09:56 2007
+++ ./dev/ata/ata-chipset.c	Sat Feb  3 22:11:54 2007
@@ -2823,16 +2823,19 @@
      { ATA_NFORCE_CK804_S1, 0, 0,         NV4,     ATA_SA300, "nForce CK804" },
      { ATA_NFORCE_CK804_S2, 0, 0,         NV4,     ATA_SA300, "nForce CK804" },
      { ATA_NFORCE_MCP51,    0, AMDNVIDIA, NVIDIA,  ATA_UDMA6, "nForce MCP51" },
      { ATA_NFORCE_MCP51_S1, 0, 0,         NV4|NVQ, ATA_SA300, "nForce MCP51" },
      { ATA_NFORCE_MCP51_S2, 0, 0,         NV4|NVQ, ATA_SA300, "nForce MCP51" },
      { ATA_NFORCE_MCP55,    0, AMDNVIDIA, NVIDIA,  ATA_UDMA6, "nForce MCP55" },
      { ATA_NFORCE_MCP55_S1, 0, 0,         NV4|NVQ, ATA_SA300, "nForce MCP55" },
      { ATA_NFORCE_MCP55_S2, 0, 0,         NV4|NVQ, ATA_SA300, "nForce MCP55" },
+     { ATA_NFORCE_MCP61,    0, AMDNVIDIA, NVIDIA,  ATA_UDMA6, "nForce MCP61" },
+     { ATA_NFORCE_MCP61_S1, 0, 0,         NV4|NVQ, ATA_SA300, "nForce MCP61" },
+     { ATA_NFORCE_MCP61_S2, 0, 0,         NV4|NVQ, ATA_SA300, "nForce MCP61" },
      { 0, 0, 0, 0, 0, 0}} ;
     char buffer[64] ;
 
     if (!(idx = ata_match_chip(dev, ids)))
 	return ENXIO;
 
     sprintf(buffer, "nVidia %s %s controller",
 	    idx->text, ata_mode2str(idx->max_dma));
--- ./dev/nve/if_nvereg.h.orig	Sat Feb  3 22:02:39 2007
+++ ./dev/nve/if_nvereg.h	Sat Feb  3 22:41:29 2007
@@ -43,16 +43,22 @@
 #define	NFORCE_MCPNET6_DEVICEID 0x00E6
 #define	NFORCE_MCPNET7_DEVICEID 0x00DF
 #define	NFORCE_MCPNET8_DEVICEID 0x0056
 #define	NFORCE_MCPNET9_DEVICEID 0x0057
 #define	NFORCE_MCPNET10_DEVICEID 0x0037
 #define	NFORCE_MCPNET11_DEVICEID 0x0038 
 #define	NFORCE_MCPNET12_DEVICEID 0x0268
 #define	NFORCE_MCPNET13_DEVICEID 0x0269
+#define	NFORCE_MCPNET14_DEVICEID 0x0372
+#define	NFORCE_MCPNET15_DEVICEID 0x0373
+#define	NFORCE_MCPNET16_DEVICEID 0x03e5
+#define	NFORCE_MCPNET17_DEVICEID 0x03e6 
+#define	NFORCE_MCPNET18_DEVICEID 0x03ee
+#define	NFORCE_MCPNET19_DEVICEID 0x03ef
 
 #define	NV_RID		0x10
 
 #define	TX_RING_SIZE	64
 #define	RX_RING_SIZE	64
 #define	NV_MAX_FRAGS	32	// match adapter.h:ADAPTER_WRITE_DATA.sElement[]
 
 #define	FCS_LEN 4
--- ./dev/nve/if_nve.c.orig	Sat Feb  3 22:02:47 2007
+++ ./dev/nve/if_nve.c	Sat Feb  3 23:22:56 2007
@@ -232,16 +232,24 @@
 	{NVIDIA_VENDORID, NFORCE_MCPNET10_DEVICEID,
 	"NVIDIA nForce MCP10 Networking Adapter"},
 	{NVIDIA_VENDORID, NFORCE_MCPNET11_DEVICEID,
 	"NVIDIA nForce MCP11 Networking Adapter"},
 	{NVIDIA_VENDORID, NFORCE_MCPNET12_DEVICEID,
 	"NVIDIA nForce MCP12 Networking Adapter"},
 	{NVIDIA_VENDORID, NFORCE_MCPNET13_DEVICEID,
 	"NVIDIA nForce MCP13 Networking Adapter"},
+	{NVIDIA_VENDORID, NFORCE_MCPNET16_DEVICEID,
+	"NVIDIA nForce MCP16 Networking Adapter"},
+	{NVIDIA_VENDORID, NFORCE_MCPNET17_DEVICEID,
+	"NVIDIA nForce MCP17 Networking Adapter"},
+	{NVIDIA_VENDORID, NFORCE_MCPNET18_DEVICEID,
+	"NVIDIA nForce MCP18 Networking Adapter"},
+	{NVIDIA_VENDORID, NFORCE_MCPNET19_DEVICEID,
+	"NVIDIA nForce MCP19 Networking Adapter"},
 	{0, 0, NULL}
 };
 
 /* DMA MEM map callback function to get data segment physical address */
 static void
 nve_dmamap_cb(void *arg, bus_dma_segment_t * segs, int nsegs, int error)
 {
 	if (error)
@@ -485,18 +493,28 @@
 	bzero(&sc->adapterdata, sizeof(sc->adapterdata));
 	
 	sc->adapterdata.ulMediaIF = sc->media;
 	sc->adapterdata.ulModeRegTxReadCompleteEnable = 1;
 	sc->hwapi->pfnSetCommonData(sc->hwapi->pADCX, &sc->adapterdata);
 	
 	/* MAC is loaded backwards into h/w reg */
 	sc->hwapi->pfnGetNodeAddress(sc->hwapi->pADCX, sc->original_mac_addr);
-	for (i = 0; i < 6; i++) {
-		eaddr[i] = sc->original_mac_addr[5 - i];
+	if (pci_get_device(dev) == NFORCE_MCPNET19_DEVICEID)
+	{
+		/* Already in the right order */
+		for (i = 0; i < 6; i++) {
+			eaddr[i] = sc->original_mac_addr[i];
+		}
+	}
+	else
+	{
+		for (i = 0; i < 6; i++) {
+			eaddr[i] = sc->original_mac_addr[5 - i];
+		}
 	}
 	sc->hwapi->pfnSetNodeAddress(sc->hwapi->pADCX, eaddr);
 
 	/* Display ethernet address ,... */
 	device_printf(dev, "Ethernet address %6D\n", eaddr, ":");
 
 	/* Allocate interface structures */
 	ifp = sc->ifp = if_alloc(IFT_ETHER);
--- ./pci/nfsmb.c.orig	Sat Feb  3 22:08:10 2007
+++ ./pci/nfsmb.c	Sat Feb  3 22:09:09 2007
@@ -32,16 +32,17 @@
 #define	NFSMB_DEVICEID_NF2_SMB		0x0064
 #define	NFSMB_DEVICEID_NF2_ULTRA_SMB	0x0084
 #define	NFSMB_DEVICEID_NF3_PRO150_SMB	0x00d4
 #define	NFSMB_DEVICEID_NF3_250GB_SMB	0x00e4
 #define	NFSMB_DEVICEID_NF4_SMB		0x0052
 #define	NFSMB_DEVICEID_NF4_04_SMB	0x0034
 #define	NFSMB_DEVICEID_NF4_51_SMB	0x0264
 #define	NFSMB_DEVICEID_NF4_55_SMB	0x0368
+#define	NFSMB_DEVICEID_NF4_61_SMB	0x03eb
 
 /* PCI Configuration space registers */
 #define	NF2PCI_SMBASE_1		PCIR_BAR(4)
 #define	NF2PCI_SMBASE_2		PCIR_BAR(5)
 
 /*
  * ACPI 3.0, Chapter 12, SMBus Host Controller Interface.
  */
@@ -118,16 +119,17 @@
 		case NFSMB_DEVICEID_NF2_SMB:
 		case NFSMB_DEVICEID_NF2_ULTRA_SMB:
 		case NFSMB_DEVICEID_NF3_PRO150_SMB:
 		case NFSMB_DEVICEID_NF3_250GB_SMB:
 		case NFSMB_DEVICEID_NF4_SMB:
 		case NFSMB_DEVICEID_NF4_04_SMB:
 		case NFSMB_DEVICEID_NF4_51_SMB:
 		case NFSMB_DEVICEID_NF4_55_SMB:
+		case NFSMB_DEVICEID_NF4_61_SMB:
 			device_set_desc(dev, "nForce2/3/4 MCP SMBus Controller");
 			return (BUS_PROBE_DEFAULT);
 		}
 	}
 
 	return (ENXIO);
 }
 
@@ -200,16 +202,17 @@
 	case NFSMB_DEVICEID_NF2_SMB:
 	case NFSMB_DEVICEID_NF2_ULTRA_SMB:
 	case NFSMB_DEVICEID_NF3_PRO150_SMB:
 	case NFSMB_DEVICEID_NF3_250GB_SMB:
 	case NFSMB_DEVICEID_NF4_SMB:
 	case NFSMB_DEVICEID_NF4_04_SMB:
 	case NFSMB_DEVICEID_NF4_51_SMB:
 	case NFSMB_DEVICEID_NF4_55_SMB:
+	case NFSMB_DEVICEID_NF4_61_SMB:
 		/* Trying to add secondary device as slave */
 		nfsmb_sc->subdev = device_add_child(dev, "nfsmb", -1);
 		if (!nfsmb_sc->subdev)
 			return (EINVAL);
 		break;
 	default:
 		break;
 	}

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->remko 
Responsible-Changed-By: remko 
Responsible-Changed-When: Tue Feb 6 11:31:36 UTC 2007 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108830 
State-Changed-From-To: open->feedback 
State-Changed-By: remko 
State-Changed-When: Thu Jun 28 06:20:59 UTC 2007 
State-Changed-Why:  
I asked for feedback regarding the nve (->nfe) driver and to test this 
on 6-STABLE if possible, reflect that in the ticket 

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

Adding to audit trail manually by linimon:

 sos@ has committed the device IDs already.  I used that as the basis
 to close the similar, but not identical, kern/108830.


From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/108830: commit references a PR
Date: Thu,  4 Oct 2007 21:48:32 +0000 (UTC)

 chinsan     2007-10-04 21:48:17 UTC
 
   FreeBSD doc repository
 
   Modified files:
     en/platforms/amd64   motherboards.sgml 
   Log:
   - Add the entry of Gigabyte GA-M61P-S3.
   
   PR:             www/116880, kern/108830
   Submitter:      clemens fischer <ino-news at spotteswoode.dnsalias.org>
   
   Revision  Changes    Path
   1.133     +13 -1     www/en/platforms/amd64/motherboards.sgml
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: clemens fischer <ino-qc@spotteswoode.de.eu.org>
To: remko@FreeBSD.org, Edwin Mons <freebsd@edwinm.ik.nu>,
	bug-followup@freebsd.org
Cc:  
Subject: Re: kern/108830: [patch] Add support for nForce MCP61 chipset (nve
	and smb)
Date: Fri, 12 Oct 2007 13:43:11 +0200

 hi there.
 
 'uname -rms' -> FreeBSD 7.0-PRERELEASE amd64.  I'm tracking RELENG_7 and
 rebuilt userland + kernel yesterday.  i tested the system with and
 without the patch.  without the patch onboard LAN doesn't work with
 either nfe(4) or nve(4), nor does nfsmb(4).  with the patch applied,
 i get to use nve(4) and nfsmb(4).
 
 at this point in time edwins patch is the most important to me, because
 it lets me use the onboard GIGABIT ethernet chip. the board is gigabytes
 "M61P-S3". it is not really new, but some of its PCI-IDs are missing in
 a few of freebsds tables.
 
 the patch doesn't apply cleanly anymore. the following parts are
 obsolete:
 
 - /sys/dev/ata/ata-pci.h and /sys/dev/ata/ata-chipset.c
 
   freebsd now contains ATA_NFORCE_MCP61* chip-IDs for SATA300.
 
 the following parts apply and are needed:
 
 - /sys/dev/nve/if_nvereg.h and /sys/dev/nve/if_nve.c
 
   without them, the LAN can't be made to work. nfe(4) doesn't cut it
   on my machine, although the PCI-IDs seem to be there.  I tried to
   ifconfig(8) it the same as the working nve(4), but no go.
 
 the following part doesn't apply, but is needed to let nfsmb(4) attach
 to a SMB device:
 
 - /sys/pci/nfsmb.c
 
   the only (non-X11) system-monitoring program that is usable for me,
   ports/sysutils/mbmon, won't use SMBus access even with the patch
   applied and the driver attaching the device.
 
 thanks for giving this your attention.  I can't do serious kernel or
 driver programming, but i can test patches and i understand C, so feel
 free to ask me, if i can be of any help.
 
 
 regards, clemens
State-Changed-From-To: feedback->patched 
State-Changed-By: remko 
State-Changed-When: Sat Nov 10 17:12:35 UTC 2007 
State-Changed-Why:  
The only part that is going to get committed from this patch 
is the SMB part, which I just did on -CURRENT. I discussed 
this with the submitter a while ago. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/108830: commit references a PR
Date: Sat, 10 Nov 2007 17:12:13 +0000 (UTC)

 remko       2007-11-10 17:12:08 UTC
 
   FreeBSD src repository
 
   Modified files:
     sys/pci              nfsmb.c 
   Log:
   Add SMB support for the MCP61 chipset.
   
   PR:             108830
   Submitted by:   Edwin Mons <freebsd at edwinm dot ik dot nu>
   Approbed by:    imp (mentor)
   
   Revision  Changes    Path
   1.7       +3 -0      src/sys/pci/nfsmb.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/108830: commit references a PR
Date: Wed, 14 Nov 2007 09:52:22 +0000 (UTC)

 remko       2007-11-14 09:52:16 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     sys/pci              nfsmb.c 
   Log:
   MFC rev 1.7 nfsmb.c
   
     Add SMB support for the MCP61 chipset.
   
     PR: 108830
     Submitted by: Edwin Mons <freebsd at edwinm dot ik dot nu>
     Approbed by: imp (mentor)
   
   Approved by:    imp (mentor, implicit)
   
   Revision  Changes    Path
   1.2.2.4   +3 -0      src/sys/pci/nfsmb.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: remko 
State-Changed-When: Wed Nov 14 19:42:45 UTC 2007 
State-Changed-Why:  
All SMB changes had been committed to all branches, closing the ticket. 
Thanks for the submission! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/108830: commit references a PR
Date: Wed, 14 Nov 2007 19:41:03 +0000 (UTC)

 remko       2007-11-14 19:40:56 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_7)
     sys/pci              nfsmb.c 
   Log:
   MFC rev 1.7 nfsmb.c
   
     Add SMB support for the MCP61 chipset.
   
     PR: 108830
     Submitted by: Edwin Mons <freebsd at edwinm dot ik dot nu>
     Approbed by: imp (mentor)
   
   Approved by:    imp (mentor, implicit)
   Approved by:    re (kensmith)
   
   Revision  Changes    Path
   1.6.2.1   +3 -0      src/sys/pci/nfsmb.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
