]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
cxgb4: collect PBT tables dump
authorRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Thu, 26 Oct 2017 11:48:38 +0000 (17:18 +0530)
committerDavid S. Miller <davem@davemloft.net>
Fri, 27 Oct 2017 14:48:30 +0000 (23:48 +0900)
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cudbg_entity.h
drivers/net/ethernet/chelsio/cxgb4/cudbg_if.h
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.h
drivers/net/ethernet/chelsio/cxgb4/cxgb4_cudbg.c

index 1860cf2b5286c91992c6acec65b700cac36ffedd..22853372abdffdb92bb0bdd44f8ac556273dc13f 100644 (file)
@@ -145,6 +145,21 @@ struct cudbg_ulptx_la {
        u32 rd_data[CUDBG_NUM_ULPTX][CUDBG_NUM_ULPTX_READ];
 };
 
+#define CUDBG_CHAC_PBT_ADDR 0x2800
+#define CUDBG_CHAC_PBT_LRF  0x3000
+#define CUDBG_CHAC_PBT_DATA 0x3800
+#define CUDBG_PBT_DYNAMIC_ENTRIES 8
+#define CUDBG_PBT_STATIC_ENTRIES 16
+#define CUDBG_LRF_ENTRIES 8
+#define CUDBG_PBT_DATA_ENTRIES 512
+
+struct cudbg_pbt_tables {
+       u32 pbt_dynamic[CUDBG_PBT_DYNAMIC_ENTRIES];
+       u32 pbt_static[CUDBG_PBT_STATIC_ENTRIES];
+       u32 lrf_table[CUDBG_LRF_ENTRIES];
+       u32 pbt_data[CUDBG_PBT_DATA_ENTRIES];
+};
+
 #define IREG_NUM_ELEM 4
 
 static const u32 t6_tp_pio_array[][IREG_NUM_ELEM] = {
index ce7bb909b8fdd8ee9260bad258d4a9d37905a0b2..f672799cc8d3c71a9a80f6e363cd60af95cce2bc 100644 (file)
@@ -62,6 +62,7 @@ enum cudbg_dbg_entity_type {
        CUDBG_MA_INDIRECT = 61,
        CUDBG_ULPTX_LA = 62,
        CUDBG_UP_CIM_INDIRECT = 64,
+       CUDBG_PBT_TABLE = 65,
        CUDBG_MBOX_LOG = 66,
        CUDBG_HMA_INDIRECT = 67,
        CUDBG_MAX_ENTITY = 70,
index 03f1ec0c01608b33a86efff885fb83333cb80f6b..c4096967c434e5171a50a83c164f40a6d568bed1 100644 (file)
@@ -1310,6 +1310,74 @@ int cudbg_collect_up_cim_indirect(struct cudbg_init *pdbg_init,
        return rc;
 }
 
+int cudbg_collect_pbt_tables(struct cudbg_init *pdbg_init,
+                            struct cudbg_buffer *dbg_buff,
+                            struct cudbg_error *cudbg_err)
+{
+       struct adapter *padap = pdbg_init->adap;
+       struct cudbg_buffer temp_buff = { 0 };
+       struct cudbg_pbt_tables *pbt;
+       int i, rc;
+       u32 addr;
+
+       rc = cudbg_get_buff(dbg_buff, sizeof(struct cudbg_pbt_tables),
+                           &temp_buff);
+       if (rc)
+               return rc;
+
+       pbt = (struct cudbg_pbt_tables *)temp_buff.data;
+       /* PBT dynamic entries */
+       addr = CUDBG_CHAC_PBT_ADDR;
+       for (i = 0; i < CUDBG_PBT_DYNAMIC_ENTRIES; i++) {
+               rc = t4_cim_read(padap, addr + (i * 4), 1,
+                                &pbt->pbt_dynamic[i]);
+               if (rc) {
+                       cudbg_err->sys_err = rc;
+                       cudbg_put_buff(&temp_buff, dbg_buff);
+                       return rc;
+               }
+       }
+
+       /* PBT static entries */
+       /* static entries start when bit 6 is set */
+       addr = CUDBG_CHAC_PBT_ADDR + (1 << 6);
+       for (i = 0; i < CUDBG_PBT_STATIC_ENTRIES; i++) {
+               rc = t4_cim_read(padap, addr + (i * 4), 1,
+                                &pbt->pbt_static[i]);
+               if (rc) {
+                       cudbg_err->sys_err = rc;
+                       cudbg_put_buff(&temp_buff, dbg_buff);
+                       return rc;
+               }
+       }
+
+       /* LRF entries */
+       addr = CUDBG_CHAC_PBT_LRF;
+       for (i = 0; i < CUDBG_LRF_ENTRIES; i++) {
+               rc = t4_cim_read(padap, addr + (i * 4), 1,
+                                &pbt->lrf_table[i]);
+               if (rc) {
+                       cudbg_err->sys_err = rc;
+                       cudbg_put_buff(&temp_buff, dbg_buff);
+                       return rc;
+               }
+       }
+
+       /* PBT data entries */
+       addr = CUDBG_CHAC_PBT_DATA;
+       for (i = 0; i < CUDBG_PBT_DATA_ENTRIES; i++) {
+               rc = t4_cim_read(padap, addr + (i * 4), 1,
+                                &pbt->pbt_data[i]);
+               if (rc) {
+                       cudbg_err->sys_err = rc;
+                       cudbg_put_buff(&temp_buff, dbg_buff);
+                       return rc;
+               }
+       }
+       cudbg_write_and_release_buff(&temp_buff, dbg_buff);
+       return rc;
+}
+
 int cudbg_collect_mbox_log(struct cudbg_init *pdbg_init,
                           struct cudbg_buffer *dbg_buff,
                           struct cudbg_error *cudbg_err)
index 280423f9869dbb85306d546fdcfdd7c2b09da0de..311b330bc3b271dd2988e26ab8c43ace0191473e 100644 (file)
@@ -123,6 +123,9 @@ int cudbg_collect_ulptx_la(struct cudbg_init *pdbg_init,
 int cudbg_collect_up_cim_indirect(struct cudbg_init *pdbg_init,
                                  struct cudbg_buffer *dbg_buff,
                                  struct cudbg_error *cudbg_err);
+int cudbg_collect_pbt_tables(struct cudbg_init *pdbg_init,
+                            struct cudbg_buffer *dbg_buff,
+                            struct cudbg_error *cudbg_err);
 int cudbg_collect_mbox_log(struct cudbg_init *pdbg_init,
                           struct cudbg_buffer *dbg_buff,
                           struct cudbg_error *cudbg_err);
index f1a1ece45b9785f94485cdd4f445afab645f92d8..003deb345ff2ff4178a9ba43581fa2425dcb24ce 100644 (file)
@@ -60,6 +60,7 @@ static const struct cxgb4_collect_entity cxgb4_collect_hw_dump[] = {
        { CUDBG_MA_INDIRECT, cudbg_collect_ma_indirect },
        { CUDBG_ULPTX_LA, cudbg_collect_ulptx_la },
        { CUDBG_UP_CIM_INDIRECT, cudbg_collect_up_cim_indirect },
+       { CUDBG_PBT_TABLE, cudbg_collect_pbt_tables },
        { CUDBG_HMA_INDIRECT, cudbg_collect_hma_indirect },
 };
 
@@ -215,6 +216,9 @@ static u32 cxgb4_get_entity_length(struct adapter *adap, u32 entity)
                n = sizeof(t5_up_cim_reg_array) / (IREG_NUM_ELEM * sizeof(u32));
                len = sizeof(struct ireg_buf) * n;
                break;
+       case CUDBG_PBT_TABLE:
+               len = sizeof(struct cudbg_pbt_tables);
+               break;
        case CUDBG_MBOX_LOG:
                len = sizeof(struct cudbg_mbox_log) * adap->mbox_log->size;
                break;