Lines Matching full:hba
18 /* @file corresponds to a debugfs attribute in directory hba->debugfs_root. */
36 struct ufs_hba *hba = hba_from_file(s->file); in ufs_debugfs_stats_show() local
37 struct ufs_event_hist *e = hba->ufs_stats.event; in ufs_debugfs_stats_show()
62 struct ufs_hba *hba = data; in ee_usr_mask_get() local
64 *val = hba->ee_usr_mask; in ee_usr_mask_get()
68 static int ufs_debugfs_get_user_access(struct ufs_hba *hba) in ufs_debugfs_get_user_access() argument
69 __acquires(&hba->host_sem) in ufs_debugfs_get_user_access()
71 down(&hba->host_sem); in ufs_debugfs_get_user_access()
72 if (!ufshcd_is_user_access_allowed(hba)) { in ufs_debugfs_get_user_access()
73 up(&hba->host_sem); in ufs_debugfs_get_user_access()
76 ufshcd_rpm_get_sync(hba); in ufs_debugfs_get_user_access()
80 static void ufs_debugfs_put_user_access(struct ufs_hba *hba) in ufs_debugfs_put_user_access() argument
81 __releases(&hba->host_sem) in ufs_debugfs_put_user_access()
83 ufshcd_rpm_put_sync(hba); in ufs_debugfs_put_user_access()
84 up(&hba->host_sem); in ufs_debugfs_put_user_access()
89 struct ufs_hba *hba = data; in ee_usr_mask_set() local
94 err = ufs_debugfs_get_user_access(hba); in ee_usr_mask_set()
97 err = ufshcd_update_ee_usr_mask(hba, val, MASK_EE_STATUS); in ee_usr_mask_set()
98 ufs_debugfs_put_user_access(hba); in ee_usr_mask_set()
104 void ufs_debugfs_exception_event(struct ufs_hba *hba, u16 status) in ufs_debugfs_exception_event() argument
110 if (!hba->debugfs_ee_rate_limit_ms || !status) in ufs_debugfs_exception_event()
113 mutex_lock(&hba->ee_ctrl_mutex); in ufs_debugfs_exception_event()
114 ee_ctrl_mask = hba->ee_drv_mask | (hba->ee_usr_mask & ~status); in ufs_debugfs_exception_event()
115 chgd = ee_ctrl_mask != hba->ee_ctrl_mask; in ufs_debugfs_exception_event()
117 err = __ufshcd_write_ee_control(hba, ee_ctrl_mask); in ufs_debugfs_exception_event()
119 dev_err(hba->dev, "%s: failed to write ee control %d\n", in ufs_debugfs_exception_event()
122 mutex_unlock(&hba->ee_ctrl_mutex); in ufs_debugfs_exception_event()
125 unsigned long delay = msecs_to_jiffies(hba->debugfs_ee_rate_limit_ms); in ufs_debugfs_exception_event()
127 queue_delayed_work(system_freezable_wq, &hba->debugfs_ee_work, delay); in ufs_debugfs_exception_event()
133 struct ufs_hba *hba = container_of(work, struct ufs_hba, debugfs_ee_work.work); in ufs_debugfs_restart_ee() local
135 if (!hba->ee_usr_mask || pm_runtime_suspended(hba->dev) || in ufs_debugfs_restart_ee()
136 ufs_debugfs_get_user_access(hba)) in ufs_debugfs_restart_ee()
138 ufshcd_write_ee_control(hba); in ufs_debugfs_restart_ee()
139 ufs_debugfs_put_user_access(hba); in ufs_debugfs_restart_ee()
145 struct ufs_hba *hba = hba_from_file(s->file); in ufs_saved_err_show() local
149 p = &hba->saved_err; in ufs_saved_err_show()
151 p = &hba->saved_uic_err; in ufs_saved_err_show()
164 struct ufs_hba *hba = hba_from_file(file); in ufs_saved_err_write() local
176 spin_lock_irq(hba->host->host_lock); in ufs_saved_err_write()
178 hba->saved_err = val; in ufs_saved_err_write()
180 hba->saved_uic_err = val; in ufs_saved_err_write()
185 ufshcd_schedule_eh_work(hba); in ufs_saved_err_write()
186 spin_unlock_irq(hba->host->host_lock); in ufs_saved_err_write()
212 void ufs_debugfs_hba_init(struct ufs_hba *hba) in ufs_debugfs_hba_init() argument
218 hba->debugfs_ee_rate_limit_ms = 20; in ufs_debugfs_hba_init()
219 INIT_DELAYED_WORK(&hba->debugfs_ee_work, ufs_debugfs_restart_ee); in ufs_debugfs_hba_init()
221 root = debugfs_create_dir(dev_name(hba->dev), ufs_debugfs_root); in ufs_debugfs_hba_init()
224 hba->debugfs_root = root; in ufs_debugfs_hba_init()
225 d_inode(root)->i_private = hba; in ufs_debugfs_hba_init()
229 debugfs_create_file("exception_event_mask", 0600, hba->debugfs_root, in ufs_debugfs_hba_init()
230 hba, &ee_usr_mask_fops); in ufs_debugfs_hba_init()
231 debugfs_create_u32("exception_event_rate_limit_ms", 0600, hba->debugfs_root, in ufs_debugfs_hba_init()
232 &hba->debugfs_ee_rate_limit_ms); in ufs_debugfs_hba_init()
235 void ufs_debugfs_hba_exit(struct ufs_hba *hba) in ufs_debugfs_hba_exit() argument
237 debugfs_remove_recursive(hba->debugfs_root); in ufs_debugfs_hba_exit()
238 cancel_delayed_work_sync(&hba->debugfs_ee_work); in ufs_debugfs_hba_exit()