Deleted Added
full compact
if_octm.c (231987) if_octm.c (232289)
1/*-
2 * Copyright (c) 2010-2011 Juli Mallett <jmallett@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2010-2011 Juli Mallett <jmallett@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/mips/cavium/if_octm.c 231987 2012-02-22 01:30:25Z gonzo $
26 * $FreeBSD: head/sys/mips/cavium/if_octm.c 232289 2012-02-29 05:48:29Z gonzo $
27 */
28
29/*
30 * Cavium Octeon management port Ethernet devices.
31 */
32
33#include "opt_inet.h"
34

--- 23 unchanged lines hidden (view full) ---

58#ifdef INET
59#include <netinet/in.h>
60#include <netinet/if_ether.h>
61#endif
62
63#include <contrib/octeon-sdk/cvmx.h>
64#include <contrib/octeon-sdk/cvmx-interrupt.h>
65#include <contrib/octeon-sdk/cvmx-mgmt-port.h>
27 */
28
29/*
30 * Cavium Octeon management port Ethernet devices.
31 */
32
33#include "opt_inet.h"
34

--- 23 unchanged lines hidden (view full) ---

58#ifdef INET
59#include <netinet/in.h>
60#include <netinet/if_ether.h>
61#endif
62
63#include <contrib/octeon-sdk/cvmx.h>
64#include <contrib/octeon-sdk/cvmx-interrupt.h>
65#include <contrib/octeon-sdk/cvmx-mgmt-port.h>
66#include "octe/ethernet-common.h"
67
68struct octm_softc {
69 struct ifnet *sc_ifp;
70 device_t sc_dev;
71 unsigned sc_port;
72 int sc_flags;
73 struct ifmedia sc_ifmedia;
74 struct resource *sc_intr;

--- 97 unchanged lines hidden (view full) ---

172 default:
173 device_printf(dev, "unsupported management port %u.\n", sc->sc_port);
174 return (ENXIO);
175 }
176
177 /*
178 * Set MAC address for this management port.
179 */
66
67struct octm_softc {
68 struct ifnet *sc_ifp;
69 device_t sc_dev;
70 unsigned sc_port;
71 int sc_flags;
72 struct ifmedia sc_ifmedia;
73 struct resource *sc_intr;

--- 97 unchanged lines hidden (view full) ---

171 default:
172 device_printf(dev, "unsupported management port %u.\n", sc->sc_port);
173 return (ENXIO);
174 }
175
176 /*
177 * Set MAC address for this management port.
178 */
180 if (cvm_assign_mac_address(&mac, NULL) != 0) {
181 device_printf(dev, "unable to allocate MAC address.\n");
182 return (ENXIO);
183 }
179 mac = 0;
180 memcpy((u_int8_t *)&mac + 2, cvmx_sysinfo_get()->mac_addr_base, 6);
181 mac += sc->sc_port;
182
184 cvmx_mgmt_port_set_mac(sc->sc_port, mac);
185
186 /* No watermark for input ring. */
187 mixx_irhwm.u64 = 0;
188 cvmx_write_csr(CVMX_MIXX_IRHWM(sc->sc_port), mixx_irhwm.u64);
189
190 /* Enable input ring interrupts. */
191 mixx_intena.u64 = 0;

--- 341 unchanged lines hidden ---
183 cvmx_mgmt_port_set_mac(sc->sc_port, mac);
184
185 /* No watermark for input ring. */
186 mixx_irhwm.u64 = 0;
187 cvmx_write_csr(CVMX_MIXX_IRHWM(sc->sc_port), mixx_irhwm.u64);
188
189 /* Enable input ring interrupts. */
190 mixx_intena.u64 = 0;

--- 341 unchanged lines hidden ---