ANDROID: ufs: core: move Android quirks into separate field
Prevent the imminent collision between the upstream quirk bits (now up to '1 << 19') and the Android quirk bits (starting at '1 << 20') by moving the Android quirk bits into their own field in struct ufs_hba. Bug: 162257402 Change-Id: I5373c092734d16f693300d9bd73c7c9063ac921e Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:
parent
743439fcc6
commit
0844ef7770
@ -124,7 +124,7 @@ bool ufshcd_crypto_enable(struct ufs_hba *hba)
|
||||
/* Reset might clear all keys, so reprogram all the keys. */
|
||||
blk_crypto_reprogram_all_keys(&hba->crypto_profile);
|
||||
|
||||
if (hba->quirks & UFSHCD_QUIRK_BROKEN_CRYPTO_ENABLE)
|
||||
if (hba->android_quirks & UFSHCD_ANDROID_QUIRK_BROKEN_CRYPTO_ENABLE)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -163,7 +163,7 @@ int ufshcd_hba_init_crypto_capabilities(struct ufs_hba *hba)
|
||||
int err = 0;
|
||||
enum blk_crypto_mode_num blk_mode_num;
|
||||
|
||||
if (hba->quirks & UFSHCD_QUIRK_CUSTOM_CRYPTO_PROFILE)
|
||||
if (hba->android_quirks & UFSHCD_ANDROID_QUIRK_CUSTOM_CRYPTO_PROFILE)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
|
@ -40,7 +40,7 @@ ufshcd_prepare_req_desc_hdr_crypto(struct ufshcd_lrb *lrbp, u32 *dword_0,
|
||||
static inline void ufshcd_crypto_clear_prdt(struct ufs_hba *hba,
|
||||
struct ufshcd_lrb *lrbp)
|
||||
{
|
||||
if (!(hba->quirks & UFSHCD_QUIRK_KEYS_IN_PRDT))
|
||||
if (!(hba->android_quirks & UFSHCD_ANDROID_QUIRK_KEYS_IN_PRDT))
|
||||
return;
|
||||
|
||||
if (!(scsi_cmd_to_rq(lrbp->cmd)->crypt_ctx))
|
||||
|
@ -616,29 +616,38 @@ enum ufshcd_quirks {
|
||||
* to reinit the device after switching to maximum gear.
|
||||
*/
|
||||
UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH = 1 << 19,
|
||||
};
|
||||
|
||||
enum ufshcd_android_quirks {
|
||||
|
||||
/*
|
||||
* IMPORTANT: set this in hba->android_quirks, not hba->quirks!
|
||||
*
|
||||
* This quirk needs to be enabled if the host controller supports inline
|
||||
* encryption, but it needs to initialize the crypto capabilities in a
|
||||
* nonstandard way and/or it needs to override blk_crypto_ll_ops. If
|
||||
* enabled, the standard code won't initialize the blk_crypto_profile;
|
||||
* ufs_hba_variant_ops::init() must do it instead.
|
||||
*/
|
||||
UFSHCD_QUIRK_CUSTOM_CRYPTO_PROFILE = 1 << 20,
|
||||
UFSHCD_ANDROID_QUIRK_CUSTOM_CRYPTO_PROFILE = 1 << 0,
|
||||
|
||||
/*
|
||||
* IMPORTANT: set this in hba->android_quirks, not hba->quirks!
|
||||
*
|
||||
* This quirk needs to be enabled if the host controller supports inline
|
||||
* encryption, but the CRYPTO_GENERAL_ENABLE bit is not implemented and
|
||||
* breaks the HCE sequence if used.
|
||||
*/
|
||||
UFSHCD_QUIRK_BROKEN_CRYPTO_ENABLE = 1 << 21,
|
||||
UFSHCD_ANDROID_QUIRK_BROKEN_CRYPTO_ENABLE = 1 << 1,
|
||||
|
||||
/*
|
||||
* IMPORTANT: set this in hba->android_quirks, not hba->quirks!
|
||||
*
|
||||
* This quirk needs to be enabled if the host controller requires that
|
||||
* the PRDT be cleared after each encrypted request because encryption
|
||||
* keys were stored in it.
|
||||
*/
|
||||
UFSHCD_QUIRK_KEYS_IN_PRDT = 1 << 22,
|
||||
UFSHCD_ANDROID_QUIRK_KEYS_IN_PRDT = 1 << 2,
|
||||
};
|
||||
|
||||
enum ufshcd_caps {
|
||||
@ -990,6 +999,8 @@ struct ufs_hba {
|
||||
|
||||
unsigned int quirks; /* Deviations from standard UFSHCI spec. */
|
||||
|
||||
unsigned int android_quirks; /* for UFSHCD_ANDROID_QUIRK_* flags */
|
||||
|
||||
/* Device deviations from standard UFS device spec. */
|
||||
unsigned int dev_quirks;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user