diff options
author | jmallett <jmallett@FreeBSD.org> | 2011-02-12 02:41:33 +0000 |
---|---|---|
committer | jmallett <jmallett@FreeBSD.org> | 2011-02-12 02:41:33 +0000 |
commit | dc1138bc7d9162cc0a91f58af509dd8d2ddf4b36 (patch) | |
tree | 9005f2866f1824724e7475aef92f4286a6889b84 /sys/mips/cavium | |
parent | 8f9934fd6be936376bee0f3f643f25b50f285b3c (diff) | |
download | FreeBSD-src-dc1138bc7d9162cc0a91f58af509dd8d2ddf4b36.zip FreeBSD-src-dc1138bc7d9162cc0a91f58af509dd8d2ddf4b36.tar.gz |
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.
Diffstat (limited to 'sys/mips/cavium')
-rw-r--r-- | sys/mips/cavium/if_octm.c | 27 | ||||
-rw-r--r-- | sys/mips/cavium/octe/ethernet-common.c | 14 |
2 files changed, 37 insertions, 4 deletions
diff --git a/sys/mips/cavium/if_octm.c b/sys/mips/cavium/if_octm.c index f2db3a9..68969ee 100644 --- a/sys/mips/cavium/if_octm.c +++ b/sys/mips/cavium/if_octm.c @@ -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. */ diff --git a/sys/mips/cavium/octe/ethernet-common.c b/sys/mips/cavium/octe/ethernet-common.c index b107749..415c3d4 100644 --- a/sys/mips/cavium/octe/ethernet-common.c +++ b/sys/mips/cavium/octe/ethernet-common.c @@ -279,6 +279,20 @@ int cvm_oct_common_init(struct ifnet *ifp) 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++; |