Path: blob/master/drivers/crypto/cavium/nitrox/nitrox_debugfs.c
26285 views
// SPDX-License-Identifier: GPL-2.01#include <linux/seq_file.h>2#include <linux/debugfs.h>34#include "nitrox_csr.h"5#include "nitrox_debugfs.h"6#include "nitrox_dev.h"78static int firmware_show(struct seq_file *s, void *v)9{10struct nitrox_device *ndev = s->private;1112seq_printf(s, "Version: %s\n", ndev->hw.fw_name[0]);13seq_printf(s, "Version: %s\n", ndev->hw.fw_name[1]);14return 0;15}1617DEFINE_SHOW_ATTRIBUTE(firmware);1819static int device_show(struct seq_file *s, void *v)20{21struct nitrox_device *ndev = s->private;2223seq_printf(s, "NITROX [%d]\n", ndev->idx);24seq_printf(s, " Part Name: %s\n", ndev->hw.partname);25seq_printf(s, " Frequency: %d MHz\n", ndev->hw.freq);26seq_printf(s, " Device ID: 0x%0x\n", ndev->hw.device_id);27seq_printf(s, " Revision ID: 0x%0x\n", ndev->hw.revision_id);28seq_printf(s, " Cores: [AE=%u SE=%u ZIP=%u]\n",29ndev->hw.ae_cores, ndev->hw.se_cores, ndev->hw.zip_cores);3031return 0;32}3334DEFINE_SHOW_ATTRIBUTE(device);3536static int stats_show(struct seq_file *s, void *v)37{38struct nitrox_device *ndev = s->private;3940seq_printf(s, "NITROX [%d] Request Statistics\n", ndev->idx);41seq_printf(s, " Posted: %llu\n",42(u64)atomic64_read(&ndev->stats.posted));43seq_printf(s, " Completed: %llu\n",44(u64)atomic64_read(&ndev->stats.completed));45seq_printf(s, " Dropped: %llu\n",46(u64)atomic64_read(&ndev->stats.dropped));4748return 0;49}5051DEFINE_SHOW_ATTRIBUTE(stats);5253void nitrox_debugfs_exit(struct nitrox_device *ndev)54{55debugfs_remove_recursive(ndev->debugfs_dir);56ndev->debugfs_dir = NULL;57}5859void nitrox_debugfs_init(struct nitrox_device *ndev)60{61struct dentry *dir;6263dir = debugfs_create_dir(KBUILD_MODNAME, NULL);6465ndev->debugfs_dir = dir;66debugfs_create_file("firmware", 0400, dir, ndev, &firmware_fops);67debugfs_create_file("device", 0400, dir, ndev, &device_fops);68debugfs_create_file("stats", 0400, dir, ndev, &stats_fops);69}707172