2 * Copyright (C) 2017 Chelsio Communications. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
18 #ifndef __CUDBG_ENTITY_H__
19 #define __CUDBG_ENTITY_H__
28 #define CUDBG_ENTITY_SIGNATURE 0xCCEDB001
30 struct cudbg_mbox_log {
31 struct mbox_cmd entry;
36 struct cudbg_cim_qcfg {
38 u16 base[CIM_NUM_IBQ + CIM_NUM_OBQ_T5];
39 u16 size[CIM_NUM_IBQ + CIM_NUM_OBQ_T5];
40 u16 thres[CIM_NUM_IBQ];
41 u32 obq_wr[2 * CIM_NUM_OBQ_T5];
42 u32 stat[4 * (CIM_NUM_IBQ + CIM_NUM_OBQ_T5)];
45 struct cudbg_rss_vf_conf {
50 struct cudbg_pm_stats {
51 u32 tx_cnt[T6_PM_NSTATS];
52 u32 rx_cnt[T6_PM_NSTATS];
53 u64 tx_cyc[T6_PM_NSTATS];
54 u64 rx_cyc[T6_PM_NSTATS];
57 struct cudbg_hw_sched {
60 u32 pace_tab[NTX_SCHED];
65 #define SGE_QBASE_DATA_REG_NUM 4
67 struct sge_qbase_reg_field {
69 u32 reg_data[SGE_QBASE_DATA_REG_NUM];
70 /* Max supported PFs */
71 u32 pf_data_value[PCIE_FW_MASTER_M + 1][SGE_QBASE_DATA_REG_NUM];
72 /* Max supported VFs */
73 u32 vf_data_value[T6_VF_M + 1][SGE_QBASE_DATA_REG_NUM];
74 u32 vfcount; /* Actual number of max vfs in current configuration */
80 u32 ireg_local_offset;
81 u32 ireg_offset_range;
85 struct ireg_field tp_pio;
89 struct cudbg_ulprx_la {
90 u32 data[ULPRX_LA_SIZE * 8];
100 static const char * const cudbg_region[] = {
101 "DBQ contexts:", "IMSG contexts:", "FLM cache:", "TCBs:",
102 "Pstructs:", "Timers:", "Rx FL:", "Tx FL:", "Pstruct FL:",
103 "Tx payload:", "Rx payload:", "LE hash:", "iSCSI region:",
104 "TDDP region:", "TPT region:", "STAG region:", "RQ region:",
105 "RQUDP region:", "PBL region:", "TXPBL region:",
106 "DBVFIFO region:", "ULPRX state:", "ULPTX state:",
110 /* Memory region info relative to current memory (i.e. wrt 0). */
111 struct cudbg_region_info {
112 bool exist; /* Does region exists in current memory? */
113 u32 start; /* Start wrt 0 */
114 u32 end; /* End wrt 0 */
117 struct cudbg_mem_desc {
123 #define CUDBG_MEMINFO_REV 1
125 struct cudbg_meminfo {
126 struct cudbg_mem_desc avail[4];
127 struct cudbg_mem_desc mem[ARRAY_SIZE(cudbg_region) + 3];
134 u32 rx_pages_data[3];
135 u32 tx_pages_data[4];
140 u32 loopback_used[NCHAN];
141 u32 loopback_alloc[NCHAN];
142 u32 p_structs_free_cnt;
147 struct cudbg_cim_pif_la {
152 struct cudbg_clk_info {
155 u64 persist_timer_min;
156 u64 persist_timer_max;
157 u64 keepalive_idle_timer;
158 u64 keepalive_interval;
168 struct cudbg_tid_info_region {
196 #define CUDBG_TID_INFO_REV 1
198 struct cudbg_tid_info_region_rev1 {
199 struct cudbg_ver_hdr ver_hdr;
200 struct cudbg_tid_info_region tid;
205 #define CUDBG_LOWMEM_MAX_CTXT_QIDS 256
206 #define CUDBG_MAX_FL_QIDS 1024
208 struct cudbg_ch_cntxt {
211 u32 data[SGE_CTXT_SIZE / 4];
214 #define CUDBG_MAX_RPLC_SIZE 128
216 struct cudbg_mps_tcam {
235 #define CUDBG_VPD_PF_SIZE 0x800
236 #define CUDBG_SCFG_VER_ADDR 0x06
237 #define CUDBG_SCFG_VER_LEN 4
238 #define CUDBG_VPD_VER_ADDR 0x18c7
239 #define CUDBG_VPD_VER_LEN 2
241 struct cudbg_vpd_data {
242 u8 sn[SERNUM_LEN + 1];
244 u8 na[MACADDR_LEN + 1];
254 #define CUDBG_MAX_TCAM_TID 0x800
255 #define CUDBG_T6_CLIP 1536
256 #define CUDBG_MAX_TID_COMP_EN 6144
257 #define CUDBG_MAX_TID_COMP_DIS 3072
259 enum cudbg_le_entry_types {
262 LE_ET_TCAM_SERVER = 2,
263 LE_ET_TCAM_FILTER = 3,
265 LE_ET_TCAM_ROUTING = 5,
267 LE_ET_INVALID_TID = 8,
279 struct cudbg_tid_data {
284 u32 data[NUM_LE_DB_DBGI_RSP_DATA_INSTANCES];
287 #define CUDBG_NUM_ULPTX 11
288 #define CUDBG_NUM_ULPTX_READ 512
289 #define CUDBG_NUM_ULPTX_ASIC 6
290 #define CUDBG_NUM_ULPTX_ASIC_READ 128
292 #define CUDBG_ULPTX_LA_REV 1
294 struct cudbg_ulptx_la {
295 u32 rdptr[CUDBG_NUM_ULPTX];
296 u32 wrptr[CUDBG_NUM_ULPTX];
297 u32 rddata[CUDBG_NUM_ULPTX];
298 u32 rd_data[CUDBG_NUM_ULPTX][CUDBG_NUM_ULPTX_READ];
299 u32 rdptr_asic[CUDBG_NUM_ULPTX_ASIC_READ];
300 u32 rddata_asic[CUDBG_NUM_ULPTX_ASIC_READ][CUDBG_NUM_ULPTX_ASIC];
303 #define CUDBG_CHAC_PBT_ADDR 0x2800
304 #define CUDBG_CHAC_PBT_LRF 0x3000
305 #define CUDBG_CHAC_PBT_DATA 0x3800
306 #define CUDBG_PBT_DYNAMIC_ENTRIES 8
307 #define CUDBG_PBT_STATIC_ENTRIES 16
308 #define CUDBG_LRF_ENTRIES 8
309 #define CUDBG_PBT_DATA_ENTRIES 512
311 struct cudbg_pbt_tables {
312 u32 pbt_dynamic[CUDBG_PBT_DYNAMIC_ENTRIES];
313 u32 pbt_static[CUDBG_PBT_STATIC_ENTRIES];
314 u32 lrf_table[CUDBG_LRF_ENTRIES];
315 u32 pbt_data[CUDBG_PBT_DATA_ENTRIES];
318 enum cudbg_qdesc_qtype {
319 CUDBG_QTYPE_UNKNOWN = 0,
327 CUDBG_QTYPE_OFLD_TXQ,
328 CUDBG_QTYPE_RDMA_RXQ,
329 CUDBG_QTYPE_RDMA_FLQ,
330 CUDBG_QTYPE_RDMA_CIQ,
331 CUDBG_QTYPE_ISCSI_RXQ,
332 CUDBG_QTYPE_ISCSI_FLQ,
333 CUDBG_QTYPE_ISCSIT_RXQ,
334 CUDBG_QTYPE_ISCSIT_FLQ,
335 CUDBG_QTYPE_CRYPTO_TXQ,
336 CUDBG_QTYPE_CRYPTO_RXQ,
337 CUDBG_QTYPE_CRYPTO_FLQ,
343 #define CUDBG_QDESC_REV 1
345 struct cudbg_qdesc_entry {
351 u8 data[0]; /* Must be last */
354 struct cudbg_qdesc_info {
355 u32 qdesc_entry_size;
357 u8 data[0]; /* Must be last */
360 #define IREG_NUM_ELEM 4
362 static const u32 t6_tp_pio_array[][IREG_NUM_ELEM] = {
363 {0x7e40, 0x7e44, 0x020, 28}, /* t6_tp_pio_regs_20_to_3b */
364 {0x7e40, 0x7e44, 0x040, 10}, /* t6_tp_pio_regs_40_to_49 */
365 {0x7e40, 0x7e44, 0x050, 10}, /* t6_tp_pio_regs_50_to_59 */
366 {0x7e40, 0x7e44, 0x060, 14}, /* t6_tp_pio_regs_60_to_6d */
367 {0x7e40, 0x7e44, 0x06F, 1}, /* t6_tp_pio_regs_6f */
368 {0x7e40, 0x7e44, 0x070, 6}, /* t6_tp_pio_regs_70_to_75 */
369 {0x7e40, 0x7e44, 0x130, 18}, /* t6_tp_pio_regs_130_to_141 */
370 {0x7e40, 0x7e44, 0x145, 19}, /* t6_tp_pio_regs_145_to_157 */
371 {0x7e40, 0x7e44, 0x160, 1}, /* t6_tp_pio_regs_160 */
372 {0x7e40, 0x7e44, 0x230, 25}, /* t6_tp_pio_regs_230_to_248 */
373 {0x7e40, 0x7e44, 0x24a, 3}, /* t6_tp_pio_regs_24c */
374 {0x7e40, 0x7e44, 0x8C0, 1} /* t6_tp_pio_regs_8c0 */
377 static const u32 t5_tp_pio_array[][IREG_NUM_ELEM] = {
378 {0x7e40, 0x7e44, 0x020, 28}, /* t5_tp_pio_regs_20_to_3b */
379 {0x7e40, 0x7e44, 0x040, 19}, /* t5_tp_pio_regs_40_to_52 */
380 {0x7e40, 0x7e44, 0x054, 2}, /* t5_tp_pio_regs_54_to_55 */
381 {0x7e40, 0x7e44, 0x060, 13}, /* t5_tp_pio_regs_60_to_6c */
382 {0x7e40, 0x7e44, 0x06F, 1}, /* t5_tp_pio_regs_6f */
383 {0x7e40, 0x7e44, 0x120, 4}, /* t5_tp_pio_regs_120_to_123 */
384 {0x7e40, 0x7e44, 0x12b, 2}, /* t5_tp_pio_regs_12b_to_12c */
385 {0x7e40, 0x7e44, 0x12f, 21}, /* t5_tp_pio_regs_12f_to_143 */
386 {0x7e40, 0x7e44, 0x145, 19}, /* t5_tp_pio_regs_145_to_157 */
387 {0x7e40, 0x7e44, 0x230, 25}, /* t5_tp_pio_regs_230_to_248 */
388 {0x7e40, 0x7e44, 0x8C0, 1} /* t5_tp_pio_regs_8c0 */
391 static const u32 t6_tp_tm_pio_array[][IREG_NUM_ELEM] = {
392 {0x7e18, 0x7e1c, 0x0, 12}
395 static const u32 t5_tp_tm_pio_array[][IREG_NUM_ELEM] = {
396 {0x7e18, 0x7e1c, 0x0, 12}
399 static const u32 t6_tp_mib_index_array[6][IREG_NUM_ELEM] = {
400 {0x7e50, 0x7e54, 0x0, 13},
401 {0x7e50, 0x7e54, 0x10, 6},
402 {0x7e50, 0x7e54, 0x18, 21},
403 {0x7e50, 0x7e54, 0x30, 32},
404 {0x7e50, 0x7e54, 0x50, 22},
405 {0x7e50, 0x7e54, 0x68, 12}
408 static const u32 t5_tp_mib_index_array[9][IREG_NUM_ELEM] = {
409 {0x7e50, 0x7e54, 0x0, 13},
410 {0x7e50, 0x7e54, 0x10, 6},
411 {0x7e50, 0x7e54, 0x18, 8},
412 {0x7e50, 0x7e54, 0x20, 13},
413 {0x7e50, 0x7e54, 0x30, 16},
414 {0x7e50, 0x7e54, 0x40, 16},
415 {0x7e50, 0x7e54, 0x50, 16},
416 {0x7e50, 0x7e54, 0x60, 6},
417 {0x7e50, 0x7e54, 0x68, 4}
420 static const u32 t5_sge_dbg_index_array[2][IREG_NUM_ELEM] = {
421 {0x10cc, 0x10d0, 0x0, 16},
422 {0x10cc, 0x10d4, 0x0, 16},
425 static const u32 t6_sge_qbase_index_array[] = {
426 /* 1 addr reg SGE_QBASE_INDEX and 4 data reg SGE_QBASE_MAP[0-3] */
427 0x1250, 0x1240, 0x1244, 0x1248, 0x124c,
430 static const u32 t5_pcie_pdbg_array[][IREG_NUM_ELEM] = {
431 {0x5a04, 0x5a0c, 0x00, 0x20}, /* t5_pcie_pdbg_regs_00_to_20 */
432 {0x5a04, 0x5a0c, 0x21, 0x20}, /* t5_pcie_pdbg_regs_21_to_40 */
433 {0x5a04, 0x5a0c, 0x41, 0x10}, /* t5_pcie_pdbg_regs_41_to_50 */
436 static const u32 t5_pcie_cdbg_array[][IREG_NUM_ELEM] = {
437 {0x5a10, 0x5a18, 0x00, 0x20}, /* t5_pcie_cdbg_regs_00_to_20 */
438 {0x5a10, 0x5a18, 0x21, 0x18}, /* t5_pcie_cdbg_regs_21_to_37 */
441 static const u32 t5_pm_rx_array[][IREG_NUM_ELEM] = {
442 {0x8FD0, 0x8FD4, 0x10000, 0x20}, /* t5_pm_rx_regs_10000_to_10020 */
443 {0x8FD0, 0x8FD4, 0x10021, 0x0D}, /* t5_pm_rx_regs_10021_to_1002c */
446 static const u32 t5_pm_tx_array[][IREG_NUM_ELEM] = {
447 {0x8FF0, 0x8FF4, 0x10000, 0x20}, /* t5_pm_tx_regs_10000_to_10020 */
448 {0x8FF0, 0x8FF4, 0x10021, 0x1D}, /* t5_pm_tx_regs_10021_to_1003c */
451 #define CUDBG_NUM_PCIE_CONFIG_REGS 0x61
453 static const u32 t5_pcie_config_array[][2] = {
470 static const u32 t6_ma_ireg_array[][IREG_NUM_ELEM] = {
471 {0x78f8, 0x78fc, 0xa000, 23}, /* t6_ma_regs_a000_to_a016 */
472 {0x78f8, 0x78fc, 0xa400, 30}, /* t6_ma_regs_a400_to_a41e */
473 {0x78f8, 0x78fc, 0xa800, 20} /* t6_ma_regs_a800_to_a813 */
476 static const u32 t6_ma_ireg_array2[][IREG_NUM_ELEM] = {
477 {0x78f8, 0x78fc, 0xe400, 17}, /* t6_ma_regs_e400_to_e600 */
478 {0x78f8, 0x78fc, 0xe640, 13} /* t6_ma_regs_e640_to_e7c0 */
481 static const u32 t6_up_cim_reg_array[][IREG_NUM_ELEM + 1] = {
482 {0x7b50, 0x7b54, 0x2000, 0x20, 0}, /* up_cim_2000_to_207c */
483 {0x7b50, 0x7b54, 0x2080, 0x1d, 0}, /* up_cim_2080_to_20fc */
484 {0x7b50, 0x7b54, 0x00, 0x20, 0}, /* up_cim_00_to_7c */
485 {0x7b50, 0x7b54, 0x80, 0x20, 0}, /* up_cim_80_to_fc */
486 {0x7b50, 0x7b54, 0x100, 0x11, 0}, /* up_cim_100_to_14c */
487 {0x7b50, 0x7b54, 0x200, 0x10, 0}, /* up_cim_200_to_23c */
488 {0x7b50, 0x7b54, 0x240, 0x2, 0}, /* up_cim_240_to_244 */
489 {0x7b50, 0x7b54, 0x250, 0x2, 0}, /* up_cim_250_to_254 */
490 {0x7b50, 0x7b54, 0x260, 0x2, 0}, /* up_cim_260_to_264 */
491 {0x7b50, 0x7b54, 0x270, 0x2, 0}, /* up_cim_270_to_274 */
492 {0x7b50, 0x7b54, 0x280, 0x20, 0}, /* up_cim_280_to_2fc */
493 {0x7b50, 0x7b54, 0x300, 0x20, 0}, /* up_cim_300_to_37c */
494 {0x7b50, 0x7b54, 0x380, 0x14, 0}, /* up_cim_380_to_3cc */
495 {0x7b50, 0x7b54, 0x4900, 0x4, 0x4}, /* up_cim_4900_to_4c60 */
496 {0x7b50, 0x7b54, 0x4904, 0x4, 0x4}, /* up_cim_4904_to_4c64 */
497 {0x7b50, 0x7b54, 0x4908, 0x4, 0x4}, /* up_cim_4908_to_4c68 */
498 {0x7b50, 0x7b54, 0x4910, 0x4, 0x4}, /* up_cim_4910_to_4c70 */
499 {0x7b50, 0x7b54, 0x4914, 0x4, 0x4}, /* up_cim_4914_to_4c74 */
500 {0x7b50, 0x7b54, 0x4920, 0x10, 0x10}, /* up_cim_4920_to_4a10 */
501 {0x7b50, 0x7b54, 0x4924, 0x10, 0x10}, /* up_cim_4924_to_4a14 */
502 {0x7b50, 0x7b54, 0x4928, 0x10, 0x10}, /* up_cim_4928_to_4a18 */
503 {0x7b50, 0x7b54, 0x492c, 0x10, 0x10}, /* up_cim_492c_to_4a1c */
506 static const u32 t5_up_cim_reg_array[][IREG_NUM_ELEM + 1] = {
507 {0x7b50, 0x7b54, 0x2000, 0x20, 0}, /* up_cim_2000_to_207c */
508 {0x7b50, 0x7b54, 0x2080, 0x19, 0}, /* up_cim_2080_to_20ec */
509 {0x7b50, 0x7b54, 0x00, 0x20, 0}, /* up_cim_00_to_7c */
510 {0x7b50, 0x7b54, 0x80, 0x20, 0}, /* up_cim_80_to_fc */
511 {0x7b50, 0x7b54, 0x100, 0x11, 0}, /* up_cim_100_to_14c */
512 {0x7b50, 0x7b54, 0x200, 0x10, 0}, /* up_cim_200_to_23c */
513 {0x7b50, 0x7b54, 0x240, 0x2, 0}, /* up_cim_240_to_244 */
514 {0x7b50, 0x7b54, 0x250, 0x2, 0}, /* up_cim_250_to_254 */
515 {0x7b50, 0x7b54, 0x260, 0x2, 0}, /* up_cim_260_to_264 */
516 {0x7b50, 0x7b54, 0x270, 0x2, 0}, /* up_cim_270_to_274 */
517 {0x7b50, 0x7b54, 0x280, 0x20, 0}, /* up_cim_280_to_2fc */
518 {0x7b50, 0x7b54, 0x300, 0x20, 0}, /* up_cim_300_to_37c */
519 {0x7b50, 0x7b54, 0x380, 0x14, 0}, /* up_cim_380_to_3cc */
522 static const u32 t6_hma_ireg_array[][IREG_NUM_ELEM] = {
523 {0x51320, 0x51324, 0xa000, 32} /* t6_hma_regs_a000_to_a01f */
525 #endif /* __CUDBG_ENTITY_H__ */