Lines Matching refs:hba

35 	struct ufs_hba *hba = hba_from_file(s->file);  in ufs_debugfs_stats_show()  local
36 struct ufs_event_hist *e = hba->ufs_stats.event; in ufs_debugfs_stats_show()
61 struct ufs_hba *hba = data; in ee_usr_mask_get() local
63 *val = hba->ee_usr_mask; in ee_usr_mask_get()
67 static int ufs_debugfs_get_user_access(struct ufs_hba *hba) in ufs_debugfs_get_user_access() argument
68 __acquires(&hba->host_sem) in ufs_debugfs_get_user_access()
70 down(&hba->host_sem); in ufs_debugfs_get_user_access()
71 if (!ufshcd_is_user_access_allowed(hba)) { in ufs_debugfs_get_user_access()
72 up(&hba->host_sem); in ufs_debugfs_get_user_access()
75 ufshcd_rpm_get_sync(hba); in ufs_debugfs_get_user_access()
79 static void ufs_debugfs_put_user_access(struct ufs_hba *hba) in ufs_debugfs_put_user_access() argument
80 __releases(&hba->host_sem) in ufs_debugfs_put_user_access()
82 ufshcd_rpm_put_sync(hba); in ufs_debugfs_put_user_access()
83 up(&hba->host_sem); in ufs_debugfs_put_user_access()
88 struct ufs_hba *hba = data; in ee_usr_mask_set() local
93 err = ufs_debugfs_get_user_access(hba); in ee_usr_mask_set()
96 err = ufshcd_update_ee_usr_mask(hba, val, MASK_EE_STATUS); in ee_usr_mask_set()
97 ufs_debugfs_put_user_access(hba); in ee_usr_mask_set()
103 void ufs_debugfs_exception_event(struct ufs_hba *hba, u16 status) in ufs_debugfs_exception_event() argument
109 if (!hba->debugfs_ee_rate_limit_ms || !status) in ufs_debugfs_exception_event()
112 mutex_lock(&hba->ee_ctrl_mutex); in ufs_debugfs_exception_event()
113 ee_ctrl_mask = hba->ee_drv_mask | (hba->ee_usr_mask & ~status); in ufs_debugfs_exception_event()
114 chgd = ee_ctrl_mask != hba->ee_ctrl_mask; in ufs_debugfs_exception_event()
116 err = __ufshcd_write_ee_control(hba, ee_ctrl_mask); in ufs_debugfs_exception_event()
118 dev_err(hba->dev, "%s: failed to write ee control %d\n", in ufs_debugfs_exception_event()
121 mutex_unlock(&hba->ee_ctrl_mutex); in ufs_debugfs_exception_event()
124 unsigned long delay = msecs_to_jiffies(hba->debugfs_ee_rate_limit_ms); in ufs_debugfs_exception_event()
126 queue_delayed_work(system_freezable_wq, &hba->debugfs_ee_work, delay); in ufs_debugfs_exception_event()
132 struct ufs_hba *hba = container_of(work, struct ufs_hba, debugfs_ee_work.work); in ufs_debugfs_restart_ee() local
134 if (!hba->ee_usr_mask || pm_runtime_suspended(hba->dev) || in ufs_debugfs_restart_ee()
135 ufs_debugfs_get_user_access(hba)) in ufs_debugfs_restart_ee()
137 ufshcd_write_ee_control(hba); in ufs_debugfs_restart_ee()
138 ufs_debugfs_put_user_access(hba); in ufs_debugfs_restart_ee()
144 struct ufs_hba *hba = hba_from_file(s->file); in ufs_saved_err_show() local
148 p = &hba->saved_err; in ufs_saved_err_show()
150 p = &hba->saved_uic_err; in ufs_saved_err_show()
163 struct ufs_hba *hba = hba_from_file(file); in ufs_saved_err_write() local
175 spin_lock_irq(hba->host->host_lock); in ufs_saved_err_write()
177 hba->saved_err = val; in ufs_saved_err_write()
179 hba->saved_uic_err = val; in ufs_saved_err_write()
184 ufshcd_schedule_eh_work(hba); in ufs_saved_err_write()
185 spin_unlock_irq(hba->host->host_lock); in ufs_saved_err_write()
211 void ufs_debugfs_hba_init(struct ufs_hba *hba) in ufs_debugfs_hba_init() argument
217 hba->debugfs_ee_rate_limit_ms = 20; in ufs_debugfs_hba_init()
218 INIT_DELAYED_WORK(&hba->debugfs_ee_work, ufs_debugfs_restart_ee); in ufs_debugfs_hba_init()
220 root = debugfs_create_dir(dev_name(hba->dev), ufs_debugfs_root); in ufs_debugfs_hba_init()
223 hba->debugfs_root = root; in ufs_debugfs_hba_init()
224 d_inode(root)->i_private = hba; in ufs_debugfs_hba_init()
228 debugfs_create_file("exception_event_mask", 0600, hba->debugfs_root, in ufs_debugfs_hba_init()
229 hba, &ee_usr_mask_fops); in ufs_debugfs_hba_init()
230 debugfs_create_u32("exception_event_rate_limit_ms", 0600, hba->debugfs_root, in ufs_debugfs_hba_init()
231 &hba->debugfs_ee_rate_limit_ms); in ufs_debugfs_hba_init()
234 void ufs_debugfs_hba_exit(struct ufs_hba *hba) in ufs_debugfs_hba_exit() argument
236 debugfs_remove_recursive(hba->debugfs_root); in ufs_debugfs_hba_exit()
237 cancel_delayed_work_sync(&hba->debugfs_ee_work); in ufs_debugfs_hba_exit()