Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) // Copyright (C) 2020 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include "ufs-debugfs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include "ufshcd.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) static struct dentry *ufs_debugfs_root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) void __init ufs_debugfs_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	ufs_debugfs_root = debugfs_create_dir("ufshcd", NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) void __exit ufs_debugfs_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	debugfs_remove_recursive(ufs_debugfs_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) static int ufs_debugfs_stats_show(struct seq_file *s, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	struct ufs_hba *hba = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	struct ufs_event_hist *e = hba->ufs_stats.event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define PRT(fmt, typ) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	seq_printf(s, fmt, e[UFS_EVT_ ## typ].cnt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	PRT("PHY Adapter Layer errors (except LINERESET): %llu\n", PA_ERR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	PRT("Data Link Layer errors: %llu\n", DL_ERR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	PRT("Network Layer errors: %llu\n", NL_ERR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	PRT("Transport Layer errors: %llu\n", TL_ERR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	PRT("Generic DME errors: %llu\n", DME_ERR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	PRT("Auto-hibernate errors: %llu\n", AUTO_HIBERN8_ERR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	PRT("IS Fatal errors (CEFES, SBFES, HCFES, DFES): %llu\n", FATAL_ERR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	PRT("DME Link Startup errors: %llu\n", LINK_STARTUP_FAIL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	PRT("PM Resume errors: %llu\n", RESUME_ERR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	PRT("PM Suspend errors : %llu\n", SUSPEND_ERR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	PRT("Logical Unit Resets: %llu\n", DEV_RESET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	PRT("Host Resets: %llu\n", HOST_RESET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	PRT("SCSI command aborts: %llu\n", ABORT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #undef PRT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) DEFINE_SHOW_ATTRIBUTE(ufs_debugfs_stats);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void ufs_debugfs_hba_init(struct ufs_hba *hba)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	hba->debugfs_root = debugfs_create_dir(dev_name(hba->dev), ufs_debugfs_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	debugfs_create_file("stats", 0400, hba->debugfs_root, hba, &ufs_debugfs_stats_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) void ufs_debugfs_hba_exit(struct ufs_hba *hba)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	debugfs_remove_recursive(hba->debugfs_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) }