Subhash Jadavani | ef54222 | 2017-08-02 16:23:55 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. |
Subhash Jadavani | cce6fbc | 2016-08-11 11:35:26 -0700 | [diff] [blame] | 2 | * |
| 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 | |
| 26 | enum 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 |
| 36 | void ufsdbg_add_debugfs(struct ufs_hba *hba); |
| 37 | void ufsdbg_remove_debugfs(struct ufs_hba *hba); |
| 38 | void ufsdbg_pr_buf_to_std(struct ufs_hba *hba, int offset, int num_regs, |
| 39 | char *str, void *priv); |
| 40 | void ufsdbg_set_err_state(struct ufs_hba *hba); |
Subhash Jadavani | ef54222 | 2017-08-02 16:23:55 -0700 | [diff] [blame] | 41 | void ufsdbg_clr_err_state(struct ufs_hba *hba); |
Subhash Jadavani | cce6fbc | 2016-08-11 11:35:26 -0700 | [diff] [blame] | 42 | #else |
| 43 | static inline void ufsdbg_add_debugfs(struct ufs_hba *hba) |
| 44 | { |
| 45 | } |
| 46 | static inline void ufsdbg_remove_debugfs(struct ufs_hba *hba) |
| 47 | { |
| 48 | } |
| 49 | static inline void ufsdbg_pr_buf_to_std(struct ufs_hba *hba, int offset, |
| 50 | int num_regs, char *str, void *priv) |
| 51 | { |
| 52 | } |
| 53 | void ufsdbg_set_err_state(struct ufs_hba *hba) |
| 54 | { |
| 55 | } |
Subhash Jadavani | ef54222 | 2017-08-02 16:23:55 -0700 | [diff] [blame] | 56 | void ufsdbg_clr_err_state(struct ufs_hba *hba) |
| 57 | { |
| 58 | } |
Subhash Jadavani | cce6fbc | 2016-08-11 11:35:26 -0700 | [diff] [blame] | 59 | #endif |
| 60 | |
| 61 | #ifdef CONFIG_UFS_FAULT_INJECTION |
| 62 | void 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 |
| 66 | static 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 */ |