1 // SPDX-License-Identifier: GPL-2.0-only 2 /** 3 * debugfs routines supporting the Power 7+ Nest Accelerators driver 4 * 5 * Copyright (C) 2011-2012 International Business Machines Inc. 6 * 7 * Author: Kent Yoder <yoder1@us.ibm.com> 8 */ 9 10 #include <linux/device.h> 11 #include <linux/kobject.h> 12 #include <linux/string.h> 13 #include <linux/debugfs.h> 14 #include <linux/module.h> 15 #include <linux/init.h> 16 #include <linux/crypto.h> 17 #include <crypto/hash.h> 18 #include <asm/vio.h> 19 20 #include "nx_csbcpb.h" 21 #include "nx.h" 22 23 #ifdef CONFIG_DEBUG_FS 24 25 /* 26 * debugfs 27 * 28 * For documentation on these attributes, please see: 29 * 30 * Documentation/ABI/testing/debugfs-pfo-nx-crypto 31 */ 32 33 int nx_debugfs_init(struct nx_crypto_driver *drv) 34 { 35 struct nx_debugfs *dfs = &drv->dfs; 36 37 dfs->dfs_root = debugfs_create_dir(NX_NAME, NULL); 38 39 dfs->dfs_aes_ops = 40 debugfs_create_u32("aes_ops", 41 S_IRUSR | S_IRGRP | S_IROTH, 42 dfs->dfs_root, (u32 *)&drv->stats.aes_ops); 43 dfs->dfs_sha256_ops = 44 debugfs_create_u32("sha256_ops", 45 S_IRUSR | S_IRGRP | S_IROTH, 46 dfs->dfs_root, 47 (u32 *)&drv->stats.sha256_ops); 48 dfs->dfs_sha512_ops = 49 debugfs_create_u32("sha512_ops", 50 S_IRUSR | S_IRGRP | S_IROTH, 51 dfs->dfs_root, 52 (u32 *)&drv->stats.sha512_ops); 53 dfs->dfs_aes_bytes = 54 debugfs_create_u64("aes_bytes", 55 S_IRUSR | S_IRGRP | S_IROTH, 56 dfs->dfs_root, 57 (u64 *)&drv->stats.aes_bytes); 58 dfs->dfs_sha256_bytes = 59 debugfs_create_u64("sha256_bytes", 60 S_IRUSR | S_IRGRP | S_IROTH, 61 dfs->dfs_root, 62 (u64 *)&drv->stats.sha256_bytes); 63 dfs->dfs_sha512_bytes = 64 debugfs_create_u64("sha512_bytes", 65 S_IRUSR | S_IRGRP | S_IROTH, 66 dfs->dfs_root, 67 (u64 *)&drv->stats.sha512_bytes); 68 dfs->dfs_errors = 69 debugfs_create_u32("errors", 70 S_IRUSR | S_IRGRP | S_IROTH, 71 dfs->dfs_root, (u32 *)&drv->stats.errors); 72 dfs->dfs_last_error = 73 debugfs_create_u32("last_error", 74 S_IRUSR | S_IRGRP | S_IROTH, 75 dfs->dfs_root, 76 (u32 *)&drv->stats.last_error); 77 dfs->dfs_last_error_pid = 78 debugfs_create_u32("last_error_pid", 79 S_IRUSR | S_IRGRP | S_IROTH, 80 dfs->dfs_root, 81 (u32 *)&drv->stats.last_error_pid); 82 return 0; 83 } 84 85 void 86 nx_debugfs_fini(struct nx_crypto_driver *drv) 87 { 88 debugfs_remove_recursive(drv->dfs.dfs_root); 89 } 90 91 #endif 92