diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-08-11 18:29:57 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-08-11 18:29:57 +0000 |
commit | 811de85db73191a08e364a68a5426f9447cb6113 (patch) | |
tree | 67a49bf9f6a5fccc569929bbb3450245f248797b /sys/arch | |
parent | 1063f744d2c00aef32b643078f4ac1064bd51702 (diff) |
Remove evcnt and %b format strings relying upon SEIL extensions. This gives
OCTEON_ETH_DEBUG kernels a chance to build. No functional change for regular
kernels.
Diffstat (limited to 'sys/arch')
25 files changed, 175 insertions, 3721 deletions
diff --git a/sys/arch/octeon/dev/cn30xxasx.c b/sys/arch/octeon/dev/cn30xxasx.c index f32f85b55ad..92bd000fa35 100644 --- a/sys/arch/octeon/dev/cn30xxasx.c +++ b/sys/arch/octeon/dev/cn30xxasx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxasx.c,v 1.5 2014/08/11 18:08:17 miod Exp $ */ +/* $OpenBSD: cn30xxasx.c,v 1.6 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -36,11 +36,7 @@ #include <octeon/dev/cn30xxasxvar.h> #ifdef OCTEON_ETH_DEBUG -void cn30xxasx_intr_evcnt_attach(struct cn30xxasx_softc *); -void cn30xxasx_intr_rml(void *); -#endif - -#ifdef OCTEON_ETH_DEBUG +void cn30xxasx_intr_rml(void *); struct cn30xxasx_softc *__cn30xxasx_softc; #endif @@ -67,7 +63,6 @@ cn30xxasx_init(struct cn30xxasx_attach_args *aa, *rsc = sc; #ifdef OCTEON_ETH_DEBUG - cn30xxasx_intr_evcnt_attach(sc); if (__cn30xxasx_softc == NULL) __cn30xxasx_softc = sc; #endif @@ -125,38 +120,17 @@ cn30xxasx_enable_rx(struct cn30xxasx_softc *sc, int enable) } #if defined(OCTEON_ETH_DEBUG) -int cn30xxasx_intr_rml_verbose; - -static const struct octeon_evcnt_entry cn30xxasx_intr_evcnt_entries[] = { -#define _ENTRY(name, type, parent, descr) \ - OCTEON_EVCNT_ENTRY(struct cn30xxasx_softc, name, type, parent, descr) - _ENTRY(asxrxpsh, MISC, NULL, "asx tx fifo overflow"), - _ENTRY(asxtxpop, MISC, NULL, "asx tx fifo underflow"), - _ENTRY(asxovrflw, MISC, NULL, "asx rx fifo overflow"), -#undef _ENTRY -}; - -void -cn30xxasx_intr_evcnt_attach(struct cn30xxasx_softc *sc) -{ - OCTEON_EVCNT_ATTACH_EVCNTS(sc, cn30xxasx_intr_evcnt_entries, "asx0"); -} +int cn30xxasx_intr_rml_verbose; void cn30xxasx_intr_rml(void *arg) { struct cn30xxasx_softc *sc = __cn30xxasx_softc; - uint64_t reg = 0; + uint64_t reg; reg = cn30xxasx_int_summary(sc); if (cn30xxasx_intr_rml_verbose) - printf("%s: ASX_INT_REG=0x%016" PRIx64 "\n", __func__, reg); - if (reg & ASX0_INT_REG_TXPSH) - OCTEON_EVCNT_INC(sc, asxrxpsh); - if (reg & ASX0_INT_REG_TXPOP) - OCTEON_EVCNT_INC(sc, asxtxpop); - if (reg & ASX0_INT_REG_OVRFLW) - OCTEON_EVCNT_INC(sc, asxovrflw); + printf("%s: ASX_INT_REG=0x%016llx\n", __func__, reg); } int @@ -193,17 +167,16 @@ cn30xxasx_int_summary(struct cn30xxasx_softc *sc) return summary; } -#define _ENTRY(x) { #x, x##_BITS, x##_OFFSET } +#define _ENTRY(x) { #x, x##_OFFSET } struct cn30xxasx_dump_reg_ { const char *name; - const char *format; size_t offset; }; void cn30xxasx_dump(void); -static const struct cn30xxasx_dump_reg_ cn30xxasx_dump_regs_[] = { +const struct cn30xxasx_dump_reg_ cn30xxasx_dump_regs_[] = { _ENTRY(ASX0_RX_PRT_EN), _ENTRY(ASX0_TX_PRT_EN), _ENTRY(ASX0_INT_REG), @@ -230,17 +203,12 @@ cn30xxasx_dump(void) struct cn30xxasx_softc *sc = __cn30xxasx_softc; const struct cn30xxasx_dump_reg_ *reg; uint64_t tmp; - char buf[512]; int i; for (i = 0; i < (int)nitems(cn30xxasx_dump_regs_); i++) { reg = &cn30xxasx_dump_regs_[i]; tmp = _ASX_RD8(sc, reg->offset); - if (reg->format == NULL) - snprintf(buf, sizeof(buf), "%016" PRIx64, tmp); - else - bitmask_snprintf(tmp, reg->format, buf, sizeof(buf)); - printf("\t%-24s: %s\n", reg->name, buf); + printf("\t%-24s: %016llx\n", reg->name, tmp); } } #endif diff --git a/sys/arch/octeon/dev/cn30xxasxreg.h b/sys/arch/octeon/dev/cn30xxasxreg.h index 713bd710752..089dce49f89 100644 --- a/sys/arch/octeon/dev/cn30xxasxreg.h +++ b/sys/arch/octeon/dev/cn30xxasxreg.h @@ -3,7 +3,7 @@ * DONT EDIT THIS FILE */ -/* $OpenBSD: cn30xxasxreg.h,v 1.1 2011/06/16 11:22:30 syuu Exp $ */ +/* $OpenBSD: cn30xxasxreg.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -162,132 +162,4 @@ #define ASX0_GMII_RX_DAT_SET_63_5 0xffffffe0 #define ASX0_GMII_RX_DAT_SET_SETTING 0x0000001f -/* ---- */ - -#define ASX0_RX_PRT_EN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\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 */ \ - "\177" /* seil ext */ \ - "\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 */ \ - "\177" /* seil ext */ \ - "\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 */ \ - "\177" /* seil ext */ \ - "\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 */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_RX_CLK_SET1_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_RX_CLK_SET2_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_PRT_LOOP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\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 */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_TX_CLK_SET1_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_TX_CLK_SET2_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_COMP_BYP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_TX_HI_WATER000_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_TX_HI_WATER001_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_TX_HI_WATER002_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define ASX0_GMII_RX_CLK_SET_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\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 */ \ - "\177" /* seil ext */ \ - "\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" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - - #endif /* _CN30XXASXREG_H_ */ diff --git a/sys/arch/octeon/dev/cn30xxasxvar.h b/sys/arch/octeon/dev/cn30xxasxvar.h index 4c881b24fb0..2a11cbe74df 100644 --- a/sys/arch/octeon/dev/cn30xxasxvar.h +++ b/sys/arch/octeon/dev/cn30xxasxvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxasxvar.h,v 1.2 2013/09/19 00:15:59 jmatthew Exp $ */ +/* $OpenBSD: cn30xxasxvar.h,v 1.3 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -34,11 +34,6 @@ struct cn30xxasx_softc { int sc_port; bus_space_tag_t sc_regt; bus_space_handle_t sc_regh; -#if defined(OCTEON_DEBUG) || defined(OCTEON_ETH_DEBUG) - struct evcnt sc_ev_asxrxpsh; - struct evcnt sc_ev_asxtxpop; - struct evcnt sc_ev_asxovrflw; -#endif }; /* XXX */ diff --git a/sys/arch/octeon/dev/cn30xxbootbusreg.h b/sys/arch/octeon/dev/cn30xxbootbusreg.h index bf577b1a7dd..6d27cb1a2b8 100644 --- a/sys/arch/octeon/dev/cn30xxbootbusreg.h +++ b/sys/arch/octeon/dev/cn30xxbootbusreg.h @@ -3,7 +3,7 @@ * DONT EDIT THIS FILE */ -/* $OpenBSD: cn30xxbootbusreg.h,v 1.1 2011/06/16 11:22:30 syuu Exp $ */ +/* $OpenBSD: cn30xxbootbusreg.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -123,115 +123,6 @@ #define MIO_BOOT_BIST_STAT_LOC 0x0000000000000002ULL #define MIO_BOOT_BIST_STAT_NCBI 0x0000000000000001ULL -/* ---- bitmask_snprintf */ - -#define MIO_BOOT_REG_CFGN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x24" "SAM\0" \ - "f\x22\x02" "WE_EXT\0" \ - "f\x20\x02" "OE_EXT\0" \ - "b\x1f" "EN\0" \ - "b\x1e" "OR\0" \ - "b\x1d" "ALE\0" \ - "b\x1c" "WIDTH\0" \ - "f\x10\x0c" "SIZE\0" \ - "f\x00\x10" "BASE\0" -#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_TIMN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x3f" "PAGEM\0" \ - "b\x3e" "WAITM\0" \ - "f\x3c\x02" "PAGES\0" \ - "f\x36\x06" "ALE\0" \ - "f\x30\x06" "PAGE\0" \ - "f\x2a\x06" "WAIT\0" \ - "f\x24\x06" "PAUSE\0" \ - "f\x1e\x06" "WR_HLD\0" \ - "f\x18\x06" "RD_HLD\0" \ - "f\x12\x06" "WE\0" \ - "f\x0c\x06" "OE\0" \ - "f\x06\x06" "CE\0" \ - "f\x00\x06" "ADR\0" -#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_CFGN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x1f" "EN\0" \ - "f\x03\x19" "BASE\0" -#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 - -#define MIO_BOOT_LOC_ADR_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x03\x05" "ADR\0" - -#define MIO_BOOT_ERR_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x01" "WAIT_ERR\0" \ - "b\x00" "ADR_ERR\0" - -#define MIO_BOOT_INT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x01" "WAIT_INT\0" \ - "b\x00" "ADR_INT\0" - -#define MIO_BOOT_THR_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x08\x06" "FIF_CNT\0" \ - "f\x00\x06" "FIF_THR\0" - -#define MIO_BOOT_BIST_STAT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x03" "NCBO_1\0" \ - "b\x02" "NCBO_0\0" \ - "b\x01" "LOC\0" \ - "b\x00" "NCBI\0" - /* ---- bus_space */ #define MIO_BOOT_REG_CFG0_OFFSET 0x0000 diff --git a/sys/arch/octeon/dev/cn30xxciureg.h b/sys/arch/octeon/dev/cn30xxciureg.h index f57259b10a5..ec9683ba3ed 100644 --- a/sys/arch/octeon/dev/cn30xxciureg.h +++ b/sys/arch/octeon/dev/cn30xxciureg.h @@ -3,7 +3,7 @@ * DONT EDIT THIS FILE */ -/* $OpenBSD: cn30xxciureg.h,v 1.1 2011/06/16 11:22:30 syuu Exp $ */ +/* $OpenBSD: cn30xxciureg.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -386,310 +386,4 @@ #define CIU_PCI_INTA_XXX_63_2 0xfffffffffffffffcULL #define CIU_PCI_INTA_INT 0x0000000000000003ULL -/* -- bitmask_snprintf(9) */ - -#define CIU_INTX_SUM0_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x3a" "MPI\0" \ - "b\x39" "PCM\0" \ - "b\x38" "USB\0" \ - "b\x37" "TIMER_3\0" \ - "b\x36" "TIMER_2\0" \ - "b\x35" "TIMER_1\0" \ - "b\x34" "TIMER_0\0" \ - "f\x34\x04" "TIMER\0" \ - "b\x32" "IPD_DRP\0" \ - "b\x30" "GMX_DRP\0" \ - "b\x2f" "TRACE\0" \ - "b\x2e" "RML\0" \ - "b\x2d" "TWSI\0" \ - "b\x2c" "WDOG_SUM\0" \ - "b\x2b" "PCI_MSI_63_48\0" \ - "b\x2a" "PCI_MSI_47_32\0" \ - "b\x29" "PCI_MSI_31_16\0" \ - "f\x28\x04" "PCI_MSI\0" \ - "b\x28" "PCI_MSI_15_0\0" \ - "b\x27" "PCI_INT_D\0" \ - "b\x26" "PCI_INT_C\0" \ - "b\x25" "PCI_INT_B\0" \ - "f\x24\x04" "PCI_INT\0" \ - "b\x24" "PCI_INT_A\0" \ - "b\x23" "UART_1\0" \ - "f\x22\x02" "UART\0" \ - "b\x22" "UART_0\0" \ - "b\x21" "MBOX_31_16\0" \ - "f\x20\x02" "MBOX\0" \ - "b\x20" "MBOX_15_0\0" \ - "b\x1f" "GPIO_15\0" \ - "b\x1e" "GPIO_14\0" \ - "b\x1d" "GPIO_13\0" \ - "b\x1c" "GPIO_12\0" \ - "b\x1b" "GPIO_11\0" \ - "b\x1a" "GPIO_10\0" \ - "b\x19" "GPIO_9\0" \ - "b\x18" "GPIO_8\0" \ - "b\x17" "GPIO_7\0" \ - "b\x16" "GPIO_6\0" \ - "b\x15" "GPIO_5\0" \ - "b\x14" "GPIO_4\0" \ - "b\x13" "GPIO_3\0" \ - "b\x12" "GPIO_2\0" \ - "b\x11" "GPIO_1\0" \ - "b\x10" "GPIO_0\0" \ - "f\x10\x10" "GPIO\0" \ - "b\x0f" "WORKQ_15\0" \ - "b\x0e" "WORKQ_14\0" \ - "b\x0d" "WORKQ_13\0" \ - "b\x0c" "WORKQ_12\0" \ - "b\x0b" "WORKQ_11\0" \ - "b\x0a" "WORKQ_10\0" \ - "b\x09" "WORKQ_9\0" \ - "b\x08" "WORKQ_8\0" \ - "b\x07" "WORKQ_7\0" \ - "b\x06" "WORKQ_6\0" \ - "b\x05" "WORKQ_5\0" \ - "b\x04" "WORKQ_4\0" \ - "b\x03" "WORKQ_3\0" \ - "b\x02" "WORKQ_2\0" \ - "b\x01" "WORKQ_1\0" \ - "b\x00" "WORKQ_0\0" \ - "f\x00\x10" "WORKQ\0" -#define CIU_INT0_SUM0_BITS CIU_INTX_SUM0_BITS -#define CIU_INT1_SUM0_BITS CIU_INTX_SUM0_BITS -#define CIU_INT2_SUM0_BITS CIU_INTX_SUM0_BITS -#define CIU_INT3_SUM0_BITS CIU_INTX_SUM0_BITS -#define CIU_INT32_SUM0_BITS CIU_INTX_SUM0_BITS - -#define CIU_INT_SUM1_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "WDOG\0" - -#define CIU_INTX_EN0_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x3a" "MPI\0" \ - "b\x39" "PCM\0" \ - "b\x38" "USB\0" \ - "b\x37" "TIMER_3\0" \ - "b\x36" "TIMER_2\0" \ - "b\x35" "TIMER_1\0" \ - "b\x34" "TIMER_0\0" \ - "f\x34\x04" "TIMER\0" \ - "b\x32" "IPD_DRP\0" \ - "b\x30" "GMX_DRP\0" \ - "b\x2f" "TRACE\0" \ - "b\x2e" "RML\0" \ - "b\x2d" "TWSI\0" \ - "b\x2c" "WDOG_SUM\0" \ - "b\x2b" "PCI_MSI_63_48\0" \ - "b\x2a" "PCI_MSI_47_32\0" \ - "b\x29" "PCI_MSI_31_16\0" \ - "f\x28\x04" "PCI_MSI\0" \ - "b\x28" "PCI_MSI_15_0\0" \ - "b\x27" "PCI_INT_D\0" \ - "b\x26" "PCI_INT_C\0" \ - "b\x25" "PCI_INT_B\0" \ - "f\x24\x04" "PCI_INT\0" \ - "b\x24" "PCI_INT_A\0" \ - "b\x23" "UART_1\0" \ - "f\x22\x02" "UART\0" \ - "b\x22" "UART_0\0" \ - "b\x21" "MBOX_31_16\0" \ - "f\x20\x02" "MBOX\0" \ - "b\x20" "MBOX_15_0\0" \ - "b\x1f" "GPIO_15\0" \ - "b\x1e" "GPIO_14\0" \ - "b\x1d" "GPIO_13\0" \ - "b\x1c" "GPIO_12\0" \ - "b\x1b" "GPIO_11\0" \ - "b\x1a" "GPIO_10\0" \ - "b\x19" "GPIO_9\0" \ - "b\x18" "GPIO_8\0" \ - "b\x17" "GPIO_7\0" \ - "b\x16" "GPIO_6\0" \ - "b\x15" "GPIO_5\0" \ - "b\x14" "GPIO_4\0" \ - "b\x13" "GPIO_3\0" \ - "b\x12" "GPIO_2\0" \ - "b\x11" "GPIO_1\0" \ - "b\x10" "GPIO_0\0" \ - "f\x10\x10" "GPIO\0" \ - "b\x0f" "WORKQ_15\0" \ - "b\x0e" "WORKQ_14\0" \ - "b\x0d" "WORKQ_13\0" \ - "b\x0c" "WORKQ_12\0" \ - "b\x0b" "WORKQ_11\0" \ - "b\x0a" "WORKQ_10\0" \ - "b\x09" "WORKQ_9\0" \ - "b\x08" "WORKQ_8\0" \ - "b\x07" "WORKQ_7\0" \ - "b\x06" "WORKQ_6\0" \ - "b\x05" "WORKQ_5\0" \ - "b\x04" "WORKQ_4\0" \ - "b\x03" "WORKQ_3\0" \ - "b\x02" "WORKQ_2\0" \ - "b\x01" "WORKQ_1\0" \ - "b\x00" "WORKQ_0\0" \ - "f\x00\x10" "WORKQ\0" -#define CIU_INT0_EN0_BITS CIU_INTX_EN0_BITS -#define CIU_INT1_EN0_BITS CIU_INTX_EN0_BITS -#define CIU_INT2_EN0_BITS CIU_INTX_EN0_BITS -#define CIU_INT3_EN0_BITS CIU_INTX_EN0_BITS -#define CIU_INT32_EN0_BITS CIU_INTX_EN0_BITS - -#define CIU_INTX_EN1_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "WDOG\0" -#define CIU_INT0_EN1_BITS CIU_INTX_EN1_BITS -#define CIU_INT1_EN1_BITS CIU_INTX_EN1_BITS -#define CIU_INT2_EN1_BITS CIU_INTX_EN1_BITS -#define CIU_INT3_EN1_BITS CIU_INTX_EN1_BITS -#define CIU_INT32_EN1_BITS CIU_INTX_EN1_BITS - -#define CIU_TIMX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x24" "ONE_SHOT\0" \ - "f\x00\x24" "LEN\0" -#define CIU_TIM0_BITS CIU_TIMX_BITS -#define CIU_TIM1_BITS CIU_TIMX_BITS -#define CIU_TIM2_BITS CIU_TIMX_BITS -#define CIU_TIM3_BITS CIU_TIMX_BITS -#define CIU_TIM32_BITS CIU_TIMX_BITS - -#define CIU_WDOGX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x2d" "GSTOPEN\0" \ - "b\x2c" "DSTOP\0" \ - "f\x14\x18" "CNT\0" \ - "f\x04\x10" "LEN\0" \ - "f\x02\x02" "STATE\0" \ - "f\x00\x02" "MODE\0" -#define CIU_WDOG0_BITS CIU_WDOGX_BITS -#define CIU_WDOG1_BITS CIU_WDOGX_BITS - -#if 0 -#define CIU_PP_POKEX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define CIU_PP_POKE0_BITS CIU_PP_POKEX_BITS -#define CIU_PP_POKE1_BITS CIU_PP_POKEX_BITS -#endif - -#define CIU_MBOX_SETX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "SET\0" -#define CIU_MBOX_SET0_BITS CIU_MBOX_SETX_BITS -#define CIU_MBOX_SET1_BITS CIU_MBOX_SETX_BITS - -#define CIU_MBOX_CLRX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "CLR\0" -#define CIU_MBOX_CLR0_BITS CIU_MBOX_CLRX_BITS -#define CIU_MBOX_CLR1_BITS CIU_MBOX_CLRX_BITS - -#define CIU_PP_RST_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "RST0\0" - -#define CIU_PP_DBG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "PPDBG\0" - -#define CIU_GSTOP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "GSTOP\0" - -#define CIU_NMI_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "NMI\0" - -#define CIU_DINT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "DINT\0" - -#define CIU_FUSE_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "FUSE\0" - -#define CIU_BIST_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x04" "BIST\0" - -#define CIU_SOFT_BIST_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "SOFT_BIST\0" - -#define CIU_SOFT_RST_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "SOFT_RST\0" - -#define CIU_SOFT_PRST_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x02" "HOST64\0" \ - "b\x01" "NPI\0" \ - "b\x00" "SOFT_PRST\0" - -#define CIU_PCI_INTA_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x02" "INT\0" - #endif /* _CN30XXCIUREG_H_ */ diff --git a/sys/arch/octeon/dev/cn30xxfpa.c b/sys/arch/octeon/dev/cn30xxfpa.c index 34e9919c860..8a9b9e76a3f 100644 --- a/sys/arch/octeon/dev/cn30xxfpa.c +++ b/sys/arch/octeon/dev/cn30xxfpa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxfpa.c,v 1.3 2014/08/11 18:08:17 miod Exp $ */ +/* $OpenBSD: cn30xxfpa.c,v 1.4 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -65,17 +65,6 @@ struct cn30xxfpa_softc { bus_dma_tag_t sc_dmat; struct cn30xxfpa_desc sc_descs[8]; - -#ifdef OCTEON_ETH_DEBUG - struct evcnt sc_ev_fpaq7perr; - struct evcnt sc_ev_fpaq7coff; - struct evcnt sc_ev_fpaq7und; - struct evcnt sc_ev_fpaq6perr; - struct evcnt sc_ev_fpaq6coff; - struct evcnt sc_ev_fpaq6und; - struct evcnt sc_ev_fpaq5perr; - struct evcnt sc_ev_fpaq5coff; -#endif }; void cn30xxfpa_bootstrap(struct octeon_config *); @@ -89,7 +78,6 @@ uint64_t cn30xxfpa_iobdma(struct cn30xxfpa_softc *, int, int); #endif #ifdef OCTEON_ETH_DEBUG -void cn30xxfpa_intr_evcnt_attach(struct cn30xxfpa_softc *); void cn30xxfpa_intr_rml(void *); #endif @@ -116,28 +104,7 @@ cn30xxfpa_reset(void) } #ifdef OCTEON_ETH_DEBUG -int cn30xxfpa_intr_rml_verbose; -struct evcnt cn30xxfpa_intr_evcnt; - -static const struct octeon_evcnt_entry cn30xxfpa_intr_evcnt_entries[] = { -#define _ENTRY(name, type, parent, descr) \ - OCTEON_EVCNT_ENTRY(struct cn30xxfpa_softc, name, type, parent, descr) - _ENTRY(fpaq7perr, MISC, NULL, "fpa q7 pointer"), - _ENTRY(fpaq7coff, MISC, NULL, "fpa q7 counter offset"), - _ENTRY(fpaq7und, MISC, NULL, "fpa q7 underflow"), - _ENTRY(fpaq6perr, MISC, NULL, "fpa q6 pointer"), - _ENTRY(fpaq6coff, MISC, NULL, "fpa q6 counter offset"), - _ENTRY(fpaq6und, MISC, NULL, "fpa q6 underflow"), - _ENTRY(fpaq5perr, MISC, NULL, "fpa q5 pointer"), - _ENTRY(fpaq5coff, MISC, NULL, "fpa q5 counter offset"), -#undef _ENTRY -}; - -void -cn30xxfpa_intr_evcnt_attach(struct cn30xxfpa_softc *sc) -{ - OCTEON_EVCNT_ATTACH_EVCNTS(sc, cn30xxfpa_intr_evcnt_entries, "fpa0"); -} +int cn30xxfpa_intr_rml_verbose; void cn30xxfpa_intr_rml(void *arg) @@ -145,28 +112,11 @@ cn30xxfpa_intr_rml(void *arg) struct cn30xxfpa_softc *sc; uint64_t reg; - cn30xxfpa_intr_evcnt.ev_count++; sc = &cn30xxfpa_softc; KASSERT(sc != NULL); reg = cn30xxfpa_int_summary(); if (cn30xxfpa_intr_rml_verbose) - printf("%s: FPA_INT_SUM=0x%016" PRIx64 "\n", __func__, reg); - if (reg & FPA_INT_SUM_Q7_PERR) - OCTEON_EVCNT_INC(sc, fpaq7perr); - if (reg & FPA_INT_SUM_Q7_COFF) - OCTEON_EVCNT_INC(sc, fpaq7coff); - if (reg & FPA_INT_SUM_Q7_UND) - OCTEON_EVCNT_INC(sc, fpaq7und); - if (reg & FPA_INT_SUM_Q6_PERR) - OCTEON_EVCNT_INC(sc, fpaq6perr); - if (reg & FPA_INT_SUM_Q6_COFF) - OCTEON_EVCNT_INC(sc, fpaq6coff); - if (reg & FPA_INT_SUM_Q6_UND) - OCTEON_EVCNT_INC(sc, fpaq6und); - if (reg & FPA_INT_SUM_Q5_PERR) - OCTEON_EVCNT_INC(sc, fpaq5perr); - if (reg & FPA_INT_SUM_Q5_COFF) - OCTEON_EVCNT_INC(sc, fpaq5coff); + printf("%s: FPA_INT_SUM=0x%016llx\n", __func__, reg); } void @@ -311,7 +261,6 @@ cn30xxfpa_init(struct cn30xxfpa_softc *sc) cn30xxfpa_init_regs(sc); #ifdef OCTEON_ETH_DEBUG cn30xxfpa_int_enable(sc, 1); - cn30xxfpa_intr_evcnt_attach(sc); #endif } @@ -361,19 +310,18 @@ cn30xxfpa_init_regs(struct cn30xxfpa_softc *sc) } #ifdef OCTEON_ETH_DEBUG -void cn30xxfpa_dump_regs(void); -void cn30xxfpa_dump_bufs(void); -void cn30xxfpa_dump_buf(int); +void cn30xxfpa_dump_regs(void); +void cn30xxfpa_dump_bufs(void); +void cn30xxfpa_dump_buf(int); -#define _ENTRY(x) { #x, x##_BITS, x##_OFFSET } +#define _ENTRY(x) { #x, x##_OFFSET } struct cn30xxfpa_dump_reg_ { const char *name; - const char *format; size_t offset; }; -static const struct cn30xxfpa_dump_reg_ cn30xxfpa_dump_regs_[] = { +const struct cn30xxfpa_dump_reg_ cn30xxfpa_dump_regs_[] = { _ENTRY(FPA_INT_SUM), _ENTRY(FPA_INT_ENB), _ENTRY(FPA_CTL_STATUS), @@ -400,7 +348,7 @@ static const struct cn30xxfpa_dump_reg_ cn30xxfpa_dump_regs_[] = { _ENTRY(FPA_QUE_ACT), }; -static const char *cn30xxfpa_dump_bufs_[8] = { +const char *cn30xxfpa_dump_bufs_[8] = { [0] = "recv", [1] = "wq", [2] = "cmdbuf", @@ -420,18 +368,12 @@ cn30xxfpa_dump_regs(void) struct cn30xxfpa_softc *sc = &cn30xxfpa_softc; const struct cn30xxfpa_dump_reg_ *reg; uint64_t tmp; - char buf[512]; int i; for (i = 0; i < (int)nitems(cn30xxfpa_dump_regs_); i++) { reg = &cn30xxfpa_dump_regs_[i]; tmp = bus_space_read_8(sc->sc_regt, sc->sc_regh, reg->offset); - if (reg->format == NULL) { - snprintf(buf, sizeof(buf), "%16" PRIx64, tmp); - } else { - bitmask_snprintf(tmp, reg->format, buf, sizeof(buf)); - } - printf("\t%-24s: %s\n", reg->name, buf); + printf("\t%-24s: %16llx\n", reg->name, tmp); } } @@ -459,7 +401,7 @@ cn30xxfpa_dump_buf(int pool) return; printf("%s pool:\n", name); for (i = 0; (ptr = cn30xxfpa_load(pool)) != 0; i++) { - printf("\t%016" PRIx64 "%s", ptr, ((i % 4) == 3) ? "\n" : ""); + printf("\t%016llx%s", ptr, ((i % 4) == 3) ? "\n" : ""); cn30xxfpa_store(ptr, OCTEON_POOL_NO_DUMP, 0); } if (i % 4 != 3) diff --git a/sys/arch/octeon/dev/cn30xxfpareg.h b/sys/arch/octeon/dev/cn30xxfpareg.h index 59b59e81420..3e4d75ca42f 100644 --- a/sys/arch/octeon/dev/cn30xxfpareg.h +++ b/sys/arch/octeon/dev/cn30xxfpareg.h @@ -3,7 +3,7 @@ * DONT EDIT THIS FILE */ -/* $OpenBSD: cn30xxfpareg.h,v 1.1 2011/06/16 11:22:30 syuu Exp $ */ +/* $OpenBSD: cn30xxfpareg.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -166,159 +166,6 @@ #define FPA_QUE_ACT_ACT_QUE 0x000000001c000000ULL #define FPA_QUE_ACT_ACT_INDX 0x0000000003ffffffULL -/* ---- bitmask_snprintf(9) */ - -#define FPA_INT_SUM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x1b" "Q7_PERR\0" \ - "b\x1a" "Q7_COFF\0" \ - "b\x19" "Q7_UND\0" \ - "b\x18" "Q6_PERR\0" \ - "b\x17" "Q6_COFF\0" \ - "b\x16" "Q6_UND\0" \ - "b\x15" "Q5_PERR\0" \ - "b\x14" "Q5_COFF\0" \ - "b\x13" "Q5_UND\0" \ - "b\x12" "Q4_PERR\0" \ - "b\x11" "Q4_COFF\0" \ - "b\x10" "Q4_UND\0" \ - "b\x0f" "Q3_PERR\0" \ - "b\x0e" "Q3_COFF\0" \ - "b\x0d" "Q3_UND\0" \ - "b\x0c" "Q2_PERR\0" \ - "b\x0b" "Q2_COFF\0" \ - "b\x0a" "Q2_UND\0" \ - "b\x09" "Q1_PERR\0" \ - "b\x08" "Q1_COFF\0" \ - "b\x07" "Q1_UND\0" \ - "b\x06" "Q0_PERR\0" \ - "b\x05" "Q0_COFF\0" \ - "b\x04" "Q0_UND\0" \ - "b\x03" "FED1_DBE\0" \ - "b\x02" "FED1_SBE\0" \ - "b\x01" "FED0_DBE\0" \ - "b\x00" "FED0_SBE\0" - -#define FPA_INT_ENB_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x1b" "Q7_PERR\0" \ - "b\x1a" "Q7_COFF\0" \ - "b\x19" "Q7_UND\0" \ - "b\x18" "Q6_PERR\0" \ - "b\x17" "Q6_COFF\0" \ - "b\x16" "Q6_UND\0" \ - "b\x15" "Q5_PERR\0" \ - "b\x14" "Q5_COFF\0" \ - "b\x13" "Q5_UND\0" \ - "b\x12" "Q4_PERR\0" \ - "b\x11" "Q4_COFF\0" \ - "b\x10" "Q4_UND\0" \ - "b\x0f" "Q3_PERR\0" \ - "b\x0e" "Q3_COFF\0" \ - "b\x0d" "Q3_UND\0" \ - "b\x0c" "Q2_PERR\0" \ - "b\x0b" "Q2_COFF\0" \ - "b\x0a" "Q2_UND\0" \ - "b\x09" "Q1_PERR\0" \ - "b\x08" "Q1_COFF\0" \ - "b\x07" "Q1_UND\0" \ - "b\x06" "Q0_PERR\0" \ - "b\x05" "Q0_COFF\0" \ - "b\x04" "Q0_UND\0" \ - "b\x03" "FED1_DBE\0" \ - "b\x02" "FED1_SBE\0" \ - "b\x01" "FED0_DBE\0" \ - "b\x00" "FED0_SBE\0" - -#define FPA_CTL_STATUS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x11" "RESET\0" \ - "b\x10" "USE_LDT\0" \ - "b\x0f" "USE_STT\0" \ - "b\x0e" "ENB\0" \ - "f\x07\x07" "MEM1_ERR\0" \ - "f\x00\x07" "MEM0_ERR\0" - -#define FPA_QUEX_AVAILABLE_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x1d" "QUE_SIZ\0" -#define FPA_QUE0_AVAILABLE_BITS FPA_QUEX_AVAILABLE_BITS -#define FPA_QUE1_AVAILABLE_BITS FPA_QUEX_AVAILABLE_BITS -#define FPA_QUE2_AVAILABLE_BITS FPA_QUEX_AVAILABLE_BITS -#define FPA_QUE3_AVAILABLE_BITS FPA_QUEX_AVAILABLE_BITS -#define FPA_QUE4_AVAILABLE_BITS FPA_QUEX_AVAILABLE_BITS -#define FPA_QUE5_AVAILABLE_BITS FPA_QUEX_AVAILABLE_BITS -#define FPA_QUE6_AVAILABLE_BITS FPA_QUEX_AVAILABLE_BITS -#define FPA_QUE7_AVAILABLE_BITS FPA_QUEX_AVAILABLE_BITS - -#define FPA_WART_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "CTL\0" - -#define FPA_WART_STATUS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "STATUS\0" - -#define FPA_BIST_STATUS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x04" "FRD\0" \ - "b\x03" "FPF0\0" \ - "b\x02" "FPF1\0" \ - "b\x01" "FFR\0" \ - "b\x00" "FDR\0" - -#define FPA_QUEX_PAGE_INDEX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x19" "PG_NUM\0" -#define FPA_QUE0_PAGE_INDEX_BITS FPA_QUEX_PAGE_INDEX_BITS -#define FPA_QUE1_PAGE_INDEX_BITS FPA_QUEX_PAGE_INDEX_BITS -#define FPA_QUE2_PAGE_INDEX_BITS FPA_QUEX_PAGE_INDEX_BITS -#define FPA_QUE3_PAGE_INDEX_BITS FPA_QUEX_PAGE_INDEX_BITS -#define FPA_QUE4_PAGE_INDEX_BITS FPA_QUEX_PAGE_INDEX_BITS -#define FPA_QUE5_PAGE_INDEX_BITS FPA_QUEX_PAGE_INDEX_BITS -#define FPA_QUE6_PAGE_INDEX_BITS FPA_QUEX_PAGE_INDEX_BITS -#define FPA_QUE7_PAGE_INDEX_BITS FPA_QUEX_PAGE_INDEX_BITS - -#define FPA_QUE_EXP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x1a\x03" "EXP_QUE\0" \ - "f\x00\x1a" "EXP_INDX\0" - -#define FPA_QUE_ACT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x1a\x03" "ACT_QUE\0" \ - "f\x00\x1a" "ACT_INDX\0" - /* ---- operations */ /* diff --git a/sys/arch/octeon/dev/cn30xxgmx.c b/sys/arch/octeon/dev/cn30xxgmx.c index 9b0efc9e236..e179ed7dabd 100644 --- a/sys/arch/octeon/dev/cn30xxgmx.c +++ b/sys/arch/octeon/dev/cn30xxgmx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxgmx.c,v 1.13 2014/08/11 18:08:17 miod Exp $ */ +/* $OpenBSD: cn30xxgmx.c,v 1.14 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -89,6 +89,7 @@ int cn30xxgmx_match(struct device *, void *, void *); void cn30xxgmx_attach(struct device *, struct device *, void *); int cn30xxgmx_print(void *, const char *); int cn30xxgmx_submatch(struct device *, void *, void *); +int cn30xxgmx_port_phy_addr(int); int cn30xxgmx_init(struct cn30xxgmx_softc *); int cn30xxgmx_rx_frm_ctl_xable(struct cn30xxgmx_port_softc *, uint64_t, int); @@ -101,9 +102,10 @@ int cn30xxgmx_rgmii_timing(struct cn30xxgmx_port_softc *); int cn30xxgmx_rgmii_set_mac_addr(struct cn30xxgmx_port_softc *, uint8_t *, uint64_t); int cn30xxgmx_rgmii_set_filter(struct cn30xxgmx_port_softc *); +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_intr_evcnt_attach(struct cn30xxgmx_softc *); void cn30xxgmx_dump(void); void cn30xxgmx_debug_reset(void); int cn30xxgmx_intr_drop(void *); @@ -147,25 +149,8 @@ struct cn30xxgmx_port_ops *cn30xxgmx_port_ops[] = { [GMX_SPI42_PORT] = &cn30xxgmx_port_ops_spi42 }; -int octeon_eth_phy_table[] = { -#if defined __seil5__ - 0x04, 0x01, 0x02 -#else - /* portwell cam-0100 */ - 0x02, 0x03, 0x22 -#endif -}; - #ifdef OCTEON_ETH_DEBUG -static void *cn30xxgmx_intr_drop_ih; -struct evcnt cn30xxgmx_intr_drop_evcnt = - EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "octeon", - "gmx drop intr"); -struct evcnt cn30xxgmx_intr_evcnt = - EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "octeon", - "gmx intr"); -EVCNT_ATTACH_STATIC(cn30xxgmx_intr_drop_evcnt); -EVCNT_ATTACH_STATIC(cn30xxgmx_intr_evcnt); +void *cn30xxgmx_intr_drop_ih; struct cn30xxgmx_port_softc *__cn30xxgmx_port_softc[3/* XXX */]; #endif @@ -191,10 +176,13 @@ cn30xxgmx_match(struct device *parent, void *match, void *aux) int cn30xxgmx_port_phy_addr(int port) { - extern struct boot_info *octeon_boot_info; + static const int octeon_eth_phy_table[] = { + /* portwell cam-0100 */ + 0x02, 0x03, 0x22 + }; switch (octeon_boot_info->board_type) { - case BOARD_TYPE_UBIQUITI_E100: + case BOARD_TYPE_UBIQUITI_E100: /* port 0: 7, port 1: 6 */ if (port > 2) return -1; return 7 - port; @@ -264,11 +252,10 @@ cn30xxgmx_attach(struct device *parent, struct device *self, void *aux) } #ifdef OCTEON_ETH_DEBUG - cn30xxgmx_intr_evcnt_attach(sc); if (cn30xxgmx_intr_drop_ih == NULL) cn30xxgmx_intr_drop_ih = octeon_intr_establish( - ffs64(CIU_INTX_SUM0_GMX_DRP) - 1, 0, IPL_NET, - cn30xxgmx_intr_drop, NULL); + ffs64(CIU_INTX_SUM0_GMX_DRP) - 1, IPL_NET, + cn30xxgmx_intr_drop, NULL, "cn30xxgmx"); #endif } @@ -1299,64 +1286,12 @@ void cn30xxgmx_intr_rml_gmx0(void); int cn30xxgmx_intr_rml_verbose; -/* tx - per unit (gmx0, gmx1, ...) */ -static const struct octeon_evcnt_entry cn30xxgmx_intr_evcnt_tx_entries[] = { -#define _ENTRY(name, type, parent, descr) \ - OCTEON_EVCNT_ENTRY(struct cn30xxgmx_softc, name, type, parent, descr) - _ENTRY(latecol, MISC, NULL, "tx late collision"), - _ENTRY(xsdef, MISC, NULL, "tx excessive deferral"), - _ENTRY(xscol, MISC, NULL, "tx excessive collision"), - _ENTRY(undflw, MISC, NULL, "tx underflow"), - _ENTRY(pkonxa, MISC, NULL, "tx port addr out-of-range") -#undef _ENTRY -}; - -/* rx - per port (gmx0:0, gmx0:1, ...) */ -static const struct octeon_evcnt_entry cn30xxgmx_intr_evcnt_rx_entries[] = { -#define _ENTRY(name, type, parent, descr) \ - OCTEON_EVCNT_ENTRY(struct cn30xxgmx_port_softc, name, type, parent, descr) - _ENTRY(minerr, MISC, NULL, "rx min error"), - _ENTRY(carext, MISC, NULL, "rx carrier error"), - _ENTRY(maxerr, MISC, NULL, "rx max error"), - _ENTRY(jabber, MISC, NULL, "rx jabber error"), - _ENTRY(fcserr, MISC, NULL, "rx fcs error"), - _ENTRY(alnerr, MISC, NULL, "rx align error"), - _ENTRY(lenerr, MISC, NULL, "rx length error"), - _ENTRY(rcverr, MISC, NULL, "rx receive error"), - _ENTRY(skperr, MISC, NULL, "rx skip error"), - _ENTRY(niberr, MISC, NULL, "rx nibble error"), - _ENTRY(ovrerr, MISC, NULL, "rx overflow error"), - _ENTRY(pckterr, MISC, NULL, "rx packet error"), - _ENTRY(rsverr, MISC, NULL, "rx reserved opcode error"), - _ENTRY(falerr, MISC, NULL, "rx false carrier error"), - _ENTRY(coldet, MISC, NULL, "rx collision detect"), - _ENTRY(ifgerr, MISC, NULL, "rx ifg error") -#undef _ENTRY -}; - -void -cn30xxgmx_intr_evcnt_attach(struct cn30xxgmx_softc *sc) -{ - struct cn30xxgmx_port_softc *port_sc; - int i; - - OCTEON_EVCNT_ATTACH_EVCNTS(sc, cn30xxgmx_intr_evcnt_tx_entries, - sc->sc_dev.dv_xname); - for (i = 0; i < sc->sc_nports; i++) { - port_sc = &sc->sc_ports[i]; - OCTEON_EVCNT_ATTACH_EVCNTS(port_sc, cn30xxgmx_intr_evcnt_rx_entries, - sc->sc_dev.dv_xname); - } -} - void cn30xxgmx_intr_rml_gmx0(void) { - struct cn30xxgmx_port_softc *sc = NULL/* XXX gcc */; + struct cn30xxgmx_port_softc *sc; int i; - uint64_t reg = 0/* XXX gcc */; - - cn30xxgmx_intr_evcnt.ev_count++; + uint64_t reg; sc = __cn30xxgmx_port_softc[0]; if (sc == NULL) @@ -1365,17 +1300,7 @@ cn30xxgmx_intr_rml_gmx0(void) /* 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%016" PRIx64 "\n", __func__, reg); - if (reg & TX_INT_REG_LATE_COL) - OCTEON_EVCNT_INC(sc->sc_port_gmx, latecol); - if (reg & TX_INT_REG_XSDEF) - OCTEON_EVCNT_INC(sc->sc_port_gmx, xsdef); - if (reg & TX_INT_REG_XSCOL) - OCTEON_EVCNT_INC(sc->sc_port_gmx, xscol); - if (reg & TX_INT_REG_UNDFLW) - OCTEON_EVCNT_INC(sc->sc_port_gmx, undflw); - if (reg & TX_INT_REG_PKO_NXA) - OCTEON_EVCNT_INC(sc->sc_port_gmx, pkonxa); + printf("%s: GMX_TX_INT_REG=0x%016llx\n", __func__, reg); for (i = 0; i < GMX_PORT_NUNITS; i++) { sc = __cn30xxgmx_port_softc[i]; @@ -1383,55 +1308,14 @@ cn30xxgmx_intr_rml_gmx0(void) continue; reg = cn30xxgmx_get_rx_int_reg(sc); if (cn30xxgmx_intr_rml_verbose) - printf("%s: GMX_RX_INT_REG=0x%016" PRIx64 "\n", __func__, reg); - if (reg & RXN_INT_REG_MINERR) - OCTEON_EVCNT_INC(sc, minerr); - if (reg & RXN_INT_REG_CAREXT) - OCTEON_EVCNT_INC(sc, carext); - if (reg & RXN_INT_REG_JABBER) - OCTEON_EVCNT_INC(sc, jabber); - if (reg & RXN_INT_REG_FCSERR) - OCTEON_EVCNT_INC(sc, fcserr); - if (reg & RXN_INT_REG_ALNERR) - OCTEON_EVCNT_INC(sc, alnerr); - if (reg & RXN_INT_REG_LENERR) - OCTEON_EVCNT_INC(sc, lenerr); - if (reg & RXN_INT_REG_RCVERR) - OCTEON_EVCNT_INC(sc, rcverr); - if (reg & RXN_INT_REG_SKPERR) - OCTEON_EVCNT_INC(sc, skperr); - if (reg & RXN_INT_REG_NIBERR) - OCTEON_EVCNT_INC(sc, niberr); - if (reg & RXN_INT_REG_OVRERR) - OCTEON_EVCNT_INC(sc, ovrerr); - if (reg & RXN_INT_REG_PCTERR) - OCTEON_EVCNT_INC(sc, pckterr); - if (reg & RXN_INT_REG_RSVERR) - OCTEON_EVCNT_INC(sc, rsverr); - if (reg & RXN_INT_REG_FALERR) - OCTEON_EVCNT_INC(sc, falerr); - if (reg & RXN_INT_REG_COLDET) - OCTEON_EVCNT_INC(sc, coldet); - if (reg & RXN_INT_REG_IFGERR) - OCTEON_EVCNT_INC(sc, ifgerr); + printf("%s: GMX_RX_INT_REG=0x%016llx\n", __func__, reg); } } -#ifdef notyet -void -cn30xxgmx_intr_rml_gmx1(void) -{ - uint64_t reg = 0/* XXX gcc */; - - /* GMX1_RXn_INT_REG or GMX1_TXn_INT_REG */ -} -#endif - int cn30xxgmx_intr_drop(void *arg) { octeon_xkphys_write_8(CIU_INT0_SUM0, CIU_INTX_SUM0_GMX_DRP); - cn30xxgmx_intr_drop_evcnt.ev_count++; return (1); } @@ -1491,15 +1375,14 @@ cn30xxgmx_get_tx_int_reg(struct cn30xxgmx_port_softc *sc) /* ---- debug */ #ifdef OCTEON_ETH_DEBUG -#define _ENTRY(x) { #x, x##_BITS, x } +#define _ENTRY(x) { #x, x } struct cn30xxgmx_dump_reg_ { const char *name; - const char *format; size_t offset; }; -static const struct cn30xxgmx_dump_reg_ cn30xxgmx_dump_regs_[] = { +const struct cn30xxgmx_dump_reg_ cn30xxgmx_dump_regs_[] = { _ENTRY(GMX0_SMAC0), _ENTRY(GMX0_BIST0), _ENTRY(GMX0_RX_PRTS), @@ -1534,7 +1417,7 @@ static const struct cn30xxgmx_dump_reg_ cn30xxgmx_dump_regs_[] = { _ENTRY(GMX0_INF_MODE), }; -static const struct cn30xxgmx_dump_reg_ cn30xxgmx_dump_port_regs_[] = { +const struct cn30xxgmx_dump_reg_ cn30xxgmx_dump_port_regs_[] = { _ENTRY(GMX0_RX0_INT_REG), _ENTRY(GMX0_RX0_INT_EN), _ENTRY(GMX0_PRT0_CFG), @@ -1571,7 +1454,7 @@ static const struct cn30xxgmx_dump_reg_ cn30xxgmx_dump_port_regs_[] = { _ENTRY(GMX0_TX0_CTL), }; -static const struct cn30xxgmx_dump_reg_ cn30xxgmx_dump_port_stats_[] = { +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), @@ -1593,22 +1476,22 @@ static const struct cn30xxgmx_dump_reg_ cn30xxgmx_dump_port_stats_[] = { _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_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) @@ -1692,26 +1575,41 @@ cn30xxgmx_dump_x(int portno, const struct cn30xxgmx_dump_reg_ *regs, size_t size const struct cn30xxgmx_dump_reg_ *reg; uint64_t tmp; char name[64]; - char buf[512]; int i; for (i = 0; i < (int)size; i++) { reg = ®s[i]; tmp = _GMX_RD8(sc, base + reg->offset); - if (reg->format == NULL) - snprintf(buf, sizeof(buf), "%016" PRIx64, tmp); - else - bitmask_snprintf(tmp, reg->format, buf, sizeof(buf)); - snprintf(name, sizeof(name), "%s", reg->name); if (index > 0) cn30xxgmx_dump_x_index(name, sizeof(name), portno); - printf("\t%-24s: %s\n", name, buf); + 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) { diff --git a/sys/arch/octeon/dev/cn30xxgmxreg.h b/sys/arch/octeon/dev/cn30xxgmxreg.h index 3b2e3acf39f..a6c826e9242 100644 --- a/sys/arch/octeon/dev/cn30xxgmxreg.h +++ b/sys/arch/octeon/dev/cn30xxgmxreg.h @@ -3,7 +3,7 @@ * DONT EDIT THIS FILE */ -/* $OpenBSD: cn30xxgmxreg.h,v 1.1 2011/06/16 11:22:30 syuu Exp $ */ +/* $OpenBSD: cn30xxgmxreg.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -640,606 +640,4 @@ #define GMX0_BASE_IF0 0x0001180008000000ULL #define GMX0_BASE_IF_SIZE (GMX0_BASE_PORT_SIZE * GMX_PORT_NUNITS) -/* for bitmask_snprintf(9) */ - -#define RXN_INT_REG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x12" "PHY_DUPX\0" \ - "b\x11" "PHY_SPD\0" \ - "b\x10" "PHY_LINK\0" \ - "b\x0f" "IFGERR\0" \ - "b\x0e" "COLDET\0" \ - "b\x0d" "FALERR\0" \ - "b\x0c" "RSVERR\0" \ - "b\x0b" "PCTERR\0" \ - "b\x0a" "OVRERR\0" \ - "b\x09" "NIBERR\0" \ - "b\x08" "SKPERR\0" \ - "b\x07" "RCVERR\0" \ - "b\x06" "LENERR\0" \ - "b\x05" "ALNERR\0" \ - "b\x04" "FCSERR\0" \ - "b\x03" "JABBER\0" \ - "b\x02" "MAXERR\0" \ - "b\x01" "CAREXT\0" \ - "b\x00" "MINERR\0" -#define RXN_INT_EN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x12" "PHY_DUPX\0" \ - "b\x11" "PHY_SPD\0" \ - "b\x10" "PHY_LINK\0" \ - "b\x0f" "IFGERR\0" \ - "b\x0e" "COLDET\0" \ - "b\x0d" "FALERR\0" \ - "b\x0c" "RSVERR\0" \ - "b\x0b" "PCTERR\0" \ - "b\x0a" "OVRERR\0" \ - "b\x09" "NIBERR\0" \ - "b\x08" "SKPERR\0" \ - "b\x07" "RCVERR\0" \ - "b\x06" "LENERR\0" \ - "b\x05" "ALNERR\0" \ - "b\x04" "FCSERR\0" \ - "b\x03" "JABBER\0" \ - "b\x02" "MAXERR\0" \ - "b\x01" "CAREXT\0" \ - "b\x00" "MINERR\0" -#define PRTN_CFG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x03" "SLOTTIME\0" \ - "b\x02" "DUPLEX\0" \ - "b\x01" "SPEED\0" \ - "b\x00" "EN\0" -#define RXN_FRM_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x0a" "NULL_DIS\0" \ - "b\x09" "PRE_ALIGN\0" \ - "b\x08" "PAD_LEN\0" \ - "b\x07" "VLAN_LEN\0" \ - "b\x06" "PRE_FREE\0" \ - "b\x05" "CTL_SMAC\0" \ - "b\x04" "CTL_MCST\0" \ - "b\x03" "CTL_BCK\0" \ - "b\x02" "CTL_DRP\0" \ - "b\x01" "PRE_STRP\0" \ - "b\x00" "PRE_CHK\0" -#define RXN_FRM_CHK_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x09" "NIBERR\0" \ - "b\x08" "SKPERR\0" \ - "b\x07" "RCVERR\0" \ - "b\x06" "LENERR\0" \ - "b\x05" "ALNERR\0" \ - "b\x04" "FCSERR\0" \ - "b\x03" "JABBER\0" \ - "b\x02" "MAXERR\0" \ - "b\x01" "CAREXT\0" \ - "b\x00" "MINERR\0" -/* RXN_FRM_MIN */ -/* RXN_FRM_MAX */ -#define RXN_JABBER_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "CNT\0" -#define RXN_DECISION_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x05" "CNT\0" -#define RXN_UDD_SKP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x08" "FCSSEL\0" \ - "f\x00\x07" "LEN\0" -#define RXN_STATS_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "RD_CLR\0" -#define RXN_IFG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x04" "IFG\0" -#define RXN_RX_INBND_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x03" "DUPLEX\0" \ - "f\x01\x02" "SPEED\0" \ - "b\x00" "STATUS\0" -#define RXN_STATS_PKTS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "CNT\0" -#define RXN_STATS_OCTS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x30" "CNT\0" -#define RXN_STATS_PKTS_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "CNT\0" -#define RXN_STATS_OCTS_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x30" "CNT\0" -#define RXN_STATS_PKTS_DMAC_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "CNT\0" -#define RXN_STATS_OCTS_DMAC_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x30" "CNT\0" -#define RXN_STATS_PKTS_DRP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "CNT\0" -#define RXN_STATS_OCTS_DRP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x30" "CNT\0" -#define RXN_STATS_PKTS_BAD_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "CNT\0" -#define RXN_ADR_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x03" "CAM_MODE\0" \ - "f\x01\x02" "MCST\0" \ - "b\x00" "BCST\0" -#define RXN_ADR_CAM_EN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x08" "EN\0" -/* RXN_ADR_CAM0 */ -/* RXN_ADR_CAM1 */ -/* RXN_ADR_CAM2 */ -/* RXN_ADR_CAM3 */ -/* RXN_ADR_CAM4 */ -/* RXN_ADR_CAM5 */ -#define TXN_CLK_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x06" "CLK_CNT\0" -#define TXN_THRESH_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x06" "CNT\0" -#define TXN_APPEND_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x03" "FORCE_FCS\0" \ - "b\x02" "FCS\0" \ - "b\x01" "PAD\0" \ - "b\x00" "PREAMBLE\0" -#define TXN_SLOT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x0a" "SLOT\0" -#define TXN_BURST_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "BURST\0" -/* SMAC0 */ -#define TXN_PAUSE_PKT_TIME_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "TIME\0" -#define TXN_MIN_PKT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x08" "MIN_SIZE\0" -#define TXN_PAUSE_PKT_INTERVAL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "INTERVAL\0" -#define TXN_SOFT_PAUSE_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "TIME\0" -#define TXN_PAUSE_TOGO_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "TIME\0" -#define TXN_PAUSE_ZERO_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "SEND\0" -#define TXN_STATS_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "RD_CLR\0" -#define TXN_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x01" "XSDEF_EN\0" \ - "b\x00" "XSCOL_EN\0" -#define TXN_STAT0_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "XSDEF\0" \ - "f\x00\x20" "XSCOL\0" -#define TXN_STAT1_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "SCOL\0" \ - "f\x00\x20" "MSCOL\0" -#define TXN_STAT2_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x30" "OCTS\0" -#define TXN_STAT3_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "PKTS\0" -#define TXN_STAT4_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "HIST1\0" \ - "f\x00\x20" "HIST0\0" -#define TXN_STAT5_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "HIST3\0" \ - "f\x00\x20" "HIST2\0" -#define TXN_STAT6_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "HIST5\0" \ - "f\x00\x20" "HIST4\0" -#define TXN_STAT7_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "HIST7\0" \ - "f\x00\x20" "HIST6\0" -#define TXN_STAT8_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "MCST\0" \ - "f\x00\x20" "BCST\0" -#define TXN_STAT9_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "UNDFLW\0" \ - "f\x00\x20" "CTL\0" -/* BIST0 */ -#define RX_PRTS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x03" "PRTS\0" -#define RX_BP_DROPN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x06" "MARK\0" -#define RX_BP_ONN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x09" "MARK\0" -#define RX_BP_OFFN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x06" "MARK\0" -#define TX_PRTS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x05" "PRTS\0" -#define TX_IFG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x04\x04" "IFG2\0" \ - "f\x00\x04" "IFG1\0" -#define TX_JAM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x08" "JAM\0" -#define TX_COL_ATTEMPT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x05" "LIMIT\0" -#define TX_PAUSE_PKT_DMAC_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x30" "DMAC\0" -#define TX_PAUSE_PKT_TYPE_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "TYPE\0" -#define TX_OVR_BP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x08\x03" "EN\0" \ - "f\x04\x03" "BP\0" \ - "f\x00\x03" "IGN_FULL\0" -#define TX_BP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x03" "SR_BP\0" -#define TX_CORRUPT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x03" "CORRUPT\0" -#define RX_PRT_INFO_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x10\x03" "DROP\0" \ - "f\x00\x03" "COMMIT\0" -#define TX_LFSR_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "LFSR\0" -#define TX_INT_REG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x10\x03" "LATE_COL\0" \ - "f\x0c\x03" "XSDEF\0" \ - "f\x08\x03" "XSCOL\0" \ - "f\x02\x03" "UNDFLW\0" \ - "b\x00" "PKO_NXA\0" -#define TX_INT_EN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x10\x03" "LATE_COL\0" \ - "f\x0c\x03" "XSDEF\0" \ - "f\x08\x03" "XSCOL\0" \ - "f\x02\x03" "UNDFLW\0" \ - "b\x00" "PKO_NXA\0" -#define NXA_ADR_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x06" "PRT\0" -#define BAD_REG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x1b\x04" "INB_NXA\0" \ - "b\x1a" "STATOVR\0" \ - "f\x16\x03" "LOSTSTAT\0" \ - "f\x02\x03" "OUT_OVR\0" -#define STAT_BP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x10" "BP\0" \ - "f\x00\x10" "CNT\0" -#define TX_CLK_MSKN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x00" "MSK\0" -#define RX_TX_STATUS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x04\x03" "TX\0" \ - "f\x00\x03" "RX\0" -#define INF_MODE_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x02" "P0MII\0" \ - "b\x01" "EN\0" \ - "b\x00" "TYPE\0" - -#define GMX0_RX0_INT_REG_BITS RXN_INT_REG_BITS -#define GMX0_RX0_INT_EN_BITS RXN_INT_EN_BITS -#define GMX0_PRT0_CFG_BITS PRTN_CFG_BITS -#define GMX0_RX0_FRM_CTL_BITS RXN_FRM_CTL_BITS -#define GMX0_RX0_FRM_CHK_BITS RXN_FRM_CHK_BITS -#define GMX0_RX0_FRM_MIN_BITS NULL//RXN_FRM_MIN_BITS -#define GMX0_RX0_FRM_MAX_BITS NULL//RXN_FRM_MAX_BITS -#define GMX0_RX0_JABBER_BITS RXN_JABBER_BITS -#define GMX0_RX0_DECISION_BITS RXN_DECISION_BITS -#define GMX0_RX0_UDD_SKP_BITS RXN_UDD_SKP_BITS -#define GMX0_RX0_STATS_CTL_BITS RXN_STATS_CTL_BITS -#define GMX0_RX0_IFG_BITS RXN_IFG_BITS -#define GMX0_RX0_RX_INBND_BITS RXN_RX_INBND_BITS -#define GMX0_RX0_STATS_PKTS_BITS RXN_STATS_PKTS_BITS -#define GMX0_RX0_STATS_OCTS_BITS RXN_STATS_OCTS_BITS -#define GMX0_RX0_STATS_PKTS_CTL_BITS RXN_STATS_PKTS_CTL_BITS -#define GMX0_RX0_STATS_OCTS_CTL_BITS RXN_STATS_OCTS_CTL_BITS -#define GMX0_RX0_STATS_PKTS_DMAC_BITS RXN_STATS_PKTS_DMAC_BITS -#define GMX0_RX0_STATS_OCTS_DMAC_BITS RXN_STATS_OCTS_DMAC_BITS -#define GMX0_RX0_STATS_PKTS_DRP_BITS RXN_STATS_PKTS_DRP_BITS -#define GMX0_RX0_STATS_OCTS_DRP_BITS RXN_STATS_OCTS_DRP_BITS -#define GMX0_RX0_STATS_PKTS_BAD_BITS RXN_STATS_PKTS_BAD_BITS -#define GMX0_RX0_ADR_CTL_BITS RXN_ADR_CTL_BITS -#define GMX0_RX0_ADR_CAM_EN_BITS RXN_ADR_CAM_EN_BITS -#define GMX0_RX0_ADR_CAM0_BITS NULL//RXN_ADR_CAM0_BITS -#define GMX0_RX0_ADR_CAM1_BITS NULL//RXN_ADR_CAM1_BITS -#define GMX0_RX0_ADR_CAM2_BITS NULL//RXN_ADR_CAM2_BITS -#define GMX0_RX0_ADR_CAM3_BITS NULL//RXN_ADR_CAM3_BITS -#define GMX0_RX0_ADR_CAM4_BITS NULL//RXN_ADR_CAM4_BITS -#define GMX0_RX0_ADR_CAM5_BITS NULL//RXN_ADR_CAM5_BITS -#define GMX0_TX0_CLK_BITS TXN_CLK_BITS -#define GMX0_TX0_THRESH_BITS TXN_THRESH_BITS -#define GMX0_TX0_APPEND_BITS TXN_APPEND_BITS -#define GMX0_TX0_SLOT_BITS TXN_SLOT_BITS -#define GMX0_TX0_BURST_BITS TXN_BURST_BITS -#define GMX0_SMAC0_BITS NULL//SMAC0_BITS -#define GMX0_TX0_PAUSE_PKT_TIME_BITS TXN_PAUSE_PKT_TIME_BITS -#define GMX0_TX0_MIN_PKT_BITS TXN_MIN_PKT_BITS -#define GMX0_TX0_PAUSE_PKT_INTERVAL_BITS TXN_PAUSE_PKT_INTERVAL_BITS -#define GMX0_TX0_SOFT_PAUSE_BITS TXN_SOFT_PAUSE_BITS -#define GMX0_TX0_PAUSE_TOGO_BITS TXN_PAUSE_TOGO_BITS -#define GMX0_TX0_PAUSE_ZERO_BITS TXN_PAUSE_ZERO_BITS -#define GMX0_TX0_STATS_CTL_BITS TXN_STATS_CTL_BITS -#define GMX0_TX0_CTL_BITS TXN_CTL_BITS -#define GMX0_TX0_STAT0_BITS TXN_STAT0_BITS -#define GMX0_TX0_STAT1_BITS TXN_STAT1_BITS -#define GMX0_TX0_STAT2_BITS TXN_STAT2_BITS -#define GMX0_TX0_STAT3_BITS TXN_STAT3_BITS -#define GMX0_TX0_STAT4_BITS TXN_STAT4_BITS -#define GMX0_TX0_STAT5_BITS TXN_STAT5_BITS -#define GMX0_TX0_STAT6_BITS TXN_STAT6_BITS -#define GMX0_TX0_STAT7_BITS TXN_STAT7_BITS -#define GMX0_TX0_STAT8_BITS TXN_STAT8_BITS -#define GMX0_TX0_STAT9_BITS TXN_STAT9_BITS -#define GMX0_BIST0_BITS NULL//BIST0_BITS -#define GMX0_RX_PRTS_BITS RX_PRTS_BITS -#define GMX0_RX_BP_DROP0_BITS RX_BP_DROPN_BITS -#define GMX0_RX_BP_ON0_BITS RX_BP_ONN_BITS -#define GMX0_RX_BP_OFF0_BITS RX_BP_OFFN_BITS -#define GMX0_RX_BP_DROP1_BITS RX_BP_DROPN_BITS -#define GMX0_RX_BP_ON1_BITS RX_BP_ONN_BITS -#define GMX0_RX_BP_OFF1_BITS RX_BP_OFFN_BITS -#define GMX0_RX_BP_DROP2_BITS RX_BP_DROPN_BITS -#define GMX0_RX_BP_ON2_BITS RX_BP_ONN_BITS -#define GMX0_RX_BP_OFF2_BITS RX_BP_OFFN_BITS -#define GMX0_TX_PRTS_BITS TX_PRTS_BITS -#define GMX0_TX_IFG_BITS TX_IFG_BITS -#define GMX0_TX_JAM_BITS TX_JAM_BITS -#define GMX0_TX_COL_ATTEMPT_BITS TX_COL_ATTEMPT_BITS -#define GMX0_TX_PAUSE_PKT_DMAC_BITS TX_PAUSE_PKT_DMAC_BITS -#define GMX0_TX_PAUSE_PKT_TYPE_BITS TX_PAUSE_PKT_TYPE_BITS -#define GMX0_TX_OVR_BP_BITS TX_OVR_BP_BITS -#define GMX0_TX_BP_BITS TX_BP_BITS -#define GMX0_TX_CORRUPT_BITS TX_CORRUPT_BITS -#define GMX0_RX_PRT_INFO_BITS RX_PRT_INFO_BITS -#define GMX0_TX_LFSR_BITS TX_LFSR_BITS -#define GMX0_TX_INT_REG_BITS TX_INT_REG_BITS -#define GMX0_TX_INT_EN_BITS TX_INT_EN_BITS -#define GMX0_NXA_ADR_BITS NXA_ADR_BITS -#define GMX0_BAD_REG_BITS BAD_REG_BITS -#define GMX0_STAT_BP_BITS STAT_BP_BITS -#define GMX0_TX_CLK_MSK0_BITS TX_CLK_MSKN_BITS -#define GMX0_TX_CLK_MSK1_BITS TX_CLK_MSKN_BITS -#define GMX0_TX_CLK_MSK2_BITS TX_CLK_MSKN_BITS -#define GMX0_RX_TX_STATUS_BITS RX_TX_STATUS_BITS -#define GMX0_INF_MODE_BITS INF_MODE_BITS - #endif /* _CN30XXGMXREG_H_ */ diff --git a/sys/arch/octeon/dev/cn30xxgmxvar.h b/sys/arch/octeon/dev/cn30xxgmxvar.h index 3dbb8e88e92..1c49a09bdc6 100644 --- a/sys/arch/octeon/dev/cn30xxgmxvar.h +++ b/sys/arch/octeon/dev/cn30xxgmxvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxgmxvar.h,v 1.2 2013/09/16 20:52:14 jmatthew Exp $ */ +/* $OpenBSD: cn30xxgmxvar.h,v 1.3 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -60,7 +60,6 @@ }; #endif -#if 1 struct cn30xxgmx_softc; struct cn30xxgmx_port_softc; @@ -79,32 +78,6 @@ struct cn30xxgmx_port_softc { struct cn30xxasx_softc *sc_port_asx; struct cn30xxipd_softc *sc_ipd; int sc_port_flowflags; - -#if defined(OCTEON_DEBUG) || defined(OCTEON_ETH_DEBUG) -#if 0 - /* XXX */ - struct evcnt sc_ev_pausedrp; - struct evcnt sc_ev_phydupx; - struct evcnt sc_ev_physpd; - struct evcnt sc_ev_phylink; -#endif - struct evcnt sc_ev_ifgerr; - struct evcnt sc_ev_coldet; - struct evcnt sc_ev_falerr; - struct evcnt sc_ev_rcverr; - struct evcnt sc_ev_rsverr; - struct evcnt sc_ev_pckterr; - struct evcnt sc_ev_ovrerr; - struct evcnt sc_ev_niberr; - struct evcnt sc_ev_skperr; - struct evcnt sc_ev_lenerr; - struct evcnt sc_ev_alnerr; - struct evcnt sc_ev_fcserr; - struct evcnt sc_ev_jabber; - struct evcnt sc_ev_maxerr; - struct evcnt sc_ev_carext; - struct evcnt sc_ev_minerr; -#endif }; struct cn30xxgmx_softc { @@ -118,16 +91,8 @@ struct cn30xxgmx_softc { struct cn30xxgmx_port_softc *sc_ports; - -#if defined(OCTEON_DEBUG) || defined(OCTEON_ETH_DEBUG) - struct evcnt sc_ev_latecol; - struct evcnt sc_ev_xsdef; - struct evcnt sc_ev_xscol; - struct evcnt sc_ev_undflw; - struct evcnt sc_ev_pkonxa; -#endif }; -#endif + struct cn30xxgmx_attach_args { bus_space_tag_t ga_regt; diff --git a/sys/arch/octeon/dev/cn30xxipd.c b/sys/arch/octeon/dev/cn30xxipd.c index c0d632629da..ee059a047f7 100644 --- a/sys/arch/octeon/dev/cn30xxipd.c +++ b/sys/arch/octeon/dev/cn30xxipd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxipd.c,v 1.4 2014/07/22 10:35:35 mpi Exp $ */ +/* $OpenBSD: cn30xxipd.c,v 1.5 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -45,17 +45,12 @@ ((caddr_t)(data) + ((word2 & PIP_WQE_WORD2_IP_OFFSET) >> PIP_WQE_WORD2_IP_OFFSET_SHIFT)) #ifdef OCTEON_ETH_DEBUG -void cn30xxipd_intr_evcnt_attach(struct cn30xxipd_softc *); -void cn30xxipd_intr_rml(void *); -int cn30xxipd_intr_drop(void *); +void cn30xxipd_intr_rml(void *); +int cn30xxipd_intr_drop(void *); -void cn30xxipd_dump(void); +void cn30xxipd_dump(void); -static void *cn30xxipd_intr_drop_ih; -struct evcnt cn30xxipd_intr_drop_evcnt = - EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "octeon", - "ipd drop intr"); -EVCNT_ATTACH_STATIC(cn30xxipd_intr_drop_evcnt); +void *cn30xxipd_intr_drop_ih; struct cn30xxipd_softc *__cn30xxipd_softc[3/* XXX */]; #endif @@ -86,11 +81,10 @@ cn30xxipd_init(struct cn30xxipd_attach_args *aa, #ifdef OCTEON_ETH_DEBUG cn30xxipd_int_enable(sc, 1); - cn30xxipd_intr_evcnt_attach(sc); if (cn30xxipd_intr_drop_ih == NULL) cn30xxipd_intr_drop_ih = octeon_intr_establish( - ffs64(CIU_INTX_SUM0_IPD_DRP) - 1, 0, IPL_NET, - cn30xxipd_intr_drop, NULL); + ffs64(CIU_INTX_SUM0_IPD_DRP) - 1, IPL_NET, + cn30xxipd_intr_drop, NULL, "cn30xxipd"); __cn30xxipd_softc[sc->sc_port] = sc; #endif /* OCTEON_ETH_DEBUG */ } @@ -234,32 +228,13 @@ cn30xxipd_sub_port_fcs(struct cn30xxipd_softc *sc, int enable) } #ifdef OCTEON_ETH_DEBUG -int cn30xxipd_intr_rml_verbose; -struct evcnt cn30xxipd_intr_evcnt; - -static const struct octeon_evcnt_entry cn30xxipd_intr_evcnt_entries[] = { -#define _ENTRY(name, type, parent, descr) \ - OCTEON_EVCNT_ENTRY(struct cn30xxipd_softc, name, type, parent, descr) - _ENTRY(ipdbpsub, MISC, NULL, "ipd backpressure subtract"), - _ENTRY(ipdprcpar3, MISC, NULL, "ipd parity error 127:96"), - _ENTRY(ipdprcpar2, MISC, NULL, "ipd parity error 95:64"), - _ENTRY(ipdprcpar1, MISC, NULL, "ipd parity error 63:32"), - _ENTRY(ipdprcpar0, MISC, NULL, "ipd parity error 31:0"), -#undef _ENTRY -}; - -void -cn30xxipd_intr_evcnt_attach(struct cn30xxipd_softc *sc) -{ - OCTEON_EVCNT_ATTACH_EVCNTS(sc, cn30xxipd_intr_evcnt_entries, "ipd0"); -} +int cn30xxipd_intr_rml_verbose; void cn30xxipd_intr_rml(void *arg) { int i; - cn30xxipd_intr_evcnt.ev_count++; for (i = 0; i < 3/* XXX */; i++) { struct cn30xxipd_softc *sc; uint64_t reg; @@ -268,17 +243,7 @@ cn30xxipd_intr_rml(void *arg) KASSERT(sc != NULL); reg = cn30xxipd_int_summary(sc); if (cn30xxipd_intr_rml_verbose) - printf("%s: IPD_INT_SUM=0x%016" PRIx64 "\n", __func__, reg); - if (reg & IPD_INT_SUM_BP_SUB) - OCTEON_EVCNT_INC(sc, ipdbpsub); - if (reg & IPD_INT_SUM_PRC_PAR3) - OCTEON_EVCNT_INC(sc, ipdprcpar3); - if (reg & IPD_INT_SUM_PRC_PAR2) - OCTEON_EVCNT_INC(sc, ipdprcpar2); - if (reg & IPD_INT_SUM_PRC_PAR1) - OCTEON_EVCNT_INC(sc, ipdprcpar1); - if (reg & IPD_INT_SUM_PRC_PAR0) - OCTEON_EVCNT_INC(sc, ipdprcpar0); + printf("%s: IPD_INT_SUM=0x%016llx\n", __func__, reg); } } @@ -311,19 +276,17 @@ int cn30xxipd_intr_drop(void *arg) { octeon_xkphys_write_8(CIU_INT0_SUM0, CIU_INTX_SUM0_IPD_DRP); - cn30xxipd_intr_drop_evcnt.ev_count++; return (1); } -#define _ENTRY(x) { #x, x##_BITS, x##_OFFSET } +#define _ENTRY(x) { #x, x##_OFFSET } struct cn30xxipd_dump_reg { const char *name; - const char *format; size_t offset; }; -static const struct cn30xxipd_dump_reg cn30xxipd_dump_regs[] = { +const struct cn30xxipd_dump_reg cn30xxipd_dump_regs[] = { _ENTRY(IPD_1ST_MBUFF_SKIP), _ENTRY(IPD_NOT_1ST_MBUFF_SKIP), _ENTRY(IPD_PACKET_MBUFF_SIZE), @@ -378,19 +341,13 @@ cn30xxipd_dump(void) struct cn30xxipd_softc *sc; const struct cn30xxipd_dump_reg *reg; uint64_t tmp; - char buf[512]; 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); - if (reg->format == NULL) { - snprintf(buf, sizeof(buf), "%16" PRIx64, tmp); - } else { - bitmask_snprintf(tmp, reg->format, buf, sizeof(buf)); - } - printf("%-32s: %s\n", reg->name, buf); + printf("%-32s: %16llx\n", reg->name, tmp); } } #endif /* OCTEON_ETH_DEBUG */ diff --git a/sys/arch/octeon/dev/cn30xxipdreg.h b/sys/arch/octeon/dev/cn30xxipdreg.h index 5977d0ffec1..0b7aa9b2b38 100644 --- a/sys/arch/octeon/dev/cn30xxipdreg.h +++ b/sys/arch/octeon/dev/cn30xxipdreg.h @@ -3,7 +3,7 @@ * DONT EDIT THIS FILE */ -/* $OpenBSD: cn30xxipdreg.h,v 1.1 2011/06/16 11:22:30 syuu Exp $ */ +/* $OpenBSD: cn30xxipdreg.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -437,351 +437,4 @@ #define IPD_WQE_L4_SYN_RST 12 #define IPD_WQE_L4_SYN_FIN 13 -#define IPD_1ST_MBUFF_SKIP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x06\x3a" "63_6\0" \ - "f\x00\x06" "SZ\0" -#define IPD_NOT_1ST_MBUFF_SKIP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x06\x3a" "63_6\0" \ - "f\x00\x06" "SZ\0" -#define IPD_PACKET_MBUFF_SIZE_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x0c\x34" "63_12\0" \ - "f\x00\x0c" "MB_SIZE\0" -#define IPD_CTL_STATUS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x0a\x36" "63_10\0" \ - "b\x09" "LEN_M8\0" \ - "b\x08" "RESET\0" \ - "b\x07" "ADDPKT\0" \ - "b\x06" "NADDBUF\0" \ - "b\x05" "PKT_LEND\0" \ - "b\x04" "WQE_LEND\0" \ - "b\x03" "PBP_EN\0" \ - "f\x01\x02" "OPC_MODE\0" \ - "b\x00" "IPD_EN\0" -#define IPD_WQE_FPA_QUEUE_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x03\x3d" "63_3\0" \ - "f\x00\x03" "WQE_QUE\0" -#define IPD_PORT0_BP_PAGE_CNT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_PORT1_BP_PAGE_CNT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_PORT2_BP_PAGE_CNT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_PORT32_BP_PAGE_CNT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_SUB_PORT_BP_PAGE_CNT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x1f\x21" "63_18\0" \ - "f\x19\x06" "PORT\0" \ - "f\x00\x19" "PAGE_CNT\0" -#define IPD_1ST_NEXT_PTR_BACK_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x04\x3c" "63_4\0" \ - "f\x00\x04" "BACK\0" -#define IPD_2ND_NEXT_PTR_BACK_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x04\x3c" "63_4\0" \ - "f\x00\x04" "BACK\0" -#define IPD_INT_ENB_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x05\x3b" "63_4\0" \ - "b\x04" "BP_SUB\0" \ - "b\x03" "PRC_PAR3\0" \ - "b\x02" "PRC_PAR2\0" \ - "b\x01" "PRC_PAR1\0" \ - "b\x00" "PRC_PAR0\0" -#define IPD_INT_SUM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x05\x3b" "63_4\0" \ - "b\x04" "BP_SUB\0" \ - "b\x03" "PRC_PAR3\0" \ - "b\x02" "PRC_PAR2\0" \ - "b\x01" "PRC_PAR1\0" \ - "b\x00" "PRC_PAR0\0" -#define IPD_SUB_PORT_FCS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x03\x3d" "63_3\0" \ - "f\x00\x03" "PORT_BIT\0" -#define IPD_QOS0_RED_MARKS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_QOS1_RED_MARKS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_QOS2_RED_MARKS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_QOS3_RED_MARKS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_QOS4_RED_MARKS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_QOS5_RED_MARKS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_QOS6_RED_MARKS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_QOS7_RED_MARKS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_PORT_BP_COUNTERS_PAIR0_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_PORT_BP_COUNTERS_PAIR1_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_PORT_BP_COUNTERS_PAIR2_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_PORT_BP_COUNTERS_PAIR32_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_RED_PORT_ENABLE_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x32\x0e" "PRB_DLY\0" \ - "f\x24\x0e" "AVG_DLY\0" \ - "f\x00\x24" "PRT_ENB\0" -#define IPD_RED_QUE0_PARAM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_RED_QUE1_PARAM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_RED_QUE2_PARAM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_RED_QUE3_PARAM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_RED_QUE4_PARAM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_RED_QUE5_PARAM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_RED_QUE6_PARAM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_RED_QUE7_PARAM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define IPD_PTR_COUNT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x13\x2d" "63_19\0" \ - "b\x12" "PKTV_CNT\0" \ - "b\x11" "WQEV_CNT\0" \ - "f\x0e\x03" "PFIF_CNT\0" \ - "f\x07\x07" "PKT_PCNT\0" \ - "f\x00\x07" "WQE_PCNT\0" -#define IPD_BP_PRT_RED_END_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x24\x1c" "63_36\0" \ - "f\x00\x24" "PRT_ENB\0" -#define IPD_QUE0_FREE_PAGE_CNT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "63_32\0" \ - "f\x00\x20" "Q0_PCNT\0" -#define IPD_CLK_COUNT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x40" "CLK_CNT\0" -#define IPD_PWP_PTR_FIFO_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x3d\x03" "63_61\0" \ - "f\x36\x07" "MAX_CNTS\0" \ - "f\x2e\x08" "WRADDR\0" \ - "f\x26\x08" "PRADDR\0" \ - "f\x09\x1d" "PTR\0" \ - "b\x08" "CENA\0" \ - "f\x00\x08" "RADDR\0" -#define IPD_PRC_HOLD_PTR_FIFO_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x27\x19" "63_39\0" \ - "f\x24\x03" "MAX_PTR\0" \ - "f\x21\x03" "PRADDR\0" \ - "f\x04\x1d" "PTR\0" \ - "b\x03" "CENA\0" \ - "f\x00\x03" "RADDR\0" -#define IPD_PRC_PORT_PTR_FIFO_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x2c\x14" "63_44\0" \ - "f\x25\x07" "MAX_PTR\0" \ - "f\x08\x1d" "PTR\0" \ - "b\x07" "CENA\0" \ - "f\x00\x07" "RADDR\0" -#define IPD_PKT_PTR_VALID_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x1d\x23" "63_29\0" \ - "f\x00\x1d" "PTR\0" -#define IPD_WQE_PTR_VALID_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x1d\x23" "63_29\0" \ - "f\x00\x1d" "PTR\0" -#define IPD_BIST_STATUS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x10\x30" "63_29\0" \ - "b\x0f" "PWQ_WQED\0" \ - "b\x0e" "PWQ_WP1\0" \ - "b\x0d" "PWQ_POW\0" \ - "b\x0c" "IPQ_PBE1\0" \ - "b\x0b" "IPQ_PBE0\0" \ - "b\x0a" "PBM3\0" \ - "b\x09" "PBM2\0" \ - "b\x08" "PBM1\0" \ - "b\x07" "PBM0\0" \ - "b\x06" "PBM_WORD\0" \ - "b\x05" "PWQ1\0" \ - "b\x04" "PWQ0\0" \ - "b\x03" "PRC_OFF\0" \ - "b\x02" "IPD_OLD\0" \ - "b\x01" "IPD_NEW\0" \ - "b\x00" "PWP\0" - #endif /* _CN30XXIPDREG_H_ */ diff --git a/sys/arch/octeon/dev/cn30xxipdvar.h b/sys/arch/octeon/dev/cn30xxipdvar.h index 6808bc17ab1..1bb1b4b7cce 100644 --- a/sys/arch/octeon/dev/cn30xxipdvar.h +++ b/sys/arch/octeon/dev/cn30xxipdvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxipdvar.h,v 1.2 2011/06/24 02:13:23 yasuoka Exp $ */ +/* $OpenBSD: cn30xxipdvar.h,v 1.3 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -36,13 +36,6 @@ struct cn30xxipd_softc { bus_space_handle_t sc_regh; size_t sc_first_mbuff_skip; size_t sc_not_first_mbuff_skip; -#ifdef OCTEON_ETH_DEBUG - struct evcnt sc_ev_ipdbpsub; - struct evcnt sc_ev_ipdprcpar3; - struct evcnt sc_ev_ipdprcpar2; - struct evcnt sc_ev_ipdprcpar1; - struct evcnt sc_ev_ipdprcpar0; -#endif }; /* XXX */ @@ -61,11 +54,9 @@ void cn30xxipd_sub_port_fcs(struct cn30xxipd_softc *, int); void cn30xxipd_offload(uint64_t, caddr_t, uint16_t *); #ifdef OCTEON_ETH_DEBUG -void cn30xxipd_int_enable(struct cn30xxipd_softc *, int); -uint64_t cn30xxipd_int_summary(struct cn30xxipd_softc *); -#endif /* OCTEON_ETH_DEBUG */ -#ifdef OCTEON_ETH_DEBUG -void cn30xxipd_int_enable(struct cn30xxipd_softc *, int); +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 diff --git a/sys/arch/octeon/dev/cn30xxpip.c b/sys/arch/octeon/dev/cn30xxpip.c index 5c3e1742a0d..a6ec1bae603 100644 --- a/sys/arch/octeon/dev/cn30xxpip.c +++ b/sys/arch/octeon/dev/cn30xxpip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxpip.c,v 1.2 2011/06/24 02:13:23 yasuoka Exp $ */ +/* $OpenBSD: cn30xxpip.c,v 1.3 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -42,17 +42,16 @@ #ifdef OCTEON_ETH_DEBUG struct cn30xxpip_softc *__cn30xxpip_softc; -void cn30xxpip_intr_evcnt_attach(struct cn30xxpip_softc *); -void cn30xxpip_intr_rml(void *); +void cn30xxpip_intr_rml(void *); -void cn30xxpip_dump(void); -void cn30xxpip_int_enable(struct cn30xxpip_softc *, int); +void cn30xxpip_dump(void); +void cn30xxpip_int_enable(struct cn30xxpip_softc *, int); #endif /* - * register definitions (for debug and statics) + * register definitions */ -#define _ENTRY(x) { #x, x##_BITS, x##_OFFSET } +#define _ENTRY(x) { #x, x##_OFFSET } #define _ENTRY_0_3(x) \ _ENTRY(x## 0), _ENTRY(x## 1), _ENTRY(x## 2), _ENTRY(x## 3) #define _ENTRY_0_7(x) \ @@ -63,11 +62,10 @@ void cn30xxpip_int_enable(struct cn30xxpip_softc *, int); struct cn30xxpip_dump_reg_ { const char *name; - const char *format; size_t offset; }; -static const struct cn30xxpip_dump_reg_ cn30xxpip_dump_stats_[] = { +const struct cn30xxpip_dump_reg_ cn30xxpip_dump_stats_[] = { /* PIP_QOS_DIFF[0-63] */ _ENTRY_0_1_2_32 (PIP_STAT0_PRT), _ENTRY_0_1_2_32 (PIP_STAT1_PRT), @@ -85,7 +83,7 @@ static const struct cn30xxpip_dump_reg_ cn30xxpip_dump_stats_[] = { _ENTRY_0_1_2_32 (PIP_STAT_INB_ERRS), }; -static const struct cn30xxpip_dump_reg_ cn30xxpip_dump_regs_[] = { +const struct cn30xxpip_dump_reg_ cn30xxpip_dump_regs_[] = { _ENTRY (PIP_BIST_STATUS), _ENTRY (PIP_INT_REG), _ENTRY (PIP_INT_EN), @@ -135,7 +133,6 @@ cn30xxpip_init(struct cn30xxpip_attach_args *aa, #ifdef OCTEON_ETH_DEBUG cn30xxpip_int_enable(sc, 1); - cn30xxpip_intr_evcnt_attach(sc); __cn30xxpip_softc = sc; printf("PIP Code initialized.\n"); #endif @@ -243,26 +240,7 @@ cn30xxpip_stats(struct cn30xxpip_softc *sc, struct ifnet *ifp, int gmx_port) #ifdef OCTEON_ETH_DEBUG -int cn30xxpip_intr_rml_verbose; -struct evcnt cn30xxpip_intr_evcnt; - -static const struct octeon_evcnt_entry cn30xxpip_intr_evcnt_entries[] = { -#define _ENTRY(name, type, parent, descr) \ - OCTEON_EVCNT_ENTRY(struct cn30xxpip_softc, name, type, parent, descr) - _ENTRY(pipbeperr, MISC, NULL, "pip parity error backend"), - _ENTRY(pipfeperr, MISC, NULL, "pip parity error frontend"), - _ENTRY(pipskprunt, MISC, NULL, "pip skiper"), - _ENTRY(pipbadtag, MISC, NULL, "pip bad tag"), - _ENTRY(pipprtnxa, MISC, NULL, "pip nonexistent port"), - _ENTRY(pippktdrp, MISC, NULL, "pip qos drop"), -#undef _ENTRY -}; - -void -cn30xxpip_intr_evcnt_attach(struct cn30xxpip_softc *sc) -{ - OCTEON_EVCNT_ATTACH_EVCNTS(sc, cn30xxpip_intr_evcnt_entries, "pip0"); -} +int cn30xxpip_intr_rml_verbose; void cn30xxpip_intr_rml(void *arg) @@ -270,28 +248,15 @@ cn30xxpip_intr_rml(void *arg) struct cn30xxpip_softc *sc; uint64_t reg; - cn30xxpip_intr_evcnt.ev_count++; 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); - if (reg & PIP_INT_REG_BEPERR) - OCTEON_EVCNT_INC(sc, pipbeperr); - if (reg & PIP_INT_REG_FEPERR) - OCTEON_EVCNT_INC(sc, pipfeperr); - if (reg & PIP_INT_REG_SKPRUNT) - OCTEON_EVCNT_INC(sc, pipskprunt); - if (reg & PIP_INT_REG_BADTAG) - OCTEON_EVCNT_INC(sc, pipbadtag); - if (reg & PIP_INT_REG_PRTNXA) - OCTEON_EVCNT_INC(sc, pipprtnxa); - if (reg & PIP_INT_REG_PKTDRP) - OCTEON_EVCNT_INC(sc, pippktdrp); } -void cn30xxpip_dump_regs(void); -void cn30xxpip_dump_stats(void); +void cn30xxpip_dump_regs(void); +void cn30xxpip_dump_stats(void); void cn30xxpip_dump(void) @@ -306,14 +271,12 @@ cn30xxpip_dump_regs(void) struct cn30xxpip_softc *sc = __cn30xxpip_softc; const struct cn30xxpip_dump_reg_ *reg; uint64_t tmp; - char buf[512]; int i; for (i = 0; i < (int)nitems(cn30xxpip_dump_regs_); i++) { reg = &cn30xxpip_dump_regs_[i]; tmp = _PIP_RD8(sc, reg->offset); - snprintf(buf, sizeof(buf), "%16llx", tmp); - printf("\t%-24s: %s\n", reg->name, buf); + printf("\t%-24s: %16llx\n", reg->name, tmp); } } @@ -323,7 +286,6 @@ cn30xxpip_dump_stats(void) struct cn30xxpip_softc *sc = __cn30xxpip_softc; const struct cn30xxpip_dump_reg_ *reg; uint64_t tmp; - char buf[512]; int i; uint64_t pip_stat_ctl; @@ -332,27 +294,22 @@ cn30xxpip_dump_stats(void) for (i = 0; i < (int)nitems(cn30xxpip_dump_stats_); i++) { reg = &cn30xxpip_dump_stats_[i]; tmp = _PIP_RD8(sc, reg->offset); - if (reg->format == NULL) { - snprintf(buf, sizeof(buf), "%16llx", tmp); - } - printf("\t%-24s: %s\n", reg->name, buf); + 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); - snprintf(buf, sizeof(buf), "%16" PRIx64, tmp); - printf("%s\t%s%s", + printf("%s\t%16llx%s", ((i % 4) == 0) ? "\t" : "", - buf, + 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); - snprintf(buf, sizeof(buf), "%16" PRIx64, tmp); - printf("%s\t%s%s", + printf("%s\t%16llx%s", ((i % 4) == 0) ? "\t" : "", - buf, + tmp, ((i % 4) == 3) ? "\n" : ""); } _PIP_WR8(sc, PIP_STAT_CTL_OFFSET, pip_stat_ctl); diff --git a/sys/arch/octeon/dev/cn30xxpipreg.h b/sys/arch/octeon/dev/cn30xxpipreg.h index 9b6964c5998..32ba5ba12ee 100644 --- a/sys/arch/octeon/dev/cn30xxpipreg.h +++ b/sys/arch/octeon/dev/cn30xxpipreg.h @@ -3,7 +3,7 @@ * DONT EDIT THIS FILE */ -/* $OpenBSD: cn30xxpipreg.h,v 1.1 2011/06/16 11:22:30 syuu Exp $ */ +/* $OpenBSD: cn30xxpipreg.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -620,368 +620,4 @@ #define PIP_GMX_FCS_ERR PIP_WQE_WORD2_RE_OPCODE_GMXFCS #define PIP_ALIGN_ERR PIP_WQE_WORD2_RE_OPCODE_ALIGN -#define PIP_BIST_STATUS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x12\x2e" "63_13\0" \ - "f\x00\x12" "BIST\0" -#define PIP_INT_REG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x09\x37" "63_9\0" \ - "b\x08" "BEPERR\0" \ - "b\x07" "FEPERR\0" \ - "b\x06" "6\0" \ - "b\x05" "SKPRUNT\0" \ - "b\x04" "BADTAG\0" \ - "b\x03" "PRTNXA\0" \ - "f\x01\x02" "2_1\0" \ - "b\x00" "PKTDRP\0" -#define PIP_INT_EN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x09\x37" "63_9\0" \ - "b\x08" "BEPERR\0" \ - "b\x07" "FEPERR\0" \ - "b\x06" "6\0" \ - "b\x05" "SKPRUNT\0" \ - "b\x04" "BADTAG\0" \ - "b\x03" "PRTNXA\0" \ - "f\x01\x02" "2_1\0" \ - "b\x00" "PKTDRP\0" -#define PIP_STAT_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x01\x3f" "63_1\0" \ - "b\x00" "RDCLR\0" -#define PIP_GBL_CTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x11\x2f" "63_17\0" \ - "b\x10" "IGNRS\0" \ - "b\x0f" "VS_WQE\0" \ - "b\x0e" "VS_QOS\0" \ - "b\x0d" "L2MAL\0" \ - "b\x0c" "TCP_FLAG\0" \ - "b\x0b" "L4_LEN\0" \ - "b\x0a" "L4_CHK\0" \ - "b\x09" "L4_PRT\0" \ - "b\x08" "L4_MAL\0" \ - "f\x06\x02" "7_6\0" \ - "f\x04\x02" "IP6_EEXT\0" \ - "b\x03" "IP4_OPTS\0" \ - "b\x02" "IP_HOP\0" \ - "b\x01" "IP_MAL\0" \ - "b\x00" "IP_CHK\0" -#define PIP_GBL_CFG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x13\x2d" "63_19\0" \ - "b\x12" "TAG_SYN\0" \ - "b\x11" "IP6_UDP\0" \ - "b\x10" "MAX_L2\0" \ - "f\x0b\x05" "15_11\0" \ - "f\x08\x03" "RAW_SHF\0" \ - "f\x03\x05" "7_3\0" \ - "f\x00\x03" "NIP_SHF\0" -#define PIP_SOFT_RST_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define PIP_IP_OFFSET_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x03\x3d" "63_3\0" \ - "f\x00\x03" "MASK_OFFSET\0" -#define PIP_TAG_SECRET_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "63_3\0" \ - "f\x10\x10" "DST\0" \ - "f\x00\x10" "SRC\0" -#define PIP_TAG_MASK_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x10\x30" "63_16\0" \ - "f\x00\x10" "MASK\0" -#define PIP_DEC_IPSECN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x12\x2e" "63_18\0" \ - "b\x11" "TCP\0" \ - "b\x10" "UDP\0" \ - "f\x00\x10" "DPRT\0" -#define PIP_DEC_IPSEC0_BITS PIP_DEC_IPSECN_BITS -#define PIP_DEC_IPSEC1_BITS PIP_DEC_IPSECN_BITS -#define PIP_DEC_IPSEC2_BITS PIP_DEC_IPSECN_BITS -#define PIP_DEC_IPSEC3_BITS PIP_DEC_IPSECN_BITS -#define PIP_RAW_WORD_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x38\x08" "63_56\0" \ - "f\x00\x38" "WORD\0" -#define PIP_QOS_VLANN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define PIP_QOS_VLAN0_BITS PIP_QOS_VLANN_BITS -#define PIP_QOS_VLAN1_BITS PIP_QOS_VLANN_BITS -#define PIP_QOS_VLAN2_BITS PIP_QOS_VLANN_BITS -#define PIP_QOS_VLAN3_BITS PIP_QOS_VLANN_BITS -#define PIP_QOS_VLAN4_BITS PIP_QOS_VLANN_BITS -#define PIP_QOS_VLAN5_BITS PIP_QOS_VLANN_BITS -#define PIP_QOS_VLAN6_BITS PIP_QOS_VLANN_BITS -#define PIP_QOS_VLAN7_BITS PIP_QOS_VLANN_BITS -#define PIP_QOS_WATCHN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x30\x10" "63_48\0" \ - "f\x20\x10" "MASK\0" \ - "f\x1c\x04" "31_28\0" \ - "f\x18\x04" "GRP\0" \ - "b\x17" "23\0" \ - "f\x14\x03" "WATCHER\0" \ - "f\x12\x02" "19_18\0" \ - "f\x10\x02" "TYPE\0" \ - "f\x00\x10" "15_0\0" -#define PIP_QOS_WATCH0_BITS PIP_QOS_WATCHN_BITS -#define PIP_QOS_WATCH1_BITS PIP_QOS_WATCHN_BITS -#define PIP_QOS_WATCH2_BITS PIP_QOS_WATCHN_BITS -#define PIP_QOS_WATCH3_BITS PIP_QOS_WATCHN_BITS -#define PIP_PRT_CFGN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x25\x1b" "63_37\0" \ - "b\x24" "RAWDRP\0" \ - "f\x22\x02" "TAG_INC\0" \ - "b\x21" "DYN_RS\0" \ - "b\x20" "INST_HDR\0" \ - "f\x1c\x04" "GRP_WAT\0" \ - "b\x1b" "27\0" \ - "f\x18\x03" "QOS\0" \ - "f\x14\x04" "QOS_WAT\0" \ - "b\x13" "19\0" \ - "b\x12" "SPARE\0" \ - "b\x11" "QOS_DIFF\0" \ - "b\x10" "QOS_VLAN\0" \ - "f\x0d\x03" "15_13\0" \ - "b\x0c" "CRC_EN\0" \ - "f\x0a\x02" "11_10\0" \ - "f\x08\x02" "MODE\0" \ - "b\x07" "7\0" \ - "f\x00\x07" "SKIP\0" -#define PIP_PRT_CFG0_BITS PIP_PRT_CFGN_BITS -#define PIP_PRT_CFG1_BITS PIP_PRT_CFGN_BITS -#define PIP_PRT_CFG2_BITS PIP_PRT_CFGN_BITS -#define PIP_PRT_CFG32_BITS PIP_PRT_CFGN_BITS -#define PIP_PRT_TAGN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x28\x18" "63_40\0" \ - "f\x24\x04" "GRPTAGBASE\0" \ - "f\x20\x04" "GRPTAGMASK\0" \ - "b\x1f" "GRPTAG\0" \ - "b\x1e" "SPARE\0" \ - "f\x1c\x02" "TAG_MODE\0" \ - "f\x1a\x02" "INC_VS\0" \ - "b\x19" "INC_VLAN\0" \ - "b\x18" "INC_PRT\0" \ - "b\x17" "IP6_DPRT\0" \ - "b\x16" "IP4_DPRT\0" \ - "b\x15" "IP6_SPRT\0" \ - "b\x14" "IP4_SPRT\0" \ - "b\x13" "IP6_NXTH\0" \ - "b\x12" "IP4_PCTL\0" \ - "b\x11" "IP6_DST\0" \ - "b\x10" "IP4_SRC\0" \ - "b\x0f" "IP6_SRC\0" \ - "b\x0e" "IP4_DST\0" \ - "f\x0c\x02" "TCP6_TAG\0" \ - "f\x0a\x02" "TCP4_TAG\0" \ - "f\x08\x02" "IP6_TAG\0" \ - "f\x06\x02" "IP4_TAG\0" \ - "f\x04\x02" "NON_TAG\0" \ - "f\x00\x04" "GRP\0" -#define PIP_PRT_TAG0_BITS PIP_PRT_TAGN_BITS -#define PIP_PRT_TAG1_BITS PIP_PRT_TAGN_BITS -#define PIP_PRT_TAG2_BITS PIP_PRT_TAGN_BITS -#define PIP_PRT_TAG32_BITS PIP_PRT_TAGN_BITS -/* PIP_QOS_DIFF[0-63] */ -#define PIP_STAT0_PRTN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "DRP_PKTS\0" \ - "f\x00\x20" "DRP_OCTS\0" -#define PIP_STAT0_PRT0_BITS PIP_STAT0_PRTN_BITS -#define PIP_STAT0_PRT1_BITS PIP_STAT0_PRTN_BITS -#define PIP_STAT0_PRT2_BITS PIP_STAT0_PRTN_BITS -#define PIP_STAT0_PRT32_BITS PIP_STAT0_PRTN_BITS -#define PIP_STAT1_PRTN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x30\x10" "63_48\0" \ - "f\x00\x30" "OCTS\0" -#define PIP_STAT1_PRT0_BITS PIP_STAT1_PRTN_BITS -#define PIP_STAT1_PRT1_BITS PIP_STAT1_PRTN_BITS -#define PIP_STAT1_PRT2_BITS PIP_STAT1_PRTN_BITS -#define PIP_STAT1_PRT32_BITS PIP_STAT1_PRTN_BITS -#define PIP_STAT2_PRTN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "PKTS\0" \ - "f\x00\x20" "RAW\0" -#define PIP_STAT2_PRT0_BITS PIP_STAT2_PRTN_BITS -#define PIP_STAT2_PRT1_BITS PIP_STAT2_PRTN_BITS -#define PIP_STAT2_PRT2_BITS PIP_STAT2_PRTN_BITS -#define PIP_STAT2_PRT32_BITS PIP_STAT2_PRTN_BITS -#define PIP_STAT3_PRTN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "BCST\0" \ - "f\x00\x20" "MCST\0" -#define PIP_STAT3_PRT0_BITS PIP_STAT3_PRTN_BITS -#define PIP_STAT3_PRT1_BITS PIP_STAT3_PRTN_BITS -#define PIP_STAT3_PRT2_BITS PIP_STAT3_PRTN_BITS -#define PIP_STAT3_PRT32_BITS PIP_STAT3_PRTN_BITS -#define PIP_STAT4_PRTN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "H65TO127\0" \ - "f\x00\x20" "H64\0" -#define PIP_STAT4_PRT0_BITS PIP_STAT4_PRTN_BITS -#define PIP_STAT4_PRT1_BITS PIP_STAT4_PRTN_BITS -#define PIP_STAT4_PRT2_BITS PIP_STAT4_PRTN_BITS -#define PIP_STAT4_PRT32_BITS PIP_STAT4_PRTN_BITS -#define PIP_STAT5_PRTN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "H256TO511\0" \ - "f\x00\x20" "H128TO255\0" -#define PIP_STAT5_PRT0_BITS PIP_STAT5_PRTN_BITS -#define PIP_STAT5_PRT1_BITS PIP_STAT5_PRTN_BITS -#define PIP_STAT5_PRT2_BITS PIP_STAT5_PRTN_BITS -#define PIP_STAT5_PRT32_BITS PIP_STAT5_PRTN_BITS -#define PIP_STAT6_PRTN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "H1024TO1518\0" \ - "f\x00\x20" "H512TO1023\0" -#define PIP_STAT6_PRT0_BITS PIP_STAT6_PRTN_BITS -#define PIP_STAT6_PRT1_BITS PIP_STAT6_PRTN_BITS -#define PIP_STAT6_PRT2_BITS PIP_STAT6_PRTN_BITS -#define PIP_STAT6_PRT32_BITS PIP_STAT6_PRTN_BITS -#define PIP_STAT7_PRTN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "FCS\0" \ - "f\x00\x20" "H1519\0" -#define PIP_STAT7_PRT0_BITS PIP_STAT7_PRTN_BITS -#define PIP_STAT7_PRT1_BITS PIP_STAT7_PRTN_BITS -#define PIP_STAT7_PRT2_BITS PIP_STAT7_PRTN_BITS -#define PIP_STAT7_PRT32_BITS PIP_STAT7_PRTN_BITS -#define PIP_STAT8_PRTN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "FRAG\0" \ - "f\x00\x20" "UNDERSZ\0" -#define PIP_STAT8_PRT0_BITS PIP_STAT8_PRTN_BITS -#define PIP_STAT8_PRT1_BITS PIP_STAT8_PRTN_BITS -#define PIP_STAT8_PRT2_BITS PIP_STAT8_PRTN_BITS -#define PIP_STAT8_PRT32_BITS PIP_STAT8_PRTN_BITS -#define PIP_STAT9_PRTN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "JABBER\0" \ - "f\x00\x20" "OVERSZ\0" -#define PIP_STAT9_PRT0_BITS PIP_STAT9_PRTN_BITS -#define PIP_STAT9_PRT1_BITS PIP_STAT9_PRTN_BITS -#define PIP_STAT9_PRT2_BITS PIP_STAT9_PRTN_BITS -#define PIP_STAT9_PRT32_BITS PIP_STAT9_PRTN_BITS -/* PIP_TAG_INC[0-63] */ -#define PIP_STAT_INB_PKTSN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x20" "PIP_STAT_INB_PKTSN\0" \ - "f\x00\x20" "PKTS\0" -#define PIP_STAT_INB_PKTS0_BITS PIP_STAT_INB_PKTSN_BITS -#define PIP_STAT_INB_PKTS1_BITS PIP_STAT_INB_PKTSN_BITS -#define PIP_STAT_INB_PKTS2_BITS PIP_STAT_INB_PKTSN_BITS -#define PIP_STAT_INB_PKTS32_BITS PIP_STAT_INB_PKTSN_BITS -#define PIP_STAT_INB_OCTSN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x30\x10" "PIP_STAT_INB_OCTSN\0" \ - "f\x00\x30" "OCTS\0" -#define PIP_STAT_INB_OCTS0_BITS PIP_STAT_INB_OCTSN_BITS -#define PIP_STAT_INB_OCTS1_BITS PIP_STAT_INB_OCTSN_BITS -#define PIP_STAT_INB_OCTS2_BITS PIP_STAT_INB_OCTSN_BITS -#define PIP_STAT_INB_OCTS32_BITS PIP_STAT_INB_OCTSN_BITS -#define PIP_STAT_INB_ERRSN_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x10\x30" "PIP_STAT_INB_ERRSN\0" \ - "f\x00\x10" "OCTS\0" -#define PIP_STAT_INB_ERRS0_BITS PIP_STAT_INB_ERRSN_BITS -#define PIP_STAT_INB_ERRS1_BITS PIP_STAT_INB_ERRSN_BITS -#define PIP_STAT_INB_ERRS2_BITS PIP_STAT_INB_ERRSN_BITS -#define PIP_STAT_INB_ERRS32_BITS PIP_STAT_INB_ERRSN_BITS - #endif /* _CN30XXPIPREG_H_ */ diff --git a/sys/arch/octeon/dev/cn30xxpipvar.h b/sys/arch/octeon/dev/cn30xxpipvar.h index 6d2205fc53d..24af5a09463 100644 --- a/sys/arch/octeon/dev/cn30xxpipvar.h +++ b/sys/arch/octeon/dev/cn30xxpipvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxpipvar.h,v 1.1 2011/06/16 11:22:30 syuu Exp $ */ +/* $OpenBSD: cn30xxpipvar.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -37,14 +37,6 @@ struct cn30xxpip_softc { int sc_tag_type; int sc_receive_group; size_t sc_ip_offset; -#ifdef OCTEON_ETH_DEBUG - struct evcnt sc_ev_pipbeperr; - struct evcnt sc_ev_pipfeperr; - struct evcnt sc_ev_pipskprunt; - struct evcnt sc_ev_pipbadtag; - struct evcnt sc_ev_pipprtnxa; - struct evcnt sc_ev_pippktdrp; -#endif }; /* XXX */ @@ -65,15 +57,13 @@ void cn30xxpip_prt_cfg_enable(struct cn30xxpip_softc *, 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); -#endif /* 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); -#ifdef OCTEON_ETH_DEBUG -void cn30xxpip_int_enable(struct cn30xxpip_softc *, int); -uint64_t cn30xxpip_int_summary(struct cn30xxpip_softc *); +void cn30xxpip_int_enable(struct cn30xxpip_softc *, int); +uint64_t cn30xxpip_int_summary(struct cn30xxpip_softc *); #endif /* OCTEON_ETH_DEBUG */ diff --git a/sys/arch/octeon/dev/cn30xxpko.c b/sys/arch/octeon/dev/cn30xxpko.c index c35c6d95f41..f78da1501c2 100644 --- a/sys/arch/octeon/dev/cn30xxpko.c +++ b/sys/arch/octeon/dev/cn30xxpko.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxpko.c,v 1.3 2013/06/01 22:20:35 jasper Exp $ */ +/* $OpenBSD: cn30xxpko.c,v 1.4 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -40,8 +40,7 @@ static inline void cn30xxpko_op_store(uint64_t, uint64_t); #ifdef OCTEON_ETH_DEBUG -void cn30xxpko_intr_evcnt_attach(struct cn30xxpko_softc *); -void cn30xxpko_intr_rml(void *); +void cn30xxpko_intr_rml(void *); #endif #define _PKO_RD8(sc, off) \ @@ -81,7 +80,6 @@ cn30xxpko_init(struct cn30xxpko_attach_args *aa, *rsc = sc; #ifdef OCTEON_ETH_DEBUG - cn30xxpko_intr_evcnt_attach(sc); __cn30xxpko_softc = sc; #endif } @@ -152,7 +150,7 @@ cn30xxpko_port_enable(struct cn30xxpko_softc *sc, int enable) return 0; } -static int pko_queue_map_init[32]; +int pko_queue_map_init[32]; int cn30xxpko_port_config(struct cn30xxpko_softc *sc) @@ -192,22 +190,7 @@ cn30xxpko_port_config(struct cn30xxpko_softc *sc) } #ifdef OCTEON_ETH_DEBUG -int cn30xxpko_intr_rml_verbose; -struct evcnt cn30xxpko_intr_evcnt; - -static const struct octeon_evcnt_entry cn30xxpko_intr_evcnt_entries[] = { -#define _ENTRY(name, type, parent, descr) \ - OCTEON_EVCNT_ENTRY(struct cn30xxpko_softc, name, type, parent, descr) - _ENTRY(pkoerrdbell, MISC, NULL, "pko doorbell overflow"), - _ENTRY(pkoerrparity, MISC, NULL, "pko parity error") -#undef _ENTRY -}; - -void -cn30xxpko_intr_evcnt_attach(struct cn30xxpko_softc *sc) -{ - OCTEON_EVCNT_ATTACH_EVCNTS(sc, cn30xxpko_intr_evcnt_entries, "pko0"); -} +int cn30xxpko_intr_rml_verbose; void cn30xxpko_intr_rml(void *arg) @@ -215,16 +198,11 @@ cn30xxpko_intr_rml(void *arg) struct cn30xxpko_softc *sc; uint64_t reg; - cn30xxpko_intr_evcnt.ev_count++; sc = __cn30xxpko_softc; KASSERT(sc != NULL); reg = cn30xxpko_int_summary(sc); if (cn30xxpko_intr_rml_verbose) - printf("%s: PKO_REG_ERROR=0x%016" PRIx64 "\n", __func__, reg); - if (reg & PKO_REG_ERROR_DOORBELL) - OCTEON_EVCNT_INC(sc, pkoerrdbell); - if (reg & PKO_REG_ERROR_PARITY) - OCTEON_EVCNT_INC(sc, pkoerrparity); + printf("%s: PKO_REG_ERROR=0x%016llx\n", __func__, reg); } void diff --git a/sys/arch/octeon/dev/cn30xxpkovar.h b/sys/arch/octeon/dev/cn30xxpkovar.h index 7da45b20389..f7e937aa1d4 100644 --- a/sys/arch/octeon/dev/cn30xxpkovar.h +++ b/sys/arch/octeon/dev/cn30xxpkovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxpkovar.h,v 1.4 2013/06/01 22:20:35 jasper Exp $ */ +/* $OpenBSD: cn30xxpkovar.h,v 1.5 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -63,11 +63,6 @@ struct cn30xxpko_softc { *sc_cmdptr; int sc_cmd_buf_pool; size_t sc_cmd_buf_size; - -#ifdef OCTEON_ETH_DEBUG - struct evcnt sc_ev_pkoerrdbell; - struct evcnt sc_ev_pkoerrparity; -#endif }; /* XXX */ diff --git a/sys/arch/octeon/dev/cn30xxpow.c b/sys/arch/octeon/dev/cn30xxpow.c index 33fed11e59f..bfcf08e84ff 100644 --- a/sys/arch/octeon/dev/cn30xxpow.c +++ b/sys/arch/octeon/dev/cn30xxpow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxpow.c,v 1.5 2014/08/11 18:08:17 miod Exp $ */ +/* $OpenBSD: cn30xxpow.c,v 1.6 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -31,8 +31,6 @@ #include <sys/types.h> #include <sys/kernel.h> /* hz */ #include <sys/malloc.h> -#include <sys/device.h> /* evcnt */ -#include <sys/syslog.h> /* evcnt */ #include <machine/bus.h> #include <machine/octeonvar.h> @@ -42,11 +40,6 @@ #include <octeon/dev/cn30xxpowreg.h> #include <octeon/dev/cn30xxpowvar.h> -/* XXX ensure assertion */ -#if !defined(DIAGNOSTIC) -#define DIAGNOSTIC -#endif - extern int ipflow_fastforward_disable_flags; struct cn30xxpow_intr_handle { @@ -61,25 +54,17 @@ struct cn30xxpow_intr_handle { #define _EV_IVAL_N 32 /* XXX */ int pi_first; struct timeval pi_last; - struct evcnt pi_ev_per[_EV_PER_N]; - struct evcnt pi_ev_ival[_EV_IVAL_N]; - struct evcnt pi_ev_stray_tc; - struct evcnt pi_ev_stray_ds; - struct evcnt pi_ev_stray_iq; #endif }; void cn30xxpow_bootstrap(struct octeon_config *); #ifdef OCTEON_ETH_DEBUG -void cn30xxpow_intr_evcnt_attach(struct cn30xxpow_softc *); 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 *); -void cn30xxpow_intr_work_debug_per(struct cn30xxpow_softc *, - struct cn30xxpow_intr_handle *, int); #endif void cn30xxpow_init(struct cn30xxpow_softc *); void cn30xxpow_init_regs(struct cn30xxpow_softc *); @@ -347,7 +332,7 @@ cn30xxpow_intr_establish(int group, int level, KASSERT(group < 16); pow_ih = malloc(sizeof(*pow_ih), M_DEVBUF, M_NOWAIT); - KASSERT(pow_ih != NULL); + KASSERT(pow_ih != NULL); /* XXX handle failure */ pow_ih->pi_ih = octeon_intr_establish( ffs64(CIU_INTX_SUM0_WORKQ_0) - 1 + group, @@ -367,68 +352,12 @@ cn30xxpow_intr_establish(int group, int level, } #ifdef OCTEON_ETH_DEBUG -#define _NAMELEN 8 -#define _DESCRLEN 40 void cn30xxpow_intr_debug_init(struct cn30xxpow_intr_handle *pow_ih, int group) { pow_ih->pi_first = 1; - char *name, *descr; - int i; - name = malloc(_NAMELEN + - _DESCRLEN * nitems(pow_ih->pi_ev_per) + - _DESCRLEN * nitems(pow_ih->pi_ev_ival), - M_DEVBUF, M_NOWAIT); - descr = name + _NAMELEN; - snprintf(name, _NAMELEN, "pow%d", group); - for (i = 0; i < (int)nitems(pow_ih->pi_ev_per); i++) { - int n = 1 << (i - 1); - - (void)snprintf(descr, _DESCRLEN, - "# of works per intr (%d-%d)", - (i == 0) ? 0 : n, - (i == 0) ? 0 : ((n << 1) - 1)); - evcnt_attach_dynamic(&pow_ih->pi_ev_per[i], - EVCNT_TYPE_MISC, NULL, name, descr); - descr += _DESCRLEN; - } - for (i = 0; i < (int)nitems(pow_ih->pi_ev_ival); i++) { - int n = 1 << (i - 1); - int p, q; - char unit; - - p = n; - q = (n << 1) - 1; - unit = 'u'; - /* - * 0 is exceptional - */ - if (i == 0) - p = q = 0; - /* - * count 1024usec as 1msec - * - * XXX this is not exact - */ - if ((i - 1) >= 10) { - p /= 1000; - q /= 1000; - unit = 'm'; - } - (void)snprintf(descr, _DESCRLEN, "intr interval (%d-%d%csec)", - p, q, unit); - evcnt_attach_dynamic(&pow_ih->pi_ev_ival[i], - EVCNT_TYPE_MISC, NULL, name, descr); - descr += _DESCRLEN; - } - evcnt_attach_dynamic(&pow_ih->pi_ev_stray_tc, - EVCNT_TYPE_MISC, NULL, name, "stray intr (TC)"); - evcnt_attach_dynamic(&pow_ih->pi_ev_stray_ds, - EVCNT_TYPE_MISC, NULL, name, "stray intr (DS)"); - evcnt_attach_dynamic(&pow_ih->pi_ev_stray_iq, - EVCNT_TYPE_MISC, NULL, name, "stray intr (IQ)"); } #endif @@ -473,7 +402,6 @@ cn30xxpow_intr_work_debug_ival(struct cn30xxpow_softc *sc, { struct timeval now; struct timeval ival; - int n; microtime(&now); if (__predict_false(pow_ih->pi_first == 1)) { @@ -483,51 +411,18 @@ cn30xxpow_intr_work_debug_ival(struct cn30xxpow_softc *sc, timersub(&now, &pow_ih->pi_last, &ival); if (ival.tv_sec != 0) goto stat_done; /* XXX */ - n = ffs64((uint64_t)ival.tv_usec); - if (n > (int)nitems(pow_ih->pi_ev_ival) - 1) - n = (int)nitems(pow_ih->pi_ev_ival) - 1; - pow_ih->pi_ev_ival[n].ev_count++; stat_done: pow_ih->pi_last = now; /* struct copy */ } - -void -cn30xxpow_intr_work_debug_per(struct cn30xxpow_softc *sc, - struct cn30xxpow_intr_handle *pow_ih, int count) -{ - int n; - - n = ffs64(count); - if (n > (int)nitems(pow_ih->pi_ev_per) - 1) - n = (int)nitems(pow_ih->pi_ev_per) - 1; - pow_ih->pi_ev_per[n].ev_count++; -#if 1 - if (count == 0) { - uint64_t wq_int_cnt; - - wq_int_cnt = _POW_GROUP_RD8(sc, pow_ih, POW_WQ_INT_CNT0_OFFSET); - if (wq_int_cnt & POW_WQ_INT_CNTX_TC_CNT) - pow_ih->pi_ev_stray_tc.ev_count++; - if (wq_int_cnt & POW_WQ_INT_CNTX_DS_CNT) - pow_ih->pi_ev_stray_ds.ev_count++; - if (wq_int_cnt & POW_WQ_INT_CNTX_IQ_CNT) - pow_ih->pi_ev_stray_iq.ev_count++; - } -#endif -} #endif #ifdef OCTEON_ETH_DEBUG #define _POW_INTR_WORK_DEBUG_IVAL(sc, ih) \ cn30xxpow_intr_work_debug_ival((sc), (ih)) -#define _POW_INTR_WORK_DEBUG_PER(sc, ih, count) \ - cn30xxpow_intr_work_debug_per((sc), (ih), (count)) #else #define _POW_INTR_WORK_DEBUG_IVAL(sc, ih) \ do {} while (0) -#define _POW_INTR_WORK_DEBUG_PER(sc, ih, count) \ - do {} while (0) #endif /* @@ -582,8 +477,7 @@ cn30xxpow_intr_work(struct cn30xxpow_softc *sc, count++; done: - _POW_INTR_WORK_DEBUG_PER(sc, pow_ih, count); - + ; /* KASSERT(work == NULL); */ /* KASSERT(count > 0); */ @@ -648,37 +542,7 @@ cn30xxpow_error_int_summary(void *data) /* ---- debug counter */ #ifdef OCTEON_ETH_DEBUG -int cn30xxpow_intr_rml_verbose; -struct evcnt cn30xxpow_intr_evcnt; - -static const struct octeon_evcnt_entry cn30xxpow_intr_evcnt_entries[] = { -#define _ENTRY(name, type, parent, descr) \ - OCTEON_EVCNT_ENTRY(struct cn30xxpow_softc, name, type, parent, descr) - _ENTRY(powecciopcsrpend, MISC, NULL, "pow csr load"), - _ENTRY(powecciopdbgpend, MISC, NULL, "pow dbg load"), - _ENTRY(powecciopaddwork, MISC, NULL, "pow addwork"), - _ENTRY(powecciopillop, MISC, NULL, "pow ill op"), - _ENTRY(poweccioppend24, MISC, NULL, "pow pend24"), - _ENTRY(poweccioppend23, MISC, NULL, "pow pend23"), - _ENTRY(poweccioppend22, MISC, NULL, "pow pend22"), - _ENTRY(poweccioppend21, MISC, NULL, "pow pend21"), - _ENTRY(poweccioptagnull, MISC, NULL, "pow tag null"), - _ENTRY(poweccioptagnullnull, MISC, NULL, "pow tag nullnull"), - _ENTRY(powecciopordatom, MISC, NULL, "pow ordered atomic"), - _ENTRY(powecciopnull, MISC, NULL, "pow core null"), - _ENTRY(powecciopnullnull, MISC, NULL, "pow core nullnull"), - _ENTRY(poweccrpe, MISC, NULL, "pow remote-pointer error"), - _ENTRY(poweccsyn, MISC, NULL, "pow syndrome value"), - _ENTRY(poweccdbe, MISC, NULL, "pow double bit"), - _ENTRY(poweccsbe, MISC, NULL, "pow single bit"), -#undef _ENTRY -}; - -void -cn30xxpow_intr_evcnt_attach(struct cn30xxpow_softc *sc) -{ - OCTEON_EVCNT_ATTACH_EVCNTS(sc, cn30xxpow_intr_evcnt_entries, "pow0"); -} +int cn30xxpow_intr_rml_verbose; void cn30xxpow_intr_rml(void *arg) @@ -686,63 +550,11 @@ cn30xxpow_intr_rml(void *arg) struct cn30xxpow_softc *sc; uint64_t reg; - cn30xxpow_intr_evcnt.ev_count++; sc = __cn30xxpow_softc; KASSERT(sc != NULL); reg = cn30xxpow_error_int_summary(sc); if (cn30xxpow_intr_rml_verbose) - printf("%s: POW_ECC_ERR=0x%016" PRIx64 "\n", __func__, reg); - switch (reg & POW_ECC_ERR_IOP) { - case POW_ECC_ERR_IOP_CSRPEND: - OCTEON_EVCNT_INC(sc, powecciopcsrpend); - break; - case POW_ECC_ERR_IOP_DBGPEND: - OCTEON_EVCNT_INC(sc, powecciopdbgpend); - break; - case POW_ECC_ERR_IOP_ADDWORK: - OCTEON_EVCNT_INC(sc, powecciopaddwork); - break; - case POW_ECC_ERR_IOP_ILLOP: - OCTEON_EVCNT_INC(sc, powecciopillop); - break; - case POW_ECC_ERR_IOP_PEND24: - OCTEON_EVCNT_INC(sc, poweccioppend24); - break; - case POW_ECC_ERR_IOP_PEND23: - OCTEON_EVCNT_INC(sc, poweccioppend23); - break; - case POW_ECC_ERR_IOP_PEND22: - OCTEON_EVCNT_INC(sc, poweccioppend22); - break; - case POW_ECC_ERR_IOP_PEND21: - OCTEON_EVCNT_INC(sc, poweccioppend21); - break; - case POW_ECC_ERR_IOP_TAGNULL: - OCTEON_EVCNT_INC(sc, poweccioptagnull); - break; - case POW_ECC_ERR_IOP_TAGNULLNULL: - OCTEON_EVCNT_INC(sc, poweccioptagnullnull); - break; - case POW_ECC_ERR_IOP_ORDATOM: - OCTEON_EVCNT_INC(sc, powecciopordatom); - break; - case POW_ECC_ERR_IOP_NULL: - OCTEON_EVCNT_INC(sc, powecciopnull); - break; - case POW_ECC_ERR_IOP_NULLNULL: - OCTEON_EVCNT_INC(sc, powecciopnullnull); - break; - default: - break; - } - if (reg & POW_ECC_ERR_RPE) - OCTEON_EVCNT_INC(sc, poweccrpe); - if (reg & POW_ECC_ERR_SYN) - OCTEON_EVCNT_INC(sc, poweccsyn); - if (reg & POW_ECC_ERR_DBE) - OCTEON_EVCNT_INC(sc, poweccdbe); - if (reg & POW_ECC_ERR_SBE) - OCTEON_EVCNT_INC(sc, poweccsbe); + printf("%s: POW_ECC_ERR=0x%016llx\n", __func__, reg); } #endif @@ -752,8 +564,8 @@ cn30xxpow_intr_rml(void *arg) #ifdef OCTEON_ETH_DEBUG -void cn30xxpow_dump_reg(void); -void cn30xxpow_dump_ops(void); +void cn30xxpow_dump_reg(void); +void cn30xxpow_dump_ops(void); void cn30xxpow_dump(void) @@ -766,11 +578,10 @@ cn30xxpow_dump(void) struct cn30xxpow_dump_reg_entry { const char *name; - const char *format; size_t offset; }; -#define _ENTRY(x) { #x, x##_BITS, x##_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) @@ -780,7 +591,7 @@ struct cn30xxpow_dump_reg_entry { _ENTRY(x## 8), _ENTRY(x## 9), _ENTRY(x##10), _ENTRY(x##11), \ _ENTRY(x##12), _ENTRY(x##13), _ENTRY(x##14), _ENTRY(x##15) -static const struct cn30xxpow_dump_reg_entry cn30xxpow_dump_reg_entries[] = { +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), @@ -810,17 +621,12 @@ cn30xxpow_dump_reg(void) struct cn30xxpow_softc *sc = __cn30xxpow_softc; const struct cn30xxpow_dump_reg_entry *entry; uint64_t tmp; - char buf[512]; 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); - if (entry->format == NULL) - snprintf(buf, sizeof(buf), "%16" PRIx64, tmp); - else - bitmask_snprintf(tmp, entry->format, buf, sizeof(buf)); - printf("\t%-24s: %s\n", entry->name, buf); + printf("\t%-24s: %16llx\n", entry->name, tmp); } } @@ -828,21 +634,19 @@ cn30xxpow_dump_reg(void) struct cn30xxpow_dump_ops_entry { const char *name; - const char *format; 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); +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, prefix##_##y##_BITS, cn30xxpow_status_by_##name##_##x } + { #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) @@ -945,18 +749,13 @@ cn30xxpow_dump_ops_common(const struct cn30xxpow_dump_ops_entry *entries, { const struct cn30xxpow_dump_ops_entry *entry; uint64_t tmp; - char buf[512]; int i; printf("%s=%d\n", by_what, arg); for (i = 0; i < (int)nentries; i++) { entry = &entries[i]; tmp = (*entry->func)(arg); - if (entry->format == NULL) - snprintf(buf, sizeof(buf), "%16" PRIx64, tmp); - else - bitmask_snprintf(tmp, entry->format, buf, sizeof(buf)); - printf("\t%-24s: %s\n", entry->name, buf); + printf("\t%-24s: %16llx\n", entry->name, tmp); } } @@ -971,10 +770,10 @@ cn30xxpow_dump_ops_common(const struct cn30xxpow_dump_ops_entry *entries, * Standalone test entries; meant to be called from ddb. */ -void cn30xxpow_test(void); -void cn30xxpow_test_dump_wqe(paddr_t); +void cn30xxpow_test(void); +void cn30xxpow_test_dump_wqe(paddr_t); -static void cn30xxpow_test_1(void); +void cn30xxpow_test_1(void); struct test_wqe { uint64_t word0; @@ -990,7 +789,7 @@ cn30xxpow_test(void) cn30xxpow_test_1(); } -static void +void cn30xxpow_test_1(void) { struct test_wqe *wqe = &test_wqe; @@ -1061,16 +860,13 @@ void cn30xxpow_test_dump_wqe(paddr_t ptr) { uint64_t word0, word1; - char buf[128]; printf("wqe\n"); word0 = *(uint64_t *)PHYS_TO_CKSEG0(ptr); - bitmask_snprintf(word0, POW_WQE_WORD0_BITS, buf, sizeof(buf)); - printf("\t%-24s: %s\n", "word0", buf); + printf("\t%-24s: %16llx\n", "word0", word0); word1 = *(uint64_t *)PHYS_TO_CKSEG0(ptr + 8); - bitmask_snprintf(word1, POW_WQE_WORD1_BITS, buf, sizeof(buf)); - printf("\t%-24s: %s\n", "word1", buf); + printf("\t%-24s: %16llx\n", "word1", word1); } #endif diff --git a/sys/arch/octeon/dev/cn30xxpowreg.h b/sys/arch/octeon/dev/cn30xxpowreg.h index e8f7cf70715..afff54f92ba 100644 --- a/sys/arch/octeon/dev/cn30xxpowreg.h +++ b/sys/arch/octeon/dev/cn30xxpowreg.h @@ -3,7 +3,7 @@ * DONT EDIT THIS FILE */ -/* $OpenBSD: cn30xxpowreg.h,v 1.1 2011/06/16 11:22:30 syuu Exp $ */ +/* $OpenBSD: cn30xxpowreg.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -427,25 +427,6 @@ #define POW_STATUS_LOAD_RESULT_PEND_TAG_PEND_XXX_35_34 0x0000000c00000000ULL #define POW_STATUS_LOAD_RESULT_PEND_TAG_PEND_TYPE 0x0000000300000000ULL #define POW_STATUS_LOAD_RESULT_PEND_TAG_PEND_TAG 0x00000000ffffffffULL -#define POW_STATUS_LOAD_RESULT_PEND_TAG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x3d" "PEND_SWITCH\0" \ - "b\x3c" "PEND_SWITCH_FULL\0" \ - "b\x3b" "PEND_SWITCH_NULL\0" \ - "b\x3a" "PEND_DESCHED\0" \ - "b\x39" "PEND_DESCHED_SWITCH\0" \ - "b\x38" "PEND_NOSCHED\0" \ - "b\x37" "PEND_NEW_WORK\0" \ - "b\x36" "PEND_NEW_WORK_WAIT\0" \ - "b\x35" "PEND_NULL_RD\0" \ - "b\x34" "PEND_NOSCHED_CLR\0" \ - "f\x28\x0b" "PEND_INDEX\0" \ - "f\x24\x04" "PEND_GRP\0" \ - "f\x20\x02" "PEND_TYPE\0" \ - "f\x00\x20" "PEND_TAG\0" /* get_cur = 0 and get_wqp = 1 ("pend_wqp") */ #define POW_STATUS_LOAD_RESULT_PEND_WQP_XXX_63_62 0xc000000000000000ULL @@ -462,23 +443,6 @@ #define POW_STATUS_LOAD_RESULT_PEND_WQP_PEND_XXX_51 0x0008000000000000ULL #define POW_STATUS_LOAD_RESULT_PEND_WQP_PEND_INDEX 0x0007ff0000000000ULL #define POW_STATUS_LOAD_RESULT_PEND_WQP_PEND_WQP 0x0000000fffffffffULL -#define POW_STATUS_LOAD_RESULT_PEND_WQP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x3d" "PEND_SWITCH\0" \ - "b\x3c" "PEND_SWITCH_FULL\0" \ - "b\x3b" "PEND_SWITCH_NULL\0" \ - "b\x3a" "PEND_DESCHED\0" \ - "b\x39" "PEND_DESCHED_SWITCH\0" \ - "b\x38" "PEND_NOSCHED\0" \ - "b\x37" "PEND_NEW_WORK\0" \ - "b\x36" "PEND_NEW_WORK_WAIT\0" \ - "b\x35" "PEND_NULL_RD\0" \ - "b\x34" "PEND_NOSCHED_CLR\0" \ - "f\x28\x0b" "PEND_INDEX\0" \ - "f\x00\x24" "PEND_WQP\0" /* get_cur = 1 and get_wqp = 0 and get_rev = 0 ("cur_tag_next") */ #define POW_STATUS_LOAD_RESULT_CUR_TAG_NEXT_XXX_63_62 0xc000000000000000ULL @@ -489,18 +453,6 @@ #define POW_STATUS_LOAD_RESULT_CUR_TAG_NEXT_TAIL 0x0000000400000000ULL #define POW_STATUS_LOAD_RESULT_CUR_TAG_NEXT_TAG_TYPE 0x0000000300000000ULL #define POW_STATUS_LOAD_RESULT_CUR_TAG_NEXT_TAG 0x00000000ffffffffULL -#define POW_STATUS_LOAD_RESULT_CUR_TAG_NEXT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x33\x0b" "LINK_INDEX\0" \ - "f\x28\x0b" "INDEX\0" \ - "f\x24\x04" "GRP\0" \ - "b\x23" "HEAD\0" \ - "b\x22" "TAIL\0" \ - "f\x20\x02" "TAG_TYPE\0" \ - "f\x00\x20" "TAG\0" /* get_cur = 1 and get_wqp = 0 and get_rev = 1 ("cur_tag_prev") */ #define POW_STATUS_LOAD_RESULT_CUR_TAG_PREV_XXX_63_62 0xc000000000000000ULL @@ -511,18 +463,6 @@ #define POW_STATUS_LOAD_RESULT_CUR_TAG_PREV_TAIL 0x0000000400000000ULL #define POW_STATUS_LOAD_RESULT_CUR_TAG_PREV_TAG_TYPE 0x0000000300000000ULL #define POW_STATUS_LOAD_RESULT_CUR_TAG_PREV_TAG 0x00000000ffffffffULL -#define POW_STATUS_LOAD_RESULT_CUR_TAG_PREV_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x33\x0b" "REVLINK_INDEX\0" \ - "f\x28\x0b" "INDEX\0" \ - "f\x24\x04" "GRP\0" \ - "b\x23" "HEAD\0" \ - "b\x22" "TAIL\0" \ - "f\x20\x02" "TAG_TYPE\0" \ - "f\x00\x20" "TAG\0" /* get_cur = 1 and get_wqp = 1 and get_rev = 0 ("cur_wqp_next") */ #define POW_STATUS_LOAD_RESULT_CUR_WQP_NEXT_XXX_63_62 0xc000000000000000ULL @@ -530,15 +470,6 @@ #define POW_STATUS_LOAD_RESULT_CUR_WQP_NEXT_INDEX 0x0007ff0000000000ULL #define POW_STATUS_LOAD_RESULT_CUR_WQP_NEXT_GRP 0x000000f000000000ULL #define POW_STATUS_LOAD_RESULT_CUR_WQP_NEXT_WQP 0x0000000fffffffffULL -#define POW_STATUS_LOAD_RESULT_CUR_WQP_NEXT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x33\x0b" "LINK_INDEX\0" \ - "f\x28\x0b" "INDEX\0" \ - "f\x24\x04" "GRP\0" \ - "f\x00\x24" "WQP\0" /* get_cur = 1 and get_wqp = 1 and get_rev = 1 ("cur_wqp_prev") */ #define POW_STATUS_LOAD_RESULT_CUR_WQP_PREV_XXX_63_62 0xc000000000000000ULL @@ -546,15 +477,6 @@ #define POW_STATUS_LOAD_RESULT_CUR_WQP_PREV_INDEX 0x0007ff0000000000ULL #define POW_STATUS_LOAD_RESULT_CUR_WQP_PREV_GRP 0x000000f000000000ULL #define POW_STATUS_LOAD_RESULT_CUR_WQP_PREV_WQP 0x0000000fffffffffULL -#define POW_STATUS_LOAD_RESULT_CUR_WQP_PREV_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x33\x0b" "REVLINK_INDEX\0" \ - "f\x28\x0b" "INDEX\0" \ - "f\x24\x04" "GRP\0" \ - "f\x00\x24" "WQP\0" /* pow memory load (subid = 2) */ #define POW_MEMORY_LOAD_INDEX 0x000000000000ffe0ULL @@ -574,30 +496,12 @@ #define POW_MEMORY_LOAD_RESULT_TAG_TAIL 0x0000000400000000ULL #define POW_MEMORY_LOAD_RESULT_TAG_TAG_TYPE 0x0000000300000000ULL #define POW_MEMORY_LOAD_RESULT_TAG_TAG 0x00000000ffffffffULL -#define POW_MEMORY_LOAD_RESULT_TAG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x28\x0b" "NEXT_INDEX\0" \ - "f\x24\x04" "GRP\0" \ - "b\x22" "TAIL\0" \ - "f\x20\x02" "TAG_TYPE\0" \ - "f\x00\x20" "TAG\0" /* get_des = 0 and get_wqp = 1 ("wqp") */ #define POW_MEMORY_LOAD_RESULT_WQP_XXX_63_51 0xfff8000000000000ULL #define POW_MEMORY_LOAD_RESULT_WQP_NEXT_INDEX 0x0007ff0000000000ULL #define POW_MEMORY_LOAD_RESULT_WQP_GRP 0x000000f000000000ULL #define POW_MEMORY_LOAD_RESULT_WQP_WQP 0x0000000fffffffffULL -#define POW_MEMORY_LOAD_RESULT_WQP_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x28\x0b" "NEXT_INDEX\0" \ - "f\x24\x04" "GRP\0" \ - "f\x00\x24" "WQP\0" /* get_des = 1 ("desched") */ #define POW_MEMORY_LOAD_RESULT_DESCHED_XXX_63_51 0xfff8000000000000ULL @@ -607,17 +511,6 @@ #define POW_MEMORY_LOAD_RESULT_DESCHED_PEND_SWITCH 0x0000000400000000ULL #define POW_MEMORY_LOAD_RESULT_DESCHED_PEND_TYPE 0x0000000300000000ULL #define POW_MEMORY_LOAD_RESULT_DESCHED_PEND_TAG 0x00000000ffffffffULL -#define POW_MEMORY_LOAD_RESULT_DESCHED_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x28\x0b" "FWD_INDEX\0" \ - "f\x24\x04" "GRP\0" \ - "b\x23" "NOSCHED\0" \ - "b\x22" "PEND_SWITCH\0" \ - "f\x20\x02" "PEND_TYPE\0" \ - "f\x00\x20" "PEND_TAG\0" /* pow index/pointer load (subid = 3) */ #define POW_IDXPTR_LOAD_QOSGRP 0x00000000000001e0ULL @@ -643,19 +536,6 @@ #define POW_IDXPTR_LOAD_RESULT_QOS_FREE_LOC_LOC_HEAD 0x00000000007ff000ULL #define POW_IDXPTR_LOAD_RESULT_QOS_FREE_LOC_XXX_11 0x0000000000000800ULL #define POW_IDXPTR_LOAD_RESULT_QOS_FREE_LOC_LOC_TAIL 0x00000000000007ffULL -#define POW_IDXPTR_LOAD_RESULT_QOS_FREE_LOC_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x33" "FREE_VAL\0" \ - "b\x32" "FREE_ONE\0" \ - "f\x26\x0b" "FREE_HEAD\0" \ - "f\x1a\x0b" "FREE_TAIL\0" \ - "b\x19" "LOC_VAL\0" \ - "b\x18" "LOC_ONE\0" \ - "f\x0c\x0b" "LOC_HEAD\0" \ - "f\x00\x0b" "LOC_TAIL\0" /* get_rmt = 0 and get_des_get_tail = 1 ("desched") */ #define POW_IDXPTR_LOAD_RESULT_GRP_NOSCHED_DES_XXX_63_52 0xfff0000000000000ULL @@ -671,19 +551,6 @@ #define POW_IDXPTR_LOAD_RESULT_GRP_NOSCHED_DES_DES_HEAD 0x00000000007ff000ULL #define POW_IDXPTR_LOAD_RESULT_GRP_NOSCHED_DES_XXX_11 0x0000000000000800ULL #define POW_IDXPTR_LOAD_RESULT_GRP_NOSCHED_DES_DES_TAIL 0x00000000000007ffULL -#define POW_IDXPTR_LOAD_RESULT_GRP_NOSCHED_DES_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x33" "NOSCHED_VAL\0" \ - "b\x32" "NOSCHED_ONE\0" \ - "f\x26\x0b" "NOSCHED_HEAD\0" \ - "f\x1a\x0b" "NOSCHED_TAIL\0" \ - "b\x19" "DES_VAL\0" \ - "b\x18" "DES_ONE\0" \ - "f\x0c\x0b" "DES_HEAD\0" \ - "f\x00\x0b" "DES_TAIL\0" /* get_rmt = 1 and get_des_get_tail = 0 ("remote_head") */ #define POW_IDXPTR_LOAD_RESULT_QUEUE_REMOTE_HEAD_XXX_63_39 0xffffff8000000000ULL @@ -691,15 +558,6 @@ #define POW_IDXPTR_LOAD_RESULT_QUEUE_REMOTE_HEAD_RMT_VAL 0x0000002000000000ULL #define POW_IDXPTR_LOAD_RESULT_QUEUE_REMOTE_HEAD_RMT_ONE 0x0000001000000000ULL #define POW_IDXPTR_LOAD_RESULT_QUEUE_REMOTE_HEAD_RMT_HEAD 0x0000000fffffffffULL -#define POW_IDXPTR_LOAD_RESULT_QUEUE_REMOTE_HEAD_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x26" "RMT_IS_HEAD\0" \ - "b\x25" "RMT_VAL\0" \ - "b\x24" "RMT_ONE\0" \ - "f\x00\x24" "RMT_HEAD\0" /* get_rmt = 1 and get_des_get_tail = 1 ("remote_tail") */ #define POW_IDXPTR_LOAD_RESULT_QUEUE_REMOTE_TAIL_XXX_63_39 0xffffff8000000000ULL @@ -707,15 +565,6 @@ #define POW_IDXPTR_LOAD_RESULT_QUEUE_REMOTE_TAIL_RMT_VAL 0x0000002000000000ULL #define POW_IDXPTR_LOAD_RESULT_QUEUE_REMOTE_TAIL_RMT_ONE 0x0000001000000000ULL #define POW_IDXPTR_LOAD_RESULT_QUEUE_REMOTE_TAIL_RMT_TAIL 0x0000000fffffffffULL -#define POW_IDXPTR_LOAD_RESULT_QUEUE_REMOTE_TAIL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x26" "RMT_IS_HEAD\0" \ - "b\x25" "RMT_VAL\0" \ - "b\x24" "RMT_ONE\0" \ - "f\x00\x24" "RMT_TAIL\0" /* pow index/pointer load (subid = 2) */ #define POW_NULL_RD_LOAD_39_3 0x000000fffffffff8ULL @@ -789,12 +638,6 @@ #define POW_WQE_WORD0_XXX_63_40 0xffffff0000000000ULL #define POW_WQE_WORD0_NEXT 0x000000ffffffffffULL -#define POW_WQE_WORD0_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x28" "NEXT\0" #define POW_WQE_WORD0_NEXT_SHIFT 0 #define POW_WQE_WORD1_XXX_63_42 0xfffffc0000000000ULL @@ -802,244 +645,9 @@ #define POW_WQE_WORD1_GRP 0x0000007800000000ULL #define POW_WQE_WORD1_TT 0x0000000700000000ULL #define POW_WQE_WORD1_TAG 0x00000000ffffffffULL -#define POW_WQE_WORD1_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x27\x03" "QOS\0" \ - "f\x23\x04" "GRP\0" \ - "f\x20\x03" "TT\0" \ - "f\x00\x20" "TAG\0" #define POW_WQE_WORD1_GRP_SHIFT 35 #define POW_WQE_WORD1_QOS_SHIFT 39 #define POW_WQE_WORD1_TT_SHIFT 32 #define POW_WQE_WORD1_TAG_SHIFT 0 -/* ------------------------------------------------------------------------- */ - -/* for bitmask_snprintf(9) */ - -#define POW_PP_GRP_MSKX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "GRP_MSK\0" -#define POW_PP_GRP_MSK0_BITS POW_PP_GRP_MSKX_BITS -#define POW_PP_GRP_MSK1_BITS POW_PP_GRP_MSKX_BITS -#define POW_WQ_INT_THRX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x1c" "TC_EN\0" \ - "f\x18\x04" "TC_THR\0" \ - "f\x0c\x06" "DS_THR\0" \ - "f\x00\x06" "IQ_THR\0" -#define POW_WQ_INT_THR0_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR1_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR2_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR3_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR4_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR5_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR6_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR7_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR8_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR9_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR10_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR11_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR12_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR13_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR14_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_THR15_BITS POW_WQ_INT_THRX_BITS -#define POW_WQ_INT_CNTX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x18\x04" "TC_CNT\0" \ - "f\x0c\x06" "DS_CNT\0" \ - "f\x00\x06" "IQ_CNT\0" -#define POW_WQ_INT_CNT0_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT1_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT2_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT3_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT4_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT5_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT6_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT7_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT8_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT9_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT10_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT11_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT12_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT13_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT14_BITS POW_WQ_INT_CNTX_BITS -#define POW_WQ_INT_CNT15_BITS POW_WQ_INT_CNTX_BITS -#define POW_QOS_THRX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x30\x07" "DES_CNT\0" \ - "f\x24\x07" "BUF_CNT\0" \ - "f\x18\x07" "FREE_CNT\0" \ - "f\x0c\x06" "MAX_THR\0" \ - "f\x00\x06" "MIN_THR\0" -#define POW_QOS_THR0_BITS POW_QOS_THRX_BITS -#define POW_QOS_THR1_BITS POW_QOS_THRX_BITS -#define POW_QOS_THR2_BITS POW_QOS_THRX_BITS -#define POW_QOS_THR3_BITS POW_QOS_THRX_BITS -#define POW_QOS_THR4_BITS POW_QOS_THRX_BITS -#define POW_QOS_THR5_BITS POW_QOS_THRX_BITS -#define POW_QOS_THR6_BITS POW_QOS_THRX_BITS -#define POW_QOS_THR7_BITS POW_QOS_THRX_BITS -#define POW_QOS_RNDX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x18\x08" "RND_P3\0" \ - "f\x10\x08" "RND_P2\0" \ - "f\x08\x08" "RND_P1\0" \ - "f\x00\x08" "RND\0" -#define POW_QOS_RND0_BITS POW_QOS_RNDX_BITS -#define POW_QOS_RND1_BITS POW_QOS_RNDX_BITS -#define POW_QOS_RND2_BITS POW_QOS_RNDX_BITS -#define POW_QOS_RND3_BITS POW_QOS_RNDX_BITS -#define POW_QOS_RND4_BITS POW_QOS_RNDX_BITS -#define POW_QOS_RND5_BITS POW_QOS_RNDX_BITS -#define POW_QOS_RND6_BITS POW_QOS_RNDX_BITS -#define POW_QOS_RND7_BITS POW_QOS_RNDX_BITS -#define POW_WQ_INT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x10\x10" "IQ_DIS\0" \ - "f\x00\x10" "WQ_INT\0" -#define POW_WQ_INT_PC_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x1c" "PC\0" \ - "f\x08\x14" "PC_THR\0" -#define POW_NW_TIM_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x0a" "NW_TIM\0" -#define POW_ECC_ERR_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x20\x0d" "IOP_IE\0" \ - "f\x10\x0d" "IOP\0" \ - "b\x0d" "RPE_IE\0" \ - "b\x0c" "RPE\0" \ - "f\x04\x05" "SYN\0" \ - "b\x03" "DBE_IE\0" \ - "b\x02" "SBE_IE\0" \ - "b\x01" "DBE\0" \ - "b\x00" "SBE\0" -#define POW_NOS_CNT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x07" "NOS_CNT\0" -#define POW_WS_PCX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define POW_WS_PC0_BITS POW_WS_PCX_BITS -#define POW_WS_PC1_BITS POW_WS_PCX_BITS -#define POW_WS_PC2_BITS POW_WS_PCX_BITS -#define POW_WS_PC3_BITS POW_WS_PCX_BITS -#define POW_WS_PC4_BITS POW_WS_PCX_BITS -#define POW_WS_PC5_BITS POW_WS_PCX_BITS -#define POW_WS_PC6_BITS POW_WS_PCX_BITS -#define POW_WS_PC7_BITS POW_WS_PCX_BITS -#define POW_WS_PC8_BITS POW_WS_PCX_BITS -#define POW_WS_PC9_BITS POW_WS_PCX_BITS -#define POW_WS_PC10_BITS POW_WS_PCX_BITS -#define POW_WS_PC11_BITS POW_WS_PCX_BITS -#define POW_WS_PC12_BITS POW_WS_PCX_BITS -#define POW_WS_PC13_BITS POW_WS_PCX_BITS -#define POW_WS_PC14_BITS POW_WS_PCX_BITS -#define POW_WS_PC15_BITS POW_WS_PCX_BITS -#define POW_WA_PCX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define POW_WA_PC0_BITS POW_WA_PCX_BITS -#define POW_WA_PC1_BITS POW_WA_PCX_BITS -#define POW_WA_PC2_BITS POW_WA_PCX_BITS -#define POW_WA_PC3_BITS POW_WA_PCX_BITS -#define POW_WA_PC4_BITS POW_WA_PCX_BITS -#define POW_WA_PC5_BITS POW_WA_PCX_BITS -#define POW_WA_PC6_BITS POW_WA_PCX_BITS -#define POW_WA_PC7_BITS POW_WA_PCX_BITS -#define POW_IQ_CNTX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define POW_IQ_CNT0_BITS POW_IQ_CNTX_BITS -#define POW_IQ_CNT1_BITS POW_IQ_CNTX_BITS -#define POW_IQ_CNT2_BITS POW_IQ_CNTX_BITS -#define POW_IQ_CNT3_BITS POW_IQ_CNTX_BITS -#define POW_IQ_CNT4_BITS POW_IQ_CNTX_BITS -#define POW_IQ_CNT5_BITS POW_IQ_CNTX_BITS -#define POW_IQ_CNT6_BITS POW_IQ_CNTX_BITS -#define POW_IQ_CNT7_BITS POW_IQ_CNTX_BITS -#define POW_WA_COM_PC_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "WA_PC\0" -#define POW_IQ_COM_CNT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - -#define POW_TS_PC_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "TS_PC\0" -#define POW_DS_PC_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "DS_PC\0" -#define POW_BIST_STAT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x10" "PP\0" \ - "b\x08" "CAM\0" \ - "b\x07" "NBT1\0" \ - "b\x06" "NBT0\0" \ - "b\x05" "IDX\0" \ - "b\x04" "FIDX\0" \ - "b\x03" "NBR1\0" \ - "b\x02" "NBR0\0" \ - "b\x01" "PEND\0" \ - "b\x00" "ADR\0" - #endif /* _CN30XXPOWREG_H_ */ diff --git a/sys/arch/octeon/dev/cn30xxpowvar.h b/sys/arch/octeon/dev/cn30xxpowvar.h index ba339cadb12..416b343ad05 100644 --- a/sys/arch/octeon/dev/cn30xxpowvar.h +++ b/sys/arch/octeon/dev/cn30xxpowvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cn30xxpowvar.h,v 1.1 2011/06/16 11:22:30 syuu Exp $ */ +/* $OpenBSD: cn30xxpowvar.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -53,25 +53,6 @@ struct cn30xxpow_softc { bus_space_handle_t sc_regh; int sc_port; int sc_int_pc_base; -#ifdef OCTEON_ETH_DEBUG - struct evcnt sc_ev_powecciopcsrpend; - struct evcnt sc_ev_powecciopdbgpend; - struct evcnt sc_ev_powecciopaddwork; - struct evcnt sc_ev_powecciopillop; - struct evcnt sc_ev_poweccioppend24; - struct evcnt sc_ev_poweccioppend23; - struct evcnt sc_ev_poweccioppend22; - struct evcnt sc_ev_poweccioppend21; - struct evcnt sc_ev_poweccioptagnull; - struct evcnt sc_ev_poweccioptagnullnull; - struct evcnt sc_ev_powecciopordatom; - struct evcnt sc_ev_powecciopnull; - struct evcnt sc_ev_powecciopnullnull; - struct evcnt sc_ev_poweccrpe; - struct evcnt sc_ev_poweccsyn; - struct evcnt sc_ev_poweccdbe; - struct evcnt sc_ev_poweccsbe; -#endif }; /* XXX */ diff --git a/sys/arch/octeon/dev/if_cnmac.c b/sys/arch/octeon/dev/if_cnmac.c index 6e923a69ea9..fb8b8a6722f 100644 --- a/sys/arch/octeon/dev/if_cnmac.c +++ b/sys/arch/octeon/dev/if_cnmac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cnmac.c,v 1.16 2014/08/11 18:08:17 miod Exp $ */ +/* $OpenBSD: if_cnmac.c,v 1.17 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -195,57 +195,17 @@ struct octeon_eth_softc *octeon_eth_gsc[GMX_PORT_NUNITS]; void *octeon_eth_pow_recv_ih; /* sysctl'able parameters */ -int octeon_eth_param_pko_cmd_w0_n2 = 1; -int octeon_eth_param_pip_dyn_rs = 1; -int octeon_eth_param_redir = 0; -int octeon_eth_param_pktbuf = 0; -int octeon_eth_param_rate = 0; -int octeon_eth_param_intr = 0; +int octeon_eth_param_pko_cmd_w0_n2 = 1; +int octeon_eth_param_pip_dyn_rs = 1; +int octeon_eth_param_redir = 0; +int octeon_eth_param_pktbuf = 0; +int octeon_eth_param_rate = 0; +int octeon_eth_param_intr = 0; -struct cfattach cnmac_ca = {sizeof(struct octeon_eth_softc), - octeon_eth_match, octeon_eth_attach, NULL, NULL}; +const struct cfattach cnmac_ca = + { sizeof(struct octeon_eth_softc), octeon_eth_match, octeon_eth_attach }; -struct cfdriver cnmac_cd = {NULL, "cnmac", DV_IFNET}; - -#ifdef OCTEON_ETH_DEBUG - -static const struct octeon_evcnt_entry octeon_evcnt_entries[] = { -#define _ENTRY(name, type, parent, descr) \ - OCTEON_EVCNT_ENTRY(struct octeon_eth_softc, name, type, parent, descr) - _ENTRY(rx, MISC, NULL, "rx"), - _ENTRY(rxint, INTR, NULL, "rx intr"), - _ENTRY(rxrs, MISC, NULL, "rx dynamic short"), - _ENTRY(rxbufpkalloc, MISC, NULL, "rx buf pkt alloc"), - _ENTRY(rxbufpkput, MISC, NULL, "rx buf pkt put"), - _ENTRY(rxbufwqalloc, MISC, NULL, "rx buf wqe alloc"), - _ENTRY(rxbufwqput, MISC, NULL, "rx buf wqe put"), - _ENTRY(rxerrcode, MISC, NULL, "rx code error"), - _ENTRY(rxerrfix, MISC, NULL, "rx fixup error"), - _ENTRY(rxerrjmb, MISC, NULL, "rx jmb error"), - _ENTRY(rxerrlink, MISC, NULL, "rx link error"), - _ENTRY(rxerroff, MISC, NULL, "rx offload error"), - _ENTRY(rxonperrshort, MISC, NULL, "rx onp fixup short error"), - _ENTRY(rxonperrpreamble, MISC, NULL, "rx onp fixup preamble error"), - _ENTRY(rxonperrcrc, MISC, NULL, "rx onp fixup crc error"), - _ENTRY(rxonperraddress, MISC, NULL, "rx onp fixup address error"), - _ENTRY(rxonponp, MISC, NULL, "rx onp fixup onp packets"), - _ENTRY(rxonpok, MISC, NULL, "rx onp fixup success packets"), - _ENTRY(tx, MISC, NULL, "tx"), - _ENTRY(txadd, MISC, NULL, "tx add"), - _ENTRY(txbufcballoc, MISC, NULL, "tx buf cb alloc"), - _ENTRY(txbufcbget, MISC, NULL, "tx buf cb get"), - _ENTRY(txbufgballoc, MISC, NULL, "tx buf gb alloc"), - _ENTRY(txbufgbget, MISC, NULL, "tx buf gb get"), - _ENTRY(txbufgbput, MISC, NULL, "tx buf gb put"), - _ENTRY(txdel, MISC, NULL, "tx del"), - _ENTRY(txerr, MISC, NULL, "tx error"), - _ENTRY(txerrcmd, MISC, NULL, "tx cmd error"), - _ENTRY(txerrgbuf, MISC, NULL, "tx gbuf error"), - _ENTRY(txerrlink, MISC, NULL, "tx link error"), - _ENTRY(txerrmkcmd, MISC, NULL, "tx makecmd error"), -#undef _ENTRY -}; -#endif +struct cfdriver cnmac_cd = { NULL, "cnmac", DV_IFNET }; /* ---- buffer management */ @@ -393,9 +353,6 @@ octeon_eth_attach(struct device *parent, struct device *self, void *aux) if (octeon_eth_pow_recv_ih == NULL) octeon_eth_pow_recv_ih = cn30xxpow_intr_establish(OCTEON_POW_GROUP_PIP, IPL_NET, octeon_eth_recv_intr, NULL, NULL, sc->sc_dev.dv_xname); - - OCTEON_EVCNT_ATTACH_EVCNTS(sc, octeon_evcnt_entries, - sc->sc_dev.dv_xname); } /* ---- submodules */ @@ -643,7 +600,6 @@ octeon_eth_send_queue_flush(struct octeon_eth_softc *sc) octeon_eth_send_queue_del(sc, &m, &gbuf); cn30xxfpa_buf_put_paddr(octeon_eth_fb_sg, CKSEG0_TO_PHYS(gbuf)); - OCTEON_EVCNT_INC(sc, txbufgbput); m_freem(m); } @@ -679,7 +635,6 @@ octeon_eth_send_queue_is_full(struct octeon_eth_softc *sc) if (__predict_false(nofree_cnt == GATHER_QUEUE_SIZE - 1)) { octeon_eth_send_queue_flush(sc); - OCTEON_EVCNT_INC(sc, txerrgbuf); octeon_eth_send_queue_flush_sync(sc); return 1; } @@ -722,8 +677,6 @@ octeon_eth_send_queue_add(struct octeon_eth_softc *sc, struct mbuf *m, if (m->m_ext.ext_free != NULL) sc->sc_ext_callback_cnt++; - - OCTEON_EVCNT_INC(sc, txadd); } void @@ -743,8 +696,6 @@ octeon_eth_send_queue_del(struct octeon_eth_softc *sc, struct mbuf **rm, sc->sc_ext_callback_cnt--; OCTEON_ETH_KASSERT(sc->sc_ext_callback_cnt >= 0); } - - OCTEON_EVCNT_INC(sc, txdel); } int @@ -760,11 +711,9 @@ octeon_eth_buf_free_work(struct octeon_eth_softc *sc, uint64_t *work, start_buffer = addr & ~(2048 - 1); cn30xxfpa_buf_put_paddr(octeon_eth_fb_pkt, start_buffer); - OCTEON_EVCNT_INC(sc, rxbufpkput); } cn30xxfpa_buf_put_paddr(octeon_eth_fb_wqe, CKSEG0_TO_PHYS(work)); - OCTEON_EVCNT_INC(sc, rxbufwqput); return 0; } @@ -773,15 +722,9 @@ void octeon_eth_buf_ext_free_m(caddr_t buf, u_int size, void *arg) { uint64_t *work = (void *)arg; -#ifdef OCTEON_ETH_DEBUG - struct octeon_eth_softc *sc = (void *)(uintptr_t)work[0]; -#endif int s = splnet(); - OCTEON_EVCNT_INC(sc, rxrs); - cn30xxfpa_buf_put_paddr(octeon_eth_fb_wqe, CKSEG0_TO_PHYS(work)); - OCTEON_EVCNT_INC(sc, rxbufwqput); splx(s); } @@ -791,16 +734,10 @@ octeon_eth_buf_ext_free_ext(caddr_t buf, u_int size, void *arg) { uint64_t *work = (void *)arg; -#ifdef OCTEON_ETH_DEBUG - struct octeon_eth_softc *sc = (void *)(uintptr_t)work[0]; -#endif int s = splnet(); cn30xxfpa_buf_put_paddr(octeon_eth_fb_wqe, CKSEG0_TO_PHYS(work)); - OCTEON_EVCNT_INC(sc, rxbufwqput); - cn30xxfpa_buf_put_paddr(octeon_eth_fb_pkt, CKSEG0_TO_PHYS(buf)); - OCTEON_EVCNT_INC(sc, rxbufpkput); splx(s); } @@ -916,7 +853,7 @@ if_cnmac_kvtophys(vaddr_t kva) else if (kva >= CKSEG1_BASE && kva < CKSEG1_BASE + CKSEG_SIZE) return CKSEG1_TO_PHYS(kva); - printf("kva %lx is not be able to convert physical address\n", kva); + printf("kva %lx is not able to convert physical address\n", kva); panic("if_cnmac_kvtophys"); } @@ -1039,7 +976,6 @@ octeon_eth_send_cmd(struct octeon_eth_softc *sc, uint64_t pko_cmd_w0, result = 1; goto done; } - OCTEON_EVCNT_INC(sc, txbufcbget); *cmdptr++ = buf; sc->sc_cmdptr.cmdptr = (uint64_t)buf; sc->sc_cmdptr.cmdptr_idx = 0; @@ -1063,7 +999,6 @@ octeon_eth_send_buf(struct octeon_eth_softc *sc, struct mbuf *m, error = octeon_eth_send_makecmd(sc, m, gbuf, &pko_cmd_w0, &pko_cmd_w1); if (error != 0) { /* already logging */ - OCTEON_EVCNT_INC(sc, txerrmkcmd); result = error; goto done; } @@ -1071,7 +1006,6 @@ octeon_eth_send_buf(struct octeon_eth_softc *sc, struct mbuf *m, error = octeon_eth_send_cmd(sc, pko_cmd_w0, pko_cmd_w1); if (error != 0) { /* already logging */ - OCTEON_EVCNT_INC(sc, txerrcmd); result = error; } @@ -1086,28 +1020,21 @@ octeon_eth_send(struct octeon_eth_softc *sc, struct mbuf *m) uint64_t *gbuf = NULL; int result = 0, error; - OCTEON_EVCNT_INC(sc, tx); - gaddr = cn30xxfpa_buf_get_paddr(octeon_eth_fb_sg); if (gaddr == 0) { log(LOG_WARNING, "%s: cannot allocate gather buffer from free pool allocator\n", sc->sc_dev.dv_xname); - OCTEON_EVCNT_INC(sc, txerrgbuf); result = 1; goto done; } - OCTEON_EVCNT_INC(sc, txbufgbget); - gbuf = (uint64_t *)(uintptr_t)PHYS_TO_CKSEG0(gaddr); - OCTEON_ETH_KASSERT(gbuf != NULL); error = octeon_eth_send_buf(sc, m, gbuf); if (error != 0) { /* already logging */ cn30xxfpa_buf_put_paddr(octeon_eth_fb_sg, gaddr); - OCTEON_EVCNT_INC(sc, txbufgbput); result = error; goto done; } @@ -1148,7 +1075,6 @@ octeon_eth_start(struct ifnet *ifp) #endif m_freem(m); IF_DROP(&ifp->if_snd); - OCTEON_EVCNT_INC(sc, txerrlink); } goto last; } @@ -1183,7 +1109,6 @@ octeon_eth_start(struct ifnet *ifp) log(LOG_WARNING, "%s: failed to transmit packet\n", sc->sc_dev.dv_xname); - OCTEON_EVCNT_INC(sc, txerr); } else { sc->sc_soft_req_cnt++; } @@ -1384,9 +1309,6 @@ octeon_eth_recv_mbuf(struct octeon_eth_softc *sc, uint64_t *work, data = (void *)addr; } - /* embed sc pointer into work[0] for _ext_free evcnt */ - work[0] = (uintptr_t)sc; - MEXTADD(m, ext_buf, ext_size, 0, ext_free, work); OCTEON_ETH_KASSERT(ISSET(m->m_flags, M_EXT)); @@ -1449,7 +1371,6 @@ octeon_eth_recv_check(struct octeon_eth_softc *sc, uint64_t word2) log(LOG_DEBUG, "%s: link is not up, the packet was dropped\n", sc->sc_dev.dv_xname); - OCTEON_EVCNT_INC(sc, rxerrlink); return 1; } @@ -1460,7 +1381,6 @@ octeon_eth_recv_check(struct octeon_eth_softc *sc, uint64_t word2) &sc->sc_rate_recv_check_jumbo_cap)) log(LOG_DEBUG, "jumbo frame was received\n"); - OCTEON_EVCNT_INC(sc, rxerrjmb); return 1; } #endif @@ -1481,7 +1401,6 @@ octeon_eth_recv_check(struct octeon_eth_softc *sc, uint64_t word2) "the packet was dropped (error code = %lld)\n", sc->sc_dev.dv_xname, word2 & PIP_WQE_WORD2_NOIP_OPECODE); } - OCTEON_EVCNT_INC(sc, rxerrcode); return 1; } @@ -1509,8 +1428,6 @@ octeon_eth_recv(struct octeon_eth_softc *sc, uint64_t *work) OCTEON_ETH_KASSERT(sc != NULL); OCTEON_ETH_KASSERT(work != NULL); - OCTEON_EVCNT_INC(sc, rx); - word2 = work[2]; ifp = &sc->sc_arpcom.ac_if; diff --git a/sys/arch/octeon/dev/if_cnmacvar.h b/sys/arch/octeon/dev/if_cnmacvar.h index 7d71fa56763..4aa3bf49ecd 100644 --- a/sys/arch/octeon/dev/if_cnmacvar.h +++ b/sys/arch/octeon/dev/if_cnmacvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cnmacvar.h,v 1.4 2014/07/09 12:56:28 mpi Exp $ */ +/* $OpenBSD: if_cnmacvar.h,v 1.5 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -114,38 +114,4 @@ struct octeon_eth_softc { struct timeval sc_rate_recv_check_jumbo_cap; struct timeval sc_rate_recv_check_code_last; struct timeval sc_rate_recv_check_code_cap; - -#ifdef OCTEON_ETH_DEBUG - struct evcnt sc_ev_rx; - struct evcnt sc_ev_rxint; - struct evcnt sc_ev_rxrs; - struct evcnt sc_ev_rxbufpkalloc; - struct evcnt sc_ev_rxbufpkput; - struct evcnt sc_ev_rxbufwqalloc; - struct evcnt sc_ev_rxbufwqput; - struct evcnt sc_ev_rxerrcode; - struct evcnt sc_ev_rxerrfix; - struct evcnt sc_ev_rxerrjmb; - struct evcnt sc_ev_rxerrlink; - struct evcnt sc_ev_rxerroff; - struct evcnt sc_ev_rxonperrshort; - struct evcnt sc_ev_rxonperrpreamble; - struct evcnt sc_ev_rxonperrcrc; - struct evcnt sc_ev_rxonperraddress; - struct evcnt sc_ev_rxonponp; - struct evcnt sc_ev_rxonpok; - struct evcnt sc_ev_tx; - struct evcnt sc_ev_txadd; - struct evcnt sc_ev_txbufcballoc; - struct evcnt sc_ev_txbufcbget; - struct evcnt sc_ev_txbufgballoc; - struct evcnt sc_ev_txbufgbget; - struct evcnt sc_ev_txbufgbput; - struct evcnt sc_ev_txdel; - struct evcnt sc_ev_txerr; - struct evcnt sc_ev_txerrcmd; - struct evcnt sc_ev_txerrgbuf; - struct evcnt sc_ev_txerrlink; - struct evcnt sc_ev_txerrmkcmd; -#endif }; diff --git a/sys/arch/octeon/dev/octhcireg.h b/sys/arch/octeon/dev/octhcireg.h index 04f09dfb095..920e289a44e 100644 --- a/sys/arch/octeon/dev/octhcireg.h +++ b/sys/arch/octeon/dev/octhcireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: octhcireg.h,v 1.1 2014/07/09 23:03:22 pirofti Exp $ */ +/* $OpenBSD: octhcireg.h,v 1.2 2014/08/11 18:29:56 miod Exp $ */ /* * Copyright (c) 2007 Internet Initiative Japan, Inc. @@ -211,7 +211,7 @@ typedef u_int32_t octhci_physaddr_t; #define USBN_DMA0_OUTB_CHNX_XXX_63_36 0xfffffff000000000ULL #define USBN_DMA0_OUTB_CHNX_ADDR 0x0000000fffffffffULL -/* ---- bitmask_snprintf */ +/* ---- %b format strings */ #define USBN_INT_BITS \ "\020" /* hex display */ \ @@ -927,404 +927,6 @@ typedef u_int32_t octhci_physaddr_t; /* for USBC_NPTXDFIFO(0..7) */ #define USBC_NPTXDFIFOX_DATA 0xffffffff -/* ---- bitmask_snprintf */ - -#define USBC_GOTGINT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x13" "DBNCEDONE\0" \ - "b\x12" "ADEVTOUTCHG\0" \ - "b\x11" "HSTNEGDET\0" \ - "b\x09" "HSTNEGSUCSTSCHNG\0" \ - "b\x08" "SESREQSUCSTSCHNG\0" \ - "b\x02" "SESENDDET\0" - -#define USBC_GINTSTS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x1f" "WKUPINT\0" \ - "b\x1e" "SESSREQINT\0" \ - "b\x1d" "DISCONNINT\0" \ - "b\x1c" "CONIDSTSCHNG\0" \ - "b\x1a" "PTXFEMP\0" \ - "b\x19" "HCHINT\0" \ - "b\x18" "PRTINT\0" \ - "b\x16" "FETSUSP\0" \ - "b\x15" "INCOMPLP\0" \ - "b\x14" "INCOMPISOIN\0" \ - "b\x13" "OEPINT\0" \ - "b\x12" "IEPINT\0" \ - "b\x11" "EPMIS\0" \ - "b\x0f" "EOPF\0" \ - "b\x0e" "ISOOUTDROP\0" \ - "b\x0d" "ENUMDONE\0" \ - "b\x0c" "USBRST\0" \ - "b\x0b" "USBSUSP\0" \ - "b\x0a" "ERLYSUSP\0" \ - "b\x09" "I2CINT\0" \ - "b\x08" "ULPICKINT\0" \ - "b\x07" "GOUTNAKEFF\0" \ - "b\x06" "GINNAKEFF\0" \ - "b\x05" "NPTXFEMP\0" \ - "b\x04" "RXFLVL\0" \ - "b\x03" "SOF\0" \ - "b\x02" "OTGINT\0" \ - "b\x01" "MODEMIS\0" \ - "b\x00" "CURMOD\0" - -#define USBC_GINTMSK_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x1f" "WKUPINTMSK\0" \ - "b\x1e" "SESSREQINTMSK\0" \ - "b\x1d" "DISCONNINTMSK\0" \ - "b\x1c" "CONIDSTSTCHNGMSK\0" \ - "b\x1a" "PTXFEMPMSK\0" \ - "b\x19" "HCHINTMSK\0" \ - "b\x18" "PRTINTMSK\0" \ - "b\x16" "FETSUSPMSK\0" \ - "b\x15" "INCOMPISOOUTMSK\0" \ - "b\x14" "INCOMPISOINMSK\0" \ - "b\x13" "OEPINTMSK\0" \ - "b\x12" "INEPINTMSK\0" \ - "b\x11" "EPMISMSK\0" \ - "b\x0f" "EOPFMSK\0" \ - "b\x0e" "ISOOUTDROPMSK\0" \ - "b\x0d" "ENUMDONEMSK\0" \ - "b\x0c" "USBRSTMSK\0" \ - "b\x0b" "USBSUSPMSK\0" \ - "b\x0a" "ERLYSUSPMSK\0" \ - "b\x09" "I2CINT\0" \ - "b\x08" "ULPICKINTMSK\0" \ - "b\x07" "GOUTNAKEFFMSK\0" \ - "b\x06" "GINNAKEFFMSK\0" \ - "b\x05" "NPTXFEMPMSK\0" \ - "b\x04" "RXFLVLMSK\0" \ - "b\x03" "SOFMSK\0" \ - "b\x02" "OTGINTMSK\0" \ - "b\x01" "MODEMISMSK\0" - -#define USBC_GRXSTSRH_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x11\x04" "PKTSTS\0" \ - "f\x0f\x02" "DPID\0" \ - "f\x04\x0b" "BCNT\0" \ - "f\x00\x04" "CHNUM\0" - -#define USBC_GRXSTSPH_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x11\x04" "PKTSTS\0" \ - "f\x0f\x02" "DPID\0" \ - "f\x04\x0b" "BCNT\0" \ - "f\x00\x04" "CHNUM\0" - -#define USBC_GUSBCFG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x10" "OTGI2CSEL\0" \ - "b\x0f" "PHYLPWRCLKSEL\0" \ - "f\x0a\x04" "USBTRDTIM\0" \ - "b\x09" "HNPCAP\0" \ - "b\x08" "SRPCAP\0" \ - "b\x07" "DDRSEL\0" \ - "b\x06" "PHYSEL\0" \ - "b\x05" "FSINTF\0" \ - "b\x04" "ULPI_UTMI_SEL\0" \ - "b\x03" "PHYIF\0" \ - "f\x00\x03" "TOUTCAL\0" - -#define USBC_GRSTCTL_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x1f" "AHBIDLE\0" \ - "b\x1e" "DMAREQ\0" \ - "f\x06\x05" "TXFNUM\0" \ - "b\x05" "TXFFLSH\0" \ - "b\x04" "RXFFLSH\0" \ - "b\x03" "INTKNQFLSH\0" \ - "b\x02" "FRMCNTRRST\0" \ - "b\x01" "HSFTRST\0" \ - "b\x00" "CSFTRST\0" - -#define USBC_GAHBCFG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x08" "PTXFEMPLVL\0" \ - "b\x07" "NPTXFEMPLVL\0" \ - "b\x05" "DMAEN\0" \ - "f\x01\x04" "HBSTLEN\0" \ - "b\x00" "GLBLINTRMSK\0" - -#define USBC_GRXFSIZ_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "RXFDEP\0" - -#define USBC_GNPTXFSIZ_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x10\x10" "NPTXFEDP\0" \ - "f\x00\x10" "NPTXFSTADDR\0" - -#define USBC_GNPTXSTS_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x1b\x04" "NPTXQTOP_CHNUM\0" \ - "f\x19\x02" "NPTXQTOP_ENTRY\0" \ - "b\x18" "NPTXQTOP_TERMINATE\0" \ - "f\x10\x08" "NPTXQSPCAVAIL\0" \ - "f\x00\x10" "NPTXFSPCAVAIL\0" - -#define USBC_GHWCFG1_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x20" "EPDIR\0" - -#define USBC_GHWCFG2_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x1a\x05" "TKNQDEPTH\0" \ - "f\x18\x02" "PTXQDEPTH\0" \ - "f\x16\x02" "NPTXQDEPTH\0" \ - "b\x13" "DYNFIFOSIZING\0" \ - "b\x12" "PERIOSUPPORT\0" \ - "f\x0e\x04" "NUMHSTCHN1\0" \ - "f\x0a\x04" "NUMDEVEPS\0" \ - "f\x08\x02" "FSPHYTYPE\0" \ - "f\x06\x02" "HSPHYTYPE\0" \ - "b\x05" "SINGPNT\0" \ - "f\x03\x02" "OTGARCH\0" \ - "f\x00\x03" "OTGMODE\0" - -#define USBC_GHWCFG3_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x10\x10" "DFIFODEPTH\0" \ - "b\x0c" "AHBPHYSYNC\0" \ - "b\x0b" "RSTTYPE\0" \ - "b\x0a" "OPTFEATURE\0" \ - "b\x09" "VENDOR_CONTROL_INTERFACE_SUPPORT\0" \ - "b\x08" "I2C_SELECTION\0" \ - "b\x07" "OTGEN\0" \ - "f\x04\x03" "PKTSIZEWIDTH\0" \ - "f\x00\x04" "XFERSIZEWIDTH\0" - -#define USBC_GHWCFG4_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x18" "BVAILDFLTR\0" \ - "b\x18" "SESSENDFLTR\0" \ - "b\x17" "AVAILDFLTR\0" \ - "b\x16" "VBUSVALIDFLTR\0" \ - "b\x15" "IDDGFLTR\0" \ - "f\x10\x04" "NUMCTLEPS\0" \ - "f\x0e\x02" "PHYDATAWIDTH\0" \ - "b\x05" "AHBFREQ\0" \ - "b\x04" "ENABLEPWROPT\0" \ - "f\x00\x04" "NUMDEVPERIOEPS\0" - -#define USBC_HCFG_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x02" "FSLSSUPP\0" \ - "f\x00\x02" "FSLSPCLKSEL\0" - -#define USBC_HPRT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x11\x02" "PRTSPD\0" \ - "f\x0d\x04" "PRTTSTCTL\0" \ - "b\x0c" "PRTPWR\0" \ - "f\x0a\x02" "PRTLNSTS\0" \ - "b\x08" "PRTRST\0" \ - "b\x07" "PRTSUSP\0" \ - "b\x06" "PRTRES\0" \ - "b\x05" "PRTOVRCURRCHNG\0" \ - "b\x04" "PRTOVRCURRACT\0" \ - "b\x03" "PRTENCHNG\0" \ - "b\x02" "PRTENA\0" \ - "b\x01" "PRTCONNDET\0" \ - "b\x00" "PRTCONNSTS\0" - -#define USBC_HFIR_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "f\x00\x10" "FRINT\0" - -#define USBC_HAINT_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x0f" "HAINT_F\0" \ - "b\x0e" "HAINT_E\0" \ - "b\x0d" "HAINT_D\0" \ - "b\x0c" "HAINT_C\0" \ - "b\x0b" "HAINT_B\0" \ - "b\x0a" "HAINT_A\0" \ - "b\x09" "HAINT_9\0" \ - "b\x08" "HAINT_8\0" \ - "b\x07" "HAINT_7\0" \ - "b\x06" "HAINT_6\0" \ - "b\x05" "HAINT_5\0" \ - "b\x04" "HAINT_4\0" \ - "b\x03" "HAINT_3\0" \ - "b\x02" "HAINT_2\0" \ - "b\x01" "HAINT_1\0" \ - "b\x00" "HAINT_0\0" - -#define USBC_HAINTMSK_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x0f" "HAINTMSK_F\0" \ - "b\x0e" "HAINTMSK_E\0" \ - "b\x0d" "HAINTMSK_D\0" \ - "b\x0c" "HAINTMSK_C\0" \ - "b\x0b" "HAINTMSK_B\0" \ - "b\x0a" "HAINTMSK_A\0" \ - "b\x09" "HAINTMSK_9\0" \ - "b\x08" "HAINTMSK_8\0" \ - "b\x07" "HAINTMSK_7\0" \ - "b\x06" "HAINTMSK_6\0" \ - "b\x05" "HAINTMSK_5\0" \ - "b\x04" "HAINTMSK_4\0" \ - "b\x03" "HAINTMSK_3\0" \ - "b\x02" "HAINTMSK_2\0" \ - "b\x01" "HAINTMSK_1\0" \ - "b\x00" "HAINTMSK_0\0" - -#define USBC_HCINTX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x0a" "DATATGLERR\0" \ - "b\x09" "FRMOVRUN\0" \ - "b\x08" "BBLERR\0" \ - "b\x07" "XACTERR\0" \ - "b\x06" "NYET\0" \ - "b\x05" "ACK\0" \ - "b\x04" "NAK\0" \ - "b\x03" "STALL\0" \ - "b\x02" "AHBERR\0" \ - "b\x01" "CHHLTD\0" \ - "b\x00" "XFERCOMPL\0" -#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_HCINTMSKX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x0a" "DATATGLERRMSK\0" \ - "b\x09" "FRMOVRUNMSK\0" \ - "b\x08" "BBLERRMSK\0" \ - "b\x07" "XACTERRMSK\0" \ - "b\x06" "NYETMSK\0" \ - "b\x05" "ACKMSK\0" \ - "b\x04" "NAKMSK\0" \ - "b\x03" "STALLMSK\0" \ - "b\x02" "AHBERRMSK\0" \ - "b\x01" "CHHLTDMSK\0" \ - "b\x00" "XFERCOMPLMSK\0" -#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_HCCHARX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x1f" "CHENA\0" \ - "b\x1e" "CHDIS\0" \ - "b\x1d" "ODDFRM\0" \ - "f\x16\x07" "DEVADDR\0" \ - "f\x14\x02" "EC\0" \ - "f\x12\x02" "EPTYPE\0" \ - "b\x11" "LSPDDEV\0" \ - "b\x0f" "EPDIR\0" \ - "f\x0b\x04" "EPNUM\0" \ - "f\x00\x0b" "MPS\0" -#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_HCTSIZX_BITS \ - "\177" /* new format */ \ - "\177" /* seil ext */ \ - "\020" /* hex display */ \ - "\020" /* %016x format */ \ - "b\x1f" "DOPNG\0" \ - "f\x1d\x02" "PID\0" \ - "f\x13\x0a" "PKTCNT\0" \ - "f\x00\x13" "XFERSIZE\0" -#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 USBC_HCTSIZ4_BITS USBC_HCTSIZX_BITS -#define USBC_HCTSIZ5_BITS USBC_HCTSIZX_BITS -#define USBC_HCTSIZ6_BITS USBC_HCTSIZX_BITS -#define USBC_HCTSIZ7_BITS USBC_HCTSIZX_BITS - /* ---- bus_space */ #define USBC_BASE 0x00016F0010000000ULL diff --git a/sys/arch/octeon/include/octeonvar.h b/sys/arch/octeon/include/octeonvar.h index f3ba0186265..245de165d6a 100644 --- a/sys/arch/octeon/include/octeonvar.h +++ b/sys/arch/octeon/include/octeonvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: octeonvar.h,v 1.20 2014/07/14 10:23:58 jasper Exp $ */ +/* $OpenBSD: octeonvar.h,v 1.21 2014/08/11 18:29:56 miod Exp $ */ /* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */ /*- @@ -421,47 +421,4 @@ octeon_get_cycles(void) return tmp; } -/* -------------------------------------------------------------------------- */ - -/* ---- event counter */ - -#if defined(OCTEON_ETH_DEBUG) -#define OCTEON_EVCNT_INC(sc, name) \ - do { (sc)->sc_ev_##name.ev_count++; } while (0) -#define OCTEON_EVCNT_ADD(sc, name, n) \ - do { (sc)->sc_ev_##name.ev_count += (n); } while (0) -#define OCTEON_EVCNT_ATTACH_EVCNTS(sc, entries, devname) \ -do { \ - int i; \ - const struct octeon_evcnt_entry *ee; \ - \ - for (i = 0; i < (int)nitems(entries); i++) { \ - ee = &(entries)[i]; \ - evcnt_attach_dynamic( \ - (struct evcnt *)((uintptr_t)(sc) + ee->ee_offset), \ - ee->ee_type, ee->ee_parent, devname, \ - ee->ee_name); \ - } \ -} while (0) -#else -#define OCTEON_EVCNT_INC(sc, name) -#define OCTEON_EVCNT_ADD(sc, name, n) -#define OCTEON_EVCNT_ATTACH_EVCNTS(sc, entries, devname) -#endif - -struct octeon_evcnt_entry { - size_t ee_offset; - int ee_type; - struct evcnt *ee_parent; - const char *ee_name; -}; - -#define OCTEON_EVCNT_ENTRY(_sc_type, _var, _ev_type, _parent, _name) \ - { \ - .ee_offset = offsetof(_sc_type, sc_ev_##_var), \ - .ee_type = EVCNT_TYPE_##_ev_type, \ - .ee_parent = _parent, \ - .ee_name = _name \ - } - #endif /* _MIPS_OCTEON_OCTEONVAR_H_ */ |