Merge tag 'uml-for-linus-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / drivers / crypto / cavium / nitrox / nitrox_debugfs.c
blob741572a019952e6517a71ddbcd9ca2a52b417f77
1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/seq_file.h>
3 #include <linux/debugfs.h>
5 #include "nitrox_csr.h"
6 #include "nitrox_debugfs.h"
7 #include "nitrox_dev.h"
9 static int firmware_show(struct seq_file *s, void *v)
11 struct nitrox_device *ndev = s->private;
13 seq_printf(s, "Version: %s\n", ndev->hw.fw_name[0]);
14 seq_printf(s, "Version: %s\n", ndev->hw.fw_name[1]);
15 return 0;
18 DEFINE_SHOW_ATTRIBUTE(firmware);
20 static int device_show(struct seq_file *s, void *v)
22 struct nitrox_device *ndev = s->private;
24 seq_printf(s, "NITROX [%d]\n", ndev->idx);
25 seq_printf(s, " Part Name: %s\n", ndev->hw.partname);
26 seq_printf(s, " Frequency: %d MHz\n", ndev->hw.freq);
27 seq_printf(s, " Device ID: 0x%0x\n", ndev->hw.device_id);
28 seq_printf(s, " Revision ID: 0x%0x\n", ndev->hw.revision_id);
29 seq_printf(s, " Cores: [AE=%u SE=%u ZIP=%u]\n",
30 ndev->hw.ae_cores, ndev->hw.se_cores, ndev->hw.zip_cores);
32 return 0;
35 DEFINE_SHOW_ATTRIBUTE(device);
37 static int stats_show(struct seq_file *s, void *v)
39 struct nitrox_device *ndev = s->private;
41 seq_printf(s, "NITROX [%d] Request Statistics\n", ndev->idx);
42 seq_printf(s, " Posted: %llu\n",
43 (u64)atomic64_read(&ndev->stats.posted));
44 seq_printf(s, " Completed: %llu\n",
45 (u64)atomic64_read(&ndev->stats.completed));
46 seq_printf(s, " Dropped: %llu\n",
47 (u64)atomic64_read(&ndev->stats.dropped));
49 return 0;
52 DEFINE_SHOW_ATTRIBUTE(stats);
54 void nitrox_debugfs_exit(struct nitrox_device *ndev)
56 debugfs_remove_recursive(ndev->debugfs_dir);
57 ndev->debugfs_dir = NULL;
60 void nitrox_debugfs_init(struct nitrox_device *ndev)
62 struct dentry *dir;
64 dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
66 ndev->debugfs_dir = dir;
67 debugfs_create_file("firmware", 0400, dir, ndev, &firmware_fops);
68 debugfs_create_file("device", 0400, dir, ndev, &device_fops);
69 debugfs_create_file("stats", 0400, dir, ndev, &stats_fops);