2 * This file is part of the Chelsio T4 Ethernet driver for Linux.
4 * Copyright (c) 2003-2014 Chelsio Communications, Inc. All rights reserved.
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35 #include <linux/seq_file.h>
36 #include <linux/debugfs.h>
37 #include <linux/string_helpers.h>
38 #include <linux/sort.h>
43 #include "cxgb4_debugfs.h"
47 /* generic seq_file support for showing a table of size rows x width. */
48 static void *seq_tab_get_idx(struct seq_tab
*tb
, loff_t pos
)
50 pos
-= tb
->skip_first
;
51 return pos
>= tb
->rows
? NULL
: &tb
->data
[pos
* tb
->width
];
54 static void *seq_tab_start(struct seq_file
*seq
, loff_t
*pos
)
56 struct seq_tab
*tb
= seq
->private;
58 if (tb
->skip_first
&& *pos
== 0)
59 return SEQ_START_TOKEN
;
61 return seq_tab_get_idx(tb
, *pos
);
64 static void *seq_tab_next(struct seq_file
*seq
, void *v
, loff_t
*pos
)
66 v
= seq_tab_get_idx(seq
->private, *pos
+ 1);
72 static void seq_tab_stop(struct seq_file
*seq
, void *v
)
76 static int seq_tab_show(struct seq_file
*seq
, void *v
)
78 const struct seq_tab
*tb
= seq
->private;
80 return tb
->show(seq
, v
, ((char *)v
- tb
->data
) / tb
->width
);
83 static const struct seq_operations seq_tab_ops
= {
84 .start
= seq_tab_start
,
90 struct seq_tab
*seq_open_tab(struct file
*f
, unsigned int rows
,
91 unsigned int width
, unsigned int have_header
,
92 int (*show
)(struct seq_file
*seq
, void *v
, int i
))
96 p
= __seq_open_private(f
, &seq_tab_ops
, sizeof(*p
) + rows
* width
);
101 p
->skip_first
= have_header
!= 0;
106 static int cim_la_show(struct seq_file
*seq
, void *v
, int idx
)
108 if (v
== SEQ_START_TOKEN
)
109 seq_puts(seq
, "Status Data PC LS0Stat LS0Addr "
115 " %02x %x%07x %x%07x %08x %08x %08x%08x%08x%08x\n",
116 (p
[0] >> 4) & 0xff, p
[0] & 0xf, p
[1] >> 4,
117 p
[1] & 0xf, p
[2] >> 4, p
[2] & 0xf, p
[3], p
[4], p
[5],
123 static int cim_la_show_3in1(struct seq_file
*seq
, void *v
, int idx
)
125 if (v
== SEQ_START_TOKEN
) {
126 seq_puts(seq
, "Status Data PC\n");
130 seq_printf(seq
, " %02x %08x %08x\n", p
[5] & 0xff, p
[6],
132 seq_printf(seq
, " %02x %02x%06x %02x%06x\n",
133 (p
[3] >> 8) & 0xff, p
[3] & 0xff, p
[4] >> 8,
134 p
[4] & 0xff, p
[5] >> 8);
135 seq_printf(seq
, " %02x %x%07x %x%07x\n", (p
[0] >> 4) & 0xff,
136 p
[0] & 0xf, p
[1] >> 4, p
[1] & 0xf, p
[2] >> 4);
141 static int cim_la_open(struct inode
*inode
, struct file
*file
)
146 struct adapter
*adap
= inode
->i_private
;
148 ret
= t4_cim_read(adap
, UP_UP_DBG_LA_CFG_A
, 1, &cfg
);
152 p
= seq_open_tab(file
, adap
->params
.cim_la_size
/ 8, 8 * sizeof(u32
), 1,
153 cfg
& UPDBGLACAPTPCONLY_F
?
154 cim_la_show_3in1
: cim_la_show
);
158 ret
= t4_cim_read_la(adap
, (u32
*)p
->data
, NULL
);
160 seq_release_private(inode
, file
);
164 static const struct file_operations cim_la_fops
= {
165 .owner
= THIS_MODULE
,
169 .release
= seq_release_private
172 static int cim_qcfg_show(struct seq_file
*seq
, void *v
)
174 static const char * const qname
[] = {
175 "TP0", "TP1", "ULP", "SGE0", "SGE1", "NC-SI",
176 "ULP0", "ULP1", "ULP2", "ULP3", "SGE", "NC-SI",
181 struct adapter
*adap
= seq
->private;
182 u16 base
[CIM_NUM_IBQ
+ CIM_NUM_OBQ_T5
];
183 u16 size
[CIM_NUM_IBQ
+ CIM_NUM_OBQ_T5
];
184 u32 stat
[(4 * (CIM_NUM_IBQ
+ CIM_NUM_OBQ_T5
))];
185 u16 thres
[CIM_NUM_IBQ
];
186 u32 obq_wr_t4
[2 * CIM_NUM_OBQ
], *wr
;
187 u32 obq_wr_t5
[2 * CIM_NUM_OBQ_T5
];
189 int cim_num_obq
= is_t4(adap
->params
.chip
) ?
190 CIM_NUM_OBQ
: CIM_NUM_OBQ_T5
;
192 i
= t4_cim_read(adap
, is_t4(adap
->params
.chip
) ? UP_IBQ_0_RDADDR_A
:
193 UP_IBQ_0_SHADOW_RDADDR_A
,
194 ARRAY_SIZE(stat
), stat
);
196 if (is_t4(adap
->params
.chip
)) {
197 i
= t4_cim_read(adap
, UP_OBQ_0_REALADDR_A
,
198 ARRAY_SIZE(obq_wr_t4
), obq_wr_t4
);
201 i
= t4_cim_read(adap
, UP_OBQ_0_SHADOW_REALADDR_A
,
202 ARRAY_SIZE(obq_wr_t5
), obq_wr_t5
);
209 t4_read_cimq_cfg(adap
, base
, size
, thres
);
212 " Queue Base Size Thres RdPtr WrPtr SOP EOP Avail\n");
213 for (i
= 0; i
< CIM_NUM_IBQ
; i
++, p
+= 4)
214 seq_printf(seq
, "%7s %5x %5u %5u %6x %4x %4u %4u %5u\n",
215 qname
[i
], base
[i
], size
[i
], thres
[i
],
216 IBQRDADDR_G(p
[0]), IBQWRADDR_G(p
[1]),
217 QUESOPCNT_G(p
[3]), QUEEOPCNT_G(p
[3]),
218 QUEREMFLITS_G(p
[2]) * 16);
219 for ( ; i
< CIM_NUM_IBQ
+ cim_num_obq
; i
++, p
+= 4, wr
+= 2)
220 seq_printf(seq
, "%7s %5x %5u %12x %4x %4u %4u %5u\n",
221 qname
[i
], base
[i
], size
[i
],
222 QUERDADDR_G(p
[0]) & 0x3fff, wr
[0] - base
[i
],
223 QUESOPCNT_G(p
[3]), QUEEOPCNT_G(p
[3]),
224 QUEREMFLITS_G(p
[2]) * 16);
228 static int cim_qcfg_open(struct inode
*inode
, struct file
*file
)
230 return single_open(file
, cim_qcfg_show
, inode
->i_private
);
233 static const struct file_operations cim_qcfg_fops
= {
234 .owner
= THIS_MODULE
,
235 .open
= cim_qcfg_open
,
238 .release
= single_release
,
241 /* Firmware Device Log dump. */
242 static const char * const devlog_level_strings
[] = {
243 [FW_DEVLOG_LEVEL_EMERG
] = "EMERG",
244 [FW_DEVLOG_LEVEL_CRIT
] = "CRIT",
245 [FW_DEVLOG_LEVEL_ERR
] = "ERR",
246 [FW_DEVLOG_LEVEL_NOTICE
] = "NOTICE",
247 [FW_DEVLOG_LEVEL_INFO
] = "INFO",
248 [FW_DEVLOG_LEVEL_DEBUG
] = "DEBUG"
251 static const char * const devlog_facility_strings
[] = {
252 [FW_DEVLOG_FACILITY_CORE
] = "CORE",
253 [FW_DEVLOG_FACILITY_SCHED
] = "SCHED",
254 [FW_DEVLOG_FACILITY_TIMER
] = "TIMER",
255 [FW_DEVLOG_FACILITY_RES
] = "RES",
256 [FW_DEVLOG_FACILITY_HW
] = "HW",
257 [FW_DEVLOG_FACILITY_FLR
] = "FLR",
258 [FW_DEVLOG_FACILITY_DMAQ
] = "DMAQ",
259 [FW_DEVLOG_FACILITY_PHY
] = "PHY",
260 [FW_DEVLOG_FACILITY_MAC
] = "MAC",
261 [FW_DEVLOG_FACILITY_PORT
] = "PORT",
262 [FW_DEVLOG_FACILITY_VI
] = "VI",
263 [FW_DEVLOG_FACILITY_FILTER
] = "FILTER",
264 [FW_DEVLOG_FACILITY_ACL
] = "ACL",
265 [FW_DEVLOG_FACILITY_TM
] = "TM",
266 [FW_DEVLOG_FACILITY_QFC
] = "QFC",
267 [FW_DEVLOG_FACILITY_DCB
] = "DCB",
268 [FW_DEVLOG_FACILITY_ETH
] = "ETH",
269 [FW_DEVLOG_FACILITY_OFLD
] = "OFLD",
270 [FW_DEVLOG_FACILITY_RI
] = "RI",
271 [FW_DEVLOG_FACILITY_ISCSI
] = "ISCSI",
272 [FW_DEVLOG_FACILITY_FCOE
] = "FCOE",
273 [FW_DEVLOG_FACILITY_FOISCSI
] = "FOISCSI",
274 [FW_DEVLOG_FACILITY_FOFCOE
] = "FOFCOE"
277 /* Information gathered by Device Log Open routine for the display routine.
280 unsigned int nentries
; /* number of entries in log[] */
281 unsigned int first
; /* first [temporal] entry in log[] */
282 struct fw_devlog_e log
[0]; /* Firmware Device Log */
285 /* Dump a Firmaware Device Log entry.
287 static int devlog_show(struct seq_file
*seq
, void *v
)
289 if (v
== SEQ_START_TOKEN
)
290 seq_printf(seq
, "%10s %15s %8s %8s %s\n",
291 "Seq#", "Tstamp", "Level", "Facility", "Message");
293 struct devlog_info
*dinfo
= seq
->private;
294 int fidx
= (uintptr_t)v
- 2;
296 struct fw_devlog_e
*e
;
298 /* Get a pointer to the log entry to display. Skip unused log
301 index
= dinfo
->first
+ fidx
;
302 if (index
>= dinfo
->nentries
)
303 index
-= dinfo
->nentries
;
304 e
= &dinfo
->log
[index
];
305 if (e
->timestamp
== 0)
308 /* Print the message. This depends on the firmware using
309 * exactly the same formating strings as the kernel so we may
310 * eventually have to put a format interpreter in here ...
312 seq_printf(seq
, "%10d %15llu %8s %8s ",
313 e
->seqno
, e
->timestamp
,
314 (e
->level
< ARRAY_SIZE(devlog_level_strings
)
315 ? devlog_level_strings
[e
->level
]
317 (e
->facility
< ARRAY_SIZE(devlog_facility_strings
)
318 ? devlog_facility_strings
[e
->facility
]
320 seq_printf(seq
, e
->fmt
, e
->params
[0], e
->params
[1],
321 e
->params
[2], e
->params
[3], e
->params
[4],
322 e
->params
[5], e
->params
[6], e
->params
[7]);
327 /* Sequential File Operations for Device Log.
329 static inline void *devlog_get_idx(struct devlog_info
*dinfo
, loff_t pos
)
331 if (pos
> dinfo
->nentries
)
334 return (void *)(uintptr_t)(pos
+ 1);
337 static void *devlog_start(struct seq_file
*seq
, loff_t
*pos
)
339 struct devlog_info
*dinfo
= seq
->private;
342 ? devlog_get_idx(dinfo
, *pos
)
346 static void *devlog_next(struct seq_file
*seq
, void *v
, loff_t
*pos
)
348 struct devlog_info
*dinfo
= seq
->private;
351 return devlog_get_idx(dinfo
, *pos
);
354 static void devlog_stop(struct seq_file
*seq
, void *v
)
358 static const struct seq_operations devlog_seq_ops
= {
359 .start
= devlog_start
,
365 /* Set up for reading the firmware's device log. We read the entire log here
366 * and then display it incrementally in devlog_show().
368 static int devlog_open(struct inode
*inode
, struct file
*file
)
370 struct adapter
*adap
= inode
->i_private
;
371 struct devlog_params
*dparams
= &adap
->params
.devlog
;
372 struct devlog_info
*dinfo
;
377 /* If we don't know where the log is we can't do anything.
379 if (dparams
->start
== 0)
382 /* Allocate the space to read in the firmware's device log and set up
383 * for the iterated call to our display function.
385 dinfo
= __seq_open_private(file
, &devlog_seq_ops
,
386 sizeof(*dinfo
) + dparams
->size
);
390 /* Record the basic log buffer information and read in the raw log.
392 dinfo
->nentries
= (dparams
->size
/ sizeof(struct fw_devlog_e
));
394 spin_lock(&adap
->win0_lock
);
395 ret
= t4_memory_rw(adap
, adap
->params
.drv_memwin
, dparams
->memtype
,
396 dparams
->start
, dparams
->size
, (__be32
*)dinfo
->log
,
398 spin_unlock(&adap
->win0_lock
);
400 seq_release_private(inode
, file
);
404 /* Translate log multi-byte integral elements into host native format
405 * and determine where the first entry in the log is.
407 for (fseqno
= ~((u32
)0), index
= 0; index
< dinfo
->nentries
; index
++) {
408 struct fw_devlog_e
*e
= &dinfo
->log
[index
];
412 if (e
->timestamp
== 0)
415 e
->timestamp
= (__force __be64
)be64_to_cpu(e
->timestamp
);
416 seqno
= be32_to_cpu(e
->seqno
);
417 for (i
= 0; i
< 8; i
++)
419 (__force __be32
)be32_to_cpu(e
->params
[i
]);
421 if (seqno
< fseqno
) {
423 dinfo
->first
= index
;
429 static const struct file_operations devlog_fops
= {
430 .owner
= THIS_MODULE
,
434 .release
= seq_release_private
437 static ssize_t
flash_read(struct file
*file
, char __user
*buf
, size_t count
,
441 loff_t avail
= FILE_DATA(file
)->i_size
;
442 struct adapter
*adap
= file
->private_data
;
448 if (count
> avail
- pos
)
457 len
= min(count
+ ofst
, sizeof(data
));
458 ret
= t4_read_flash(adap
, pos
- ofst
, (len
+ 3) / 4,
464 if (copy_to_user(buf
, data
+ ofst
, len
))
476 static const struct file_operations flash_debugfs_fops
= {
477 .owner
= THIS_MODULE
,
482 static inline void tcamxy2valmask(u64 x
, u64 y
, u8
*addr
, u64
*mask
)
485 y
= (__force u64
)cpu_to_be64(y
);
486 memcpy(addr
, (char *)&y
+ 2, ETH_ALEN
);
489 static int mps_tcam_show(struct seq_file
*seq
, void *v
)
491 if (v
== SEQ_START_TOKEN
)
492 seq_puts(seq
, "Idx Ethernet address Mask Vld Ports PF"
498 struct adapter
*adap
= seq
->private;
499 unsigned int idx
= (uintptr_t)v
- 2;
500 u64 tcamy
= t4_read_reg64(adap
, MPS_CLS_TCAM_Y_L(idx
));
501 u64 tcamx
= t4_read_reg64(adap
, MPS_CLS_TCAM_X_L(idx
));
502 u32 cls_lo
= t4_read_reg(adap
, MPS_CLS_SRAM_L(idx
));
503 u32 cls_hi
= t4_read_reg(adap
, MPS_CLS_SRAM_H(idx
));
504 u32 rplc
[4] = {0, 0, 0, 0};
507 seq_printf(seq
, "%3u -\n", idx
);
511 if (cls_lo
& REPLICATE_F
) {
512 struct fw_ldst_cmd ldst_cmd
;
515 memset(&ldst_cmd
, 0, sizeof(ldst_cmd
));
516 ldst_cmd
.op_to_addrspace
=
517 htonl(FW_CMD_OP_V(FW_LDST_CMD
) |
520 FW_LDST_CMD_ADDRSPACE_V(
521 FW_LDST_ADDRSPC_MPS
));
522 ldst_cmd
.cycles_to_len16
= htonl(FW_LEN16(ldst_cmd
));
523 ldst_cmd
.u
.mps
.fid_ctl
=
524 htons(FW_LDST_CMD_FID_V(FW_LDST_MPS_RPLC
) |
525 FW_LDST_CMD_CTL_V(idx
));
526 ret
= t4_wr_mbox(adap
, adap
->mbox
, &ldst_cmd
,
527 sizeof(ldst_cmd
), &ldst_cmd
);
529 dev_warn(adap
->pdev_dev
, "Can't read MPS "
530 "replication map for idx %d: %d\n",
533 rplc
[0] = ntohl(ldst_cmd
.u
.mps
.rplc31_0
);
534 rplc
[1] = ntohl(ldst_cmd
.u
.mps
.rplc63_32
);
535 rplc
[2] = ntohl(ldst_cmd
.u
.mps
.rplc95_64
);
536 rplc
[3] = ntohl(ldst_cmd
.u
.mps
.rplc127_96
);
540 tcamxy2valmask(tcamx
, tcamy
, addr
, &mask
);
541 seq_printf(seq
, "%3u %02x:%02x:%02x:%02x:%02x:%02x %012llx"
543 idx
, addr
[0], addr
[1], addr
[2], addr
[3], addr
[4],
544 addr
[5], (unsigned long long)mask
,
545 (cls_lo
& SRAM_VLD_F
) ? 'Y' : 'N', PORTMAP_G(cls_hi
),
547 (cls_lo
& VF_VALID_F
) ? VF_G(cls_lo
) : -1);
548 if (cls_lo
& REPLICATE_F
)
549 seq_printf(seq
, " %08x %08x %08x %08x",
550 rplc
[3], rplc
[2], rplc
[1], rplc
[0]);
552 seq_printf(seq
, "%36c", ' ');
553 seq_printf(seq
, "%4u%3u%3u%3u %#x\n",
554 SRAM_PRIO0_G(cls_lo
), SRAM_PRIO1_G(cls_lo
),
555 SRAM_PRIO2_G(cls_lo
), SRAM_PRIO3_G(cls_lo
),
556 (cls_lo
>> MULTILISTEN0_S
) & 0xf);
561 static inline void *mps_tcam_get_idx(struct seq_file
*seq
, loff_t pos
)
563 struct adapter
*adap
= seq
->private;
564 int max_mac_addr
= is_t4(adap
->params
.chip
) ?
565 NUM_MPS_CLS_SRAM_L_INSTANCES
:
566 NUM_MPS_T5_CLS_SRAM_L_INSTANCES
;
567 return ((pos
<= max_mac_addr
) ? (void *)(uintptr_t)(pos
+ 1) : NULL
);
570 static void *mps_tcam_start(struct seq_file
*seq
, loff_t
*pos
)
572 return *pos
? mps_tcam_get_idx(seq
, *pos
) : SEQ_START_TOKEN
;
575 static void *mps_tcam_next(struct seq_file
*seq
, void *v
, loff_t
*pos
)
578 return mps_tcam_get_idx(seq
, *pos
);
581 static void mps_tcam_stop(struct seq_file
*seq
, void *v
)
585 static const struct seq_operations mps_tcam_seq_ops
= {
586 .start
= mps_tcam_start
,
587 .next
= mps_tcam_next
,
588 .stop
= mps_tcam_stop
,
589 .show
= mps_tcam_show
592 static int mps_tcam_open(struct inode
*inode
, struct file
*file
)
594 int res
= seq_open(file
, &mps_tcam_seq_ops
);
597 struct seq_file
*seq
= file
->private_data
;
599 seq
->private = inode
->i_private
;
604 static const struct file_operations mps_tcam_debugfs_fops
= {
605 .owner
= THIS_MODULE
,
606 .open
= mps_tcam_open
,
609 .release
= seq_release
,
612 #if IS_ENABLED(CONFIG_IPV6)
613 static int clip_tbl_open(struct inode
*inode
, struct file
*file
)
615 return single_open(file
, clip_tbl_show
, PDE_DATA(inode
));
618 static const struct file_operations clip_tbl_debugfs_fops
= {
619 .owner
= THIS_MODULE
,
620 .open
= clip_tbl_open
,
623 .release
= single_release
627 int mem_open(struct inode
*inode
, struct file
*file
)
630 struct adapter
*adap
;
632 file
->private_data
= inode
->i_private
;
634 mem
= (uintptr_t)file
->private_data
& 0x3;
635 adap
= file
->private_data
- mem
;
637 (void)t4_fwcache(adap
, FW_PARAM_DEV_FWCACHE_FLUSH
);
642 static ssize_t
mem_read(struct file
*file
, char __user
*buf
, size_t count
,
646 loff_t avail
= file_inode(file
)->i_size
;
647 unsigned int mem
= (uintptr_t)file
->private_data
& 3;
648 struct adapter
*adap
= file
->private_data
- mem
;
656 if (count
> avail
- pos
)
659 data
= t4_alloc_mem(count
);
663 spin_lock(&adap
->win0_lock
);
664 ret
= t4_memory_rw(adap
, 0, mem
, pos
, count
, data
, T4_MEMORY_READ
);
665 spin_unlock(&adap
->win0_lock
);
670 ret
= copy_to_user(buf
, data
, count
);
679 static const struct file_operations mem_debugfs_fops
= {
680 .owner
= THIS_MODULE
,
683 .llseek
= default_llseek
,
686 static void set_debugfs_file_size(struct dentry
*de
, loff_t size
)
688 if (!IS_ERR(de
) && de
->d_inode
)
689 de
->d_inode
->i_size
= size
;
692 static void add_debugfs_mem(struct adapter
*adap
, const char *name
,
693 unsigned int idx
, unsigned int size_mb
)
697 de
= debugfs_create_file(name
, S_IRUSR
, adap
->debugfs_root
,
698 (void *)adap
+ idx
, &mem_debugfs_fops
);
699 if (de
&& de
->d_inode
)
700 de
->d_inode
->i_size
= size_mb
<< 20;
703 /* Add an array of Debug FS files.
705 void add_debugfs_files(struct adapter
*adap
,
706 struct t4_debugfs_entry
*files
,
711 /* debugfs support is best effort */
712 for (i
= 0; i
< nfiles
; i
++)
713 debugfs_create_file(files
[i
].name
, files
[i
].mode
,
715 (void *)adap
+ files
[i
].data
,
719 int t4_setup_debugfs(struct adapter
*adap
)
725 static struct t4_debugfs_entry t4_debugfs_files
[] = {
726 { "cim_la", &cim_la_fops
, S_IRUSR
, 0 },
727 { "cim_qcfg", &cim_qcfg_fops
, S_IRUSR
, 0 },
728 { "devlog", &devlog_fops
, S_IRUSR
, 0 },
729 { "l2t", &t4_l2t_fops
, S_IRUSR
, 0},
730 { "mps_tcam", &mps_tcam_debugfs_fops
, S_IRUSR
, 0 },
731 #if IS_ENABLED(CONFIG_IPV6)
732 { "clip_tbl", &clip_tbl_debugfs_fops
, S_IRUSR
, 0 },
736 add_debugfs_files(adap
,
738 ARRAY_SIZE(t4_debugfs_files
));
740 i
= t4_read_reg(adap
, MA_TARGET_MEM_ENABLE_A
);
741 if (i
& EDRAM0_ENABLE_F
) {
742 size
= t4_read_reg(adap
, MA_EDRAM0_BAR_A
);
743 add_debugfs_mem(adap
, "edc0", MEM_EDC0
, EDRAM0_SIZE_G(size
));
745 if (i
& EDRAM1_ENABLE_F
) {
746 size
= t4_read_reg(adap
, MA_EDRAM1_BAR_A
);
747 add_debugfs_mem(adap
, "edc1", MEM_EDC1
, EDRAM1_SIZE_G(size
));
749 if (is_t4(adap
->params
.chip
)) {
750 size
= t4_read_reg(adap
, MA_EXT_MEMORY_BAR_A
);
751 if (i
& EXT_MEM_ENABLE_F
)
752 add_debugfs_mem(adap
, "mc", MEM_MC
,
753 EXT_MEM_SIZE_G(size
));
755 if (i
& EXT_MEM0_ENABLE_F
) {
756 size
= t4_read_reg(adap
, MA_EXT_MEMORY0_BAR_A
);
757 add_debugfs_mem(adap
, "mc0", MEM_MC0
,
758 EXT_MEM0_SIZE_G(size
));
760 if (i
& EXT_MEM1_ENABLE_F
) {
761 size
= t4_read_reg(adap
, MA_EXT_MEMORY1_BAR_A
);
762 add_debugfs_mem(adap
, "mc1", MEM_MC1
,
763 EXT_MEM1_SIZE_G(size
));
767 de
= debugfs_create_file("flash", S_IRUSR
, adap
->debugfs_root
, adap
,
768 &flash_debugfs_fops
);
769 set_debugfs_file_size(de
, adap
->params
.sf_size
);