forked from torvalds/linux
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
scsi: ufs-debugfs: Add error counters
People testing have a need to know how many errors might be occurring over time. Add error counters and expose them via debugfs. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
- Loading branch information
1 parent
cb52531
commit d62bfd1751cd091c2ae671208b026c6885b8184e
Showing
5 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // SPDX-License-Identifier: GPL-2.0 | ||
| // Copyright (C) 2020 Intel Corporation | ||
|
|
||
| #include <linux/debugfs.h> | ||
|
|
||
| #include "ufshcd.h" | ||
|
|
||
| static struct dentry *ufs_debugfs_root; | ||
|
|
||
| void ufs_debugfs_init(void) | ||
| { | ||
| ufs_debugfs_root = debugfs_create_dir("ufshcd", NULL); | ||
| } | ||
|
|
||
| void ufs_debugfs_exit(void) | ||
| { | ||
| debugfs_remove_recursive(ufs_debugfs_root); | ||
| } | ||
|
|
||
| static int ufs_debugfs_stats_show(struct seq_file *s, void *data) | ||
| { | ||
| struct ufs_hba *hba = s->private; | ||
| struct ufs_event_hist *e = hba->ufs_stats.event; | ||
|
|
||
| #define PRT(fmt, typ) \ | ||
| seq_printf(s, fmt, e[UFS_EVT_ ## typ].cnt) | ||
|
|
||
| PRT("PHY Adapter Layer errors (except LINERESET): %llu\n", PA_ERR); | ||
| PRT("Data Link Layer errors: %llu\n", DL_ERR); | ||
| PRT("Network Layer errors: %llu\n", NL_ERR); | ||
| PRT("Transport Layer errors: %llu\n", TL_ERR); | ||
| PRT("Generic DME errors: %llu\n", DME_ERR); | ||
| PRT("Auto-hibernate errors: %llu\n", AUTO_HIBERN8_ERR); | ||
| PRT("IS Fatal errors (CEFES, SBFES, HCFES, DFES): %llu\n", FATAL_ERR); | ||
| PRT("DME Link Startup errors: %llu\n", LINK_STARTUP_FAIL); | ||
| PRT("PM Resume errors: %llu\n", RESUME_ERR); | ||
| PRT("PM Suspend errors : %llu\n", SUSPEND_ERR); | ||
| PRT("Logical Unit Resets: %llu\n", DEV_RESET); | ||
| PRT("Host Resets: %llu\n", HOST_RESET); | ||
| PRT("SCSI command aborts: %llu\n", ABORT); | ||
| #undef PRT | ||
| return 0; | ||
| } | ||
| DEFINE_SHOW_ATTRIBUTE(ufs_debugfs_stats); | ||
|
|
||
| void ufs_debugfs_hba_init(struct ufs_hba *hba) | ||
| { | ||
| hba->debugfs_root = debugfs_create_dir(dev_name(hba->dev), ufs_debugfs_root); | ||
| debugfs_create_file("stats", 0400, hba->debugfs_root, hba, &ufs_debugfs_stats_fops); | ||
| } | ||
|
|
||
| void ufs_debugfs_hba_exit(struct ufs_hba *hba) | ||
| { | ||
| debugfs_remove_recursive(hba->debugfs_root); | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0 */ | ||
| /* Copyright (C) 2020 Intel Corporation | ||
| */ | ||
|
|
||
| #ifndef __UFS_DEBUGFS_H__ | ||
| #define __UFS_DEBUGFS_H__ | ||
|
|
||
| struct ufs_hba; | ||
|
|
||
| #ifdef CONFIG_DEBUG_FS | ||
| void ufs_debugfs_init(void); | ||
| void ufs_debugfs_exit(void); | ||
| void ufs_debugfs_hba_init(struct ufs_hba *hba); | ||
| void ufs_debugfs_hba_exit(struct ufs_hba *hba); | ||
| #else | ||
| static inline void ufs_debugfs_init(void) {} | ||
| static inline void ufs_debugfs_exit(void) {} | ||
| static inline void ufs_debugfs_hba_init(struct ufs_hba *hba) {} | ||
| static inline void ufs_debugfs_hba_exit(struct ufs_hba *hba) {} | ||
| #endif | ||
|
|
||
| #endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters