FreeBSD 8.0: can't PXE Boot using nvidia nForce4 network card

Pyun YongHyeon pyunyh at gmail.com
Tue Dec 29 00:38:49 UTC 2009


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 at 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 at 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
-------------- next part --------------
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


More information about the freebsd-stable mailing list