From david@dugeem.net  Fri Jun  6 02:18:06 2003
Return-Path: <david@dugeem.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 77A0B37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  6 Jun 2003 02:18:06 -0700 (PDT)
Received: from mail011.syd.optusnet.com.au (mail011.syd.optusnet.com.au [210.49.20.139])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0784643F85
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  6 Jun 2003 02:18:05 -0700 (PDT)
	(envelope-from david@dugeem.net)
Received: from blah.ryde.dugeem.net (c19426.carlnfd1.nsw.optusnet.com.au [211.28.175.9])
	by mail011.syd.optusnet.com.au (8.11.6p2/8.11.6) with ESMTP id h569I3X12893
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 6 Jun 2003 19:18:04 +1000
Received: (from david@localhost)
	by blah.ryde.dugeem.net (8.11.6/8.11.6) id h569I2U66960;
	Fri, 6 Jun 2003 19:18:02 +1000 (EST)
	(envelope-from david.burns@dugeem.net)
Message-Id: <200306060918.h569I2U66960@blah.ryde.dugeem.net>
Date: Fri, 6 Jun 2003 19:18:02 +1000 (EST)
From: David Burns <david.burns@dugeem.net>
Reply-To:
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] dc(4) driver fails to init Intel 21143 Cardbus NIC
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         52980
>Category:       kern
>Synopsis:       [dc] [patch] dc driver fails to init Intel 21143 Cardbus NIC
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    mbr
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 06 02:20:13 PDT 2003
>Closed-Date:    Sat Jan 02 22:50:30 UTC 2010
>Last-Modified:  Sat Jan 02 22:50:30 UTC 2010
>Originator:     David Burns <david.burns@dugeem.net>
>Release:        FreeBSD 5.1-RC1 i386
>Organization:
(this space available for rent)
>Environment:
System: FreeBSD blahblah.ryde.dugeem.net 5.1-RC1 FreeBSD 5.1-RC1 #15: Thu Jun 5 23:42:21 EST 2003 root@:/usr/src/sys/i386/compile/DUGEEM i386
>Description:
Attempting to use a (1998 vintage) Xircom CBE 10/100 Cardbus Ethernet NIC with
5.1-RC1. PCI/Cardbus init successfully identifies card as Intel 21143 NIC, (ie
early Xircom 21143 based Cardbus NIC - this is correct!) but shows incorrect
MAC address of 00:00:00:00:00:00.
NIC would still not work even if MAC address was manually set through ifconfig.
Fix is attached.
>How-To-Repeat:
1. Install FreeBSD 5.1-RC1 on laptop with Cardbus slot(s)
2. Insert Xircom CBE 10/100 Cardbus Ethernet NIC
3. Observe incorrect MAC address
4. ifconfig dc0 ether 00:01:02:03:04:05
5. ifconfig dc0 inet 192.168.63.63/24
6. ifconfig dc0 (output shows inactive status)
>Fix:
1. If 21143 chipset found, test for DC_PCI_CCIS != 0. If yes, then set
	sc->dc_type = DC_TYPE_21143_CB
2. Use new type to obtain MAC address from CIS - same code as DC_TYPE_XIRCOM
3. Need to set 21143 GPIO outputs to MII/SYM (similar to Xircom x3201).
	(Also enable activity LED - needs to be tested on x3201)

See attached diff -u output.
>Release-Note:
>Audit-Trail:

From: David Burns <david.burns@dugeem.net>
To: freebsd-gnats-submit@FreeBSD.org, david.burns@dugeem.net
Cc:  
Subject: Re: kern/52980: [patch] dc(4) driver fails to init Intel 21143 Cardbus
 NIC
Date: Fri, 06 Jun 2003 19:43:00 +1000

 This is a multi-part message in MIME format.
 --------------090801070000020202080409
 Content-Type: text/plain; charset=us-ascii; format=flowed
 Content-Transfer-Encoding: 7bit
 
 ---- /var/log/messages extract ----
 [...]
 Jun  4 00:19:52  kernel: cbb0: <TI1131 PCI-CardBus Bridge> mem 
 0xcc000-0xccfff at device 4.0 on pci0
 Jun  4 00:19:52  kernel: cardbus0: <CardBus bus> on cbb0
 Jun  4 00:19:52  kernel: pccard0: <16-bit PCCard bus> on cbb0
 Jun  4 00:19:52  kernel: pci_cfgintr: 0:4 INTA routed to irq 11
 Jun  4 00:19:52  kernel: cbb1: <TI1131 PCI-CardBus Bridge> mem 
 0xcd000-0xcdfff at device 4.1 on pci0
 Jun  4 00:19:52  kernel: cardbus1: <CardBus bus> on cbb1
 Jun  4 00:19:52  kernel: pccard1: <16-bit PCCard bus> on cbb1
 Jun  4 00:19:52  kernel: pci_cfgintr: 0:4 INTB routed to irq 11
 [...]
 Jun  4 00:19:52  kernel: dc0: <Intel 21143 10/100BaseTX> port 
 0x1000-0x107f mem 0x88000000-0x8800007f irq 11 at device 0.0 on cardbus0
 Jun  4 00:19:52  kernel: dc0: Ethernet address: 00:00:00:00:00:00
 Jun  4 00:19:52  kernel: miibus0: <MII bus> on dc0
 Jun  4 00:19:52  kernel: dcphy0: <Intel 21143 NWAY media interface> on 
 miibus0
 Jun  4 00:19:52  kernel: dcphy0:  10baseT, 10baseT-FDX, 100baseTX, 
 100baseTX-FDX, auto
 [...]
 --- end extract ----
 
 
 --------------090801070000020202080409
 Content-Type: text/plain;
  name="if_dcreg.h-diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="if_dcreg.h-diff"
 
 --- if_dcreg.h-v1.32	Wed Jun  4 16:59:16 2003
 +++ if_dcreg.h	Thu Jun  5 22:12:50 2003
 @@ -78,6 +78,8 @@
  #define DC_TYPE_PNIC		0xA	/* 82c168/82c169 PNIC I */
  #define	DC_TYPE_XIRCOM		0xB	/* Xircom X3201 */
  #define DC_TYPE_CONEXANT	0xC	/* Conexant LANfinity RS7112 */
 +#define DC_TYPE_21143_CB	0xD	/* Intel 21143 Cardbus */
 +					/* eg Xircom CBE 10/100 */
  
  #define DC_IS_MACRONIX(x)			\
  	(x->dc_type == DC_TYPE_98713 ||		\
 @@ -88,7 +90,10 @@
  	(x->dc_type == DC_TYPE_AL981 ||		\
  	 x->dc_type == DC_TYPE_AN985)
  
 -#define DC_IS_INTEL(x)		(x->dc_type == DC_TYPE_21143)
 +#define DC_IS_INTEL(x)				\
 +	(x->dc_type == DC_TYPE_21143 ||		\
 +	 x->dc_type == DC_TYPE_21143_CB)
 +
  #define DC_IS_ASIX(x)		(x->dc_type == DC_TYPE_ASIX)
  #define DC_IS_COMET(x)		(x->dc_type == DC_TYPE_AL981)
  #define DC_IS_CENTAUR(x)	(x->dc_type == DC_TYPE_AN985)
 @@ -97,6 +102,7 @@
  #define DC_IS_PNIC(x)		(x->dc_type == DC_TYPE_PNIC)
  #define	DC_IS_XIRCOM(x)		(x->dc_type == DC_TYPE_XIRCOM)
  #define DC_IS_CONEXANT(x)	(x->dc_type == DC_TYPE_CONEXANT)
 +#define DC_IS_INTEL_CB(x)	(x->dc_type == DC_TYPE_21143_CB)
  
  /* MII/symbol mode port types */
  #define DC_PMODE_MII		0x1
 
 --------------090801070000020202080409
 Content-Type: text/plain;
  name="if_dc.c-diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="if_dc.c-diff"
 
 --- if_dc.c-v1.108	Wed Jun  4 16:59:01 2003
 +++ if_dc.c	Thu Jun  5 23:38:32 2003
 @@ -1984,7 +1984,10 @@
  
  	switch(sc->dc_info->dc_did) {
  	case DC_DEVICEID_21143:
 -		sc->dc_type = DC_TYPE_21143;
 +		if (!pci_read_config(dev, DC_PCI_CCIS, 4))
 +			sc->dc_type = DC_TYPE_21143;
 +		else
 +			sc->dc_type = DC_TYPE_21143_CB;
  		sc->dc_flags |= DC_TX_POLL|DC_TX_USE_TX_INTR;
  		sc->dc_flags |= DC_REDUCED_MII_POLL;
  		/* Save EEPROM contents so we can parse them later. */
 @@ -2161,6 +2164,7 @@
  	case DC_TYPE_CONEXANT:
  		bcopy(sc->dc_srom + DC_CONEXANT_EE_NODEADDR, &eaddr, 6);
  		break;
 +	case DC_TYPE_21143_CB:
  	case DC_TYPE_XIRCOM:
  		/* The MAC comes from the CIS */
  		mac = pci_get_ether(dev);
 @@ -2240,7 +2244,8 @@
  		 * LEDs, and twiddling these bits has adverse effects
  		 * on them. (I.e. you suddenly can't get a link.)
  		 */
 -		if (pci_read_config(dev, DC_PCI_CSID, 4) != 0x80281033)
 +		if (!DC_IS_INTEL_CB(sc) &&
 +		    pci_read_config(dev, DC_PCI_CSID, 4) != 0x80281033)
  			sc->dc_flags |= DC_TULIP_LEDS;
  		error = 0;
  	}
 @@ -2250,15 +2255,17 @@
  		goto fail;
  	}
  
 -	if (DC_IS_XIRCOM(sc)) {
 +	if (DC_IS_INTEL_CB(sc) || DC_IS_XIRCOM(sc)) {
  		/*
  		 * setup General Purpose Port mode and data so the tulip
  		 * can talk to the MII.
 +		 * Also enable the activity LED
  		 */
 -		CSR_WRITE_4(sc, DC_SIAGP, DC_SIAGP_WRITE_EN | DC_SIAGP_INT1_EN |
 +		CSR_WRITE_4(sc, DC_SIAGP, DC_SIAGP_WRITE_EN | DC_SIAGP_INT1_EN |			   DC_SIAGP_LED1 |
  			   DC_SIAGP_MD_GP2_OUTPUT | DC_SIAGP_MD_GP0_OUTPUT);
  		DELAY(10);
  		CSR_WRITE_4(sc, DC_SIAGP, DC_SIAGP_INT1_EN |
 +			   DC_SIAGP_LED1 |
  			   DC_SIAGP_MD_GP2_OUTPUT | DC_SIAGP_MD_GP0_OUTPUT);
  		DELAY(10);
  	}
 @@ -3390,15 +3397,18 @@
  			DC_SETBIT(sc, DC_MX_MAGICPACKET, DC_MX_MAGIC_98715);
  	}
  
 -	if (DC_IS_XIRCOM(sc)) {
 +	if (DC_IS_INTEL_CB(sc) || DC_IS_XIRCOM(sc)) {
  		/*
  		 * setup General Purpose Port mode and data so the tulip
  		 * can talk to the MII.
 +		 * Also enable the activity LED
  		 */
  		CSR_WRITE_4(sc, DC_SIAGP, DC_SIAGP_WRITE_EN | DC_SIAGP_INT1_EN |
 +			   DC_SIAGP_LED1 |
  			   DC_SIAGP_MD_GP2_OUTPUT | DC_SIAGP_MD_GP0_OUTPUT);
  		DELAY(10);
  		CSR_WRITE_4(sc, DC_SIAGP, DC_SIAGP_INT1_EN |
 +			   DC_SIAGP_LED1 |
  			   DC_SIAGP_MD_GP2_OUTPUT | DC_SIAGP_MD_GP0_OUTPUT);
  		DELAY(10);
  	}
 
 --------------090801070000020202080409--
 
Responsible-Changed-From-To: freebsd-bugs->mbr 
Responsible-Changed-By: mbr 
Responsible-Changed-When: Fri Jun 6 11:47:28 PDT 2003 
Responsible-Changed-Why:  
Take this PR. 

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

From: Alex K <lesha@intercaf.ru>
To: freebsd-gnats-submit@FreeBSD.org, david.burns@dugeem.net
Cc:  
Subject: Re: kern/52980: [patch] dc(4) driver fails to init Intel 21143 Cardbus NIC
Date: Fri, 25 Jun 2004 22:12:07 +0400

 With this patch my system panics immediately on card insertion
 just after "dc0: no station address in CIS"
 
 (my MAC is identified ok even with no patch, but LEDs are always
 off and status is always "no carrier")
 
 
 AL.

From: Volker <volker@vwsoft.com>
To: bug-followup@FreeBSD.org, david.burns@dugeem.net, lesha@intercaf.ru
Cc:  
Subject: Re: kern/52980: [dc] [patch] dc driver fails to init Intel 21143
 Cardbus NIC
Date: Sun, 10 Feb 2008 19:10:30 +0100

 David, Alex,
 
 is this issue still valid with later releases (say > 5.3)? Are you
 able to check your NIC with RELENG_6/7/8?
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Wed Feb 13 09:43:59 UTC 2008 
State-Changed-Why:  
Note that submitter has been asked for feedback. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=52980 
State-Changed-From-To: feedback->closed 
State-Changed-By: mbr 
State-Changed-When: Sat Jan 2 22:47:56 UTC 2010 
State-Changed-Why:  
Submitter feedback timeout and the orig intel nic 
is not used a lot anymore. 

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