Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Feb 2011 02:41:33 +0000 (UTC)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218594 - in head/sys/mips/cavium: . octe
Message-ID:  <201102120241.p1C2fXPb082317@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jmallett
Date: Sat Feb 12 02:41:33 2011
New Revision: 218594
URL: http://svn.freebsd.org/changeset/base/218594

Log:
  The Lanner MR-730 uses the first two MACs at its MAC base for the 10/100
  management ports, and gigabit ports start at an offset of 2 from the MAC
  base.

Modified:
  head/sys/mips/cavium/if_octm.c
  head/sys/mips/cavium/octe/ethernet-common.c

Modified: head/sys/mips/cavium/if_octm.c
==============================================================================
--- head/sys/mips/cavium/if_octm.c	Sat Feb 12 02:14:19 2011	(r218593)
+++ head/sys/mips/cavium/if_octm.c	Sat Feb 12 02:41:33 2011	(r218594)
@@ -64,6 +64,8 @@
 #include <contrib/octeon-sdk/cvmx-interrupt.h>
 #include <contrib/octeon-sdk/cvmx-mgmt-port.h>
 
+extern cvmx_bootinfo_t *octeon_bootinfo;
+
 struct octm_softc {
 	struct ifnet *sc_ifp;
 	device_t sc_dev;
@@ -173,10 +175,27 @@ octm_attach(device_t dev)
 		return (ENXIO);
 	}
 
-	mac = cvmx_mgmt_port_get_mac(sc->sc_port);
-	if (mac == CVMX_MGMT_PORT_GET_MAC_ERROR) {
-		device_printf(dev, "unable to read MAC.\n");
-		return (ENXIO);
+	switch (cvmx_sysinfo_get()->board_type) {
+#if defined(OCTEON_VENDOR_LANNER)
+	case CVMX_BOARD_TYPE_CUST_LANNER_MR730:
+		/*
+		 * The MR-730 uses its first two MACs for the management
+		 * ports.
+		 */
+		mac = 0;
+		memcpy((u_int8_t *)&mac + 2, octeon_bootinfo->mac_addr_base,
+		       6);
+		mac += sc->sc_port;
+		cvmx_mgmt_port_set_mac(sc->sc_port, mac);
+		break;
+#endif
+	default:
+		mac = cvmx_mgmt_port_get_mac(sc->sc_port);
+		if (mac == CVMX_MGMT_PORT_GET_MAC_ERROR) {
+			device_printf(dev, "unable to read MAC.\n");
+			return (ENXIO);
+		}
+		break;
 	}
 
 	/* No watermark for input ring.  */

Modified: head/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- head/sys/mips/cavium/octe/ethernet-common.c	Sat Feb 12 02:14:19 2011	(r218593)
+++ head/sys/mips/cavium/octe/ethernet-common.c	Sat Feb 12 02:41:33 2011	(r218594)
@@ -279,6 +279,20 @@ int cvm_oct_common_init(struct ifnet *if
 		octeon_bootinfo->mac_addr_base[5] + count};
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 
+	switch (cvmx_sysinfo_get()->board_type) {
+#if defined(OCTEON_VENDOR_LANNER)
+	case CVMX_BOARD_TYPE_CUST_LANNER_MR730:
+		/*
+		 * The MR-730 uses its first two MACs for the management
+		 * ports.
+		 */
+		mac[5] += 2;
+		break;
+#endif
+	default:
+		break;
+	}
+
 	ifp->if_mtu = ETHERMTU;
 
 	count++;



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