socsvn commit: r304039 - soc2016/vincenzo/head/sys/dev/netmap

vincenzo at FreeBSD.org vincenzo at FreeBSD.org
Fri May 27 14:39:58 UTC 2016


Author: vincenzo
Date: Fri May 27 14:39:57 2016
New Revision: 304039
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=304039

Log:
  ptnet: read MAC address from I/O registers

Modified:
  soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c

Modified: soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c
==============================================================================
--- soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Fri May 27 14:39:41 2016	(r304038)
+++ soc2016/vincenzo/head/sys/dev/netmap/if_ptnet.c	Fri May 27 14:39:57 2016	(r304039)
@@ -178,6 +178,7 @@
 #endif
 	struct ptnet_softc *sc;
 	struct ifnet *ifp;
+	uint32_t macreg;
 	int err, rid;
 
 	device_printf(dev, "%s\n", __func__);
@@ -253,7 +254,15 @@
 	ifmedia_add(&sc->media, IFM_ETHER | IFM_10G_T | IFM_FDX, 0, NULL);
 	ifmedia_set(&sc->media, IFM_ETHER | IFM_10G_T | IFM_FDX);
 
-	memset(sc->hwaddr, 0, sizeof(sc->hwaddr));
+	macreg = bus_read_4(sc->iomem, PTNET_IO_MAC_HI);
+	sc->hwaddr[0] = (macreg >> 8) & 0xff;
+	sc->hwaddr[1] = macreg & 0xff;
+	macreg = bus_read_4(sc->iomem, PTNET_IO_MAC_LO);
+	sc->hwaddr[2] = (macreg >> 24) & 0xff;
+	sc->hwaddr[3] = (macreg >> 16) & 0xff;
+	sc->hwaddr[4] = (macreg >> 8) & 0xff;
+	sc->hwaddr[5] = macreg & 0xff;
+
 	ether_ifattach(ifp, sc->hwaddr);
 
 	ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);


More information about the svn-soc-all mailing list