From nobody@FreeBSD.org  Wed Oct  3 05:08:08 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0FE8716A418
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  3 Oct 2007 05:08:08 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id E33DC13C49D
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  3 Oct 2007 05:08:07 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l93587El057602
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 3 Oct 2007 05:08:07 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.1/8.14.1/Submit) id l93587eG057601;
	Wed, 3 Oct 2007 05:08:07 GMT
	(envelope-from nobody)
Message-Id: <200710030508.l93587eG057601@www.freebsd.org>
Date: Wed, 3 Oct 2007 05:08:07 GMT
From: Kudo Chien <ckchien@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: msk watchdog timeout
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         116853
>Category:       kern
>Synopsis:       [msk] msk watchdog timeout
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    yongari
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 03 05:10:07 GMT 2007
>Closed-Date:    Fri Jun 24 00:50:23 UTC 2011
>Last-Modified:  Fri Jun 24 00:50:23 UTC 2011
>Originator:     Kudo Chien
>Release:        7.0-CURRENT
>Organization:
>Environment:
FreeBSD mk12 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Tue Oct  2 22:21:12 CST 2007     root@mk12:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
Whenever I try to get a FreeBSD iso file through ftp (transfer rate is about 3 MB/s), msk would be down. Some messages from dmesg are like:
msk0: watchdog timeout
msk0: link state changed to DOWN
msk0: link state changed to UP
mskc0: Tx descriptor error
mskc0: Tx descriptor error
msk0: watchdog timeout
msk0: link state changed to DOWN
msk0: link state changed to UP

I used FreeBSD 6.2-STABLE before, since there is some related patch for msk at FreeBSD-Current (if_msk.c rev. 1.18). I upgrade to Current, but the problem seems not solved. Certainly, I tried to add hw.msk.legacy_intr="1" in /boot/loader.conf. Whether disabling  MSI or not, the problem is as before. In order to avoid shared interrupt, I've also disabled USB device in BIOS, but not help.

Could you please tell me how to solve this problem.
Thanks a lot

---
My host is Intel Core 2 Duo E6300 + Onboard Marvel 8056 Gigabit LAN Controller (My MB is GA-965G-DS3 of Gigabyte,
http://www.gigabyte.com.tw/Products/Motherboard/Products_Spec.aspx?ClassValue=Motherboard&ProductID=2417&ProductName=GA-965G-DS3)


ifconfig:
msk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:16:e6:de:bf:ed
        inet x.x.x.x netmask 0xffffff00 broadcast x.x.x.x
        media: Ethernet autoselect (1000baseTX <full-duplex,flag2>)
        status: active

boot message:
mskc0: <Marvell Yukon 88E8056 Gigabit Ethernet> port 0xa000-0xa0ff mem 0xf1000000-0xf1003fff irq 16 at device 0.0 on pci3
msk0: <Marvell Technology Group Ltd. Yukon EC Ultra Id 0xb4 Rev 0x02> on mskc0
msk0: Ethernet address: 00:16:e6:de:bf:ed
miibus0: <MII bus> on msk0
e1000phy0: <Marvell 88E1149 Gigabit PHY> PHY 0 on miibus0
e1000phy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX-FDX, auto
mskc0: [ITHREAD]

vmstat -i:
interrupt                          total       rate
irq1: atkbd0                           6          0
irq6: fdc0                             1          0
irq14: ata0                        97074          0
irq15: ata1                          629          0
irq16: mskc0                      288008          1
irq19: atapci0+                     1522          0
cpu0: timer                    421587304       1922
cpu1: timer                    421586922       1922
Total                          843561466       3846


pciconf -lv:
mskc0@pci3:0:0: class=0x020000 card=0xe0001458 chip=0x436411ab rev=0x14 hdr=0x00
    vendor     = 'Marvell Semiconductor (Was: Galileo Technology Ltd)'
    class      = network
    subclass   = ethernet 
>How-To-Repeat:
Get a FreeBSD iso file through ftp (transfer rate is about 3-4 MB/s), and msk would be down.
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->yongari 
Responsible-Changed-By: yongari 
Responsible-Changed-When: Thu Oct 4 01:15:35 UTC 2007 
Responsible-Changed-Why:  
Take 

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

From: Lorenzo Perone <lopez.on.the.lists@yellowspace.net>
To: bug-followup@FreeBSD.org, ckchien@gmail.com
Cc:  
Subject: Re: kern/116853: msk watchdog timeout
Date: Sun, 2 Dec 2007 18:32:36 +0100

 Hi, here are some test results on the same problems, with
 7.0-BETA3 amd64.
 
 The problem persists in the following combinations:
 
 - RELENG_7 (as of Mon Dec  3 00:30:24 CET 2007) amd64,
    carrying if_msk.c v 1.18;
 
 - The same but using if_msk.c v 1.25 (as well as if_mskreg.h,v 1.10)
 
 - The same using both tunables on or off,
       hw.msk.legacy_intr="1"
       hw.msk.msi_disable="1"
       in /boot/loader.conf
 
 Still repeated by:
 Fetching a large file such as a FreeBSD iso (I used: fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/ISO-IMAGES/6.2/6.2-RELEASE-amd64-disc1.iso') 
 .
 After a few MBytes, the card begins with:
 
 msk0: watchdog timeout
 msk0: link state changed to DOWN
 msk0: link state changed to UP
 msk0: watchdog timeout
 msk0: link state changed to DOWN
 msk0: link state changed to UP
 
 Without tuning (that is, without anything in loader.conf)
 I had the impression  that the problem occurs a little bit
 later than with  them set to 1. But basically it doesn't
 seem to change anything.
 
 Are there any chances to get this bug resolved
 by 7.0-RELEASE?
 
 I am available for further tests.
 
 Thank You for Your attention,
 
 Lorenzo Perone
 
 --------------------
 
 Here are the details of my configuration:
 
 uname -a:
 FreeBSD marx.intranet 7.0-BETA3 FreeBSD 7.0-BETA3 #0: Mon Dec  3  
 00:30:24 CET 2007     lopez@marx.intranet:/usr/obj/usr/src/sys/MARX64   
 amd64
 
 pciconf -lv
 mskc0@pci0:1:0:0:	class=0x020000 card=0x81f81043 chip=0x436411ab  
 rev=0x12 hdr=0x00
      vendor     = 'Marvell Semiconductor (Was: Galileo Technology Ltd)'
      device     = '88E8056 Yukon PCI-E Gigabit Ethernet Controller'
      class      = network
      subclass   = ethernet
 
 ifconfig:
 msk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu  
 1500
 	options=19a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4>
 	ether 00:1b:fc:ce:0f:41
 	inet 192.168.1.213 netmask 0xffffff00 broadcast 192.168.1.255
 	media: Ethernet autoselect (100baseTX <full-duplex,flag0,flag1>)
 	status: active
 
 vmstat -i
 interrupt                          total       rate
 irq1: atkbd0                           6          0
 irq6: fdc0                             1          0
 irq16: uhci0 twe0+                  1419          1
 irq20: fwohci0                         3          0
 cpu0: timer                      2615621       1921
 irq256: mskc0                       6082          4
 cpu1: timer                      2605619       1914
 Total                            5228751       3841
 
 boot messages:
 mskc0: <Marvell Yukon 88E8056 Gigabit Ethernet> port 0xc800-0xc8ff mem  
 0xfdffc000-0xfdffffff irq 17 at device 0.0 on pci1
 msk0: <Marvell Technology Group Ltd. Yukon EC Ultra Id 0xb4 Rev 0x03>  
 on mskc0
 msk0: Ethernet address: 00:1b:fc:ce:0f:41
 miibus0: <MII bus> on msk0
 e1000phy0: <Marvell 88E1149 Gigabit PHY> PHY 0 on miibus0
 e1000phy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX- 
 FDX, auto
 mskc0: [FILTER]
 
 

From: Pyun YongHyeon <pyunyh@gmail.com>
To: Lorenzo Perone <lopez.on.the.lists@yellowspace.net>
Cc: yongari@FreeBSD.org, bug-followup@FreeBSD.org
Subject: Re: kern/116853: msk watchdog timeout
Date: Mon, 3 Dec 2007 10:42:27 +0900

 On Sun, Dec 02, 2007 at 05:50:03PM +0000, Lorenzo Perone wrote:
  > The following reply was made to PR kern/116853; it has been noted by GNATS.
  > 
  > From: Lorenzo Perone <lopez.on.the.lists@yellowspace.net>
  > To: bug-followup@FreeBSD.org, ckchien@gmail.com
  > Cc:  
  > Subject: Re: kern/116853: msk watchdog timeout
  > Date: Sun, 2 Dec 2007 18:32:36 +0100
  > 
  >  Hi, here are some test results on the same problems, with
  >  7.0-BETA3 amd64.
  >  
  >  The problem persists in the following combinations:
  >  
  >  - RELENG_7 (as of Mon Dec  3 00:30:24 CET 2007) amd64,
  >     carrying if_msk.c v 1.18;
  >  
  >  - The same but using if_msk.c v 1.25 (as well as if_mskreg.h,v 1.10)
  >  
  >  - The same using both tunables on or off,
  >        hw.msk.legacy_intr="1"
  >        hw.msk.msi_disable="1"
  >        in /boot/loader.conf
  >  
  >  Still repeated by:
  >  Fetching a large file such as a FreeBSD iso (I used: fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/ISO-IMAGES/6.2/6.2-RELEASE-amd64-disc1.iso') 
  >  .
  >  After a few MBytes, the card begins with:
  >  
  >  msk0: watchdog timeout
  >  msk0: link state changed to DOWN
  >  msk0: link state changed to UP
  >  msk0: watchdog timeout
  >  msk0: link state changed to DOWN
  >  msk0: link state changed to UP
  >  
  >  Without tuning (that is, without anything in loader.conf)
  >  I had the impression  that the problem occurs a little bit
  >  later than with  them set to 1. But basically it doesn't
  >  seem to change anything.
  >  
  >  Are there any chances to get this bug resolved
  >  by 7.0-RELEASE?
  >  
  >  I am available for further tests.
  >  
  >  Thank You for Your attention,
  >  
  >  Lorenzo Perone
  >  
  >  --------------------
  >  
  >  Here are the details of my configuration:
  >  
  >  uname -a:
  >  FreeBSD marx.intranet 7.0-BETA3 FreeBSD 7.0-BETA3 #0: Mon Dec  3  
  >  00:30:24 CET 2007     lopez@marx.intranet:/usr/obj/usr/src/sys/MARX64   
  >  amd64
  >  
  >  pciconf -lv
  >  mskc0@pci0:1:0:0:	class=0x020000 card=0x81f81043 chip=0x436411ab  
  >  rev=0x12 hdr=0x00
  >       vendor     = 'Marvell Semiconductor (Was: Galileo Technology Ltd)'
  >       device     = '88E8056 Yukon PCI-E Gigabit Ethernet Controller'
  >       class      = network
  >       subclass   = ethernet
  >  
  >  ifconfig:
  >  msk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu  
  >  1500
  >  	options=19a<TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4>
  >  	ether 00:1b:fc:ce:0f:41
  >  	inet 192.168.1.213 netmask 0xffffff00 broadcast 192.168.1.255
  >  	media: Ethernet autoselect (100baseTX <full-duplex,flag0,flag1>)
  >  	status: active
  >  
  >  vmstat -i
  >  interrupt                          total       rate
  >  irq1: atkbd0                           6          0
  >  irq6: fdc0                             1          0
  >  irq16: uhci0 twe0+                  1419          1
  >  irq20: fwohci0                         3          0
  >  cpu0: timer                      2615621       1921
  >  irq256: mskc0                       6082          4
  >  cpu1: timer                      2605619       1914
  >  Total                            5228751       3841
  >  
  >  boot messages:
  >  mskc0: <Marvell Yukon 88E8056 Gigabit Ethernet> port 0xc800-0xc8ff mem  
  >  0xfdffc000-0xfdffffff irq 17 at device 0.0 on pci1
  >  msk0: <Marvell Technology Group Ltd. Yukon EC Ultra Id 0xb4 Rev 0x03>  
  >  on mskc0
  >  msk0: Ethernet address: 00:1b:fc:ce:0f:41
  >  miibus0: <MII bus> on msk0
  >  e1000phy0: <Marvell 88E1149 Gigabit PHY> PHY 0 on miibus0
  >  e1000phy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX- 
  >  FDX, auto
  >  mskc0: [FILTER]
  >  
  >  
 
 I know the instability issue with 88E8056/88E1149 PHY. Lacking of the
 hardware and documentation for the controller makes me hard to find a
 clue. :(
 
 -- 
 Regards,
 Pyun YongHyeon

From: Sidorkin Oleg <osidorkin@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/116853: [msk] msk watchdog timeout
Date: Tue, 10 Nov 2009 03:41:26 +0300

 It is still reproducible on recent FreeBSD 8.0-RC2 amd/64:
 
 boot message:
 mskc0: <Marvell Yukon 88E8056 Gigabit Ethernet> port 0xd800-0xd8ff mem 
 0xfeafc000-0xfeafffff irq 17 at device 0.0 on pci1
 msk0: <Marvell Technology Group Ltd. Yukon EC Ultra Id 0xb4 Rev 0x03> on 
 mskc0
 msk0: Ethernet address: 00:1b:fc:d4:cf:11
 miibus0: <MII bus> on msk0
 e1000phy0: <Marvell 88E1149 Gigabit PHY> PHY 0 on miibus0
 e1000phy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 
 1000baseT-FDX, auto
 mskc0: [FILTER]
 
 
 mskc0@pci0:1:0:0:       class=0x020000 card=0xe0001458 chip=0x436411ab 
 rev=0x14 hdr=0x00
     vendor     = 'Marvell Semiconductor (Was: Galileo Technology Ltd)'
     device     = 'Yukon PCI-E Gigabit Ethernet Controller (88E8056)'
     class      = network
     subclass   = ethernet
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/116853: commit references a PR
Date: Sun, 14 Mar 2010 23:24:12 +0000 (UTC)

 Author: yongari
 Date: Sun Mar 14 23:23:57 2010
 New Revision: 205161
 URL: http://svn.freebsd.org/changeset/base/205161
 
 Log:
   It seems PCI_OUR_REG_[1-5] registers are not mapped on PCI
   configuration space on Yukon Ultra(88E8056) such that accesses to
   these registers were NOPs which in turn make msk(4) instable on
   this controller. Use indirect access method to access
   PCI_OUR_REG_[1-5] registers. This should fix a long standing
   instability bug which prevented msk(4) working on Yukon Ultra.
   Special thanks to koitsu who gave me remote access to his system.
   
   PR:	kern/114631, kern/116853
   MFC after:	1 week
 
 Modified:
   head/sys/dev/msk/if_msk.c
 
 Modified: head/sys/dev/msk/if_msk.c
 ==============================================================================
 --- head/sys/dev/msk/if_msk.c	Sun Mar 14 22:38:18 2010	(r205160)
 +++ head/sys/dev/msk/if_msk.c	Sun Mar 14 23:23:57 2010	(r205161)
 @@ -1212,7 +1212,7 @@ msk_phy_power(struct msk_softc *sc, int 
  		 */
  		CSR_WRITE_1(sc, B2_Y2_CLK_GATE, val);
  
 -		val = pci_read_config(sc->msk_dev, PCI_OUR_REG_1, 4);
 +		val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
  		val &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
  		if (sc->msk_hw_id == CHIP_ID_YUKON_XL) {
  			if (sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
 @@ -1223,7 +1223,7 @@ msk_phy_power(struct msk_softc *sc, int 
  			}
  		}
  		/* Release PHY from PowerDown/COMA mode. */
 -		pci_write_config(sc->msk_dev, PCI_OUR_REG_1, val, 4);
 +		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
  		switch (sc->msk_hw_id) {
  		case CHIP_ID_YUKON_EC_U:
  		case CHIP_ID_YUKON_EX:
 @@ -1232,16 +1232,16 @@ msk_phy_power(struct msk_softc *sc, int 
  			CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
  
  			/* Enable all clocks. */
 -			pci_write_config(sc->msk_dev, PCI_OUR_REG_3, 0, 4);
 -			our = pci_read_config(sc->msk_dev, PCI_OUR_REG_4, 4);
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
 +			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
  			our &= (PCI_FORCE_ASPM_REQUEST|PCI_ASPM_GPHY_LINK_DOWN|
  			    PCI_ASPM_INT_FIFO_EMPTY|PCI_ASPM_CLKRUN_REQUEST);
  			/* Set all bits to 0 except bits 15..12. */
 -			pci_write_config(sc->msk_dev, PCI_OUR_REG_4, our, 4);
 -			our = pci_read_config(sc->msk_dev, PCI_OUR_REG_5, 4);
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, our);
 +			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
  			our &= PCI_CTL_TIM_VMAIN_AV_MSK;
 -			pci_write_config(sc->msk_dev, PCI_OUR_REG_5, our, 4);
 -			pci_write_config(sc->msk_dev, PCI_CFG_REG_1, 0, 4);
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, our);
 +			CSR_PCI_WRITE_4(sc, PCI_CFG_REG_1, 0);
  			/*
  			 * Disable status race, workaround for
  			 * Yukon EC Ultra & Yukon EX.
 @@ -1262,7 +1262,7 @@ msk_phy_power(struct msk_softc *sc, int 
  		}
  		break;
  	case MSK_PHY_POWERDOWN:
 -		val = pci_read_config(sc->msk_dev, PCI_OUR_REG_1, 4);
 +		val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
  		val |= PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD;
  		if (sc->msk_hw_id == CHIP_ID_YUKON_XL &&
  		    sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
 @@ -1270,7 +1270,7 @@ msk_phy_power(struct msk_softc *sc, int 
  			if (sc->msk_num_port > 1)
  				val &= ~PCI_Y2_PHY2_COMA;
  		}
 -		pci_write_config(sc->msk_dev, PCI_OUR_REG_1, val, 4);
 +		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
  
  		val = Y2_PCI_CLK_LNK1_DIS | Y2_COR_CLK_LNK1_DIS |
  		      Y2_CLK_GAT_LNK1_DIS | Y2_PCI_CLK_LNK2_DIS |
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: Timothy Yen <yen.timothy@gmail.com>
To: bug-followup@FreeBSD.org, ckchien@gmail.com
Cc:  
Subject: Re: kern/116853: [msk] msk watchdog timeout
Date: Tue, 16 Mar 2010 04:05:49 -0400

 --001636c5bce53be50a0481e6778f
 Content-Type: text/plain; charset=ISO-8859-1
 
 Tonight I compiled 9.0-CURRENT and installed it. I then copied
 /boot/kernel/if_msk.so and /boot/kernel/if_msk.so.symbols to a temporary
 drive. Then I reverted to a snapshot of my 8.0-RELEASE kernel and overwrote
 the if_msk files. Subsequently, I tried transferring files on Samba at 60
 MB/s for about 20 minutes and then got a msk0 watchdog timeout error
 message. Any suggestions?
 
 --001636c5bce53be50a0481e6778f
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 Tonight I compiled 9.0-CURRENT and installed it. I then copied /boot/kernel=
 /if_msk.so and /boot/kernel/if_msk.so.symbols to a temporary drive. Then I =
 reverted to a snapshot of my 8.0-RELEASE kernel and overwrote the if_msk fi=
 les. Subsequently, I tried transferring files on Samba at 60 MB/s for about=
  20 minutes and then got a msk0 watchdog timeout error message. Any suggest=
 ions?<br>
 
 --001636c5bce53be50a0481e6778f--

From: Pyun YongHyeon <pyunyh@gmail.com>
To: Timothy Yen <yen.timothy@gmail.com>
Cc: yongari@freebsd.org, bug-followup@FreeBSD.org
Subject: Re: kern/116853: [msk] msk watchdog timeout
Date: Tue, 16 Mar 2010 11:39:13 -0700

 On Tue, Mar 16, 2010 at 08:40:03AM +0000, Timothy Yen wrote:
 > The following reply was made to PR kern/116853; it has been noted by GNATS.
 > 
 > From: Timothy Yen <yen.timothy@gmail.com>
 > To: bug-followup@FreeBSD.org, ckchien@gmail.com
 > Cc:  
 > Subject: Re: kern/116853: [msk] msk watchdog timeout
 > Date: Tue, 16 Mar 2010 04:05:49 -0400
 > 
 >  Tonight I compiled 9.0-CURRENT and installed it. I then copied
 >  /boot/kernel/if_msk.so and /boot/kernel/if_msk.so.symbols to a temporary
 >  drive. Then I reverted to a snapshot of my 8.0-RELEASE kernel and overwrote
 >  the if_msk files. Subsequently, I tried transferring files on Samba at 60
 >  MB/s for about 20 minutes and then got a msk0 watchdog timeout error
 >  message. Any suggestions?
 >  
 
 The code in HEAD does not build on 8.0-RELEASE due to the addition
 of additional interface capabilities. Did you manually patch the
 source to build it on 8.0-RELEASE? Or you mean you reverted to use
 msk(4) of 8.0-RELEASE and start to seeing the watchdog timeout issue?
 Are you also using 88E8056(Yukon Ultra) + 88E1149 PHY? If not,
 please open new PR and let me know the PR number.

From: "Timothy Yen" <yen.timothy@gmail.com>
To: <pyunyh@gmail.com>
Cc: <yongari@freebsd.org>,
	<bug-followup@FreeBSD.org>
Subject: RE: kern/116853: [msk] msk watchdog timeout
Date: Tue, 16 Mar 2010 15:48:32 -0400

 I have the 88E8056 integrated on my P5Q-E motherboard. There's also a
 88E8001, and I get watchdog timeouts on it too. I tried to manually patch it
 and build it on 8.0-RELEASE, but it didn't compile like you said. So I
 thought I would get the 9.0-CURRENT if_msk.ko and if_msk.ko.symbols and
 overwrite the 8.0-RELEASE ones.
 
 What I did was:
 1. Created a zfs snapshot of my 8.0-RELEASE
 2. Exported http://svn.freebsd.org/base/head/
 3. Built the kernel using GENERIC
 4. Installed the kernel
 5. Copied /boot/kernel/if_msk.ko and /boot/kernel/if_msk.ko.symbols to an
 external hard drive
 6. Rolled back to my 8.0-RELEASE kernel
 7. Overwrote if_msk.ko and if_msk.ko.symbols with the ones on my external
 hard drive
 
 Usually I get watchdog timeouts within 5 minutes of transferring, but with
 the 9.0-CURRENT if_msk, it took 20 minutes. I could give you remote access
 to my machine to debug it.
 
 -----Original Message-----
 From: Pyun YongHyeon [mailto:pyunyh@gmail.com] 
 Sent: Tuesday, March 16, 2010 2:39 PM
 To: Timothy Yen
 Cc: yongari@freebsd.org; bug-followup@FreeBSD.org
 Subject: Re: kern/116853: [msk] msk watchdog timeout
 
 On Tue, Mar 16, 2010 at 08:40:03AM +0000, Timothy Yen wrote:
 > The following reply was made to PR kern/116853; it has been noted by
 GNATS.
 > 
 > From: Timothy Yen <yen.timothy@gmail.com>
 > To: bug-followup@FreeBSD.org, ckchien@gmail.com
 > Cc:  
 > Subject: Re: kern/116853: [msk] msk watchdog timeout
 > Date: Tue, 16 Mar 2010 04:05:49 -0400
 > 
 >  Tonight I compiled 9.0-CURRENT and installed it. I then copied
 >  /boot/kernel/if_msk.so and /boot/kernel/if_msk.so.symbols to a temporary
 >  drive. Then I reverted to a snapshot of my 8.0-RELEASE kernel and
 overwrote
 >  the if_msk files. Subsequently, I tried transferring files on Samba at 60
 >  MB/s for about 20 minutes and then got a msk0 watchdog timeout error
 >  message. Any suggestions?
 >  
 
 The code in HEAD does not build on 8.0-RELEASE due to the addition
 of additional interface capabilities. Did you manually patch the
 source to build it on 8.0-RELEASE? Or you mean you reverted to use
 msk(4) of 8.0-RELEASE and start to seeing the watchdog timeout issue?
 Are you also using 88E8056(Yukon Ultra) + 88E1149 PHY? If not,
 please open new PR and let me know the PR number.
 

From: Pyun YongHyeon <pyunyh@gmail.com>
To: Timothy Yen <yen.timothy@gmail.com>
Cc: yongari@freebsd.org, bug-followup@freebsd.org
Subject: Re: kern/116853: [msk] msk watchdog timeout
Date: Tue, 16 Mar 2010 13:35:33 -0700

 On Tue, Mar 16, 2010 at 03:48:32PM -0400, Timothy Yen wrote:
 > I have the 88E8056 integrated on my P5Q-E motherboard. There's also a
 > 88E8001, and I get watchdog timeouts on it too. I tried to manually patch it
 > and build it on 8.0-RELEASE, but it didn't compile like you said. So I
 > thought I would get the 9.0-CURRENT if_msk.ko and if_msk.ko.symbols and
 > overwrite the 8.0-RELEASE ones.
 > 
 > What I did was:
 > 1. Created a zfs snapshot of my 8.0-RELEASE
 > 2. Exported http://svn.freebsd.org/base/head/
 > 3. Built the kernel using GENERIC
 > 4. Installed the kernel
 > 5. Copied /boot/kernel/if_msk.ko and /boot/kernel/if_msk.ko.symbols to an
 > external hard drive
 > 6. Rolled back to my 8.0-RELEASE kernel
 > 7. Overwrote if_msk.ko and if_msk.ko.symbols with the ones on my external
 > hard drive
 > 
 
 I have no idea how kernel module built in 9-CURRRENT could be run
 on 8.0-RELEASE. Download if_msk.c/if_mskreg.h  and sys/dev/mii/*
 files from HEAD and patch if_msk.c before building it on
 8.0-RELEASE. Due to addition of some additional interface
 capabilities you may have to add the following in the beginning
 of if_msk.c.
 
 #ifndef IFCAP_VLAN_HWTSO
 #define IFCAP_VLAN_HWTSO 0
 #endif
 
 > Usually I get watchdog timeouts within 5 minutes of transferring, but with
 > the 9.0-CURRENT if_msk, it took 20 minutes. I could give you remote access
 > to my machine to debug it.
 > 
 
 Remote debugging is really hard and it's only available option when
 you are able to setup two systems connected with serial console.

From: Timothy Yen <yen.timothy@gmail.com>
To: pyunyh@gmail.com
Cc: yongari@freebsd.org, bug-followup@freebsd.org
Subject: Re: kern/116853: [msk] msk watchdog timeout
Date: Tue, 16 Mar 2010 18:08:15 -0400

 --0016e68fcffb067fbd0481f23c42
 Content-Type: text/plain; charset=ISO-8859-1
 
 Here is the stderr
 
 ./aicasm: 880 instructions used
 ./aicasm: 826 instructions used
 ../aicasm/aicasm: 880 instructions used
 ../aicasm/aicasm: 826 instructions used
 cc1: warnings being treated as errors
 /usr/src/sys/dev/msk/if_msk.c: In function 'mskc_reset':
 /usr/src/sys/dev/msk/if_msk.c:1452: warning: implicit declaration of
 function 'pci_get_max_read_req'
 /usr/src/sys/dev/msk/if_msk.c:1452: warning: nested extern declaration of
 'pci_get_max_read_req'
 /usr/src/sys/dev/msk/if_msk.c:1453: warning: implicit declaration of
 function 'pci_set_max_read_req'
 /usr/src/sys/dev/msk/if_msk.c:1453: warning: nested extern declaration of
 'pci_set_max_read_req'
 
 I believe I grep'd for those functions yesterday on 9.0-CURRENT and copied
 over the pci folder, but that caused more errors and I gave up. Any way
 around this?
 
 On Tue, Mar 16, 2010 at 4:35 PM, Pyun YongHyeon <pyunyh@gmail.com> wrote:
 
 > On Tue, Mar 16, 2010 at 03:48:32PM -0400, Timothy Yen wrote:
 > > I have the 88E8056 integrated on my P5Q-E motherboard. There's also a
 > > 88E8001, and I get watchdog timeouts on it too. I tried to manually patch
 > it
 > > and build it on 8.0-RELEASE, but it didn't compile like you said. So I
 > > thought I would get the 9.0-CURRENT if_msk.ko and if_msk.ko.symbols and
 > > overwrite the 8.0-RELEASE ones.
 > >
 > > What I did was:
 > > 1. Created a zfs snapshot of my 8.0-RELEASE
 > > 2. Exported http://svn.freebsd.org/base/head/
 > > 3. Built the kernel using GENERIC
 > > 4. Installed the kernel
 > > 5. Copied /boot/kernel/if_msk.ko and /boot/kernel/if_msk.ko.symbols to an
 > > external hard drive
 > > 6. Rolled back to my 8.0-RELEASE kernel
 > > 7. Overwrote if_msk.ko and if_msk.ko.symbols with the ones on my external
 > > hard drive
 > >
 >
 > I have no idea how kernel module built in 9-CURRRENT could be run
 > on 8.0-RELEASE. Download if_msk.c/if_mskreg.h  and sys/dev/mii/*
 > files from HEAD and patch if_msk.c before building it on
 > 8.0-RELEASE. Due to addition of some additional interface
 > capabilities you may have to add the following in the beginning
 > of if_msk.c.
 >
 > #ifndef IFCAP_VLAN_HWTSO
 > #define IFCAP_VLAN_HWTSO 0
 > #endif
 >
 > > Usually I get watchdog timeouts within 5 minutes of transferring, but
 > with
 > > the 9.0-CURRENT if_msk, it took 20 minutes. I could give you remote
 > access
 > > to my machine to debug it.
 > >
 >
 > Remote debugging is really hard and it's only available option when
 > you are able to setup two systems connected with serial console.
 >
 
 --0016e68fcffb067fbd0481f23c42
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 Here is the stderr<br><br>./aicasm: 880 instructions used<br>./aicasm: 826 =
 instructions used<br>../aicasm/aicasm: 880 instructions used<br>../aicasm/a=
 icasm: 826 instructions used<br>cc1: warnings being treated as errors<br>
 /usr/src/sys/dev/msk/if_msk.c: In function &#39;mskc_reset&#39;:<br>/usr/sr=
 c/sys/dev/msk/if_msk.c:1452: warning: implicit declaration of function &#39=
 ;pci_get_max_read_req&#39;<br>/usr/src/sys/dev/msk/if_msk.c:1452: warning: =
 nested extern declaration of &#39;pci_get_max_read_req&#39;<br>
 /usr/src/sys/dev/msk/if_msk.c:1453: warning: implicit declaration of functi=
 on &#39;pci_set_max_read_req&#39;<br>/usr/src/sys/dev/msk/if_msk.c:1453: wa=
 rning: nested extern declaration of &#39;pci_set_max_read_req&#39;<br><br>
 I believe I grep&#39;d for those functions yesterday on 9.0-CURRENT and cop=
 ied over the pci folder, but that caused more errors and I gave up. Any way=
  around this?<br><br><div class=3D"gmail_quote">On Tue, Mar 16, 2010 at 4:3=
 5 PM, Pyun YongHyeon <span dir=3D"ltr">&lt;<a href=3D"mailto:pyunyh@gmail.c=
 om">pyunyh@gmail.com</a>&gt;</span> wrote:<br>
 <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
 r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class=3D"im"=
 >On Tue, Mar 16, 2010 at 03:48:32PM -0400, Timothy Yen wrote:<br>
 &gt; I have the 88E8056 integrated on my P5Q-E motherboard. There&#39;s als=
 o a<br>
 &gt; 88E8001, and I get watchdog timeouts on it too. I tried to manually pa=
 tch it<br>
 &gt; and build it on 8.0-RELEASE, but it didn&#39;t compile like you said. =
 So I<br>
 &gt; thought I would get the 9.0-CURRENT if_msk.ko and if_msk.ko.symbols an=
 d<br>
 &gt; overwrite the 8.0-RELEASE ones.<br>
 &gt;<br>
 &gt; What I did was:<br>
 &gt; 1. Created a zfs snapshot of my 8.0-RELEASE<br>
 &gt; 2. Exported <a href=3D"http://svn.freebsd.org/base/head/" target=3D"_b=
 lank">http://svn.freebsd.org/base/head/</a><br>
 &gt; 3. Built the kernel using GENERIC<br>
 &gt; 4. Installed the kernel<br>
 &gt; 5. Copied /boot/kernel/if_msk.ko and /boot/kernel/if_msk.ko.symbols to=
  an<br>
 &gt; external hard drive<br>
 &gt; 6. Rolled back to my 8.0-RELEASE kernel<br>
 &gt; 7. Overwrote if_msk.ko and if_msk.ko.symbols with the ones on my exter=
 nal<br>
 &gt; hard drive<br>
 &gt;<br>
 <br>
 </div>I have no idea how kernel module built in 9-CURRRENT could be run<br>
 on 8.0-RELEASE. Download if_msk.c/if_mskreg.h =A0and sys/dev/mii/*<br>
 files from HEAD and patch if_msk.c before building it on<br>
 8.0-RELEASE. Due to addition of some additional interface<br>
 capabilities you may have to add the following in the beginning<br>
 of if_msk.c.<br>
 <br>
 #ifndef IFCAP_VLAN_HWTSO<br>
 #define IFCAP_VLAN_HWTSO 0<br>
 #endif<br>
 <div class=3D"im"><br>
 &gt; Usually I get watchdog timeouts within 5 minutes of transferring, but =
 with<br>
 &gt; the 9.0-CURRENT if_msk, it took 20 minutes. I could give you remote ac=
 cess<br>
 &gt; to my machine to debug it.<br>
 &gt;<br>
 <br>
 </div>Remote debugging is really hard and it&#39;s only available option wh=
 en<br>
 you are able to setup two systems connected with serial console.<br>
 </blockquote></div><br>
 
 --0016e68fcffb067fbd0481f23c42--

From: Pyun YongHyeon <pyunyh@gmail.com>
To: Timothy Yen <yen.timothy@gmail.com>
Cc: yongari@freebsd.org, bug-followup@freebsd.org
Subject: Re: kern/116853: [msk] msk watchdog timeout
Date: Tue, 16 Mar 2010 15:21:51 -0700

 On Tue, Mar 16, 2010 at 06:08:15PM -0400, Timothy Yen wrote:
 > Here is the stderr
 > 
 > ./aicasm: 880 instructions used
 > ./aicasm: 826 instructions used
 > ../aicasm/aicasm: 880 instructions used
 > ../aicasm/aicasm: 826 instructions used
 > cc1: warnings being treated as errors
 > /usr/src/sys/dev/msk/if_msk.c: In function 'mskc_reset':
 > /usr/src/sys/dev/msk/if_msk.c:1452: warning: implicit declaration of
 > function 'pci_get_max_read_req'
 > /usr/src/sys/dev/msk/if_msk.c:1452: warning: nested extern declaration of
 > 'pci_get_max_read_req'
 > /usr/src/sys/dev/msk/if_msk.c:1453: warning: implicit declaration of
 > function 'pci_set_max_read_req'
 > /usr/src/sys/dev/msk/if_msk.c:1453: warning: nested extern declaration of
 > 'pci_set_max_read_req'
 > 
 > I believe I grep'd for those functions yesterday on 9.0-CURRENT and copied
 > over the pci folder, but that caused more errors and I gave up. Any way
 > around this?
 > 
 
 Oops, sorry. pci_get_max_read_req() and pci_set_max_read_req() are
 only available on stable. I think you can safely comment out these
 two functions that just affects performance.
 For instance, change the following code
 
 1446         if (sc->msk_expcap != 0) {
 1447                 /* Change Max. Read Request Size to 2048 bytes. */
 1448                 if (pci_get_max_read_req(sc->msk_dev) == 512)
 1449                         pci_set_max_read_req(sc->msk_dev, 2048);
 1450         }
 
 to 
 1446         if (sc->msk_expcap != 0) {
 		     #if 0
 1447                 /* Change Max. Read Request Size to 2048 bytes. */
 1448                 if (pci_get_max_read_req(sc->msk_dev) == 512)
 1449                         pci_set_max_read_req(sc->msk_dev, 2048);
 		     #endif
 1450         }

From: "Timothy Yen" <yen.timothy@gmail.com>
To: <pyunyh@gmail.com>
Cc: <yongari@freebsd.org>,
	<bug-followup@freebsd.org>
Subject: RE: kern/116853: [msk] msk watchdog timeout
Date: Tue, 16 Mar 2010 19:18:20 -0400

 It worked and compiled after I commented out that section. I installed the
 kernel and rebooted. It managed to transfer 89.5 GB at 65 MB/s through Samba
 before I got a msk0: watchdog timeout. Anything else I can try?
 
 -----Original Message-----
 From: Pyun YongHyeon [mailto:pyunyh@gmail.com] 
 Sent: Tuesday, March 16, 2010 6:22 PM
 To: Timothy Yen
 Cc: yongari@freebsd.org; bug-followup@freebsd.org
 Subject: Re: kern/116853: [msk] msk watchdog timeout
 
 On Tue, Mar 16, 2010 at 06:08:15PM -0400, Timothy Yen wrote:
 > Here is the stderr
 > 
 > ./aicasm: 880 instructions used
 > ./aicasm: 826 instructions used
 > ../aicasm/aicasm: 880 instructions used
 > ../aicasm/aicasm: 826 instructions used
 > cc1: warnings being treated as errors
 > /usr/src/sys/dev/msk/if_msk.c: In function 'mskc_reset':
 > /usr/src/sys/dev/msk/if_msk.c:1452: warning: implicit declaration of
 > function 'pci_get_max_read_req'
 > /usr/src/sys/dev/msk/if_msk.c:1452: warning: nested extern declaration of
 > 'pci_get_max_read_req'
 > /usr/src/sys/dev/msk/if_msk.c:1453: warning: implicit declaration of
 > function 'pci_set_max_read_req'
 > /usr/src/sys/dev/msk/if_msk.c:1453: warning: nested extern declaration of
 > 'pci_set_max_read_req'
 > 
 > I believe I grep'd for those functions yesterday on 9.0-CURRENT and copied
 > over the pci folder, but that caused more errors and I gave up. Any way
 > around this?
 > 
 
 Oops, sorry. pci_get_max_read_req() and pci_set_max_read_req() are
 only available on stable. I think you can safely comment out these
 two functions that just affects performance.
 For instance, change the following code
 
 1446         if (sc->msk_expcap != 0) {
 1447                 /* Change Max. Read Request Size to 2048 bytes. */
 1448                 if (pci_get_max_read_req(sc->msk_dev) == 512)
 1449                         pci_set_max_read_req(sc->msk_dev, 2048);
 1450         }
 
 to 
 1446         if (sc->msk_expcap != 0) {
 		     #if 0
 1447                 /* Change Max. Read Request Size to 2048 bytes. */
 1448                 if (pci_get_max_read_req(sc->msk_dev) == 512)
 1449                         pci_set_max_read_req(sc->msk_dev, 2048);
 		     #endif
 1450         }
 

From: Pyun YongHyeon <pyunyh@gmail.com>
To: Timothy Yen <yen.timothy@gmail.com>
Cc: yongari@freebsd.org, bug-followup@freebsd.org
Subject: Re: kern/116853: [msk] msk watchdog timeout
Date: Tue, 16 Mar 2010 17:15:36 -0700

 On Tue, Mar 16, 2010 at 07:18:20PM -0400, Timothy Yen wrote:
 > It worked and compiled after I commented out that section. I installed the
 > kernel and rebooted. It managed to transfer 89.5 GB at 65 MB/s through Samba
 > before I got a msk0: watchdog timeout. Anything else I can try?
 > 
 
 Did you also download e1000phy.c and e1000phyreg.h in sys/dev/mii
 directory and rebuild it?

From: "Timothy Yen" <yen.timothy@gmail.com>
To: <pyunyh@gmail.com>
Cc: <yongari@freebsd.org>,
	<bug-followup@freebsd.org>
Subject: RE: kern/116853: [msk] msk watchdog timeout
Date: Tue, 16 Mar 2010 20:36:14 -0400

 Yes, I rm -rf'ed /usr/src/sys/dev/mii and then I copied everything from
 9.0-CURRENT'S sys/dev/mii
 
 -----Original Message-----
 From: Pyun YongHyeon [mailto:pyunyh@gmail.com] 
 Sent: Tuesday, March 16, 2010 8:16 PM
 To: Timothy Yen
 Cc: yongari@freebsd.org; bug-followup@freebsd.org
 Subject: Re: kern/116853: [msk] msk watchdog timeout
 
 On Tue, Mar 16, 2010 at 07:18:20PM -0400, Timothy Yen wrote:
 > It worked and compiled after I commented out that section. I installed the
 > kernel and rebooted. It managed to transfer 89.5 GB at 65 MB/s through
 Samba
 > before I got a msk0: watchdog timeout. Anything else I can try?
 > 
 
 Did you also download e1000phy.c and e1000phyreg.h in sys/dev/mii
 directory and rebuild it?
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/116853: commit references a PR
Date: Wed, 24 Mar 2010 17:37:11 +0000 (UTC)

 Author: yongari
 Date: Wed Mar 24 17:36:56 2010
 New Revision: 205617
 URL: http://svn.freebsd.org/changeset/base/205617
 
 Log:
   MFC r205161:
     It seems PCI_OUR_REG_[1-5] registers are not mapped on PCI
     configuration space on Yukon Ultra(88E8056) such that accesses to
     these registers were NOPs which in turn make msk(4) instable on
     this controller. Use indirect access method to access
     PCI_OUR_REG_[1-5] registers. This should fix a long standing
     instability bug which prevented msk(4) working on Yukon Ultra.
     Special thanks to koitsu who gave me remote access to his system.
   
     PR:	kern/114631, kern/116853
 
 Modified:
   stable/8/sys/dev/msk/if_msk.c
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
   stable/8/sys/dev/xen/xenpci/   (props changed)
   stable/8/sys/net/   (props changed)
   stable/8/sys/netinet/ipfw/   (props changed)
 
 Modified: stable/8/sys/dev/msk/if_msk.c
 ==============================================================================
 --- stable/8/sys/dev/msk/if_msk.c	Wed Mar 24 17:32:20 2010	(r205616)
 +++ stable/8/sys/dev/msk/if_msk.c	Wed Mar 24 17:36:56 2010	(r205617)
 @@ -1125,7 +1125,7 @@ msk_phy_power(struct msk_softc *sc, int 
  		 */
  		CSR_WRITE_1(sc, B2_Y2_CLK_GATE, val);
  
 -		val = pci_read_config(sc->msk_dev, PCI_OUR_REG_1, 4);
 +		val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
  		val &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
  		if (sc->msk_hw_id == CHIP_ID_YUKON_XL) {
  			if (sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
 @@ -1136,7 +1136,7 @@ msk_phy_power(struct msk_softc *sc, int 
  			}
  		}
  		/* Release PHY from PowerDown/COMA mode. */
 -		pci_write_config(sc->msk_dev, PCI_OUR_REG_1, val, 4);
 +		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
  		switch (sc->msk_hw_id) {
  		case CHIP_ID_YUKON_EC_U:
  		case CHIP_ID_YUKON_EX:
 @@ -1145,16 +1145,16 @@ msk_phy_power(struct msk_softc *sc, int 
  			CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
  
  			/* Enable all clocks. */
 -			pci_write_config(sc->msk_dev, PCI_OUR_REG_3, 0, 4);
 -			our = pci_read_config(sc->msk_dev, PCI_OUR_REG_4, 4);
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
 +			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
  			our &= (PCI_FORCE_ASPM_REQUEST|PCI_ASPM_GPHY_LINK_DOWN|
  			    PCI_ASPM_INT_FIFO_EMPTY|PCI_ASPM_CLKRUN_REQUEST);
  			/* Set all bits to 0 except bits 15..12. */
 -			pci_write_config(sc->msk_dev, PCI_OUR_REG_4, our, 4);
 -			our = pci_read_config(sc->msk_dev, PCI_OUR_REG_5, 4);
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, our);
 +			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
  			our &= PCI_CTL_TIM_VMAIN_AV_MSK;
 -			pci_write_config(sc->msk_dev, PCI_OUR_REG_5, our, 4);
 -			pci_write_config(sc->msk_dev, PCI_CFG_REG_1, 0, 4);
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, our);
 +			CSR_PCI_WRITE_4(sc, PCI_CFG_REG_1, 0);
  			/*
  			 * Disable status race, workaround for
  			 * Yukon EC Ultra & Yukon EX.
 @@ -1175,7 +1175,7 @@ msk_phy_power(struct msk_softc *sc, int 
  		}
  		break;
  	case MSK_PHY_POWERDOWN:
 -		val = pci_read_config(sc->msk_dev, PCI_OUR_REG_1, 4);
 +		val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
  		val |= PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD;
  		if (sc->msk_hw_id == CHIP_ID_YUKON_XL &&
  		    sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
 @@ -1183,7 +1183,7 @@ msk_phy_power(struct msk_softc *sc, int 
  			if (sc->msk_num_port > 1)
  				val &= ~PCI_Y2_PHY2_COMA;
  		}
 -		pci_write_config(sc->msk_dev, PCI_OUR_REG_1, val, 4);
 +		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
  
  		val = Y2_PCI_CLK_LNK1_DIS | Y2_COR_CLK_LNK1_DIS |
  		      Y2_CLK_GAT_LNK1_DIS | Y2_PCI_CLK_LNK2_DIS |
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/116853: commit references a PR
Date: Wed, 24 Mar 2010 17:38:22 +0000 (UTC)

 Author: yongari
 Date: Wed Mar 24 17:38:08 2010
 New Revision: 205618
 URL: http://svn.freebsd.org/changeset/base/205618
 
 Log:
   MFC r205161:
     It seems PCI_OUR_REG_[1-5] registers are not mapped on PCI
     configuration space on Yukon Ultra(88E8056) such that accesses to
     these registers were NOPs which in turn make msk(4) instable on
     this controller. Use indirect access method to access
     PCI_OUR_REG_[1-5] registers. This should fix a long standing
     instability bug which prevented msk(4) working on Yukon Ultra.
     Special thanks to koitsu who gave me remote access to his system.
   
     PR:	kern/114631, kern/116853
 
 Modified:
   stable/7/sys/dev/msk/if_msk.c
 Directory Properties:
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Modified: stable/7/sys/dev/msk/if_msk.c
 ==============================================================================
 --- stable/7/sys/dev/msk/if_msk.c	Wed Mar 24 17:36:56 2010	(r205617)
 +++ stable/7/sys/dev/msk/if_msk.c	Wed Mar 24 17:38:08 2010	(r205618)
 @@ -1125,7 +1125,7 @@ msk_phy_power(struct msk_softc *sc, int 
  		 */
  		CSR_WRITE_1(sc, B2_Y2_CLK_GATE, val);
  
 -		val = pci_read_config(sc->msk_dev, PCI_OUR_REG_1, 4);
 +		val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
  		val &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
  		if (sc->msk_hw_id == CHIP_ID_YUKON_XL) {
  			if (sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
 @@ -1136,7 +1136,7 @@ msk_phy_power(struct msk_softc *sc, int 
  			}
  		}
  		/* Release PHY from PowerDown/COMA mode. */
 -		pci_write_config(sc->msk_dev, PCI_OUR_REG_1, val, 4);
 +		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
  		switch (sc->msk_hw_id) {
  		case CHIP_ID_YUKON_EC_U:
  		case CHIP_ID_YUKON_EX:
 @@ -1145,16 +1145,16 @@ msk_phy_power(struct msk_softc *sc, int 
  			CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
  
  			/* Enable all clocks. */
 -			pci_write_config(sc->msk_dev, PCI_OUR_REG_3, 0, 4);
 -			our = pci_read_config(sc->msk_dev, PCI_OUR_REG_4, 4);
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
 +			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
  			our &= (PCI_FORCE_ASPM_REQUEST|PCI_ASPM_GPHY_LINK_DOWN|
  			    PCI_ASPM_INT_FIFO_EMPTY|PCI_ASPM_CLKRUN_REQUEST);
  			/* Set all bits to 0 except bits 15..12. */
 -			pci_write_config(sc->msk_dev, PCI_OUR_REG_4, our, 4);
 -			our = pci_read_config(sc->msk_dev, PCI_OUR_REG_5, 4);
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, our);
 +			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
  			our &= PCI_CTL_TIM_VMAIN_AV_MSK;
 -			pci_write_config(sc->msk_dev, PCI_OUR_REG_5, our, 4);
 -			pci_write_config(sc->msk_dev, PCI_CFG_REG_1, 0, 4);
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, our);
 +			CSR_PCI_WRITE_4(sc, PCI_CFG_REG_1, 0);
  			/*
  			 * Disable status race, workaround for
  			 * Yukon EC Ultra & Yukon EX.
 @@ -1175,7 +1175,7 @@ msk_phy_power(struct msk_softc *sc, int 
  		}
  		break;
  	case MSK_PHY_POWERDOWN:
 -		val = pci_read_config(sc->msk_dev, PCI_OUR_REG_1, 4);
 +		val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
  		val |= PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD;
  		if (sc->msk_hw_id == CHIP_ID_YUKON_XL &&
  		    sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
 @@ -1183,7 +1183,7 @@ msk_phy_power(struct msk_softc *sc, int 
  			if (sc->msk_num_port > 1)
  				val &= ~PCI_Y2_PHY2_COMA;
  		}
 -		pci_write_config(sc->msk_dev, PCI_OUR_REG_1, val, 4);
 +		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
  
  		val = Y2_PCI_CLK_LNK1_DIS | Y2_COR_CLK_LNK1_DIS |
  		      Y2_CLK_GAT_LNK1_DIS | Y2_PCI_CLK_LNK2_DIS |
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: eadler 
State-Changed-When: Tue Mar 1 10:15:16 EST 2011 
State-Changed-Why:  
committed in head 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/116853: commit references a PR
Date: Wed, 22 Jun 2011 01:43:13 +0000 (UTC)

 Author: yongari
 Date: Wed Jun 22 01:42:52 2011
 New Revision: 223396
 URL: http://svn.freebsd.org/changeset/base/223396
 
 Log:
   MFC r222219,222221,222223,222226-222227,222231,222516:
     Merge all relevant changes from HEAD to fix long standing
     instability issues of msk(4).  To get desired effect of this
     merge, cold restarting is required because incorrectly programmed
     registers are not reset to default value.
     PR:	kern/114631, kern/116853, kern/139093, kern/144206,
   	kern/147824, kern/151169, kern/154591, kern/155636,
   	kern/156493
   
   r222219:
     Do not blindly clear entire GPHY control register. It seems some
     bits of the register is used for other purposes such that clearing
     these bits resulted in unexpected results such as corrupted RX
     frames or missing LE status updates.  For old controllers like
     Yukon EC it had no effect but it caused all kind of troubles on
     Yukon Supreme.
     This change shall improve stability of controllers like Yukon
     Ultra, Ultra2, Extreme, Optima and Supreme.
   
   r222221:
     Rework store and forward configuration of TX MAC FIFO. Basically it
     enables store and forward mode except for jumbo frame on Yukon
     Ultra.
   
   r222223:
     Do not configure RAM registers for controllers that do not have
     them.  These registers are defined only for Yukon XL, Yukon EC and
     Yukon FE.
   
   r222226:
     Make sure to enable all clocks before accessing registers.
     Releasing PHY from power down/COMA is done after enabling all
     clocks. While I'm here remove unnecessary controller reset.
   
   r222227:
     Do not touch ASF related register for controllers that do not have
     these registers. Also disable Watchdog of ASF microcontroller.
   
   r222231:
     When MTU is changed, check whether driver should be reinitialized or
     not.  If reinitialized is required, clear driver running flag.
   
   r222516:
     Correctly check MAC running status before disabling TX/RX MACs.
 
 Modified:
   stable/8/sys/dev/msk/if_msk.c
   stable/8/sys/dev/msk/if_mskreg.h
 Directory Properties:
   stable/8/sys/   (props changed)
   stable/8/sys/amd64/include/xen/   (props changed)
   stable/8/sys/cddl/contrib/opensolaris/   (props changed)
   stable/8/sys/contrib/dev/acpica/   (props changed)
   stable/8/sys/contrib/pf/   (props changed)
 
 Modified: stable/8/sys/dev/msk/if_msk.c
 ==============================================================================
 --- stable/8/sys/dev/msk/if_msk.c	Wed Jun 22 00:49:24 2011	(r223395)
 +++ stable/8/sys/dev/msk/if_msk.c	Wed Jun 22 01:42:52 2011	(r223396)
 @@ -562,7 +562,7 @@ msk_miibus_statchg(device_t dev)
  		msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0);
  		/* Disable Rx/Tx MAC. */
  		gmac = GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL);
 -		if ((GM_GPCR_RX_ENA | GM_GPCR_TX_ENA) != 0) {
 +		if ((gmac & (GM_GPCR_RX_ENA | GM_GPCR_TX_ENA)) != 0) {
  			gmac &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
  			GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac);
  			/* Read again to ensure writing. */
 @@ -1030,7 +1030,10 @@ msk_ioctl(struct ifnet *ifp, u_long comm
  				}
  			}
  			ifp->if_mtu = ifr->ifr_mtu;
 -			msk_init_locked(sc_if);
 +			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
 +				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 +				msk_init_locked(sc_if);
 +			}
  		}
  		MSK_IF_UNLOCK(sc_if);
  		break;
 @@ -1212,37 +1215,30 @@ msk_phy_power(struct msk_softc *sc, int 
  		 */
  		CSR_WRITE_1(sc, B2_Y2_CLK_GATE, val);
  
 -		val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
 -		val &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
 +		our = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
 +		our &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
  		if (sc->msk_hw_id == CHIP_ID_YUKON_XL) {
  			if (sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
  				/* Deassert Low Power for 1st PHY. */
 -				val |= PCI_Y2_PHY1_COMA;
 +				our |= PCI_Y2_PHY1_COMA;
  				if (sc->msk_num_port > 1)
 -					val |= PCI_Y2_PHY2_COMA;
 +					our |= PCI_Y2_PHY2_COMA;
  			}
  		}
 -		/* Release PHY from PowerDown/COMA mode. */
 -		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
 -		switch (sc->msk_hw_id) {
 -		case CHIP_ID_YUKON_EC_U:
 -		case CHIP_ID_YUKON_EX:
 -		case CHIP_ID_YUKON_FE_P:
 -		case CHIP_ID_YUKON_UL_2:
 -		case CHIP_ID_YUKON_OPT:
 -			CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
 -
 -			/* Enable all clocks. */
 -			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
 -			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
 -			our &= (PCI_FORCE_ASPM_REQUEST|PCI_ASPM_GPHY_LINK_DOWN|
 -			    PCI_ASPM_INT_FIFO_EMPTY|PCI_ASPM_CLKRUN_REQUEST);
 +		if (sc->msk_hw_id == CHIP_ID_YUKON_EC_U ||
 +		    sc->msk_hw_id == CHIP_ID_YUKON_EX ||
 +		    sc->msk_hw_id >= CHIP_ID_YUKON_FE_P) {
 +			val = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
 +			val &= (PCI_FORCE_ASPM_REQUEST |
 +			    PCI_ASPM_GPHY_LINK_DOWN | PCI_ASPM_INT_FIFO_EMPTY |
 +			    PCI_ASPM_CLKRUN_REQUEST);
  			/* Set all bits to 0 except bits 15..12. */
 -			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, our);
 -			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
 -			our &= PCI_CTL_TIM_VMAIN_AV_MSK;
 -			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, our);
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, val);
 +			val = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
 +			val &= PCI_CTL_TIM_VMAIN_AV_MSK;
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, val);
  			CSR_PCI_WRITE_4(sc, PCI_CFG_REG_1, 0);
 +			CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_ON);
  			/*
  			 * Disable status race, workaround for
  			 * Yukon EC Ultra & Yukon EX.
 @@ -1251,10 +1247,10 @@ msk_phy_power(struct msk_softc *sc, int 
  			val |= GLB_GPIO_STAT_RACE_DIS;
  			CSR_WRITE_4(sc, B2_GP_IO, val);
  			CSR_READ_4(sc, B2_GP_IO);
 -			break;
 -		default:
 -			break;
  		}
 +		/* Release PHY from PowerDown/COMA mode. */
 +		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, our);
 +
  		for (i = 0; i < sc->msk_num_port; i++) {
  			CSR_WRITE_2(sc, MR_ADDR(i, GMAC_LINK_CTRL),
  			    GMLC_RST_SET);
 @@ -1300,28 +1296,33 @@ mskc_reset(struct msk_softc *sc)
  	bus_addr_t addr;
  	uint16_t status;
  	uint32_t val;
 -	int i;
 -
 -	CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
 +	int i, initram;
  
  	/* Disable ASF. */
 -	if (sc->msk_hw_id == CHIP_ID_YUKON_EX) {
 -		status = CSR_READ_2(sc, B28_Y2_ASF_HCU_CCSR);
 -		/* Clear AHB bridge & microcontroller reset. */
 -		status &= ~(Y2_ASF_HCU_CCSR_AHB_RST |
 -		    Y2_ASF_HCU_CCSR_CPU_RST_MODE);
 -		/* Clear ASF microcontroller state. */
 -		status &= ~ Y2_ASF_HCU_CCSR_UC_STATE_MSK;
 -		CSR_WRITE_2(sc, B28_Y2_ASF_HCU_CCSR, status);
 -	} else
 -		CSR_WRITE_1(sc, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
 -	CSR_WRITE_2(sc, B0_CTST, Y2_ASF_DISABLE);
 -
 -	/*
 -	 * Since we disabled ASF, S/W reset is required for Power Management.
 -	 */
 -	CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
 -	CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
 +	if (sc->msk_hw_id >= CHIP_ID_YUKON_XL &&
 +	    sc->msk_hw_id <= CHIP_ID_YUKON_SUPR) {
 +		if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
 +		    sc->msk_hw_id == CHIP_ID_YUKON_SUPR) {
 +			CSR_WRITE_4(sc, B28_Y2_CPU_WDOG, 0);
 +			status = CSR_READ_2(sc, B28_Y2_ASF_HCU_CCSR);
 +			/* Clear AHB bridge & microcontroller reset. */
 +			status &= ~(Y2_ASF_HCU_CCSR_AHB_RST |
 +			    Y2_ASF_HCU_CCSR_CPU_RST_MODE);
 +			/* Clear ASF microcontroller state. */
 +			status &= ~Y2_ASF_HCU_CCSR_UC_STATE_MSK;
 +			status &= ~Y2_ASF_HCU_CCSR_CPU_CLK_DIVIDE_MSK;
 +			CSR_WRITE_2(sc, B28_Y2_ASF_HCU_CCSR, status);
 +			CSR_WRITE_4(sc, B28_Y2_CPU_WDOG, 0);
 +		} else
 +			CSR_WRITE_1(sc, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
 +		CSR_WRITE_2(sc, B0_CTST, Y2_ASF_DISABLE);
 +		/*
 +		 * Since we disabled ASF, S/W reset is required for
 +		 * Power Management.
 +		 */
 +		CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
 +		CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
 +	}
  
  	/* Clear all error bits in the PCI status register. */
  	status = pci_read_config(sc->msk_dev, PCIR_STATUS, 2);
 @@ -1362,8 +1363,8 @@ mskc_reset(struct msk_softc *sc)
  	/* Reset GPHY/GMAC Control */
  	for (i = 0; i < sc->msk_num_port; i++) {
  		/* GPHY Control reset. */
 -		CSR_WRITE_4(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_SET);
 -		CSR_WRITE_4(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_CLR);
 +		CSR_WRITE_1(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_SET);
 +		CSR_WRITE_1(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_CLR);
  		/* GMAC Control reset. */
  		CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_SET);
  		CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_CLR);
 @@ -1396,8 +1397,14 @@ mskc_reset(struct msk_softc *sc)
  	CSR_WRITE_1(sc, GMAC_TI_ST_CTRL, GMT_ST_STOP);
  	CSR_WRITE_1(sc, GMAC_TI_ST_CTRL, GMT_ST_CLR_IRQ);
  
 +	initram = 0;
 +	if (sc->msk_hw_id == CHIP_ID_YUKON_XL ||
 +	    sc->msk_hw_id == CHIP_ID_YUKON_EC ||
 +	    sc->msk_hw_id == CHIP_ID_YUKON_FE)
 +		initram++;
 +
  	/* Configure timeout values. */
 -	for (i = 0; i < sc->msk_num_port; i++) {
 +	for (i = 0; initram > 0 && i < sc->msk_num_port; i++) {
  		CSR_WRITE_2(sc, SELECT_RAM_BUFFER(i, B3_RI_CTRL), RI_RST_SET);
  		CSR_WRITE_2(sc, SELECT_RAM_BUFFER(i, B3_RI_CTRL), RI_RST_CLR);
  		CSR_WRITE_1(sc, SELECT_RAM_BUFFER(i, B3_RI_WTO_R1),
 @@ -1708,6 +1715,9 @@ mskc_attach(device_t dev)
  		}
  	}
  
 +	/* Enable all clocks before accessing any registers. */
 +	CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
 +
  	CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
  	sc->msk_hw_id = CSR_READ_1(sc, B2_CHIP_ID);
  	sc->msk_hw_rev = (CSR_READ_1(sc, B2_MAC_CFG) >> 4) & 0x0f;
 @@ -1748,9 +1758,6 @@ mskc_attach(device_t dev)
  	resource_int_value(device_get_name(dev), device_get_unit(dev),
  	    "int_holdoff", &sc->msk_int_holdoff);
  
 -	/* Soft reset. */
 -	CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
 -	CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
  	sc->msk_pmd = CSR_READ_1(sc, B2_PMD_TYP);
  	/* Check number of MACs. */
  	sc->msk_num_port = 1;
 @@ -2964,6 +2971,7 @@ mskc_resume(device_t dev)
  
  	MSK_LOCK(sc);
  
 +	CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
  	mskc_reset(sc);
  	for (i = 0; i < sc->msk_num_port; i++) {
  		if (sc->msk_if[i] != NULL && sc->msk_if[i]->msk_ifp != NULL &&
 @@ -3655,37 +3663,24 @@ msk_set_tx_stfwd(struct msk_if_softc *sc
  
  	ifp = sc_if->msk_ifp;
  	sc = sc_if->msk_softc;
 -	switch (sc->msk_hw_id) {
 -	case CHIP_ID_YUKON_EX:
 -		if (sc->msk_hw_rev == CHIP_REV_YU_EX_A0)
 -			goto yukon_ex_workaround;
 -		if (ifp->if_mtu > ETHERMTU)
 -			CSR_WRITE_4(sc,
 -			    MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 -			    TX_JUMBO_ENA | TX_STFW_ENA);
 -		else
 -			CSR_WRITE_4(sc,
 -			    MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 -			    TX_JUMBO_DIS | TX_STFW_ENA);
 -		break;
 -	default:
 -yukon_ex_workaround:
 +	if ((sc->msk_hw_id == CHIP_ID_YUKON_EX &&
 +	    sc->msk_hw_rev != CHIP_REV_YU_EX_A0) ||
 +	    sc->msk_hw_id >= CHIP_ID_YUKON_SUPR) {
 +		CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 +		    TX_STFW_ENA);
 +	} else {
  		if (ifp->if_mtu > ETHERMTU) {
  			/* Set Tx GMAC FIFO Almost Empty Threshold. */
  			CSR_WRITE_4(sc,
  			    MR_ADDR(sc_if->msk_port, TX_GMF_AE_THR),
  			    MSK_ECU_JUMBO_WM << 16 | MSK_ECU_AE_THR);
  			/* Disable Store & Forward mode for Tx. */
 -			CSR_WRITE_4(sc,
 -			    MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 -			    TX_JUMBO_ENA | TX_STFW_DIS);
 +			CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 +			    TX_STFW_DIS);
  		} else {
 -			/* Enable Store & Forward mode for Tx. */
 -			CSR_WRITE_4(sc,
 -			    MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 -			    TX_JUMBO_DIS | TX_STFW_ENA);
 +			CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 +			    TX_STFW_ENA);
  		}
 -		break;
  	}
  }
  
 
 Modified: stable/8/sys/dev/msk/if_mskreg.h
 ==============================================================================
 --- stable/8/sys/dev/msk/if_mskreg.h	Wed Jun 22 00:49:24 2011	(r223395)
 +++ stable/8/sys/dev/msk/if_mskreg.h	Wed Jun 22 01:42:52 2011	(r223396)
 @@ -677,6 +677,7 @@
  /* ASF Subsystem Registers (Yukon-2 only) */
  #define B28_Y2_SMB_CONFIG	0x0e40	/* 32 bit ASF SMBus Config Register */
  #define B28_Y2_SMB_CSD_REG	0x0e44	/* 32 bit ASF SMB Control/Status/Data */
 +#define B28_Y2_CPU_WDOG		0x0e48	/* 32 bit Watchdog Register */
  #define B28_Y2_ASF_IRQ_V_BASE	0x0e60	/* 32 bit ASF IRQ Vector Base */
  #define B28_Y2_ASF_STAT_CMD	0x0e68	/* 32 bit ASF Status and Command Reg */
  #define B28_Y2_ASF_HCU_CCSR	0x0e68	/* 32 bit ASF HCU CCSR (Yukon EX) */
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/116853: commit references a PR
Date: Wed, 22 Jun 2011 01:44:18 +0000 (UTC)

 Author: yongari
 Date: Wed Jun 22 01:44:09 2011
 New Revision: 223397
 URL: http://svn.freebsd.org/changeset/base/223397
 
 Log:
   MFC r222219,222221,222223,222226-222227,222231,222516:
     Merge all relevant changes from HEAD to fix long standing
     instability issues of msk(4).  To get desired effect of this
     merge, cold restarting is required because incorrectly programmed
     registers are not reset to default value.
     PR:	kern/114631, kern/116853, kern/139093, kern/144206,
   	kern/147824, kern/151169, kern/154591, kern/155636,
   	kern/156493
   
   r222219:
     Do not blindly clear entire GPHY control register. It seems some
     bits of the register is used for other purposes such that clearing
     these bits resulted in unexpected results such as corrupted RX
     frames or missing LE status updates.  For old controllers like
     Yukon EC it had no effect but it caused all kind of troubles on
     Yukon Supreme.
     This change shall improve stability of controllers like Yukon
     Ultra, Ultra2, Extreme, Optima and Supreme.
   
   r222221:
     Rework store and forward configuration of TX MAC FIFO. Basically it
     enables store and forward mode except for jumbo frame on Yukon
     Ultra.
   
   r222223:
     Do not configure RAM registers for controllers that do not have
     them.  These registers are defined only for Yukon XL, Yukon EC and
     Yukon FE.
   
   r222226:
     Make sure to enable all clocks before accessing registers.
     Releasing PHY from power down/COMA is done after enabling all
     clocks. While I'm here remove unnecessary controller reset.
   
   r222227:
     Do not touch ASF related register for controllers that do not have
     these registers. Also disable Watchdog of ASF microcontroller.
   
   r222231:
     When MTU is changed, check whether driver should be reinitialized or
     not.  If reinitialized is required, clear driver running flag.
   
   r222516:
     Correctly check MAC running status before disabling TX/RX MACs.
 
 Modified:
   stable/7/sys/dev/msk/if_msk.c
   stable/7/sys/dev/msk/if_mskreg.h
 Directory Properties:
   stable/7/sys/   (props changed)
   stable/7/sys/cddl/contrib/opensolaris/   (props changed)
   stable/7/sys/contrib/dev/acpica/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
 
 Modified: stable/7/sys/dev/msk/if_msk.c
 ==============================================================================
 --- stable/7/sys/dev/msk/if_msk.c	Wed Jun 22 01:42:52 2011	(r223396)
 +++ stable/7/sys/dev/msk/if_msk.c	Wed Jun 22 01:44:09 2011	(r223397)
 @@ -562,7 +562,7 @@ msk_miibus_statchg(device_t dev)
  		msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0);
  		/* Disable Rx/Tx MAC. */
  		gmac = GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL);
 -		if ((GM_GPCR_RX_ENA | GM_GPCR_TX_ENA) != 0) {
 +		if ((gmac & (GM_GPCR_RX_ENA | GM_GPCR_TX_ENA)) != 0) {
  			gmac &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
  			GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac);
  			/* Read again to ensure writing. */
 @@ -1030,7 +1030,10 @@ msk_ioctl(struct ifnet *ifp, u_long comm
  				}
  			}
  			ifp->if_mtu = ifr->ifr_mtu;
 -			msk_init_locked(sc_if);
 +			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
 +				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 +				msk_init_locked(sc_if);
 +			}
  		}
  		MSK_IF_UNLOCK(sc_if);
  		break;
 @@ -1212,37 +1215,30 @@ msk_phy_power(struct msk_softc *sc, int 
  		 */
  		CSR_WRITE_1(sc, B2_Y2_CLK_GATE, val);
  
 -		val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
 -		val &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
 +		our = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
 +		our &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
  		if (sc->msk_hw_id == CHIP_ID_YUKON_XL) {
  			if (sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
  				/* Deassert Low Power for 1st PHY. */
 -				val |= PCI_Y2_PHY1_COMA;
 +				our |= PCI_Y2_PHY1_COMA;
  				if (sc->msk_num_port > 1)
 -					val |= PCI_Y2_PHY2_COMA;
 +					our |= PCI_Y2_PHY2_COMA;
  			}
  		}
 -		/* Release PHY from PowerDown/COMA mode. */
 -		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
 -		switch (sc->msk_hw_id) {
 -		case CHIP_ID_YUKON_EC_U:
 -		case CHIP_ID_YUKON_EX:
 -		case CHIP_ID_YUKON_FE_P:
 -		case CHIP_ID_YUKON_UL_2:
 -		case CHIP_ID_YUKON_OPT:
 -			CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
 -
 -			/* Enable all clocks. */
 -			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
 -			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
 -			our &= (PCI_FORCE_ASPM_REQUEST|PCI_ASPM_GPHY_LINK_DOWN|
 -			    PCI_ASPM_INT_FIFO_EMPTY|PCI_ASPM_CLKRUN_REQUEST);
 +		if (sc->msk_hw_id == CHIP_ID_YUKON_EC_U ||
 +		    sc->msk_hw_id == CHIP_ID_YUKON_EX ||
 +		    sc->msk_hw_id >= CHIP_ID_YUKON_FE_P) {
 +			val = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
 +			val &= (PCI_FORCE_ASPM_REQUEST |
 +			    PCI_ASPM_GPHY_LINK_DOWN | PCI_ASPM_INT_FIFO_EMPTY |
 +			    PCI_ASPM_CLKRUN_REQUEST);
  			/* Set all bits to 0 except bits 15..12. */
 -			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, our);
 -			our = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
 -			our &= PCI_CTL_TIM_VMAIN_AV_MSK;
 -			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, our);
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, val);
 +			val = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
 +			val &= PCI_CTL_TIM_VMAIN_AV_MSK;
 +			CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, val);
  			CSR_PCI_WRITE_4(sc, PCI_CFG_REG_1, 0);
 +			CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_ON);
  			/*
  			 * Disable status race, workaround for
  			 * Yukon EC Ultra & Yukon EX.
 @@ -1251,10 +1247,10 @@ msk_phy_power(struct msk_softc *sc, int 
  			val |= GLB_GPIO_STAT_RACE_DIS;
  			CSR_WRITE_4(sc, B2_GP_IO, val);
  			CSR_READ_4(sc, B2_GP_IO);
 -			break;
 -		default:
 -			break;
  		}
 +		/* Release PHY from PowerDown/COMA mode. */
 +		CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, our);
 +
  		for (i = 0; i < sc->msk_num_port; i++) {
  			CSR_WRITE_2(sc, MR_ADDR(i, GMAC_LINK_CTRL),
  			    GMLC_RST_SET);
 @@ -1300,28 +1296,33 @@ mskc_reset(struct msk_softc *sc)
  	bus_addr_t addr;
  	uint16_t status;
  	uint32_t val;
 -	int i;
 -
 -	CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
 +	int i, initram;
  
  	/* Disable ASF. */
 -	if (sc->msk_hw_id == CHIP_ID_YUKON_EX) {
 -		status = CSR_READ_2(sc, B28_Y2_ASF_HCU_CCSR);
 -		/* Clear AHB bridge & microcontroller reset. */
 -		status &= ~(Y2_ASF_HCU_CCSR_AHB_RST |
 -		    Y2_ASF_HCU_CCSR_CPU_RST_MODE);
 -		/* Clear ASF microcontroller state. */
 -		status &= ~ Y2_ASF_HCU_CCSR_UC_STATE_MSK;
 -		CSR_WRITE_2(sc, B28_Y2_ASF_HCU_CCSR, status);
 -	} else
 -		CSR_WRITE_1(sc, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
 -	CSR_WRITE_2(sc, B0_CTST, Y2_ASF_DISABLE);
 -
 -	/*
 -	 * Since we disabled ASF, S/W reset is required for Power Management.
 -	 */
 -	CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
 -	CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
 +	if (sc->msk_hw_id >= CHIP_ID_YUKON_XL &&
 +	    sc->msk_hw_id <= CHIP_ID_YUKON_SUPR) {
 +		if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
 +		    sc->msk_hw_id == CHIP_ID_YUKON_SUPR) {
 +			CSR_WRITE_4(sc, B28_Y2_CPU_WDOG, 0);
 +			status = CSR_READ_2(sc, B28_Y2_ASF_HCU_CCSR);
 +			/* Clear AHB bridge & microcontroller reset. */
 +			status &= ~(Y2_ASF_HCU_CCSR_AHB_RST |
 +			    Y2_ASF_HCU_CCSR_CPU_RST_MODE);
 +			/* Clear ASF microcontroller state. */
 +			status &= ~Y2_ASF_HCU_CCSR_UC_STATE_MSK;
 +			status &= ~Y2_ASF_HCU_CCSR_CPU_CLK_DIVIDE_MSK;
 +			CSR_WRITE_2(sc, B28_Y2_ASF_HCU_CCSR, status);
 +			CSR_WRITE_4(sc, B28_Y2_CPU_WDOG, 0);
 +		} else
 +			CSR_WRITE_1(sc, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
 +		CSR_WRITE_2(sc, B0_CTST, Y2_ASF_DISABLE);
 +		/*
 +		 * Since we disabled ASF, S/W reset is required for
 +		 * Power Management.
 +		 */
 +		CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
 +		CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
 +	}
  
  	/* Clear all error bits in the PCI status register. */
  	status = pci_read_config(sc->msk_dev, PCIR_STATUS, 2);
 @@ -1362,8 +1363,8 @@ mskc_reset(struct msk_softc *sc)
  	/* Reset GPHY/GMAC Control */
  	for (i = 0; i < sc->msk_num_port; i++) {
  		/* GPHY Control reset. */
 -		CSR_WRITE_4(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_SET);
 -		CSR_WRITE_4(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_CLR);
 +		CSR_WRITE_1(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_SET);
 +		CSR_WRITE_1(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_CLR);
  		/* GMAC Control reset. */
  		CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_SET);
  		CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_CLR);
 @@ -1396,8 +1397,14 @@ mskc_reset(struct msk_softc *sc)
  	CSR_WRITE_1(sc, GMAC_TI_ST_CTRL, GMT_ST_STOP);
  	CSR_WRITE_1(sc, GMAC_TI_ST_CTRL, GMT_ST_CLR_IRQ);
  
 +	initram = 0;
 +	if (sc->msk_hw_id == CHIP_ID_YUKON_XL ||
 +	    sc->msk_hw_id == CHIP_ID_YUKON_EC ||
 +	    sc->msk_hw_id == CHIP_ID_YUKON_FE)
 +		initram++;
 +
  	/* Configure timeout values. */
 -	for (i = 0; i < sc->msk_num_port; i++) {
 +	for (i = 0; initram > 0 && i < sc->msk_num_port; i++) {
  		CSR_WRITE_2(sc, SELECT_RAM_BUFFER(i, B3_RI_CTRL), RI_RST_SET);
  		CSR_WRITE_2(sc, SELECT_RAM_BUFFER(i, B3_RI_CTRL), RI_RST_CLR);
  		CSR_WRITE_1(sc, SELECT_RAM_BUFFER(i, B3_RI_WTO_R1),
 @@ -1708,6 +1715,9 @@ mskc_attach(device_t dev)
  		}
  	}
  
 +	/* Enable all clocks before accessing any registers. */
 +	CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
 +
  	CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
  	sc->msk_hw_id = CSR_READ_1(sc, B2_CHIP_ID);
  	sc->msk_hw_rev = (CSR_READ_1(sc, B2_MAC_CFG) >> 4) & 0x0f;
 @@ -1748,9 +1758,6 @@ mskc_attach(device_t dev)
  	resource_int_value(device_get_name(dev), device_get_unit(dev),
  	    "int_holdoff", &sc->msk_int_holdoff);
  
 -	/* Soft reset. */
 -	CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
 -	CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
  	sc->msk_pmd = CSR_READ_1(sc, B2_PMD_TYP);
  	/* Check number of MACs. */
  	sc->msk_num_port = 1;
 @@ -2964,6 +2971,7 @@ mskc_resume(device_t dev)
  
  	MSK_LOCK(sc);
  
 +	CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
  	mskc_reset(sc);
  	for (i = 0; i < sc->msk_num_port; i++) {
  		if (sc->msk_if[i] != NULL && sc->msk_if[i]->msk_ifp != NULL &&
 @@ -3655,37 +3663,24 @@ msk_set_tx_stfwd(struct msk_if_softc *sc
  
  	ifp = sc_if->msk_ifp;
  	sc = sc_if->msk_softc;
 -	switch (sc->msk_hw_id) {
 -	case CHIP_ID_YUKON_EX:
 -		if (sc->msk_hw_rev == CHIP_REV_YU_EX_A0)
 -			goto yukon_ex_workaround;
 -		if (ifp->if_mtu > ETHERMTU)
 -			CSR_WRITE_4(sc,
 -			    MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 -			    TX_JUMBO_ENA | TX_STFW_ENA);
 -		else
 -			CSR_WRITE_4(sc,
 -			    MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 -			    TX_JUMBO_DIS | TX_STFW_ENA);
 -		break;
 -	default:
 -yukon_ex_workaround:
 +	if ((sc->msk_hw_id == CHIP_ID_YUKON_EX &&
 +	    sc->msk_hw_rev != CHIP_REV_YU_EX_A0) ||
 +	    sc->msk_hw_id >= CHIP_ID_YUKON_SUPR) {
 +		CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 +		    TX_STFW_ENA);
 +	} else {
  		if (ifp->if_mtu > ETHERMTU) {
  			/* Set Tx GMAC FIFO Almost Empty Threshold. */
  			CSR_WRITE_4(sc,
  			    MR_ADDR(sc_if->msk_port, TX_GMF_AE_THR),
  			    MSK_ECU_JUMBO_WM << 16 | MSK_ECU_AE_THR);
  			/* Disable Store & Forward mode for Tx. */
 -			CSR_WRITE_4(sc,
 -			    MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 -			    TX_JUMBO_ENA | TX_STFW_DIS);
 +			CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 +			    TX_STFW_DIS);
  		} else {
 -			/* Enable Store & Forward mode for Tx. */
 -			CSR_WRITE_4(sc,
 -			    MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 -			    TX_JUMBO_DIS | TX_STFW_ENA);
 +			CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
 +			    TX_STFW_ENA);
  		}
 -		break;
  	}
  }
  
 
 Modified: stable/7/sys/dev/msk/if_mskreg.h
 ==============================================================================
 --- stable/7/sys/dev/msk/if_mskreg.h	Wed Jun 22 01:42:52 2011	(r223396)
 +++ stable/7/sys/dev/msk/if_mskreg.h	Wed Jun 22 01:44:09 2011	(r223397)
 @@ -677,6 +677,7 @@
  /* ASF Subsystem Registers (Yukon-2 only) */
  #define B28_Y2_SMB_CONFIG	0x0e40	/* 32 bit ASF SMBus Config Register */
  #define B28_Y2_SMB_CSD_REG	0x0e44	/* 32 bit ASF SMB Control/Status/Data */
 +#define B28_Y2_CPU_WDOG		0x0e48	/* 32 bit Watchdog Register */
  #define B28_Y2_ASF_IRQ_V_BASE	0x0e60	/* 32 bit ASF IRQ Vector Base */
  #define B28_Y2_ASF_STAT_CMD	0x0e68	/* 32 bit ASF Status and Command Reg */
  #define B28_Y2_ASF_HCU_CCSR	0x0e68	/* 32 bit ASF HCU CCSR (Yukon EX) */
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: yongari 
State-Changed-When: Fri Jun 24 00:50:02 UTC 2011 
State-Changed-Why:  
Fix merged to both stable/8 and stable/7. If you encounter the 
issue again please open a new PR. 
Thanks for reporting! 

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