Author: np
Date: Wed Aug 30 23:41:04 2017
New Revision: 323041
URL: https://svnweb.freebsd.org/changeset/base/323041

Log:
  cxgbe(4): Add two new debug flags -- one to allow manual firmware
  install after full initialization, and another to disable the TCB
  cache (T6+).  The latter works as a tunable only.
  
  Note that debug_flags are for debugging only and should not be set
  normally.
  
  MFC after:    1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/adapter.h
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/adapter.h
==============================================================================
--- head/sys/dev/cxgbe/adapter.h        Wed Aug 30 22:58:11 2017        
(r323040)
+++ head/sys/dev/cxgbe/adapter.h        Wed Aug 30 23:41:04 2017        
(r323041)
@@ -172,7 +172,9 @@ enum {
        INTR_ALL        = (INTR_RXQ | INTR_OFLD_RXQ),
 
        /* adapter debug_flags */
-       DF_DUMP_MBOX    = (1 << 0),
+       DF_DUMP_MBOX            = (1 << 0),     /* Log all mbox cmd/rpl. */
+       DF_LOAD_FW_ANYTIME      = (1 << 1),     /* Allow LOAD_FW after init */
+       DF_DISABLE_TCB_CACHE    = (1 << 2),     /* Disable TCB cache (T6+) */
 };
 
 #define IS_DOOMED(vi)  ((vi)->flags & DOOMED)

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c        Wed Aug 30 22:58:11 2017        
(r323040)
+++ head/sys/dev/cxgbe/t4_main.c        Wed Aug 30 23:41:04 2017        
(r323041)
@@ -9049,7 +9049,14 @@ load_fw(struct adapter *sc, struct t4_data *fw)
        if (rc)
                return (rc);
 
-       if (sc->flags & FULL_INIT_DONE) {
+       /*
+        * The firmware, with the sole exception of the memory parity error
+        * handler, runs from memory and not flash.  It is almost always safe to
+        * install a new firmware on a running system.  Just set bit 1 in
+        * hw.cxgbe.dflags or dev.<nexus>.<n>.dflags first.
+        */
+       if (sc->flags & FULL_INIT_DONE &&
+           (sc->debug_flags & DF_LOAD_FW_ANYTIME) == 0) {
                rc = EBUSY;
                goto done;
        }

Modified: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c Wed Aug 30 22:58:11 2017        (r323040)
+++ head/sys/dev/cxgbe/t4_sge.c Wed Aug 30 23:41:04 2017        (r323041)
@@ -615,6 +615,16 @@ t4_tweak_chip_settings(struct adapter *sc)
                else
                        v = V_TSCALE(tscale - 2);
                t4_set_reg_field(sc, A_SGE_ITP_CONTROL, m, v);
+
+               if (sc->debug_flags & DF_DISABLE_TCB_CACHE) {
+                       m = V_RDTHRESHOLD(M_RDTHRESHOLD) | F_WRTHRTHRESHEN |
+                           V_WRTHRTHRESH(M_WRTHRTHRESH);
+                       t4_tp_pio_read(sc, &v, 1, A_TP_CMM_CONFIG, 1);
+                       v &= ~m;
+                       v |= V_RDTHRESHOLD(1) | F_WRTHRTHRESHEN |
+                           V_WRTHRTHRESH(16);
+                       t4_tp_pio_write(sc, &v, 1, A_TP_CMM_CONFIG, 1);
+               }
        }
 
        /* 4K, 16K, 64K, 256K DDP "page sizes" for TDDP */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to