Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * debugfs routines supporting the Power 7+ Nest Accelerators driver
0004  *
0005  * Copyright (C) 2011-2012 International Business Machines Inc.
0006  *
0007  * Author: Kent Yoder <yoder1@us.ibm.com>
0008  */
0009 
0010 #include <linux/device.h>
0011 #include <linux/kobject.h>
0012 #include <linux/string.h>
0013 #include <linux/debugfs.h>
0014 #include <linux/module.h>
0015 #include <linux/init.h>
0016 #include <linux/crypto.h>
0017 #include <crypto/hash.h>
0018 #include <asm/vio.h>
0019 
0020 #include "nx_csbcpb.h"
0021 #include "nx.h"
0022 
0023 #ifdef CONFIG_DEBUG_FS
0024 
0025 /*
0026  * debugfs
0027  *
0028  * For documentation on these attributes, please see:
0029  *
0030  * Documentation/ABI/testing/debugfs-pfo-nx-crypto
0031  */
0032 
0033 void nx_debugfs_init(struct nx_crypto_driver *drv)
0034 {
0035     struct dentry *root;
0036 
0037     root = debugfs_create_dir(NX_NAME, NULL);
0038     drv->dfs_root = root;
0039 
0040     debugfs_create_u32("aes_ops", S_IRUSR | S_IRGRP | S_IROTH,
0041                root, &drv->stats.aes_ops.counter);
0042     debugfs_create_u32("sha256_ops", S_IRUSR | S_IRGRP | S_IROTH,
0043                root, &drv->stats.sha256_ops.counter);
0044     debugfs_create_u32("sha512_ops", S_IRUSR | S_IRGRP | S_IROTH,
0045                root, &drv->stats.sha512_ops.counter);
0046     debugfs_create_u64("aes_bytes", S_IRUSR | S_IRGRP | S_IROTH,
0047                root, &drv->stats.aes_bytes.counter);
0048     debugfs_create_u64("sha256_bytes", S_IRUSR | S_IRGRP | S_IROTH,
0049                root, &drv->stats.sha256_bytes.counter);
0050     debugfs_create_u64("sha512_bytes", S_IRUSR | S_IRGRP | S_IROTH,
0051                root, &drv->stats.sha512_bytes.counter);
0052     debugfs_create_u32("errors", S_IRUSR | S_IRGRP | S_IROTH,
0053                root, &drv->stats.errors.counter);
0054     debugfs_create_u32("last_error", S_IRUSR | S_IRGRP | S_IROTH,
0055                root, &drv->stats.last_error.counter);
0056     debugfs_create_u32("last_error_pid", S_IRUSR | S_IRGRP | S_IROTH,
0057                root, &drv->stats.last_error_pid.counter);
0058 }
0059 
0060 void
0061 nx_debugfs_fini(struct nx_crypto_driver *drv)
0062 {
0063     debugfs_remove_recursive(drv->dfs_root);
0064 }
0065 
0066 #endif