19 #include <linux/export.h>
97 spin_unlock_irqrestore(&bfad->
bfad_lock, flags);
113 bfad_debugfs_open_fwsave(
struct inode *inode,
struct file *file)
141 spin_unlock_irqrestore(&bfad->
bfad_lock, flags);
157 bfad_debugfs_open_reg(
struct inode *inode,
struct file *file)
174 bfad_debugfs_lseek(
struct file *file, loff_t
offset,
int orig)
204 bfad_debugfs_read(
struct file *file,
char __user *
buf,
205 size_t nbytes, loff_t *pos)
216 #define BFA_REG_CT_ADDRSZ (0x40000)
217 #define BFA_REG_CB_ADDRSZ (0x20000)
218 #define BFA_REG_ADDRSZ(__ioc) \
219 ((u32)(bfa_asic_id_ctc(bfa_ioc_devid(__ioc)) ? \
220 BFA_REG_CT_ADDRSZ : BFA_REG_CB_ADDRSZ))
221 #define BFA_REG_ADDRMSK(__ioc) (BFA_REG_ADDRSZ(__ioc) - 1)
224 bfad_reg_offset_check(
struct bfa_s *bfa,
u32 offset,
u32 len)
229 area = (offset >> 15) & 0x7;
232 if ((offset + (len<<2)) > 0x8000)
234 }
else if (area == 0x1) {
236 if ((offset + (len<<2)) > 0x10000)
247 bfad_debugfs_read_regrd(
struct file *file,
char __user *buf,
248 size_t nbytes, loff_t *pos)
261 if ((*pos + nbytes) >= bfad->
reglen) {
271 bfad_debugfs_write_regrd(
struct file *file,
const char __user *buf,
272 size_t nbytes, loff_t *ppos)
279 int addr, len, rc,
i;
298 rc =
sscanf(kern_buf,
"%x:%x", &addr, &len);
301 "bfad[%d]: %s failed to read user buf\n",
324 rc = bfad_reg_offset_check(bfa, addr, len);
337 for (
i = 0;
i <
len;
i++) {
342 spin_unlock_irqrestore(&bfad->
bfad_lock, flags);
348 bfad_debugfs_write_regwr(
struct file *file,
const char __user *buf,
349 size_t nbytes, loff_t *ppos)
374 rc =
sscanf(kern_buf,
"%x:%x", &addr, &
val);
377 "bfad[%d]: %s failed to read user buf\n",
387 rc = bfad_reg_offset_check(bfa, addr, 1);
390 "bfad[%d]: Failed reg offset check\n",
398 spin_unlock_irqrestore(&bfad->
bfad_lock, flags);
404 bfad_debugfs_release(
struct inode *inode,
struct file *file)
417 bfad_debugfs_release_fwtrc(
struct inode *inode,
struct file *file)
434 .open = bfad_debugfs_open_drvtrc,
435 .llseek = bfad_debugfs_lseek,
436 .read = bfad_debugfs_read,
437 .release = bfad_debugfs_release,
442 .open = bfad_debugfs_open_fwtrc,
443 .llseek = bfad_debugfs_lseek,
444 .read = bfad_debugfs_read,
445 .release = bfad_debugfs_release_fwtrc,
450 .open = bfad_debugfs_open_fwsave,
451 .llseek = bfad_debugfs_lseek,
452 .read = bfad_debugfs_read,
453 .release = bfad_debugfs_release_fwtrc,
458 .open = bfad_debugfs_open_reg,
459 .llseek = bfad_debugfs_lseek,
460 .read = bfad_debugfs_read_regrd,
461 .write = bfad_debugfs_write_regrd,
462 .release = bfad_debugfs_release,
467 .open = bfad_debugfs_open_reg,
468 .llseek = bfad_debugfs_lseek,
469 .write = bfad_debugfs_write_regwr,
470 .release = bfad_debugfs_release,
487 static struct dentry *bfa_debugfs_root;
488 static atomic_t bfa_debugfs_port_count;
502 if (!bfa_debugfs_root) {
505 if (!bfa_debugfs_root) {
507 "BFA debugfs root dir creation failed\n");
519 "bfa %s: debugfs root creation failed\n",
526 for (i = 0; i <
ARRAY_SIZE(bfad_debugfs_files); i++) {
527 file = &bfad_debugfs_files[
i];
536 "bfa %s: debugfs %s creation failed\n",
553 for (i = 0; i <
ARRAY_SIZE(bfad_debugfs_files); i++) {
570 bfa_debugfs_root =
NULL;