Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/cavium Minor tweaks and cleanup.



details:   https://anonhg.NetBSD.org/src/rev/35539e431be4
branches:  trunk
changeset: 935044:35539e431be4
user:      simonb <simonb%NetBSD.org@localhost>
date:      Tue Jun 23 05:14:18 2020 +0000

description:
Minor tweaks and cleanup.

diffstat:

 sys/arch/mips/cavium/dev/octeon_asx.c     |  15 ++++----
 sys/arch/mips/cavium/dev/octeon_ciu.c     |   6 +-
 sys/arch/mips/cavium/dev/octeon_fau.c     |   8 ++--
 sys/arch/mips/cavium/dev/octeon_fauvar.h  |   4 +-
 sys/arch/mips/cavium/dev/octeon_fpa.c     |   7 +--
 sys/arch/mips/cavium/dev/octeon_fpareg.h  |   4 +-
 sys/arch/mips/cavium/dev/octeon_fpavar.h  |  30 +++++++++--------
 sys/arch/mips/cavium/dev/octeon_usbnreg.h |  13 ++-----
 sys/arch/mips/cavium/octeon_cpunode.c     |  25 ++++++---------
 sys/arch/mips/cavium/octeon_iobus.c       |  51 +++++++++++++++++-------------
 10 files changed, 81 insertions(+), 82 deletions(-)

diffs (truncated from 504 to 300 lines):

diff -r ca91c17fa11a -r 35539e431be4 sys/arch/mips/cavium/dev/octeon_asx.c
--- a/sys/arch/mips/cavium/dev/octeon_asx.c     Tue Jun 23 03:09:35 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_asx.c     Tue Jun 23 05:14:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_asx.c,v 1.3 2020/06/22 02:26:19 simonb Exp $    */
+/*     $NetBSD: octeon_asx.c,v 1.4 2020/06/23 05:14:18 simonb Exp $    */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,9 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_asx.c,v 1.3 2020/06/22 02:26:19 simonb Exp $");
-
-#include "opt_octeon.h"
+__KERNEL_RCSID(0, "$NetBSD: octeon_asx.c,v 1.4 2020/06/23 05:14:18 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -84,9 +82,9 @@
 
        asx_tx_port = _ASX_RD8(sc, ASX0_TX_PRT_EN_OFFSET);
        if (enable)
-               SET(asx_tx_port, 1 << sc->sc_port);
+               SET(asx_tx_port, __BIT(sc->sc_port));
        else
-               CLR(asx_tx_port, 1 << sc->sc_port);
+               CLR(asx_tx_port, __BIT(sc->sc_port));
        _ASX_WR8(sc, ASX0_TX_PRT_EN_OFFSET, asx_tx_port);
        return 0;
 }
@@ -98,9 +96,9 @@
 
        asx_rx_port = _ASX_RD8(sc, ASX0_RX_PRT_EN_OFFSET);
        if (enable)
-               SET(asx_rx_port, 1 << sc->sc_port);
+               SET(asx_rx_port, __BIT(sc->sc_port));
        else
-               CLR(asx_rx_port, 1 << sc->sc_port);
+               CLR(asx_rx_port, __BIT(sc->sc_port));
        _ASX_WR8(sc, ASX0_RX_PRT_EN_OFFSET, asx_rx_port);
        return 0;
 }
@@ -108,6 +106,7 @@
 int
 octasx_clk_set(struct octasx_softc *sc, int tx_setting, int rx_setting)
 {
+
        _ASX_WR8(sc, ASX0_TX_CLK_SET0_OFFSET + 8 * sc->sc_port, tx_setting);
        _ASX_WR8(sc, ASX0_RX_CLK_SET0_OFFSET + 8 * sc->sc_port, rx_setting);
        return 0;
diff -r ca91c17fa11a -r 35539e431be4 sys/arch/mips/cavium/dev/octeon_ciu.c
--- a/sys/arch/mips/cavium/dev/octeon_ciu.c     Tue Jun 23 03:09:35 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_ciu.c     Tue Jun 23 05:14:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_ciu.c,v 1.3 2020/06/22 02:26:19 simonb Exp $    */
+/*     $NetBSD: octeon_ciu.c,v 1.4 2020/06/23 05:14:18 simonb Exp $    */
 
 /*
  * Copyright (c) 2008 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_ciu.c,v 1.3 2020/06/22 02:26:19 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_ciu.c,v 1.4 2020/06/23 05:14:18 simonb Exp $");
 
 #include "opt_octeon.h"
 
@@ -43,4 +43,4 @@
 #include <mips/cavium/octeonvar.h>
 #include <mips/cavium/dev/octeon_ciureg.h>
 
-/* XXX keep this file? */
+/* XXX Add MP IPI interrupt support */
diff -r ca91c17fa11a -r 35539e431be4 sys/arch/mips/cavium/dev/octeon_fau.c
--- a/sys/arch/mips/cavium/dev/octeon_fau.c     Tue Jun 23 03:09:35 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_fau.c     Tue Jun 23 05:14:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_fau.c,v 1.3 2020/06/18 13:52:08 simonb Exp $    */
+/*     $NetBSD: octeon_fau.c,v 1.4 2020/06/23 05:14:18 simonb Exp $    */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_fau.c,v 1.3 2020/06/18 13:52:08 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_fau.c,v 1.4 2020/06/23 05:14:18 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -52,7 +52,7 @@
        paddr_t addr = OCTEON_ADDR_IO_DID(FAU_MAJOR_DID, FAU_SUB_DID) |
            __SHIFTIN(args, OCTEON_ADDR_OFFSET);
 
-       return octeon_read_csr(addr);
+       return octeon_xkphys_read_8(addr);
 }
 
 static inline void
@@ -61,7 +61,7 @@
        paddr_t addr = OCTEON_ADDR_IO_DID(FAU_MAJOR_DID, FAU_SUB_DID) |
            __SHIFTIN(args, OCTEON_ADDR_OFFSET);
 
-       octeon_write_csr(addr, value);
+       octeon_xkphys_write_8(addr, value);
 }
 
 /* ---- operation primitives */
diff -r ca91c17fa11a -r 35539e431be4 sys/arch/mips/cavium/dev/octeon_fauvar.h
--- a/sys/arch/mips/cavium/dev/octeon_fauvar.h  Tue Jun 23 03:09:35 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_fauvar.h  Tue Jun 23 05:14:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_fauvar.h,v 1.3 2020/06/18 13:52:08 simonb Exp $ */
+/*     $NetBSD: octeon_fauvar.h,v 1.4 2020/06/23 05:14:18 simonb Exp $ */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -118,6 +118,7 @@
 static inline void
 octfau_op_inc_fetch_8(struct octfau_desc *fd, int64_t v)
 {
+
        octfau_op_iobdma_store_data(fd->fd_scroff, v, 0,
            OCT_FAU_OP_SIZE_64/* XXX */, fd->fd_regno);
 }
@@ -125,6 +126,7 @@
 static inline int64_t
 octfau_op_inc_read_8(struct octfau_desc *fd)
 {
+
        OCTEON_SYNCIOBDMA;
        return octeon_cvmseg_read_8(fd->fd_scroff);
 }
diff -r ca91c17fa11a -r 35539e431be4 sys/arch/mips/cavium/dev/octeon_fpa.c
--- a/sys/arch/mips/cavium/dev/octeon_fpa.c     Tue Jun 23 03:09:35 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_fpa.c     Tue Jun 23 05:14:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_fpa.c,v 1.7 2020/06/22 02:26:20 simonb Exp $    */
+/*     $NetBSD: octeon_fpa.c,v 1.8 2020/06/23 05:14:18 simonb Exp $    */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -29,9 +29,7 @@
 #undef FPADEBUG
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.7 2020/06/22 02:26:20 simonb Exp $");
-
-#include "opt_octeon.h"
+__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.8 2020/06/23 05:14:18 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -216,6 +214,7 @@
 void
 octfpa_init_bus(struct octfpa_softc *sc)
 {
+
        octfpa_init_bus_space(sc);
 }
 
diff -r ca91c17fa11a -r 35539e431be4 sys/arch/mips/cavium/dev/octeon_fpareg.h
--- a/sys/arch/mips/cavium/dev/octeon_fpareg.h  Tue Jun 23 03:09:35 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_fpareg.h  Tue Jun 23 05:14:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_fpareg.h,v 1.4 2020/06/22 12:26:11 simonb Exp $ */
+/*     $NetBSD: octeon_fpareg.h,v 1.5 2020/06/23 05:14:18 simonb Exp $ */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -177,6 +177,8 @@
 #define        FPA_BASE                                0x0001180028000000ULL
 #define        FPA_SIZE                                0x0200
 
+#define        FPA_NPOOLS                              8
+
 #define        FPA_INT_SUM_OFFSET                      0x0040
 #define        FPA_INT_ENB_OFFSET                      0x0048
 #define        FPA_CTL_STATUS_OFFSET                   0x0050
diff -r ca91c17fa11a -r 35539e431be4 sys/arch/mips/cavium/dev/octeon_fpavar.h
--- a/sys/arch/mips/cavium/dev/octeon_fpavar.h  Tue Jun 23 03:09:35 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_fpavar.h  Tue Jun 23 05:14:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_fpavar.h,v 1.6 2020/06/22 02:26:20 simonb Exp $ */
+/*     $NetBSD: octeon_fpavar.h,v 1.7 2020/06/23 05:14:18 simonb Exp $ */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -29,7 +29,10 @@
 #ifndef _OCTEON_FPAVAR_H_
 #define _OCTEON_FPAVAR_H_
 
+#include <mips/cache_octeon.h>
+
 #include <mips/cavium/octeonreg.h>
+#include <mips/cavium/dev/octeon_fpareg.h>
 
 struct octfpa_buf {
        int             fb_poolno;      /* pool # */
@@ -54,18 +57,16 @@
 uint64_t       octfpa_query(int);
 int            octfpa_available_fpa_pool(int *available, int pool_no);
 
-#define OCTEON_CACHE_LINE_SIZE (128)
+/* Pool sizes in bytes, must be multiple of a cache line */
+#define FPA_POOL_0_SIZE (16 * OCTEON_CACHELINE_SIZE)
+#define FPA_POOL_1_SIZE (1 * OCTEON_CACHELINE_SIZE)
+#define FPA_POOL_2_SIZE (8 * OCTEON_CACHELINE_SIZE)
+#define FPA_POOL_3_SIZE (4 * OCTEON_CACHELINE_SIZE)
 
-/* Pool sizes in bytes, must be multiple of a cache line */
-#define FPA_POOL_0_SIZE (16 * OCTEON_CACHE_LINE_SIZE)
-#define FPA_POOL_1_SIZE (1 * OCTEON_CACHE_LINE_SIZE)
-#define FPA_POOL_2_SIZE (8 * OCTEON_CACHE_LINE_SIZE)
-#define FPA_POOL_3_SIZE (4 * OCTEON_CACHE_LINE_SIZE)
-
-#define FPA_POOL_4_SIZE (16 * OCTEON_CACHE_LINE_SIZE)
-#define FPA_POOL_5_SIZE (16 * OCTEON_CACHE_LINE_SIZE)
-#define FPA_POOL_6_SIZE (16 * OCTEON_CACHE_LINE_SIZE)
-#define FPA_POOL_7_SIZE (16 * OCTEON_CACHE_LINE_SIZE)
+#define FPA_POOL_4_SIZE (16 * OCTEON_CACHELINE_SIZE)
+#define FPA_POOL_5_SIZE (16 * OCTEON_CACHELINE_SIZE)
+#define FPA_POOL_6_SIZE (16 * OCTEON_CACHELINE_SIZE)
+#define FPA_POOL_7_SIZE (16 * OCTEON_CACHELINE_SIZE)
 
 /* Pools in use */
 #define FPA_RECV_PKT_POOL              (0)     /* Receive Packet buffers */
@@ -96,7 +97,7 @@
        /* for FPA operations, subdid == pool number */
        uint64_t addr = OCTEON_ADDR_IO_DID(FPA_MAJOR_DID, fpapool);
 
-       return octeon_read_csr(addr);
+       return octeon_xkphys_read_8(addr);
 }
 
 #ifdef notyet
@@ -118,7 +119,8 @@
            __SHIFTIN(addr, FPA_OPS_STORE_ADDR);
 
        OCTEON_SYNCWS;
-       octeon_write_csr(ptr, __SHIFTIN(dwbcount, FPA_OPS_STORE_DATA_DWBCOUNT));
+       octeon_xkphys_write_8(ptr,
+           __SHIFTIN(dwbcount, FPA_OPS_STORE_DATA_DWBCOUNT));
 }
 
 static __inline paddr_t
diff -r ca91c17fa11a -r 35539e431be4 sys/arch/mips/cavium/dev/octeon_usbnreg.h
--- a/sys/arch/mips/cavium/dev/octeon_usbnreg.h Tue Jun 23 03:09:35 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_usbnreg.h Tue Jun 23 05:14:18 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_usbnreg.h,v 1.2 2020/06/22 03:05:07 simonb Exp $        */
+/*     $NetBSD: octeon_usbnreg.h,v 1.3 2020/06/23 05:14:18 simonb Exp $        */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -109,8 +109,9 @@
 #define USBN_CLK_CTL_P_XENBN                   UINT64_C(0x0000000000004000)
 #define USBN_CLK_CTL_P_COM_ON                  UINT64_C(0x0000000000002000)
 #define USBN_CLK_CTL_P_C_SEL                   UINT64_C(0x0000000000001800)
-#define  SET_USBN_CLK_CTL_P_C_SEL(v) (((v)<<11) & USBN_CLK_CTL_P_C_SEL)
-#define  GET_USBN_CLK_CTL_P_C_SEL(v) (((v) & USBN_CLK_CTL_P_C_SEL) >> 11)
+#define          USBN_CLK_CTL_P_C_SEL_12MHZ              0
+#define          USBN_CLK_CTL_P_C_SEL_24MHZ              1
+#define          USBN_CLK_CTL_P_C_SEL_48MHZ              2
 #define USBN_CLK_CTL_CDIV_BYP                  UINT64_C(0x0000000000000400)
 #define USBN_CLK_CTL_SD_MODE                   UINT64_C(0x0000000000000300)
 #define USBN_CLK_CTL_S_BIST                    UINT64_C(0x0000000000000080)
@@ -119,15 +120,9 @@
 #define USBN_CLK_CTL_PRST                      UINT64_C(0x0000000000000010)
 #define USBN_CLK_CTL_HRST                      UINT64_C(0x0000000000000008)
 #define USBN_CLK_CTL_DIVIDE                    UINT64_C(0x0000000000000007)
-#define  SET_USBN_CLK_CTL_DIVIDE(v) (((v)<<0) & USBN_CLK_CTL_DIVIDE)
-#define  GET_USBN_CLK_CTL_DIVIDE(v) (((v) & USBN_CLK_CTL_DIVIDE) >> 0)
 /* CN50xx extension */
 #define USBN_CLK_CTL_DIVIDE2                   UINT64_C(0x00000000000c0000)
-#define  SET_USBN_CLK_CTL_DIVIDE2(v) (((v)<<18) & USBN_CLK_CTL_DIVIDE2)
-#define  GET_USBN_CLK_CTL_DIVIDE2(v) (((v) & USBN_CLK_CTL_DIVIDE2) >> 18)
 #define USBN_CLK_CTL_P_RTYPE                   UINT64_C(0x000000000000c000)
-#define  SET_USBN_CLK_CTL_P_RTYPE(v) (((v)<<14) & USBN_CLK_CTL_P_RTYPE)
-#define  GET_USBN_CLK_CTL_P_RTYPE(v) (((v) & USBN_CLK_CTL_P_RTYPE) >> 14)
 
 #define USBN_USBP_CTL_STATUS_XXX_63_38         UINT64_C(0xffffffc000000000)
 #define USBN_USBP_CTL_STATUS_BIST_DONE         UINT64_C(0x0000002000000000)
diff -r ca91c17fa11a -r 35539e431be4 sys/arch/mips/cavium/octeon_cpunode.c
--- a/sys/arch/mips/cavium/octeon_cpunode.c     Tue Jun 23 03:09:35 2020 +0000
+++ b/sys/arch/mips/cavium/octeon_cpunode.c     Tue Jun 23 05:14:18 2020 +0000
@@ -29,7 +29,7 @@
 #define __INTR_PRIVATE
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: octeon_cpunode.c,v 1.12 2018/01/23 06:57:49 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_cpunode.c,v 1.13 2020/06/23 05:14:18 simonb Exp $");
 
 #include "locators.h"
 #include "cpunode.h"
@@ -63,7 +63,6 @@



Home | Main Index | Thread Index | Old Index