blob: 8ae5eb47d6c251e55e11abfddac692eed7d36ac9 [file] [log] [blame]
Subhash Jadavanief542222017-08-02 16:23:55 -07001/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
Subhash Jadavanicce6fbc2016-08-11 11:35:26 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * UFS debugfs - add debugfs interface to the ufshcd.
13 * This is currently used for statistics collection and exporting from the
14 * UFS driver.
15 * This infrastructure can be used for debugging or direct tweaking
16 * of the driver from userspace.
17 *
18 */
19
20#ifndef _UFS_DEBUGFS_H
21#define _UFS_DEBUGFS_H
22
23#include <linux/debugfs.h>
24#include "ufshcd.h"
25
26enum ufsdbg_err_inject_scenario {
27 ERR_INJECT_INTR,
28 ERR_INJECT_PWR_CHANGE,
29 ERR_INJECT_UIC,
30 ERR_INJECT_DME_ATTR,
31 ERR_INJECT_QUERY,
32 ERR_INJECT_MAX_ERR_SCENARIOS,
33};
34
35#ifdef CONFIG_DEBUG_FS
36void ufsdbg_add_debugfs(struct ufs_hba *hba);
37void ufsdbg_remove_debugfs(struct ufs_hba *hba);
38void ufsdbg_pr_buf_to_std(struct ufs_hba *hba, int offset, int num_regs,
39 char *str, void *priv);
40void ufsdbg_set_err_state(struct ufs_hba *hba);
Subhash Jadavanief542222017-08-02 16:23:55 -070041void ufsdbg_clr_err_state(struct ufs_hba *hba);
Subhash Jadavanicce6fbc2016-08-11 11:35:26 -070042#else
43static inline void ufsdbg_add_debugfs(struct ufs_hba *hba)
44{
45}
46static inline void ufsdbg_remove_debugfs(struct ufs_hba *hba)
47{
48}
49static inline void ufsdbg_pr_buf_to_std(struct ufs_hba *hba, int offset,
50 int num_regs, char *str, void *priv)
51{
52}
53void ufsdbg_set_err_state(struct ufs_hba *hba)
54{
55}
Subhash Jadavanief542222017-08-02 16:23:55 -070056void ufsdbg_clr_err_state(struct ufs_hba *hba)
57{
58}
Subhash Jadavanicce6fbc2016-08-11 11:35:26 -070059#endif
60
61#ifdef CONFIG_UFS_FAULT_INJECTION
62void ufsdbg_error_inject_dispatcher(struct ufs_hba *hba,
63 enum ufsdbg_err_inject_scenario err_scenario,
64 int success_value, int *ret_value);
65#else
66static inline void ufsdbg_error_inject_dispatcher(struct ufs_hba *hba,
67 enum ufsdbg_err_inject_scenario err_scenario,
68 int success_value, int *ret_value)
69{
70}
71#endif
72
73#endif /* End of Header */