linux/drivers/crypto/nx/nx_debugfs.c
<<
>>
Prefs
   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
  33void nx_debugfs_init(struct nx_crypto_driver *drv)
  34{
  35        struct dentry *root;
  36
  37        root = debugfs_create_dir(NX_NAME, NULL);
  38        drv->dfs_root = root;
  39
  40        debugfs_create_u32("aes_ops", S_IRUSR | S_IRGRP | S_IROTH,
  41                           root, (u32 *)&drv->stats.aes_ops);
  42        debugfs_create_u32("sha256_ops", S_IRUSR | S_IRGRP | S_IROTH,
  43                           root, (u32 *)&drv->stats.sha256_ops);
  44        debugfs_create_u32("sha512_ops", S_IRUSR | S_IRGRP | S_IROTH,
  45                           root, (u32 *)&drv->stats.sha512_ops);
  46        debugfs_create_u64("aes_bytes", S_IRUSR | S_IRGRP | S_IROTH,
  47                           root, (u64 *)&drv->stats.aes_bytes);
  48        debugfs_create_u64("sha256_bytes", S_IRUSR | S_IRGRP | S_IROTH,
  49                           root, (u64 *)&drv->stats.sha256_bytes);
  50        debugfs_create_u64("sha512_bytes", S_IRUSR | S_IRGRP | S_IROTH,
  51                           root, (u64 *)&drv->stats.sha512_bytes);
  52        debugfs_create_u32("errors", S_IRUSR | S_IRGRP | S_IROTH,
  53                           root, (u32 *)&drv->stats.errors);
  54        debugfs_create_u32("last_error", S_IRUSR | S_IRGRP | S_IROTH,
  55                           root, (u32 *)&drv->stats.last_error);
  56        debugfs_create_u32("last_error_pid", S_IRUSR | S_IRGRP | S_IROTH,
  57                           root, (u32 *)&drv->stats.last_error_pid);
  58}
  59
  60void
  61nx_debugfs_fini(struct nx_crypto_driver *drv)
  62{
  63        debugfs_remove_recursive(drv->dfs_root);
  64}
  65
  66#endif
  67