1*175e0e23SKent Yoder /** 2*175e0e23SKent Yoder * debugfs routines supporting the Power 7+ Nest Accelerators driver 3*175e0e23SKent Yoder * 4*175e0e23SKent Yoder * Copyright (C) 2011-2012 International Business Machines Inc. 5*175e0e23SKent Yoder * 6*175e0e23SKent Yoder * This program is free software; you can redistribute it and/or modify 7*175e0e23SKent Yoder * it under the terms of the GNU General Public License as published by 8*175e0e23SKent Yoder * the Free Software Foundation; version 2 only. 9*175e0e23SKent Yoder * 10*175e0e23SKent Yoder * This program is distributed in the hope that it will be useful, 11*175e0e23SKent Yoder * but WITHOUT ANY WARRANTY; without even the implied warranty of 12*175e0e23SKent Yoder * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*175e0e23SKent Yoder * GNU General Public License for more details. 14*175e0e23SKent Yoder * 15*175e0e23SKent Yoder * You should have received a copy of the GNU General Public License 16*175e0e23SKent Yoder * along with this program; if not, write to the Free Software 17*175e0e23SKent Yoder * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18*175e0e23SKent Yoder * 19*175e0e23SKent Yoder * Author: Kent Yoder <yoder1@us.ibm.com> 20*175e0e23SKent Yoder */ 21*175e0e23SKent Yoder 22*175e0e23SKent Yoder #include <linux/device.h> 23*175e0e23SKent Yoder #include <linux/kobject.h> 24*175e0e23SKent Yoder #include <linux/string.h> 25*175e0e23SKent Yoder #include <linux/debugfs.h> 26*175e0e23SKent Yoder #include <linux/module.h> 27*175e0e23SKent Yoder #include <linux/init.h> 28*175e0e23SKent Yoder #include <linux/crypto.h> 29*175e0e23SKent Yoder #include <crypto/hash.h> 30*175e0e23SKent Yoder #include <asm/vio.h> 31*175e0e23SKent Yoder 32*175e0e23SKent Yoder #include "nx_csbcpb.h" 33*175e0e23SKent Yoder #include "nx.h" 34*175e0e23SKent Yoder 35*175e0e23SKent Yoder #ifdef CONFIG_DEBUG_FS 36*175e0e23SKent Yoder 37*175e0e23SKent Yoder /* 38*175e0e23SKent Yoder * debugfs 39*175e0e23SKent Yoder * 40*175e0e23SKent Yoder * For documentation on these attributes, please see: 41*175e0e23SKent Yoder * 42*175e0e23SKent Yoder * Documentation/ABI/testing/debugfs-pfo-nx-crypto 43*175e0e23SKent Yoder */ 44*175e0e23SKent Yoder 45*175e0e23SKent Yoder int nx_debugfs_init(struct nx_crypto_driver *drv) 46*175e0e23SKent Yoder { 47*175e0e23SKent Yoder struct nx_debugfs *dfs = &drv->dfs; 48*175e0e23SKent Yoder 49*175e0e23SKent Yoder dfs->dfs_root = debugfs_create_dir(NX_NAME, NULL); 50*175e0e23SKent Yoder 51*175e0e23SKent Yoder dfs->dfs_aes_ops = 52*175e0e23SKent Yoder debugfs_create_u32("aes_ops", 53*175e0e23SKent Yoder S_IRUSR | S_IRGRP | S_IROTH, 54*175e0e23SKent Yoder dfs->dfs_root, (u32 *)&drv->stats.aes_ops); 55*175e0e23SKent Yoder dfs->dfs_sha256_ops = 56*175e0e23SKent Yoder debugfs_create_u32("sha256_ops", 57*175e0e23SKent Yoder S_IRUSR | S_IRGRP | S_IROTH, 58*175e0e23SKent Yoder dfs->dfs_root, 59*175e0e23SKent Yoder (u32 *)&drv->stats.sha256_ops); 60*175e0e23SKent Yoder dfs->dfs_sha512_ops = 61*175e0e23SKent Yoder debugfs_create_u32("sha512_ops", 62*175e0e23SKent Yoder S_IRUSR | S_IRGRP | S_IROTH, 63*175e0e23SKent Yoder dfs->dfs_root, 64*175e0e23SKent Yoder (u32 *)&drv->stats.sha512_ops); 65*175e0e23SKent Yoder dfs->dfs_aes_bytes = 66*175e0e23SKent Yoder debugfs_create_u64("aes_bytes", 67*175e0e23SKent Yoder S_IRUSR | S_IRGRP | S_IROTH, 68*175e0e23SKent Yoder dfs->dfs_root, 69*175e0e23SKent Yoder (u64 *)&drv->stats.aes_bytes); 70*175e0e23SKent Yoder dfs->dfs_sha256_bytes = 71*175e0e23SKent Yoder debugfs_create_u64("sha256_bytes", 72*175e0e23SKent Yoder S_IRUSR | S_IRGRP | S_IROTH, 73*175e0e23SKent Yoder dfs->dfs_root, 74*175e0e23SKent Yoder (u64 *)&drv->stats.sha256_bytes); 75*175e0e23SKent Yoder dfs->dfs_sha512_bytes = 76*175e0e23SKent Yoder debugfs_create_u64("sha512_bytes", 77*175e0e23SKent Yoder S_IRUSR | S_IRGRP | S_IROTH, 78*175e0e23SKent Yoder dfs->dfs_root, 79*175e0e23SKent Yoder (u64 *)&drv->stats.sha512_bytes); 80*175e0e23SKent Yoder dfs->dfs_errors = 81*175e0e23SKent Yoder debugfs_create_u32("errors", 82*175e0e23SKent Yoder S_IRUSR | S_IRGRP | S_IROTH, 83*175e0e23SKent Yoder dfs->dfs_root, (u32 *)&drv->stats.errors); 84*175e0e23SKent Yoder dfs->dfs_last_error = 85*175e0e23SKent Yoder debugfs_create_u32("last_error", 86*175e0e23SKent Yoder S_IRUSR | S_IRGRP | S_IROTH, 87*175e0e23SKent Yoder dfs->dfs_root, 88*175e0e23SKent Yoder (u32 *)&drv->stats.last_error); 89*175e0e23SKent Yoder dfs->dfs_last_error_pid = 90*175e0e23SKent Yoder debugfs_create_u32("last_error_pid", 91*175e0e23SKent Yoder S_IRUSR | S_IRGRP | S_IROTH, 92*175e0e23SKent Yoder dfs->dfs_root, 93*175e0e23SKent Yoder (u32 *)&drv->stats.last_error_pid); 94*175e0e23SKent Yoder return 0; 95*175e0e23SKent Yoder } 96*175e0e23SKent Yoder 97*175e0e23SKent Yoder void 98*175e0e23SKent Yoder nx_debugfs_fini(struct nx_crypto_driver *drv) 99*175e0e23SKent Yoder { 100*175e0e23SKent Yoder debugfs_remove_recursive(drv->dfs.dfs_root); 101*175e0e23SKent Yoder } 102*175e0e23SKent Yoder 103*175e0e23SKent Yoder #endif 104