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 Rework CVMSEG LM usage a litte:



details:   https://anonhg.NetBSD.org/src/rev/647875e8aef5
branches:  trunk
changeset: 972729:647875e8aef5
user:      simonb <simonb%NetBSD.org@localhost>
date:      Fri Jun 05 09:18:35 2020 +0000

description:
Rework CVMSEG LM usage a litte:
 - remove unused LM slots
 - use #defines for defining the size of CVMSEG LM users

XXX: Need to dynamically set CVMMEMCTL[LMEMSZ] during startup so we can
     both adapt to any future increase in CVMSEG LM usage and not waste
     any more L2 that we need to.
XXX: Still need to move general IOBDMA conf to a different (new?) header.

diffstat:

 sys/arch/mips/cavium/dev/if_cnmac.c   |  14 ++++++++++++--
 sys/arch/mips/cavium/dev/octeon_rnm.c |   8 ++++----
 sys/arch/mips/cavium/octeonvar.h      |  22 +++++++---------------
 3 files changed, 23 insertions(+), 21 deletions(-)

diffs (102 lines):

diff -r 514e16a5ab8f -r 647875e8aef5 sys/arch/mips/cavium/dev/if_cnmac.c
--- a/sys/arch/mips/cavium/dev/if_cnmac.c       Fri Jun 05 08:02:32 2020 +0000
+++ b/sys/arch/mips/cavium/dev/if_cnmac.c       Fri Jun 05 09:18:35 2020 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: if_cnmac.c,v 1.19 2020/05/31 06:27:06 simonb Exp $     */
+/*     $NetBSD: if_cnmac.c,v 1.20 2020/06/05 09:18:35 simonb Exp $     */
 
 #include <sys/cdefs.h>
 #if 0
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.19 2020/05/31 06:27:06 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.20 2020/06/05 09:18:35 simonb Exp $");
 #endif
 
 #include "opt_octeon.h"
@@ -295,6 +295,16 @@
        sc->sc_gmx = ga->ga_gmx;
        sc->sc_gmx_port = ga->ga_gmx_port;
 
+       if (sc->sc_port >= CVMSEG_LM_ETHER_COUNT) {
+               /*
+                * If we got here, increase CVMSEG_LM_ETHER_COUNT
+                * in octeonvar.h .
+                */
+               printf("%s: ERROR out of CVMSEG LM buffers\n",
+                   device_xname(self));
+               return;
+       }
+
        sc->sc_init_flag = 0;
        /*
         * XXXUEBAYASI
diff -r 514e16a5ab8f -r 647875e8aef5 sys/arch/mips/cavium/dev/octeon_rnm.c
--- a/sys/arch/mips/cavium/dev/octeon_rnm.c     Fri Jun 05 08:02:32 2020 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_rnm.c     Fri Jun 05 09:18:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_rnm.c,v 1.9 2020/05/31 06:27:06 simonb Exp $    */
+/*     $NetBSD: octeon_rnm.c,v 1.10 2020/06/05 09:18:35 simonb Exp $   */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -99,7 +99,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.9 2020/05/31 06:27:06 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_rnm.c,v 1.10 2020/06/05 09:18:35 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -368,8 +368,8 @@
            __SHIFTIN(RNM_IOBDMA_MAJORDID, IOBDMA_MAJORDID) |
            __SHIFTIN(RNM_IOBDMA_SUBDID, IOBDMA_SUBDID);
 
-       KASSERT(nwords < 128);  /* iobdma address restriction */
-       KASSERT(nwords <= 32);  /* octeon_cvmseg_map limitation */
+       KASSERT(nwords < 128);                  /* iobdma address restriction */
+       KASSERT(nwords <= CVMSEG_LM_RNM_SIZE);  /* size of CVMSEM LM buffer */
 
        octeon_iobdma_write_8(iobdma);
        OCTEON_SYNCIOBDMA;
diff -r 514e16a5ab8f -r 647875e8aef5 sys/arch/mips/cavium/octeonvar.h
--- a/sys/arch/mips/cavium/octeonvar.h  Fri Jun 05 08:02:32 2020 +0000
+++ b/sys/arch/mips/cavium/octeonvar.h  Fri Jun 05 09:18:35 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeonvar.h,v 1.8 2020/05/31 06:27:06 simonb Exp $     */
+/*     $NetBSD: octeonvar.h,v 1.9 2020/06/05 09:18:35 simonb Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -148,26 +148,18 @@
 /*
  * CVMSEG (``scratch'') memory map
  */
+
+#define CVMSEG_LM_RNM_SIZE     16      /* limited by CN70XX hardware (why?) */
+#define CVMSEG_LM_ETHER_COUNT  4       /* limits number of cnmac devices */
+
 struct octeon_cvmseg_map {
-       /* 0-3 */
-       uint64_t                csm_xxx_0;
-       uint64_t                csm_xxx_1;
-       uint64_t                csm_xxx_2;
        uint64_t                csm_pow_intr;
 
-       /* 4-19 */
        struct octeon_cvmseg_ether_map {
-               uint64_t        csm_ether_fau_req;
                uint64_t        csm_ether_fau_done;
-               uint64_t        csm_ether_fau_cmdptr;
-               uint64_t        csm_ether_xxx_3;
-       } csm_ether[4/* XXX */];
+       } csm_ether[CVMSEG_LM_ETHER_COUNT];
 
-       /* 20-31 */
-       uint64_t        xxx_20_32[32 - 20];
-
-       /* 32-63 */
-       uint64_t        csm_rnm[32];
+       uint64_t        csm_rnm[CVMSEG_LM_RNM_SIZE];
 } __packed;
 #define        OCTEON_CVMSEG_OFFSET(entry) \
        offsetof(struct octeon_cvmseg_map, entry)



Home | Main Index | Thread Index | Old Index