Deleted Added
sdiff udiff text old ( 215959 ) new ( 215974 )
full compact
1/*************************************************************************
2Copyright (c) 2003-2007 Cavium Networks (support@cavium.com). All rights
3reserved.
4
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are
8met:

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

22
23This Software, including technical data, may be subject to U.S. export control laws, including the U.S. Export Administration Act and its associated regulations, and may be subject to export or import regulations in other countries.
24
25TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
26AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
27*************************************************************************/
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet.c 215974 2010-11-28 05:57:24Z jmallett $");
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/bus.h>
35#include <sys/conf.h>
36#include <sys/endian.h>
37#include <sys/kernel.h>
38#include <sys/rman.h>

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

69int pow_receive_group = 15;
70TUNABLE_INT("hw.octe.pow_receive_group", &pow_receive_group);
71/*
72 "\t\tPOW group to receive packets from. All ethernet hardware\n"
73 "\t\twill be configured to send incomming packets to this POW\n"
74 "\t\tgroup. Also any other software can submit packets to this\n"
75 "\t\tgroup for the kernel to process." */
76
77extern int octeon_is_simulation(void);
78
79/**
80 * Exported from the kernel so we can determine board information. It is
81 * passed by the bootloader to the kernel.
82 */
83extern cvmx_bootinfo_t *octeon_bootinfo;
84

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

164 IF_UNLOCK(&priv->tx_free_queue[qos]);
165
166 /*
167 * XXX locking!
168 */
169 priv->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
170 }
171 }
172 }
173 port++;
174 /* Poll the next port in a 50th of a second.
175 This spreads the polling of ports out a little bit */
176 callout_reset(&cvm_oct_poll_timer, hz / 50, cvm_do_timer, NULL);
177 } else {
178 port = 0;
179 /* If any updates were made in this run, continue iterating at

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

297 int ifnum;
298 int num_interfaces;
299 int interface;
300 int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE;
301 int qos;
302
303 printf("cavium-ethernet: %s\n", OCTEON_SDK_VERSION_STRING);
304
305 cvm_oct_rx_initialize();
306 cvm_oct_configure_common_hw(bus);
307
308 cvmx_helper_initialize_packet_io_global();
309
310 /* Change the input group for all ports before input is enabled */
311 num_interfaces = cvmx_helper_get_number_of_interfaces();
312 for (interface = 0; interface < num_interfaces; interface++) {

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

346
347 dev = BUS_ADD_CHILD(bus, 0, "octe", ifnum++);
348 if (dev != NULL)
349 ifp = if_alloc(IFT_ETHER);
350 if (dev == NULL || ifp == NULL) {
351 printf("\t\tFailed to allocate ethernet device for port %d\n", port);
352 continue;
353 }
354
355 /* Initialize the device private structure. */
356 device_probe(dev);
357 priv = device_get_softc(dev);
358 priv->dev = dev;
359 priv->ifp = ifp;
360 priv->imode = imode;
361 priv->port = port;

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

376 case CVMX_HELPER_INTERFACE_MODE_NPI:
377 priv->init = cvm_oct_common_init;
378 priv->uninit = cvm_oct_common_uninit;
379 device_set_desc(dev, "Cavium Octeon NPI Ethernet");
380 break;
381
382 case CVMX_HELPER_INTERFACE_MODE_XAUI:
383 priv->init = cvm_oct_xaui_init;
384 priv->uninit = cvm_oct_common_uninit;
385 device_set_desc(dev, "Cavium Octeon XAUI Ethernet");
386 break;
387
388 case CVMX_HELPER_INTERFACE_MODE_LOOP:
389 priv->init = cvm_oct_common_init;
390 priv->uninit = cvm_oct_common_uninit;
391 device_set_desc(dev, "Cavium Octeon LOOP Ethernet");
392 break;
393
394 case CVMX_HELPER_INTERFACE_MODE_SGMII:
395 priv->init = cvm_oct_sgmii_init;
396 priv->uninit = cvm_oct_common_uninit;
397 device_set_desc(dev, "Cavium Octeon SGMII Ethernet");
398 break;
399
400 case CVMX_HELPER_INTERFACE_MODE_SPI:
401 priv->init = cvm_oct_spi_init;
402 priv->uninit = cvm_oct_spi_uninit;
403 device_set_desc(dev, "Cavium Octeon SPI Ethernet");
404 break;

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

483#else
484 panic("%s: need to detach and free interface.", __func__);
485#endif
486 cvm_oct_device[port] = NULL;
487 }
488 }
489
490 cvmx_pko_shutdown();
491
492 cvmx_ipd_free_ptr();
493
494 /* Free the HW pools */
495 cvm_oct_mem_empty_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE, num_packet_buffers);
496 cvm_oct_mem_empty_fpa(CVMX_FPA_WQE_POOL, CVMX_FPA_WQE_POOL_SIZE, num_packet_buffers);
497 if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
498 cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL, CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
499}