CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Thu May 27 03:23:29 UTC 2021 Modified Files: src/sys/arch/mips/cavium/dev: if_cnmac.c Log Message: Move the send queue checking to a new function, and also call this in the rx interrupt path. Measureable improvement on a NFS "create small files" test. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/cavium/dev/if_cnmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/if_cnmac.c diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.26 --- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25 Thu May 27 01:43:32 2021 +++ src/sys/arch/mips/cavium/dev/if_cnmac.c Thu May 27 03:23:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $ */ +/* $NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $"); /* * If no free send buffer is available, free all the sent buffers and bail out. @@ -122,6 +122,7 @@ static inline void cnmac_send_queue_flus static inline void cnmac_send_queue_flush_fetch(struct cnmac_softc *); static inline void cnmac_send_queue_flush(struct cnmac_softc *); static inline void cnmac_send_queue_flush_sync(struct cnmac_softc *); +static void cnmac_send_queue_check_and_flush(struct cnmac_softc *); static inline int cnmac_send_queue_is_full(struct cnmac_softc *); static inline void cnmac_send_queue_add(struct cnmac_softc *, struct mbuf *, uint64_t *); @@ -604,6 +605,23 @@ cnmac_send_queue_is_full(struct cnmac_so return 0; } +static void +cnmac_send_queue_check_and_flush(struct cnmac_softc *sc) +{ + int s; + + /* XXX XXX XXX */ + s = splnet(); + if (sc->sc_soft_req_cnt > 0) { + cnmac_send_queue_flush_prefetch(sc); + cnmac_send_queue_flush_fetch(sc); + cnmac_send_queue_flush(sc); + cnmac_send_queue_flush_sync(sc); + } + splx(s); + /* XXX XXX XXX */ +} + /* * (Ab)use m_nextpkt and m_paddr to maintain mbuf chain and pointer to gather * buffer. Other mbuf members may be used by m_freem(), so don't touch them! @@ -1299,6 +1317,8 @@ cnmac_intr(void *arg) } (void)cnmac_recv(sc, work); + + cnmac_send_queue_check_and_flush(sc); } _POW_WR8(sc->sc_pow, POW_WQ_INT_OFFSET, wqmask); @@ -1326,21 +1346,11 @@ cnmac_tick_free(void *arg) { struct cnmac_softc *sc = arg; int timo; - int s; - s = splnet(); - /* XXX XXX XXX */ - if (sc->sc_soft_req_cnt > 0) { - cnmac_send_queue_flush_prefetch(sc); - cnmac_send_queue_flush_fetch(sc); - cnmac_send_queue_flush(sc); - cnmac_send_queue_flush_sync(sc); - } - /* XXX XXX XXX */ + cnmac_send_queue_check_and_flush(sc); timo = (sc->sc_ext_callback_cnt > 0) ? 1 : hz; callout_schedule(>sc_tick_free_ch, timo); - splx(s); } /*
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Thu May 27 01:43:32 UTC 2021 Modified Files: src/sys/arch/mips/cavium/dev: if_cnmac.c Log Message: Schedule the send cleanup function for next tick in cnmac_start(). In the send cleanup function, schedule for the next tick instead of waiting for HZ ticks if there are still send requests outstanding. Greatly increases NFS throughput, perhaps other types of network traffic. Use callout_setfunc() after callout_init() instead of callout_reset(). To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/mips/cavium/dev/if_cnmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/if_cnmac.c diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.24 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25 --- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.24 Tue Jun 23 05:17:13 2020 +++ src/sys/arch/mips/cavium/dev/if_cnmac.c Thu May 27 01:43:32 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_cnmac.c,v 1.24 2020/06/23 05:17:13 simonb Exp $ */ +/* $NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.24 2020/06/23 05:17:13 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $"); /* * If no free send buffer is available, free all the sent buffers and bail out. @@ -278,7 +278,10 @@ cnmac_attach(device_t parent, device_t s octgmx_stats_init(sc->sc_gmx_port); callout_init(>sc_tick_misc_ch, 0); + callout_setfunc(>sc_tick_misc_ch, cnmac_tick_misc, sc); + callout_init(>sc_tick_free_ch, 0); + callout_setfunc(>sc_tick_free_ch, cnmac_tick_free, sc); const int dv_unit = device_unit(self); octfau_op_init(>sc_fau_done, @@ -998,6 +1001,7 @@ cnmac_start(struct ifnet *ifp) if (wdc > 0) octpko_op_doorbell_write(sc->sc_port, sc->sc_port, wdc); + callout_schedule(>sc_tick_free_ch, 1); return; } /* XXX XXX XXX */ @@ -1031,6 +1035,7 @@ cnmac_start(struct ifnet *ifp) last: cnmac_send_queue_flush_fetch(sc); + callout_schedule(>sc_tick_free_ch, 1); } static void @@ -1073,8 +1078,8 @@ cnmac_init(struct ifnet *ifp) octgmx_set_filter(sc->sc_gmx_port); - callout_reset(>sc_tick_misc_ch, hz, cnmac_tick_misc, sc); - callout_reset(>sc_tick_free_ch, hz, cnmac_tick_free, sc); + callout_schedule(>sc_tick_misc_ch, hz); + callout_schedule(>sc_tick_free_ch, hz); SET(ifp->if_flags, IFF_RUNNING); CLR(ifp->if_flags, IFF_OACTIVE); @@ -1097,7 +1102,6 @@ cnmac_stop(struct ifnet *ifp, int disabl /* Mark the interface as down and cancel the watchdog timer. */ CLR(ifp->if_flags, IFF_RUNNING | IFF_OACTIVE); ifp->if_timer = 0; - } /* misc */ @@ -1334,13 +1338,8 @@ cnmac_tick_free(void *arg) } /* XXX XXX XXX */ - /* XXX XXX XXX */ - /* ??? */ - timo = hz - (100 * sc->sc_ext_callback_cnt); - if (timo < 10) - timo = 10; + timo = (sc->sc_ext_callback_cnt > 0) ? 1 : hz; callout_schedule(>sc_tick_free_ch, timo); - /* XXX XXX XXX */ splx(s); }
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Fri May 14 13:36:28 UTC 2021 Modified Files: src/sys/arch/mips/cavium/dev: octeon_gmx.c Log Message: Fix a missed bitmask to __SHIFTOUT conversion in rev 1.12. Fixes negotiation problems on non-gige switches. Problem discovered and tested by riastradh@. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/mips/cavium/dev/octeon_gmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.18 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.19 --- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.18 Wed May 5 06:47:29 2021 +++ src/sys/arch/mips/cavium/dev/octeon_gmx.c Fri May 14 13:36:28 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $ */ +/* $NetBSD: octeon_gmx.c,v 1.19 2021/05/14 13:36:28 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.19 2021/05/14 13:36:28 simonb Exp $"); #include #include @@ -834,7 +834,7 @@ octgmx_rgmii_speed_speed(struct octgmx_p prt_cfg = _GMX_PORT_RD8(sc, GMX0_PRT0_CFG); - switch (sc->sc_link & RXN_RX_INBND_SPEED) { + switch (__SHIFTOUT(sc->sc_link, RXN_RX_INBND_SPEED)) { case RXN_RX_INBND_SPEED_2_5: /* 10Mbps */ /*
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Wed May 5 06:47:29 UTC 2021 Modified Files: src/sys/arch/mips/cavium/dev: octeon_cib.c octeon_gmx.c octeon_intc.c Log Message: Sprinkle some static. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/dev/octeon_cib.c \ src/sys/arch/mips/cavium/dev/octeon_intc.c cvs rdiff -u -r1.17 -r1.18 src/sys/arch/mips/cavium/dev/octeon_gmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_cib.c diff -u src/sys/arch/mips/cavium/dev/octeon_cib.c:1.6 src/sys/arch/mips/cavium/dev/octeon_cib.c:1.7 --- src/sys/arch/mips/cavium/dev/octeon_cib.c:1.6 Wed Jan 27 03:10:21 2021 +++ src/sys/arch/mips/cavium/dev/octeon_cib.c Wed May 5 06:47:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_cib.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: octeon_cib.c,v 1.7 2021/05/05 06:47:29 simonb Exp $ */ /*- * Copyright (c) 2020 Jared D. McNeill @@ -29,7 +29,7 @@ #include "opt_multiprocessor.h" #include -__KERNEL_RCSID(0, "$NetBSD: octeon_cib.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_cib.c,v 1.7 2021/05/05 06:47:29 simonb Exp $"); #include #include @@ -53,7 +53,7 @@ static bool octeon_cib_intrstr(device_t, static int octeon_cib_intr(void *); -struct fdtbus_interrupt_controller_func octeon_cib_funcs = { +static struct fdtbus_interrupt_controller_func octeon_cib_funcs = { .establish = octeon_cib_establish, .disestablish = octeon_cib_disestablish, .intrstr = octeon_cib_intrstr Index: src/sys/arch/mips/cavium/dev/octeon_intc.c diff -u src/sys/arch/mips/cavium/dev/octeon_intc.c:1.6 src/sys/arch/mips/cavium/dev/octeon_intc.c:1.7 --- src/sys/arch/mips/cavium/dev/octeon_intc.c:1.6 Wed Jan 27 03:10:21 2021 +++ src/sys/arch/mips/cavium/dev/octeon_intc.c Wed May 5 06:47:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_intc.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: octeon_intc.c,v 1.7 2021/05/05 06:47:29 simonb Exp $ */ /*- * Copyright (c) 2020 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_intc.c,v 1.6 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_intc.c,v 1.7 2021/05/05 06:47:29 simonb Exp $"); #include #include @@ -49,7 +49,7 @@ static void * octeon_intc_establish(devi static void octeon_intc_disestablish(device_t, void *); static bool octeon_intc_intrstr(device_t, u_int *, char *, size_t); -struct fdtbus_interrupt_controller_func octeon_intc_funcs = { +static struct fdtbus_interrupt_controller_func octeon_intc_funcs = { .establish = octeon_intc_establish, .disestablish = octeon_intc_disestablish, .intrstr = octeon_intc_intrstr Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.17 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.18 --- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.17 Sat Apr 24 23:36:42 2021 +++ src/sys/arch/mips/cavium/dev/octeon_gmx.c Wed May 5 06:47:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_gmx.c,v 1.17 2021/04/24 23:36:42 thorpej Exp $ */ +/* $NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.17 2021/04/24 23:36:42 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.18 2021/05/05 06:47:29 simonb Exp $"); #include #include @@ -138,33 +138,33 @@ static const int octgmx_rx_adr_cam_regs[ GMX0_RX0_ADR_CAM3, GMX0_RX0_ADR_CAM4, GMX0_RX0_ADR_CAM5 }; -struct octgmx_port_ops octgmx_port_ops_mii = { +static struct octgmx_port_ops octgmx_port_ops_mii = { /* XXX not implemented */ }; -struct octgmx_port_ops octgmx_port_ops_gmii = { +static struct octgmx_port_ops octgmx_port_ops_gmii = { .port_ops_enable = octgmx_rgmii_enable, .port_ops_speed = octgmx_rgmii_speed, .port_ops_timing = octgmx_rgmii_timing, }; -struct octgmx_port_ops octgmx_port_ops_rgmii = { +static struct octgmx_port_ops octgmx_port_ops_rgmii = { .port_ops_enable = octgmx_rgmii_enable, .port_ops_speed = octgmx_rgmii_speed, .port_ops_timing = octgmx_rgmii_timing, }; -struct octgmx_port_ops octgmx_port_ops_sgmii = { +static struct octgmx_port_ops octgmx_port_ops_sgmii = { .port_ops_enable = octgmx_sgmii_enable, .port_ops_speed = octgmx_sgmii_speed, .port_ops_timing = octgmx_sgmii_timing, }; -struct octgmx_port_ops octgmx_port_ops_spi42 = { +static struct octgmx_port_ops octgmx_port_ops_spi42 = { /* XXX not implemented */ }; -struct octgmx_port_ops *octgmx_port_ops[] = { +static struct octgmx_port_ops *octgmx_port_ops[] = { [GMX_MII_PORT] = _port_ops_mii, [GMX_GMII_PORT] = _port_ops_gmii, [GMX_RGMII_PORT] = _port_ops_rgmii,
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Wed Mar 24 08:10:14 UTC 2021 Modified Files: src/sys/arch/mips/cavium/dev: octeon_fpa.c Log Message: Remove somewhat dubious empty octfpa_desc structure. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/cavium/dev/octeon_fpa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_fpa.c diff -u src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.9 src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.10 --- src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.9 Mon Jan 4 17:22:59 2021 +++ src/sys/arch/mips/cavium/dev/octeon_fpa.c Wed Mar 24 08:10:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_fpa.c,v 1.9 2021/01/04 17:22:59 thorpej Exp $ */ +/* $NetBSD: octeon_fpa.c,v 1.10 2021/03/24 08:10:14 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -29,7 +29,7 @@ #undef FPADEBUG #include -__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.9 2021/01/04 17:22:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.10 2021/03/24 08:10:14 simonb Exp $"); #include #include @@ -54,10 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c #define _DMA_NSEGS 1 #define _DMA_BUFLEN 0x0100 -/* pool descriptor */ -struct octfpa_desc { -}; - struct octfpa_softc { int sc_initialized; @@ -68,8 +64,6 @@ struct octfpa_softc { bus_space_handle_t sc_opsh; bus_dma_tag_t sc_dmat; - - struct octfpa_desc sc_descs[8]; }; void octfpa_bootstrap(struct octeon_config *);
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: thorpej Date: Mon Jan 4 17:22:59 UTC 2021 Modified Files: src/sys/arch/mips/cavium/dev: octeon_asx.c octeon_fpa.c octeon_gmx.c octeon_ipd.c octeon_pip.c octeon_pko.c Log Message: malloc(9) -> kmem(9) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/cavium/dev/octeon_asx.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/cavium/dev/octeon_fpa.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/cavium/dev/octeon_gmx.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/cavium/dev/octeon_ipd.c cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/cavium/dev/octeon_pip.c cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/cavium/dev/octeon_pko.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_asx.c diff -u src/sys/arch/mips/cavium/dev/octeon_asx.c:1.4 src/sys/arch/mips/cavium/dev/octeon_asx.c:1.5 --- src/sys/arch/mips/cavium/dev/octeon_asx.c:1.4 Tue Jun 23 05:14:18 2020 +++ src/sys/arch/mips/cavium/dev/octeon_asx.c Mon Jan 4 17:22:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_asx.c,v 1.4 2020/06/23 05:14:18 simonb Exp $ */ +/* $NetBSD: octeon_asx.c,v 1.5 2021/01/04 17:22:59 thorpej Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,11 +27,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_asx.c,v 1.4 2020/06/23 05:14:18 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_asx.c,v 1.5 2021/01/04 17:22:59 thorpej Exp $"); #include #include -#include +#include #include #include #include @@ -43,7 +43,7 @@ octasx_init(struct octasx_attach_args *a struct octasx_softc *sc; int status; - sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO); + sc = kmem_zalloc(sizeof(*sc), KM_SLEEP); if (sc == NULL) panic("can't allocate memory: %s", __func__); Index: src/sys/arch/mips/cavium/dev/octeon_fpa.c diff -u src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.8 src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.9 --- src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.8 Tue Jun 23 05:14:18 2020 +++ src/sys/arch/mips/cavium/dev/octeon_fpa.c Mon Jan 4 17:22:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_fpa.c,v 1.8 2020/06/23 05:14:18 simonb Exp $ */ +/* $NetBSD: octeon_fpa.c,v 1.9 2021/01/04 17:22:59 thorpej Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -29,12 +29,12 @@ #undef FPADEBUG #include -__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.8 2020/06/23 05:14:18 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.9 2021/01/04 17:22:59 thorpej Exp $"); #include #include #include -#include +#include #include #include @@ -113,10 +113,8 @@ octfpa_buf_init(int poolno, size_t size, paddr_t paddr; nsegs = 1/* XXX */; - fb = malloc(sizeof(*fb) + sizeof(*fb->fb_dma_segs) * nsegs, M_DEVBUF, - M_WAITOK | M_ZERO); - if (fb == NULL) - return 1; + fb = kmem_zalloc(sizeof(*fb) + sizeof(*fb->fb_dma_segs) * nsegs, + KM_SLEEP); fb->fb_poolno = poolno; fb->fb_size = size; fb->fb_nelems = nelems; Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.15 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.16 --- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.15 Tue Jun 23 05:17:13 2020 +++ src/sys/arch/mips/cavium/dev/octeon_gmx.c Mon Jan 4 17:22:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_gmx.c,v 1.15 2020/06/23 05:17:13 simonb Exp $ */ +/* $NetBSD: octeon_gmx.c,v 1.16 2021/01/04 17:22:59 thorpej Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.15 2020/06/23 05:17:13 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.16 2021/01/04 17:22:59 thorpej Exp $"); #include #include @@ -36,7 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c #include #include #include -#include +#include #include #include @@ -218,8 +218,8 @@ octgmx_attach(device_t parent, device_t octgmx_init(sc); - sc->sc_ports = malloc(sizeof(*sc->sc_ports) * sc->sc_nports, M_DEVBUF, - M_WAITOK | M_ZERO); + sc->sc_ports = kmem_zalloc(sizeof(*sc->sc_ports) * sc->sc_nports, + KM_SLEEP); for (i = 0; i < sc->sc_nports; i++) { port = GMX_PORT_NUM(sc->sc_unitno, i); Index: src/sys/arch/mips/cavium/dev/octeon_ipd.c diff -u src/sys/arch/mips/cavium/dev/octeon_ipd.c:1.7 src/sys/arch/mips/cavium/dev/octeon_ipd.c:1.8 --- src/sys/arch/mips/cavium/dev/octeon_ipd.c:1.7 Tue Jun 23 05:15:33 2020 +++ src/sys/arch/mips/cavium/dev/octeon_ipd.c Mon Jan 4 17:22:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_ipd.c,v 1.7 2020/06/23 05:15:33 simonb Exp $ */ +/* $NetBSD: octeon_ipd.c,v 1.8 2021/01/04 17:22:59 thorpej Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,11 +27,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_ipd.c,v 1.7 2020/06/23 05:15:33 simonb Exp $"); +__KERNEL_RCSID(0,
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: jmcneill Date: Thu Oct 15 09:32:40 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_xhci.c Log Message: Initialise xhci_softc sc_ios To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_xhci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_xhci.c diff -u src/sys/arch/mips/cavium/dev/octeon_xhci.c:1.2 src/sys/arch/mips/cavium/dev/octeon_xhci.c:1.3 --- src/sys/arch/mips/cavium/dev/octeon_xhci.c:1.2 Fri Jul 17 08:06:02 2020 +++ src/sys/arch/mips/cavium/dev/octeon_xhci.c Thu Oct 15 09:32:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_xhci.c,v 1.2 2020/07/17 08:06:02 simonb Exp $ */ +/* $NetBSD: octeon_xhci.c,v 1.3 2020/10/15 09:32:40 jmcneill Exp $ */ /* $OpenBSD: octxhci.c,v 1.4 2019/09/29 04:32:23 visa Exp $ */ /* @@ -115,6 +115,7 @@ octxhci_attach(device_t parent, device_t sc->sc_bus.ub_hcpriv = sc; sc->sc_bus.ub_dmatag = faa->faa_dmat; sc->sc_iot = _bus_tag; + sc->sc_ios = size; child = of_find_bycompat(phandle, "synopsys,dwc3"); if (child == -1) {
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Tue Aug 4 01:59:46 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_corereg.h Log Message: Add some CvmCtl bits from newer cnMIPS cores. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/cavium/dev/octeon_corereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_corereg.h diff -u src/sys/arch/mips/cavium/dev/octeon_corereg.h:1.4 src/sys/arch/mips/cavium/dev/octeon_corereg.h:1.5 --- src/sys/arch/mips/cavium/dev/octeon_corereg.h:1.4 Sun Jul 26 07:46:21 2020 +++ src/sys/arch/mips/cavium/dev/octeon_corereg.h Tue Aug 4 01:59:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_corereg.h,v 1.4 2020/07/26 07:46:21 simonb Exp $ */ +/* $NetBSD: octeon_corereg.h,v 1.5 2020/08/04 01:59:46 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -87,8 +87,17 @@ #define CP0_TAGLOD_VALID UINT64_C(0x0001) /* CvmCtl Register */ +/* CVMCTL_STEPRATE to CVMCTL_TLBBRFTDIS are available on cnMIPS III cores */ -#define CP0_CVMCTL_XXX_63_32 UINT64_C(0x) +#define CP0_CVMCTL_XXX_63_43 UINT64_C(0xf800) +#define CP0_CVMCTL_STEPRATE UINT64_C(0x0780) +#define CP0_CVMCTL_ZUCUINT64_C(0x0040) +#define CP0_CVMCTL_CAMELLIA UINT64_C(0x0020) +#define CP0_CVMCTL_USEMAK UINT64_C(0x0010) +#define CP0_CVMCTL_SMS4UINT64_C(0x0008) +#define CP0_CVMCTL_DISABLEPAUSE UINT64_C(0x0004) +#define CP0_CVMCTL_SNOW3G UINT64_C(0x0002) +#define CP0_CVMCTL_TLBBRFTDIS UINT64_C(0x0001) #define CP0_CVMCTL_FUSE_STARTBIT UINT64_C(0x8000) #define CP0_CVMCTL_XXX_30 UINT64_C(0x4000) #define CP0_CVMCTL_KASUMI UINT64_C(0x2000)
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: jmcneill Date: Mon Jul 20 17:56:13 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_ciureg.h Log Message: Fix coreX/IP4 summary register offsets To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/cavium/dev/octeon_ciureg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_ciureg.h diff -u src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.10 src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.11 --- src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.10 Fri Jul 17 21:59:30 2020 +++ src/sys/arch/mips/cavium/dev/octeon_ciureg.h Mon Jul 20 17:56:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_ciureg.h,v 1.10 2020/07/17 21:59:30 jmcneill Exp $ */ +/* $NetBSD: octeon_ciureg.h,v 1.11 2020/07/20 17:56:13 jmcneill Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -85,7 +85,7 @@ #define CIU_PCI_INTAUINT64_C(0x000107000750) #define CIU_INT4_SUM0UINT64_C(0x000107000c00) #define CIU_INT4_SUM1UINT64_C(0x000107000c08) -#define CIU_IP4_SUM0(n)(CIU_INT4_SUM0 + 0x10 * (n)) +#define CIU_IP4_SUM0(n)(CIU_INT4_SUM0 + 0x8 * (n)) #define CIU_INT4_EN00UINT64_C(0x000107000c80) #define CIU_INT4_EN01UINT64_C(0x000107000c88) #define CIU_INT4_EN10UINT64_C(0x000107000c90)
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Fri Jul 17 08:06:02 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_xhci.c octeon_xhcireg.h Log Message: Don't use a reserved value for the USB endian CSR selects and enable octxhci_uctl_init(). Between these, USB works without needing a "usb start" from u-boot. XXX: Note the port power enable goop is still disabled until we get a GPIO driver. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/dev/octeon_xhci.c \ src/sys/arch/mips/cavium/dev/octeon_xhcireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_xhci.c diff -u src/sys/arch/mips/cavium/dev/octeon_xhci.c:1.1 src/sys/arch/mips/cavium/dev/octeon_xhci.c:1.2 --- src/sys/arch/mips/cavium/dev/octeon_xhci.c:1.1 Thu Jul 16 21:34:52 2020 +++ src/sys/arch/mips/cavium/dev/octeon_xhci.c Fri Jul 17 08:06:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_xhci.c,v 1.1 2020/07/16 21:34:52 jmcneill Exp $ */ +/* $NetBSD: octeon_xhci.c,v 1.2 2020/07/17 08:06:02 simonb Exp $ */ /* $OpenBSD: octxhci.c,v 1.4 2019/09/29 04:32:23 visa Exp $ */ /* @@ -151,7 +151,6 @@ octxhci_attach(device_t parent, device_t if (strcmp(clock_type_hs, "pll_ref_clk") == 0) clock_sel |= 2; - if (0) octxhci_uctl_init(osc, clock_freq, clock_sel); if (octxhci_dwc3_init(sc) != 0) { @@ -330,8 +329,8 @@ octxhci_uctl_init(struct octxhci_softc * val = XCTL_RD_8(sc, XCTL_SHIM_CFG); val &= ~XCTL_SHIM_CFG_CSR_BYTE_SWAP; val &= ~XCTL_SHIM_CFG_DMA_BYTE_SWAP; - val |= 3ull << XCTL_SHIM_CFG_CSR_BYTE_SWAP_SHIFT; - val |= 1ull << XCTL_SHIM_CFG_DMA_BYTE_SWAP_SHIFT; + val |= __SHIFTIN(XCTL_SHIM_ENDIAN_BIG, XCTL_SHIM_CFG_DMA_BYTE_SWAP); + val |= __SHIFTIN(XCTL_SHIM_ENDIAN_BIG, XCTL_SHIM_CFG_CSR_BYTE_SWAP); XCTL_WR_8(sc, XCTL_SHIM_CFG, val); (void)XCTL_RD_8(sc, XCTL_SHIM_CFG); } Index: src/sys/arch/mips/cavium/dev/octeon_xhcireg.h diff -u src/sys/arch/mips/cavium/dev/octeon_xhcireg.h:1.1 src/sys/arch/mips/cavium/dev/octeon_xhcireg.h:1.2 --- src/sys/arch/mips/cavium/dev/octeon_xhcireg.h:1.1 Thu Jul 16 21:34:52 2020 +++ src/sys/arch/mips/cavium/dev/octeon_xhcireg.h Fri Jul 17 08:06:02 2020 @@ -59,6 +59,10 @@ #define XCTL_SHIM_CFG_DMA_BYTE_SWAP_SHIFT 8 #define XCTL_SHIM_CFG_CSR_BYTE_SWAP 0x0003ull #define XCTL_SHIM_CFG_CSR_BYTE_SWAP_SHIFT 0 +#define XCTL_SHIM_ENDIAN_LITTLE 0 /* A-B-C-D-E-F-G-H -> A-B-C-D-E-F-G-H */ +#define XCTL_SHIM_ENDIAN_BIG 1 /* A-B-C-D-E-F-G-H -> H-G-F-E-D-C-B-A */ +#define XCTL_SHIM_ENDIAN_RSVD2 2 /* A-B-C-D-E-F-G-H -> D-C-B-A-H-G-F-E */ +#define XCTL_SHIM_ENDIAN_RSVD3 3 /* A-B-C-D-E-F-G-H -> E-F-G-H-A-B-C-D */ /* * DWC3 core control registers.
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Sat Jun 27 02:49:42 UTC 2020 Added Files: src/sys/arch/mips/cavium/dev: octeon_uartvar.h Log Message: Add new file containing a couple of UART prototypes. Missing file pointed out by rin@. Thanks! To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/mips/cavium/dev/octeon_uartvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/mips/cavium/dev/octeon_uartvar.h diff -u /dev/null src/sys/arch/mips/cavium/dev/octeon_uartvar.h:1.1 --- /dev/null Sat Jun 27 02:49:42 2020 +++ src/sys/arch/mips/cavium/dev/octeon_uartvar.h Sat Jun 27 02:49:42 2020 @@ -0,0 +1,9 @@ +/* $NetBSD: octeon_uartvar.h,v 1.1 2020/06/27 02:49:42 simonb Exp $ */ + +#ifndef _OCTEON_UARTVAR_H_ +#define _OCTEON_UARTVAR_H_ + +void octuart_early_cnattach(int); +int octuart_com_cnattach(bus_space_tag_t, int, int); + +#endif /* _OCTEON_UARTVAR_H_ */
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Tue Jun 23 05:18:43 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_uart.c Log Message: Add support for a very simple output-only console so early printf() can work. Minor tweaks, remove some unused code. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/cavium/dev/octeon_uart.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_uart.c diff -u src/sys/arch/mips/cavium/dev/octeon_uart.c:1.8 src/sys/arch/mips/cavium/dev/octeon_uart.c:1.9 --- src/sys/arch/mips/cavium/dev/octeon_uart.c:1.8 Fri Jun 19 02:23:43 2020 +++ src/sys/arch/mips/cavium/dev/octeon_uart.c Tue Jun 23 05:18:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_uart.c,v 1.8 2020/06/19 02:23:43 simonb Exp $ */ +/* $NetBSD: octeon_uart.c,v 1.9 2020/06/23 05:18:43 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,9 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_uart.c,v 1.8 2020/06/19 02:23:43 simonb Exp $"); - -#include "opt_octeon.h" +__KERNEL_RCSID(0, "$NetBSD: octeon_uart.c,v 1.9 2020/06/23 05:18:43 simonb Exp $"); #include #include @@ -41,11 +39,13 @@ __KERNEL_RCSID(0, "$NetBSD: octeon_uart. #include #include +#include #include #include #include #include +#include #include struct octuart_iobus_softc { @@ -59,9 +59,8 @@ static void octuart_iobus_attach(device_ static int octuart_com_enable(struct com_softc *); static void octuart_com_disable(struct com_softc *); - -/* XXX */ -int octuart_com_cnattach(bus_space_tag_t, int, int); +/* octputc() is not declared static so it can be used for debugging elsewhere */ +void octputc(dev_t, int); /* XXX */ const bus_addr_t octuart_com_bases[] = { @@ -93,7 +92,7 @@ const struct com_regs octuart_com_regs = CFATTACH_DECL_NEW(com_iobus, sizeof(struct octuart_iobus_softc), octuart_iobus_match, octuart_iobus_attach, NULL, NULL); -int +static int octuart_iobus_match(device_t parent, struct cfdata *cf, void *aux) { struct iobus_attach_args *aa = aux; @@ -109,7 +108,7 @@ out: return result; } -void +static void octuart_iobus_attach(device_t parent, device_t self, void *aux) { struct octuart_iobus_softc *sc = device_private(self); @@ -154,17 +153,7 @@ octuart_iobus_attach(device_t parent, de /* XXX disable if kgdb? */ } -#if 0 -void -octuart_iobus_detach(device_t self, ...) -{ - struct octuart_iobus_softc *sc = (void *)self; - - octeon_intr_disestablish(sc->ih); -} -#endif - -int +static int octuart_com_enable(struct com_softc *sc_com) { struct com_regs *regsp = _com->sc_regs; @@ -176,7 +165,7 @@ octuart_com_enable(struct com_softc *sc_ return 0; } -void +static void octuart_com_disable(struct com_softc *sc_com) { /* @@ -205,3 +194,31 @@ octuart_com_cnattach(bus_space_tag_t bus COM_TYPE_16550_NOERS, CONMODE); } + + +/* + * A very simple output-only console so early printf() can work. + */ +struct consdev early_console = { + .cn_putc = octputc, + .cn_pollc = nullcnpollc, + .cn_dev = makedev(0, 0), + .cn_pri = CN_DEAD +}; +static int early_comcnrate; + +void +octputc(dev_t dev, int c) +{ + + octeon_xkphys_write_8(MIO_UART0_RBR, (uint8_t)c); + delay(100 / (early_comcnrate / 10)); /* wait for char to drain */ +} + +void +octuart_early_cnattach(int rate) +{ + + early_comcnrate = rate; + cn_tab = _console; +}
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Tue Jun 23 05:18:28 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_dwctwo.c Log Message: Make sure we only attach to CN3xxx/CN5xxx. Cleanup - mostly removing unused code. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_dwctwo.c diff -u src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.12 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.13 --- src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.12 Tue Jun 23 03:07:47 2020 +++ src/sys/arch/mips/cavium/dev/octeon_dwctwo.c Tue Jun 23 05:18:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_dwctwo.c,v 1.12 2020/06/23 03:07:47 simonb Exp $ */ +/* $NetBSD: octeon_dwctwo.c,v 1.13 2020/06/23 05:18:28 simonb Exp $ */ /* * Copyright (c) 2015 Masao Uebayashi @@ -43,9 +43,8 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.12 2020/06/23 03:07:47 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.13 2020/06/23 05:18:28 simonb Exp $"); -#include "opt_octeon.h" #include "opt_usb.h" #include @@ -83,29 +82,21 @@ struct octeon_dwc2_softc { void *sc_ih; }; -static int octeon_dwc2_match(device_t, struct cfdata *, void *); -static void octeon_dwc2_attach(device_t, device_t, void *); -static uint32_t octeon_dwc2_rd_4(void *, bus_space_handle_t, - bus_size_t); -static void octeon_dwc2_wr_4(void *, bus_space_handle_t, - bus_size_t, uint32_t); -int octeon_dwc2_set_dma_addr(device_t, bus_addr_t, int); -static inline void octeon_dwc2_reg_assert(struct octeon_dwc2_softc *, - bus_size_t, uint64_t); -static inline void octeon_dwc2_reg_deassert(struct octeon_dwc2_softc *, - bus_size_t, uint64_t); -static inline uint64_t octeon_dwc2_reg_rd(struct octeon_dwc2_softc *, - bus_size_t); -static inline void octeon_dwc2_reg_wr(struct octeon_dwc2_softc *, - bus_size_t, uint64_t); -static inline void octeon_dwc2_reg2_assert(struct octeon_dwc2_softc *, - bus_size_t, uint64_t); -static inline void octeon_dwc2_reg2_deassert(struct octeon_dwc2_softc *, - bus_size_t, uint64_t); -static inline uint64_t octeon_dwc2_reg2_rd(struct octeon_dwc2_softc *, - bus_size_t); -static inline void octeon_dwc2_reg2_wr(struct octeon_dwc2_softc *, - bus_size_t, uint64_t); +static int octeon_dwc2_match(device_t, struct cfdata *, void *); +static void octeon_dwc2_attach(device_t, device_t, void *); +static uint32_t octeon_dwc2_rd_4(void *, bus_space_handle_t, bus_size_t); +static void octeon_dwc2_wr_4(void *, bus_space_handle_t, bus_size_t, + uint32_t); +static int octeon_dwc2_set_dma_addr(device_t, bus_addr_t, int); +static void octeon_dwc2_reg_assert(struct octeon_dwc2_softc *, bus_size_t, + uint64_t); +static void octeon_dwc2_reg_deassert(struct octeon_dwc2_softc *, bus_size_t, + uint64_t); +static uint64_t octeon_dwc2_reg_rd(struct octeon_dwc2_softc *, bus_size_t); +static void octeon_dwc2_reg_wr(struct octeon_dwc2_softc *, bus_size_t, + uint64_t); +static void octeon_dwc2_reg2_wr(struct octeon_dwc2_softc *, bus_size_t, + uint64_t); static struct dwc2_core_params octeon_dwc2_params = { .otg_cap = 2, /* 2 - No HNP/SRP capable */ @@ -143,12 +134,20 @@ CFATTACH_DECL_NEW(octdwctwo, sizeof(stru static int octeon_dwc2_match(device_t parent, struct cfdata *cf, void *aux) { + const mips_prid_t cpu_id = mips_options.mips_cpu_id; struct iobus_attach_args *aa = aux; if (strcmp(cf->cf_name, aa->aa_name) != 0) return 0; - return 1; + switch (MIPS_PRID_IMPL(cpu_id)) { + case MIPS_CN31XX: + case MIPS_CN30XX: + case MIPS_CN50XX: + return 1; + default: + return 0; + } } static void @@ -214,8 +213,8 @@ octeon_dwc2_attach(device_t parent, devi */ /* XXX board specific */ clk &= ~(USBN_CLK_CTL_DIVIDE | USBN_CLK_CTL_DIVIDE2); - clk |= SET_USBN_CLK_CTL_DIVIDE(0x4ULL) - | SET_USBN_CLK_CTL_DIVIDE2(0x0ULL); + clk |= __SHIFTIN(0x4, USBN_CLK_CTL_DIVIDE) | /* XX magic 0x4 */ + __SHIFTIN(0x0, USBN_CLK_CTL_DIVIDE2); octeon_dwc2_reg_wr(sc, USBN_CLK_CTL_OFFSET, clk); /* * d. Write USBN_CLK_CTL[HCLK_RST] = 1. @@ -233,7 +232,7 @@ octeon_dwc2_attach(device_t parent, devi * a. write USBN_CLK_CTL[DIVIDE] with the new divide value. */ clk = octeon_dwc2_reg_rd(sc, USBN_CLK_CTL_OFFSET); - clk |= 0x4ULL & USBN_CLK_CTL_DIVIDE; + clk |= __SHIFTIN(0x4, USBN_CLK_CTL_DIVIDE); /* XX magic 0x4 */ octeon_dwc2_reg_wr(sc, USBN_CLK_CTL_OFFSET, clk); /* * b. Wait 64 core-clock cycles for HCLK to stabilize. @@ -241,7 +240,7 @@ octeon_dwc2_attach(device_t parent, devi delay(1); break; default: - panic("unknown H/W type"); /* XXX */ + panic("unknown H/W type"); /* shouldn't get here */ } /* @@ -330,7 +329,7 @@
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Tue Jun 23 05:17:13 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: if_cnmac.c if_cnmacvar.h octeon_gmx.c octeon_gmxreg.h octeon_gmxvar.h Log Message: Redo cnmac attachments - cnmacM @ gmxN @ pip0 @ iobus Support SGMII mode used on CN70XX. Most functional changes from OpenBSD octeon port. Still more to come from the OpenBSD driver. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/mips/cavium/dev/if_cnmac.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/cavium/dev/if_cnmacvar.h cvs rdiff -u -r1.14 -r1.15 src/sys/arch/mips/cavium/dev/octeon_gmx.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/cavium/dev/octeon_gmxreg.h cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/dev/octeon_gmxvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/if_cnmac.c diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.23 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.24 --- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.23 Mon Jun 22 02:26:19 2020 +++ src/sys/arch/mips/cavium/dev/if_cnmac.c Tue Jun 23 05:17:13 2020 @@ -1,11 +1,33 @@ -/* $NetBSD: if_cnmac.c,v 1.23 2020/06/22 02:26:19 simonb Exp $ */ +/* $NetBSD: if_cnmac.c,v 1.24 2020/06/23 05:17:13 simonb Exp $ */ -#include -#if 0 -__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.23 2020/06/22 02:26:19 simonb Exp $"); -#endif +/* + * Copyright (c) 2007 Internet Initiative Japan, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ -#include "opt_octeon.h" +#include +__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.24 2020/06/23 05:17:13 simonb Exp $"); /* * If no free send buffer is available, free all the sent buffers and bail out. @@ -30,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v #include #include -#include #include #include #include @@ -52,23 +73,24 @@ __KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v #include #include +#include #include #include +#include +#include #include #include #include -#include -#include +#include #include #include -#include -#include #include #include #include -#include +#include #include + #include /* @@ -86,8 +108,6 @@ static void cnmac_attach(device_t, devic static void cnmac_pip_init(struct cnmac_softc *); static void cnmac_ipd_init(struct cnmac_softc *); static void cnmac_pko_init(struct cnmac_softc *); -static void cnmac_asx_init(struct cnmac_softc *); -static void cnmac_smi_init(struct cnmac_softc *); static void cnmac_board_mac_addr(uint8_t *, size_t, struct cnmac_softc *); @@ -107,11 +127,8 @@ static inline void cnmac_send_queue_add( uint64_t *); static inline void cnmac_send_queue_del(struct cnmac_softc *, struct mbuf **, uint64_t **); -static inline int cnmac_buf_free_work(struct cnmac_softc *, uint64_t *, -uint64_t); -static inline void cnmac_buf_ext_free_m(struct mbuf *, void *, size_t, void *); -static inline void cnmac_buf_ext_free_ext(struct mbuf *, void *, size_t, -void *); +static inline int cnmac_buf_free_work(struct cnmac_softc *, uint64_t *); +static inline void cnmac_buf_ext_free(struct mbuf *, void *, size_t, void *); static int cnmac_ioctl(struct ifnet *, u_long, void *); static void cnmac_watchdog(struct ifnet *); @@ -122,7 +139,8 @@ static void cnmac_start(struct ifnet *); static inline int cnmac_send_cmd(struct cnmac_softc *, uint64_t, uint64_t, int *); static inline uint64_t cnmac_send_makecmd_w1(int, paddr_t); -static inline uint64_t cnmac_send_makecmd_w0(uint64_t, uint64_t, size_t, int); +static inline uint64_t cnmac_send_makecmd_w0(uint64_t,
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Tue Jun 23 03:09:35 UTC 2020 Removed Files: src/sys/arch/mips/cavium/dev: octeon_usbcvar.h octeon_usbnvar.h Log Message: Remove unused include files. To generate a diff of this commit: cvs rdiff -u -r1.6 -r0 src/sys/arch/mips/cavium/dev/octeon_usbcvar.h cvs rdiff -u -r1.1 -r0 src/sys/arch/mips/cavium/dev/octeon_usbnvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Tue Jun 23 03:08:11 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_usbcreg.h Log Message: Remove USB controller register definitions, these match dwc2 core and weren't used anyway. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/cavium/dev/octeon_usbcreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_usbcreg.h diff -u src/sys/arch/mips/cavium/dev/octeon_usbcreg.h:1.3 src/sys/arch/mips/cavium/dev/octeon_usbcreg.h:1.4 --- src/sys/arch/mips/cavium/dev/octeon_usbcreg.h:1.3 Mon Jun 22 12:26:11 2020 +++ src/sys/arch/mips/cavium/dev/octeon_usbcreg.h Tue Jun 23 03:08:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_usbcreg.h,v 1.3 2020/06/22 12:26:11 simonb Exp $ */ +/* $NetBSD: octeon_usbcreg.h,v 1.4 2020/06/23 03:08:11 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -33,671 +33,9 @@ #ifndef _OCTEON_USBCREG_H_ #define _OCTEON_USBCREG_H_ -/* register addresses */ - -#define USBC_GOTGCTL0x00016F001000ULL -#define USBC_GOTGINT0x00016F001004ULL -#define USBC_GAHBCFG0x00016F001008ULL -#define USBC_GUSBCFG0x00016F00100CULL -#define USBC_GRSTCTL0x00016F001010ULL -#define USBC_GINTSTS0x00016F001014ULL -#define USBC_GINTMSK0x00016F001018ULL -#define USBC_GRXSTSRH0x00016F00101CULL -#define USBC_GRXSTSPH0x00016F001020ULL -#define USBC_GRXFSIZ0x00016F001024ULL -#define USBC_GNPTXFSIZ0x00016F001028ULL -#define USBC_GNPTXSTS0x00016F00102CULL -#define USBC_GSNPSID0x00016F001040ULL -#define USBC_GHWCFG10x00016F001044ULL -#define USBC_GHWCFG20x00016F001048ULL -#define USBC_GHWCFG30x00016F00104CULL -#define USBC_GHWCFG40x00016F001050ULL -#define USBC_HPTXFSIZ0x00016F001100ULL -#define USBC_DPTXFSIZ10x00016F001104ULL -#define USBC_DPTXFSIZ20x00016F001108ULL -#define USBC_DPTXFSIZ30x00016F00110CULL -#define USBC_DPTXFSIZ40x00016F001110ULL -#define USBC_HCFG0x00016F001400ULL -#define USBC_HFIR0x00016F001404ULL -#define USBC_HFNUM0x00016F001408ULL -#define USBC_HPTXSTS0x00016F001410ULL -#define USBC_HAINT0x00016F001414ULL -#define USBC_HAINTMSK0x00016F001418ULL -#define USBC_HPRT0x00016F001440ULL -#define USBC_HCCHAR00x00016F001500ULL -#define USBC_HCCHAR10x00016F001520ULL -#define USBC_HCCHAR20x00016F001540ULL -#define USBC_HCCHAR30x00016F001560ULL -#define USBC_HCCHAR40x00016F001580ULL -#define USBC_HCCHAR50x00016F0015A0ULL -#define USBC_HCCHAR60x00016F0015C0ULL -#define USBC_HCCHAR70x00016F0015E0ULL -#define USBC_HCSPLT00x00016F001504ULL -#define USBC_HCSPLT10x00016F001524ULL -#define USBC_HCSPLT20x00016F001544ULL -#define USBC_HCSPLT30x00016F001564ULL -#define USBC_HCSPLT40x00016F001584ULL -#define USBC_HCSPLT50x00016F0015A4ULL -#define USBC_HCSPLT60x00016F0015C4ULL -#define USBC_HCSPLT70x00016F0015E4ULL -#define USBC_HCINT00x00016F001508ULL -#define USBC_HCINT10x00016F001528ULL -#define USBC_HCINT20x00016F001548ULL -#define USBC_HCINT30x00016F001568ULL -#define USBC_HCINT40x00016F001588ULL -#define USBC_HCINT50x00016F0015A8ULL -#define USBC_HCINT60x00016F0015C8ULL -#define USBC_HCINT70x00016F0015E8ULL -#define USBC_HCINTMSK00x00016F00150CULL -#define USBC_HCINTMSK10x00016F00152CULL -#define USBC_HCINTMSK20x00016F00154CULL -#define USBC_HCINTMSK30x00016F00156CULL -#define USBC_HCINTMSK40x00016F00158CULL -#define USBC_HCINTMSK50x00016F0015ACULL -#define USBC_HCINTMSK60x00016F0015CCULL -#define USBC_HCINTMSK70x00016F0015ECULL -#define USBC_HCTSIZ00x00016F001510ULL -#define USBC_HCTSIZ10x00016F001530ULL -#define USBC_HCTSIZ20x00016F001550ULL -#define USBC_HCTSIZ30x00016F001570ULL -#define USBC_HCTSIZ40x00016F001590ULL -#define USBC_HCTSIZ50x00016F0015B0ULL -#define USBC_HCTSIZ60x00016F0015D0ULL -#define USBC_HCTSIZ70x00016F0015F0ULL -#define USBC_DCFG0x00016F001800ULL -#define USBC_DCTL0x00016F001804ULL -#define USBC_DSTS0x00016F001808ULL -#define USBC_DIEPMSK0x00016F001810ULL -#define USBC_DOEPMSK0x00016F001814ULL -#define USBC_DAINT0x00016F001818ULL -#define USBC_DAINTMSK0x00016F00181CULL -#define USBC_DTKNQR10x00016F001820ULL -#define USBC_DTKNQR20x00016F001824ULL -#define USBC_DTKNQR30x00016F001830ULL -#define USBC_DTKNQR40x00016F001834ULL -#define USBC_DIEPCTL00x00016F001900ULL -#define USBC_DIEPCTL1
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Tue Jun 23 03:07:48 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_dwctwo.c Log Message: Remove unused octeon*usb*var*h includes. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_dwctwo.c diff -u src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.11 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.12 --- src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.11 Fri Jun 19 02:23:43 2020 +++ src/sys/arch/mips/cavium/dev/octeon_dwctwo.c Tue Jun 23 03:07:47 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_dwctwo.c,v 1.11 2020/06/19 02:23:43 simonb Exp $ */ +/* $NetBSD: octeon_dwctwo.c,v 1.12 2020/06/23 03:07:47 simonb Exp $ */ /* * Copyright (c) 2015 Masao Uebayashi @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.11 2020/06/19 02:23:43 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.12 2020/06/23 03:07:47 simonb Exp $"); #include "opt_octeon.h" #include "opt_usb.h" @@ -63,9 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: octeon_dwctw #include #include #include -#include #include -#include #include #include
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Mon Jun 22 12:26:11 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_bootbusreg.h octeon_ciureg.h octeon_fpareg.h octeon_gmxreg.h octeon_pipreg.h octeon_powreg.h octeon_usbcreg.h Log Message: Remove more snprintb _BITS bits. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_bootbusreg.h \ src/sys/arch/mips/cavium/dev/octeon_usbcreg.h cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/cavium/dev/octeon_ciureg.h cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/cavium/dev/octeon_fpareg.h \ src/sys/arch/mips/cavium/dev/octeon_gmxreg.h \ src/sys/arch/mips/cavium/dev/octeon_pipreg.h \ src/sys/arch/mips/cavium/dev/octeon_powreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_bootbusreg.h diff -u src/sys/arch/mips/cavium/dev/octeon_bootbusreg.h:1.2 src/sys/arch/mips/cavium/dev/octeon_bootbusreg.h:1.3 --- src/sys/arch/mips/cavium/dev/octeon_bootbusreg.h:1.2 Mon Jun 22 03:05:07 2020 +++ src/sys/arch/mips/cavium/dev/octeon_bootbusreg.h Mon Jun 22 12:26:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_bootbusreg.h,v 1.2 2020/06/22 03:05:07 simonb Exp $ */ +/* $NetBSD: octeon_bootbusreg.h,v 1.3 2020/06/22 12:26:11 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -116,33 +116,6 @@ #define MIO_BOOT_BIST_STAT_LOC UINT64_C(0x0002) #define MIO_BOOT_BIST_STAT_NCBI UINT64_C(0x0001) -#define MIO_BOOT_REG_CFG0_BITS MIO_BOOT_REG_CFGN_BITS -#define MIO_BOOT_REG_CFG1_BITS MIO_BOOT_REG_CFGN_BITS -#define MIO_BOOT_REG_CFG2_BITS MIO_BOOT_REG_CFGN_BITS -#define MIO_BOOT_REG_CFG3_BITS MIO_BOOT_REG_CFGN_BITS -#define MIO_BOOT_REG_CFG4_BITS MIO_BOOT_REG_CFGN_BITS -#define MIO_BOOT_REG_CFG5_BITS MIO_BOOT_REG_CFGN_BITS -#define MIO_BOOT_REG_CFG6_BITS MIO_BOOT_REG_CFGN_BITS -#define MIO_BOOT_REG_CFG7_BITS MIO_BOOT_REG_CFGN_BITS - -#define MIO_BOOT_REG_TIM0_BITS MIO_BOOT_REG_TIMN_BITS -#define MIO_BOOT_REG_TIM1_BITS MIO_BOOT_REG_TIMN_BITS -#define MIO_BOOT_REG_TIM2_BITS MIO_BOOT_REG_TIMN_BITS -#define MIO_BOOT_REG_TIM3_BITS MIO_BOOT_REG_TIMN_BITS -#define MIO_BOOT_REG_TIM4_BITS MIO_BOOT_REG_TIMN_BITS -#define MIO_BOOT_REG_TIM5_BITS MIO_BOOT_REG_TIMN_BITS -#define MIO_BOOT_REG_TIM6_BITS MIO_BOOT_REG_TIMN_BITS -#define MIO_BOOT_REG_TIM7_BITS MIO_BOOT_REG_TIMN_BITS - -#define MIO_BOOT_LOC_CFG0_BITS MIO_BOOT_LOC_CFGN_BITS -#define MIO_BOOT_LOC_CFG1_BITS MIO_BOOT_LOC_CFGN_BITS -#define MIO_BOOT_LOC_CFG2_BITS MIO_BOOT_LOC_CFGN_BITS -#define MIO_BOOT_LOC_CFG3_BITS MIO_BOOT_LOC_CFGN_BITS -#define MIO_BOOT_LOC_CFG4_BITS MIO_BOOT_LOC_CFGN_BITS -#define MIO_BOOT_LOC_CFG5_BITS MIO_BOOT_LOC_CFGN_BITS -#define MIO_BOOT_LOC_CFG6_BITS MIO_BOOT_LOC_CFGN_BITS -#define MIO_BOOT_LOC_CFG7_BITS MIO_BOOT_LOC_CFGN_BITS - /* bus_space */ #define MIO_BOOT_REG_CFG0_OFFSET 0x Index: src/sys/arch/mips/cavium/dev/octeon_usbcreg.h diff -u src/sys/arch/mips/cavium/dev/octeon_usbcreg.h:1.2 src/sys/arch/mips/cavium/dev/octeon_usbcreg.h:1.3 --- src/sys/arch/mips/cavium/dev/octeon_usbcreg.h:1.2 Mon Jun 22 03:05:07 2020 +++ src/sys/arch/mips/cavium/dev/octeon_usbcreg.h Mon Jun 22 12:26:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_usbcreg.h,v 1.2 2020/06/22 03:05:07 simonb Exp $ */ +/* $NetBSD: octeon_usbcreg.h,v 1.3 2020/06/22 12:26:11 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -573,42 +573,6 @@ /* for USBC_NPTXDFIFO(0..7) */ #define USBC_NPTXDFIFOX_DATA 0x -#define USBC_HCINT0_BITS USBC_HCINTX_BITS -#define USBC_HCINT1_BITS USBC_HCINTX_BITS -#define USBC_HCINT2_BITS USBC_HCINTX_BITS -#define USBC_HCINT3_BITS USBC_HCINTX_BITS -#define USBC_HCINT4_BITS USBC_HCINTX_BITS -#define USBC_HCINT5_BITS USBC_HCINTX_BITS -#define USBC_HCINT6_BITS USBC_HCINTX_BITS -#define USBC_HCINT7_BITS USBC_HCINTX_BITS - -#define USBC_HCINTMSK0_BITS USBC_HCINTMSKX_BITS -#define USBC_HCINTMSK1_BITS USBC_HCINTMSKX_BITS -#define USBC_HCINTMSK2_BITS USBC_HCINTMSKX_BITS -#define USBC_HCINTMSK3_BITS USBC_HCINTMSKX_BITS -#define USBC_HCINTMSK4_BITS USBC_HCINTMSKX_BITS -#define USBC_HCINTMSK5_BITS USBC_HCINTMSKX_BITS -#define USBC_HCINTMSK6_BITS USBC_HCINTMSKX_BITS -#define USBC_HCINTMSK7_BITS USBC_HCINTMSKX_BITS - -#define USBC_HCCHAR0_BITS USBC_HCCHARX_BITS -#define USBC_HCCHAR1_BITS USBC_HCCHARX_BITS -#define USBC_HCCHAR2_BITS USBC_HCCHARX_BITS -#define USBC_HCCHAR3_BITS USBC_HCCHARX_BITS -#define USBC_HCCHAR4_BITS USBC_HCCHARX_BITS -#define USBC_HCCHAR5_BITS USBC_HCCHARX_BITS -#define USBC_HCCHAR6_BITS USBC_HCCHARX_BITS -#define USBC_HCCHAR7_BITS USBC_HCCHARX_BITS - -#define USBC_HCTSIZ0_BITS USBC_HCTSIZX_BITS -#define USBC_HCTSIZ1_BITS USBC_HCTSIZX_BITS -#define USBC_HCTSIZ2_BITS USBC_HCTSIZX_BITS -#define USBC_HCTSIZ3_BITS USBC_HCTSIZX_BITS -#define
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Mon Jun 22 03:05:07 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_asxreg.h octeon_bootbusreg.h octeon_ciureg.h octeon_corereg.h octeon_fpareg.h octeon_gmxreg.h octeon_gpioreg.h octeon_ipdreg.h octeon_mpireg.h octeon_pip.c octeon_pipreg.h octeon_powreg.h octeon_rnmreg.h octeon_twsireg.h octeon_usbcreg.h octeon_usbnreg.h Log Message: Remove unused snprintb format strings. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/dev/octeon_asxreg.h \ src/sys/arch/mips/cavium/dev/octeon_bootbusreg.h \ src/sys/arch/mips/cavium/dev/octeon_gpioreg.h \ src/sys/arch/mips/cavium/dev/octeon_usbcreg.h \ src/sys/arch/mips/cavium/dev/octeon_usbnreg.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/cavium/dev/octeon_ciureg.h cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_corereg.h \ src/sys/arch/mips/cavium/dev/octeon_fpareg.h \ src/sys/arch/mips/cavium/dev/octeon_gmxreg.h \ src/sys/arch/mips/cavium/dev/octeon_ipdreg.h \ src/sys/arch/mips/cavium/dev/octeon_mpireg.h \ src/sys/arch/mips/cavium/dev/octeon_pipreg.h \ src/sys/arch/mips/cavium/dev/octeon_powreg.h \ src/sys/arch/mips/cavium/dev/octeon_twsireg.h cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/dev/octeon_pip.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/cavium/dev/octeon_rnmreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_asxreg.h diff -u src/sys/arch/mips/cavium/dev/octeon_asxreg.h:1.1 src/sys/arch/mips/cavium/dev/octeon_asxreg.h:1.2 --- src/sys/arch/mips/cavium/dev/octeon_asxreg.h:1.1 Wed Apr 29 08:32:01 2015 +++ src/sys/arch/mips/cavium/dev/octeon_asxreg.h Mon Jun 22 03:05:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_asxreg.h,v 1.1 2015/04/29 08:32:01 hikaru Exp $ */ +/* $NetBSD: octeon_asxreg.h,v 1.2 2020/06/22 03:05:07 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -155,114 +155,4 @@ #define ASX0_GMII_RX_DAT_SET_63_5 0xffe0 #define ASX0_GMII_RX_DAT_SET_SETTING 0x001f -/* */ - -#define ASX0_RX_PRT_EN_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x03\x3d" "63_3\0" \ - "f\x00\x03" "PRT_EN\0" -#define ASX0_TX_PRT_EN_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x03\x3d" "63_3\0" \ - "f\x00\x03" "PRT_EN\0" -#define ASX0_INT_REG_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x0b\x35" "63_11\0" \ - "f\x08\x03" "TXPSH\0" \ - "b\x07" "7\0" \ - "f\x04\x03" "TXPOP\0" \ - "b\x03" "3\0" \ - "f\x00\x03" "OVRFLW\0" -#define ASX0_INT_EN_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x0b\x35" "63_11\0" \ - "f\x08\x03" "TXPSH\0" \ - "b\x07" "7\0" \ - "f\x04\x03" "TXPOP\0" \ - "b\x03" "3\0" \ - "f\x00\x03" "OVRFLW\0" -#define ASX0_RX_CLK_SET0_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_RX_CLK_SET1_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_RX_CLK_SET2_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_PRT_LOOP_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x07\x39" "63_7\0" \ - "f\x04\x03" "EXT_LOOP\0" \ - "b\x03" "3\0" \ - "f\x00\x03" "PRT_LOOP\0" -#define ASX0_TX_CLK_SET0_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_TX_CLK_SET1_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_TX_CLK_SET2_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_COMP_BYP_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_TX_HI_WATER000_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_TX_HI_WATER001_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_TX_HI_WATER002_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_GMII_RX_CLK_SET_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x05\x3b" "63_5\0" \ - "f\x00\x05" "SETTING\0" -#define ASX0_GMII_RX_DAT_SET_BITS \ - "\177" /* new format */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x05\x3b" "63_5\0" \ - "f\x00\x05" "SETTING\0" -#define ASX0_MII_RX_DAT_SET_BITS \ - "\177" /*
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Mon Jun 8 01:17:05 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_rnm.c Log Message: Fix tyop in a comment. Thanks riastradh@. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/cavium/dev/octeon_rnm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_rnm.c diff -u src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.10 src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.11 --- src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.10 Fri Jun 5 09:18:35 2020 +++ src/sys/arch/mips/cavium/dev/octeon_rnm.c Mon Jun 8 01:17:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_rnm.c,v 1.10 2020/06/05 09:18:35 simonb Exp $ */ +/* $NetBSD: octeon_rnm.c,v 1.11 2020/06/08 01:17:05 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -99,7 +99,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.10 2020/06/05 09:18:35 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.11 2020/06/08 01:17:05 simonb Exp $"); #include #include @@ -369,7 +369,7 @@ octrnm_iobdma(struct octrnm_softc *sc, u __SHIFTIN(RNM_IOBDMA_SUBDID, IOBDMA_SUBDID); KASSERT(nwords < 128); /* iobdma address restriction */ - KASSERT(nwords <= CVMSEG_LM_RNM_SIZE); /* size of CVMSEM LM buffer */ + KASSERT(nwords <= CVMSEG_LM_RNM_SIZE); /* size of CVMSEG LM buffer */ octeon_iobdma_write_8(iobdma); OCTEON_SYNCIOBDMA;
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Tue Jun 2 14:39:57 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_ciureg.h Log Message: Add a missing entry, clean up a few other incorrect entries. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/cavium/dev/octeon_ciureg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_ciureg.h diff -u src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.5 src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.6 --- src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.5 Sat Aug 20 06:34:22 2016 +++ src/sys/arch/mips/cavium/dev/octeon_ciureg.h Tue Jun 2 14:39:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_ciureg.h,v 1.5 2016/08/20 06:34:22 skrll Exp $ */ +/* $NetBSD: octeon_ciureg.h,v 1.6 2020/06/02 14:39:57 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -189,6 +189,7 @@ #define _CIU_INT_WORKQ_3_SHIFT 0x03 #define _CIU_INT_WORKQ_2_SHIFT 0x02 #define _CIU_INT_WORKQ_1_SHIFT 0x01 +#define _CIU_INT_WORKQ_0_SHIFT 0x00 #define CIU_INTX_SUM0_XXX_63_59 UINT64_C(0xf800) #define CIU_INTX_SUM0_MPI UINT64_C(0x0400) @@ -352,7 +353,8 @@ #define CIU_MBOX_CLRX_XXX_63_32 UINT64_C(0x) #define CIU_MBOX_CLRX_CLR UINT64_C(0x) -#define CIU_PP_RST_XXX_63_1 UINT64_C(0xfffe) +#define CIU_PP_RST_XXX_63_2 UINT64_C(0xfffc) +#define CIU_PP_RST_RSTUINT64_C(0x0002) #define CIU_PP_RST_RST0UINT64_C(0x0001) #define CIU_PP_DBG_XXX_63_1 UINT64_C(0xfffe) @@ -361,14 +363,14 @@ #define CIU_GSTOP_XXX_63_1 UINT64_C(0xfffe) #define CIU_GSTOP_GSTOPUINT64_C(0x0001) -#define CIU_NMI_XXX_63_1 UINT64_C(0xfffe) -#define CIU_NMI_NMIUINT64_C(0x0001) +#define CIU_NMI_XXX_63_2 UINT64_C(0xfffc) +#define CIU_NMI_NMIUINT64_C(0x0003) -#define CIU_DINT_XXX_63_1 UINT64_C(0xfffe) -#define CIU_DINT_DINTUINT64_C(0x0001) +#define CIU_DINT_XXX_63_2 UINT64_C(0xfffc) +#define CIU_DINT_DINTUINT64_C(0x0003) -#define CIU_FUSE_XXX_63_1 UINT64_C(0xfffe) -#define CIU_FUSE_FUSEUINT64_C(0x0001) +#define CIU_FUSE_XXX_63_2 UINT64_C(0xfffc) +#define CIU_FUSE_FUSEUINT64_C(0x0003) #define CIU_BIST_XXX_63_4 UINT64_C(0xfff0) #define CIU_BIST_BISTUINT64_C(0x000f) @@ -379,7 +381,7 @@ #define CIU_SOFT_RST_XXX_63_1 UINT64_C(0xfffe) #define CIU_SOFT_RST_SOFT_RST UINT64_C(0x0001) -#define CIU_SOFT_PRST_XXX_63_1 UINT64_C(0xfff8) +#define CIU_SOFT_PRST_XXX_63_4 UINT64_C(0xfff8) #define CIU_SOFT_PRST_HOST64 UINT64_C(0x0004) #define CIU_SOFT_PRST_NPI UINT64_C(0x0002) #define CIU_SOFT_PRST_SOFT_PRST UINT64_C(0x0001)
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Sun May 31 06:23:49 UTC 2020 Removed Files: src/sys/arch/mips/cavium/dev: octeon_tim.c octeon_timreg.h Log Message: Remove unused Timer Unit register definitions and stubs. Can be resurrected from the attic in the unlikely event we'll ever have a driver for this device. To generate a diff of this commit: cvs rdiff -u -r1.1 -r0 src/sys/arch/mips/cavium/dev/octeon_tim.c \ src/sys/arch/mips/cavium/dev/octeon_timreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Sat May 30 03:12:52 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_rnm.c Log Message: CN70XX iobdma limit appears to be 128 words, so gather that many samples as a time. Gather the full 512 bytes of samples and process in a single call to rnd_add_data_sync() - about 10% faster than 4 calls to rnd_add_data_sync(). Put sample buffer in the softc to save some stack usage. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/dev/octeon_rnm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_rnm.c diff -u src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.6 src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.7 --- src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.6 Mon May 18 16:05:09 2020 +++ src/sys/arch/mips/cavium/dev/octeon_rnm.c Sat May 30 03:12:52 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_rnm.c,v 1.6 2020/05/18 16:05:09 riastradh Exp $ */ +/* $NetBSD: octeon_rnm.c,v 1.7 2020/05/30 03:12:52 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -99,7 +99,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.6 2020/05/18 16:05:09 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.7 2020/05/30 03:12:52 simonb Exp $"); #include #include @@ -123,6 +123,7 @@ __KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c #define RNG_FIFO_WORDS (512/sizeof(uint64_t)) struct octeon_rnm_softc { + uint64_t sc_sample[RNG_FIFO_WORDS]; bus_space_tag_t sc_bust; bus_space_handle_t sc_regh; kmutex_t sc_lock; @@ -222,8 +223,8 @@ static void octeon_rnm_rng(size_t nbytes, void *vsc) { const unsigned BPB = 256; /* bits of data per bit of entropy */ - uint64_t sample[32]; struct octeon_rnm_softc *sc = vsc; + uint64_t *samplepos; size_t needed = NBBY*nbytes; unsigned i; @@ -244,20 +245,21 @@ octeon_rnm_rng(size_t nbytes, void *vsc) octeon_rnm_raw_entropy(sc, sc->sc_rogroup); /* - * Gather half the FIFO at a time -- we are limited to - * 256 bytes because of limits on the CVMSEG buffer. + * Gather quarter the FIFO at a time -- we are limited + * to 128 bytes because of limits on the CVMSEG buffer. */ - CTASSERT(sizeof sample == 256); - CTASSERT(2*__arraycount(sample) == RNG_FIFO_WORDS); - for (i = 0; i < 2; i++) { - octeon_rnm_iobdma(sc, sample, __arraycount(sample)); + CTASSERT(sizeof sc->sc_sample == 512); + CTASSERT(__arraycount(sc->sc_sample) == RNG_FIFO_WORDS); + for (samplepos = sc->sc_sample, i = 0; i < 4; i++) { + octeon_rnm_iobdma(sc, samplepos, RNG_FIFO_WORDS / 4); + samplepos += RNG_FIFO_WORDS / 4; + } #ifdef OCTEON_RNM_DEBUG - hexdump(printf, "rnm", sample, sizeof sample); + hexdump(printf, "rnm", sc->sc_sample, sizeof sc->sc_sample); #endif - rnd_add_data_sync(>sc_rndsrc, sample, - sizeof sample, NBBY*sizeof(sample)/BPB); - needed -= MIN(needed, MAX(1, NBBY*sizeof(sample)/BPB)); - } + rnd_add_data_sync(>sc_rndsrc, sc->sc_sample, + sizeof sc->sc_sample, NBBY*sizeof(sc->sc_sample)/BPB); + needed -= MIN(needed, MAX(1, NBBY*sizeof(sc->sc_sample)/BPB)); /* Yield if requested. */ if (__predict_false(curcpu()->ci_schedstate.spc_flags & @@ -270,7 +272,7 @@ octeon_rnm_rng(size_t nbytes, void *vsc) mutex_exit(>sc_lock); /* Zero the sample. */ - explicit_memset(sample, 0, sizeof sample); + explicit_memset(sc->sc_sample, 0, sizeof sc->sc_sample); } /* @@ -366,7 +368,7 @@ octeon_rnm_iobdma(struct octeon_rnm_soft __SHIFTIN(RNM_IOBDMA_MAJORDID, IOBDMA_MAJORDID) | __SHIFTIN(RNM_IOBDMA_SUBDID, IOBDMA_SUBDID); - KASSERT(nwords < 256); /* iobdma address restriction */ + KASSERT(nwords < 128); /* iobdma address restriction */ KASSERT(nwords <= 32); /* octeon_cvmseg_map limitation */ octeon_iobdma_write_8(iobdma);
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: riastradh Date: Mon May 18 16:05:09 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_rnm.c Log Message: Adjust entropy estimate for the Octeon. We are hedging in serial and in parallel, and more conservative than the Linux driver from Cavium seems to be, so although I don't know exactly what the thermal jitter of the device is, this seems like a reasonable compromise. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/cavium/dev/octeon_rnm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_rnm.c diff -u src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.5 src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.6 --- src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.5 Wed May 13 21:09:02 2020 +++ src/sys/arch/mips/cavium/dev/octeon_rnm.c Mon May 18 16:05:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_rnm.c,v 1.5 2020/05/13 21:09:02 riastradh Exp $ */ +/* $NetBSD: octeon_rnm.c,v 1.6 2020/05/18 16:05:09 riastradh Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -67,27 +67,39 @@ * The first sample of each RO always seems to be zero. Further, * consecutive samples from a single ring oscillator are not * independent, so naive debiasing like a von Neumann extractor - * falls flat on its face. - * - * We read out one FIFO's worth of raw samples from all 128 ring - * oscillators by going through them round-robin, and without a - * more detailed assessment of the jitter on the physical devices, - * we assume it takes a couple thousand samples of ring - * oscillators (one bit per sample) to reach one bit of entropy, - * so we read out 8 KB to get about 256 bits of entropy. - * - * We could use the on-board LFSR/SHA-1 conditioner, but it's not - * clear how many RO samples go into the conditioner, and our - * entropy pool is a perfectly good conditioner itself, so it - * seems there is little advantage -- other than expedience -- to - * using the LFSR/SHA-1 conditioner. + * falls flat on its face. And parallel ring oscillators powered + * by the same source may not be independent either, if they end + * up locked. + * + * We read out one FIFO's worth of raw samples from groups of 8 + * ring oscillators at a time, of 128 total, by going through them + * round robin. We take 32 consecutive samples from each ring + * oscillator in a group of 8 in parallel before we count one bit + * of entropy. To get 256 bits of entropy, we read 4Kbit of data + * from each of two 8-RO groups. + * + * We could use the on-board LFSR/SHA-1 conditioner like the Linux + * driver written by Cavium does, but it's not clear how many RO + * samples go into the conditioner, and our entropy pool is a + * perfectly good conditioner itself, so it seems there is little + * advantage -- other than expedience -- to using the LFSR/SHA-1 + * conditioner. All the manual says is that it samples 125 of the + * 128 ROs. But the Cavium SHA-1 CPU instruction is advertised to + * have a latency of 100 cycles, so it seems implausible that much + * more than one sample from each RO could be squeezed in there. + * + * The hardware exposes only 64 bits of each SHA-1 hash, and the + * Linux driver uses 32 bits of that -- which, if treated as full + * entropy, would mean an assessment of 3.9 bits of RO samples to + * get 1 bit of entropy, whereas we take 256 bits of RO samples to + * get one bit of entropy, so this seems reasonably conservative. * * Reference: Cavium Networks OCTEON Plus CN50XX Hardware Reference * Manual, CN50XX-HM-0.99E PRELIMINARY, July 2008. */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.5 2020/05/13 21:09:02 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.6 2020/05/18 16:05:09 riastradh Exp $"); #include #include @@ -209,8 +221,7 @@ octeon_rnm_attach(device_t parent, devic static void octeon_rnm_rng(size_t nbytes, void *vsc) { - /* Assume we need 2048 RO samples to get one bit of entropy. */ - const unsigned BPB = 2048; + const unsigned BPB = 256; /* bits of data per bit of entropy */ uint64_t sample[32]; struct octeon_rnm_softc *sc = vsc; size_t needed = NBBY*nbytes;
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Tue May 12 14:04:50 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_rnm.c Log Message: Oceton RNG/RNM driver modernisation to fit new entropy world order by riastradh@, with some tweaks to get working in RNG mode. XXX TODO: work out how to get raw entropy mode working. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/cavium/dev/octeon_rnm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_rnm.c diff -u src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.3 src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.4 --- src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.3 Tue May 12 10:37:10 2020 +++ src/sys/arch/mips/cavium/dev/octeon_rnm.c Tue May 12 14:04:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_rnm.c,v 1.3 2020/05/12 10:37:10 simonb Exp $ */ +/* $NetBSD: octeon_rnm.c,v 1.4 2020/05/12 14:04:50 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,14 +27,13 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.3 2020/05/12 10:37:10 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.4 2020/05/12 14:04:50 simonb Exp $"); #include #include -#include -#include #include #include +#include #include #include @@ -45,26 +44,18 @@ __KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c #include #define RNG_DELAY_CLOCK 91 -#define RNG_DEF_BURST_COUNT 10 - -int octeon_rnm_burst_count = RNG_DEF_BURST_COUNT; struct octeon_rnm_softc { - device_t sc_dev; - bus_space_tag_t sc_bust; bus_space_handle_t sc_regh; - + kmutex_t sc_lock; krndsource_t sc_rndsrc; /* /dev/random source */ - struct callout sc_rngto; /* rng timeout */ - int sc_rnghz; /* rng poll time */ }; static int octeon_rnm_match(device_t, struct cfdata *, void *); static void octeon_rnm_attach(device_t, device_t, void *); -static void octeon_rnm_rng(void *); -static inline uint64_t octeon_rnm_load(struct octeon_rnm_softc *); -static inline int octeon_rnm_iobdma(struct octeon_rnm_softc *); +static void octeon_rnm_rng(size_t, void *); +static uint64_t octeon_rnm_load(struct octeon_rnm_softc *); CFATTACH_DECL_NEW(octeon_rnm, sizeof(struct octeon_rnm_softc), octeon_rnm_match, octeon_rnm_attach, NULL, NULL); @@ -94,7 +85,6 @@ octeon_rnm_attach(device_t parent, devic aprint_normal("\n"); - sc->sc_dev = self; sc->sc_bust = aa->aa_bust; if (bus_space_map(aa->aa_bust, aa->aa_unit->addr, RNM_SIZE, 0, >sc_regh) != 0) { @@ -110,48 +100,81 @@ octeon_rnm_attach(device_t parent, devic return; } - bus_space_write_8(sc->sc_bust, sc->sc_regh, RNM_CTL_STATUS_OFFSET, - RNM_CTL_STATUS_RNG_EN | RNM_CTL_STATUS_ENT_EN); - - if (hz >= 100) - sc->sc_rnghz = hz / 100; - else - sc->sc_rnghz = 1; - - rnd_attach_source(>sc_rndsrc, device_xname(sc->sc_dev), - RND_TYPE_RNG, RND_FLAG_NO_ESTIMATE); + mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_VM); - callout_init(>sc_rngto, 0); +#ifdef notyet + /* + * Enable the internal ring oscillator entropy source (ENT), + * but disable the LFSR/SHA-1 engine (RNG) so we get the raw RO + * samples. + * + * XXX simonb + * To access the raw entropy, it looks like this needs to be + * done through the IOBDMA. Put this in the "Too Hard For Now" + * basket and just use the RNG. + */ + bus_space_write_8(sc->sc_bust, sc->sc_regh, RNM_CTL_STATUS_OFFSET, + RNM_CTL_STATUS_EXP_ENT | RNM_CTL_STATUS_ENT_EN); - octeon_rnm_rng(sc); + /* + * Once entropy is enabled, 64 bits of raw entropy is available + * every 8 clock cycles. Wait a microsecond now before the + * random callback is called to much sure random data is + * available. + */ + delay(1); +#else + /* Enable the LFSR/SHA-1 engine (RNG). */ + bus_space_write_8(sc->sc_bust, sc->sc_regh, RNM_CTL_STATUS_OFFSET, + RNM_CTL_STATUS_RNG_EN | RNM_CTL_STATUS_ENT_EN); - aprint_normal("%s: random number generator enabled: %dhz\n", - device_xname(sc->sc_dev), sc->sc_rnghz); + /* + * Once entropy is enabled, a 64-bit random number is available + * every 81 clock cycles. Wait a microsecond now before the + * random callback is called to much sure random data is + * available. + */ + delay(1); +#endif + + rndsource_setcb(>sc_rndsrc, octeon_rnm_rng, sc); + rnd_attach_source(>sc_rndsrc, device_xname(self), RND_TYPE_RNG, + RND_FLAG_DEFAULT | RND_FLAG_HASCB); } static void -octeon_rnm_rng(void *vsc) +octeon_rnm_rng(size_t nbytes, void *vsc) { struct octeon_rnm_softc *sc = vsc; uint64_t rn; int i; - for (i = 0; i < octeon_rnm_burst_count; i++) { + /* Prevent concurrent access from emptying the FIFO. */ + mutex_enter(>sc_lock); + for (i = 0; i < howmany(nbytes, sizeof(rn)); i++) { rn = octeon_rnm_load(sc); rnd_add_data(>sc_rndsrc, , sizeof(rn), sizeof(rn) * NBBY); /* * XXX - * delay should be over RNG_DELAY_CLOCK cycles at least, -
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Tue May 12 10:37:10 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_rnm.c Log Message: If bus_space_map fails, just don't attach the driver instead of panicing. Check RNG built in self test, don't attach if that fails too. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_rnm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_rnm.c diff -u src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.2 src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.3 --- src/sys/arch/mips/cavium/dev/octeon_rnm.c:1.2 Tue Jan 8 19:41:09 2019 +++ src/sys/arch/mips/cavium/dev/octeon_rnm.c Tue May 12 10:37:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_rnm.c,v 1.2 2019/01/08 19:41:09 jdolecek Exp $ */ +/* $NetBSD: octeon_rnm.c,v 1.3 2020/05/12 10:37:10 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.2 2019/01/08 19:41:09 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.3 2020/05/12 10:37:10 simonb Exp $"); #include #include @@ -90,16 +90,25 @@ octeon_rnm_attach(device_t parent, devic { struct octeon_rnm_softc *sc = device_private(self); struct iobus_attach_args *aa = aux; - int status; + uint64_t bist_status; aprint_normal("\n"); sc->sc_dev = self; sc->sc_bust = aa->aa_bust; - status = bus_space_map(aa->aa_bust, aa->aa_unit->addr, RNM_SIZE, - 0, >sc_regh); - if (status != 0) - panic(": can't map i/o space"); + if (bus_space_map(aa->aa_bust, aa->aa_unit->addr, RNM_SIZE, + 0, >sc_regh) != 0) { + aprint_error_dev(self, "unable to map device\n"); + return; + } + + bist_status = bus_space_read_8(sc->sc_bust, sc->sc_regh, + RNM_BIST_STATUS_OFFSET); + if (bist_status) { + aprint_error_dev(self, "RNG built in self test failed: %#lx\n", + bist_status); + return; + } bus_space_write_8(sc->sc_bust, sc->sc_regh, RNM_CTL_STATUS_OFFSET, RNM_CTL_STATUS_RNG_EN | RNM_CTL_STATUS_ENT_EN);
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: simonb Date: Tue May 12 10:12:08 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_rnmreg.h Log Message: Add a few more bits. XXX convert to __BITS. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/dev/octeon_rnmreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_rnmreg.h diff -u src/sys/arch/mips/cavium/dev/octeon_rnmreg.h:1.1 src/sys/arch/mips/cavium/dev/octeon_rnmreg.h:1.2 --- src/sys/arch/mips/cavium/dev/octeon_rnmreg.h:1.1 Wed Apr 29 08:32:01 2015 +++ src/sys/arch/mips/cavium/dev/octeon_rnmreg.h Tue May 12 10:12:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_rnmreg.h,v 1.1 2015/04/29 08:32:01 hikaru Exp $ */ +/* $NetBSD: octeon_rnmreg.h,v 1.2 2020/05/12 10:12:08 simonb Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -40,7 +40,9 @@ /* register bits */ -#define RNM_CTL_STATUS_XXX_63_4 UINT64_C(0xfff0) +#define RNM_CTL_STATUS_XXX_63_5 UINT64_C(0xfe00) +#define RNM_CTL_STATUS_ENT_SEL_MASK UINT64_C(0x01e0) +#define RNM_CTL_STATUS_EXP_ENT UINT64_C(0x0010) #define RNM_CTL_STATUS_RNG_RST UINT64_C(0x0008) #define RNM_CTL_STATUS_RNM_RST UINT64_C(0x0004) #define RNM_CTL_STATUS_RNG_EN UINT64_C(0x0002) @@ -64,6 +66,8 @@ "\177" /* new format */ \ "\020" /* hex display */ \ "\020" /* %016x format */ \ + "f\x05\x04" "ENT_SEL\0" \ + "b\x04" "EXP_ENT\0" \ "b\x03" "RNG_RST\0" \ "b\x02" "RNM_RST\0" \ "b\x01" "RNG_EN\0" \
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: mrg Date: Fri Apr 24 09:29:26 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: if_cnmac.c octeon_gmx.c octeon_gmxvar.h Log Message: fetch properties in attach rather than every re-init. this avoids a rwlock while spinlock held problem likely introduced with MII locking rework, as fetching a property takes an rwlock, and prior to the rework, only kernel lock would have been held. ok skrll@. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/mips/cavium/dev/if_cnmac.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/cavium/dev/octeon_gmx.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_gmxvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/if_cnmac.c diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.17 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.18 --- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.17 Tue Feb 18 15:00:42 2020 +++ src/sys/arch/mips/cavium/dev/if_cnmac.c Fri Apr 24 09:29:26 2020 @@ -1,8 +1,8 @@ -/* $NetBSD: if_cnmac.c,v 1.17 2020/02/18 15:00:42 thorpej Exp $ */ +/* $NetBSD: if_cnmac.c,v 1.18 2020/04/24 09:29:26 mrg Exp $ */ #include #if 0 -__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.17 2020/02/18 15:00:42 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.18 2020/04/24 09:29:26 mrg Exp $"); #endif #include "opt_octeon.h" @@ -292,6 +292,8 @@ octeon_eth_attach(device_t parent, devic struct octeon_eth_softc *sc = device_private(self); struct octeon_gmx_attach_args *ga = aux; struct ifnet *ifp = >sc_ethercom.ec_if; + prop_dictionary_t dict; + prop_object_t clk; uint8_t enaddr[ETHER_ADDR_LEN]; sc->sc_dev = self; @@ -399,6 +401,15 @@ octeon_eth_attach(device_t parent, devic OCTEON_EVCNT_ATTACH_EVCNTS(sc, octeon_evcnt_entries, device_xname(sc->sc_dev)); + + dict = device_properties(sc->sc_gmx->sc_dev); + + clk = prop_dictionary_get(dict, "rgmii-tx"); + KASSERT(clk != NULL); + sc->sc_gmx_port->sc_clk_tx_setting = prop_number_integer_value(clk); + clk = prop_dictionary_get(dict, "rgmii-rx"); + KASSERT(clk != NULL); + sc->sc_gmx_port->sc_clk_rx_setting = prop_number_integer_value(clk); } /* submodules */ Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.8 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.9 --- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.8 Wed Jan 29 05:30:14 2020 +++ src/sys/arch/mips/cavium/dev/octeon_gmx.c Fri Apr 24 09:29:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $ */ +/* $NetBSD: octeon_gmx.c,v 1.9 2020/04/24 09:29:26 mrg Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.8 2020/01/29 05:30:14 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.9 2020/04/24 09:29:26 mrg Exp $"); #include "opt_octeon.h" @@ -847,9 +847,6 @@ octeon_gmx_rgmii_speed_speed(struct octe static int octeon_gmx_rgmii_timing(struct octeon_gmx_port_softc *sc) { - prop_dictionary_t dict = device_properties(sc->sc_port_gmx->sc_dev); - prop_object_t clk; - int clk_tx_setting, clk_rx_setting; uint64_t rx_frm_ctl; /* RGMII TX Threshold Registers @@ -887,14 +884,9 @@ octeon_gmx_rgmii_timing(struct octeon_gm /* RGMII TX Clock-Delay Registers * Delay setting to place n TXC (RGMII transmit clock) delay line. */ - clk = prop_dictionary_get(dict, "rgmii-tx"); - KASSERT(clk != NULL); - clk_tx_setting = prop_number_integer_value(clk); - clk = prop_dictionary_get(dict, "rgmii-rx"); - KASSERT(clk != NULL); - clk_rx_setting = prop_number_integer_value(clk); - octeon_asx_clk_set(sc->sc_port_asx, clk_tx_setting, clk_rx_setting); + octeon_asx_clk_set(sc->sc_port_asx, + sc->sc_clk_tx_setting, sc->sc_clk_rx_setting); return 0; } Index: src/sys/arch/mips/cavium/dev/octeon_gmxvar.h diff -u src/sys/arch/mips/cavium/dev/octeon_gmxvar.h:1.2 src/sys/arch/mips/cavium/dev/octeon_gmxvar.h:1.3 --- src/sys/arch/mips/cavium/dev/octeon_gmxvar.h:1.2 Thu Apr 19 21:50:06 2018 +++ src/sys/arch/mips/cavium/dev/octeon_gmxvar.h Fri Apr 24 09:29:26 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_gmxvar.h,v 1.2 2018/04/19 21:50:06 christos Exp $ */ +/* $NetBSD: octeon_gmxvar.h,v 1.3 2020/04/24 09:29:26 mrg Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -69,6 +69,9 @@ struct octeon_gmx_port_softc { struct octeon_ipd_softc *sc_ipd; int sc_port_flowflags; + int sc_clk_tx_setting; + int sc_clk_rx_setting; + #if defined(OCTEON_DEBUG) || defined(OCTEON_ETH_DEBUG) #if 0 /* XXX */
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: thorpej Date: Tue Feb 18 15:00:42 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: if_cnmac.c Log Message: - Use ether_mediachange(). - Don't call the media change function directly from the init function; bounce through mii_ifmedia_change(). To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/cavium/dev/if_cnmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/if_cnmac.c diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.16 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.17 --- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.16 Wed Jan 29 05:30:14 2020 +++ src/sys/arch/mips/cavium/dev/if_cnmac.c Tue Feb 18 15:00:42 2020 @@ -1,8 +1,8 @@ -/* $NetBSD: if_cnmac.c,v 1.16 2020/01/29 05:30:14 thorpej Exp $ */ +/* $NetBSD: if_cnmac.c,v 1.17 2020/02/18 15:00:42 thorpej Exp $ */ #include #if 0 -__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.16 2020/01/29 05:30:14 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.17 2020/02/18 15:00:42 thorpej Exp $"); #endif #include "opt_octeon.h" @@ -121,7 +121,6 @@ static void octeon_eth_mii_statchg(struc static int octeon_eth_mediainit(struct octeon_eth_softc *); static void octeon_eth_mediastatus(struct ifnet *, struct ifmediareq *); -static int octeon_eth_mediachange(struct ifnet *); static inline void octeon_eth_send_queue_flush_prefetch(struct octeon_eth_softc *); static inline void octeon_eth_send_queue_flush_fetch(struct octeon_eth_softc *); @@ -546,7 +545,7 @@ octeon_eth_mediainit(struct octeon_eth_s sc->sc_ethercom.ec_mii = mii; /* Initialize ifmedia structures. */ - ifmedia_init(>mii_media, 0, octeon_eth_mediachange, + ifmedia_init(>mii_media, 0, ether_mediachange, octeon_eth_mediastatus); phy = prop_dictionary_get(device_properties(sc->sc_dev), "phy-addr"); @@ -586,16 +585,6 @@ octeon_eth_mediastatus(struct ifnet *ifp sc->sc_gmx_port->sc_port_flowflags; } -static int -octeon_eth_mediachange(struct ifnet *ifp) -{ - struct octeon_eth_softc *sc = ifp->if_softc; - - mii_mediachg(>sc_mii); - - return 0; -} - /* send buffer garbage collection */ static inline void @@ -1226,7 +1215,7 @@ octeon_eth_init(struct ifnet *ifp) } else { octeon_gmx_port_enable(sc->sc_gmx_port, 1); } - octeon_eth_mediachange(ifp); + mii_ifmedia_change(>sc_mii); octeon_gmx_set_filter(sc->sc_gmx_port);
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: thorpej Date: Sat Jan 25 19:20:24 UTC 2020 Modified Files: src/sys/arch/mips/cavium/dev: octeon_gmx.c Log Message: Remove the IFETHER_DOT3STATS stuff in this driver. ifi_dot3stats does not exist in NetBSD's "struct if_data", and what this driver does with it is incompatible with upcoming network stack changes. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/dev/octeon_gmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.6 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.7 --- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.6 Sun Nov 10 21:16:30 2019 +++ src/sys/arch/mips/cavium/dev/octeon_gmx.c Sat Jan 25 19:20:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_gmx.c,v 1.6 2019/11/10 21:16:30 chs Exp $ */ +/* $NetBSD: octeon_gmx.c,v 1.7 2020/01/25 19:20:24 thorpej Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.6 2019/11/10 21:16:30 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.7 2020/01/25 19:20:24 thorpej Exp $"); #include "opt_octeon.h" @@ -1080,20 +1080,10 @@ octeon_gmx_stats(struct octeon_gmx_port_ ifp->if_oerrors += (uint32_t)tmp + ((uint32_t)(tmp >> 32) * 16); ifp->if_collisions += (uint32_t)tmp; -#if IFETHER_DOT3STATS - /* dot3StatsExcessiveCollisions */ - ifp->if_data.ifi_dot3stats.if_oexsvcols += (uint32_t)tmp; -#endif tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT1); ifp->if_collisions += (uint32_t)tmp + (uint32_t)(tmp >> 32); -#if IFETHER_DOT3STATS - /* dot3StatsSingleCollisionFrames */ - ifp->if_data.ifi_dot3stats.if_oscols += (uint32_t)(tmp >> 32); - /* dot3StatsMultipleCollisionFrames */ - ifp->if_data.ifi_dot3stats.if_omcols += (uint32_t)tmp; -#endif tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT9); ifp->if_oerrors += (uint32_t)(tmp >> 32);
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: gutteridge Date: Sat Dec 28 02:58:59 UTC 2019 Modified Files: src/sys/arch/mips/cavium/dev: if_cnmac.c Log Message: Fix typos in comments. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/mips/cavium/dev/if_cnmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/if_cnmac.c diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.14 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.15 --- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.14 Fri Jun 7 07:41:22 2019 +++ src/sys/arch/mips/cavium/dev/if_cnmac.c Sat Dec 28 02:58:59 2019 @@ -1,8 +1,8 @@ -/* $NetBSD: if_cnmac.c,v 1.14 2019/06/07 07:41:22 martin Exp $ */ +/* $NetBSD: if_cnmac.c,v 1.15 2019/12/28 02:58:59 gutteridge Exp $ */ #include #if 0 -__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.14 2019/06/07 07:41:22 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.15 2019/12/28 02:58:59 gutteridge Exp $"); #endif #include "opt_octeon.h" @@ -20,7 +20,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v #endif /* - * If no free send buffer is available, free all the sent buffer and bail out. + * If no free send buffer is available, free all the sent buffers and bail out. */ #define OCTEON_ETH_SEND_QUEUE_CHECK @@ -1099,7 +1099,7 @@ octeon_eth_start(struct ifnet *ifp) /* * Performance tuning - * presend iobdma request + * pre-send iobdma request */ octeon_eth_send_queue_flush_prefetch(sc); @@ -1131,7 +1131,7 @@ octeon_eth_start(struct ifnet *ifp) /* * If no free send buffer is available, free all the sent - * buffer and bail out. + * buffers and bail out. */ if (octeon_eth_send_queue_is_full(sc)) { SET(ifp->if_flags, IFF_OACTIVE); @@ -1421,7 +1421,7 @@ octeon_eth_recv_check(struct octeon_eth_ return 1; } -#if 0 /* XXX Performance tunig (Jumbo-frame is not supported yet!) */ +#if 0 /* XXX Performance tuning (Jumbo-frame is not supported yet!) */ if (__predict_false(octeon_eth_recv_check_jumbo(sc, word2)) != 0) { /* XXX jumbo frame */ if (ratecheck(>sc_rate_recv_check_jumbo_last, @@ -1438,10 +1438,10 @@ octeon_eth_recv_check(struct octeon_eth_ if ((word2 & PIP_WQE_WORD2_NOIP_OPECODE) == PIP_WQE_WORD2_RE_OPCODE_LENGTH) { /* No logging */ - /* XXX inclement special error count */ + /* XXX increment special error count */ } else if ((word2 & PIP_WQE_WORD2_NOIP_OPECODE) == PIP_WQE_WORD2_RE_OPCODE_PARTIAL) { - /* Not an erorr. it's because of overload */ + /* Not an error, it's because of overload */ } else { if (ratecheck(>sc_rate_recv_check_code_last, @@ -1469,7 +1469,7 @@ octeon_eth_recv(struct octeon_eth_softc /* XXX XXX XXX */ /* * Performance tuning - * presend iobdma request + * pre-send iobdma request */ if (sc->sc_soft_req_cnt > sc->sc_soft_req_thresh) { octeon_eth_send_queue_flush_prefetch(sc);
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: dholland Date: Sun Jan 27 05:04:39 UTC 2019 Modified Files: src/sys/arch/mips/cavium/dev: octeon_fpa.c Log Message: Restore accidentally-dropped opt_octeon.h. (or at least it really looks like it was accidental) To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/cavium/dev/octeon_fpa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_fpa.c diff -u src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.3 src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.4 --- src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.3 Sun Jan 27 02:08:38 2019 +++ src/sys/arch/mips/cavium/dev/octeon_fpa.c Sun Jan 27 05:04:39 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_fpa.c,v 1.3 2019/01/27 02:08:38 pgoyette Exp $ */ +/* $NetBSD: octeon_fpa.c,v 1.4 2019/01/27 05:04:39 dholland Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -29,7 +29,9 @@ #undef FPADEBUG #include -__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.3 2019/01/27 02:08:38 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.4 2019/01/27 05:04:39 dholland Exp $"); + +#include "opt_octeon.h" #include #include
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: msaitoh Date: Thu Jan 10 05:41:10 UTC 2019 Modified Files: src/sys/arch/mips/cavium/dev: octeon_smivar.h Log Message: KNF. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/dev/octeon_smivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_smivar.h diff -u src/sys/arch/mips/cavium/dev/octeon_smivar.h:1.1 src/sys/arch/mips/cavium/dev/octeon_smivar.h:1.2 --- src/sys/arch/mips/cavium/dev/octeon_smivar.h:1.1 Wed Apr 29 08:32:01 2015 +++ src/sys/arch/mips/cavium/dev/octeon_smivar.h Thu Jan 10 05:41:10 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_smivar.h,v 1.1 2015/04/29 08:32:01 hikaru Exp $ */ +/* $NetBSD: octeon_smivar.h,v 1.2 2019/01/10 05:41:10 msaitoh Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -42,10 +42,10 @@ struct octeon_smi_attach_args { bus_space_tag_t aa_regt; }; -void octeon_smi_init(struct octeon_smi_attach_args *, - struct octeon_smi_softc **); -int octeon_smi_read(struct octeon_smi_softc *, int, int); -void octeon_smi_write(struct octeon_smi_softc *, int, int, int); -void octeon_smi_set_clock(struct octeon_smi_softc *, uint64_t); +void octeon_smi_init(struct octeon_smi_attach_args *, +struct octeon_smi_softc **); +int octeon_smi_read(struct octeon_smi_softc *, int, int); +void octeon_smi_write(struct octeon_smi_softc *, int, int, int); +void octeon_smi_set_clock(struct octeon_smi_softc *, uint64_t); #endif
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: skrll Date: Sun Nov 18 11:45:46 UTC 2018 Modified Files: src/sys/arch/mips/cavium/dev: octeon_usbcvar.h Log Message: Whitespace To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/cavium/dev/octeon_usbcvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_usbcvar.h diff -u src/sys/arch/mips/cavium/dev/octeon_usbcvar.h:1.4 src/sys/arch/mips/cavium/dev/octeon_usbcvar.h:1.5 --- src/sys/arch/mips/cavium/dev/octeon_usbcvar.h:1.4 Mon Apr 9 16:21:10 2018 +++ src/sys/arch/mips/cavium/dev/octeon_usbcvar.h Sun Nov 18 11:45:46 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_usbcvar.h,v 1.4 2018/04/09 16:21:10 jakllsch Exp $ */ +/* $NetBSD: octeon_usbcvar.h,v 1.5 2018/11/18 11:45:46 skrll Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -107,7 +107,7 @@ typedef struct octeon_usbc_soft_ed { u_int8_t ref_count; struct octeon_usbc_soft_td *std_head; - + u_int8_t status; #define USBC_ENDPT_STATUS_SKIP 0 #define USBC_ENDPT_STATUS_READY 1 @@ -176,7 +176,7 @@ typedef struct octeon_usbc_soft_td { typedef struct octeon_usbc_softc { device_t sc_dev; struct usbd_bus sc_bus; - + bus_space_tag_t sc_bust; /* iobus space */ bus_space_handle_t sc_regh; /* usbc register space */
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: skrll Date: Thu Oct 4 15:21:23 UTC 2018 Modified Files: src/sys/arch/mips/cavium/dev: octeon_fpa.c Log Message: Remove duplicate #include To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/dev/octeon_fpa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_fpa.c diff -u src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.1 src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.2 --- src/sys/arch/mips/cavium/dev/octeon_fpa.c:1.1 Wed Apr 29 08:32:01 2015 +++ src/sys/arch/mips/cavium/dev/octeon_fpa.c Thu Oct 4 15:21:23 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_fpa.c,v 1.1 2015/04/29 08:32:01 hikaru Exp $ */ +/* $NetBSD: octeon_fpa.c,v 1.2 2018/10/04 15:21:23 skrll Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -29,9 +29,7 @@ #undef FPADEBUG #include -__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.1 2015/04/29 08:32:01 hikaru Exp $"); - -#include "opt_octeon.h" +__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.2 2018/10/04 15:21:23 skrll Exp $"); #include "opt_octeon.h"
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: mrg Date: Tue Feb 6 09:33:45 UTC 2018 Modified Files: src/sys/arch/mips/cavium/dev: octeon_pip.c Log Message: update for GCC 6: hide octeon_pip_dump_regs_[] under OCTEON_ETH_DEBUG, the only user. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/dev/octeon_pip.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_pip.c diff -u src/sys/arch/mips/cavium/dev/octeon_pip.c:1.1 src/sys/arch/mips/cavium/dev/octeon_pip.c:1.2 --- src/sys/arch/mips/cavium/dev/octeon_pip.c:1.1 Wed Apr 29 08:32:01 2015 +++ src/sys/arch/mips/cavium/dev/octeon_pip.c Tue Feb 6 09:33:45 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_pip.c,v 1.1 2015/04/29 08:32:01 hikaru Exp $ */ +/* $NetBSD: octeon_pip.c,v 1.2 2018/02/06 09:33:45 mrg Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_pip.c,v 1.1 2015/04/29 08:32:01 hikaru Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_pip.c,v 1.2 2018/02/06 09:33:45 mrg Exp $"); #include "opt_octeon.h" @@ -88,6 +88,7 @@ static const struct octeon_pip_dump_reg_ _ENTRY_0_1_2_32 (PIP_STAT_INB_ERRS), }; +#ifdef OCTEON_ETH_DEBUG static const struct octeon_pip_dump_reg_ octeon_pip_dump_regs_[] = { _ENTRY (PIP_BIST_STATUS), _ENTRY (PIP_INT_REG), @@ -106,6 +107,8 @@ static const struct octeon_pip_dump_reg_ _ENTRY_0_1_2_32 (PIP_PRT_CFG), _ENTRY_0_1_2_32 (PIP_PRT_TAG), }; +#endif + #undef _ENTRY #undef _ENTRY_0_3 #undef _ENTRY_0_7
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: jmcneill Date: Mon Jan 1 13:25:22 UTC 2018 Modified Files: src/sys/arch/mips/cavium/dev: if_cnmac.c Log Message: Set and clear IFF_OACTIVE as necessary, and add support for queueing multiple packets before performing a PKO doorbell write. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/cavium/dev/if_cnmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/if_cnmac.c diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.7 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.8 --- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.7 Sun Nov 26 18:41:14 2017 +++ src/sys/arch/mips/cavium/dev/if_cnmac.c Mon Jan 1 13:25:22 2018 @@ -1,8 +1,8 @@ -/* $NetBSD: if_cnmac.c,v 1.7 2017/11/26 18:41:14 jmcneill Exp $ */ +/* $NetBSD: if_cnmac.c,v 1.8 2018/01/01 13:25:22 jmcneill Exp $ */ #include #if 0 -__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.7 2017/11/26 18:41:14 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.8 2018/01/01 13:25:22 jmcneill Exp $"); #endif #include "opt_octeon.h" @@ -144,7 +144,7 @@ static void octeon_eth_stop(struct ifnet static void octeon_eth_start(struct ifnet *); static inline int octeon_eth_send_cmd(struct octeon_eth_softc *, uint64_t, - uint64_t); + uint64_t, int *); static inline uint64_t octeon_eth_send_makecmd_w1(int, paddr_t); static inline uint64_t octeon_eth_send_makecmd_w0(uint64_t, uint64_t, size_t, int); @@ -153,9 +153,9 @@ static inline int octeon_eth_send_makecm static inline int octeon_eth_send_makecmd(struct octeon_eth_softc *, struct mbuf *, uint64_t *, uint64_t *, uint64_t *); static inline int octeon_eth_send_buf(struct octeon_eth_softc *, - struct mbuf *, uint64_t *); + struct mbuf *, uint64_t *, int *); static inline int octeon_eth_send(struct octeon_eth_softc *, - struct mbuf *); + struct mbuf *, int *); static int octeon_eth_reset(struct octeon_eth_softc *); static int octeon_eth_configure(struct octeon_eth_softc *); @@ -615,6 +615,7 @@ octeon_eth_send_queue_flush_fetch(struct static inline void octeon_eth_send_queue_flush(struct octeon_eth_softc *sc) { + struct ifnet *ifp = >sc_ethercom.ec_if; const int64_t sent_count = sc->sc_hard_done_cnt; int i; @@ -631,6 +632,8 @@ octeon_eth_send_queue_flush(struct octeo OCTEON_EVCNT_INC(sc, txbufgbput); m_freem(m); + + CLR(ifp->if_flags, IFF_OACTIVE); } octeon_fau_op_inc_fetch_8(>sc_fau_done, i); @@ -972,7 +975,7 @@ done: static inline int octeon_eth_send_cmd(struct octeon_eth_softc *sc, uint64_t pko_cmd_w0, -uint64_t pko_cmd_w1) +uint64_t pko_cmd_w1, int *pwdc) { uint64_t *cmdptr; int result = 0; @@ -1011,7 +1014,7 @@ octeon_eth_send_cmd(struct octeon_eth_so sc->sc_cmdptr.cmdptr_idx += 2; } - octeon_pko_op_doorbell_write(sc->sc_port, sc->sc_port, 2); + *pwdc += 2; done: return result; @@ -1019,7 +1022,7 @@ done: static inline int octeon_eth_send_buf(struct octeon_eth_softc *sc, struct mbuf *m, -uint64_t *gbuf) +uint64_t *gbuf, int *pwdc) { int result = 0, error; uint64_t pko_cmd_w0, pko_cmd_w1; @@ -1032,7 +1035,7 @@ octeon_eth_send_buf(struct octeon_eth_so goto done; } - error = octeon_eth_send_cmd(sc, pko_cmd_w0, pko_cmd_w1); + error = octeon_eth_send_cmd(sc, pko_cmd_w0, pko_cmd_w1, pwdc); if (error != 0) { /* already logging */ OCTEON_EVCNT_INC(sc, txerrcmd); @@ -1044,7 +1047,7 @@ done: } static inline int -octeon_eth_send(struct octeon_eth_softc *sc, struct mbuf *m) +octeon_eth_send(struct octeon_eth_softc *sc, struct mbuf *m, int *pwdc) { paddr_t gaddr = 0; uint64_t *gbuf = NULL; @@ -1072,7 +1075,7 @@ octeon_eth_send(struct octeon_eth_softc OCTEON_ETH_KASSERT(gbuf != NULL); - error = octeon_eth_send_buf(sc, m, gbuf); + error = octeon_eth_send_buf(sc, m, gbuf, pwdc); if (error != 0) { /* already logging */ octeon_fpa_buf_put_paddr(octeon_eth_fb_sg, gaddr); @@ -1092,6 +1095,7 @@ octeon_eth_start(struct ifnet *ifp) { struct octeon_eth_softc *sc = ifp->if_softc; struct mbuf *m; + int wdc = 0; /* * performance tuning @@ -1130,6 +1134,10 @@ octeon_eth_start(struct ifnet *ifp) * and bail out. */ if (octeon_eth_send_queue_is_full(sc)) { + SET(ifp->if_flags, IFF_OACTIVE); + if (wdc > 0) +octeon_pko_op_doorbell_write(sc->sc_port, +sc->sc_port, wdc); return; } /* XXX XXX XXX */ @@ -1141,7 +1149,7 @@ octeon_eth_start(struct ifnet *ifp) /* XXX XXX XXX */ if (sc->sc_soft_req_cnt > sc->sc_soft_req_thresh) octeon_eth_send_queue_flush(sc); - if (octeon_eth_send(sc, m)) { + if (octeon_eth_send(sc, m, )) { IF_DROP(>if_snd); m_freem(m); log(LOG_WARNING, @@ -1161,6 +1169,9 @@ octeon_eth_start(struct ifnet *ifp) octeon_eth_send_queue_flush_prefetch(sc); } + if (wdc > 0) +
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: jmcneill Date: Sun Nov 26 18:41:14 UTC 2017 Modified Files: src/sys/arch/mips/cavium/dev: if_cnmac.c Log Message: Set ETHERCAP_VLAN_MTU capability flag. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/dev/if_cnmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/if_cnmac.c diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.6 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.7 --- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.6 Tue Aug 22 07:09:00 2017 +++ src/sys/arch/mips/cavium/dev/if_cnmac.c Sun Nov 26 18:41:14 2017 @@ -1,8 +1,8 @@ -/* $NetBSD: if_cnmac.c,v 1.6 2017/08/22 07:09:00 maya Exp $ */ +/* $NetBSD: if_cnmac.c,v 1.7 2017/11/26 18:41:14 jmcneill Exp $ */ #include #if 0 -__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.6 2017/08/22 07:09:00 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.7 2017/11/26 18:41:14 jmcneill Exp $"); #endif #include "opt_octeon.h" @@ -366,6 +366,9 @@ octeon_eth_attach(device_t parent, devic IFCAP_CSUM_IPv4_Rx | IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_TCPv6_Rx | IFCAP_CSUM_UDPv6_Rx; + /* 802.1Q VLAN-sized frames are supported */ + sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU; + octeon_gmx_set_mac_addr(sc->sc_gmx_port, enaddr); octeon_gmx_set_filter(sc->sc_gmx_port);
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: maya Date: Tue Aug 22 07:09:00 UTC 2017 Modified Files: src/sys/arch/mips/cavium/dev: if_cnmac.c Log Message: Reword warning message To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/cavium/dev/if_cnmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/if_cnmac.c diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.5 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.6 --- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.5 Thu Dec 15 09:28:03 2016 +++ src/sys/arch/mips/cavium/dev/if_cnmac.c Tue Aug 22 07:09:00 2017 @@ -1,8 +1,8 @@ -/* $NetBSD: if_cnmac.c,v 1.5 2016/12/15 09:28:03 ozaki-r Exp $ */ +/* $NetBSD: if_cnmac.c,v 1.6 2017/08/22 07:09:00 maya Exp $ */ #include #if 0 -__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.5 2016/12/15 09:28:03 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.6 2017/08/22 07:09:00 maya Exp $"); #endif #include "opt_octeon.h" @@ -1436,8 +1436,8 @@ octeon_eth_recv_check(struct octeon_eth_ if (ratecheck(>sc_rate_recv_check_code_last, >sc_rate_recv_check_code_cap)) log(LOG_WARNING, -"%s: the reception error had occured, " -"the packet was dropped (error code = %" PRId64 ")\n", +"%s: reception error, packet dropped " +"(error code = %" PRId64 ")\n", device_xname(sc->sc_dev), word2 & PIP_WQE_WORD2_NOIP_OPECODE); } OCTEON_EVCNT_INC(sc, rxerrcode);
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: maxv Date: Sun Aug 20 11:05:24 UTC 2017 Modified Files: src/sys/arch/mips/cavium/dev: octeon_gmx.c Log Message: as the xxx implicitly points out, there's a division by zero here, so panic right away; found by mootja To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_gmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_gmx.c diff -u src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.2 src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.3 --- src/sys/arch/mips/cavium/dev/octeon_gmx.c:1.2 Mon Jun 1 22:55:12 2015 +++ src/sys/arch/mips/cavium/dev/octeon_gmx.c Sun Aug 20 11:05:24 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_gmx.c,v 1.2 2015/06/01 22:55:12 matt Exp $ */ +/* $NetBSD: octeon_gmx.c,v 1.3 2017/08/20 11:05:24 maxv Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.2 2015/06/01 22:55:12 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.3 2017/08/20 11:05:24 maxv Exp $"); #include "opt_octeon.h" @@ -654,6 +654,7 @@ octeon_gmx_rgmii_speed(struct octeon_gmx break; default: baudrate = 0/* XXX */; + panic("unable to get baudrate"); break; } ifp->if_baudrate = baudrate;
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: skrll Date: Sat Aug 20 06:34:22 UTC 2016 Modified Files: src/sys/arch/mips/cavium/dev: octeon_ciureg.h Log Message: Fix a couple of (unsed) definitions To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/cavium/dev/octeon_ciureg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_ciureg.h diff -u src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.4 src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.5 --- src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.4 Sat Jun 6 20:15:35 2015 +++ src/sys/arch/mips/cavium/dev/octeon_ciureg.h Sat Aug 20 06:34:22 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_ciureg.h,v 1.4 2015/06/06 20:15:35 matt Exp $ */ +/* $NetBSD: octeon_ciureg.h,v 1.5 2016/08/20 06:34:22 skrll Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -40,7 +40,7 @@ #define CIU_INT2_SUM0UINT64_C(0x00010710) #define CIU_INT3_SUM0UINT64_C(0x00010718) #define CIU_INT32_SUM0UINT64_C(0x000107000100) -#define CIU_INT_SUM1UINT64_C(0x00010708) +#define CIU_INT_SUM1UINT64_C(0x000107000108) #define CIU_INT0_EN0UINT64_C(0x000107000200) #define CIU_INT1_EN0UINT64_C(0x000107000210) #define CIU_INT2_EN0UINT64_C(0x000107000220) @@ -88,7 +88,7 @@ #define CIU_INT2_SUM0_OFFSET 0x0010 #define CIU_INT3_SUM0_OFFSET 0x0018 #define CIU_INT32_SUM0_OFFSET 0x0100 -#define CIU_INT_SUM1_OFFSET 0x0008 +#define CIU_INT_SUM1_OFFSET 0x0108 #define CIU_INT0_EN0_OFFSET 0x0200 #define CIU_INT1_EN0_OFFSET 0x0210 #define CIU_INT2_EN0_OFFSET 0x0220
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: matt Date: Tue Jul 12 03:34:25 UTC 2016 Modified Files: src/sys/arch/mips/cavium/dev: octeon_dwctwo.c Log Message: Use mips_lwu To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_dwctwo.c diff -u src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.8 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.9 --- src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.8 Mon Jul 11 16:15:35 2016 +++ src/sys/arch/mips/cavium/dev/octeon_dwctwo.c Tue Jul 12 03:34:25 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_dwctwo.c,v 1.8 2016/07/11 16:15:35 matt Exp $ */ +/* $NetBSD: octeon_dwctwo.c,v 1.9 2016/07/12 03:34:25 matt Exp $ */ /* * Copyright (c) 2015 Masao Uebayashi@@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.8 2016/07/11 16:15:35 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.9 2016/07/12 03:34:25 matt Exp $"); #include "opt_octeon.h" #include "opt_usb.h" @@ -321,7 +321,7 @@ octeon_dwc2_rd_4(void *v, bus_space_hand { /* dwc2 uses little-endian addressing */ - return mips_lw((h + off) ^ 4); + return mips_lwu((h + off) ^ 4); } static void
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: skrll Date: Tue Apr 26 09:24:57 UTC 2016 Modified Files: src/sys/arch/mips/cavium/dev: octeon_dwctwo.c Log Message: Adapt to nick-nhusb merge To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_dwctwo.c diff -u src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.6 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.7 --- src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.6 Sun Aug 30 13:02:42 2015 +++ src/sys/arch/mips/cavium/dev/octeon_dwctwo.c Tue Apr 26 09:24:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_dwctwo.c,v 1.6 2015/08/30 13:02:42 skrll Exp $ */ +/* $NetBSD: octeon_dwctwo.c,v 1.7 2016/04/26 09:24:57 skrll Exp $ */ /* * Copyright (c) 2015 Masao Uebayashi@@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.6 2015/08/30 13:02:42 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_dwctwo.c,v 1.7 2016/04/26 09:24:57 skrll Exp $"); #include "opt_octeon.h" #include "opt_usb.h" @@ -173,7 +173,7 @@ octeon_dwc2_attach(device_t parent, devi sc->sc_dwc2_bust.bs_w_4 = octeon_dwc2_wr_4; sc->sc_dwc2.sc_iot = >sc_dwc2_bust; - sc->sc_dwc2.sc_bus.dmatag = aa->aa_dmat; + sc->sc_dwc2.sc_bus.ub_dmatag = aa->aa_dmat; sc->sc_dwc2.sc_params = _dwc2_params; sc->sc_dwc2.sc_set_dma_addr = octeon_dwc2_set_dma_addr;
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: skrll Date: Tue Apr 26 09:23:33 UTC 2016 Modified Files: src/sys/arch/mips/cavium/dev: octeon_usbcvar.h Log Message: g/c usb_dma_reserve To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_usbcvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_usbcvar.h diff -u src/sys/arch/mips/cavium/dev/octeon_usbcvar.h:1.2 src/sys/arch/mips/cavium/dev/octeon_usbcvar.h:1.3 --- src/sys/arch/mips/cavium/dev/octeon_usbcvar.h:1.2 Tue Apr 26 09:22:36 2016 +++ src/sys/arch/mips/cavium/dev/octeon_usbcvar.h Tue Apr 26 09:23:33 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_usbcvar.h,v 1.2 2016/04/26 09:22:36 skrll Exp $ */ +/* $NetBSD: octeon_usbcvar.h,v 1.3 2016/04/26 09:23:33 skrll Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -229,9 +229,6 @@ typedef struct octeon_usbc_softc { device_ptr_t sc_child; /* /dev/usb# device */ #endif char sc_dying; -#ifdef __NetBSD__ - struct usb_dma_reserve sc_dma_reserve; -#endif u_int8_t sc_port_speed; #ifndef USBC_HPRT_PRTSPD_HIGH
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: skrll Date: Tue Apr 26 09:22:36 UTC 2016 Modified Files: src/sys/arch/mips/cavium/dev: octeon_usbcvar.h Log Message: s/usbd_xfer_handle/struct usbd_xfer */ To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/dev/octeon_usbcvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_usbcvar.h diff -u src/sys/arch/mips/cavium/dev/octeon_usbcvar.h:1.1 src/sys/arch/mips/cavium/dev/octeon_usbcvar.h:1.2 --- src/sys/arch/mips/cavium/dev/octeon_usbcvar.h:1.1 Wed Apr 29 08:32:01 2015 +++ src/sys/arch/mips/cavium/dev/octeon_usbcvar.h Tue Apr 26 09:22:36 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_usbcvar.h,v 1.1 2015/04/29 08:32:01 hikaru Exp $ */ +/* $NetBSD: octeon_usbcvar.h,v 1.2 2016/04/26 09:22:36 skrll Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -152,7 +152,7 @@ typedef struct octeon_usbc_soft_td { struct octeon_usbc_soft_td *next; struct octeon_usbc_soft_ed *sed; usb_dma_t *buff; - usbd_xfer_handle xfer; + struct usbd_xfer *xfer; u_int32_t offset; u_int32_t base_offset; u_int8_t error_count; @@ -196,7 +196,7 @@ typedef struct octeon_usbc_softc { int sc_noport; u_int8_t sc_addr; /* device address */ u_int8_t sc_conf; /* device configuration */ - usbd_xfer_handle sc_intrxfer; + struct usbd_xfer *sc_intrxfer; char sc_isreset; /* USBC is reseted ? */ char sc_connstat_change; /* USBC is disconnected ? */ #define USBC_PRT_STAT_CONNECTED 0x01
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: matt Date: Sat Jun 6 20:15:35 UTC 2015 Modified Files: src/sys/arch/mips/cavium/dev: octeon_ciureg.h Log Message: Add CIU_BASE To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/cavium/dev/octeon_ciureg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_ciureg.h diff -u src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.3 src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.4 --- src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.3 Sat Jun 6 04:33:45 2015 +++ src/sys/arch/mips/cavium/dev/octeon_ciureg.h Sat Jun 6 20:15:35 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_ciureg.h,v 1.3 2015/06/06 04:33:45 matt Exp $ */ +/* $NetBSD: octeon_ciureg.h,v 1.4 2015/06/06 20:15:35 matt Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -81,6 +81,8 @@ #define CIU_INT4_EN10UINT64_C(0x000107000c90) #define CIU_INT4_EN11UINT64_C(0x000107000c98) +#define CIU_BASEUINT64_C(0x00010700) + #define CIU_INT0_SUM0_OFFSET 0x #define CIU_INT1_SUM0_OFFSET 0x0008 #define CIU_INT2_SUM0_OFFSET 0x0010
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: matt Date: Sat Jun 6 04:33:45 UTC 2015 Modified Files: src/sys/arch/mips/cavium/dev: octeon_ciureg.h Log Message: Fix CUI_MBOX_{SET,CLR}1 values To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_ciureg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_ciureg.h diff -u src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.2 src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.3 --- src/sys/arch/mips/cavium/dev/octeon_ciureg.h:1.2 Mon Jun 1 22:55:12 2015 +++ src/sys/arch/mips/cavium/dev/octeon_ciureg.h Sat Jun 6 04:33:45 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_ciureg.h,v 1.2 2015/06/01 22:55:12 matt Exp $ */ +/* $NetBSD: octeon_ciureg.h,v 1.3 2015/06/06 04:33:45 matt Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -60,9 +60,9 @@ #define CIU_PP_POKE0UINT64_C(0x000107000580) #define CIU_PP_POKE1UINT64_C(0x000107000588) #define CIU_MBOX_SET0UINT64_C(0x000107000600) -#define CIU_MBOX_SET1UINT64_C(0x000107000600) +#define CIU_MBOX_SET1UINT64_C(0x000107000608) #define CIU_MBOX_CLR0UINT64_C(0x000107000680) -#define CIU_MBOX_CLR1UINT64_C(0x000107000680) +#define CIU_MBOX_CLR1UINT64_C(0x000107000688) #define CIU_PP_RSTUINT64_C(0x000107000700) #define CIU_PP_DBGUINT64_C(0x000107000708) #define CIU_GSTOPUINT64_C(0x000107000710)
CVS commit: src/sys/arch/mips/cavium/dev
Module Name:src Committed By: matt Date: Tue Jun 2 05:11:34 UTC 2015 Modified Files: src/sys/arch/mips/cavium/dev: octeon_uart.c Log Message: Use structure copy instead of memcpy. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_uart.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/mips/cavium/dev/octeon_uart.c diff -u src/sys/arch/mips/cavium/dev/octeon_uart.c:1.2 src/sys/arch/mips/cavium/dev/octeon_uart.c:1.3 --- src/sys/arch/mips/cavium/dev/octeon_uart.c:1.2 Mon Jun 1 22:55:12 2015 +++ src/sys/arch/mips/cavium/dev/octeon_uart.c Tue Jun 2 05:11:34 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_uart.c,v 1.2 2015/06/01 22:55:12 matt Exp $ */ +/* $NetBSD: octeon_uart.c,v 1.3 2015/06/02 05:11:34 matt Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: octeon_uart.c,v 1.2 2015/06/01 22:55:12 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: octeon_uart.c,v 1.3 2015/06/02 05:11:34 matt Exp $); #include opt_octeon.h @@ -121,7 +121,7 @@ octeon_uart_iobus_attach(device_t parent int status; sc_com-sc_dev = self; - (void)memcpy(sc_com-sc_regs, octeon_uart_com_regs, sizeof(sc_com-sc_regs)); + sc_com-sc_regs = octeon_uart_com_regs; sc_com-sc_regs.cr_iot = aa-aa_bust; sc_com-sc_regs.cr_iobase = aa-aa_unit-addr;