Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips/cavium Cleanup - mostly removing unused code a...
details: https://anonhg.NetBSD.org/src/rev/bdae85f9a3cf
branches: trunk
changeset: 935046:bdae85f9a3cf
user: simonb <simonb%NetBSD.org@localhost>
date: Tue Jun 23 05:15:33 2020 +0000
description:
Cleanup - mostly removing unused code and defines.
diffstat:
sys/arch/mips/cavium/dev/octeon_ipd.c | 61 +----
sys/arch/mips/cavium/dev/octeon_ipdvar.h | 3 +-
sys/arch/mips/cavium/dev/octeon_pko.c | 41 +--
sys/arch/mips/cavium/dev/octeon_pkovar.h | 4 +-
sys/arch/mips/cavium/dev/octeon_pow.c | 358 +------------------------------
sys/arch/mips/cavium/dev/octeon_powreg.h | 8 +-
sys/arch/mips/cavium/dev/octeon_powvar.h | 161 +++---------
sys/arch/mips/cavium/octeonvar.h | 108 +---------
8 files changed, 79 insertions(+), 665 deletions(-)
diffs (truncated from 1003 to 300 lines):
diff -r 506bd76cc9e0 -r bdae85f9a3cf sys/arch/mips/cavium/dev/octeon_ipd.c
--- a/sys/arch/mips/cavium/dev/octeon_ipd.c Tue Jun 23 05:14:39 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_ipd.c Tue Jun 23 05:15:33 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_ipd.c,v 1.6 2020/06/22 02:26:20 simonb Exp $ */
+/* $NetBSD: octeon_ipd.c,v 1.7 2020/06/23 05:15:33 simonb Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,11 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_ipd.c,v 1.6 2020/06/22 02:26:20 simonb Exp $");
-
-#include "opt_octeon.h"
-
-#include "opt_octeon.h"
+__KERNEL_RCSID(0, "$NetBSD: octeon_ipd.c,v 1.7 2020/06/23 05:15:33 simonb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -208,55 +204,6 @@
*rcflags = cflags;
}
-int
-octipd_red(struct octipd_softc *sc, uint64_t pass_thr, uint64_t drop_thr)
-{
-#if defined(CNMAC_IPD_RED)
- /*
- * no receive problem workaround.
- * if not set IPD RED pramaters,
- * may become unable to receive packet
- * on media mismatch environment
- * of self media 100-half duplex.
- */
- uint64_t red_marks;
- uint64_t red_param;
- uint64_t red_port;
-
- red_marks = drop_thr << 32 /* XXX */ | pass_thr;
- _IPD_WR8(sc, IPD_QOS0_RED_MARKS_OFFSET, red_marks);
- _IPD_WR8(sc, IPD_QOS1_RED_MARKS_OFFSET, red_marks);
- _IPD_WR8(sc, IPD_QOS2_RED_MARKS_OFFSET, red_marks);
- _IPD_WR8(sc, IPD_QOS3_RED_MARKS_OFFSET, red_marks);
- _IPD_WR8(sc, IPD_QOS4_RED_MARKS_OFFSET, red_marks);
- _IPD_WR8(sc, IPD_QOS5_RED_MARKS_OFFSET, red_marks);
- _IPD_WR8(sc, IPD_QOS6_RED_MARKS_OFFSET, red_marks);
- _IPD_WR8(sc, IPD_QOS7_RED_MARKS_OFFSET, red_marks);
- red_param =
- ((255ull << 24 /* XXX */) / (pass_thr - drop_thr)) |
- 1ull << 32 /* XXX */ |
- 255ull << 40 /* XXX */ |
- 1ull << 48 /* XXX */;
- _IPD_WR8(sc, IPD_RED_QUE0_PARAM_OFFSET, red_param);
- _IPD_WR8(sc, IPD_RED_QUE1_PARAM_OFFSET, red_param);
- _IPD_WR8(sc, IPD_RED_QUE2_PARAM_OFFSET, red_param);
- _IPD_WR8(sc, IPD_RED_QUE3_PARAM_OFFSET, red_param);
- _IPD_WR8(sc, IPD_RED_QUE4_PARAM_OFFSET, red_param);
- _IPD_WR8(sc, IPD_RED_QUE5_PARAM_OFFSET, red_param);
- _IPD_WR8(sc, IPD_RED_QUE6_PARAM_OFFSET, red_param);
- _IPD_WR8(sc, IPD_RED_QUE7_PARAM_OFFSET, red_param);
-
- _IPD_WR8(sc, IPD_BP_PRT_RED_END_OFFSET, 0);
-
- red_port = 0xfffffffffull |
- 10000ull << 36 /* XXX */ |
- 10000ull << 50 /* XXX */;
- _IPD_WR8(sc, IPD_RED_PORT_ENABLE_OFFSET, red_port);
-#endif
-
- return 0;
-}
-
void
octipd_sub_port_fcs(struct octipd_softc *sc, int enable)
{
@@ -264,8 +211,8 @@
sub_port_fcs = _IPD_RD8(sc, IPD_SUB_PORT_FCS_OFFSET);
if (enable == 0)
- CLR(sub_port_fcs, 1 << sc->sc_port);
+ CLR(sub_port_fcs, __BIT(sc->sc_port));
else
- SET(sub_port_fcs, 1 << sc->sc_port);
+ SET(sub_port_fcs, __BIT(sc->sc_port));
_IPD_WR8(sc, IPD_SUB_PORT_FCS_OFFSET, sub_port_fcs);
}
diff -r 506bd76cc9e0 -r bdae85f9a3cf sys/arch/mips/cavium/dev/octeon_ipdvar.h
--- a/sys/arch/mips/cavium/dev/octeon_ipdvar.h Tue Jun 23 05:14:39 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_ipdvar.h Tue Jun 23 05:15:33 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_ipdvar.h,v 1.4 2020/06/22 02:26:20 simonb Exp $ */
+/* $NetBSD: octeon_ipdvar.h,v 1.5 2020/06/23 05:15:33 simonb Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -49,7 +49,6 @@
void octipd_init(struct octipd_attach_args *, struct octipd_softc **);
int octipd_enable(struct octipd_softc *);
int octipd_config(struct octipd_softc *);
-int octipd_red(struct octipd_softc *, uint64_t, uint64_t);
void octipd_sub_port_fcs(struct octipd_softc *, int);
void octipd_offload(uint64_t, void *, int *);
diff -r 506bd76cc9e0 -r bdae85f9a3cf sys/arch/mips/cavium/dev/octeon_pko.c
--- a/sys/arch/mips/cavium/dev/octeon_pko.c Tue Jun 23 05:14:39 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_pko.c Tue Jun 23 05:15:33 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_pko.c,v 1.4 2020/06/22 02:26:20 simonb Exp $ */
+/* $NetBSD: octeon_pko.c,v 1.5 2020/06/23 05:15:33 simonb Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,9 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_pko.c,v 1.4 2020/06/22 02:26:20 simonb Exp $");
-
-#include "opt_octeon.h"
+__KERNEL_RCSID(0, "$NetBSD: octeon_pko.c,v 1.5 2020/06/23 05:15:33 simonb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -42,6 +40,8 @@
#include <mips/cavium/dev/octeon_pkoreg.h>
#include <mips/cavium/dev/octeon_pkovar.h>
+static inline void octpko_op_store(uint64_t, uint64_t);
+
#define _PKO_RD8(sc, off) \
bus_space_read_8((sc)->sc_regt, (sc)->sc_regh, (off))
#define _PKO_WR8(sc, off, v) \
@@ -91,25 +91,13 @@
return 0;
}
-#if 0
-void
-octpko_reset(octpko_softc *sc)
-{
- uint64_t reg_flags;
-
- reg_flags = _PKO_RD8(sc, PKO_REG_FLAGS_OFFSET);
- SET(reg_flags, PKO_REG_FLAGS_RESET);
- _PKO_WR8(sc, PKO_REG_FLAGS_OFFSET, reg_flags);
-}
-#endif
-
void
octpko_config(struct octpko_softc *sc)
{
uint64_t reg_cmd_buf = 0;
- SET(reg_cmd_buf, (sc->sc_cmd_buf_pool << 20) & PKO_REG_CMD_BUF_POOL);
- SET(reg_cmd_buf, sc->sc_cmd_buf_size & PKO_REG_CMD_BUF_SIZE);
+ SET(reg_cmd_buf, __SHIFTIN(sc->sc_cmd_buf_pool, PKO_REG_CMD_BUF_POOL));
+ SET(reg_cmd_buf, __SHIFTIN(sc->sc_cmd_buf_size, PKO_REG_CMD_BUF_SIZE));
_PKO_WR8(sc, PKO_REG_CMD_BUF_OFFSET, reg_cmd_buf);
}
@@ -125,10 +113,9 @@
/* XXX assume one queue maped one port */
/* Enable packet output by enabling all queues for this port */
mem_queue_qos = 0;
- SET(mem_queue_qos, ((uint64_t)sc->sc_port << 7) & PKO_MEM_QUEUE_QOS_PID);
- SET(mem_queue_qos, sc->sc_port & PKO_MEM_QUEUE_QOS_QID);
- SET(mem_queue_qos, ((enable ? 0xffULL : 0x00ULL) << 53) &
- PKO_MEM_QUEUE_QOS_QOS_MASK);
+ SET(mem_queue_qos, __SHIFTIN(sc->sc_port, PKO_MEM_QUEUE_QOS_PID));
+ SET(mem_queue_qos, __SHIFTIN(sc->sc_port, PKO_MEM_QUEUE_QOS_QID));
+ SET(mem_queue_qos, enable ? PKO_MEM_QUEUE_QOS_QOS_MASK : 0);
_PKO_WR8(sc, PKO_REG_READ_IDX_OFFSET, reg_read_idx);
_PKO_WR8(sc, PKO_MEM_QUEUE_QOS_OFFSET, mem_queue_qos);
@@ -155,11 +142,11 @@
/* assume one queue maped one port */
mem_queue_ptrs = 0;
SET(mem_queue_ptrs, PKO_MEM_QUEUE_PTRS_TAIL);
- SET(mem_queue_ptrs, ((uint64_t)0 << 13) & PKO_MEM_QUEUE_PTRS_IDX);
- SET(mem_queue_ptrs, ((uint64_t)sc->sc_port << 7) & PKO_MEM_QUEUE_PTRS_PID);
- SET(mem_queue_ptrs, sc->sc_port & PKO_MEM_QUEUE_PTRS_QID);
- SET(mem_queue_ptrs, ((uint64_t)0xff << 53) & PKO_MEM_QUEUE_PTRS_QOS_MASK);
- SET(mem_queue_ptrs, ((uint64_t)buf_ptr << 17) & PKO_MEM_QUEUE_PTRS_BUF_PTR);
+ SET(mem_queue_ptrs, __SHIFTIN(0, PKO_MEM_QUEUE_PTRS_IDX));
+ SET(mem_queue_ptrs, __SHIFTIN(sc->sc_port, PKO_MEM_QUEUE_PTRS_PID));
+ SET(mem_queue_ptrs, __SHIFTIN(sc->sc_port, PKO_MEM_QUEUE_PTRS_QID));
+ SET(mem_queue_ptrs, __SHIFTIN(0xff, PKO_MEM_QUEUE_PTRS_QOS_MASK));
+ SET(mem_queue_ptrs, __SHIFTIN(buf_ptr, PKO_MEM_QUEUE_PTRS_BUF_PTR));
OCTEON_SYNCW;
_PKO_WR8(sc, PKO_MEM_QUEUE_PTRS_OFFSET, mem_queue_ptrs);
diff -r 506bd76cc9e0 -r bdae85f9a3cf sys/arch/mips/cavium/dev/octeon_pkovar.h
--- a/sys/arch/mips/cavium/dev/octeon_pkovar.h Tue Jun 23 05:14:39 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_pkovar.h Tue Jun 23 05:15:33 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_pkovar.h,v 1.5 2020/06/22 02:26:20 simonb Exp $ */
+/* $NetBSD: octeon_pkovar.h,v 1.6 2020/06/23 05:15:33 simonb Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -138,7 +138,7 @@
addr = OCTEON_ADDR_IO_DID(PKO_MAJOR_DID, PKO_SUB_DID) | args;
/* XXX */
OCTEON_SYNCW;
- octeon_write_csr(addr, value);
+ octeon_xkphys_write_8(addr, value);
}
static __inline void
diff -r 506bd76cc9e0 -r bdae85f9a3cf sys/arch/mips/cavium/dev/octeon_pow.c
--- a/sys/arch/mips/cavium/dev/octeon_pow.c Tue Jun 23 05:14:39 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_pow.c Tue Jun 23 05:15:33 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: octeon_pow.c,v 1.9 2020/06/22 02:26:20 simonb Exp $ */
+/* $NetBSD: octeon_pow.c,v 1.10 2020/06/23 05:15:33 simonb Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,194 +27,25 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_pow.c,v 1.9 2020/06/22 02:26:20 simonb Exp $");
-
-#include "opt_octeon.h" /* CNMAC_DEBUG */
+__KERNEL_RCSID(0, "$NetBSD: octeon_pow.c,v 1.10 2020/06/23 05:15:33 simonb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/types.h>
-#include <sys/kernel.h> /* hz */
-#include <sys/malloc.h>
-#include <sys/device.h> /* evcnt */
-#include <sys/syslog.h> /* evcnt */
-
-#include <sys/bus.h>
#include <mips/include/locore.h>
#include <mips/cavium/octeonvar.h>
#include <mips/cavium/include/iobusvar.h>
-#include <mips/cavium/dev/octeon_ciureg.h> /* XXX */
#include <mips/cavium/dev/octeon_powreg.h>
#include <mips/cavium/dev/octeon_powvar.h>
-/* XXX ensure assertion */
-#if !defined(DIAGNOSTIC)
-#define DIAGNOSTIC
-#endif
-
-extern int ipflow_fastforward_disable_flags;
-
-struct octpow_intr_handle {
- void *pi_ih;
- struct octpow_softc *pi_sc;
- int pi_group;
- void (*pi_cb)(void *, uint64_t *);
- void *pi_data;
-};
-
void octpow_bootstrap(struct octeon_config *);
static void octpow_init(struct octpow_softc *);
static void octpow_init_regs(struct octpow_softc *);
-static inline int octpow_tag_sw_poll(void) __unused;
-static inline void octpow_tag_sw_wait(void);
-static inline void octpow_config_int_pc(struct octpow_softc *, int);
-static inline void octpow_config_int(struct octpow_softc *, int, uint64_t,
- uint64_t, uint64_t);
-static inline void octpow_intr_work(struct octpow_softc *,
- struct octpow_intr_handle *, int);
-static int octpow_intr(void *);
-
-/* XXX */
-struct octpow_softc octpow_softc;
-
-/*
- * XXX: parameter tuning is needed: see files.octeon
- */
-#ifndef CNMAC_RING_MAX
-#define CNMAC_RING_MAX 512
-#endif
-#ifndef CNMAC_RING_MIN
-#define CNMAC_RING_MIN 1
-#endif
-
-#ifdef CNMAC_INTR_FEEDBACK_RING
-int max_recv_cnt = CNMAC_RING_MAX;
-int min_recv_cnt = CNMAC_RING_MIN;
-int recv_cnt = CNMAC_RING_MIN;
-int int_rate = 1;
-#endif
-
-/* -------------------------------------------------------------------------- */
-
-/* ---- utility functions */
-
-
Home |
Main Index |
Thread Index |
Old Index