summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2017-11-05 04:57:29 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2017-11-05 04:57:29 +0000
commite136b60b5aafa235d12bedfdadcb53ccdae8d465 (patch)
treecf42702e959e446f24270f0d7f7a923a1c27c42d
parent05a681f22992622250e30c8a03e9ee3f93448b33 (diff)
Remove unmaintained debug code.
-rw-r--r--sys/arch/octeon/dev/cn30xxasx.c106
-rw-r--r--sys/arch/octeon/dev/cn30xxfpa.c185
-rw-r--r--sys/arch/octeon/dev/cn30xxfpavar.h6
-rw-r--r--sys/arch/octeon/dev/cn30xxgmx.c384
-rw-r--r--sys/arch/octeon/dev/cn30xxipd.c148
-rw-r--r--sys/arch/octeon/dev/cn30xxipdvar.h10
-rw-r--r--sys/arch/octeon/dev/cn30xxpip.c120
-rw-r--r--sys/arch/octeon/dev/cn30xxpipvar.h14
-rw-r--r--sys/arch/octeon/dev/cn30xxpko.c55
-rw-r--r--sys/arch/octeon/dev/cn30xxpow.c450
10 files changed, 12 insertions, 1466 deletions
diff --git a/sys/arch/octeon/dev/cn30xxasx.c b/sys/arch/octeon/dev/cn30xxasx.c
index 92bd000fa35..d8b18333d3e 100644
--- a/sys/arch/octeon/dev/cn30xxasx.c
+++ b/sys/arch/octeon/dev/cn30xxasx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cn30xxasx.c,v 1.6 2014/08/11 18:29:56 miod Exp $ */
+/* $OpenBSD: cn30xxasx.c,v 1.7 2017/11/05 04:57:28 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -35,12 +35,6 @@
#include <octeon/dev/cn30xxasxreg.h>
#include <octeon/dev/cn30xxasxvar.h>
-#ifdef OCTEON_ETH_DEBUG
-void cn30xxasx_intr_rml(void *);
-struct cn30xxasx_softc *__cn30xxasx_softc;
-#endif
-
-/* XXX */
void
cn30xxasx_init(struct cn30xxasx_attach_args *aa,
struct cn30xxasx_softc **rsc)
@@ -61,11 +55,6 @@ cn30xxasx_init(struct cn30xxasx_attach_args *aa,
panic("can't map %s space", "asx register");
*rsc = sc;
-
-#ifdef OCTEON_ETH_DEBUG
- if (__cn30xxasx_softc == NULL)
- __cn30xxasx_softc = sc;
-#endif
}
#define _ASX_RD8(sc, off) \
@@ -75,17 +64,10 @@ cn30xxasx_init(struct cn30xxasx_attach_args *aa,
int cn30xxasx_enable_tx(struct cn30xxasx_softc *, int);
int cn30xxasx_enable_rx(struct cn30xxasx_softc *, int);
-#ifdef OCTEON_ETH_DEBUG
-int cn30xxasx_enable_intr(struct cn30xxasx_softc *, int);
-#endif
int
cn30xxasx_enable(struct cn30xxasx_softc *sc, int enable)
{
-
-#ifdef OCTEON_ETH_DEBUG
- cn30xxasx_enable_intr(sc, enable);
-#endif
cn30xxasx_enable_tx(sc, enable);
cn30xxasx_enable_rx(sc, enable);
return 0;
@@ -119,35 +101,6 @@ cn30xxasx_enable_rx(struct cn30xxasx_softc *sc, int enable)
return 0;
}
-#if defined(OCTEON_ETH_DEBUG)
-int cn30xxasx_intr_rml_verbose;
-
-void
-cn30xxasx_intr_rml(void *arg)
-{
- struct cn30xxasx_softc *sc = __cn30xxasx_softc;
- uint64_t reg;
-
- reg = cn30xxasx_int_summary(sc);
- if (cn30xxasx_intr_rml_verbose)
- printf("%s: ASX_INT_REG=0x%016llx\n", __func__, reg);
-}
-
-int
-cn30xxasx_enable_intr(struct cn30xxasx_softc *sc, int enable)
-{
- uint64_t asx_int_xxx = 0;
-
- SET(asx_int_xxx,
- ASX0_INT_REG_TXPSH |
- ASX0_INT_REG_TXPOP |
- ASX0_INT_REG_OVRFLW);
- _ASX_WR8(sc, ASX0_INT_REG_OFFSET, asx_int_xxx);
- _ASX_WR8(sc, ASX0_INT_EN_OFFSET, enable ? asx_int_xxx : 0);
- return 0;
-}
-#endif
-
int
cn30xxasx_clk_set(struct cn30xxasx_softc *sc, int tx_setting, int rx_setting)
{
@@ -155,60 +108,3 @@ cn30xxasx_clk_set(struct cn30xxasx_softc *sc, int tx_setting, int rx_setting)
_ASX_WR8(sc, ASX0_RX_CLK_SET0_OFFSET + 8 * sc->sc_port, rx_setting);
return 0;
}
-
-#ifdef OCTEON_ETH_DEBUG
-uint64_t
-cn30xxasx_int_summary(struct cn30xxasx_softc *sc)
-{
- uint64_t summary;
-
- summary = _ASX_RD8(sc, ASX0_INT_REG_OFFSET);
- _ASX_WR8(sc, ASX0_INT_REG_OFFSET, summary);
- return summary;
-}
-
-#define _ENTRY(x) { #x, x##_OFFSET }
-
-struct cn30xxasx_dump_reg_ {
- const char *name;
- size_t offset;
-};
-
-void cn30xxasx_dump(void);
-
-const struct cn30xxasx_dump_reg_ cn30xxasx_dump_regs_[] = {
- _ENTRY(ASX0_RX_PRT_EN),
- _ENTRY(ASX0_TX_PRT_EN),
- _ENTRY(ASX0_INT_REG),
- _ENTRY(ASX0_INT_EN),
- _ENTRY(ASX0_RX_CLK_SET0),
- _ENTRY(ASX0_RX_CLK_SET1),
- _ENTRY(ASX0_RX_CLK_SET2),
- _ENTRY(ASX0_PRT_LOOP),
- _ENTRY(ASX0_TX_CLK_SET0),
- _ENTRY(ASX0_TX_CLK_SET1),
- _ENTRY(ASX0_TX_CLK_SET2),
- _ENTRY(ASX0_COMP_BYP),
- _ENTRY(ASX0_TX_HI_WATER000),
- _ENTRY(ASX0_TX_HI_WATER001),
- _ENTRY(ASX0_TX_HI_WATER002),
- _ENTRY(ASX0_GMII_RX_CLK_SET),
- _ENTRY(ASX0_GMII_RX_DAT_SET),
- _ENTRY(ASX0_MII_RX_DAT_SET),
-};
-
-void
-cn30xxasx_dump(void)
-{
- struct cn30xxasx_softc *sc = __cn30xxasx_softc;
- const struct cn30xxasx_dump_reg_ *reg;
- uint64_t tmp;
- int i;
-
- for (i = 0; i < (int)nitems(cn30xxasx_dump_regs_); i++) {
- reg = &cn30xxasx_dump_regs_[i];
- tmp = _ASX_RD8(sc, reg->offset);
- printf("\t%-24s: %016llx\n", reg->name, tmp);
- }
-}
-#endif
diff --git a/sys/arch/octeon/dev/cn30xxfpa.c b/sys/arch/octeon/dev/cn30xxfpa.c
index 9fb69d64a33..aaa6c6f6dec 100644
--- a/sys/arch/octeon/dev/cn30xxfpa.c
+++ b/sys/arch/octeon/dev/cn30xxfpa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cn30xxfpa.c,v 1.8 2017/11/04 11:18:17 visa Exp $ */
+/* $OpenBSD: cn30xxfpa.c,v 1.9 2017/11/05 04:57:28 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -26,8 +26,6 @@
* SUCH DAMAGE.
*/
-#undef FPADEBUG
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@@ -39,12 +37,6 @@
#include <octeon/dev/cn30xxfpavar.h>
#include <octeon/dev/cn30xxfpareg.h>
-#ifdef FPADEBUG
-#define DPRINTF(x) printf x
-#else
-#define DPRINTF(x)
-#endif
-
struct cn30xxfpa_softc {
int sc_initialized;
@@ -64,10 +56,6 @@ void cn30xxfpa_init(struct cn30xxfpa_softc *);
uint64_t cn30xxfpa_iobdma(struct cn30xxfpa_softc *, int, int);
#endif
-#ifdef OCTEON_ETH_DEBUG
-void cn30xxfpa_intr_rml(void *);
-#endif
-
static struct cn30xxfpa_softc cn30xxfpa_softc;
/* ---- global functions */
@@ -89,56 +77,6 @@ cn30xxfpa_reset(void)
/* XXX */
}
-#ifdef OCTEON_ETH_DEBUG
-int cn30xxfpa_intr_rml_verbose;
-
-void
-cn30xxfpa_intr_rml(void *arg)
-{
- struct cn30xxfpa_softc *sc;
- uint64_t reg;
-
- sc = &cn30xxfpa_softc;
- KASSERT(sc != NULL);
- reg = cn30xxfpa_int_summary();
- if (cn30xxfpa_intr_rml_verbose)
- printf("%s: FPA_INT_SUM=0x%016llx\n", __func__, reg);
-}
-
-void
-cn30xxfpa_int_enable(struct cn30xxfpa_softc *sc, int enable)
-{
- const uint64_t int_xxx =
- FPA_INT_ENB_Q7_PERR | FPA_INT_ENB_Q7_COFF | FPA_INT_ENB_Q7_UND |
- FPA_INT_ENB_Q6_PERR | FPA_INT_ENB_Q6_COFF | FPA_INT_ENB_Q6_UND |
- FPA_INT_ENB_Q5_PERR | FPA_INT_ENB_Q5_COFF | FPA_INT_ENB_Q5_UND |
- FPA_INT_ENB_Q4_PERR | FPA_INT_ENB_Q4_COFF | FPA_INT_ENB_Q4_UND |
- FPA_INT_ENB_Q3_PERR | FPA_INT_ENB_Q3_COFF | FPA_INT_ENB_Q3_UND |
- FPA_INT_ENB_Q2_PERR | FPA_INT_ENB_Q2_COFF | FPA_INT_ENB_Q2_UND |
- FPA_INT_ENB_Q1_PERR | FPA_INT_ENB_Q1_COFF | FPA_INT_ENB_Q1_UND |
- FPA_INT_ENB_Q0_PERR | FPA_INT_ENB_Q0_COFF | FPA_INT_ENB_Q0_UND |
- FPA_INT_ENB_FED1_DBE | FPA_INT_ENB_FED1_SBE |
- FPA_INT_ENB_FED0_DBE | FPA_INT_ENB_FED0_SBE;
-
- bus_space_write_8(sc->sc_regt, sc->sc_regh, FPA_INT_SUM_OFFSET,
- int_xxx);
- if (enable)
- bus_space_write_8(sc->sc_regt, sc->sc_regh, FPA_INT_ENB_OFFSET,
- int_xxx);
-}
-
-uint64_t
-cn30xxfpa_int_summary(void)
-{
- struct cn30xxfpa_softc *sc = &cn30xxfpa_softc;
- uint64_t summary;
-
- summary = bus_space_read_8(sc->sc_regt, sc->sc_regh, FPA_INT_SUM_OFFSET);
- bus_space_write_8(sc->sc_regt, sc->sc_regh, FPA_INT_SUM_OFFSET, summary);
- return summary;
-}
-#endif
-
int
cn30xxfpa_buf_init(int poolno, size_t size, size_t nelems,
struct cn30xxfpa_buf **rfb)
@@ -242,9 +180,6 @@ cn30xxfpa_init(struct cn30xxfpa_softc *sc)
sc->sc_initialized = 1;
cn30xxfpa_init_regs(sc);
-#ifdef OCTEON_ETH_DEBUG
- cn30xxfpa_int_enable(sc, 1);
-#endif
}
void
@@ -259,122 +194,4 @@ cn30xxfpa_init_regs(struct cn30xxfpa_softc *sc)
bus_space_write_8(sc->sc_regt, sc->sc_regh, FPA_CTL_STATUS_OFFSET,
FPA_CTL_STATUS_ENB);
-
-/* XXX */
-#ifdef OCTEON_ETH_DEBUG
- bus_space_write_8(sc->sc_regt, sc->sc_regh, FPA_INT_ENB_OFFSET,
- FPA_INT_ENB_Q7_PERR | FPA_INT_ENB_Q7_COFF | FPA_INT_ENB_Q7_UND |
- FPA_INT_ENB_Q6_PERR | FPA_INT_ENB_Q6_COFF | FPA_INT_ENB_Q6_UND |
- FPA_INT_ENB_Q5_PERR | FPA_INT_ENB_Q5_COFF | FPA_INT_ENB_Q5_UND |
- FPA_INT_ENB_Q4_PERR | FPA_INT_ENB_Q4_COFF | FPA_INT_ENB_Q4_UND |
- FPA_INT_ENB_Q3_PERR | FPA_INT_ENB_Q3_COFF | FPA_INT_ENB_Q3_UND |
- FPA_INT_ENB_Q2_PERR | FPA_INT_ENB_Q2_COFF | FPA_INT_ENB_Q2_UND |
- FPA_INT_ENB_Q1_PERR | FPA_INT_ENB_Q1_COFF | FPA_INT_ENB_Q1_UND |
- FPA_INT_ENB_Q0_PERR | FPA_INT_ENB_Q0_COFF | FPA_INT_ENB_Q0_UND |
- FPA_INT_ENB_FED1_DBE | FPA_INT_ENB_FED1_SBE |
- FPA_INT_ENB_FED0_DBE | FPA_INT_ENB_FED0_SBE);
-#endif
}
-
-#ifdef OCTEON_ETH_DEBUG
-void cn30xxfpa_dump_regs(void);
-void cn30xxfpa_dump_bufs(void);
-void cn30xxfpa_dump_buf(int);
-
-#define _ENTRY(x) { #x, x##_OFFSET }
-
-struct cn30xxfpa_dump_reg_ {
- const char *name;
- size_t offset;
-};
-
-const struct cn30xxfpa_dump_reg_ cn30xxfpa_dump_regs_[] = {
- _ENTRY(FPA_INT_SUM),
- _ENTRY(FPA_INT_ENB),
- _ENTRY(FPA_CTL_STATUS),
- _ENTRY(FPA_QUE0_AVAILABLE),
- _ENTRY(FPA_QUE1_AVAILABLE),
- _ENTRY(FPA_QUE2_AVAILABLE),
- _ENTRY(FPA_QUE3_AVAILABLE),
- _ENTRY(FPA_QUE4_AVAILABLE),
- _ENTRY(FPA_QUE5_AVAILABLE),
- _ENTRY(FPA_QUE6_AVAILABLE),
- _ENTRY(FPA_QUE7_AVAILABLE),
- _ENTRY(FPA_WART_CTL),
- _ENTRY(FPA_WART_STATUS),
- _ENTRY(FPA_BIST_STATUS),
- _ENTRY(FPA_QUE0_PAGE_INDEX),
- _ENTRY(FPA_QUE1_PAGE_INDEX),
- _ENTRY(FPA_QUE2_PAGE_INDEX),
- _ENTRY(FPA_QUE3_PAGE_INDEX),
- _ENTRY(FPA_QUE4_PAGE_INDEX),
- _ENTRY(FPA_QUE5_PAGE_INDEX),
- _ENTRY(FPA_QUE6_PAGE_INDEX),
- _ENTRY(FPA_QUE7_PAGE_INDEX),
- _ENTRY(FPA_QUE_EXP),
- _ENTRY(FPA_QUE_ACT),
-};
-
-const char *cn30xxfpa_dump_bufs_[8] = {
- [0] = "recv",
- [1] = "wq",
- [2] = "cmdbuf",
- [3] = "gbuf",
-};
-
-void
-cn30xxfpa_dump(void)
-{
- cn30xxfpa_dump_regs();
- cn30xxfpa_dump_bufs();
-}
-
-void
-cn30xxfpa_dump_regs(void)
-{
- struct cn30xxfpa_softc *sc = &cn30xxfpa_softc;
- const struct cn30xxfpa_dump_reg_ *reg;
- uint64_t tmp;
- int i;
-
- for (i = 0; i < nitems(cn30xxfpa_dump_regs_); i++) {
- reg = &cn30xxfpa_dump_regs_[i];
- tmp = bus_space_read_8(sc->sc_regt, sc->sc_regh, reg->offset);
- printf("\t%-24s: %16llx\n", reg->name, tmp);
- }
-}
-
-/*
- * XXX assume pool 7 is unused!
- */
-void
-cn30xxfpa_dump_bufs(void)
-{
- int i;
-
- for (i = 0; i < 8; i++)
- cn30xxfpa_dump_buf(i);
-}
-
-void
-cn30xxfpa_dump_buf(int pool)
-{
- int i;
- uint64_t ptr;
- const char *name;
-
- name = cn30xxfpa_dump_bufs_[pool];
- if (name == NULL)
- return;
- printf("%s pool:\n", name);
- for (i = 0; (ptr = cn30xxfpa_load(pool)) != 0; i++) {
- printf("\t%016llx%s", ptr, ((i % 4) == 3) ? "\n" : "");
- cn30xxfpa_store(ptr, OCTEON_POOL_NO_DUMP, 0);
- }
- if (i % 4 != 3)
- printf("\n");
- printf("total = %d buffers\n", i);
- while ((ptr = cn30xxfpa_load(OCTEON_POOL_NO_DUMP)) != 0)
- cn30xxfpa_store(ptr, pool, 0);
-}
-#endif
diff --git a/sys/arch/octeon/dev/cn30xxfpavar.h b/sys/arch/octeon/dev/cn30xxfpavar.h
index c62b078da19..480f3877ed6 100644
--- a/sys/arch/octeon/dev/cn30xxfpavar.h
+++ b/sys/arch/octeon/dev/cn30xxfpavar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cn30xxfpavar.h,v 1.6 2017/11/04 11:18:17 visa Exp $ */
+/* $OpenBSD: cn30xxfpavar.h,v 1.7 2017/11/05 04:57:28 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
* All rights reserved.
@@ -50,10 +50,6 @@ int cn30xxfpa_buf_init(int, size_t, size_t, struct cn30xxfpa_buf **);
void *cn30xxfpa_buf_get(struct cn30xxfpa_buf *);
uint64_t cn30xxfpa_query(int);
-#ifdef OCTEON_ETH_DEBUG
-void cn30xxfpa_dump(void);
-#endif
-
/*
* operations
*/
diff --git a/sys/arch/octeon/dev/cn30xxgmx.c b/sys/arch/octeon/dev/cn30xxgmx.c
index 04b9bf1b2db..54af0427f82 100644
--- a/sys/arch/octeon/dev/cn30xxgmx.c
+++ b/sys/arch/octeon/dev/cn30xxgmx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cn30xxgmx.c,v 1.37 2017/11/03 16:46:17 visa Exp $ */
+/* $OpenBSD: cn30xxgmx.c,v 1.38 2017/11/05 04:57:28 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -106,9 +106,6 @@ int cn30xxgmx_tx_ovr_bp_enable(struct cn30xxgmx_port_softc *, int);
int cn30xxgmx_rx_pause_enable(struct cn30xxgmx_port_softc *, int);
#ifdef OCTEON_ETH_DEBUG
-void cn30xxgmx_dump(void);
-void cn30xxgmx_debug_reset(void);
-int cn30xxgmx_intr_drop(void *);
int cn30xxgmx_rgmii_speed_newlink_log(struct cn30xxgmx_port_softc *,
uint64_t);
#endif
@@ -152,12 +149,6 @@ struct cn30xxgmx_port_ops *cn30xxgmx_port_ops[] = {
[GMX_SPI42_PORT] = &cn30xxgmx_port_ops_spi42
};
-#ifdef OCTEON_ETH_DEBUG
-void *cn30xxgmx_intr_drop_ih;
-
-struct cn30xxgmx_port_softc *__cn30xxgmx_port_softc[GMX_PORT_NUNITS];
-#endif
-
struct cfattach cn30xxgmx_ca = {sizeof(struct cn30xxgmx_softc),
cn30xxgmx_match, cn30xxgmx_attach, NULL, NULL};
@@ -276,18 +267,7 @@ cn30xxgmx_attach(struct device *parent, struct device *self, void *aux)
gmx_aa.ga_smi = smi;
config_found(self, &gmx_aa, cn30xxgmx_print);
-
-#ifdef OCTEON_ETH_DEBUG
- __cn30xxgmx_port_softc[port_sc->sc_port_no] = port_sc;
-#endif
}
-
-#ifdef OCTEON_ETH_DEBUG
- if (cn30xxgmx_intr_drop_ih == NULL)
- cn30xxgmx_intr_drop_ih = octeon_intr_establish(
- ffs64(CIU_INTX_SUM0_GMX_DRP) - 1, IPL_NET,
- cn30xxgmx_intr_drop, NULL, "cn30xxgmx");
-#endif
}
int
@@ -1306,365 +1286,3 @@ cn30xxgmx_stats(struct cn30xxgmx_port_softc *sc)
tmp = _GMX_PORT_RD8(sc, GMX0_TX0_STAT9);
ifp->if_oerrors += (uint32_t)(tmp >> 32);
}
-
-/* ---- interrupt */
-
-#ifdef OCTEON_ETH_DEBUG
-void cn30xxgmx_intr_rml_gmx0(void);
-
-int cn30xxgmx_intr_rml_verbose;
-
-void
-cn30xxgmx_intr_rml_gmx0(void)
-{
- struct cn30xxgmx_port_softc *sc;
- int i;
- uint64_t reg;
-
- sc = __cn30xxgmx_port_softc[0];
- if (sc == NULL)
- return;
-
- /* GMX0_RXn_INT_REG or GMX0_TXn_INT_REG */
- reg = cn30xxgmx_get_tx_int_reg(sc);
- if (cn30xxgmx_intr_rml_verbose && reg != 0)
- printf("%s: GMX_TX_INT_REG=0x%016llx\n", __func__, reg);
-
- for (i = 0; i < GMX_PORT_NUNITS; i++) {
- sc = __cn30xxgmx_port_softc[i];
- if (sc == NULL)
- continue;
- reg = cn30xxgmx_get_rx_int_reg(sc);
- if (cn30xxgmx_intr_rml_verbose)
- printf("%s: GMX_RX_INT_REG=0x%016llx\n", __func__, reg);
- }
-}
-
-int
-cn30xxgmx_intr_drop(void *arg)
-{
- octeon_xkphys_write_8(CIU_INT0_SUM0, CIU_INTX_SUM0_GMX_DRP);
- return (1);
-}
-
-uint64_t
-cn30xxgmx_get_rx_int_reg(struct cn30xxgmx_port_softc *sc)
-{
- uint64_t reg;
- uint64_t rx_int_reg = 0;
-
- reg = _GMX_PORT_RD8(sc, GMX0_RX0_INT_REG);
- /* clear */
- SET(rx_int_reg, 0 |
- RXN_INT_REG_PHY_DUPX |
- RXN_INT_REG_PHY_SPD |
- RXN_INT_REG_PHY_LINK |
- RXN_INT_REG_IFGERR |
- RXN_INT_REG_COLDET |
- RXN_INT_REG_FALERR |
- RXN_INT_REG_RSVERR |
- RXN_INT_REG_PCTERR |
- RXN_INT_REG_OVRERR |
- RXN_INT_REG_NIBERR |
- RXN_INT_REG_SKPERR |
- RXN_INT_REG_RCVERR |
- RXN_INT_REG_LENERR |
- RXN_INT_REG_ALNERR |
- RXN_INT_REG_FCSERR |
- RXN_INT_REG_JABBER |
- RXN_INT_REG_MAXERR |
- RXN_INT_REG_CAREXT |
- RXN_INT_REG_MINERR);
- _GMX_PORT_WR8(sc, GMX0_RX0_INT_REG, rx_int_reg);
-
- return reg;
-}
-
-uint64_t
-cn30xxgmx_get_tx_int_reg(struct cn30xxgmx_port_softc *sc)
-{
- uint64_t reg;
- uint64_t tx_int_reg = 0;
-
- reg = _GMX_PORT_RD8(sc, GMX0_TX_INT_REG);
- /* clear */
- SET(tx_int_reg, 0 |
- TX_INT_REG_LATE_COL |
- TX_INT_REG_XSDEF |
- TX_INT_REG_XSCOL |
- TX_INT_REG_UNDFLW |
- TX_INT_REG_PKO_NXA);
- _GMX_PORT_WR8(sc, GMX0_TX_INT_REG, tx_int_reg);
-
- return reg;
-}
-#endif /* OCTEON_ETH_DEBUG */
-
-/* ---- debug */
-
-#ifdef OCTEON_ETH_DEBUG
-#define _ENTRY(x) { #x, x }
-
-struct cn30xxgmx_dump_reg_ {
- const char *name;
- size_t offset;
-};
-
-const struct cn30xxgmx_dump_reg_ cn30xxgmx_dump_regs_[] = {
- _ENTRY(GMX0_SMAC0),
- _ENTRY(GMX0_BIST0),
- _ENTRY(GMX0_RX_PRTS),
- _ENTRY(GMX0_RX_BP_DROP0),
- _ENTRY(GMX0_RX_BP_DROP1),
- _ENTRY(GMX0_RX_BP_DROP2),
- _ENTRY(GMX0_RX_BP_ON0),
- _ENTRY(GMX0_RX_BP_ON1),
- _ENTRY(GMX0_RX_BP_ON2),
- _ENTRY(GMX0_RX_BP_OFF0),
- _ENTRY(GMX0_RX_BP_OFF1),
- _ENTRY(GMX0_RX_BP_OFF2),
- _ENTRY(GMX0_TX_PRTS),
- _ENTRY(GMX0_TX_IFG),
- _ENTRY(GMX0_TX_JAM),
- _ENTRY(GMX0_TX_COL_ATTEMPT),
- _ENTRY(GMX0_TX_PAUSE_PKT_DMAC),
- _ENTRY(GMX0_TX_PAUSE_PKT_TYPE),
- _ENTRY(GMX0_TX_OVR_BP),
- _ENTRY(GMX0_TX_BP),
- _ENTRY(GMX0_TX_CORRUPT),
- _ENTRY(GMX0_RX_PRT_INFO),
- _ENTRY(GMX0_TX_LFSR),
- _ENTRY(GMX0_TX_INT_REG),
- _ENTRY(GMX0_TX_INT_EN),
- _ENTRY(GMX0_NXA_ADR),
- _ENTRY(GMX0_BAD_REG),
- _ENTRY(GMX0_STAT_BP),
- _ENTRY(GMX0_TX_CLK_MSK0),
- _ENTRY(GMX0_TX_CLK_MSK1),
- _ENTRY(GMX0_RX_TX_STATUS),
- _ENTRY(GMX0_INF_MODE),
-};
-
-const struct cn30xxgmx_dump_reg_ cn30xxgmx_dump_port_regs_[] = {
- _ENTRY(GMX0_RX0_INT_REG),
- _ENTRY(GMX0_RX0_INT_EN),
- _ENTRY(GMX0_PRT0_CFG),
- _ENTRY(GMX0_RX0_FRM_CTL),
- _ENTRY(GMX0_RX0_FRM_CHK),
- _ENTRY(GMX0_RX0_FRM_MIN),
- _ENTRY(GMX0_RX0_FRM_MAX),
- _ENTRY(GMX0_RX0_JABBER),
- _ENTRY(GMX0_RX0_DECISION),
- _ENTRY(GMX0_RX0_UDD_SKP),
- _ENTRY(GMX0_RX0_STATS_CTL),
- _ENTRY(GMX0_RX0_IFG),
- _ENTRY(GMX0_RX0_RX_INBND),
- _ENTRY(GMX0_RX0_ADR_CTL),
- _ENTRY(GMX0_RX0_ADR_CAM_EN),
- _ENTRY(GMX0_RX0_ADR_CAM0),
- _ENTRY(GMX0_RX0_ADR_CAM1),
- _ENTRY(GMX0_RX0_ADR_CAM2),
- _ENTRY(GMX0_RX0_ADR_CAM3),
- _ENTRY(GMX0_RX0_ADR_CAM4),
- _ENTRY(GMX0_RX0_ADR_CAM5),
- _ENTRY(GMX0_TX0_CLK),
- _ENTRY(GMX0_TX0_THRESH),
- _ENTRY(GMX0_TX0_APPEND),
- _ENTRY(GMX0_TX0_SLOT),
- _ENTRY(GMX0_TX0_BURST),
- _ENTRY(GMX0_TX0_PAUSE_PKT_TIME),
- _ENTRY(GMX0_TX0_MIN_PKT),
- _ENTRY(GMX0_TX0_PAUSE_PKT_INTERVAL),
- _ENTRY(GMX0_TX0_SOFT_PAUSE),
- _ENTRY(GMX0_TX0_PAUSE_TOGO),
- _ENTRY(GMX0_TX0_PAUSE_ZERO),
- _ENTRY(GMX0_TX0_STATS_CTL),
- _ENTRY(GMX0_TX0_CTL),
-};
-
-const struct cn30xxgmx_dump_reg_ cn30xxgmx_dump_port_stats_[] = {
- _ENTRY(GMX0_RX0_STATS_PKTS),
- _ENTRY(GMX0_RX0_STATS_OCTS),
- _ENTRY(GMX0_RX0_STATS_PKTS_CTL),
- _ENTRY(GMX0_RX0_STATS_OCTS_CTL),
- _ENTRY(GMX0_RX0_STATS_PKTS_DMAC),
- _ENTRY(GMX0_RX0_STATS_OCTS_DMAC),
- _ENTRY(GMX0_RX0_STATS_PKTS_DRP),
- _ENTRY(GMX0_RX0_STATS_OCTS_DRP),
- _ENTRY(GMX0_RX0_STATS_PKTS_BAD),
- _ENTRY(GMX0_TX0_STAT0),
- _ENTRY(GMX0_TX0_STAT1),
- _ENTRY(GMX0_TX0_STAT2),
- _ENTRY(GMX0_TX0_STAT3),
- _ENTRY(GMX0_TX0_STAT4),
- _ENTRY(GMX0_TX0_STAT5),
- _ENTRY(GMX0_TX0_STAT6),
- _ENTRY(GMX0_TX0_STAT7),
- _ENTRY(GMX0_TX0_STAT8),
- _ENTRY(GMX0_TX0_STAT9),
-};
-
-void cn30xxgmx_dump_common(void);
-void cn30xxgmx_dump_port0(void);
-void cn30xxgmx_dump_port1(void);
-void cn30xxgmx_dump_port2(void);
-void cn30xxgmx_dump_port0_regs(void);
-void cn30xxgmx_dump_port1_regs(void);
-void cn30xxgmx_dump_port2_regs(void);
-void cn30xxgmx_dump_port0_stats(void);
-void cn30xxgmx_dump_port1_stats(void);
-void cn30xxgmx_dump_port2_stats(void);
-void cn30xxgmx_dump_port_regs(int);
-void cn30xxgmx_dump_port_stats(int);
-void cn30xxgmx_dump_common_x(int, const struct cn30xxgmx_dump_reg_ *, size_t);
-void cn30xxgmx_dump_port_x(int, const struct cn30xxgmx_dump_reg_ *, size_t);
-void cn30xxgmx_dump_x(int, const struct cn30xxgmx_dump_reg_ *, size_t, size_t, int);
-void cn30xxgmx_dump_x_index(char *, size_t, int);
-
-void
-cn30xxgmx_dump(void)
-{
- cn30xxgmx_dump_common();
- cn30xxgmx_dump_port0();
- cn30xxgmx_dump_port1();
- cn30xxgmx_dump_port2();
-}
-
-void
-cn30xxgmx_dump_common(void)
-{
- cn30xxgmx_dump_common_x(0, cn30xxgmx_dump_regs_,
- nitems(cn30xxgmx_dump_regs_));
-}
-
-void
-cn30xxgmx_dump_port0(void)
-{
- cn30xxgmx_dump_port_regs(0);
- cn30xxgmx_dump_port_stats(0);
-}
-
-void
-cn30xxgmx_dump_port1(void)
-{
- cn30xxgmx_dump_port_regs(1);
- cn30xxgmx_dump_port_stats(1);
-}
-
-void
-cn30xxgmx_dump_port2(void)
-{
- cn30xxgmx_dump_port_regs(2);
- cn30xxgmx_dump_port_stats(2);
-}
-
-void
-cn30xxgmx_dump_port_regs(int portno)
-{
- cn30xxgmx_dump_port_x(portno, cn30xxgmx_dump_port_regs_,
- nitems(cn30xxgmx_dump_port_regs_));
-}
-
-void
-cn30xxgmx_dump_port_stats(int portno)
-{
- struct cn30xxgmx_port_softc *sc = __cn30xxgmx_port_softc[0];
- uint64_t rx_stats_ctl;
- uint64_t tx_stats_ctl;
-
- rx_stats_ctl = _GMX_RD8(sc, GMX0_BASE_PORT_SIZE * portno + GMX0_RX0_STATS_CTL);
- _GMX_WR8(sc, GMX0_BASE_PORT_SIZE * portno + GMX0_RX0_STATS_CTL,
- rx_stats_ctl & ~RXN_STATS_CTL_RD_CLR);
- tx_stats_ctl = _GMX_RD8(sc, GMX0_BASE_PORT_SIZE * portno + GMX0_TX0_STATS_CTL);
- _GMX_WR8(sc, GMX0_BASE_PORT_SIZE * portno + GMX0_TX0_STATS_CTL,
- tx_stats_ctl & ~TXN_STATS_CTL_RD_CLR);
- cn30xxgmx_dump_port_x(portno, cn30xxgmx_dump_port_stats_,
- nitems(cn30xxgmx_dump_port_stats_));
- _GMX_WR8(sc, GMX0_BASE_PORT_SIZE * portno + GMX0_RX0_STATS_CTL, rx_stats_ctl);
- _GMX_WR8(sc, GMX0_BASE_PORT_SIZE * portno + GMX0_TX0_STATS_CTL, tx_stats_ctl);
-}
-
-void
-cn30xxgmx_dump_common_x(int portno, const struct cn30xxgmx_dump_reg_ *regs, size_t size)
-{
- cn30xxgmx_dump_x(portno, regs, size, 0, 0);
-}
-
-void
-cn30xxgmx_dump_port_x(int portno, const struct cn30xxgmx_dump_reg_ *regs, size_t size)
-{
- cn30xxgmx_dump_x(portno, regs, size, GMX0_BASE_PORT_SIZE * portno, 1);
-}
-
-void
-cn30xxgmx_dump_x(int portno, const struct cn30xxgmx_dump_reg_ *regs, size_t size, size_t base, int index)
-{
- struct cn30xxgmx_port_softc *sc = __cn30xxgmx_port_softc[0];
- const struct cn30xxgmx_dump_reg_ *reg;
- uint64_t tmp;
- char name[64];
- int i;
-
- for (i = 0; i < (int)size; i++) {
- reg = &regs[i];
- tmp = _GMX_RD8(sc, base + reg->offset);
-
- snprintf(name, sizeof(name), "%s", reg->name);
- if (index > 0)
- cn30xxgmx_dump_x_index(name, sizeof(name), portno);
-
- printf("\t%-24s: %016llx\n", name, tmp);
- }
-}
-
-/* not in libkern */
-static char *strstr(const char *, const char *);
-static char *
-strstr(const char *s, const char *find)
-{
- char c, sc;
- size_t len;
-
- if ((c = *find++) != 0) {
- len = strlen(find);
- do {
- do {
- if ((sc = *s++) == 0)
- return (NULL);
- } while (sc != c);
- } while (strncmp(s, find, len) != 0);
- s--;
- }
- return (char *)s;
-}
-
-void
-cn30xxgmx_dump_x_index(char *buf, size_t len, int index)
-{
- static const char *patterns[] = { "_TX0_", "_RX0_", "_PRT0_" };
- int i;
-
- for (i = 0; i < (int)nitems(patterns); i++) {
- char *p;
-
- p = strstr(buf, patterns[i]);
- if (p == NULL)
- continue;
- p = strchr(p, '0');
- KASSERT(p != NULL);
- *p = '0' + index;
- return;
- }
-}
-
-void
-cn30xxgmx_debug_reset(void)
-{
- int i;
-
- for (i = 0; i < 3; i++)
- cn30xxgmx_link_enable(__cn30xxgmx_port_softc[i], 0);
- for (i = 0; i < 3; i++)
- cn30xxgmx_link_enable(__cn30xxgmx_port_softc[i], 1);
-}
-#endif
diff --git a/sys/arch/octeon/dev/cn30xxipd.c b/sys/arch/octeon/dev/cn30xxipd.c
index 882cdaef66f..83206c0dbca 100644
--- a/sys/arch/octeon/dev/cn30xxipd.c
+++ b/sys/arch/octeon/dev/cn30xxipd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cn30xxipd.c,v 1.10 2017/11/04 11:18:17 visa Exp $ */
+/* $OpenBSD: cn30xxipd.c,v 1.11 2017/11/05 04:57:28 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -40,18 +40,6 @@
#include <octeon/dev/cn30xxipdreg.h>
#include <octeon/dev/cn30xxipdvar.h>
-#ifdef OCTEON_ETH_DEBUG
-void cn30xxipd_intr_rml(void *);
-int cn30xxipd_intr_drop(void *);
-
-void cn30xxipd_dump(void);
-
-void *cn30xxipd_intr_drop_ih;
-
-struct cn30xxipd_softc *__cn30xxipd_softc[GMX_PORT_NUNITS];
-#endif
-
-/* XXX */
void
cn30xxipd_init(struct cn30xxipd_attach_args *aa,
struct cn30xxipd_softc **rsc)
@@ -74,15 +62,6 @@ cn30xxipd_init(struct cn30xxipd_attach_args *aa,
panic("can't map %s space", "ipd register");
*rsc = sc;
-
-#ifdef OCTEON_ETH_DEBUG
- cn30xxipd_int_enable(sc, 1);
- if (cn30xxipd_intr_drop_ih == NULL)
- cn30xxipd_intr_drop_ih = octeon_intr_establish(
- ffs64(CIU_INTX_SUM0_IPD_DRP) - 1, IPL_NET,
- cn30xxipd_intr_drop, NULL, "cn30xxipd");
- __cn30xxipd_softc[sc->sc_port] = sc;
-#endif /* OCTEON_ETH_DEBUG */
}
#define _IPD_RD8(sc, off) \
@@ -196,128 +175,3 @@ cn30xxipd_sub_port_fcs(struct cn30xxipd_softc *sc, int enable)
SET(sub_port_fcs, 1 << sc->sc_port);
_IPD_WR8(sc, IPD_SUB_PORT_FCS_OFFSET, sub_port_fcs);
}
-
-#ifdef OCTEON_ETH_DEBUG
-int cn30xxipd_intr_rml_verbose;
-
-void
-cn30xxipd_intr_rml(void *arg)
-{
- int i;
-
- for (i = 0; i < 3/* XXX */; i++) {
- struct cn30xxipd_softc *sc;
- uint64_t reg;
-
- sc = __cn30xxipd_softc[i];
- KASSERT(sc != NULL);
- reg = cn30xxipd_int_summary(sc);
- if (cn30xxipd_intr_rml_verbose)
- printf("%s: IPD_INT_SUM=0x%016llx\n", __func__, reg);
- }
-}
-
-void
-cn30xxipd_int_enable(struct cn30xxipd_softc *sc, int enable)
-{
- uint64_t ipd_int_xxx = 0;
-
- SET(ipd_int_xxx,
- IPD_INT_SUM_BP_SUB |
- IPD_INT_SUM_PRC_PAR3 |
- IPD_INT_SUM_PRC_PAR2 |
- IPD_INT_SUM_PRC_PAR1 |
- IPD_INT_SUM_PRC_PAR0);
- _IPD_WR8(sc, IPD_INT_SUM_OFFSET, ipd_int_xxx);
- _IPD_WR8(sc, IPD_INT_ENB_OFFSET, enable ? ipd_int_xxx : 0);
-}
-
-uint64_t
-cn30xxipd_int_summary(struct cn30xxipd_softc *sc)
-{
- uint64_t summary;
-
- summary = _IPD_RD8(sc, IPD_INT_SUM_OFFSET);
- _IPD_WR8(sc, IPD_INT_SUM_OFFSET, summary);
- return summary;
-}
-
-int
-cn30xxipd_intr_drop(void *arg)
-{
- octeon_xkphys_write_8(CIU_INT0_SUM0, CIU_INTX_SUM0_IPD_DRP);
- return (1);
-}
-
-#define _ENTRY(x) { #x, x##_OFFSET }
-
-struct cn30xxipd_dump_reg {
- const char *name;
- size_t offset;
-};
-
-const struct cn30xxipd_dump_reg cn30xxipd_dump_regs[] = {
- _ENTRY(IPD_1ST_MBUFF_SKIP),
- _ENTRY(IPD_NOT_1ST_MBUFF_SKIP),
- _ENTRY(IPD_PACKET_MBUFF_SIZE),
- _ENTRY(IPD_CTL_STATUS),
- _ENTRY(IPD_WQE_FPA_QUEUE),
- _ENTRY(IPD_PORT0_BP_PAGE_CNT),
- _ENTRY(IPD_PORT1_BP_PAGE_CNT),
- _ENTRY(IPD_PORT2_BP_PAGE_CNT),
- _ENTRY(IPD_PORT32_BP_PAGE_CNT),
- _ENTRY(IPD_SUB_PORT_BP_PAGE_CNT),
- _ENTRY(IPD_1ST_NEXT_PTR_BACK),
- _ENTRY(IPD_2ND_NEXT_PTR_BACK),
- _ENTRY(IPD_INT_ENB),
- _ENTRY(IPD_INT_SUM),
- _ENTRY(IPD_SUB_PORT_FCS),
- _ENTRY(IPD_QOS0_RED_MARKS),
- _ENTRY(IPD_QOS1_RED_MARKS),
- _ENTRY(IPD_QOS2_RED_MARKS),
- _ENTRY(IPD_QOS3_RED_MARKS),
- _ENTRY(IPD_QOS4_RED_MARKS),
- _ENTRY(IPD_QOS5_RED_MARKS),
- _ENTRY(IPD_QOS6_RED_MARKS),
- _ENTRY(IPD_QOS7_RED_MARKS),
- _ENTRY(IPD_PORT_BP_COUNTERS_PAIR0),
- _ENTRY(IPD_PORT_BP_COUNTERS_PAIR1),
- _ENTRY(IPD_PORT_BP_COUNTERS_PAIR2),
- _ENTRY(IPD_PORT_BP_COUNTERS_PAIR32),
- _ENTRY(IPD_RED_PORT_ENABLE),
- _ENTRY(IPD_RED_QUE0_PARAM),
- _ENTRY(IPD_RED_QUE1_PARAM),
- _ENTRY(IPD_RED_QUE2_PARAM),
- _ENTRY(IPD_RED_QUE3_PARAM),
- _ENTRY(IPD_RED_QUE4_PARAM),
- _ENTRY(IPD_RED_QUE5_PARAM),
- _ENTRY(IPD_RED_QUE6_PARAM),
- _ENTRY(IPD_RED_QUE7_PARAM),
- _ENTRY(IPD_PTR_COUNT),
- _ENTRY(IPD_BP_PRT_RED_END),
- _ENTRY(IPD_QUE0_FREE_PAGE_CNT),
- _ENTRY(IPD_CLK_COUNT),
- _ENTRY(IPD_PWP_PTR_FIFO_CTL),
- _ENTRY(IPD_PRC_HOLD_PTR_FIFO_CTL),
- _ENTRY(IPD_PRC_PORT_PTR_FIFO_CTL),
- _ENTRY(IPD_PKT_PTR_VALID),
- _ENTRY(IPD_WQE_PTR_VALID),
- _ENTRY(IPD_BIST_STATUS),
-};
-
-void
-cn30xxipd_dump(void)
-{
- struct cn30xxipd_softc *sc;
- const struct cn30xxipd_dump_reg *reg;
- uint64_t tmp;
- int i;
-
- sc = __cn30xxipd_softc[0];
- for (i = 0; i < (int)nitems(cn30xxipd_dump_regs); i++) {
- reg = &cn30xxipd_dump_regs[i];
- tmp = _IPD_RD8(sc, reg->offset);
- printf("%-32s: %16llx\n", reg->name, tmp);
- }
-}
-#endif /* OCTEON_ETH_DEBUG */
diff --git a/sys/arch/octeon/dev/cn30xxipdvar.h b/sys/arch/octeon/dev/cn30xxipdvar.h
index 2abd262524d..c1cede00ee7 100644
--- a/sys/arch/octeon/dev/cn30xxipdvar.h
+++ b/sys/arch/octeon/dev/cn30xxipdvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cn30xxipdvar.h,v 1.4 2015/10/24 05:35:42 visa Exp $ */
+/* $OpenBSD: cn30xxipdvar.h,v 1.5 2017/11/05 04:57:28 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -53,10 +53,4 @@ int cn30xxipd_config(struct cn30xxipd_softc *);
void cn30xxipd_sub_port_fcs(struct cn30xxipd_softc *, int);
void cn30xxipd_offload(uint64_t, uint16_t *);
-#ifdef OCTEON_ETH_DEBUG
-void cn30xxipd_int_enable(struct cn30xxipd_softc *, int);
-uint64_t cn30xxipd_int_summary(struct cn30xxipd_softc *);
-void cn30xxipd_int_enable(struct cn30xxipd_softc *, int);
-#endif /* OCTEON_ETH_DEBUG */
-
-#endif
+#endif /* !_CN30XXIPDVAR_H_ */
diff --git a/sys/arch/octeon/dev/cn30xxpip.c b/sys/arch/octeon/dev/cn30xxpip.c
index 1d13d238aeb..a2264e421be 100644
--- a/sys/arch/octeon/dev/cn30xxpip.c
+++ b/sys/arch/octeon/dev/cn30xxpip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cn30xxpip.c,v 1.6 2016/06/09 15:29:22 visa Exp $ */
+/* $OpenBSD: cn30xxpip.c,v 1.7 2017/11/05 04:57:28 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -41,15 +41,6 @@
#include <octeon/dev/cn30xxpipreg.h>
#include <octeon/dev/cn30xxpipvar.h>
-#ifdef OCTEON_ETH_DEBUG
-struct cn30xxpip_softc *__cn30xxpip_softc;
-
-void cn30xxpip_intr_rml(void *);
-
-void cn30xxpip_dump(void);
-void cn30xxpip_int_enable(struct cn30xxpip_softc *, int);
-#endif
-
/*
* register definitions
*/
@@ -132,12 +123,6 @@ cn30xxpip_init(struct cn30xxpip_attach_args *aa,
panic("can't map %s space", "pip register");
*rsc = sc;
-
-#ifdef OCTEON_ETH_DEBUG
- cn30xxpip_int_enable(sc, 1);
- __cn30xxpip_softc = sc;
- printf("PIP Code initialized.\n");
-#endif
}
#define _PIP_RD8(sc, off) \
@@ -239,106 +224,3 @@ cn30xxpip_stats(struct cn30xxpip_softc *sc, struct ifnet *ifp, int gmx_port)
_PIP_WR8(sc, PIP_STAT_CTL_OFFSET, pip_stat_ctl);
}
-
-
-#ifdef OCTEON_ETH_DEBUG
-int cn30xxpip_intr_rml_verbose;
-
-void
-cn30xxpip_intr_rml(void *arg)
-{
- struct cn30xxpip_softc *sc;
- uint64_t reg;
-
- sc = __cn30xxpip_softc;
- KASSERT(sc != NULL);
- reg = cn30xxpip_int_summary(sc);
- if (cn30xxpip_intr_rml_verbose)
- printf("%s: PIP_INT_REG=0x%016llx\n", __func__, reg);
-}
-
-void cn30xxpip_dump_regs(void);
-void cn30xxpip_dump_stats(void);
-
-void
-cn30xxpip_dump(void)
-{
- cn30xxpip_dump_regs();
- cn30xxpip_dump_stats();
-}
-
-void
-cn30xxpip_dump_regs(void)
-{
- struct cn30xxpip_softc *sc = __cn30xxpip_softc;
- const struct cn30xxpip_dump_reg_ *reg;
- uint64_t tmp;
- int i;
-
- for (i = 0; i < (int)nitems(cn30xxpip_dump_regs_); i++) {
- reg = &cn30xxpip_dump_regs_[i];
- tmp = _PIP_RD8(sc, reg->offset);
- printf("\t%-24s: %16llx\n", reg->name, tmp);
- }
-}
-
-void
-cn30xxpip_dump_stats(void)
-{
- struct cn30xxpip_softc *sc = __cn30xxpip_softc;
- const struct cn30xxpip_dump_reg_ *reg;
- uint64_t tmp;
- int i;
- uint64_t pip_stat_ctl;
-
- pip_stat_ctl = _PIP_RD8(sc, PIP_STAT_CTL_OFFSET);
- _PIP_WR8(sc, PIP_STAT_CTL_OFFSET, pip_stat_ctl & ~PIP_STAT_CTL_RDCLR);
- for (i = 0; i < (int)nitems(cn30xxpip_dump_stats_); i++) {
- reg = &cn30xxpip_dump_stats_[i];
- tmp = _PIP_RD8(sc, reg->offset);
- printf("\t%-24s: %16llx\n", reg->name, tmp);
- }
- printf("\t%-24s:\n", "PIP_QOS_DIFF[0-63]");
- for (i = 0; i < 64; i++) {
- tmp = _PIP_RD8(sc, PIP_QOS_DIFF0_OFFSET + sizeof(uint64_t) * i);
- printf("%s\t%16llx%s",
- ((i % 4) == 0) ? "\t" : "",
- tmp,
- ((i % 4) == 3) ? "\n" : "");
- }
- printf("\t%-24s:\n", "PIP_TAG_INC[0-63]");
- for (i = 0; i < 64; i++) {
- tmp = _PIP_RD8(sc, PIP_TAG_INC0_OFFSET + sizeof(uint64_t) * i);
- printf("%s\t%16llx%s",
- ((i % 4) == 0) ? "\t" : "",
- tmp,
- ((i % 4) == 3) ? "\n" : "");
- }
- _PIP_WR8(sc, PIP_STAT_CTL_OFFSET, pip_stat_ctl);
-}
-
-void
-cn30xxpip_int_enable(struct cn30xxpip_softc *sc, int enable)
-{
- uint64_t pip_int_xxx = 0;
-
- SET(pip_int_xxx,
- PIP_INT_EN_BEPERR |
- PIP_INT_EN_FEPERR |
- PIP_INT_EN_SKPRUNT |
- PIP_INT_EN_BADTAG |
- PIP_INT_EN_PRTNXA |
- PIP_INT_EN_PKTDRP);
- _PIP_WR8(sc, PIP_INT_REG_OFFSET, pip_int_xxx);
- _PIP_WR8(sc, PIP_INT_EN_OFFSET, enable ? pip_int_xxx : 0);
-}
-uint64_t
-cn30xxpip_int_summary(struct cn30xxpip_softc *sc)
-{
- uint64_t summary;
-
- summary = _PIP_RD8(sc, PIP_INT_REG_OFFSET);
- _PIP_WR8(sc, PIP_INT_REG_OFFSET, summary);
- return summary;
-}
-#endif /* OCTEON_ETH_DEBUG */
diff --git a/sys/arch/octeon/dev/cn30xxpipvar.h b/sys/arch/octeon/dev/cn30xxpipvar.h
index 24af5a09463..e15f6ad530f 100644
--- a/sys/arch/octeon/dev/cn30xxpipvar.h
+++ b/sys/arch/octeon/dev/cn30xxpipvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cn30xxpipvar.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */
+/* $OpenBSD: cn30xxpipvar.h,v 1.3 2017/11/05 04:57:28 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -56,15 +56,5 @@ void cn30xxpip_prt_cfg_enable(struct cn30xxpip_softc *,
uint64_t, int);
void cn30xxpip_stats(struct cn30xxpip_softc *,
struct ifnet *, int);
-#ifdef OCTEON_ETH_DEBUG
-void cn30xxpip_int_enable(struct cn30xxpip_softc *, int);
-void cn30xxpip_dump(void);
-void cn30xxpip_dump_regs(void);
-void cn30xxpip_dump_stats(void);
-void cn30xxpip_int_enable(struct cn30xxpip_softc *, int);
-uint64_t cn30xxpip_int_summary(struct cn30xxpip_softc *);
-#endif /* OCTEON_ETH_DEBUG */
-
-
-#endif
+#endif /* !_CN30XXPIPVAR_H_ */
diff --git a/sys/arch/octeon/dev/cn30xxpko.c b/sys/arch/octeon/dev/cn30xxpko.c
index 3ab4c5b00a9..569eb056466 100644
--- a/sys/arch/octeon/dev/cn30xxpko.c
+++ b/sys/arch/octeon/dev/cn30xxpko.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cn30xxpko.c,v 1.5 2016/05/24 14:06:39 visa Exp $ */
+/* $OpenBSD: cn30xxpko.c,v 1.6 2017/11/05 04:57:28 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -39,19 +39,11 @@
static inline void cn30xxpko_op_store(uint64_t, uint64_t);
-#ifdef OCTEON_ETH_DEBUG
-void cn30xxpko_intr_rml(void *);
-#endif
-
#define _PKO_RD8(sc, off) \
bus_space_read_8((sc)->sc_regt, (sc)->sc_regh, (off))
#define _PKO_WR8(sc, off, v) \
bus_space_write_8((sc)->sc_regt, (sc)->sc_regh, (off), (v))
-#ifdef OCTEON_ETH_DEBUG
-struct cn30xxpko_softc *__cn30xxpko_softc;
-#endif
-
/* ----- gloal functions */
/* XXX */
@@ -78,10 +70,6 @@ cn30xxpko_init(struct cn30xxpko_attach_args *aa,
panic("can't map %s space", "pko register");
*rsc = sc;
-
-#ifdef OCTEON_ETH_DEBUG
- __cn30xxpko_softc = sc;
-#endif
}
int
@@ -121,10 +109,6 @@ cn30xxpko_config(struct cn30xxpko_softc *sc)
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);
_PKO_WR8(sc, PKO_REG_CMD_BUF_OFFSET, reg_cmd_buf);
-
-#ifdef OCTEON_ETH_DEBUG
- cn30xxpko_int_enable(sc, 1);
-#endif
}
int
@@ -188,40 +172,3 @@ cn30xxpko_port_config(struct cn30xxpko_softc *sc)
return 0;
}
-
-#ifdef OCTEON_ETH_DEBUG
-int cn30xxpko_intr_rml_verbose;
-
-void
-cn30xxpko_intr_rml(void *arg)
-{
- struct cn30xxpko_softc *sc;
- uint64_t reg;
-
- sc = __cn30xxpko_softc;
- KASSERT(sc != NULL);
- reg = cn30xxpko_int_summary(sc);
- if (cn30xxpko_intr_rml_verbose)
- printf("%s: PKO_REG_ERROR=0x%016llx\n", __func__, reg);
-}
-
-void
-cn30xxpko_int_enable(struct cn30xxpko_softc *sc, int enable)
-{
- uint64_t pko_int_xxx = 0;
-
- pko_int_xxx = PKO_REG_ERROR_DOORBELL | PKO_REG_ERROR_PARITY;
- _PKO_WR8(sc, PKO_REG_ERROR_OFFSET, pko_int_xxx);
- _PKO_WR8(sc, PKO_REG_INT_MASK_OFFSET, enable ? pko_int_xxx : 0);
-}
-
-uint64_t
-cn30xxpko_int_summary(struct cn30xxpko_softc *sc)
-{
- uint64_t summary;
-
- summary = _PKO_RD8(sc, PKO_REG_ERROR_OFFSET);
- _PKO_WR8(sc, PKO_REG_ERROR_OFFSET, summary);
- return summary;
-}
-#endif
diff --git a/sys/arch/octeon/dev/cn30xxpow.c b/sys/arch/octeon/dev/cn30xxpow.c
index 62146ab7223..e9faf9387c3 100644
--- a/sys/arch/octeon/dev/cn30xxpow.c
+++ b/sys/arch/octeon/dev/cn30xxpow.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cn30xxpow.c,v 1.10 2017/09/08 05:36:52 deraadt Exp $ */
+/* $OpenBSD: cn30xxpow.c,v 1.11 2017/11/05 04:57:28 visa Exp $ */
/*
* Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -47,24 +47,10 @@ struct cn30xxpow_intr_handle {
int pi_group;
void (*pi_cb)(void *, uint64_t *);
void *pi_data;
-
-#ifdef OCTEON_ETH_DEBUG
-#define _EV_PER_N 32 /* XXX */
-#define _EV_IVAL_N 32 /* XXX */
- int pi_first;
- struct timeval pi_last;
-#endif
};
void cn30xxpow_bootstrap(struct octeon_config *);
-#ifdef OCTEON_ETH_DEBUG
-void cn30xxpow_intr_rml(void *);
-
-void cn30xxpow_intr_debug_init(struct cn30xxpow_intr_handle *, int);
-void cn30xxpow_intr_work_debug_ival(struct cn30xxpow_softc *,
- struct cn30xxpow_intr_handle *);
-#endif
void cn30xxpow_init(struct cn30xxpow_softc *);
void cn30xxpow_init_regs(struct cn30xxpow_softc *);
int cn30xxpow_tag_sw_poll(void);
@@ -76,17 +62,9 @@ void cn30xxpow_intr_work(struct cn30xxpow_softc *,
struct cn30xxpow_intr_handle *, int);
int cn30xxpow_intr(void *);
-#ifdef OCTEON_ETH_DEBUG
-void cn30xxpow_dump(void);
-#endif
-
/* XXX */
struct cn30xxpow_softc cn30xxpow_softc;
-#ifdef OCTEON_ETH_DEBUG
-struct cn30xxpow_softc *__cn30xxpow_softc;
-#endif
-
/*
* XXX: parameter tuning is needed: see files.octeon
*/
@@ -189,11 +167,6 @@ cn30xxpow_bootstrap(struct octeon_config *mcp)
/* XXX */
cn30xxpow_init(sc);
-
-#ifdef OCTEON_ETH_DEBUG
- __cn30xxpow_softc = sc;
-#endif
-
}
void
@@ -256,22 +229,9 @@ cn30xxpow_intr_establish(int group, int level,
pow_ih->pi_cb = cb;
pow_ih->pi_data = data;
-#ifdef OCTEON_ETH_DEBUG
- cn30xxpow_intr_debug_init(pow_ih, group);
-#endif
return pow_ih;
}
-#ifdef OCTEON_ETH_DEBUG
-
-void
-cn30xxpow_intr_debug_init(struct cn30xxpow_intr_handle *pow_ih, int group)
-{
- pow_ih->pi_first = 1;
-
-}
-#endif
-
void
cn30xxpow_init(struct cn30xxpow_softc *sc)
{
@@ -279,10 +239,6 @@ cn30xxpow_init(struct cn30xxpow_softc *sc)
sc->sc_int_pc_base = 10000;
cn30xxpow_config_int_pc(sc, sc->sc_int_pc_base);
-
-#ifdef OCTEON_ETH_DEBUG
- cn30xxpow_error_int_enable(sc, 1);
-#endif
}
void
@@ -294,48 +250,12 @@ cn30xxpow_init_regs(struct cn30xxpow_softc *sc)
&sc->sc_regh);
if (status != 0)
panic("can't map %s space", "pow register");
-
-#ifdef OCTEON_ETH_DEBUG
- _POW_WR8(sc, POW_ECC_ERR_OFFSET,
- POW_ECC_ERR_IOP_IE | POW_ECC_ERR_RPE_IE |
- POW_ECC_ERR_DBE_IE | POW_ECC_ERR_SBE_IE);
-#endif
}
/* -------------------------------------------------------------------------- */
/* ---- interrupt handling */
-#ifdef OCTEON_ETH_DEBUG
-void
-cn30xxpow_intr_work_debug_ival(struct cn30xxpow_softc *sc,
- struct cn30xxpow_intr_handle *pow_ih)
-{
- struct timeval now;
- struct timeval ival;
-
- microtime(&now);
- if (__predict_false(pow_ih->pi_first == 1)) {
- pow_ih->pi_first = 0;
- goto stat_done;
- }
- timersub(&now, &pow_ih->pi_last, &ival);
- if (ival.tv_sec != 0)
- goto stat_done; /* XXX */
-
-stat_done:
- pow_ih->pi_last = now; /* struct copy */
-}
-#endif
-
-#ifdef OCTEON_ETH_DEBUG
-#define _POW_INTR_WORK_DEBUG_IVAL(sc, ih) \
- cn30xxpow_intr_work_debug_ival((sc), (ih))
-#else
-#define _POW_INTR_WORK_DEBUG_IVAL(sc, ih) \
- do {} while (0)
-#endif
-
/*
* Interrupt handling by fixed count.
*
@@ -362,8 +282,6 @@ cn30xxpow_intr_work(struct cn30xxpow_softc *sc,
if (max_recv_cnt > 0)
recv_cnt = max_recv_cnt - 1;
- _POW_INTR_WORK_DEBUG_IVAL(sc, pow_ih);
-
cn30xxpow_tag_sw_wait();
cn30xxpow_work_request_async(OCTEON_CVMSEG_OFFSET(csm_pow_intr),
POW_NO_WAIT);
@@ -415,369 +333,3 @@ cn30xxpow_intr(void *data)
_POW_WR8(sc, POW_WQ_INT_OFFSET, wq_int_mask << POW_WQ_INT_WQ_INT_SHIFT);
return 1;
}
-
-/* -------------------------------------------------------------------------- */
-
-/* ---- debug configuration */
-
-#ifdef OCTEON_ETH_DEBUG
-
-void
-cn30xxpow_error_int_enable(void *data, int enable)
-{
- struct cn30xxpow_softc *sc = data;
- uint64_t pow_error_int_xxx;
-
- pow_error_int_xxx =
- POW_ECC_ERR_IOP | POW_ECC_ERR_RPE |
- POW_ECC_ERR_DBE | POW_ECC_ERR_SBE;
- _POW_WR8(sc, POW_ECC_ERR_OFFSET, pow_error_int_xxx);
- _POW_WR8(sc, POW_ECC_ERR_OFFSET, enable ? pow_error_int_xxx : 0);
-}
-
-uint64_t
-cn30xxpow_error_int_summary(void *data)
-{
- struct cn30xxpow_softc *sc = data;
- uint64_t summary;
-
- summary = _POW_RD8(sc, POW_ECC_ERR_OFFSET);
- _POW_WR8(sc, POW_ECC_ERR_OFFSET, summary);
- return summary;
-}
-
-#endif
-
-/* -------------------------------------------------------------------------- */
-
-/* ---- debug counter */
-
-#ifdef OCTEON_ETH_DEBUG
-int cn30xxpow_intr_rml_verbose;
-
-void
-cn30xxpow_intr_rml(void *arg)
-{
- struct cn30xxpow_softc *sc;
- uint64_t reg;
-
- sc = __cn30xxpow_softc;
- KASSERT(sc != NULL);
- reg = cn30xxpow_error_int_summary(sc);
- if (cn30xxpow_intr_rml_verbose)
- printf("%s: POW_ECC_ERR=0x%016llx\n", __func__, reg);
-}
-#endif
-
-/* -------------------------------------------------------------------------- */
-
-/* ---- debug dump */
-
-#ifdef OCTEON_ETH_DEBUG
-
-void cn30xxpow_dump_reg(void);
-void cn30xxpow_dump_ops(void);
-
-void
-cn30xxpow_dump(void)
-{
- cn30xxpow_dump_reg();
- cn30xxpow_dump_ops();
-}
-
-/* ---- register dump */
-
-struct cn30xxpow_dump_reg_entry {
- const char *name;
- size_t offset;
-};
-
-#define _ENTRY(x) { #x, x##_OFFSET }
-#define _ENTRY_0_7(x) \
- _ENTRY(x## 0), _ENTRY(x## 1), _ENTRY(x## 2), _ENTRY(x## 3), \
- _ENTRY(x## 4), _ENTRY(x## 5), _ENTRY(x## 6), _ENTRY(x## 7)
-#define _ENTRY_0_15(x) \
- _ENTRY(x## 0), _ENTRY(x## 1), _ENTRY(x## 2), _ENTRY(x## 3), \
- _ENTRY(x## 4), _ENTRY(x## 5), _ENTRY(x## 6), _ENTRY(x## 7), \
- _ENTRY(x## 8), _ENTRY(x## 9), _ENTRY(x##10), _ENTRY(x##11), \
- _ENTRY(x##12), _ENTRY(x##13), _ENTRY(x##14), _ENTRY(x##15)
-
-const struct cn30xxpow_dump_reg_entry cn30xxpow_dump_reg_entries[] = {
- _ENTRY (POW_PP_GRP_MSK0),
- _ENTRY (POW_PP_GRP_MSK1),
- _ENTRY_0_15 (POW_WQ_INT_THR),
- _ENTRY_0_15 (POW_WQ_INT_CNT),
- _ENTRY_0_7 (POW_QOS_THR),
- _ENTRY_0_7 (POW_QOS_RND),
- _ENTRY (POW_WQ_INT),
- _ENTRY (POW_WQ_INT_PC),
- _ENTRY (POW_NW_TIM),
- _ENTRY (POW_ECC_ERR),
- _ENTRY (POW_NOS_CNT),
- _ENTRY_0_15 (POW_WS_PC),
- _ENTRY_0_7 (POW_WA_PC),
- _ENTRY_0_7 (POW_IQ_CNT),
- _ENTRY (POW_WA_COM_PC),
- _ENTRY (POW_IQ_COM_CNT),
- _ENTRY (POW_TS_PC),
- _ENTRY (POW_DS_PC),
- _ENTRY (POW_BIST_STAT)
-};
-
-#undef _ENTRY
-
-void
-cn30xxpow_dump_reg(void)
-{
- struct cn30xxpow_softc *sc = __cn30xxpow_softc;
- const struct cn30xxpow_dump_reg_entry *entry;
- uint64_t tmp;
- int i;
-
- for (i = 0; i < (int)nitems(cn30xxpow_dump_reg_entries); i++) {
- entry = &cn30xxpow_dump_reg_entries[i];
- tmp = _POW_RD8(sc, entry->offset);
- printf("\t%-24s: %16llx\n", entry->name, tmp);
- }
-}
-
-/* ---- operations dump */
-
-struct cn30xxpow_dump_ops_entry {
- const char *name;
- uint64_t (*func)(int);
-};
-
-void cn30xxpow_dump_ops_coreid(int);
-void cn30xxpow_dump_ops_index(int);
-void cn30xxpow_dump_ops_qos(int);
-void cn30xxpow_dump_ops_grp(int);
-void cn30xxpow_dump_ops_queue(int);
-void cn30xxpow_dump_ops_common(const struct cn30xxpow_dump_ops_entry *,
- size_t, const char *, int);
-
-#define _ENTRY_COMMON(name, prefix, x, y) \
- { #name "_" #x, cn30xxpow_status_by_##name##_##x }
-
-const struct cn30xxpow_dump_ops_entry cn30xxpow_dump_ops_coreid_entries[] = {
-#define _ENTRY(x, y) _ENTRY_COMMON(coreid, POW_STATUS_LOAD_RESULT, x, y)
- _ENTRY(pend_tag, PEND_TAG),
- _ENTRY(pend_wqp, PEND_WQP),
- _ENTRY(cur_tag_next, CUR_TAG_NEXT),
- _ENTRY(cur_tag_prev, CUR_TAG_PREV),
- _ENTRY(cur_wqp_next, CUR_WQP_NEXT),
- _ENTRY(cur_wqp_prev, CUR_WQP_PREV)
-#undef _ENTRY
-};
-
-const struct cn30xxpow_dump_ops_entry cn30xxpow_dump_ops_index_entries[] = {
-#define _ENTRY(x, y) _ENTRY_COMMON(index, POW_MEMORY_LOAD_RESULT, x, y)
- _ENTRY(tag, TAG),
- _ENTRY(wqp, WQP),
- _ENTRY(desched, DESCHED)
-#undef _ENTRY
-};
-
-const struct cn30xxpow_dump_ops_entry cn30xxpow_dump_ops_qos_entries[] = {
-#define _ENTRY(x, y) _ENTRY_COMMON(qos, POW_IDXPTR_LOAD_RESULT_QOS, x, y)
- _ENTRY(free_loc, FREE_LOC)
-#undef _ENTRY
-};
-
-const struct cn30xxpow_dump_ops_entry cn30xxpow_dump_ops_grp_entries[] = {
-#define _ENTRY(x, y) _ENTRY_COMMON(grp, POW_IDXPTR_LOAD_RESULT_GRP, x, y)
- _ENTRY(nosched_des, NOSCHED_DES)
-#undef _ENTRY
-};
-
-const struct cn30xxpow_dump_ops_entry cn30xxpow_dump_ops_queue_entries[] = {
-#define _ENTRY(x, y) _ENTRY_COMMON(queue, POW_IDXPTR_LOAD_RESULT_QUEUE, x, y)
- _ENTRY(remote_head, REMOTE_HEAD),
- _ENTRY(remote_tail, REMOTE_TAIL)
-#undef _ENTRY
-};
-
-void
-cn30xxpow_dump_ops(void)
-{
- int i;
-
- /* XXX */
- for (i = 0; i < 2/* XXX */; i++)
- cn30xxpow_dump_ops_coreid(i);
-
- /* XXX */
- cn30xxpow_dump_ops_index(0);
-
- for (i = 0; i < 8; i++)
- cn30xxpow_dump_ops_qos(i);
-
- for (i = 0; i < 16; i++)
- cn30xxpow_dump_ops_grp(i);
-
- for (i = 0; i < 16; i++)
- cn30xxpow_dump_ops_queue(i);
-}
-
-void
-cn30xxpow_dump_ops_coreid(int coreid)
-{
- cn30xxpow_dump_ops_common(cn30xxpow_dump_ops_coreid_entries,
- nitems(cn30xxpow_dump_ops_coreid_entries), "coreid", coreid);
-}
-
-void
-cn30xxpow_dump_ops_index(int index)
-{
- cn30xxpow_dump_ops_common(cn30xxpow_dump_ops_index_entries,
- nitems(cn30xxpow_dump_ops_index_entries), "index", index);
-}
-
-void
-cn30xxpow_dump_ops_qos(int qos)
-{
- cn30xxpow_dump_ops_common(cn30xxpow_dump_ops_qos_entries,
- nitems(cn30xxpow_dump_ops_qos_entries), "qos", qos);
-}
-
-void
-cn30xxpow_dump_ops_grp(int grp)
-{
- cn30xxpow_dump_ops_common(cn30xxpow_dump_ops_grp_entries,
- nitems(cn30xxpow_dump_ops_grp_entries), "grp", grp);
-}
-
-void
-cn30xxpow_dump_ops_queue(int queue)
-{
- cn30xxpow_dump_ops_common(cn30xxpow_dump_ops_queue_entries,
- nitems(cn30xxpow_dump_ops_queue_entries), "queue", queue);
-}
-
-void
-cn30xxpow_dump_ops_common(const struct cn30xxpow_dump_ops_entry *entries,
- size_t nentries, const char *by_what, int arg)
-{
- const struct cn30xxpow_dump_ops_entry *entry;
- uint64_t tmp;
- int i;
-
- printf("%s=%d\n", by_what, arg);
- for (i = 0; i < (int)nentries; i++) {
- entry = &entries[i];
- tmp = (*entry->func)(arg);
- printf("\t%-24s: %16llx\n", entry->name, tmp);
- }
-}
-
-#endif
-
-/* -------------------------------------------------------------------------- */
-
-/* ---- test */
-
-#ifdef OCTEON_POW_TEST
-/*
- * Standalone test entries; meant to be called from ddb.
- */
-
-void cn30xxpow_test(void);
-void cn30xxpow_test_dump_wqe(paddr_t);
-
-void cn30xxpow_test_1(void);
-
-struct test_wqe {
- uint64_t word0;
- uint64_t word1;
- uint64_t word2;
- uint64_t word3;
-} __packed;
-struct test_wqe test_wqe;
-
-void
-cn30xxpow_test(void)
-{
- cn30xxpow_test_1();
-}
-
-void
-cn30xxpow_test_1(void)
-{
- struct test_wqe *wqe = &test_wqe;
- int qos, grp, queue, tt;
- uint32_t tag;
- paddr_t ptr;
-
- qos = 7; /* XXX */
- grp = queue = 15; /* XXX */
- tt = POW_TAG_TYPE_ORDERED; /* XXX */
- tag = UINT32_C(0x01234567); /* XXX */
-
- /* => make sure that the queue is empty */
-
- cn30xxpow_dump_ops_qos(qos);
- cn30xxpow_dump_ops_grp(grp);
- printf("\n");
-
- /*
- * Initialize WQE.
- *
- * word0:next is used by hardware.
- *
- * word1:qos, word1:grp, word1:tt, word1:tag must match with arguments
- * of the following ADDWQ transaction.
- */
-
- (void)memset(wqe, 0, sizeof(*wqe));
- wqe->word0 =
- __BITS64_SET(POW_WQE_WORD0_NEXT, 0);
- wqe->word1 =
- __BITS64_SET(POW_WQE_WORD1_QOS, qos) |
- __BITS64_SET(POW_WQE_WORD1_GRP, grp) |
- __BITS64_SET(POW_WQE_WORD1_TT, tt) |
- __BITS64_SET(POW_WQE_WORD1_TAG, tag);
-
- printf("calling ADDWQ\n");
- cn30xxpow_ops_addwq(MIPS_KSEG0_TO_PHYS(wqe), qos, grp, tt, tag);
-
- cn30xxpow_dump_ops_qos(qos);
- cn30xxpow_dump_ops_grp(grp);
- printf("\n");
-
- /* => make sure that a WQE is added to the queue */
-
- printf("calling GET_WORK_LOAD\n");
- ptr = cn30xxpow_ops_get_work_load(0);
-
- cn30xxpow_dump_ops_qos(qos);
- cn30xxpow_dump_ops_grp(grp);
- printf("\n");
-
- cn30xxpow_test_dump_wqe(ptr);
-
- /* => make sure that the WQE is in-flight (and scheduled) */
-
- printf("calling SWTAG(NULL)\n");
- cn30xxpow_ops_swtag(POW_TAG_TYPE_NULL, tag);
-
- cn30xxpow_dump_ops_qos(qos);
- cn30xxpow_dump_ops_grp(grp);
- printf("\n");
-
- /* => make sure that the WQE is un-scheduled (completed) */
-}
-
-void
-cn30xxpow_test_dump_wqe(paddr_t ptr)
-{
- uint64_t word0, word1;
-
- printf("wqe\n");
-
- word0 = *(uint64_t *)PHYS_TO_XKPHYS(ptr, CCA_CACHED);
- printf("\t%-24s: %16llx\n", "word0", word0);
-
- word1 = *(uint64_t *)PHYS_TO_XKPHYS(ptr + 8, CCA_CACHED);
- printf("\t%-24s: %16llx\n", "word1", word1);
-}
-#endif