|
24 | 24 | #include <linux/pm_opp.h> |
25 | 25 | #include <linux/regulator/consumer.h> |
26 | 26 | #include <linux/sched/clock.h> |
| 27 | +#include <linux/sizes.h> |
27 | 28 | #include <linux/iopoll.h> |
28 | 29 | #include <scsi/scsi_cmnd.h> |
29 | 30 | #include <scsi/scsi_dbg.h> |
@@ -5249,6 +5250,25 @@ static void ufshcd_lu_init(struct ufs_hba *hba, struct scsi_device *sdev) |
5249 | 5250 | hba->dev_info.rpmb_region_size[1] = desc_buf[RPMB_UNIT_DESC_PARAM_REGION1_SIZE]; |
5250 | 5251 | hba->dev_info.rpmb_region_size[2] = desc_buf[RPMB_UNIT_DESC_PARAM_REGION2_SIZE]; |
5251 | 5252 | hba->dev_info.rpmb_region_size[3] = desc_buf[RPMB_UNIT_DESC_PARAM_REGION3_SIZE]; |
| 5253 | + |
| 5254 | + if (hba->dev_info.wspecversion <= 0x0220) { |
| 5255 | + /* |
| 5256 | + * These older spec chips have only one RPMB region, |
| 5257 | + * sized between 128 kB minimum and 16 MB maximum. |
| 5258 | + * No per region size fields are provided (respective |
| 5259 | + * REGIONX_SIZE fields always contain zeros), so get |
| 5260 | + * it from the logical block count and size fields for |
| 5261 | + * compatibility |
| 5262 | + * |
| 5263 | + * (See JESD220C-2_2 Section 14.1.4.6 |
| 5264 | + * RPMB Unit Descriptor,* offset 13h, 4 bytes) |
| 5265 | + */ |
| 5266 | + hba->dev_info.rpmb_region_size[0] = |
| 5267 | + (get_unaligned_be64(desc_buf |
| 5268 | + + RPMB_UNIT_DESC_PARAM_LOGICAL_BLK_COUNT) |
| 5269 | + << desc_buf[RPMB_UNIT_DESC_PARAM_LOGICAL_BLK_SIZE]) |
| 5270 | + / SZ_128K; |
| 5271 | + } |
5252 | 5272 | } |
5253 | 5273 |
|
5254 | 5274 |
|
@@ -5963,6 +5983,7 @@ static int ufshcd_disable_auto_bkops(struct ufs_hba *hba) |
5963 | 5983 |
|
5964 | 5984 | hba->auto_bkops_enabled = false; |
5965 | 5985 | trace_ufshcd_auto_bkops_state(hba, "Disabled"); |
| 5986 | + hba->urgent_bkops_lvl = BKOPS_STATUS_PERF_IMPACT; |
5966 | 5987 | hba->is_urgent_bkops_lvl_checked = false; |
5967 | 5988 | out: |
5968 | 5989 | return err; |
@@ -6066,7 +6087,7 @@ static void ufshcd_bkops_exception_event_handler(struct ufs_hba *hba) |
6066 | 6087 | * impacted or critical. Handle these device by determining their urgent |
6067 | 6088 | * bkops status at runtime. |
6068 | 6089 | */ |
6069 | | - if (curr_status < BKOPS_STATUS_PERF_IMPACT) { |
| 6090 | + if ((curr_status > BKOPS_STATUS_NO_OP) && (curr_status < BKOPS_STATUS_PERF_IMPACT)) { |
6070 | 6091 | dev_err(hba->dev, "%s: device raised urgent BKOPS exception for bkops status %d\n", |
6071 | 6092 | __func__, curr_status); |
6072 | 6093 | /* update the current status as the urgent bkops level */ |
|
0 commit comments