[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree
zrouter-src-freebsd at zrouter.org
zrouter-src-freebsd at zrouter.org
Fri Mar 2 15:40:25 UTC 2012
details: http://zrouter.org/hg/FreeBSD/head//rev/dc3e1538e0ca
changeset: 412:dc3e1538e0ca
user: ray at terran.dlink.ua
date: Fri Mar 02 17:27:16 2012 +0200
description:
Update to FreeBSD-HEAD @232391
diffstat:
head/sys/mips/atheros/if_arge.c | 30 +++++-------
head/sys/mips/atheros/if_argevar.h | 6 +-
head/sys/mips/cavium/files.octeon1 | 9 +--
head/sys/mips/cavium/if_octm.c | 3 +-
head/sys/mips/cavium/octe/ethernet-common.c | 66 +++++++++++++++++++++++++---
head/sys/mips/cavium/octe/ethernet-common.h | 4 +-
head/sys/mips/cavium/octe/ethernet-rgmii.c | 6 +-
head/sys/mips/cavium/octe/ethernet-sgmii.c | 7 ++-
head/sys/mips/cavium/octe/ethernet-spi.c | 5 +-
head/sys/mips/cavium/octe/ethernet-xaui.c | 7 ++-
head/sys/mips/cavium/octe/ethernet.c | 46 +++++--------------
head/sys/mips/cavium/octopci.c | 3 +
head/sys/mips/conf/AR7242 | 3 +-
head/sys/mips/conf/OCTEON1 | 8 ++-
head/sys/mips/include/elf.h | 24 +++++++++-
head/sys/mips/include/mips_opcode.h | 12 ++++-
head/sys/mips/mips/busdma_machdep.c | 12 ++--
head/sys/mips/mips/locore.S | 4 +-
head/sys/mips/mips/trap.c | 29 ++++++++++-
head/sys/mips/mips/vm_machdep.c | 15 +++++-
head/sys/mips/rt305x/rt305x_machdep.c | 7 ++-
head/sys/mips/rt305x/rt305x_sysctl.c | 8 +-
head/sys/mips/rt305x/uart_dev_rt305x.c | 5 --
23 files changed, 207 insertions(+), 112 deletions(-)
diffs (857 lines):
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/atheros/if_arge.c
--- a/head/sys/mips/atheros/if_arge.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/atheros/if_arge.c Fri Mar 02 17:27:16 2012 +0200
@@ -231,13 +231,6 @@
#endif
}
-struct miibus_ivars {
- struct ifnet *ifp;
- ifm_change_cb_t ifmedia_upd;
- ifm_stat_cb_t ifmedia_sts;
- int mii_flags;
-};
-
static int
arge_attach(device_t dev)
{
@@ -679,7 +672,6 @@
else
sc->arge_media_type = IFM_100_TX;
- printf("%s:%d: call arge_set_pll(sc, media=%08x, duplex=%08x)\n", __func__, __LINE__, sc->arge_media_type, sc->arge_media_duplex);
arge_set_pll(sc, sc->arge_media_type, sc->arge_media_duplex);
ARGE_UNLOCK(sc);
return;
@@ -688,7 +680,6 @@
if (mii->mii_media_status & IFM_ACTIVE) {
if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
sc->arge_link_status = 1;
- printf("%s:%d: call arge_set_pll(sc, media=%08x, duplex=%08x)\n", __func__, __LINE__, IFM_SUBTYPE(mii->mii_media_active), (mii->mii_media_active & IFM_GMASK));
arge_set_pll(sc, IFM_SUBTYPE(mii->mii_media_active),
(mii->mii_media_active & IFM_GMASK));
}
@@ -1200,7 +1191,8 @@
NULL, NULL, /* lockfunc, lockarg */
&sc->arge_cdata.arge_parent_tag);
if (error != 0) {
- device_printf(sc->arge_dev, "failed to create parent DMA tag\n");
+ device_printf(sc->arge_dev,
+ "failed to create parent DMA tag\n");
goto fail;
}
/* Create tag for Tx ring. */
@@ -1217,7 +1209,8 @@
NULL, NULL, /* lockfunc, lockarg */
&sc->arge_cdata.arge_tx_ring_tag);
if (error != 0) {
- device_printf(sc->arge_dev, "failed to create Tx ring DMA tag\n");
+ device_printf(sc->arge_dev,
+ "failed to create Tx ring DMA tag\n");
goto fail;
}
@@ -1235,7 +1228,8 @@
NULL, NULL, /* lockfunc, lockarg */
&sc->arge_cdata.arge_rx_ring_tag);
if (error != 0) {
- device_printf(sc->arge_dev, "failed to create Rx ring DMA tag\n");
+ device_printf(sc->arge_dev,
+ "failed to create Rx ring DMA tag\n");
goto fail;
}
@@ -1253,7 +1247,8 @@
NULL, NULL, /* lockfunc, lockarg */
&sc->arge_cdata.arge_tx_tag);
if (error != 0) {
- device_printf(sc->arge_dev, "failed to create Tx DMA tag\n");
+ device_printf(sc->arge_dev,
+ "failed to create Tx DMA tag\n");
goto fail;
}
@@ -1271,7 +1266,8 @@
NULL, NULL, /* lockfunc, lockarg */
&sc->arge_cdata.arge_rx_tag);
if (error != 0) {
- device_printf(sc->arge_dev, "failed to create Rx DMA tag\n");
+ device_printf(sc->arge_dev,
+ "failed to create Rx DMA tag\n");
goto fail;
}
@@ -1517,10 +1513,9 @@
int err;
m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
- if (m == NULL) {
- printf("m_getcl fail\n");
+ if (m == NULL)
return (ENOBUFS);
- }
+
m->m_len = m->m_pkthdr.len = MCLBYTES;
m_adj(m, sizeof(uint64_t));
@@ -1528,7 +1523,6 @@
sc->arge_cdata.arge_rx_sparemap, m, segs, &nsegs, 0);
if (err != 0) {
m_freem(m);
- printf("bus_dmamap_load_mbuf_sg return %d\n", err);
return (ENOBUFS);
}
KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs));
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/atheros/if_argevar.h
--- a/head/sys/mips/atheros/if_argevar.h Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/atheros/if_argevar.h Fri Mar 02 17:27:16 2012 +0200
@@ -31,10 +31,8 @@
#define __IF_ARGEVAR_H__
#define ARGE_NPHY 32
-//#define ARGE_TX_RING_COUNT 128
-//#define ARGE_RX_RING_COUNT 128
-#define ARGE_TX_RING_COUNT 512
-#define ARGE_RX_RING_COUNT 512
+#define ARGE_TX_RING_COUNT 128
+#define ARGE_RX_RING_COUNT 128
#define ARGE_RX_DMA_SIZE ARGE_RX_RING_COUNT * sizeof(struct arge_desc)
#define ARGE_TX_DMA_SIZE ARGE_TX_RING_COUNT * sizeof(struct arge_desc)
#define ARGE_MAXFRAGS 8
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/cavium/files.octeon1
--- a/head/sys/mips/cavium/files.octeon1 Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/cavium/files.octeon1 Fri Mar 02 17:27:16 2012 +0200
@@ -1,4 +1,4 @@
-# $FreeBSD: head/sys/mips/cavium/files.octeon1 229677 2012-01-06 01:23:26Z gonzo $
+# $FreeBSD: head/sys/mips/cavium/files.octeon1 232289 2012-02-29 05:48:29Z gonzo $
# Octeon Support Files
#
mips/cavium/asm_octeon.S optional smp
@@ -24,6 +24,9 @@
mips/mips/octeon_cop2_swtch.S standard
mips/mips/octeon_cop2.c standard
+mips/cavium/if_octm.c optional octm
+contrib/octeon-sdk/cvmx-mgmt-port.c optional octm
+
mips/cavium/octe/ethernet.c optional octe
mips/cavium/octe/ethernet-mv88e61xx.c optional octe octeon_vendor_lanner
mips/cavium/octe/ethernet-common.c optional octe
@@ -39,10 +42,6 @@
mips/cavium/octe/octe.c optional octe
mips/cavium/octe/octebus.c optional octe
-mips/cavium/if_octm.c optional octm
-
-contrib/octeon-sdk/cvmx-mgmt-port.c optional octm
-
mips/cavium/octopci.c optional pci
mips/cavium/octopci_bus_space.c optional pci
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/cavium/if_octm.c
--- a/head/sys/mips/cavium/if_octm.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/cavium/if_octm.c Fri Mar 02 17:27:16 2012 +0200
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: head/sys/mips/cavium/if_octm.c 226024 2011-10-04 20:17:43Z marcel $
+ * $FreeBSD: head/sys/mips/cavium/if_octm.c 232289 2012-02-29 05:48:29Z gonzo $
*/
/*
@@ -179,6 +179,7 @@
mac = 0;
memcpy((u_int8_t *)&mac + 2, cvmx_sysinfo_get()->mac_addr_base, 6);
mac += sc->sc_port;
+
cvmx_mgmt_port_set_mac(sc->sc_port, mac);
/* No watermark for input ring. */
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/cavium/octe/ethernet-common.c
--- a/head/sys/mips/cavium/octe/ethernet-common.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/cavium/octe/ethernet-common.c Fri Mar 02 17:27:16 2012 +0200
@@ -28,7 +28,7 @@
*************************************************************************/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet-common.c 226024 2011-10-04 20:17:43Z marcel $");
+__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet-common.c 232289 2012-02-29 05:48:29Z gonzo $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -46,6 +46,8 @@
extern int octeon_is_simulation(void);
+static uint64_t cvm_oct_mac_addr = 0;
+static uint32_t cvm_oct_mac_addr_offset = 0;
/**
* Set the multicast list. Currently unimplemented.
@@ -90,6 +92,57 @@
/**
+ * Assign a MAC addres from the pool of available MAC addresses
+ * Can return as either a 64-bit value and/or 6 octets.
+ *
+ * @param macp Filled in with the assigned address if non-NULL
+ * @param octets Filled in with the assigned address if non-NULL
+ * @return Zero on success
+ */
+int cvm_assign_mac_address(uint64_t *macp, uint8_t *octets)
+{
+ /* Initialize from global MAC address base; fail if not set */
+ if (cvm_oct_mac_addr == 0) {
+ memcpy((uint8_t *)&cvm_oct_mac_addr + 2,
+ cvmx_sysinfo_get()->mac_addr_base, 6);
+
+ if (cvm_oct_mac_addr == 0)
+ return ENXIO;
+
+ /*
+ * The offset from mac_addr_base that should be used for the next port
+ * that is configured. By convention, if any mgmt ports exist on the
+ * chip, they get the first mac addresses. The ports controlled by
+ * driver that use this function are numbered sequencially following
+ * any mgmt addresses that may exist.
+ *
+ * XXX Would be nice if __cvmx_mgmt_port_num_ports() were
+ * not static to cvmx-mgmt-port.c.
+ */
+ if (OCTEON_IS_MODEL(OCTEON_CN56XX))
+ cvm_oct_mac_addr_offset = 1;
+ else if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN63XX))
+ cvm_oct_mac_addr_offset = 2;
+ else
+ cvm_oct_mac_addr_offset = 0;
+ cvm_oct_mac_addr += cvm_oct_mac_addr_offset;
+ }
+
+ if (cvm_oct_mac_addr_offset >= cvmx_sysinfo_get()->mac_addr_count)
+ return ENXIO; /* Out of addresses to assign */
+
+ if (macp)
+ *macp = cvm_oct_mac_addr;
+ if (octets)
+ memcpy(octets, (u_int8_t *)&cvm_oct_mac_addr + 2, 6);
+
+ cvm_oct_mac_addr++;
+ cvm_oct_mac_addr_offset++;
+
+ return 0;
+}
+
+/**
* Set the hardware MAC address for a device
*
* @param dev Device to change the MAC address for
@@ -268,16 +321,11 @@
*/
int cvm_oct_common_init(struct ifnet *ifp)
{
- char mac[6] = {
- cvmx_sysinfo_get()->mac_addr_base[0],
- cvmx_sysinfo_get()->mac_addr_base[1],
- cvmx_sysinfo_get()->mac_addr_base[2],
- cvmx_sysinfo_get()->mac_addr_base[3],
- cvmx_sysinfo_get()->mac_addr_base[4],
- cvmx_sysinfo_get()->mac_addr_base[5] };
+ uint8_t mac[6];
cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
- mac[5] += cvm_oct_mac_addr_offset++;
+ if (cvm_assign_mac_address(NULL, mac) != 0)
+ return ENXIO;
ifp->if_mtu = ETHERMTU;
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/cavium/octe/ethernet-common.h
--- a/head/sys/mips/cavium/octe/ethernet-common.h Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/cavium/octe/ethernet-common.h Fri Mar 02 17:27:16 2012 +0200
@@ -26,7 +26,7 @@
AND 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.
*************************************************************************/
-/* $FreeBSD: head/sys/mips/cavium/octe/ethernet-common.h 219706 2011-03-16 22:51:34Z jmallett $ */
+/* $FreeBSD: head/sys/mips/cavium/octe/ethernet-common.h 231987 2012-02-22 01:30:25Z gonzo $ */
int cvm_oct_common_open(struct ifnet *ifp);
int cvm_oct_common_stop(struct ifnet *ifp);
@@ -37,6 +37,7 @@
int cvm_oct_common_change_mtu(struct ifnet *ifp, int new_mtu);
void cvm_oct_common_set_multicast_list(struct ifnet *ifp);
void cvm_oct_common_set_mac_address(struct ifnet *ifp, const void *);
+int cvm_assign_mac_address(uint64_t *, uint8_t *);
int cvm_oct_init_module(device_t);
void cvm_oct_cleanup_module(device_t);
@@ -52,4 +53,3 @@
void cvm_oct_spi_uninit(struct ifnet *ifp);
int cvm_oct_xaui_init(struct ifnet *ifp);
-extern unsigned int cvm_oct_mac_addr_offset;
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/cavium/octe/ethernet-rgmii.c
--- a/head/sys/mips/cavium/octe/ethernet-rgmii.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/cavium/octe/ethernet-rgmii.c Fri Mar 02 17:27:16 2012 +0200
@@ -28,7 +28,7 @@
*************************************************************************/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet-rgmii.c 216071 2010-11-30 07:14:05Z jmallett $");
+__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet-rgmii.c 231987 2012-02-22 01:30:25Z gonzo $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -215,7 +215,9 @@
int error;
int rid;
- cvm_oct_common_init(ifp);
+ if (cvm_oct_common_init(ifp) != 0)
+ return ENXIO;
+
priv->open = cvm_oct_common_open;
priv->stop = cvm_oct_common_stop;
priv->stop(ifp);
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/cavium/octe/ethernet-sgmii.c
--- a/head/sys/mips/cavium/octe/ethernet-sgmii.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/cavium/octe/ethernet-sgmii.c Fri Mar 02 17:27:16 2012 +0200
@@ -28,7 +28,7 @@
*************************************************************************/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet-sgmii.c 216071 2010-11-30 07:14:05Z jmallett $");
+__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet-sgmii.c 231987 2012-02-22 01:30:25Z gonzo $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -49,7 +49,10 @@
int cvm_oct_sgmii_init(struct ifnet *ifp)
{
cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
- cvm_oct_common_init(ifp);
+
+ if (cvm_oct_common_init(ifp) != 0)
+ return ENXIO;
+
priv->open = cvm_oct_common_open;
priv->stop = cvm_oct_common_stop;
priv->stop(ifp);
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/cavium/octe/ethernet-spi.c
--- a/head/sys/mips/cavium/octe/ethernet-spi.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/cavium/octe/ethernet-spi.c Fri Mar 02 17:27:16 2012 +0200
@@ -28,7 +28,7 @@
*************************************************************************/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet-spi.c 210311 2010-07-20 19:25:11Z jmallett $");
+__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet-spi.c 231987 2012-02-22 01:30:25Z gonzo $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -289,7 +289,8 @@
cvm_oct_spi_enable_error_reporting(INTERFACE(priv->port));
priv->poll = cvm_oct_spi_poll;
}
- cvm_oct_common_init(ifp);
+ if (cvm_oct_common_init(ifp) != 0)
+ return ENXIO;
return 0;
}
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/cavium/octe/ethernet-xaui.c
--- a/head/sys/mips/cavium/octe/ethernet-xaui.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/cavium/octe/ethernet-xaui.c Fri Mar 02 17:27:16 2012 +0200
@@ -28,7 +28,7 @@
*************************************************************************/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet-xaui.c 216071 2010-11-30 07:14:05Z jmallett $");
+__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet-xaui.c 231987 2012-02-22 01:30:25Z gonzo $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -49,7 +49,10 @@
int cvm_oct_xaui_init(struct ifnet *ifp)
{
cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
- cvm_oct_common_init(ifp);
+
+ if (cvm_oct_common_init(ifp) != 0)
+ return ENXIO;
+
priv->open = cvm_oct_common_open;
priv->stop = cvm_oct_common_stop;
priv->stop(ifp);
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/cavium/octe/ethernet.c
--- a/head/sys/mips/cavium/octe/ethernet.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/cavium/octe/ethernet.c Fri Mar 02 17:27:16 2012 +0200
@@ -27,7 +27,7 @@
*************************************************************************/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet.c 226024 2011-10-04 20:17:43Z marcel $");
+__FBSDID("$FreeBSD: head/sys/mips/cavium/octe/ethernet.c 231987 2012-02-22 01:30:25Z gonzo $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -97,15 +97,6 @@
*/
static int cvm_oct_num_output_buffers;
-/*
- * The offset from mac_addr_base that should be used for the next port
- * that is configured. By convention, if any mgmt ports exist on the
- * chip, they get the first mac addresses. The ports controlled by
- * this driver are numbered sequencially following any mgmt addresses
- * that may exist.
- */
-unsigned int cvm_oct_mac_addr_offset;
-
/**
* Function to update link status.
*/
@@ -321,20 +312,6 @@
printf("cavium-ethernet: %s\n", OCTEON_SDK_VERSION_STRING);
- /*
- * MAC addresses for this driver start after the management
- * ports.
- *
- * XXX Would be nice if __cvmx_mgmt_port_num_ports() were
- * not static to cvmx-mgmt-port.c.
- */
- if (OCTEON_IS_MODEL(OCTEON_CN56XX))
- cvm_oct_mac_addr_offset = 1;
- else if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN63XX))
- cvm_oct_mac_addr_offset = 2;
- else
- cvm_oct_mac_addr_offset = 0;
-
cvm_oct_rx_initialize();
cvm_oct_configure_common_hw(bus);
@@ -375,15 +352,17 @@
int num_ports = cvmx_helper_ports_on_interface(interface);
int port;
- for (port = cvmx_helper_get_ipd_port(interface, 0); port < cvmx_helper_get_ipd_port(interface, num_ports); port++) {
+ for (port = cvmx_helper_get_ipd_port(interface, 0);
+ port < cvmx_helper_get_ipd_port(interface, num_ports);
+ ifnum++, port++) {
cvm_oct_private_t *priv;
struct ifnet *ifp;
- dev = BUS_ADD_CHILD(bus, 0, "octe", ifnum++);
+ dev = BUS_ADD_CHILD(bus, 0, "octe", ifnum);
if (dev != NULL)
ifp = if_alloc(IFT_ETHER);
if (dev == NULL || ifp == NULL) {
- printf("\t\tFailed to allocate ethernet device for port %d\n", port);
+ printf("Failed to allocate ethernet device for interface %d port %d\n", interface, port);
continue;
}
@@ -454,12 +433,13 @@
ifp->if_softc = priv;
if (!priv->init) {
- panic("%s: unsupported device type, need to free ifp.", __func__);
- } else
- if (priv->init(ifp) < 0) {
- printf("\t\tFailed to register ethernet device for interface %d, port %d\n",
- interface, priv->port);
- panic("%s: init failed, need to free ifp.", __func__);
+ printf("octe%d: unsupported device type interface %d, port %d\n",
+ ifnum, interface, priv->port);
+ if_free(ifp);
+ } else if (priv->init(ifp) != 0) {
+ printf("octe%d: failed to register device for interface %d, port %d\n",
+ ifnum, interface, priv->port);
+ if_free(ifp);
} else {
cvm_oct_device[priv->port] = ifp;
fau -= cvmx_pko_get_num_queues(priv->port) * sizeof(uint32_t);
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/cavium/octopci.c
--- a/head/sys/mips/cavium/octopci.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/cavium/octopci.c Fri Mar 02 17:27:16 2012 +0200
@@ -339,6 +339,7 @@
sc = device_get_softc(dev);
+#define PCI_CONFIG_SPACE_DELAY 10000
if (octeon_has_feature(OCTEON_FEATURE_PCIE)) {
if (bus == 0 && slot == 0 && func == 0)
return ((uint32_t)-1);
@@ -356,6 +357,7 @@
}
addr = octopci_cs_addr(bus, slot, func, reg);
+ DELAY(PCI_CONFIG_SPACE_DELAY);
switch (bytes) {
case 4:
@@ -398,6 +400,7 @@
}
addr = octopci_cs_addr(bus, slot, func, reg);
+ DELAY(PCI_CONFIG_SPACE_DELAY);
switch (bytes) {
case 4:
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/conf/AR7242
--- a/head/sys/mips/conf/AR7242 Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/conf/AR7242 Fri Mar 02 17:27:16 2012 +0200
@@ -67,7 +67,8 @@
device mii
device arge
-device rlswitch
+device switch
+device switch_ar8x16
device usb
options USB_EHCI_BIG_ENDIAN_DESC # handle big-endian byte order
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/conf/OCTEON1
--- a/head/sys/mips/conf/OCTEON1 Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/conf/OCTEON1 Fri Mar 02 17:27:16 2012 +0200
@@ -24,7 +24,7 @@
makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1
# Don't build any modules yet.
-makeoptions MODULES_OVERRIDE="wlan_acl wlan_amrr wlan_ccmp wlan_rssadapt wlan_tkip wlan_wep wlan_xauth"
+makeoptions MODULES_OVERRIDE="wlan_acl wlan_amrr wlan_ccmp wlan_rssadapt wlan_tkip wlan_wep wlan_xauth usb/run"
makeoptions KERNLOADADDR=0xffffffff80100000
include "../cavium/std.octeon1"
@@ -109,6 +109,8 @@
#x#options ROOTDEVNAME=\"ufs:cf0s2a\" # Default root filesystem.
+device gpio
+
device cfi # Detect Flash memmory
device cfid
device geom_map
@@ -297,8 +299,8 @@
# USB support
#options USB_DEBUG # enable debug msgs
#x#
-device cndotg
-#device octusb # Cavium Octeon on-board USB interface (USB 2.0)
+#device cndotg
+device octusb # Cavium Octeon on-board USB interface (USB 2.0)
#device uhci # UHCI PCI->USB interface
#device ohci # OHCI PCI->USB interface
#device ehci # EHCI PCI->USB interface (USB 2.0)
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/include/elf.h
--- a/head/sys/mips/include/elf.h Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/include/elf.h Fri Mar 02 17:27:16 2012 +0200
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* JNPR: elf.h,v 1.4 2006/12/02 09:53:40 katta
- * $FreeBSD$
+ * $FreeBSD: head/sys/mips/include/elf.h 231406 2012-02-10 19:17:14Z gonzo $
*
*/
@@ -189,9 +189,27 @@
#define R_MIPS_REL16 33
#define R_MIPS_ADD_IMMEDIATE 34
#define R_MIPS_PJUMP 35
-#define R_MIPS_ERLGOT 36
+#define R_MIPS_RELGOT 36
+#define R_MIPS_JALR 37
-#define R_MIPS_max 37
+/*
+ * TLS relocations
+ */
+#define R_MIPS_TLS_DTPMOD32 38 /* Module number 32 bit */
+#define R_MIPS_TLS_DTPREL32 39 /* Module-relative offset 32 bit */
+#define R_MIPS_TLS_DTPMOD64 40 /* Module number 64 bit */
+#define R_MIPS_TLS_DTPREL64 41 /* Module-relative offset 64 bit */
+#define R_MIPS_TLS_GD 42 /* 16 bit GOT offset for GD */
+#define R_MIPS_TLS_LDM 43 /* 16 bit GOT offset for LDM */
+#define R_MIPS_TLS_DTPREL_HI16 44 /* Module-relative offset, high 16 bits */
+#define R_MIPS_TLS_DTPREL_LO16 45 /* Module-relative offset, low 16 bits */
+#define R_MIPS_TLS_GOTTPREL 46 /* 16 bit GOT offset for IE */
+#define R_MIPS_TLS_TPREL32 47 /* TP-relative offset, 32 bit */
+#define R_MIPS_TLS_TPREL64 48 /* TP-relative offset, 64 bit */
+#define R_MIPS_TLS_TPREL_HI16 49 /* TP-relative offset, high 16 bits */
+#define R_MIPS_TLS_TPREL_LO16 50 /* TP-relative offset, low 16 bits */
+
+#define R_MIPS_max 51
#define R_TYPE(name) __CONCAT(R_MIPS_,name)
/* Define "machine" characteristics */
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/include/mips_opcode.h
--- a/head/sys/mips/include/mips_opcode.h Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/include/mips_opcode.h Fri Mar 02 17:27:16 2012 +0200
@@ -33,7 +33,7 @@
*
* from: @(#)mips_opcode.h 8.1 (Berkeley) 6/10/93
* JNPR: mips_opcode.h,v 1.1 2006/08/07 05:38:57 katta
- * $FreeBSD$
+ * $FreeBSD: head/sys/mips/include/mips_opcode.h 231312 2012-02-09 22:17:13Z gonzo $
*/
#ifndef _MACHINE_MIPS_OPCODE_H_
@@ -176,6 +176,11 @@
#define OP_LDL 032
#define OP_LDR 033
+#define OP_SPECIAL2 034
+#define OP_JALX 035
+
+#define OP_SPECIAL3 037
+
#define OP_LB 040
#define OP_LH 041
#define OP_LWL 042
@@ -389,6 +394,11 @@
#define OP_R_BGEZALL OP_BGEZALL
/*
+ * Values for the 'func' field when 'op' == OP_SPECIAL3.
+ */
+#define OP_RDHWR 073
+
+/*
* Values for the 'rs' field when 'op' == OP_COPz.
*/
#define OP_MF 000
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/mips/busdma_machdep.c
--- a/head/sys/mips/mips/busdma_machdep.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/mips/busdma_machdep.c Fri Mar 02 17:27:16 2012 +0200
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/mips/mips/busdma_machdep.c 227309 2011-11-07 15:43:11Z ed $");
+__FBSDID("$FreeBSD: head/sys/mips/mips/busdma_machdep.c 232356 2012-03-01 19:58:34Z jhb $");
/*
* MIPS bus dma support routines
@@ -67,7 +67,7 @@
struct bus_dma_tag {
bus_dma_tag_t parent;
bus_size_t alignment;
- bus_size_t boundary;
+ bus_addr_t boundary;
bus_addr_t lowaddr;
bus_addr_t highaddr;
bus_dma_filter_t *filter;
@@ -310,7 +310,7 @@
int
bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
- bus_size_t boundary, bus_addr_t lowaddr,
+ bus_addr_t boundary, bus_addr_t lowaddr,
bus_addr_t highaddr, bus_dma_filter_t *filter,
void *filterarg, bus_size_t maxsize, int nsegments,
bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
@@ -356,13 +356,13 @@
* Take into account any restrictions imposed by our parent tag
*/
if (parent != NULL) {
- newtag->lowaddr = min(parent->lowaddr, newtag->lowaddr);
- newtag->highaddr = max(parent->highaddr, newtag->highaddr);
+ newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr);
+ newtag->highaddr = MAX(parent->highaddr, newtag->highaddr);
if (newtag->boundary == 0)
newtag->boundary = parent->boundary;
else if (parent->boundary != 0)
newtag->boundary =
- min(parent->boundary, newtag->boundary);
+ MIN(parent->boundary, newtag->boundary);
if ((newtag->filter != NULL) ||
((parent->flags & BUS_DMA_COULD_BOUNCE) != 0))
newtag->flags |= BUS_DMA_COULD_BOUNCE;
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/mips/locore.S
--- a/head/sys/mips/mips/locore.S Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/mips/locore.S Fri Mar 02 17:27:16 2012 +0200
@@ -47,7 +47,7 @@
*
* from: @(#)locore.s 8.5 (Berkeley) 1/4/94
* JNPR: locore.S,v 1.6.2.1 2007/08/29 12:24:49 girish
- * $FreeBSD: head/sys/mips/mips/locore.S 229677 2012-01-06 01:23:26Z gonzo $
+ * $FreeBSD: head/sys/mips/mips/locore.S 231712 2012-02-14 20:34:25Z rwatson $
*/
/*
@@ -118,7 +118,7 @@
*/
li t1, MIPS_SR_COP_1_BIT
#ifdef __mips_n64
- or t1, MIPS_SR_KX | MIPS_SR_UX
+ or t1, MIPS_SR_KX | MIPS_SR_SX | MIPS_SR_UX
#endif
#endif
/*
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/mips/trap.c
--- a/head/sys/mips/mips/trap.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/mips/trap.c Fri Mar 02 17:27:16 2012 +0200
@@ -39,7 +39,7 @@
* JNPR: trap.c,v 1.13.2.2 2007/08/29 10:03:49 girish
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/mips/mips/trap.c 229677 2012-01-06 01:23:26Z gonzo $");
+__FBSDID("$FreeBSD: head/sys/mips/mips/trap.c 231314 2012-02-09 22:48:35Z gonzo $");
#include "opt_ddb.h"
#include "opt_global.h"
@@ -414,6 +414,7 @@
intptr_t addr = 0;
register_t pc;
int cop;
+ register_t *frame_regs;
trapdebug_enter(trapframe, 0);
@@ -762,9 +763,29 @@
}
case T_RES_INST + T_USER:
- log_illegal_instruction("RES_INST", trapframe);
- i = SIGILL;
- addr = trapframe->pc;
+ {
+ InstFmt inst;
+ inst = *(InstFmt *)(intptr_t)trapframe->pc;
+ switch (inst.RType.op) {
+ case OP_SPECIAL3:
+ switch (inst.RType.func) {
+ case OP_RDHWR:
+ /* Register 29 used for TLS */
+ if (inst.RType.rd == 29) {
+ frame_regs = &(trapframe->zero);
+ frame_regs[inst.RType.rt] = (register_t)(intptr_t)td->td_md.md_tls;
+ trapframe->pc += sizeof(int);
+ goto out;
+ }
+ break;
+ }
+ break;
+ }
+
+ log_illegal_instruction("RES_INST", trapframe);
+ i = SIGILL;
+ addr = trapframe->pc;
+ }
break;
case T_C2E:
case T_C2E + T_USER:
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/mips/vm_machdep.c
--- a/head/sys/mips/mips/vm_machdep.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/mips/vm_machdep.c Fri Mar 02 17:27:16 2012 +0200
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/mips/mips/vm_machdep.c 229677 2012-01-06 01:23:26Z gonzo $");
+__FBSDID("$FreeBSD: head/sys/mips/mips/vm_machdep.c 231470 2012-02-10 23:24:33Z gonzo $");
#include "opt_cputype.h"
#include "opt_ddb.h"
@@ -601,7 +601,18 @@
cpu_set_user_tls(struct thread *td, void *tls_base)
{
- td->td_md.md_tls = tls_base;
+ /*
+ * tls_base passed to this function
+ * from thr_new call and points to actual TCB struct,
+ * so we should add TP_OFFSET + sizeof(struct tcb)
+ * to make it the same way TLS base is passed to
+ * MIPS_SET_TLS/MIPS_GET_TLS API
+ */
+#ifdef __mips_n64
+ td->td_md.md_tls = (char*)tls_base + 0x7010;
+#else
+ td->td_md.md_tls = (char*)tls_base + 0x7008;
+#endif
return (0);
}
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/rt305x/rt305x_machdep.c
--- a/head/sys/mips/rt305x/rt305x_machdep.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/rt305x/rt305x_machdep.c Fri Mar 02 17:27:16 2012 +0200
@@ -136,12 +136,17 @@
void
platform_reset(void)
{
+#ifdef RSTCTRL_RESET
uint32_t *reset_ctl;
- /* XXX: CFI must be reseted by call loader deom flash */
+ /* XXX: CFI must be reseted by call loader from flash */
reset_ctl = (uint32_t *)MIPS_KSEG0_TO_PHYS(SYSCTL_BASE +
SYSCTL_RSTCTRL);
*reset_ctl = SYSCTL_RSTCTRL_SYS;
+#else
+ __asm __volatile("li $25, 0xbf000000");
+ __asm __volatile("j $25");
+#endif
}
void
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/rt305x/rt305x_sysctl.c
--- a/head/sys/mips/rt305x/rt305x_sysctl.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/rt305x/rt305x_sysctl.c Fri Mar 02 17:27:16 2012 +0200
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: head/sys/mips/rt305x/rt305x_sysctl.c 232250 2012-02-28 13:19:34Z gavin $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -84,7 +84,7 @@
if ( val & SYSCTL_SYSCFG_BIG_ENDIAN)
printf("\tBig Endian\n");
if ( val & SYSCTL_SYSCFG_CPU_CLK_SEL_384MHZ)
- printf("\tClock is 384Mhz\n");
+ printf("\tClock is 384MHz\n");
printf("\tBoot from %u\n",
((val & SYSCTL_SYSCFG_BOOT_FROM_MASK) >>
SYSCTL_SYSCFG_BOOT_FROM_SHIFT));
@@ -109,7 +109,7 @@
printf("\tI2S clock is enabled\n");
printf("\tI2S clock is %s\n",
(val & SYSCTL_CLKCFG1_I2S_CLK_SEL_EXT)?
- "external":"internal 15.625Mhz");
+ "external":"internal 15.625MHz");
printf("\tI2S clock divider %u\n",
((val & SYSCTL_CLKCFG1_I2S_CLK_DIV_MASK) >>
SYSCTL_CLKCFG1_I2S_CLK_DIV_SHIFT));
@@ -118,7 +118,7 @@
printf("\tPCM clock is %s\n",
(val & SYSCTL_CLKCFG1_PCM_CLK_SEL_EXT)?
- "external":"internal 15.625Mhz");
+ "external":"internal 15.625MHz");
printf("\tPCM clock divider %u\n",
((val & SYSCTL_CLKCFG1_PCM_CLK_DIV_MASK) >>
SYSCTL_CLKCFG1_PCM_CLK_DIV_SHIFT));
diff -r ff9b7f9bab8d -r dc3e1538e0ca head/sys/mips/rt305x/uart_dev_rt305x.c
--- a/head/sys/mips/rt305x/uart_dev_rt305x.c Fri Mar 02 17:25:47 2012 +0200
+++ b/head/sys/mips/rt305x/uart_dev_rt305x.c Fri Mar 02 17:27:16 2012 +0200
@@ -399,12 +399,7 @@
case UART_IIR_ID_LINESTATUS:
ipend |= SER_INT_SIGCHG;
if (lsr & UART_LSR_BI)
- {
ipend |= SER_INT_BREAK;
-#ifdef KDB
- breakpoint();
-#endif
- }
if (lsr & UART_LSR_OE)
ipend |= SER_INT_OVERRUN;
break;
More information about the Zrouter-src-freebsd
mailing list