aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/esas2r/esas2r_flash.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/esas2r/esas2r_flash.c')
-rw-r--r--drivers/scsi/esas2r/esas2r_flash.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/scsi/esas2r/esas2r_flash.c b/drivers/scsi/esas2r/esas2r_flash.c
index 2ec3c23275b8..b7dc59fca7a6 100644
--- a/drivers/scsi/esas2r/esas2r_flash.c
+++ b/drivers/scsi/esas2r/esas2r_flash.c
@@ -231,7 +231,7 @@ static bool load_image(struct esas2r_adapter *a, struct esas2r_request *rq)
231 * RS_PENDING, FM API tasks will continue. 231 * RS_PENDING, FM API tasks will continue.
232 */ 232 */
233 rq->req_stat = RS_PENDING; 233 rq->req_stat = RS_PENDING;
234 if (a->flags & AF_DEGRADED_MODE) 234 if (test_bit(AF_DEGRADED_MODE, &a->flags))
235 /* not suppported for now */; 235 /* not suppported for now */;
236 else 236 else
237 build_flash_msg(a, rq); 237 build_flash_msg(a, rq);
@@ -315,7 +315,7 @@ static bool complete_fmapi_req(struct esas2r_adapter *a,
315 memset(fc->scratch, 0, FM_BUF_SZ); 315 memset(fc->scratch, 0, FM_BUF_SZ);
316 316
317 esas2r_enable_heartbeat(a); 317 esas2r_enable_heartbeat(a);
318 esas2r_lock_clear_flags(&a->flags, AF_FLASH_LOCK); 318 clear_bit(AF_FLASH_LOCK, &a->flags);
319 return false; 319 return false;
320} 320}
321 321
@@ -526,7 +526,7 @@ no_cfg:
526 * The download is complete. If in degraded mode, 526 * The download is complete. If in degraded mode,
527 * attempt a chip reset. 527 * attempt a chip reset.
528 */ 528 */
529 if (a->flags & AF_DEGRADED_MODE) 529 if (test_bit(AF_DEGRADED_MODE, &a->flags))
530 esas2r_local_reset_adapter(a); 530 esas2r_local_reset_adapter(a);
531 531
532 a->flash_ver = fi->cmp_hdr[CH_IT_BIOS].version; 532 a->flash_ver = fi->cmp_hdr[CH_IT_BIOS].version;
@@ -890,7 +890,7 @@ bool esas2r_process_fs_ioctl(struct esas2r_adapter *a,
890 } 890 }
891 } 891 }
892 892
893 if (a->flags & AF_DEGRADED_MODE) { 893 if (test_bit(AF_DEGRADED_MODE, &a->flags)) {
894 fs->status = ATTO_STS_DEGRADED; 894 fs->status = ATTO_STS_DEGRADED;
895 return false; 895 return false;
896 } 896 }
@@ -945,8 +945,12 @@ static bool esas2r_flash_access(struct esas2r_adapter *a, u32 function)
945 945
946 /* Now wait for the firmware to process it */ 946 /* Now wait for the firmware to process it */
947 starttime = jiffies_to_msecs(jiffies); 947 starttime = jiffies_to_msecs(jiffies);
948 timeout = a->flags & 948
949 (AF_CHPRST_PENDING | AF_DISC_PENDING) ? 40000 : 5000; 949 if (test_bit(AF_CHPRST_PENDING, &a->flags) ||
950 test_bit(AF_DISC_PENDING, &a->flags))
951 timeout = 40000;
952 else
953 timeout = 5000;
950 954
951 while (true) { 955 while (true) {
952 intstat = esas2r_read_register_dword(a, MU_INT_STATUS_OUT); 956 intstat = esas2r_read_register_dword(a, MU_INT_STATUS_OUT);
@@ -1008,7 +1012,7 @@ bool esas2r_read_flash_block(struct esas2r_adapter *a,
1008 u32 offset; 1012 u32 offset;
1009 u32 iatvr; 1013 u32 iatvr;
1010 1014
1011 if (a->flags2 & AF2_SERIAL_FLASH) 1015 if (test_bit(AF2_SERIAL_FLASH, &a->flags2))
1012 iatvr = MW_DATA_ADDR_SER_FLASH + (from & -WINDOW_SIZE); 1016 iatvr = MW_DATA_ADDR_SER_FLASH + (from & -WINDOW_SIZE);
1013 else 1017 else
1014 iatvr = MW_DATA_ADDR_PAR_FLASH + (from & -WINDOW_SIZE); 1018 iatvr = MW_DATA_ADDR_PAR_FLASH + (from & -WINDOW_SIZE);
@@ -1236,9 +1240,9 @@ static void esas2r_nvram_callback(struct esas2r_adapter *a,
1236 if (rq->req_stat != RS_PENDING) { 1240 if (rq->req_stat != RS_PENDING) {
1237 /* update the NVRAM state */ 1241 /* update the NVRAM state */
1238 if (rq->req_stat == RS_SUCCESS) 1242 if (rq->req_stat == RS_SUCCESS)
1239 esas2r_lock_set_flags(&a->flags, AF_NVR_VALID); 1243 set_bit(AF_NVR_VALID, &a->flags);
1240 else 1244 else
1241 esas2r_lock_clear_flags(&a->flags, AF_NVR_VALID); 1245 clear_bit(AF_NVR_VALID, &a->flags);
1242 1246
1243 esas2r_enable_heartbeat(a); 1247 esas2r_enable_heartbeat(a);
1244 1248
@@ -1258,7 +1262,7 @@ bool esas2r_nvram_write(struct esas2r_adapter *a, struct esas2r_request *rq,
1258 u32 *sas_address_dwords = (u32 *)&sas_address_bytes[0]; 1262 u32 *sas_address_dwords = (u32 *)&sas_address_bytes[0];
1259 struct atto_vda_flash_req *vrq = &rq->vrq->flash; 1263 struct atto_vda_flash_req *vrq = &rq->vrq->flash;
1260 1264
1261 if (a->flags & AF_DEGRADED_MODE) 1265 if (test_bit(AF_DEGRADED_MODE, &a->flags))
1262 return false; 1266 return false;
1263 1267
1264 if (down_interruptible(&a->nvram_semaphore)) 1268 if (down_interruptible(&a->nvram_semaphore))
@@ -1302,7 +1306,7 @@ bool esas2r_nvram_write(struct esas2r_adapter *a, struct esas2r_request *rq,
1302 FLS_OFFSET_NVR, 1306 FLS_OFFSET_NVR,
1303 sizeof(struct esas2r_sas_nvram)); 1307 sizeof(struct esas2r_sas_nvram));
1304 1308
1305 if (a->flags & AF_LEGACY_SGE_MODE) { 1309 if (test_bit(AF_LEGACY_SGE_MODE, &a->flags)) {
1306 1310
1307 vrq->data.sge[0].length = 1311 vrq->data.sge[0].length =
1308 cpu_to_le32(SGE_LAST | 1312 cpu_to_le32(SGE_LAST |
@@ -1337,7 +1341,7 @@ bool esas2r_nvram_validate(struct esas2r_adapter *a)
1337 } else if (n->version > SASNVR_VERSION) { 1341 } else if (n->version > SASNVR_VERSION) {
1338 esas2r_hdebug("invalid NVRAM version"); 1342 esas2r_hdebug("invalid NVRAM version");
1339 } else { 1343 } else {
1340 esas2r_lock_set_flags(&a->flags, AF_NVR_VALID); 1344 set_bit(AF_NVR_VALID, &a->flags);
1341 rslt = true; 1345 rslt = true;
1342 } 1346 }
1343 1347
@@ -1359,7 +1363,7 @@ void esas2r_nvram_set_defaults(struct esas2r_adapter *a)
1359 struct esas2r_sas_nvram *n = a->nvram; 1363 struct esas2r_sas_nvram *n = a->nvram;
1360 u32 time = jiffies_to_msecs(jiffies); 1364 u32 time = jiffies_to_msecs(jiffies);
1361 1365
1362 esas2r_lock_clear_flags(&a->flags, AF_NVR_VALID); 1366 clear_bit(AF_NVR_VALID, &a->flags);
1363 *n = default_sas_nvram; 1367 *n = default_sas_nvram;
1364 n->sas_addr[3] |= 0x0F; 1368 n->sas_addr[3] |= 0x0F;
1365 n->sas_addr[4] = HIBYTE(LOWORD(time)); 1369 n->sas_addr[4] = HIBYTE(LOWORD(time));
@@ -1389,7 +1393,7 @@ bool esas2r_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi,
1389 u8 j; 1393 u8 j;
1390 struct esas2r_component_header *ch; 1394 struct esas2r_component_header *ch;
1391 1395
1392 if (esas2r_lock_set_flags(&a->flags, AF_FLASH_LOCK) & AF_FLASH_LOCK) { 1396 if (test_and_set_bit(AF_FLASH_LOCK, &a->flags)) {
1393 /* flag was already set */ 1397 /* flag was already set */
1394 fi->status = FI_STAT_BUSY; 1398 fi->status = FI_STAT_BUSY;
1395 return false; 1399 return false;
@@ -1413,7 +1417,7 @@ bool esas2r_fm_api(struct esas2r_adapter *a, struct esas2r_flash_img *fi,
1413 return complete_fmapi_req(a, rq, FI_STAT_IMG_VER); 1417 return complete_fmapi_req(a, rq, FI_STAT_IMG_VER);
1414 } 1418 }
1415 1419
1416 if (a->flags & AF_DEGRADED_MODE) 1420 if (test_bit(AF_DEGRADED_MODE, &a->flags))
1417 return complete_fmapi_req(a, rq, FI_STAT_DEGRADED); 1421 return complete_fmapi_req(a, rq, FI_STAT_DEGRADED);
1418 1422
1419 switch (fi->action) { 1423 switch (fi->action) {