Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nx_debugfs.c
Go to the documentation of this file.
1 
22 #include <linux/device.h>
23 #include <linux/kobject.h>
24 #include <linux/string.h>
25 #include <linux/debugfs.h>
26 #include <linux/module.h>
27 #include <linux/init.h>
28 #include <linux/crypto.h>
29 #include <crypto/hash.h>
30 #include <asm/vio.h>
31 
32 #include "nx_csbcpb.h"
33 #include "nx.h"
34 
35 #ifdef CONFIG_DEBUG_FS
36 
37 /*
38  * debugfs
39  *
40  * For documentation on these attributes, please see:
41  *
42  * Documentation/ABI/testing/debugfs-pfo-nx-crypto
43  */
44 
45 int nx_debugfs_init(struct nx_crypto_driver *drv)
46 {
47  struct nx_debugfs *dfs = &drv->dfs;
48 
50 
51  dfs->dfs_aes_ops =
52  debugfs_create_u32("aes_ops",
54  dfs->dfs_root, (u32 *)&drv->stats.aes_ops);
55  dfs->dfs_sha256_ops =
56  debugfs_create_u32("sha256_ops",
58  dfs->dfs_root,
59  (u32 *)&drv->stats.sha256_ops);
60  dfs->dfs_sha512_ops =
61  debugfs_create_u32("sha512_ops",
63  dfs->dfs_root,
64  (u32 *)&drv->stats.sha512_ops);
65  dfs->dfs_aes_bytes =
66  debugfs_create_u64("aes_bytes",
68  dfs->dfs_root,
69  (u64 *)&drv->stats.aes_bytes);
70  dfs->dfs_sha256_bytes =
71  debugfs_create_u64("sha256_bytes",
73  dfs->dfs_root,
74  (u64 *)&drv->stats.sha256_bytes);
75  dfs->dfs_sha512_bytes =
76  debugfs_create_u64("sha512_bytes",
78  dfs->dfs_root,
79  (u64 *)&drv->stats.sha512_bytes);
80  dfs->dfs_errors =
81  debugfs_create_u32("errors",
83  dfs->dfs_root, (u32 *)&drv->stats.errors);
84  dfs->dfs_last_error =
85  debugfs_create_u32("last_error",
87  dfs->dfs_root,
88  (u32 *)&drv->stats.last_error);
89  dfs->dfs_last_error_pid =
90  debugfs_create_u32("last_error_pid",
92  dfs->dfs_root,
93  (u32 *)&drv->stats.last_error_pid);
94  return 0;
95 }
96 
97 void
98 nx_debugfs_fini(struct nx_crypto_driver *drv)
99 {
100  debugfs_remove_recursive(drv->dfs.dfs_root);
101 }
102 
103 #endif