Lines Matching refs:hba

20 static int ufshcd_program_key(struct ufs_hba *hba,  in ufshcd_program_key()  argument
24 u32 slot_offset = hba->crypto_cfg_register + slot * sizeof(*cfg); in ufshcd_program_key()
27 ufshcd_hold(hba, false); in ufshcd_program_key()
29 if (hba->vops && hba->vops->program_key) { in ufshcd_program_key()
30 err = hba->vops->program_key(hba, cfg, slot); in ufshcd_program_key()
35 ufshcd_writel(hba, 0, slot_offset + 16 * sizeof(cfg->reg_val[0])); in ufshcd_program_key()
37 ufshcd_writel(hba, le32_to_cpu(cfg->reg_val[i]), in ufshcd_program_key()
41 ufshcd_writel(hba, le32_to_cpu(cfg->reg_val[17]), in ufshcd_program_key()
44 ufshcd_writel(hba, le32_to_cpu(cfg->reg_val[16]), in ufshcd_program_key()
47 ufshcd_release(hba); in ufshcd_program_key()
55 struct ufs_hba *hba = in ufshcd_crypto_keyslot_program() local
57 const union ufs_crypto_cap_entry *ccap_array = hba->crypto_cap_array; in ufshcd_crypto_keyslot_program()
67 for (i = 0; i < hba->crypto_capabilities.num_crypto_cap; i++) { in ufshcd_crypto_keyslot_program()
92 err = ufshcd_program_key(hba, &cfg, slot); in ufshcd_crypto_keyslot_program()
98 static int ufshcd_clear_keyslot(struct ufs_hba *hba, int slot) in ufshcd_clear_keyslot() argument
106 return ufshcd_program_key(hba, &cfg, slot); in ufshcd_clear_keyslot()
113 struct ufs_hba *hba = in ufshcd_crypto_keyslot_evict() local
116 return ufshcd_clear_keyslot(hba, slot); in ufshcd_crypto_keyslot_evict()
119 bool ufshcd_crypto_enable(struct ufs_hba *hba) in ufshcd_crypto_enable() argument
121 if (!(hba->caps & UFSHCD_CAP_CRYPTO)) in ufshcd_crypto_enable()
125 blk_crypto_reprogram_all_keys(&hba->crypto_profile); in ufshcd_crypto_enable()
156 int ufshcd_hba_init_crypto_capabilities(struct ufs_hba *hba) in ufshcd_hba_init_crypto_capabilities() argument
167 if (!(hba->capabilities & MASK_CRYPTO_SUPPORT) || in ufshcd_hba_init_crypto_capabilities()
168 !(hba->caps & UFSHCD_CAP_CRYPTO)) in ufshcd_hba_init_crypto_capabilities()
171 hba->crypto_capabilities.reg_val = in ufshcd_hba_init_crypto_capabilities()
172 cpu_to_le32(ufshcd_readl(hba, REG_UFS_CCAP)); in ufshcd_hba_init_crypto_capabilities()
173 hba->crypto_cfg_register = in ufshcd_hba_init_crypto_capabilities()
174 (u32)hba->crypto_capabilities.config_array_ptr * 0x100; in ufshcd_hba_init_crypto_capabilities()
175 hba->crypto_cap_array = in ufshcd_hba_init_crypto_capabilities()
176 devm_kcalloc(hba->dev, hba->crypto_capabilities.num_crypto_cap, in ufshcd_hba_init_crypto_capabilities()
177 sizeof(hba->crypto_cap_array[0]), GFP_KERNEL); in ufshcd_hba_init_crypto_capabilities()
178 if (!hba->crypto_cap_array) { in ufshcd_hba_init_crypto_capabilities()
185 hba->dev, &hba->crypto_profile, in ufshcd_hba_init_crypto_capabilities()
186 hba->crypto_capabilities.config_count + 1); in ufshcd_hba_init_crypto_capabilities()
190 hba->crypto_profile.ll_ops = ufshcd_crypto_ops; in ufshcd_hba_init_crypto_capabilities()
192 hba->crypto_profile.max_dun_bytes_supported = 8; in ufshcd_hba_init_crypto_capabilities()
193 hba->crypto_profile.dev = hba->dev; in ufshcd_hba_init_crypto_capabilities()
199 for (cap_idx = 0; cap_idx < hba->crypto_capabilities.num_crypto_cap; in ufshcd_hba_init_crypto_capabilities()
201 hba->crypto_cap_array[cap_idx].reg_val = in ufshcd_hba_init_crypto_capabilities()
202 cpu_to_le32(ufshcd_readl(hba, in ufshcd_hba_init_crypto_capabilities()
206 hba->crypto_cap_array[cap_idx]); in ufshcd_hba_init_crypto_capabilities()
208 hba->crypto_profile.modes_supported[blk_mode_num] |= in ufshcd_hba_init_crypto_capabilities()
209 hba->crypto_cap_array[cap_idx].sdus_mask * 512; in ufshcd_hba_init_crypto_capabilities()
216 hba->caps &= ~UFSHCD_CAP_CRYPTO; in ufshcd_hba_init_crypto_capabilities()
224 void ufshcd_init_crypto(struct ufs_hba *hba) in ufshcd_init_crypto() argument
228 if (!(hba->caps & UFSHCD_CAP_CRYPTO)) in ufshcd_init_crypto()
232 for (slot = 0; slot < hba->crypto_capabilities.config_count + 1; slot++) in ufshcd_init_crypto()
233 ufshcd_clear_keyslot(hba, slot); in ufshcd_init_crypto()
236 void ufshcd_crypto_register(struct ufs_hba *hba, struct request_queue *q) in ufshcd_crypto_register() argument
238 if (hba->caps & UFSHCD_CAP_CRYPTO) in ufshcd_crypto_register()
239 blk_crypto_register(&hba->crypto_profile, q); in ufshcd_crypto_register()