Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Dec 2009 16:37:35 -0800
From:      Pyun YongHyeon <pyunyh@gmail.com>
To:        Olivier Cochard-Labb? <olivier@cochard.me>
Cc:        stable@freebsd.org
Subject:   Re: FreeBSD 8.0: can't PXE Boot using nvidia nForce4 network card
Message-ID:  <20091229003735.GD1166@michelle.cdnetworks.com>
In-Reply-To: <3131aa530912281622v3a4a15c5r38766eed989ff30e@mail.gmail.com>
References:  <3131aa530912230507q5abd0a9eh1f22ac858518268f@mail.gmail.com> <20091224193320.GD8146@michelle.cdnetworks.com> <3131aa530912281330t34032ad5he5fe7720b4d2744a@mail.gmail.com> <20091228222140.GC1166@michelle.cdnetworks.com> <3131aa530912281622v3a4a15c5r38766eed989ff30e@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--8GpibOaaTibBMecb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Dec 29, 2009 at 01:22:40AM +0100, Olivier Cochard-Labb? wrote:
> On Mon, Dec 28, 2009 at 11:21 PM, Pyun YongHyeon <pyunyh@gmail.com> wrote:
> 
> > Ok, it seems Linux forcedeth driver seems to poke NFE_STATUS
> > register before accessing PHY. I'm not sure whether this code could
> > be related with the issue but would you try attached patch?
> >
> 
> Allready a patch to try! Thanks for your reactivity!
> 
> The patch was applyed successfully and new kernel compiled/installed
> without problem but same error message:
> 
> FreeBSD 8.0-STABLE #4: Mon Dec 28 23:48:36 CET 2009
>     root@debugger.bsdrp.net:/usr/obj/usr/src/sys/GENERIC i386
> (...)
> nfe0: <NVIDIA nForce4 CK804 MCP8 Networking Adapter> irq 21 at device
> 10.0 on pci0
> nfe0: Lazy allocation of 0x1000000 bytes rid 0x10 type 3 at 0x81000000
> nfe0: Reserved 0x1000000 bytes for rid 0x10 type 3 at 0x81000000
> nfe0: MII without any phy!
> device_attach: nfe0 attach returned 6
> (...)
> Trying to mount root from nfs:10.0.0.1:/usr/tftpboot
> nfs_diskless: no interface
> ROOT MOUNT ERROR:
> (...)
> 

:-(
How about this one? Sorry, I'm just guessing(no hardware, no
documentation).

> Regards,
> 
> Olivier

--8GpibOaaTibBMecb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="nfe.CK804.diff2"

Index: sys/dev/nfe/if_nfe.c
===================================================================
--- sys/dev/nfe/if_nfe.c	(revision 201135)
+++ sys/dev/nfe/if_nfe.c	(working copy)
@@ -340,6 +340,7 @@
 	struct nfe_softc *sc;
 	struct ifnet *ifp;
 	bus_addr_t dma_addr_max;
+	uint32_t phystat, phyrestore;
 	int error = 0, i, msic, reg, rid;
 
 	sc = device_get_softc(dev);
@@ -349,6 +350,7 @@
 	    MTX_DEF);
 	callout_init_mtx(&sc->nfe_stat_ch, &sc->nfe_mtx, 0);
 	TASK_INIT(&sc->nfe_link_task, 0, nfe_link_task, sc);
+	phyrestore = 0;
 
 	pci_enable_busmaster(dev);
 
@@ -513,6 +515,8 @@
 		break;
 	}
 
+	NFE_READ(sc, NFE_WOL_CTL);
+	NFE_WRITE(sc, NFE_WOL_CTL, 0);
 	nfe_power(sc);
 	/* Check for reversed ethernet address */
 	if ((NFE_READ(sc, NFE_TX_UNK) & NFE_MAC_ADDR_INORDER) != 0)
@@ -599,6 +603,14 @@
 	ifp->if_capabilities |= IFCAP_POLLING;
 #endif
 
+	phystat = NFE_READ(sc, NFE_STATUS) & NFE_STATUS_RUNNING;
+	if ((phystat & NFE_STATUS_RUNNING) != 0) {
+		phystat &= ~NFE_STATUS_RUNNING;
+		NFE_WRITE(sc, NFE_STATUS, phystat);
+		phyrestore = 1;
+	}
+	NFE_WRITE(sc, NFE_PHY_STATUS, 0xf);
+
 	/* Do MII setup */
 	if (mii_phy_probe(dev, &sc->nfe_miibus, nfe_ifmedia_upd,
 	    nfe_ifmedia_sts)) {
@@ -636,8 +648,11 @@
 	}
 
 fail:
-	if (error)
+	if (error) {
+		if (phyrestore != 0)
+			NFE_WRITE(sc, NFE_STATUS, phystat | NFE_STATUS_RUNNING);
 		nfe_detach(dev);
+	}
 
 	return (error);
 }
@@ -2744,7 +2759,8 @@
 	NFE_WRITE(sc, NFE_SETUP_R6, NFE_R6_MAGIC);
 
 	/* update MAC knowledge of PHY; generates a NFE_IRQ_LINK interrupt */
-	NFE_WRITE(sc, NFE_STATUS, sc->mii_phyaddr << 24 | NFE_STATUS_MAGIC);
+	NFE_WRITE(sc, NFE_STATUS, sc->mii_phyaddr << NFE_STATUS_PHYSHIFT |
+	    NFE_STATUS_PHYVALID | NFE_STATUS_RUNNING);
 
 	NFE_WRITE(sc, NFE_SETUP_R4, NFE_R4_MAGIC);
 	NFE_WRITE(sc, NFE_WOL_CTL, NFE_WOL_MAGIC);
Index: sys/dev/nfe/if_nfereg.h
===================================================================
--- sys/dev/nfe/if_nfereg.h	(revision 201135)
+++ sys/dev/nfe/if_nfereg.h	(working copy)
@@ -137,7 +137,11 @@
 #define	NFE_PHY_BUSY		0x08000
 #define	NFE_PHYADD_SHIFT	5
 
-#define	NFE_STATUS_MAGIC	0x140000
+#define	NFE_STATUS_START	0x00000002
+#define	NFE_STATUS_LINKUP	0x00000004
+#define	NFE_STATUS_PHYVALID	0x00040000
+#define	NFE_STATUS_RUNNING	0x00100000
+#define	NFE_STATUS_PHYSHIFT	24
 
 #define	NFE_R1_MAGIC_1000	0x14050f
 #define	NFE_R1_MAGIC_10_100	0x16070f

--8GpibOaaTibBMecb--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091229003735.GD1166>