Pull SCSI fixes from James Bottomley: - add support for new devices (ufs, mvsas) - a major set of fixes in lpfc - get rid of a driver specific ioctl in pcmraid - a major rework of aha152x to get rid of the scsi_pointer. - minor fixes and obvious changes including several spelling updates. * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (36 commits) scsi: megaraid_sas: Target with invalid LUN ID is deleted during scan scsi: ufs: ufshpb: Fix a NULL check on list iterator scsi: sd: Clean up gendisk if device_add_disk() failed scsi: message: fusion: Remove redundant variable dmp scsi: mvsas: Add PCI ID of RocketRaid 2640 scsi: sd: sd_read_cpr() requires VPD pages scsi: mpt3sas: Fail reset operation if config request timed out scsi: sym53c500_cs: Stop using struct scsi_pointer scsi: ufs: ufs-pci: Add support for Intel MTL scsi: mpt3sas: Fix mpt3sas_check_same_4gb_region() kdoc comment scsi: scsi_debug: Fix sdebug_blk_mq_poll() in_use_bm bitmap use scsi: bnx2i: Fix spelling mistake "mis-match" -> "mismatch" scsi: bnx2fc: Fix spelling mistake "mis-match" -> "mismatch" scsi: zorro7xx: Fix a resource leak in zorro7xx_remove_one() scsi: aic7xxx: Use standard PCI subsystem, subdevice defines scsi: ufs: qcom: Drop custom Android boot parameters scsi: core: sysfs: Remove comments that conflict with the actual logic scsi: hisi_sas: Remove stray fallthrough annotation scsi: virtio-scsi: Eliminate anonymous module_init & module_exit scsi: isci: Fix spelling mistake "doesnt" -> "doesn't" ...
Unified · Split
| @@ -6658,13 +6658,13 @@ static int mpt_summary_proc_show(struct seq_file *m, void *v) · 6657 unmodified lines | |||
| 6658 | static int mpt_version_proc_show(struct seq_file *m, void *v) | 6658 | static int mpt_version_proc_show(struct seq_file *m, void *v) |
| 6659 | { | 6659 | { |
| 6660 | u8 cb_idx; | 6660 | u8 cb_idx; |
| 6661 | int scsi, fc, sas, lan, ctl, targ, dmp; | 6661 | int scsi, fc, sas, lan, ctl, targ; |
| 6662 | char *drvname; | 6662 | char *drvname; |
| 6663 | 6663 | ||
| 6664 | seq_printf(m, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON); | 6664 | seq_printf(m, "%s-%s\n", "mptlinux", MPT_LINUX_VERSION_COMMON); |
| 6665 | seq_printf(m, " Fusion MPT base driver\n"); | 6665 | seq_printf(m, " Fusion MPT base driver\n"); |
| 6666 | 6666 | ||
| 6667 | scsi = fc = sas = lan = ctl = targ = dmp = 0; | 6667 | scsi = fc = sas = lan = ctl = targ = 0; |
| 6668 | for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) { | 6668 | for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) { |
| 6669 | drvname = NULL; | 6669 | drvname = NULL; |
| 6670 | if (MptCallbacks[cb_idx]) { | 6670 | if (MptCallbacks[cb_idx]) { |
| @@ -317,14 +317,18 @@ enum { · 316 unmodified lines | |||
| 317 | }; | 317 | }; |
| 318 | 318 | ||
| 319 | struct aha152x_cmd_priv { | 319 | struct aha152x_cmd_priv { |
| 320 | struct scsi_pointer scsi_pointer; | 320 | char *ptr; |
| 321 | int this_residual; | ||
| 322 | struct scatterlist *buffer; | ||
| 323 | int status; | ||
| 324 | int message; | ||
| 325 | int sent_command; | ||
| 326 | int phase; | ||
| 321 | }; | 327 | }; |
| 322 | 328 | ||
| 323 | static struct scsi_pointer *aha152x_scsi_pointer(struct scsi_cmnd *cmd) | 329 | static struct aha152x_cmd_priv *aha152x_priv(struct scsi_cmnd *cmd) |
| 324 | { | 330 | { |
| 325 | struct aha152x_cmd_priv *acmd = scsi_cmd_priv(cmd); | 331 | return scsi_cmd_priv(cmd); |
| 326 | |||
| 327 | return &acmd->scsi_pointer; | ||
| 328 | } | 332 | } |
| 329 | 333 | ||
| 330 | MODULE_AUTHOR("Jürgen Fischer"); | 334 | MODULE_AUTHOR("Jürgen Fischer"); |
| @@ -890,17 +894,16 @@ void aha152x_release(struct Scsi_Host *shpnt) · 559 unmodified lines | |||
| 890 | static int setup_expected_interrupts(struct Scsi_Host *shpnt) | 894 | static int setup_expected_interrupts(struct Scsi_Host *shpnt) |
| 891 | { | 895 | { |
| 892 | if(CURRENT_SC) { | 896 | if(CURRENT_SC) { |
| 893 | struct scsi_pointer *scsi_pointer = | 897 | struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC); |
| 894 | aha152x_scsi_pointer(CURRENT_SC); | ||
| 895 | 898 | ||
| 896 | scsi_pointer->phase |= 1 << 16; | 899 | acp->phase |= 1 << 16; |
| 897 | 900 | ||
| 898 | if (scsi_pointer->phase & selecting) { | 901 | if (acp->phase & selecting) { |
| 899 | SETPORT(SSTAT1, SELTO); | 902 | SETPORT(SSTAT1, SELTO); |
| 900 | SETPORT(SIMODE0, ENSELDO | (DISCONNECTED_SC ? ENSELDI : 0)); | 903 | SETPORT(SIMODE0, ENSELDO | (DISCONNECTED_SC ? ENSELDI : 0)); |
| 901 | SETPORT(SIMODE1, ENSELTIMO); | 904 | SETPORT(SIMODE1, ENSELTIMO); |
| 902 | } else { | 905 | } else { |
| 903 | SETPORT(SIMODE0, (scsi_pointer->phase & spiordy) ? ENSPIORDY : 0); | 906 | SETPORT(SIMODE0, (acp->phase & spiordy) ? ENSPIORDY : 0); |
| 904 | SETPORT(SIMODE1, ENPHASEMIS | ENSCSIRST | ENSCSIPERR | ENBUSFREE); | 907 | SETPORT(SIMODE1, ENPHASEMIS | ENSCSIRST | ENSCSIPERR | ENBUSFREE); |
| 905 | } | 908 | } |
| 906 | } else if(STATE==seldi) { | 909 | } else if(STATE==seldi) { |
| @@ -924,17 +927,16 @@ static int setup_expected_interrupts(struct Scsi_Host *shpnt) · 17 unmodified lines | |||
| 924 | static int aha152x_internal_queue(struct scsi_cmnd *SCpnt, | 927 | static int aha152x_internal_queue(struct scsi_cmnd *SCpnt, |
| 925 | struct completion *complete, int phase) | 928 | struct completion *complete, int phase) |
| 926 | { | 929 | { |
| 927 | struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(SCpnt); | 930 | struct aha152x_cmd_priv *acp = aha152x_priv(SCpnt); |
| 928 | struct Scsi_Host *shpnt = SCpnt->device->host; | 931 | struct Scsi_Host *shpnt = SCpnt->device->host; |
| 929 | unsigned long flags; | 932 | unsigned long flags; |
| 930 | 933 | ||
| 931 | scsi_pointer->phase = not_issued | phase; | 934 | acp->phase = not_issued | phase; |
| 932 | scsi_pointer->Status = 0x1; /* Ilegal status by SCSI standard */ | 935 | acp->status = 0x1; /* Illegal status by SCSI standard */ |
| 933 | scsi_pointer->Message = 0; | 936 | acp->message = 0; |
| 934 | scsi_pointer->have_data_in = 0; | 937 | acp->sent_command = 0; |
| 935 | scsi_pointer->sent_command = 0; | ||
| 936 | 938 | ||
| 937 | if (scsi_pointer->phase & (resetting | check_condition)) { | 939 | if (acp->phase & (resetting | check_condition)) { |
| 938 | if (!SCpnt->host_scribble || SCSEM(SCpnt) || SCNEXT(SCpnt)) { | 940 | if (!SCpnt->host_scribble || SCSEM(SCpnt) || SCNEXT(SCpnt)) { |
| 939 | scmd_printk(KERN_ERR, SCpnt, "cannot reuse command\n"); | 941 | scmd_printk(KERN_ERR, SCpnt, "cannot reuse command\n"); |
| 940 | return FAILED; | 942 | return FAILED; |
| @@ -957,15 +959,15 @@ static int aha152x_internal_queue(struct scsi_cmnd *SCpnt, · 16 unmodified lines | |||
| 957 | SCp.phase : current state of the command */ | 959 | SCp.phase : current state of the command */ |
| 958 | 960 | ||
| 959 | if ((phase & resetting) || !scsi_sglist(SCpnt)) { | 961 | if ((phase & resetting) || !scsi_sglist(SCpnt)) { |
| 960 | scsi_pointer->ptr = NULL; | 962 | acp->ptr = NULL; |
| 961 | scsi_pointer->this_residual = 0; | 963 | acp->this_residual = 0; |
| 962 | scsi_set_resid(SCpnt, 0); | 964 | scsi_set_resid(SCpnt, 0); |
| 963 | scsi_pointer->buffer = NULL; | 965 | acp->buffer = NULL; |
| 964 | } else { | 966 | } else { |
| 965 | scsi_set_resid(SCpnt, scsi_bufflen(SCpnt)); | 967 | scsi_set_resid(SCpnt, scsi_bufflen(SCpnt)); |
| 966 | scsi_pointer->buffer = scsi_sglist(SCpnt); | 968 | acp->buffer = scsi_sglist(SCpnt); |
| 967 | scsi_pointer->ptr = SG_ADDRESS(scsi_pointer->buffer); | 969 | acp->ptr = SG_ADDRESS(acp->buffer); |
| 968 | scsi_pointer->this_residual = scsi_pointer->buffer->length; | 970 | acp->this_residual = acp->buffer->length; |
| 969 | } | 971 | } |
| 970 | 972 | ||
| 971 | DO_LOCK(flags); | 973 | DO_LOCK(flags); |
| @@ -1015,7 +1017,7 @@ static void reset_done(struct scsi_cmnd *SCpnt) · 43 unmodified lines | |||
| 1015 | 1017 | ||
| 1016 | static void aha152x_scsi_done(struct scsi_cmnd *SCpnt) | 1018 | static void aha152x_scsi_done(struct scsi_cmnd *SCpnt) |
| 1017 | { | 1019 | { |
| 1018 | if (aha152x_scsi_pointer(SCpnt)->phase & resetting) | 1020 | if (aha152x_priv(SCpnt)->phase & resetting) |
| 1019 | reset_done(SCpnt); | 1021 | reset_done(SCpnt); |
| 1020 | else | 1022 | else |
| 1021 | scsi_done(SCpnt); | 1023 | scsi_done(SCpnt); |
| @@ -1101,7 +1103,7 @@ static int aha152x_device_reset(struct scsi_cmnd * SCpnt) · 79 unmodified lines | |||
| 1101 | 1103 | ||
| 1102 | DO_LOCK(flags); | 1104 | DO_LOCK(flags); |
| 1103 | 1105 | ||
| 1104 | if (aha152x_scsi_pointer(SCpnt)->phase & resetted) { | 1106 | if (aha152x_priv(SCpnt)->phase & resetted) { |
| 1105 | HOSTDATA(shpnt)->commands--; | 1107 | HOSTDATA(shpnt)->commands--; |
| 1106 | if (!HOSTDATA(shpnt)->commands) | 1108 | if (!HOSTDATA(shpnt)->commands) |
| 1107 | SETPORT(PORTA, 0); | 1109 | SETPORT(PORTA, 0); |
| @@ -1395,31 +1397,30 @@ static void busfree_run(struct Scsi_Host *shpnt) · 287 unmodified lines | |||
| 1395 | SETPORT(SSTAT1, CLRBUSFREE); | 1397 | SETPORT(SSTAT1, CLRBUSFREE); |
| 1396 | 1398 | ||
| 1397 | if(CURRENT_SC) { | 1399 | if(CURRENT_SC) { |
| 1398 | struct scsi_pointer *scsi_pointer = | 1400 | struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC); |
| 1399 | aha152x_scsi_pointer(CURRENT_SC); | ||
| 1400 | 1401 | ||
| 1401 | #if defined(AHA152X_STAT) | 1402 | #if defined(AHA152X_STAT) |
| 1402 | action++; | 1403 | action++; |
| 1403 | #endif | 1404 | #endif |
| 1404 | scsi_pointer->phase &= ~syncneg; | 1405 | acp->phase &= ~syncneg; |
| 1405 | 1406 | ||
| 1406 | if (scsi_pointer->phase & completed) { | 1407 | if (acp->phase & completed) { |
| 1407 | /* target sent COMMAND COMPLETE */ | 1408 | /* target sent COMMAND COMPLETE */ |
| 1408 | done(shpnt, scsi_pointer->Status, DID_OK); | 1409 | done(shpnt, acp->status, DID_OK); |
| 1409 | 1410 | ||
| 1410 | } else if (scsi_pointer->phase & aborted) { | 1411 | } else if (acp->phase & aborted) { |
| 1411 | done(shpnt, scsi_pointer->Status, DID_ABORT); | 1412 | done(shpnt, acp->status, DID_ABORT); |
| 1412 | 1413 | ||
| 1413 | } else if (scsi_pointer->phase & resetted) { | 1414 | } else if (acp->phase & resetted) { |
| 1414 | done(shpnt, scsi_pointer->Status, DID_RESET); | 1415 | done(shpnt, acp->status, DID_RESET); |
| 1415 | 1416 | ||
| 1416 | } else if (scsi_pointer->phase & disconnected) { | 1417 | } else if (acp->phase & disconnected) { |
| 1417 | /* target sent DISCONNECT */ | 1418 | /* target sent DISCONNECT */ |
| 1418 | #if defined(AHA152X_STAT) | 1419 | #if defined(AHA152X_STAT) |
| 1419 | HOSTDATA(shpnt)->disconnections++; | 1420 | HOSTDATA(shpnt)->disconnections++; |
| 1420 | #endif | 1421 | #endif |
| 1421 | append_SC(&DISCONNECTED_SC, CURRENT_SC); | 1422 | append_SC(&DISCONNECTED_SC, CURRENT_SC); |
| 1422 | scsi_pointer->phase |= 1 << 16; | 1423 | acp->phase |= 1 << 16; |
| 1423 | CURRENT_SC = NULL; | 1424 | CURRENT_SC = NULL; |
| 1424 | 1425 | ||
| 1425 | } else { | 1426 | } else { |
| @@ -1438,24 +1439,23 @@ static void busfree_run(struct Scsi_Host *shpnt) · 12 unmodified lines | |||
| 1438 | action++; | 1439 | action++; |
| 1439 | #endif | 1440 | #endif |
| 1440 | 1441 | ||
| 1441 | if (aha152x_scsi_pointer(DONE_SC)->phase & check_condition) { | 1442 | if (aha152x_priv(DONE_SC)->phase & check_condition) { |
| 1442 | struct scsi_cmnd *cmd = HOSTDATA(shpnt)->done_SC; | 1443 | struct scsi_cmnd *cmd = HOSTDATA(shpnt)->done_SC; |
| 1443 | struct aha152x_scdata *sc = SCDATA(cmd); | 1444 | struct aha152x_scdata *sc = SCDATA(cmd); |
| 1444 | 1445 | ||
| 1445 | scsi_eh_restore_cmnd(cmd, &sc->ses); | 1446 | scsi_eh_restore_cmnd(cmd, &sc->ses); |
| 1446 | 1447 | ||
| 1447 | aha152x_scsi_pointer(cmd)->Status = SAM_STAT_CHECK_CONDITION; | 1448 | aha152x_priv(cmd)->status = SAM_STAT_CHECK_CONDITION; |
| 1448 | 1449 | ||
| 1449 | HOSTDATA(shpnt)->commands--; | 1450 | HOSTDATA(shpnt)->commands--; |
| 1450 | if (!HOSTDATA(shpnt)->commands) | 1451 | if (!HOSTDATA(shpnt)->commands) |
| 1451 | SETPORT(PORTA, 0); /* turn led off */ | 1452 | SETPORT(PORTA, 0); /* turn led off */ |
| 1452 | } else if (aha152x_scsi_pointer(DONE_SC)->Status == | 1453 | } else if (aha152x_priv(DONE_SC)->status == SAM_STAT_CHECK_CONDITION) { |
| 1453 | SAM_STAT_CHECK_CONDITION) { | ||
| 1454 | #if defined(AHA152X_STAT) | 1454 | #if defined(AHA152X_STAT) |
| 1455 | HOSTDATA(shpnt)->busfree_with_check_condition++; | 1455 | HOSTDATA(shpnt)->busfree_with_check_condition++; |
| 1456 | #endif | 1456 | #endif |
| 1457 | 1457 | ||
| 1458 | if(!(aha152x_scsi_pointer(DONE_SC)->phase & not_issued)) { | 1458 | if (!(aha152x_priv(DONE_SC)->phase & not_issued)) { |
| 1459 | struct aha152x_scdata *sc; | 1459 | struct aha152x_scdata *sc; |
| 1460 | struct scsi_cmnd *ptr = DONE_SC; | 1460 | struct scsi_cmnd *ptr = DONE_SC; |
| 1461 | DONE_SC=NULL; | 1461 | DONE_SC=NULL; |
| @@ -1480,7 +1480,7 @@ static void busfree_run(struct Scsi_Host *shpnt) · 18 unmodified lines | |||
| 1480 | if (!HOSTDATA(shpnt)->commands) | 1480 | if (!HOSTDATA(shpnt)->commands) |
| 1481 | SETPORT(PORTA, 0); /* turn led off */ | 1481 | SETPORT(PORTA, 0); /* turn led off */ |
| 1482 | 1482 | ||
| 1483 | if (!(aha152x_scsi_pointer(ptr)->phase & resetting)) { | 1483 | if (!(aha152x_priv(ptr)->phase & resetting)) { |
| 1484 | kfree(ptr->host_scribble); | 1484 | kfree(ptr->host_scribble); |
| 1485 | ptr->host_scribble=NULL; | 1485 | ptr->host_scribble=NULL; |
| 1486 | } | 1486 | } |
| @@ -1503,13 +1503,12 @@ static void busfree_run(struct Scsi_Host *shpnt) · 16 unmodified lines | |||
| 1503 | DO_UNLOCK(flags); | 1503 | DO_UNLOCK(flags); |
| 1504 | 1504 | ||
| 1505 | if(CURRENT_SC) { | 1505 | if(CURRENT_SC) { |
| 1506 | struct scsi_pointer *scsi_pointer = | 1506 | struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC); |
| 1507 | aha152x_scsi_pointer(CURRENT_SC); | ||
| 1508 | 1507 | ||
| 1509 | #if defined(AHA152X_STAT) | 1508 | #if defined(AHA152X_STAT) |
| 1510 | action++; | 1509 | action++; |
| 1511 | #endif | 1510 | #endif |
| 1512 | scsi_pointer->phase |= selecting; | 1511 | acp->phase |= selecting; |
| 1513 | 1512 | ||
| 1514 | /* clear selection timeout */ | 1513 | /* clear selection timeout */ |
| 1515 | SETPORT(SSTAT1, SELTO); | 1514 | SETPORT(SSTAT1, SELTO); |
| @@ -1537,13 +1536,13 @@ static void busfree_run(struct Scsi_Host *shpnt) · 21 unmodified lines | |||
| 1537 | */ | 1536 | */ |
| 1538 | static void seldo_run(struct Scsi_Host *shpnt) | 1537 | static void seldo_run(struct Scsi_Host *shpnt) |
| 1539 | { | 1538 | { |
| 1540 | struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC); | 1539 | struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC); |
| 1541 | 1540 | ||
| 1542 | SETPORT(SCSISIG, 0); | 1541 | SETPORT(SCSISIG, 0); |
| 1543 | SETPORT(SSTAT1, CLRBUSFREE); | 1542 | SETPORT(SSTAT1, CLRBUSFREE); |
| 1544 | SETPORT(SSTAT1, CLRPHASECHG); | 1543 | SETPORT(SSTAT1, CLRPHASECHG); |
| 1545 | 1544 | ||
| 1546 | scsi_pointer->phase &= ~(selecting | not_issued); | 1545 | acp->phase &= ~(selecting | not_issued); |
| 1547 | 1546 | ||
| 1548 | SETPORT(SCSISEQ, 0); | 1547 | SETPORT(SCSISEQ, 0); |
| 1549 | 1548 | ||
| @@ -1558,12 +1557,12 @@ static void seldo_run(struct Scsi_Host *shpnt) · 8 unmodified lines | |||
| 1558 | 1557 | ||
| 1559 | ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun)); | 1558 | ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun)); |
| 1560 | 1559 | ||
| 1561 | if (scsi_pointer->phase & aborting) { | 1560 | if (acp->phase & aborting) { |
| 1562 | ADDMSGO(ABORT); | 1561 | ADDMSGO(ABORT); |
| 1563 | } else if (scsi_pointer->phase & resetting) { | 1562 | } else if (acp->phase & resetting) { |
| 1564 | ADDMSGO(BUS_DEVICE_RESET); | 1563 | ADDMSGO(BUS_DEVICE_RESET); |
| 1565 | } else if (SYNCNEG==0 && SYNCHRONOUS) { | 1564 | } else if (SYNCNEG==0 && SYNCHRONOUS) { |
| 1566 | scsi_pointer->phase |= syncneg; | 1565 | acp->phase |= syncneg; |
| 1567 | MSGOLEN += spi_populate_sync_msg(&MSGO(MSGOLEN), 50, 8); | 1566 | MSGOLEN += spi_populate_sync_msg(&MSGO(MSGOLEN), 50, 8); |
| 1568 | SYNCNEG=1; /* negotiation in progress */ | 1567 | SYNCNEG=1; /* negotiation in progress */ |
| 1569 | } | 1568 | } |
| @@ -1578,7 +1577,7 @@ static void seldo_run(struct Scsi_Host *shpnt) · 8 unmodified lines | |||
| 1578 | */ | 1577 | */ |
| 1579 | static void selto_run(struct Scsi_Host *shpnt) | 1578 | static void selto_run(struct Scsi_Host *shpnt) |
| 1580 | { | 1579 | { |
| 1581 | struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC); | 1580 | struct aha152x_cmd_priv *acp; |
| 1582 | 1581 | ||
| 1583 | SETPORT(SCSISEQ, 0); | 1582 | SETPORT(SCSISEQ, 0); |
| 1584 | SETPORT(SSTAT1, CLRSELTIMO); | 1583 | SETPORT(SSTAT1, CLRSELTIMO); |
| @@ -1586,9 +1585,10 @@ static void selto_run(struct Scsi_Host *shpnt) · 1 unmodified line | |||
| 1586 | if (!CURRENT_SC) | 1585 | if (!CURRENT_SC) |
| 1587 | return; | 1586 | return; |
| 1588 | 1587 | ||
| 1589 | scsi_pointer->phase &= ~selecting; | 1588 | acp = aha152x_priv(CURRENT_SC); |
| 1589 | acp->phase &= ~selecting; | ||
| 1590 | 1590 | ||
| 1591 | if (scsi_pointer->phase & aborted) | 1591 | if (acp->phase & aborted) |
| 1592 | done(shpnt, SAM_STAT_GOOD, DID_ABORT); | 1592 | done(shpnt, SAM_STAT_GOOD, DID_ABORT); |
| 1593 | else if (TESTLO(SSTAT0, SELINGO)) | 1593 | else if (TESTLO(SSTAT0, SELINGO)) |
| 1594 | done(shpnt, SAM_STAT_GOOD, DID_BUS_BUSY); | 1594 | done(shpnt, SAM_STAT_GOOD, DID_BUS_BUSY); |
| @@ -1616,10 +1616,9 @@ static void seldi_run(struct Scsi_Host *shpnt) · 21 unmodified lines | |||
| 1616 | SETPORT(SSTAT1, CLRPHASECHG); | 1616 | SETPORT(SSTAT1, CLRPHASECHG); |
| 1617 | 1617 | ||
| 1618 | if(CURRENT_SC) { | 1618 | if(CURRENT_SC) { |
| 1619 | struct scsi_pointer *scsi_pointer = | 1619 | struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC); |
| 1620 | aha152x_scsi_pointer(CURRENT_SC); | ||
| 1621 | 1620 | ||
| 1622 | if (!(scsi_pointer->phase & not_issued)) | 1621 | if (!(acp->phase & not_issued)) |
| 1623 | scmd_printk(KERN_ERR, CURRENT_SC, | 1622 | scmd_printk(KERN_ERR, CURRENT_SC, |
| 1624 | "command should not have been issued yet\n"); | 1623 | "command should not have been issued yet\n"); |
| 1625 | 1624 | ||
| @@ -1676,7 +1675,7 @@ static void seldi_run(struct Scsi_Host *shpnt) · 50 unmodified lines | |||
| 1676 | static void msgi_run(struct Scsi_Host *shpnt) | 1675 | static void msgi_run(struct Scsi_Host *shpnt) |
| 1677 | { | 1676 | { |
| 1678 | for(;;) { | 1677 | for(;;) { |
| 1679 | struct scsi_pointer *scsi_pointer; | 1678 | struct aha152x_cmd_priv *acp; |
| 1680 | int sstat1 = GETPORT(SSTAT1); | 1679 | int sstat1 = GETPORT(SSTAT1); |
| 1681 | 1680 | ||
| 1682 | if(sstat1 & (PHASECHG|PHASEMIS|BUSFREE) || !(sstat1 & REQINIT)) | 1681 | if(sstat1 & (PHASECHG|PHASEMIS|BUSFREE) || !(sstat1 & REQINIT)) |
| @@ -1714,9 +1713,9 @@ static void msgi_run(struct Scsi_Host *shpnt) · 31 unmodified lines | |||
| 1714 | continue; | 1713 | continue; |
| 1715 | } | 1714 | } |
| 1716 | 1715 | ||
| 1717 | scsi_pointer = aha152x_scsi_pointer(CURRENT_SC); | 1716 | acp = aha152x_priv(CURRENT_SC); |
| 1718 | scsi_pointer->Message = MSGI(0); | 1717 | acp->message = MSGI(0); |
| 1719 | scsi_pointer->phase &= ~disconnected; | 1718 | acp->phase &= ~disconnected; |
| 1720 | 1719 | ||
| 1721 | MSGILEN=0; | 1720 | MSGILEN=0; |
| 1722 | 1721 | ||
| @@ -1724,8 +1723,8 @@ static void msgi_run(struct Scsi_Host *shpnt) · 1 unmodified line | |||
| 1724 | continue; | 1723 | continue; |
| 1725 | } | 1724 | } |
| 1726 | 1725 | ||
| 1727 | scsi_pointer = aha152x_scsi_pointer(CURRENT_SC); | 1726 | acp = aha152x_priv(CURRENT_SC); |
| 1728 | scsi_pointer->Message = MSGI(0); | 1727 | acp->message = MSGI(0); |
| 1729 | 1728 | ||
| 1730 | switch (MSGI(0)) { | 1729 | switch (MSGI(0)) { |
| 1731 | case DISCONNECT: | 1730 | case DISCONNECT: |
| @@ -1733,11 +1732,11 @@ static void msgi_run(struct Scsi_Host *shpnt) · 1 unmodified line | |||
| 1733 | scmd_printk(KERN_WARNING, CURRENT_SC, | 1732 | scmd_printk(KERN_WARNING, CURRENT_SC, |
| 1734 | "target was not allowed to disconnect\n"); | 1733 | "target was not allowed to disconnect\n"); |
| 1735 | 1734 | ||
| 1736 | scsi_pointer->phase |= disconnected; | 1735 | acp->phase |= disconnected; |
| 1737 | break; | 1736 | break; |
| 1738 | 1737 | ||
| 1739 | case COMMAND_COMPLETE: | 1738 | case COMMAND_COMPLETE: |
| 1740 | scsi_pointer->phase |= completed; | 1739 | acp->phase |= completed; |
| 1741 | break; | 1740 | break; |
| 1742 | 1741 | ||
| 1743 | case MESSAGE_REJECT: | 1742 | case MESSAGE_REJECT: |
| @@ -1867,11 +1866,9 @@ static void msgi_end(struct Scsi_Host *shpnt) · 123 unmodified lines | |||
| 1867 | */ | 1866 | */ |
| 1868 | static void msgo_init(struct Scsi_Host *shpnt) | 1867 | static void msgo_init(struct Scsi_Host *shpnt) |
| 1869 | { | 1868 | { |
| 1870 | struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC); | ||
| 1871 | |||
| 1872 | if(MSGOLEN==0) { | 1869 | if(MSGOLEN==0) { |
| 1873 | if ((scsi_pointer->phase & syncneg) && SYNCNEG==2 && | 1870 | if ((aha152x_priv(CURRENT_SC)->phase & syncneg) && |
| 1874 | SYNCRATE==0) { | 1871 | SYNCNEG == 2 && SYNCRATE == 0) { |
| 1875 | ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun)); | 1872 | ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun)); |
| 1876 | } else { | 1873 | } else { |
| 1877 | scmd_printk(KERN_INFO, CURRENT_SC, | 1874 | scmd_printk(KERN_INFO, CURRENT_SC, |
| @@ -1888,7 +1885,7 @@ static void msgo_init(struct Scsi_Host *shpnt) · 10 unmodified lines | |||
| 1888 | */ | 1885 | */ |
| 1889 | static void msgo_run(struct Scsi_Host *shpnt) | 1886 | static void msgo_run(struct Scsi_Host *shpnt) |
| 1890 | { | 1887 | { |
| 1891 | struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC); | 1888 | struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC); |
| 1892 | 1889 | ||
| 1893 | while(MSGO_I<MSGOLEN) { | 1890 | while(MSGO_I<MSGOLEN) { |
| 1894 | if (TESTLO(SSTAT0, SPIORDY)) | 1891 | if (TESTLO(SSTAT0, SPIORDY)) |
| @@ -1901,13 +1898,13 @@ static void msgo_run(struct Scsi_Host *shpnt) · 6 unmodified lines | |||
| 1901 | 1898 | ||
| 1902 | 1899 | ||
| 1903 | if (MSGO(MSGO_I) & IDENTIFY_BASE) | 1900 | if (MSGO(MSGO_I) & IDENTIFY_BASE) |
| 1904 | scsi_pointer->phase |= identified; | 1901 | acp->phase |= identified; |
| 1905 | 1902 | ||
| 1906 | if (MSGO(MSGO_I)==ABORT) | 1903 | if (MSGO(MSGO_I)==ABORT) |
| 1907 | scsi_pointer->phase |= aborted; | 1904 | acp->phase |= aborted; |
| 1908 | 1905 | ||
| 1909 | if (MSGO(MSGO_I)==BUS_DEVICE_RESET) | 1906 | if (MSGO(MSGO_I)==BUS_DEVICE_RESET) |
| 1910 | scsi_pointer->phase |= resetted; | 1907 | acp->phase |= resetted; |
| 1911 | 1908 | ||
| 1912 | SETPORT(SCSIDAT, MSGO(MSGO_I++)); | 1909 | SETPORT(SCSIDAT, MSGO(MSGO_I++)); |
| 1913 | } | 1910 | } |
| @@ -1936,7 +1933,7 @@ static void msgo_end(struct Scsi_Host *shpnt) · 22 unmodified lines | |||
| 1936 | */ | 1933 | */ |
| 1937 | static void cmd_init(struct Scsi_Host *shpnt) | 1934 | static void cmd_init(struct Scsi_Host *shpnt) |
| 1938 | { | 1935 | { |
| 1939 | if (aha152x_scsi_pointer(CURRENT_SC)->sent_command) { | 1936 | if (aha152x_priv(CURRENT_SC)->sent_command) { |
| 1940 | scmd_printk(KERN_ERR, CURRENT_SC, | 1937 | scmd_printk(KERN_ERR, CURRENT_SC, |
| 1941 | "command already sent\n"); | 1938 | "command already sent\n"); |
| 1942 | done(shpnt, SAM_STAT_GOOD, DID_ERROR); | 1939 | done(shpnt, SAM_STAT_GOOD, DID_ERROR); |
| @@ -1967,7 +1964,7 @@ static void cmd_end(struct Scsi_Host *shpnt) · 24 unmodified lines | |||
| 1967 | "command sent incompletely (%d/%d)\n", | 1964 | "command sent incompletely (%d/%d)\n", |
| 1968 | CMD_I, CURRENT_SC->cmd_len); | 1965 | CMD_I, CURRENT_SC->cmd_len); |
| 1969 | else | 1966 | else |
| 1970 | aha152x_scsi_pointer(CURRENT_SC)->sent_command++; | 1967 | aha152x_priv(CURRENT_SC)->sent_command++; |
| 1971 | } | 1968 | } |
| 1972 | 1969 | ||
| 1973 | /* | 1970 | /* |
| @@ -1979,7 +1976,7 @@ static void status_run(struct Scsi_Host *shpnt) · 5 unmodified lines | |||
| 1979 | if (TESTLO(SSTAT0, SPIORDY)) | 1976 | if (TESTLO(SSTAT0, SPIORDY)) |
| 1980 | return; | 1977 | return; |
| 1981 | 1978 | ||
| 1982 | aha152x_scsi_pointer(CURRENT_SC)->Status = GETPORT(SCSIDAT); | 1979 | aha152x_priv(CURRENT_SC)->status = GETPORT(SCSIDAT); |
| 1983 | 1980 | ||
| 1984 | } | 1981 | } |
| 1985 | 1982 | ||
| @@ -2003,7 +2000,7 @@ static void datai_init(struct Scsi_Host *shpnt) · 17 unmodified lines | |||
| 2003 | 2000 | ||
| 2004 | static void datai_run(struct Scsi_Host *shpnt) | 2001 | static void datai_run(struct Scsi_Host *shpnt) |
| 2005 | { | 2002 | { |
| 2006 | struct scsi_pointer *scsi_pointer; | 2003 | struct aha152x_cmd_priv *acp; |
| 2007 | unsigned long the_time; | 2004 | unsigned long the_time; |
| 2008 | int fifodata, data_count; | 2005 | int fifodata, data_count; |
| 2009 | 2006 | ||
| @@ -2041,36 +2038,35 @@ static void datai_run(struct Scsi_Host *shpnt) · 31 unmodified lines | |||
| 2041 | fifodata = GETPORT(FIFOSTAT); | 2038 | fifodata = GETPORT(FIFOSTAT); |
| 2042 | } | 2039 | } |
| 2043 | 2040 | ||
| 2044 | scsi_pointer = aha152x_scsi_pointer(CURRENT_SC); | 2041 | acp = aha152x_priv(CURRENT_SC); |
| 2045 | if (scsi_pointer->this_residual > 0) { | 2042 | if (acp->this_residual > 0) { |
| 2046 | while (fifodata > 0 && scsi_pointer->this_residual > 0) { | 2043 | while (fifodata > 0 && acp->this_residual > 0) { |
| 2047 | data_count = fifodata > scsi_pointer->this_residual ? | 2044 | data_count = fifodata > acp->this_residual ? |
| 2048 | scsi_pointer->this_residual : | 2045 | acp->this_residual : fifodata; |
| 2049 | fifodata; | ||
| 2050 | fifodata -= data_count; | 2046 | fifodata -= data_count; |
| 2051 | 2047 | ||
| 2052 | if (data_count & 1) { | 2048 | if (data_count & 1) { |
| 2053 | SETPORT(DMACNTRL0, ENDMA|_8BIT); | 2049 | SETPORT(DMACNTRL0, ENDMA|_8BIT); |
| 2054 | *scsi_pointer->ptr++ = GETPORT(DATAPORT); | 2050 | *acp->ptr++ = GETPORT(DATAPORT); |
| 2055 | scsi_pointer->this_residual--; | 2051 | acp->this_residual--; |
| 2056 | DATA_LEN++; | 2052 | DATA_LEN++; |
| 2057 | SETPORT(DMACNTRL0, ENDMA); | 2053 | SETPORT(DMACNTRL0, ENDMA); |
| 2058 | } | 2054 | } |
| 2059 | 2055 | ||
| 2060 | if (data_count > 1) { | 2056 | if (data_count > 1) { |
| 2061 | data_count >>= 1; | 2057 | data_count >>= 1; |
| 2062 | insw(DATAPORT, scsi_pointer->ptr, data_count); | 2058 | insw(DATAPORT, acp->ptr, data_count); |
| 2063 | scsi_pointer->ptr += 2 * data_count; | 2059 | acp->ptr += 2 * data_count; |
| 2064 | scsi_pointer->this_residual -= 2 * data_count; | 2060 | acp->this_residual -= 2 * data_count; |
| 2065 | DATA_LEN += 2 * data_count; | 2061 | DATA_LEN += 2 * data_count; |
| 2066 | } | 2062 | } |
| 2067 | 2063 | ||
| 2068 | if (scsi_pointer->this_residual == 0 && | 2064 | if (acp->this_residual == 0 && |
| 2069 | !sg_is_last(scsi_pointer->buffer)) { | 2065 | !sg_is_last(acp->buffer)) { |
| 2070 | /* advance to next buffer */ | 2066 | /* advance to next buffer */ |
| 2071 | scsi_pointer->buffer = sg_next(scsi_pointer->buffer); | 2067 | acp->buffer = sg_next(acp->buffer); |
| 2072 | scsi_pointer->ptr = SG_ADDRESS(scsi_pointer->buffer); | 2068 | acp->ptr = SG_ADDRESS(acp->buffer); |
| 2073 | scsi_pointer->this_residual = scsi_pointer->buffer->length; | 2069 | acp->this_residual = acp->buffer->length; |
| 2074 | } | 2070 | } |
| 2075 | } | 2071 | } |
| 2076 | } else if (fifodata > 0) { | 2072 | } else if (fifodata > 0) { |
| @@ -2138,15 +2134,15 @@ static void datao_init(struct Scsi_Host *shpnt) · 61 unmodified lines | |||
| 2138 | 2134 | ||
| 2139 | static void datao_run(struct Scsi_Host *shpnt) | 2135 | static void datao_run(struct Scsi_Host *shpnt) |
| 2140 | { | 2136 | { |
| 2141 | struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC); | 2137 | struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC); |
| 2142 | unsigned long the_time; | 2138 | unsigned long the_time; |
| 2143 | int data_count; | 2139 | int data_count; |
| 2144 | 2140 | ||
| 2145 | /* until phase changes or all data sent */ | 2141 | /* until phase changes or all data sent */ |
| 2146 | while (TESTLO(DMASTAT, INTSTAT) && scsi_pointer->this_residual > 0) { | 2142 | while (TESTLO(DMASTAT, INTSTAT) && acp->this_residual > 0) { |
| 2147 | data_count = 128; | 2143 | data_count = 128; |
| 2148 | if (data_count > scsi_pointer->this_residual) | 2144 | if (data_count > acp->this_residual) |
| 2149 | data_count = scsi_pointer->this_residual; | 2145 | data_count = acp->this_residual; |
| 2150 | 2146 | ||
| 2151 | if(TESTLO(DMASTAT, DFIFOEMP)) { | 2147 | if(TESTLO(DMASTAT, DFIFOEMP)) { |
| 2152 | scmd_printk(KERN_ERR, CURRENT_SC, | 2148 | scmd_printk(KERN_ERR, CURRENT_SC, |
| @@ -2157,26 +2153,25 @@ static void datao_run(struct Scsi_Host *shpnt) · 4 unmodified lines | |||
| 2157 | 2153 | ||
| 2158 | if(data_count & 1) { | 2154 | if(data_count & 1) { |
| 2159 | SETPORT(DMACNTRL0,WRITE_READ|ENDMA|_8BIT); | 2155 | SETPORT(DMACNTRL0,WRITE_READ|ENDMA|_8BIT); |
| 2160 | SETPORT(DATAPORT, *scsi_pointer->ptr++); | 2156 | SETPORT(DATAPORT, *acp->ptr++); |
| 2161 | scsi_pointer->this_residual--; | 2157 | acp->this_residual--; |
| 2162 | CMD_INC_RESID(CURRENT_SC, -1); | 2158 | CMD_INC_RESID(CURRENT_SC, -1); |
| 2163 | SETPORT(DMACNTRL0,WRITE_READ|ENDMA); | 2159 | SETPORT(DMACNTRL0,WRITE_READ|ENDMA); |
| 2164 | } | 2160 | } |
| 2165 | 2161 | ||
| 2166 | if(data_count > 1) { | 2162 | if(data_count > 1) { |
| 2167 | data_count >>= 1; | 2163 | data_count >>= 1; |
| 2168 | outsw(DATAPORT, scsi_pointer->ptr, data_count); | 2164 | outsw(DATAPORT, acp->ptr, data_count); |
| 2169 | scsi_pointer->ptr += 2 * data_count; | 2165 | acp->ptr += 2 * data_count; |
| 2170 | scsi_pointer->this_residual -= 2 * data_count; | 2166 | acp->this_residual -= 2 * data_count; |
| 2171 | CMD_INC_RESID(CURRENT_SC, -2 * data_count); | 2167 | CMD_INC_RESID(CURRENT_SC, -2 * data_count); |
| 2172 | } | 2168 | } |
| 2173 | 2169 | ||
| 2174 | if (scsi_pointer->this_residual == 0 && | 2170 | if (acp->this_residual == 0 && !sg_is_last(acp->buffer)) { |
| 2175 | !sg_is_last(scsi_pointer->buffer)) { | ||
| 2176 | /* advance to next buffer */ | 2171 | /* advance to next buffer */ |
| 2177 | scsi_pointer->buffer = sg_next(scsi_pointer->buffer); | 2172 | acp->buffer = sg_next(acp->buffer); |
| 2178 | scsi_pointer->ptr = SG_ADDRESS(scsi_pointer->buffer); | 2173 | acp->ptr = SG_ADDRESS(acp->buffer); |
| 2179 | scsi_pointer->this_residual = scsi_pointer->buffer->length; | 2174 | acp->this_residual = acp->buffer->length; |
| 2180 | } | 2175 | } |
| 2181 | 2176 | ||
| 2182 | the_time=jiffies + 100*HZ; | 2177 | the_time=jiffies + 100*HZ; |
| @@ -2192,7 +2187,7 @@ static void datao_run(struct Scsi_Host *shpnt) · 9 unmodified lines | |||
| 2192 | 2187 | ||
| 2193 | static void datao_end(struct Scsi_Host *shpnt) | 2188 | static void datao_end(struct Scsi_Host *shpnt) |
| 2194 | { | 2189 | { |
| 2195 | struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC); | 2190 | struct aha152x_cmd_priv *acp = aha152x_priv(CURRENT_SC); |
| 2196 | 2191 | ||
| 2197 | if(TESTLO(DMASTAT, DFIFOEMP)) { | 2192 | if(TESTLO(DMASTAT, DFIFOEMP)) { |
| 2198 | u32 datao_cnt = GETSTCNT(); | 2193 | u32 datao_cnt = GETSTCNT(); |
| @@ -2211,10 +2206,9 @@ static void datao_end(struct Scsi_Host *shpnt) · 12 unmodified lines | |||
| 2211 | sg = sg_next(sg); | 2206 | sg = sg_next(sg); |
| 2212 | } | 2207 | } |
| 2213 | 2208 | ||
| 2214 | scsi_pointer->buffer = sg; | 2209 | acp->buffer = sg; |
| 2215 | scsi_pointer->ptr = SG_ADDRESS(scsi_pointer->buffer) + done; | 2210 | acp->ptr = SG_ADDRESS(acp->buffer) + done; |
| 2216 | scsi_pointer->this_residual = scsi_pointer->buffer->length - | 2211 | acp->this_residual = acp->buffer->length - done; |
| 2217 | done; | ||
| 2218 | } | 2212 | } |
| 2219 | 2213 | ||
| 2220 | SETPORT(SXFRCTL0, CH1|CLRCH1|CLRSTCNT); | 2214 | SETPORT(SXFRCTL0, CH1|CLRCH1|CLRSTCNT); |
| @@ -2229,7 +2223,6 @@ static void datao_end(struct Scsi_Host *shpnt) · 8 unmodified lines | |||
| 2229 | */ | 2223 | */ |
| 2230 | static int update_state(struct Scsi_Host *shpnt) | 2224 | static int update_state(struct Scsi_Host *shpnt) |
| 2231 | { | 2225 | { |
| 2232 | struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(CURRENT_SC); | ||
| 2233 | int dataphase=0; | 2226 | int dataphase=0; |
| 2234 | unsigned int stat0 = GETPORT(SSTAT0); | 2227 | unsigned int stat0 = GETPORT(SSTAT0); |
| 2235 | unsigned int stat1 = GETPORT(SSTAT1); | 2228 | unsigned int stat1 = GETPORT(SSTAT1); |
| @@ -2244,7 +2237,7 @@ static int update_state(struct Scsi_Host *shpnt) · 8 unmodified lines | |||
| 2244 | } else if (stat0 & SELDI && PREVSTATE == busfree) { | 2237 | } else if (stat0 & SELDI && PREVSTATE == busfree) { |
| 2245 | STATE=seldi; | 2238 | STATE=seldi; |
| 2246 | } else if (stat0 & SELDO && CURRENT_SC && | 2239 | } else if (stat0 & SELDO && CURRENT_SC && |
| 2247 | (scsi_pointer->phase & selecting)) { | 2240 | (aha152x_priv(CURRENT_SC)->phase & selecting)) { |
| 2248 | STATE=seldo; | 2241 | STATE=seldo; |
| 2249 | } else if(stat1 & SELTO) { | 2242 | } else if(stat1 & SELTO) { |
| 2250 | STATE=selto; | 2243 | STATE=selto; |
| @@ -2376,8 +2369,7 @@ static void is_complete(struct Scsi_Host *shpnt) · 125 unmodified lines | |||
| 2376 | SETPORT(SXFRCTL0, CH1); | 2369 | SETPORT(SXFRCTL0, CH1); |
| 2377 | SETPORT(DMACNTRL0, 0); | 2370 | SETPORT(DMACNTRL0, 0); |
| 2378 | if(CURRENT_SC) | 2371 | if(CURRENT_SC) |
| 2379 | aha152x_scsi_pointer(CURRENT_SC)->phase &= | 2372 | aha152x_priv(CURRENT_SC)->phase &= ~spiordy; |
| 2380 | ~spiordy; | ||
| 2381 | } | 2373 | } |
| 2382 | 2374 | ||
| 2383 | /* | 2375 | /* |
| @@ -2399,8 +2391,7 @@ static void is_complete(struct Scsi_Host *shpnt) · 15 unmodified lines | |||
| 2399 | SETPORT(DMACNTRL0, 0); | 2391 | SETPORT(DMACNTRL0, 0); |
| 2400 | SETPORT(SXFRCTL0, CH1|SPIOEN); | 2392 | SETPORT(SXFRCTL0, CH1|SPIOEN); |
| 2401 | if(CURRENT_SC) | 2393 | if(CURRENT_SC) |
| 2402 | aha152x_scsi_pointer(CURRENT_SC)->phase |= | 2394 | aha152x_priv(CURRENT_SC)->phase |= spiordy; |
| 2403 | spiordy; | ||
| 2404 | } | 2395 | } |
| 2405 | 2396 | ||
| 2406 | /* | 2397 | /* |
| @@ -2490,7 +2481,7 @@ static void disp_enintr(struct Scsi_Host *shpnt) · 83 unmodified lines | |||
| 2490 | */ | 2481 | */ |
| 2491 | static void show_command(struct scsi_cmnd *ptr) | 2482 | static void show_command(struct scsi_cmnd *ptr) |
| 2492 | { | 2483 | { |
| 2493 | const int phase = aha152x_scsi_pointer(ptr)->phase; | 2484 | const int phase = aha152x_priv(ptr)->phase; |
| 2494 | 2485 | ||
| 2495 | scsi_print_command(ptr); | 2486 | scsi_print_command(ptr); |
| 2496 | scmd_printk(KERN_DEBUG, ptr, | 2487 | scmd_printk(KERN_DEBUG, ptr, |
| @@ -2538,8 +2529,8 @@ static void show_queues(struct Scsi_Host *shpnt) · 41 unmodified lines | |||
| 2538 | 2529 | ||
| 2539 | static void get_command(struct seq_file *m, struct scsi_cmnd * ptr) | 2530 | static void get_command(struct seq_file *m, struct scsi_cmnd * ptr) |
| 2540 | { | 2531 | { |
| 2541 | struct scsi_pointer *scsi_pointer = aha152x_scsi_pointer(ptr); | 2532 | struct aha152x_cmd_priv *acp = aha152x_priv(ptr); |
| 2542 | const int phase = scsi_pointer->phase; | 2533 | const int phase = acp->phase; |
| 2543 | int i; | 2534 | int i; |
| 2544 | 2535 | ||
| 2545 | seq_printf(m, "%p: target=%d; lun=%d; cmnd=( ", | 2536 | seq_printf(m, "%p: target=%d; lun=%d; cmnd=( ", |
| @@ -2549,8 +2540,8 @@ static void get_command(struct seq_file *m, struct scsi_cmnd * ptr) · 3 unmodified lines | |||
| 2549 | seq_printf(m, "0x%02x ", ptr->cmnd[i]); | 2540 | seq_printf(m, "0x%02x ", ptr->cmnd[i]); |
| 2550 | 2541 | ||
| 2551 | seq_printf(m, "); resid=%d; residual=%d; buffers=%d; phase |", | 2542 | seq_printf(m, "); resid=%d; residual=%d; buffers=%d; phase |", |
| 2552 | scsi_get_resid(ptr), scsi_pointer->this_residual, | 2543 | scsi_get_resid(ptr), acp->this_residual, |
| 2553 | sg_nents(scsi_pointer->buffer) - 1); | 2544 | sg_nents(acp->buffer) - 1); |
| 2554 | 2545 | ||
| 2555 | if (phase & not_issued) | 2546 | if (phase & not_issued) |
| 2556 | seq_puts(m, "not issued|"); | 2547 | seq_puts(m, "not issued|"); |
| @@ -420,8 +420,6 @@ ahd_unlock(struct ahd_softc *ahd, unsigned long *flags) · 419 unmodified lines | |||
| 420 | 420 | ||
| 421 | /* config registers for header type 0 devices */ | 421 | /* config registers for header type 0 devices */ |
| 422 | #define PCIR_MAPS 0x10 | 422 | #define PCIR_MAPS 0x10 |
| 423 | #define PCIR_SUBVEND_0 0x2c | ||
| 424 | #define PCIR_SUBDEV_0 0x2e | ||
| 425 | 423 | ||
| 426 | /****************************** PCI-X definitions *****************************/ | 424 | /****************************** PCI-X definitions *****************************/ |
| 427 | #define PCIXR_COMMAND 0x96 | 425 | #define PCIXR_COMMAND 0x96 |
| @@ -260,8 +260,8 @@ ahd_find_pci_device(ahd_dev_softc_t pci) · 259 unmodified lines | |||
| 260 | 260 | ||
| 261 | vendor = ahd_pci_read_config(pci, PCIR_DEVVENDOR, /*bytes*/2); | 261 | vendor = ahd_pci_read_config(pci, PCIR_DEVVENDOR, /*bytes*/2); |
| 262 | device = ahd_pci_read_config(pci, PCIR_DEVICE, /*bytes*/2); | 262 | device = ahd_pci_read_config(pci, PCIR_DEVICE, /*bytes*/2); |
| 263 | subvendor = ahd_pci_read_config(pci, PCIR_SUBVEND_0, /*bytes*/2); | 263 | subvendor = ahd_pci_read_config(pci, PCI_SUBSYSTEM_VENDOR_ID, /*bytes*/2); |
| 264 | subdevice = ahd_pci_read_config(pci, PCIR_SUBDEV_0, /*bytes*/2); | 264 | subdevice = ahd_pci_read_config(pci, PCI_SUBSYSTEM_ID, /*bytes*/2); |
| 265 | full_id = ahd_compose_id(device, | 265 | full_id = ahd_compose_id(device, |
| 266 | vendor, | 266 | vendor, |
| 267 | subdevice, | 267 | subdevice, |
| @@ -298,7 +298,7 @@ ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry) · 30 unmodified lines | |||
| 298 | * Record if this is an HP board. | 298 | * Record if this is an HP board. |
| 299 | */ | 299 | */ |
| 300 | subvendor = ahd_pci_read_config(ahd->dev_softc, | 300 | subvendor = ahd_pci_read_config(ahd->dev_softc, |
| 301 | PCIR_SUBVEND_0, /*bytes*/2); | 301 | PCI_SUBSYSTEM_VENDOR_ID, /*bytes*/2); |
| 302 | if (subvendor == SUBID_HP) | 302 | if (subvendor == SUBID_HP) |
| 303 | ahd->flags |= AHD_HP_BOARD; | 303 | ahd->flags |= AHD_HP_BOARD; |
| 304 | 304 | ||
| @@ -433,8 +433,6 @@ ahc_unlock(struct ahc_softc *ahc, unsigned long *flags) · 432 unmodified lines | |||
| 433 | 433 | ||
| 434 | /* config registers for header type 0 devices */ | 434 | /* config registers for header type 0 devices */ |
| 435 | #define PCIR_MAPS 0x10 | 435 | #define PCIR_MAPS 0x10 |
| 436 | #define PCIR_SUBVEND_0 0x2c | ||
| 437 | #define PCIR_SUBDEV_0 0x2e | ||
| 438 | 436 | ||
| 439 | typedef enum | 437 | typedef enum |
| 440 | { | 438 | { |
| @@ -673,8 +673,8 @@ ahc_find_pci_device(ahc_dev_softc_t pci) · 672 unmodified lines | |||
| 673 | 673 | ||
| 674 | vendor = ahc_pci_read_config(pci, PCIR_DEVVENDOR, /*bytes*/2); | 674 | vendor = ahc_pci_read_config(pci, PCIR_DEVVENDOR, /*bytes*/2); |
| 675 | device = ahc_pci_read_config(pci, PCIR_DEVICE, /*bytes*/2); | 675 | device = ahc_pci_read_config(pci, PCIR_DEVICE, /*bytes*/2); |
| 676 | subvendor = ahc_pci_read_config(pci, PCIR_SUBVEND_0, /*bytes*/2); | 676 | subvendor = ahc_pci_read_config(pci, PCI_SUBSYSTEM_VENDOR_ID, /*bytes*/2); |
| 677 | subdevice = ahc_pci_read_config(pci, PCIR_SUBDEV_0, /*bytes*/2); | 677 | subdevice = ahc_pci_read_config(pci, PCI_SUBSYSTEM_ID, /*bytes*/2); |
| 678 | full_id = ahc_compose_id(device, vendor, subdevice, subvendor); | 678 | full_id = ahc_compose_id(device, vendor, subdevice, subvendor); |
| 679 | 679 | ||
| 680 | /* | 680 | /* |
| @@ -1169,7 +1169,7 @@ static void bnx2fc_process_ofld_cmpl(struct bnx2fc_hba *hba, · 1168 unmodified lines | |||
| 1169 | ofld_kcqe->fcoe_conn_context_id); | 1169 | ofld_kcqe->fcoe_conn_context_id); |
| 1170 | interface = tgt->port->priv; | 1170 | interface = tgt->port->priv; |
| 1171 | if (hba != interface->hba) { | 1171 | if (hba != interface->hba) { |
| 1172 | printk(KERN_ERR PFX "ERROR:ofld_cmpl: HBA mis-match\n"); | 1172 | printk(KERN_ERR PFX "ERROR:ofld_cmpl: HBA mismatch\n"); |
| 1173 | goto ofld_cmpl_err; | 1173 | goto ofld_cmpl_err; |
| 1174 | } | 1174 | } |
| 1175 | /* | 1175 | /* |
| @@ -1226,12 +1226,12 @@ static void bnx2fc_process_enable_conn_cmpl(struct bnx2fc_hba *hba, · 50 unmodified lines | |||
| 1226 | * and enable | 1226 | * and enable |
| 1227 | */ | 1227 | */ |
| 1228 | if (tgt->context_id != context_id) { | 1228 | if (tgt->context_id != context_id) { |
| 1229 | printk(KERN_ERR PFX "context id mis-match\n"); | 1229 | printk(KERN_ERR PFX "context id mismatch\n"); |
| 1230 | return; | 1230 | return; |
| 1231 | } | 1231 | } |
| 1232 | interface = tgt->port->priv; | 1232 | interface = tgt->port->priv; |
| 1233 | if (hba != interface->hba) { | 1233 | if (hba != interface->hba) { |
| 1234 | printk(KERN_ERR PFX "bnx2fc-enbl_cmpl: HBA mis-match\n"); | 1234 | printk(KERN_ERR PFX "bnx2fc-enbl_cmpl: HBA mismatch\n"); |
| 1235 | goto enbl_cmpl_err; | 1235 | goto enbl_cmpl_err; |
| 1236 | } | 1236 | } |
| 1237 | if (!ofld_kcqe->completion_status) | 1237 | if (!ofld_kcqe->completion_status) |
| @@ -2398,7 +2398,7 @@ static void bnx2i_process_conn_destroy_cmpl(struct bnx2i_hba *hba, · 2397 unmodified lines | |||
| 2398 | } | 2398 | } |
| 2399 | 2399 | ||
| 2400 | if (hba != ep->hba) { | 2400 | if (hba != ep->hba) { |
| 2401 | printk(KERN_ALERT "conn destroy- error hba mis-match\n"); | 2401 | printk(KERN_ALERT "conn destroy- error hba mismatch\n"); |
| 2402 | return; | 2402 | return; |
| 2403 | } | 2403 | } |
| 2404 | 2404 | ||
| @@ -2432,7 +2432,7 @@ static void bnx2i_process_ofld_cmpl(struct bnx2i_hba *hba, · 27 unmodified lines | |||
| 2432 | } | 2432 | } |
| 2433 | 2433 | ||
| 2434 | if (hba != ep->hba) { | 2434 | if (hba != ep->hba) { |
| 2435 | printk(KERN_ALERT "ofld_cmpl: error hba mis-match\n"); | 2435 | printk(KERN_ALERT "ofld_cmpl: error hba mismatch\n"); |
| 2436 | return; | 2436 | return; |
| 2437 | } | 2437 | } |
| 2438 | 2438 | ||
| @@ -442,7 +442,6 @@ void hisi_sas_task_deliver(struct hisi_hba *hisi_hba, · 441 unmodified lines | |||
| 442 | case SAS_PROTOCOL_INTERNAL_ABORT: | 442 | case SAS_PROTOCOL_INTERNAL_ABORT: |
| 443 | hisi_sas_task_prep_abort(hisi_hba, slot); | 443 | hisi_sas_task_prep_abort(hisi_hba, slot); |
| 444 | break; | 444 | break; |
| 445 | fallthrough; | ||
| 446 | default: | 445 | default: |
| 447 | return; | 446 | return; |
| 448 | } | 447 | } |
| @@ -36,7 +36,7 @@ · 35 unmodified lines | |||
| 36 | 36 | ||
| 37 | #define IBMVSCSIS_VERSION "v0.2" | 37 | #define IBMVSCSIS_VERSION "v0.2" |
| 38 | 38 | ||
| 39 | #define INITIAL_SRP_LIMIT 800 | 39 | #define INITIAL_SRP_LIMIT 1024 |
| 40 | #define DEFAULT_MAX_SECTORS 256 | 40 | #define DEFAULT_MAX_SECTORS 256 |
| 41 | #define MAX_TXU 1024 * 1024 | 41 | #define MAX_TXU 1024 * 1024 |
| 42 | 42 | ||
| @@ -413,7 +413,7 @@ static void sci_controller_event_completion(struct isci_host *ihost, u32 ent) · 412 unmodified lines | |||
| 413 | dev_warn(&ihost->pdev->dev, | 413 | dev_warn(&ihost->pdev->dev, |
| 414 | "%s: SCIC Controller 0x%p received " | 414 | "%s: SCIC Controller 0x%p received " |
| 415 | "event 0x%x for io request object " | 415 | "event 0x%x for io request object " |
| 416 | "that doesnt exist.\n", | 416 | "that doesn't exist.\n", |
| 417 | __func__, | 417 | __func__, |
| 418 | ihost, | 418 | ihost, |
| 419 | ent); | 419 | ent); |
| @@ -428,7 +428,7 @@ static void sci_controller_event_completion(struct isci_host *ihost, u32 ent) · 8 unmodified lines | |||
| 428 | dev_warn(&ihost->pdev->dev, | 428 | dev_warn(&ihost->pdev->dev, |
| 429 | "%s: SCIC Controller 0x%p received " | 429 | "%s: SCIC Controller 0x%p received " |
| 430 | "event 0x%x for remote device object " | 430 | "event 0x%x for remote device object " |
| 431 | "that doesnt exist.\n", | 431 | "that doesn't exist.\n", |
| 432 | __func__, | 432 | __func__, |
| 433 | ihost, | 433 | ihost, |
| 434 | ent); | 434 | ent); |
| @@ -462,7 +462,7 @@ static void sci_controller_event_completion(struct isci_host *ihost, u32 ent) · 27 unmodified lines | |||
| 462 | } else | 462 | } else |
| 463 | dev_err(&ihost->pdev->dev, | 463 | dev_err(&ihost->pdev->dev, |
| 464 | "%s: SCIC Controller 0x%p received event 0x%x " | 464 | "%s: SCIC Controller 0x%p received event 0x%x " |
| 465 | "for remote device object 0x%0x that doesnt " | 465 | "for remote device object 0x%0x that doesn't " |
| 466 | "exist.\n", | 466 | "exist.\n", |
| 467 | __func__, | 467 | __func__, |
| 468 | ihost, | 468 | ihost, |
| @@ -3045,7 +3045,6 @@ iscsi_conn_setup(struct iscsi_cls_session *cls_session, int dd_size, · 3044 unmodified lines | |||
| 3045 | if (!cls_conn) | 3045 | if (!cls_conn) |
| 3046 | return NULL; | 3046 | return NULL; |
| 3047 | conn = cls_conn->dd_data; | 3047 | conn = cls_conn->dd_data; |
| 3048 | memset(conn, 0, sizeof(*conn) + dd_size); | ||
| 3049 | 3048 | ||
| 3050 | conn->dd_data = cls_conn->dd_data + sizeof(*conn); | 3049 | conn->dd_data = cls_conn->dd_data + sizeof(*conn); |
| 3051 | conn->session = session; | 3050 | conn->session = session; |
| @@ -897,6 +897,11 @@ enum lpfc_irq_chann_mode { · 896 unmodified lines | |||
| 897 | NHT_MODE, | 897 | NHT_MODE, |
| 898 | }; | 898 | }; |
| 899 | 899 | ||
| 900 | enum lpfc_hba_bit_flags { | ||
| 901 | FABRIC_COMANDS_BLOCKED, | ||
| 902 | HBA_PCI_ERR, | ||
| 903 | }; | ||
| 904 | |||
| 900 | struct lpfc_hba { | 905 | struct lpfc_hba { |
| 901 | /* SCSI interface function jump table entries */ | 906 | /* SCSI interface function jump table entries */ |
| 902 | struct lpfc_io_buf * (*lpfc_get_scsi_buf) | 907 | struct lpfc_io_buf * (*lpfc_get_scsi_buf) |
| @@ -1043,7 +1048,6 @@ struct lpfc_hba { · 140 unmodified lines | |||
| 1043 | * Firmware supports Forced Link Speed | 1048 | * Firmware supports Forced Link Speed |
| 1044 | * capability | 1049 | * capability |
| 1045 | */ | 1050 | */ |
| 1046 | #define HBA_PCI_ERR 0x80000 /* The PCI slot is offline */ | ||
| 1047 | #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */ | 1051 | #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */ |
| 1048 | #define HBA_SHORT_CMF 0x200000 /* shorter CMF timer routine */ | 1052 | #define HBA_SHORT_CMF 0x200000 /* shorter CMF timer routine */ |
| 1049 | #define HBA_CGN_DAY_WRAP 0x400000 /* HBA Congestion info day wraps */ | 1053 | #define HBA_CGN_DAY_WRAP 0x400000 /* HBA Congestion info day wraps */ |
| @@ -1350,7 +1354,6 @@ struct lpfc_hba { · 300 unmodified lines | |||
| 1350 | atomic_t fabric_iocb_count; | 1354 | atomic_t fabric_iocb_count; |
| 1351 | struct timer_list fabric_block_timer; | 1355 | struct timer_list fabric_block_timer; |
| 1352 | unsigned long bit_flags; | 1356 | unsigned long bit_flags; |
| 1353 | #define FABRIC_COMANDS_BLOCKED 0 | ||
| 1354 | atomic_t num_rsrc_err; | 1357 | atomic_t num_rsrc_err; |
| 1355 | atomic_t num_cmd_success; | 1358 | atomic_t num_cmd_success; |
| 1356 | unsigned long last_rsrc_error_time; | 1359 | unsigned long last_rsrc_error_time; |
| @@ -670,3 +670,6 @@ struct lpfc_vmid *lpfc_get_vmid_from_hashtable(struct lpfc_vport *vport, · 669 unmodified lines | |||
| 670 | uint32_t hash, uint8_t *buf); | 670 | uint32_t hash, uint8_t *buf); |
| 671 | void lpfc_vmid_vport_cleanup(struct lpfc_vport *vport); | 671 | void lpfc_vmid_vport_cleanup(struct lpfc_vport *vport); |
| 672 | int lpfc_issue_els_qfpa(struct lpfc_vport *vport); | 672 | int lpfc_issue_els_qfpa(struct lpfc_vport *vport); |
| 673 | |||
| 674 | void lpfc_sli_rpi_release(struct lpfc_vport *vport, | ||
| 675 | struct lpfc_nodelist *ndlp); | ||
| @@ -109,8 +109,8 @@ lpfc_rport_invalid(struct fc_rport *rport) · 108 unmodified lines | |||
| 109 | 109 | ||
| 110 | ndlp = rdata->pnode; | 110 | ndlp = rdata->pnode; |
| 111 | if (!rdata->pnode) { | 111 | if (!rdata->pnode) { |
| 112 | pr_err("**** %s: NULL ndlp on rport x%px SID x%x\n", | 112 | pr_info("**** %s: NULL ndlp on rport x%px SID x%x\n", |
| 113 | __func__, rport, rport->scsi_target_id); | 113 | __func__, rport, rport->scsi_target_id); |
| 114 | return -EINVAL; | 114 | return -EINVAL; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| @@ -169,9 +169,10 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) · 52 unmodified lines | |||
| 169 | 169 | ||
| 170 | lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, | 170 | lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, |
| 171 | "3181 dev_loss_callbk x%06x, rport x%px flg x%x " | 171 | "3181 dev_loss_callbk x%06x, rport x%px flg x%x " |
| 172 | "load_flag x%x refcnt %d\n", | 172 | "load_flag x%x refcnt %d state %d xpt x%x\n", |
| 173 | ndlp->nlp_DID, ndlp->rport, ndlp->nlp_flag, | 173 | ndlp->nlp_DID, ndlp->rport, ndlp->nlp_flag, |
| 174 | vport->load_flag, kref_read(&ndlp->kref)); | 174 | vport->load_flag, kref_read(&ndlp->kref), |
| 175 | ndlp->nlp_state, ndlp->fc4_xpt_flags); | ||
| 175 | 176 | ||
| 176 | /* Don't schedule a worker thread event if the vport is going down. | 177 | /* Don't schedule a worker thread event if the vport is going down. |
| 177 | * The teardown process cleans up the node via lpfc_drop_node. | 178 | * The teardown process cleans up the node via lpfc_drop_node. |
| @@ -181,6 +182,11 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) · 3 unmodified lines | |||
| 181 | ndlp->rport = NULL; | 182 | ndlp->rport = NULL; |
| 182 | 183 | ||
| 183 | ndlp->fc4_xpt_flags &= ~SCSI_XPT_REGD; | 184 | ndlp->fc4_xpt_flags &= ~SCSI_XPT_REGD; |
| 185 | /* clear the NLP_XPT_REGD if the node is not registered | ||
| 186 | * with nvme-fc | ||
| 187 | */ | ||
| 188 | if (ndlp->fc4_xpt_flags == NLP_XPT_REGD) | ||
| 189 | ndlp->fc4_xpt_flags &= ~NLP_XPT_REGD; | ||
| 184 | 190 | ||
| 185 | /* Remove the node reference from remote_port_add now. | 191 | /* Remove the node reference from remote_port_add now. |
| 186 | * The driver will not call remote_port_delete. | 192 | * The driver will not call remote_port_delete. |
| @@ -225,18 +231,36 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) · 38 unmodified lines | |||
| 225 | ndlp->rport = NULL; | 231 | ndlp->rport = NULL; |
| 226 | spin_unlock_irqrestore(&ndlp->lock, iflags); | 232 | spin_unlock_irqrestore(&ndlp->lock, iflags); |
| 227 | 233 | ||
| 228 | /* We need to hold the node by incrementing the reference | 234 | if (phba->worker_thread) { |
| 229 | * count until this queued work is done | 235 | /* We need to hold the node by incrementing the reference |
| 230 | */ | 236 | * count until this queued work is done |
| 231 | evtp->evt_arg1 = lpfc_nlp_get(ndlp); | 237 | */ |
| 238 | evtp->evt_arg1 = lpfc_nlp_get(ndlp); | ||
| 239 | |||
| 240 | spin_lock_irqsave(&phba->hbalock, iflags); | ||
| 241 | if (evtp->evt_arg1) { | ||
| 242 | evtp->evt = LPFC_EVT_DEV_LOSS; | ||
| 243 | list_add_tail(&evtp->evt_listp, &phba->work_list); | ||
| 244 | lpfc_worker_wake_up(phba); | ||
| 245 | } | ||
| 246 | spin_unlock_irqrestore(&phba->hbalock, iflags); | ||
| 247 | } else { | ||
| 248 | lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, | ||
| 249 | "3188 worker thread is stopped %s x%06x, " | ||
| 250 | " rport x%px flg x%x load_flag x%x refcnt " | ||
| 251 | "%d\n", __func__, ndlp->nlp_DID, | ||
| 252 | ndlp->rport, ndlp->nlp_flag, | ||
| 253 | vport->load_flag, kref_read(&ndlp->kref)); | ||
| 254 | if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD)) { | ||
| 255 | spin_lock_irqsave(&ndlp->lock, iflags); | ||
| 256 | /* Node is in dev loss. No further transaction. */ | ||
| 257 | ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS; | ||
| 258 | spin_unlock_irqrestore(&ndlp->lock, iflags); | ||
| 259 | lpfc_disc_state_machine(vport, ndlp, NULL, | ||
| 260 | NLP_EVT_DEVICE_RM); | ||
| 261 | } | ||
| 232 | 262 | ||
| 233 | spin_lock_irqsave(&phba->hbalock, iflags); | ||
| 234 | if (evtp->evt_arg1) { | ||
| 235 | evtp->evt = LPFC_EVT_DEV_LOSS; | ||
| 236 | list_add_tail(&evtp->evt_listp, &phba->work_list); | ||
| 237 | lpfc_worker_wake_up(phba); | ||
| 238 | } | 263 | } |
| 239 | spin_unlock_irqrestore(&phba->hbalock, iflags); | ||
| 240 | 264 | ||
| 241 | return; | 265 | return; |
| 242 | } | 266 | } |
| @@ -503,11 +527,12 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) · 260 unmodified lines | |||
| 503 | lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, | 527 | lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |
| 504 | "0203 Devloss timeout on " | 528 | "0203 Devloss timeout on " |
| 505 | "WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x " | 529 | "WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x " |
| 506 | "NPort x%06x Data: x%x x%x x%x\n", | 530 | "NPort x%06x Data: x%x x%x x%x refcnt %d\n", |
| 507 | *name, *(name+1), *(name+2), *(name+3), | 531 | *name, *(name+1), *(name+2), *(name+3), |
| 508 | *(name+4), *(name+5), *(name+6), *(name+7), | 532 | *(name+4), *(name+5), *(name+6), *(name+7), |
| 509 | ndlp->nlp_DID, ndlp->nlp_flag, | 533 | ndlp->nlp_DID, ndlp->nlp_flag, |
| 510 | ndlp->nlp_state, ndlp->nlp_rpi); | 534 | ndlp->nlp_state, ndlp->nlp_rpi, |
| 535 | kref_read(&ndlp->kref)); | ||
| 511 | } else { | 536 | } else { |
| 512 | lpfc_printf_vlog(vport, KERN_INFO, LOG_TRACE_EVENT, | 537 | lpfc_printf_vlog(vport, KERN_INFO, LOG_TRACE_EVENT, |
| 513 | "0204 Devloss timeout on " | 538 | "0204 Devloss timeout on " |
| @@ -755,18 +780,22 @@ lpfc_work_list_done(struct lpfc_hba *phba) · 241 unmodified lines | |||
| 755 | int free_evt; | 780 | int free_evt; |
| 756 | int fcf_inuse; | 781 | int fcf_inuse; |
| 757 | uint32_t nlp_did; | 782 | uint32_t nlp_did; |
| 783 | bool hba_pci_err; | ||
| 758 | 784 | ||
| 759 | spin_lock_irq(&phba->hbalock); | 785 | spin_lock_irq(&phba->hbalock); |
| 760 | while (!list_empty(&phba->work_list)) { | 786 | while (!list_empty(&phba->work_list)) { |
| 761 | list_remove_head((&phba->work_list), evtp, typeof(*evtp), | 787 | list_remove_head((&phba->work_list), evtp, typeof(*evtp), |
| 762 | evt_listp); | 788 | evt_listp); |
| 763 | spin_unlock_irq(&phba->hbalock); | 789 | spin_unlock_irq(&phba->hbalock); |
| 790 | hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags); | ||
| 764 | free_evt = 1; | 791 | free_evt = 1; |
| 765 | switch (evtp->evt) { | 792 | switch (evtp->evt) { |
| 766 | case LPFC_EVT_ELS_RETRY: | 793 | case LPFC_EVT_ELS_RETRY: |
| 767 | ndlp = (struct lpfc_nodelist *) (evtp->evt_arg1); | 794 | ndlp = (struct lpfc_nodelist *) (evtp->evt_arg1); |
| 768 | lpfc_els_retry_delay_handler(ndlp); | 795 | if (!hba_pci_err) { |
| 769 | free_evt = 0; /* evt is part of ndlp */ | 796 | lpfc_els_retry_delay_handler(ndlp); |
| 797 | free_evt = 0; /* evt is part of ndlp */ | ||
| 798 | } | ||
| 770 | /* decrement the node reference count held | 799 | /* decrement the node reference count held |
| 771 | * for this queued work | 800 | * for this queued work |
| 772 | */ | 801 | */ |
| @@ -788,8 +817,10 @@ lpfc_work_list_done(struct lpfc_hba *phba) · 15 unmodified lines | |||
| 788 | break; | 817 | break; |
| 789 | case LPFC_EVT_RECOVER_PORT: | 818 | case LPFC_EVT_RECOVER_PORT: |
| 790 | ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1); | 819 | ndlp = (struct lpfc_nodelist *)(evtp->evt_arg1); |
| 791 | lpfc_sli_abts_recover_port(ndlp->vport, ndlp); | 820 | if (!hba_pci_err) { |
| 792 | free_evt = 0; | 821 | lpfc_sli_abts_recover_port(ndlp->vport, ndlp); |
| 822 | free_evt = 0; | ||
| 823 | } | ||
| 793 | /* decrement the node reference count held for | 824 | /* decrement the node reference count held for |
| 794 | * this queued work | 825 | * this queued work |
| 795 | */ | 826 | */ |
| @@ -859,14 +890,18 @@ lpfc_work_done(struct lpfc_hba *phba) · 63 unmodified lines | |||
| 859 | struct lpfc_vport **vports; | 890 | struct lpfc_vport **vports; |
| 860 | struct lpfc_vport *vport; | 891 | struct lpfc_vport *vport; |
| 861 | int i; | 892 | int i; |
| 893 | bool hba_pci_err; | ||
| 862 | 894 | ||
| 895 | hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags); | ||
| 863 | spin_lock_irq(&phba->hbalock); | 896 | spin_lock_irq(&phba->hbalock); |
| 864 | ha_copy = phba->work_ha; | 897 | ha_copy = phba->work_ha; |
| 865 | phba->work_ha = 0; | 898 | phba->work_ha = 0; |
| 866 | spin_unlock_irq(&phba->hbalock); | 899 | spin_unlock_irq(&phba->hbalock); |
| 900 | if (hba_pci_err) | ||
| 901 | ha_copy = 0; | ||
| 867 | 902 | ||
| 868 | /* First, try to post the next mailbox command to SLI4 device */ | 903 | /* First, try to post the next mailbox command to SLI4 device */ |
| 869 | if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) | 904 | if (phba->pci_dev_grp == LPFC_PCI_DEV_OC && !hba_pci_err) |
| 870 | lpfc_sli4_post_async_mbox(phba); | 905 | lpfc_sli4_post_async_mbox(phba); |
| 871 | 906 | ||
| 872 | if (ha_copy & HA_ERATT) { | 907 | if (ha_copy & HA_ERATT) { |
| @@ -886,7 +921,7 @@ lpfc_work_done(struct lpfc_hba *phba) · 13 unmodified lines | |||
| 886 | lpfc_handle_latt(phba); | 921 | lpfc_handle_latt(phba); |
| 887 | 922 | ||
| 888 | /* Handle VMID Events */ | 923 | /* Handle VMID Events */ |
| 889 | if (lpfc_is_vmid_enabled(phba)) { | 924 | if (lpfc_is_vmid_enabled(phba) && !hba_pci_err) { |
| 890 | if (phba->pport->work_port_events & | 925 | if (phba->pport->work_port_events & |
| 891 | WORKER_CHECK_VMID_ISSUE_QFPA) { | 926 | WORKER_CHECK_VMID_ISSUE_QFPA) { |
| 892 | lpfc_check_vmid_qfpa_issue(phba); | 927 | lpfc_check_vmid_qfpa_issue(phba); |
| @@ -936,6 +971,8 @@ lpfc_work_done(struct lpfc_hba *phba) · 43 unmodified lines | |||
| 936 | work_port_events = vport->work_port_events; | 971 | work_port_events = vport->work_port_events; |
| 937 | vport->work_port_events &= ~work_port_events; | 972 | vport->work_port_events &= ~work_port_events; |
| 938 | spin_unlock_irq(&vport->work_port_lock); | 973 | spin_unlock_irq(&vport->work_port_lock); |
| 974 | if (hba_pci_err) | ||
| 975 | continue; | ||
| 939 | if (work_port_events & WORKER_DISC_TMO) | 976 | if (work_port_events & WORKER_DISC_TMO) |
| 940 | lpfc_disc_timeout_handler(vport); | 977 | lpfc_disc_timeout_handler(vport); |
| 941 | if (work_port_events & WORKER_ELS_TMO) | 978 | if (work_port_events & WORKER_ELS_TMO) |
| @@ -1173,12 +1210,14 @@ lpfc_linkdown(struct lpfc_hba *phba) · 231 unmodified lines | |||
| 1173 | struct lpfc_vport **vports; | 1210 | struct lpfc_vport **vports; |
| 1174 | LPFC_MBOXQ_t *mb; | 1211 | LPFC_MBOXQ_t *mb; |
| 1175 | int i; | 1212 | int i; |
| 1213 | int offline; | ||
| 1176 | 1214 | ||
| 1177 | if (phba->link_state == LPFC_LINK_DOWN) | 1215 | if (phba->link_state == LPFC_LINK_DOWN) |
| 1178 | return 0; | 1216 | return 0; |
| 1179 | 1217 | ||
| 1180 | /* Block all SCSI stack I/Os */ | 1218 | /* Block all SCSI stack I/Os */ |
| 1181 | lpfc_scsi_dev_block(phba); | 1219 | lpfc_scsi_dev_block(phba); |
| 1220 | offline = pci_channel_offline(phba->pcidev); | ||
| 1182 | 1221 | ||
| 1183 | phba->defer_flogi_acc_flag = false; | 1222 | phba->defer_flogi_acc_flag = false; |
| 1184 | 1223 | ||
| @@ -1219,7 +1258,7 @@ lpfc_linkdown(struct lpfc_hba *phba) · 34 unmodified lines | |||
| 1219 | lpfc_destroy_vport_work_array(phba, vports); | 1258 | lpfc_destroy_vport_work_array(phba, vports); |
| 1220 | 1259 | ||
| 1221 | /* Clean up any SLI3 firmware default rpi's */ | 1260 | /* Clean up any SLI3 firmware default rpi's */ |
| 1222 | if (phba->sli_rev > LPFC_SLI_REV3) | 1261 | if (phba->sli_rev > LPFC_SLI_REV3 || offline) |
| 1223 | goto skip_unreg_did; | 1262 | goto skip_unreg_did; |
| 1224 | 1263 | ||
| 1225 | mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 1264 | mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
| @@ -4712,6 +4751,11 @@ lpfc_nlp_unreg_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 3486 unmodified lines | |||
| 4712 | spin_lock_irqsave(&ndlp->lock, iflags); | 4751 | spin_lock_irqsave(&ndlp->lock, iflags); |
| 4713 | if (!(ndlp->fc4_xpt_flags & NLP_XPT_REGD)) { | 4752 | if (!(ndlp->fc4_xpt_flags & NLP_XPT_REGD)) { |
| 4714 | spin_unlock_irqrestore(&ndlp->lock, iflags); | 4753 | spin_unlock_irqrestore(&ndlp->lock, iflags); |
| 4754 | lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, | ||
| 4755 | "0999 %s Not regd: ndlp x%px rport x%px DID " | ||
| 4756 | "x%x FLG x%x XPT x%x\n", | ||
| 4757 | __func__, ndlp, ndlp->rport, ndlp->nlp_DID, | ||
| 4758 | ndlp->nlp_flag, ndlp->fc4_xpt_flags); | ||
| 4715 | return; | 4759 | return; |
| 4716 | } | 4760 | } |
| 4717 | 4761 | ||
| @@ -4722,6 +4766,13 @@ lpfc_nlp_unreg_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 4 unmodified lines | |||
| 4722 | ndlp->fc4_xpt_flags & SCSI_XPT_REGD) { | 4766 | ndlp->fc4_xpt_flags & SCSI_XPT_REGD) { |
| 4723 | vport->phba->nport_event_cnt++; | 4767 | vport->phba->nport_event_cnt++; |
| 4724 | lpfc_unregister_remote_port(ndlp); | 4768 | lpfc_unregister_remote_port(ndlp); |
| 4769 | } else if (!ndlp->rport) { | ||
| 4770 | lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, | ||
| 4771 | "1999 %s NDLP in devloss x%px DID x%x FLG x%x" | ||
| 4772 | " XPT x%x refcnt %d\n", | ||
| 4773 | __func__, ndlp, ndlp->nlp_DID, ndlp->nlp_flag, | ||
| 4774 | ndlp->fc4_xpt_flags, | ||
| 4775 | kref_read(&ndlp->kref)); | ||
| 4725 | } | 4776 | } |
| 4726 | 4777 | ||
| 4727 | if (ndlp->fc4_xpt_flags & NVME_XPT_REGD) { | 4778 | if (ndlp->fc4_xpt_flags & NVME_XPT_REGD) { |
| @@ -5371,6 +5422,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 643 unmodified lines | |||
| 5371 | ndlp->nlp_flag &= ~NLP_UNREG_INP; | 5422 | ndlp->nlp_flag &= ~NLP_UNREG_INP; |
| 5372 | mempool_free(mbox, phba->mbox_mem_pool); | 5423 | mempool_free(mbox, phba->mbox_mem_pool); |
| 5373 | acc_plogi = 1; | 5424 | acc_plogi = 1; |
| 5425 | lpfc_nlp_put(ndlp); | ||
| 5374 | } | 5426 | } |
| 5375 | } else { | 5427 | } else { |
| 5376 | lpfc_printf_vlog(vport, KERN_INFO, | 5428 | lpfc_printf_vlog(vport, KERN_INFO, |
| @@ -6097,12 +6149,34 @@ lpfc_disc_flush_list(struct lpfc_vport *vport) · 720 unmodified lines | |||
| 6097 | } | 6149 | } |
| 6098 | } | 6150 | } |
| 6099 | 6151 | ||
| 6152 | /* | ||
| 6153 | * lpfc_notify_xport_npr - notifies xport of node disappearance | ||
| 6154 | * @vport: Pointer to Virtual Port object. | ||
| 6155 | * | ||
| 6156 | * Transitions all ndlps to NPR state. When lpfc_nlp_set_state | ||
| 6157 | * calls lpfc_nlp_state_cleanup, the ndlp->rport is unregistered | ||
| 6158 | * and transport notified that the node is gone. | ||
| 6159 | * Return Code: | ||
| 6160 | * none | ||
| 6161 | */ | ||
| 6162 | static void | ||
| 6163 | lpfc_notify_xport_npr(struct lpfc_vport *vport) | ||
| 6164 | { | ||
| 6165 | struct lpfc_nodelist *ndlp, *next_ndlp; | ||
| 6166 | |||
| 6167 | list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, | ||
| 6168 | nlp_listp) { | ||
| 6169 | lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); | ||
| 6170 | } | ||
| 6171 | } | ||
| 6100 | void | 6172 | void |
| 6101 | lpfc_cleanup_discovery_resources(struct lpfc_vport *vport) | 6173 | lpfc_cleanup_discovery_resources(struct lpfc_vport *vport) |
| 6102 | { | 6174 | { |
| 6103 | lpfc_els_flush_rscn(vport); | 6175 | lpfc_els_flush_rscn(vport); |
| 6104 | lpfc_els_flush_cmd(vport); | 6176 | lpfc_els_flush_cmd(vport); |
| 6105 | lpfc_disc_flush_list(vport); | 6177 | lpfc_disc_flush_list(vport); |
| 6178 | if (pci_channel_offline(vport->phba->pcidev)) | ||
| 6179 | lpfc_notify_xport_npr(vport); | ||
| 6106 | } | 6180 | } |
| 6107 | 6181 | ||
| 6108 | /*****************************************************************************/ | 6182 | /*****************************************************************************/ |
| @@ -95,6 +95,7 @@ static void lpfc_sli4_oas_verify(struct lpfc_hba *phba); · 94 unmodified lines | |||
| 95 | static uint16_t lpfc_find_cpu_handle(struct lpfc_hba *, uint16_t, int); | 95 | static uint16_t lpfc_find_cpu_handle(struct lpfc_hba *, uint16_t, int); |
| 96 | static void lpfc_setup_bg(struct lpfc_hba *, struct Scsi_Host *); | 96 | static void lpfc_setup_bg(struct lpfc_hba *, struct Scsi_Host *); |
| 97 | static int lpfc_sli4_cgn_parm_chg_evt(struct lpfc_hba *); | 97 | static int lpfc_sli4_cgn_parm_chg_evt(struct lpfc_hba *); |
| 98 | static void lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba); | ||
| 98 | 99 | ||
| 99 | static struct scsi_transport_template *lpfc_transport_template = NULL; | 100 | static struct scsi_transport_template *lpfc_transport_template = NULL; |
| 100 | static struct scsi_transport_template *lpfc_vport_transport_template = NULL; | 101 | static struct scsi_transport_template *lpfc_vport_transport_template = NULL; |
| @@ -1642,7 +1643,7 @@ lpfc_sli4_offline_eratt(struct lpfc_hba *phba) · 1541 unmodified lines | |||
| 1642 | { | 1643 | { |
| 1643 | spin_lock_irq(&phba->hbalock); | 1644 | spin_lock_irq(&phba->hbalock); |
| 1644 | if (phba->link_state == LPFC_HBA_ERROR && | 1645 | if (phba->link_state == LPFC_HBA_ERROR && |
| 1645 | phba->hba_flag & HBA_PCI_ERR) { | 1646 | test_bit(HBA_PCI_ERR, &phba->bit_flags)) { |
| 1646 | spin_unlock_irq(&phba->hbalock); | 1647 | spin_unlock_irq(&phba->hbalock); |
| 1647 | return; | 1648 | return; |
| 1648 | } | 1649 | } |
| @@ -1985,6 +1986,7 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba) · 336 unmodified lines | |||
| 1985 | if (pci_channel_offline(phba->pcidev)) { | 1986 | if (pci_channel_offline(phba->pcidev)) { |
| 1986 | lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, | 1987 | lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, |
| 1987 | "3166 pci channel is offline\n"); | 1988 | "3166 pci channel is offline\n"); |
| 1989 | lpfc_sli_flush_io_rings(phba); | ||
| 1988 | return; | 1990 | return; |
| 1989 | } | 1991 | } |
| 1990 | 1992 | ||
| @@ -2973,6 +2975,22 @@ lpfc_cleanup(struct lpfc_vport *vport) · 982 unmodified lines | |||
| 2973 | NLP_EVT_DEVICE_RM); | 2975 | NLP_EVT_DEVICE_RM); |
| 2974 | } | 2976 | } |
| 2975 | 2977 | ||
| 2978 | /* This is a special case flush to return all | ||
| 2979 | * IOs before entering this loop. There are | ||
| 2980 | * two points in the code where a flush is | ||
| 2981 | * avoided if the FC_UNLOADING flag is set. | ||
| 2982 | * one is in the multipool destroy, | ||
| 2983 | * (this prevents a crash) and the other is | ||
| 2984 | * in the nvme abort handler, ( also prevents | ||
| 2985 | * a crash). Both of these exceptions are | ||
| 2986 | * cases where the slot is still accessible. | ||
| 2987 | * The flush here is only when the pci slot | ||
| 2988 | * is offline. | ||
| 2989 | */ | ||
| 2990 | if (vport->load_flag & FC_UNLOADING && | ||
| 2991 | pci_channel_offline(phba->pcidev)) | ||
| 2992 | lpfc_sli_flush_io_rings(vport->phba); | ||
| 2993 | |||
| 2976 | /* At this point, ALL ndlp's should be gone | 2994 | /* At this point, ALL ndlp's should be gone |
| 2977 | * because of the previous NLP_EVT_DEVICE_RM. | 2995 | * because of the previous NLP_EVT_DEVICE_RM. |
| 2978 | * Lets wait for this to happen, if needed. | 2996 | * Lets wait for this to happen, if needed. |
| @@ -2985,7 +3003,7 @@ lpfc_cleanup(struct lpfc_vport *vport) · 6 unmodified lines | |||
| 2985 | list_for_each_entry_safe(ndlp, next_ndlp, | 3003 | list_for_each_entry_safe(ndlp, next_ndlp, |
| 2986 | &vport->fc_nodes, nlp_listp) { | 3004 | &vport->fc_nodes, nlp_listp) { |
| 2987 | lpfc_printf_vlog(ndlp->vport, KERN_ERR, | 3005 | lpfc_printf_vlog(ndlp->vport, KERN_ERR, |
| 2988 | LOG_TRACE_EVENT, | 3006 | LOG_DISCOVERY, |
| 2989 | "0282 did:x%x ndlp:x%px " | 3007 | "0282 did:x%x ndlp:x%px " |
| 2990 | "refcnt:%d xflags x%x nflag x%x\n", | 3008 | "refcnt:%d xflags x%x nflag x%x\n", |
| 2991 | ndlp->nlp_DID, (void *)ndlp, | 3009 | ndlp->nlp_DID, (void *)ndlp, |
| @@ -3682,7 +3700,8 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) · 690 unmodified lines | |||
| 3682 | struct lpfc_vport **vports; | 3700 | struct lpfc_vport **vports; |
| 3683 | struct Scsi_Host *shost; | 3701 | struct Scsi_Host *shost; |
| 3684 | int i; | 3702 | int i; |
| 3685 | int offline = 0; | 3703 | int offline; |
| 3704 | bool hba_pci_err; | ||
| 3686 | 3705 | ||
| 3687 | if (vport->fc_flag & FC_OFFLINE_MODE) | 3706 | if (vport->fc_flag & FC_OFFLINE_MODE) |
| 3688 | return; | 3707 | return; |
| @@ -3692,6 +3711,7 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) · 3 unmodified lines | |||
| 3692 | lpfc_linkdown(phba); | 3711 | lpfc_linkdown(phba); |
| 3693 | 3712 | ||
| 3694 | offline = pci_channel_offline(phba->pcidev); | 3713 | offline = pci_channel_offline(phba->pcidev); |
| 3714 | hba_pci_err = test_bit(HBA_PCI_ERR, &phba->bit_flags); | ||
| 3695 | 3715 | ||
| 3696 | /* Issue an unreg_login to all nodes on all vports */ | 3716 | /* Issue an unreg_login to all nodes on all vports */ |
| 3697 | vports = lpfc_create_vport_work_array(phba); | 3717 | vports = lpfc_create_vport_work_array(phba); |
| @@ -3715,11 +3735,14 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) · 17 unmodified lines | |||
| 3715 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; | 3735 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; |
| 3716 | spin_unlock_irq(&ndlp->lock); | 3736 | spin_unlock_irq(&ndlp->lock); |
| 3717 | 3737 | ||
| 3718 | if (offline) { | 3738 | if (offline || hba_pci_err) { |
| 3719 | spin_lock_irq(&ndlp->lock); | 3739 | spin_lock_irq(&ndlp->lock); |
| 3720 | ndlp->nlp_flag &= ~(NLP_UNREG_INP | | 3740 | ndlp->nlp_flag &= ~(NLP_UNREG_INP | |
| 3721 | NLP_RPI_REGISTERED); | 3741 | NLP_RPI_REGISTERED); |
| 3722 | spin_unlock_irq(&ndlp->lock); | 3742 | spin_unlock_irq(&ndlp->lock); |
| 3743 | if (phba->sli_rev == LPFC_SLI_REV4) | ||
| 3744 | lpfc_sli_rpi_release(vports[i], | ||
| 3745 | ndlp); | ||
| 3723 | } else { | 3746 | } else { |
| 3724 | lpfc_unreg_rpi(vports[i], ndlp); | 3747 | lpfc_unreg_rpi(vports[i], ndlp); |
| 3725 | } | 3748 | } |
| @@ -13354,8 +13377,9 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba) · 9628 unmodified lines | |||
| 13354 | /* Abort all iocbs associated with the hba */ | 13377 | /* Abort all iocbs associated with the hba */ |
| 13355 | lpfc_sli_hba_iocb_abort(phba); | 13378 | lpfc_sli_hba_iocb_abort(phba); |
| 13356 | 13379 | ||
| 13357 | /* Wait for completion of device XRI exchange busy */ | 13380 | if (!pci_channel_offline(phba->pcidev)) |
| 13358 | lpfc_sli4_xri_exchange_busy_wait(phba); | 13381 | /* Wait for completion of device XRI exchange busy */ |
| 13382 | lpfc_sli4_xri_exchange_busy_wait(phba); | ||
| 13359 | 13383 | ||
| 13360 | /* per-phba callback de-registration for hotplug event */ | 13384 | /* per-phba callback de-registration for hotplug event */ |
| 13361 | if (phba->pport) | 13385 | if (phba->pport) |
| @@ -13374,15 +13398,12 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba) · 12 unmodified lines | |||
| 13374 | /* Disable FW logging to host memory */ | 13398 | /* Disable FW logging to host memory */ |
| 13375 | lpfc_ras_stop_fwlog(phba); | 13399 | lpfc_ras_stop_fwlog(phba); |
| 13376 | 13400 | ||
| 13377 | /* Unset the queues shared with the hardware then release all | ||
| 13378 | * allocated resources. | ||
| 13379 | */ | ||
| 13380 | lpfc_sli4_queue_unset(phba); | ||
| 13381 | lpfc_sli4_queue_destroy(phba); | ||
| 13382 | |||
| 13383 | /* Reset SLI4 HBA FCoE function */ | 13401 | /* Reset SLI4 HBA FCoE function */ |
| 13384 | lpfc_pci_function_reset(phba); | 13402 | lpfc_pci_function_reset(phba); |
| 13385 | 13403 | ||
| 13404 | /* release all queue allocated resources. */ | ||
| 13405 | lpfc_sli4_queue_destroy(phba); | ||
| 13406 | |||
| 13386 | /* Free RAS DMA memory */ | 13407 | /* Free RAS DMA memory */ |
| 13387 | if (phba->ras_fwlog.ras_enabled) | 13408 | if (phba->ras_fwlog.ras_enabled) |
| 13388 | lpfc_sli4_ras_dma_free(phba); | 13409 | lpfc_sli4_ras_dma_free(phba); |
| @@ -14262,6 +14283,7 @@ lpfc_sli_prep_dev_for_perm_failure(struct lpfc_hba *phba) · 873 unmodified lines | |||
| 14262 | "2711 PCI channel permanent disable for failure\n"); | 14283 | "2711 PCI channel permanent disable for failure\n"); |
| 14263 | /* Block all SCSI devices' I/Os on the host */ | 14284 | /* Block all SCSI devices' I/Os on the host */ |
| 14264 | lpfc_scsi_dev_block(phba); | 14285 | lpfc_scsi_dev_block(phba); |
| 14286 | lpfc_sli4_prep_dev_for_reset(phba); | ||
| 14265 | 14287 | ||
| 14266 | /* stop all timers */ | 14288 | /* stop all timers */ |
| 14267 | lpfc_stop_hba_timers(phba); | 14289 | lpfc_stop_hba_timers(phba); |
| @@ -15057,24 +15079,28 @@ lpfc_sli4_prep_dev_for_recover(struct lpfc_hba *phba) · 789 unmodified lines | |||
| 15057 | static void | 15079 | static void |
| 15058 | lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) | 15080 | lpfc_sli4_prep_dev_for_reset(struct lpfc_hba *phba) |
| 15059 | { | 15081 | { |
| 15060 | lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, | 15082 | int offline = pci_channel_offline(phba->pcidev); |
| 15061 | "2826 PCI channel disable preparing for reset\n"); | 15083 | |
| 15084 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
| 15085 | "2826 PCI channel disable preparing for reset offline" | ||
| 15086 | " %d\n", offline); | ||
| 15062 | 15087 | ||
| 15063 | /* Block any management I/Os to the device */ | 15088 | /* Block any management I/Os to the device */ |
| 15064 | lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); | 15089 | lpfc_block_mgmt_io(phba, LPFC_MBX_NO_WAIT); |
| 15065 | 15090 | ||
| 15066 | /* Block all SCSI devices' I/Os on the host */ | ||
| 15067 | lpfc_scsi_dev_block(phba); | ||
| 15068 | 15091 | ||
| 15092 | /* HBA_PCI_ERR was set in io_error_detect */ | ||
| 15093 | lpfc_offline_prep(phba, LPFC_MBX_NO_WAIT); | ||
| 15069 | /* Flush all driver's outstanding I/Os as we are to reset */ | 15094 | /* Flush all driver's outstanding I/Os as we are to reset */ |
| 15070 | lpfc_sli_flush_io_rings(phba); | 15095 | lpfc_sli_flush_io_rings(phba); |
| 15096 | lpfc_offline(phba); | ||
| 15071 | 15097 | ||
| 15072 | /* stop all timers */ | 15098 | /* stop all timers */ |
| 15073 | lpfc_stop_hba_timers(phba); | 15099 | lpfc_stop_hba_timers(phba); |
| 15074 | 15100 | ||
| 15101 | lpfc_sli4_queue_destroy(phba); | ||
| 15075 | /* Disable interrupt and pci device */ | 15102 | /* Disable interrupt and pci device */ |
| 15076 | lpfc_sli4_disable_intr(phba); | 15103 | lpfc_sli4_disable_intr(phba); |
| 15077 | lpfc_sli4_queue_destroy(phba); | ||
| 15078 | pci_disable_device(phba->pcidev); | 15104 | pci_disable_device(phba->pcidev); |
| 15079 | } | 15105 | } |
| 15080 | 15106 | ||
| @@ -15123,6 +15149,7 @@ lpfc_io_error_detected_s4(struct pci_dev *pdev, pci_channel_state_t state) · 42 unmodified lines | |||
| 15123 | { | 15149 | { |
| 15124 | struct Scsi_Host *shost = pci_get_drvdata(pdev); | 15150 | struct Scsi_Host *shost = pci_get_drvdata(pdev); |
| 15125 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; | 15151 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
| 15152 | bool hba_pci_err; | ||
| 15126 | 15153 | ||
| 15127 | switch (state) { | 15154 | switch (state) { |
| 15128 | case pci_channel_io_normal: | 15155 | case pci_channel_io_normal: |
| @@ -15130,17 +15157,24 @@ lpfc_io_error_detected_s4(struct pci_dev *pdev, pci_channel_state_t state) · 1 unmodified line | |||
| 15130 | lpfc_sli4_prep_dev_for_recover(phba); | 15157 | lpfc_sli4_prep_dev_for_recover(phba); |
| 15131 | return PCI_ERS_RESULT_CAN_RECOVER; | 15158 | return PCI_ERS_RESULT_CAN_RECOVER; |
| 15132 | case pci_channel_io_frozen: | 15159 | case pci_channel_io_frozen: |
| 15133 | phba->hba_flag |= HBA_PCI_ERR; | 15160 | hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); |
| 15134 | /* Fatal error, prepare for slot reset */ | 15161 | /* Fatal error, prepare for slot reset */ |
| 15135 | lpfc_sli4_prep_dev_for_reset(phba); | 15162 | if (!hba_pci_err) |
| 15163 | lpfc_sli4_prep_dev_for_reset(phba); | ||
| 15164 | else | ||
| 15165 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
| 15166 | "2832 Already handling PCI error " | ||
| 15167 | "state: x%x\n", state); | ||
| 15136 | return PCI_ERS_RESULT_NEED_RESET; | 15168 | return PCI_ERS_RESULT_NEED_RESET; |
| 15137 | case pci_channel_io_perm_failure: | 15169 | case pci_channel_io_perm_failure: |
| 15138 | phba->hba_flag |= HBA_PCI_ERR; | 15170 | set_bit(HBA_PCI_ERR, &phba->bit_flags); |
| 15139 | /* Permanent failure, prepare for device down */ | 15171 | /* Permanent failure, prepare for device down */ |
| 15140 | lpfc_sli4_prep_dev_for_perm_failure(phba); | 15172 | lpfc_sli4_prep_dev_for_perm_failure(phba); |
| 15141 | return PCI_ERS_RESULT_DISCONNECT; | 15173 | return PCI_ERS_RESULT_DISCONNECT; |
| 15142 | default: | 15174 | default: |
| 15143 | phba->hba_flag |= HBA_PCI_ERR; | 15175 | hba_pci_err = test_and_set_bit(HBA_PCI_ERR, &phba->bit_flags); |
| 15176 | if (!hba_pci_err) | ||
| 15177 | lpfc_sli4_prep_dev_for_reset(phba); | ||
| 15144 | /* Unknown state, prepare and request slot reset */ | 15178 | /* Unknown state, prepare and request slot reset */ |
| 15145 | lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, | 15179 | lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, |
| 15146 | "2825 Unknown PCI error state: x%x\n", state); | 15180 | "2825 Unknown PCI error state: x%x\n", state); |
| @@ -15174,17 +15208,21 @@ lpfc_io_slot_reset_s4(struct pci_dev *pdev) · 27 unmodified lines | |||
| 15174 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; | 15208 | struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; |
| 15175 | struct lpfc_sli *psli = &phba->sli; | 15209 | struct lpfc_sli *psli = &phba->sli; |
| 15176 | uint32_t intr_mode; | 15210 | uint32_t intr_mode; |
| 15211 | bool hba_pci_err; | ||
| 15177 | 15212 | ||
| 15178 | dev_printk(KERN_INFO, &pdev->dev, "recovering from a slot reset.\n"); | 15213 | dev_printk(KERN_INFO, &pdev->dev, "recovering from a slot reset.\n"); |
| 15179 | if (pci_enable_device_mem(pdev)) { | 15214 | if (pci_enable_device_mem(pdev)) { |
| 15180 | printk(KERN_ERR "lpfc: Cannot re-enable " | 15215 | printk(KERN_ERR "lpfc: Cannot re-enable " |
| 15181 | "PCI device after reset.\n"); | 15216 | "PCI device after reset.\n"); |
| 15182 | return PCI_ERS_RESULT_DISCONNECT; | 15217 | return PCI_ERS_RESULT_DISCONNECT; |
| 15183 | } | 15218 | } |
| 15184 | 15219 | ||
| 15185 | pci_restore_state(pdev); | 15220 | pci_restore_state(pdev); |
| 15186 | 15221 | ||
| 15187 | phba->hba_flag &= ~HBA_PCI_ERR; | 15222 | hba_pci_err = test_and_clear_bit(HBA_PCI_ERR, &phba->bit_flags); |
| 15223 | if (!hba_pci_err) | ||
| 15224 | dev_info(&pdev->dev, | ||
| 15225 | "hba_pci_err was not set, recovering slot reset.\n"); | ||
| 15188 | /* | 15226 | /* |
| 15189 | * As the new kernel behavior of pci_restore_state() API call clears | 15227 | * As the new kernel behavior of pci_restore_state() API call clears |
| 15190 | * device saved_state flag, need to save the restored state again. | 15228 | * device saved_state flag, need to save the restored state again. |
| @@ -15198,6 +15236,8 @@ lpfc_io_slot_reset_s4(struct pci_dev *pdev) · 7 unmodified lines | |||
| 15198 | psli->sli_flag &= ~LPFC_SLI_ACTIVE; | 15236 | psli->sli_flag &= ~LPFC_SLI_ACTIVE; |
| 15199 | spin_unlock_irq(&phba->hbalock); | 15237 | spin_unlock_irq(&phba->hbalock); |
| 15200 | 15238 | ||
| 15239 | /* Init cpu_map array */ | ||
| 15240 | lpfc_cpu_map_array_init(phba); | ||
| 15201 | /* Configure and enable interrupt */ | 15241 | /* Configure and enable interrupt */ |
| 15202 | intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); | 15242 | intr_mode = lpfc_sli4_enable_intr(phba, phba->intr_mode); |
| 15203 | if (intr_mode == LPFC_INTR_ERROR) { | 15243 | if (intr_mode == LPFC_INTR_ERROR) { |
| @@ -15239,8 +15279,6 @@ lpfc_io_resume_s4(struct pci_dev *pdev) · 35 unmodified lines | |||
| 15239 | */ | 15279 | */ |
| 15240 | if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { | 15280 | if (!(phba->sli.sli_flag & LPFC_SLI_ACTIVE)) { |
| 15241 | /* Perform device reset */ | 15281 | /* Perform device reset */ |
| 15242 | lpfc_offline_prep(phba, LPFC_MBX_WAIT); | ||
| 15243 | lpfc_offline(phba); | ||
| 15244 | lpfc_sli_brdrestart(phba); | 15282 | lpfc_sli_brdrestart(phba); |
| 15245 | /* Bring the device back online */ | 15283 | /* Bring the device back online */ |
| 15246 | lpfc_online(phba); | 15284 | lpfc_online(phba); |
| @@ -93,6 +93,11 @@ lpfc_nvme_create_queue(struct nvme_fc_local_port *pnvme_lport, · 92 unmodified lines | |||
| 93 | 93 | ||
| 94 | lport = (struct lpfc_nvme_lport *)pnvme_lport->private; | 94 | lport = (struct lpfc_nvme_lport *)pnvme_lport->private; |
| 95 | vport = lport->vport; | 95 | vport = lport->vport; |
| 96 | |||
| 97 | if (!vport || vport->load_flag & FC_UNLOADING || | ||
| 98 | vport->phba->hba_flag & HBA_IOQ_FLUSH) | ||
| 99 | return -ENODEV; | ||
| 100 | |||
| 96 | qhandle = kzalloc(sizeof(struct lpfc_nvme_qhandle), GFP_KERNEL); | 101 | qhandle = kzalloc(sizeof(struct lpfc_nvme_qhandle), GFP_KERNEL); |
| 97 | if (qhandle == NULL) | 102 | if (qhandle == NULL) |
| 98 | return -ENOMEM; | 103 | return -ENOMEM; |
| @@ -267,7 +272,8 @@ lpfc_nvme_handle_lsreq(struct lpfc_hba *phba, · 168 unmodified lines | |||
| 267 | return -EINVAL; | 272 | return -EINVAL; |
| 268 | 273 | ||
| 269 | remoteport = lpfc_rport->remoteport; | 274 | remoteport = lpfc_rport->remoteport; |
| 270 | if (!vport->localport) | 275 | if (!vport->localport || |
| 276 | vport->phba->hba_flag & HBA_IOQ_FLUSH) | ||
| 271 | return -EINVAL; | 277 | return -EINVAL; |
| 272 | 278 | ||
| 273 | lport = vport->localport->private; | 279 | lport = vport->localport->private; |
| @@ -559,6 +565,8 @@ __lpfc_nvme_ls_req(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, · 285 unmodified lines | |||
| 559 | ndlp->nlp_DID, ntype, nstate); | 565 | ndlp->nlp_DID, ntype, nstate); |
| 560 | return -ENODEV; | 566 | return -ENODEV; |
| 561 | } | 567 | } |
| 568 | if (vport->phba->hba_flag & HBA_IOQ_FLUSH) | ||
| 569 | return -ENODEV; | ||
| 562 | 570 | ||
| 563 | if (!vport->phba->sli4_hba.nvmels_wq) | 571 | if (!vport->phba->sli4_hba.nvmels_wq) |
| 564 | return -ENOMEM; | 572 | return -ENOMEM; |
| @@ -662,7 +670,8 @@ lpfc_nvme_ls_req(struct nvme_fc_local_port *pnvme_lport, · 97 unmodified lines | |||
| 662 | return -EINVAL; | 670 | return -EINVAL; |
| 663 | 671 | ||
| 664 | vport = lport->vport; | 672 | vport = lport->vport; |
| 665 | if (vport->load_flag & FC_UNLOADING) | 673 | if (vport->load_flag & FC_UNLOADING || |
| 674 | vport->phba->hba_flag & HBA_IOQ_FLUSH) | ||
| 666 | return -ENODEV; | 675 | return -ENODEV; |
| 667 | 676 | ||
| 668 | atomic_inc(&lport->fc4NvmeLsRequests); | 677 | atomic_inc(&lport->fc4NvmeLsRequests); |
| @@ -1516,7 +1525,8 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport, · 847 unmodified lines | |||
| 1516 | 1525 | ||
| 1517 | phba = vport->phba; | 1526 | phba = vport->phba; |
| 1518 | 1527 | ||
| 1519 | if (unlikely(vport->load_flag & FC_UNLOADING)) { | 1528 | if ((unlikely(vport->load_flag & FC_UNLOADING)) || |
| 1529 | phba->hba_flag & HBA_IOQ_FLUSH) { | ||
| 1520 | lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR, | 1530 | lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_IOERR, |
| 1521 | "6124 Fail IO, Driver unload\n"); | 1531 | "6124 Fail IO, Driver unload\n"); |
| 1522 | atomic_inc(&lport->xmt_fcp_err); | 1532 | atomic_inc(&lport->xmt_fcp_err); |
| @@ -2169,8 +2179,7 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, · 646 unmodified lines | |||
| 2169 | abts_nvme = 0; | 2179 | abts_nvme = 0; |
| 2170 | for (i = 0; i < phba->cfg_hdw_queue; i++) { | 2180 | for (i = 0; i < phba->cfg_hdw_queue; i++) { |
| 2171 | qp = &phba->sli4_hba.hdwq[i]; | 2181 | qp = &phba->sli4_hba.hdwq[i]; |
| 2172 | if (!vport || !vport->localport || | 2182 | if (!vport->localport || !qp || !qp->io_wq) |
| 2173 | !qp || !qp->io_wq) | ||
| 2174 | return; | 2183 | return; |
| 2175 | 2184 | ||
| 2176 | pring = qp->io_wq->pring; | 2185 | pring = qp->io_wq->pring; |
| @@ -2180,8 +2189,9 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, · 3 unmodified lines | |||
| 2180 | abts_scsi += qp->abts_scsi_io_bufs; | 2189 | abts_scsi += qp->abts_scsi_io_bufs; |
| 2181 | abts_nvme += qp->abts_nvme_io_bufs; | 2190 | abts_nvme += qp->abts_nvme_io_bufs; |
| 2182 | } | 2191 | } |
| 2183 | if (!vport || !vport->localport || | 2192 | if (!vport->localport || |
| 2184 | vport->phba->hba_flag & HBA_PCI_ERR) | 2193 | test_bit(HBA_PCI_ERR, &vport->phba->bit_flags) || |
| 2194 | vport->load_flag & FC_UNLOADING) | ||
| 2185 | return; | 2195 | return; |
| 2186 | 2196 | ||
| 2187 | lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, | 2197 | lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, |
| @@ -2541,8 +2551,7 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 353 unmodified lines | |||
| 2541 | * return values is ignored. The upcall is a courtesy to the | 2551 | * return values is ignored. The upcall is a courtesy to the |
| 2542 | * transport. | 2552 | * transport. |
| 2543 | */ | 2553 | */ |
| 2544 | if (vport->load_flag & FC_UNLOADING || | 2554 | if (vport->load_flag & FC_UNLOADING) |
| 2545 | unlikely(vport->phba->hba_flag & HBA_PCI_ERR)) | ||
| 2546 | (void)nvme_fc_set_remoteport_devloss(remoteport, 0); | 2555 | (void)nvme_fc_set_remoteport_devloss(remoteport, 0); |
| 2547 | 2556 | ||
| 2548 | ret = nvme_fc_unregister_remoteport(remoteport); | 2557 | ret = nvme_fc_unregister_remoteport(remoteport); |
| @@ -5929,13 +5929,15 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) · 5928 unmodified lines | |||
| 5929 | } | 5929 | } |
| 5930 | 5930 | ||
| 5931 | lpfc_cmd->waitq = &waitq; | 5931 | lpfc_cmd->waitq = &waitq; |
| 5932 | if (phba->sli_rev == LPFC_SLI_REV4) | 5932 | if (phba->sli_rev == LPFC_SLI_REV4) { |
| 5933 | spin_unlock(&pring_s4->ring_lock); | 5933 | spin_unlock(&pring_s4->ring_lock); |
| 5934 | else | 5934 | ret_val = lpfc_sli4_issue_abort_iotag(phba, iocb, |
| 5935 | lpfc_sli_abort_fcp_cmpl); | ||
| 5936 | } else { | ||
| 5935 | pring = &phba->sli.sli3_ring[LPFC_FCP_RING]; | 5937 | pring = &phba->sli.sli3_ring[LPFC_FCP_RING]; |
| 5936 | 5938 | ret_val = lpfc_sli_issue_abort_iotag(phba, pring, iocb, | |
| 5937 | ret_val = lpfc_sli_issue_abort_iotag(phba, pring, iocb, | 5939 | lpfc_sli_abort_fcp_cmpl); |
| 5938 | lpfc_sli_abort_fcp_cmpl); | 5940 | } |
| 5939 | 5941 | ||
| 5940 | /* Make sure HBA is alive */ | 5942 | /* Make sure HBA is alive */ |
| 5941 | lpfc_issue_hb_tmo(phba); | 5943 | lpfc_issue_hb_tmo(phba); |
| @@ -2828,6 +2828,12 @@ __lpfc_sli_rpi_release(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 2827 unmodified lines | |||
| 2828 | ndlp->nlp_flag &= ~NLP_UNREG_INP; | 2828 | ndlp->nlp_flag &= ~NLP_UNREG_INP; |
| 2829 | } | 2829 | } |
| 2830 | 2830 | ||
| 2831 | void | ||
| 2832 | lpfc_sli_rpi_release(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) | ||
| 2833 | { | ||
| 2834 | __lpfc_sli_rpi_release(vport, ndlp); | ||
| 2835 | } | ||
| 2836 | |||
| 2831 | /** | 2837 | /** |
| 2832 | * lpfc_sli_def_mbox_cmpl - Default mailbox completion handler | 2838 | * lpfc_sli_def_mbox_cmpl - Default mailbox completion handler |
| 2833 | * @phba: Pointer to HBA context object. | 2839 | * @phba: Pointer to HBA context object. |
| @@ -3715,7 +3721,15 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, · 881 unmodified lines | |||
| 3715 | unsigned long iflag; | 3721 | unsigned long iflag; |
| 3716 | u32 ulp_command, ulp_status, ulp_word4, ulp_context, iotag; | 3722 | u32 ulp_command, ulp_status, ulp_word4, ulp_context, iotag; |
| 3717 | 3723 | ||
| 3724 | if (phba->sli_rev == LPFC_SLI_REV4) | ||
| 3725 | spin_lock_irqsave(&pring->ring_lock, iflag); | ||
| 3726 | else | ||
| 3727 | spin_lock_irqsave(&phba->hbalock, iflag); | ||
| 3718 | cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq); | 3728 | cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq); |
| 3729 | if (phba->sli_rev == LPFC_SLI_REV4) | ||
| 3730 | spin_unlock_irqrestore(&pring->ring_lock, iflag); | ||
| 3731 | else | ||
| 3732 | spin_unlock_irqrestore(&phba->hbalock, iflag); | ||
| 3719 | 3733 | ||
| 3720 | ulp_command = get_job_cmnd(phba, saveq); | 3734 | ulp_command = get_job_cmnd(phba, saveq); |
| 3721 | ulp_status = get_job_ulpstatus(phba, saveq); | 3735 | ulp_status = get_job_ulpstatus(phba, saveq); |
| @@ -4052,10 +4066,8 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, · 330 unmodified lines | |||
| 4052 | break; | 4066 | break; |
| 4053 | } | 4067 | } |
| 4054 | 4068 | ||
| 4055 | spin_unlock_irqrestore(&phba->hbalock, iflag); | ||
| 4056 | cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring, | 4069 | cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring, |
| 4057 | &rspiocbq); | 4070 | &rspiocbq); |
| 4058 | spin_lock_irqsave(&phba->hbalock, iflag); | ||
| 4059 | if (unlikely(!cmdiocbq)) | 4071 | if (unlikely(!cmdiocbq)) |
| 4060 | break; | 4072 | break; |
| 4061 | if (cmdiocbq->cmd_flag & LPFC_DRIVER_ABORTED) | 4073 | if (cmdiocbq->cmd_flag & LPFC_DRIVER_ABORTED) |
| @@ -4536,42 +4548,62 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *phba, · 474 unmodified lines | |||
| 4536 | void | 4548 | void |
| 4537 | lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | 4549 | lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) |
| 4538 | { | 4550 | { |
| 4539 | LIST_HEAD(completions); | 4551 | LIST_HEAD(tx_completions); |
| 4552 | LIST_HEAD(txcmplq_completions); | ||
| 4540 | struct lpfc_iocbq *iocb, *next_iocb; | 4553 | struct lpfc_iocbq *iocb, *next_iocb; |
| 4554 | int offline; | ||
| 4541 | 4555 | ||
| 4542 | if (pring->ringno == LPFC_ELS_RING) { | 4556 | if (pring->ringno == LPFC_ELS_RING) { |
| 4543 | lpfc_fabric_abort_hba(phba); | 4557 | lpfc_fabric_abort_hba(phba); |
| 4544 | } | 4558 | } |
| 4559 | offline = pci_channel_offline(phba->pcidev); | ||
| 4545 | 4560 | ||
| 4546 | /* Error everything on txq and txcmplq | 4561 | /* Error everything on txq and txcmplq |
| 4547 | * First do the txq. | 4562 | * First do the txq. |
| 4548 | */ | 4563 | */ |
| 4549 | if (phba->sli_rev >= LPFC_SLI_REV4) { | 4564 | if (phba->sli_rev >= LPFC_SLI_REV4) { |
| 4550 | spin_lock_irq(&pring->ring_lock); | 4565 | spin_lock_irq(&pring->ring_lock); |
| 4551 | list_splice_init(&pring->txq, &completions); | 4566 | list_splice_init(&pring->txq, &tx_completions); |
| 4552 | pring->txq_cnt = 0; | 4567 | pring->txq_cnt = 0; |
| 4553 | spin_unlock_irq(&pring->ring_lock); | ||
| 4554 | 4568 | ||
| 4555 | spin_lock_irq(&phba->hbalock); | 4569 | if (offline) { |
| 4556 | /* Next issue ABTS for everything on the txcmplq */ | 4570 | list_splice_init(&pring->txcmplq, |
| 4557 | list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) | 4571 | &txcmplq_completions); |
| 4558 | lpfc_sli_issue_abort_iotag(phba, pring, iocb, NULL); | 4572 | } else { |
| 4559 | spin_unlock_irq(&phba->hbalock); | 4573 | /* Next issue ABTS for everything on the txcmplq */ |
| 4574 | list_for_each_entry_safe(iocb, next_iocb, | ||
| 4575 | &pring->txcmplq, list) | ||
| 4576 | lpfc_sli_issue_abort_iotag(phba, pring, | ||
| 4577 | iocb, NULL); | ||
| 4578 | } | ||
| 4579 | spin_unlock_irq(&pring->ring_lock); | ||
| 4560 | } else { | 4580 | } else { |
| 4561 | spin_lock_irq(&phba->hbalock); | 4581 | spin_lock_irq(&phba->hbalock); |
| 4562 | list_splice_init(&pring->txq, &completions); | 4582 | list_splice_init(&pring->txq, &tx_completions); |
| 4563 | pring->txq_cnt = 0; | 4583 | pring->txq_cnt = 0; |
| 4564 | 4584 | ||
| 4565 | /* Next issue ABTS for everything on the txcmplq */ | 4585 | if (offline) { |
| 4566 | list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) | 4586 | list_splice_init(&pring->txcmplq, &txcmplq_completions); |
| 4567 | lpfc_sli_issue_abort_iotag(phba, pring, iocb, NULL); | 4587 | } else { |
| 4588 | /* Next issue ABTS for everything on the txcmplq */ | ||
| 4589 | list_for_each_entry_safe(iocb, next_iocb, | ||
| 4590 | &pring->txcmplq, list) | ||
| 4591 | lpfc_sli_issue_abort_iotag(phba, pring, | ||
| 4592 | iocb, NULL); | ||
| 4593 | } | ||
| 4568 | spin_unlock_irq(&phba->hbalock); | 4594 | spin_unlock_irq(&phba->hbalock); |
| 4569 | } | 4595 | } |
| 4570 | /* Make sure HBA is alive */ | ||
| 4571 | lpfc_issue_hb_tmo(phba); | ||
| 4572 | 4596 | ||
| 4597 | if (offline) { | ||
| 4598 | /* Cancel all the IOCBs from the completions list */ | ||
| 4599 | lpfc_sli_cancel_iocbs(phba, &txcmplq_completions, | ||
| 4600 | IOSTAT_LOCAL_REJECT, IOERR_SLI_ABORTED); | ||
| 4601 | } else { | ||
| 4602 | /* Make sure HBA is alive */ | ||
| 4603 | lpfc_issue_hb_tmo(phba); | ||
| 4604 | } | ||
| 4573 | /* Cancel all the IOCBs from the completions list */ | 4605 | /* Cancel all the IOCBs from the completions list */ |
| 4574 | lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, | 4606 | lpfc_sli_cancel_iocbs(phba, &tx_completions, IOSTAT_LOCAL_REJECT, |
| 4575 | IOERR_SLI_ABORTED); | 4607 | IOERR_SLI_ABORTED); |
| 4576 | } | 4608 | } |
| 4577 | 4609 | ||
| @@ -4624,11 +4656,6 @@ lpfc_sli_flush_io_rings(struct lpfc_hba *phba) · 46 unmodified lines | |||
| 4624 | struct lpfc_iocbq *piocb, *next_iocb; | 4656 | struct lpfc_iocbq *piocb, *next_iocb; |
| 4625 | 4657 | ||
| 4626 | spin_lock_irq(&phba->hbalock); | 4658 | spin_lock_irq(&phba->hbalock); |
| 4627 | if (phba->hba_flag & HBA_IOQ_FLUSH || | ||
| 4628 | !phba->sli4_hba.hdwq) { | ||
| 4629 | spin_unlock_irq(&phba->hbalock); | ||
| 4630 | return; | ||
| 4631 | } | ||
| 4632 | /* Indicate the I/O queues are flushed */ | 4659 | /* Indicate the I/O queues are flushed */ |
| 4633 | phba->hba_flag |= HBA_IOQ_FLUSH; | 4660 | phba->hba_flag |= HBA_IOQ_FLUSH; |
| 4634 | spin_unlock_irq(&phba->hbalock); | 4661 | spin_unlock_irq(&phba->hbalock); |
| @@ -10997,6 +11024,10 @@ lpfc_sli_issue_iocb(struct lpfc_hba *phba, uint32_t ring_number, · 6362 unmodified lines | |||
| 10997 | unsigned long iflags; | 11024 | unsigned long iflags; |
| 10998 | int rc; | 11025 | int rc; |
| 10999 | 11026 | ||
| 11027 | /* If the PCI channel is in offline state, do not post iocbs. */ | ||
| 11028 | if (unlikely(pci_channel_offline(phba->pcidev))) | ||
| 11029 | return IOCB_ERROR; | ||
| 11030 | |||
| 11000 | if (phba->sli_rev == LPFC_SLI_REV4) { | 11031 | if (phba->sli_rev == LPFC_SLI_REV4) { |
| 11001 | lpfc_sli_prep_wqe(phba, piocb); | 11032 | lpfc_sli_prep_wqe(phba, piocb); |
| 11002 | 11033 | ||
| @@ -20,7 +20,7 @@ · 19 unmodified lines | |||
| 20 | * included with this package. * | 20 | * included with this package. * |
| 21 | *******************************************************************/ | 21 | *******************************************************************/ |
| 22 | 22 | ||
| 23 | #define LPFC_DRIVER_VERSION "14.2.0.0" | 23 | #define LPFC_DRIVER_VERSION "14.2.0.1" |
| 24 | #define LPFC_DRIVER_NAME "lpfc" | 24 | #define LPFC_DRIVER_NAME "lpfc" |
| 25 | 25 | ||
| 26 | /* Used for SLI 2/3 */ | 26 | /* Used for SLI 2/3 */ |
| @@ -2560,6 +2560,9 @@ struct megasas_instance_template { · 2559 unmodified lines | |||
| 2560 | #define MEGASAS_IS_LOGICAL(sdev) \ | 2560 | #define MEGASAS_IS_LOGICAL(sdev) \ |
| 2561 | ((sdev->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1) | 2561 | ((sdev->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1) |
| 2562 | 2562 | ||
| 2563 | #define MEGASAS_IS_LUN_VALID(sdev) \ | ||
| 2564 | (((sdev)->lun == 0) ? 1 : 0) | ||
| 2565 | |||
| 2563 | #define MEGASAS_DEV_INDEX(scp) \ | 2566 | #define MEGASAS_DEV_INDEX(scp) \ |
| 2564 | (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ | 2567 | (((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \ |
| 2565 | scp->device->id) | 2568 | scp->device->id) |
| @@ -2126,6 +2126,9 @@ static int megasas_slave_alloc(struct scsi_device *sdev) · 2125 unmodified lines | |||
| 2126 | goto scan_target; | 2126 | goto scan_target; |
| 2127 | } | 2127 | } |
| 2128 | return -ENXIO; | 2128 | return -ENXIO; |
| 2129 | } else if (!MEGASAS_IS_LUN_VALID(sdev)) { | ||
| 2130 | sdev_printk(KERN_INFO, sdev, "%s: invalid LUN\n", __func__); | ||
| 2131 | return -ENXIO; | ||
| 2129 | } | 2132 | } |
| 2130 | 2133 | ||
| 2131 | scan_target: | 2134 | scan_target: |
| @@ -2156,6 +2159,10 @@ static void megasas_slave_destroy(struct scsi_device *sdev) · 24 unmodified lines | |||
| 2156 | instance = megasas_lookup_instance(sdev->host->host_no); | 2159 | instance = megasas_lookup_instance(sdev->host->host_no); |
| 2157 | 2160 | ||
| 2158 | if (MEGASAS_IS_LOGICAL(sdev)) { | 2161 | if (MEGASAS_IS_LOGICAL(sdev)) { |
| 2162 | if (!MEGASAS_IS_LUN_VALID(sdev)) { | ||
| 2163 | sdev_printk(KERN_INFO, sdev, "%s: invalid LUN\n", __func__); | ||
| 2164 | return; | ||
| 2165 | } | ||
| 2159 | ld_tgt_id = MEGASAS_TARGET_ID(sdev); | 2166 | ld_tgt_id = MEGASAS_TARGET_ID(sdev); |
| 2160 | instance->ld_tgtid_status[ld_tgt_id] = LD_TARGET_ID_DELETED; | 2167 | instance->ld_tgtid_status[ld_tgt_id] = LD_TARGET_ID_DELETED; |
| 2161 | if (megasas_dbg_lvl & LD_PD_DEBUG) | 2168 | if (megasas_dbg_lvl & LD_PD_DEBUG) |
| @@ -5716,13 +5716,12 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) · 5715 unmodified lines | |||
| 5716 | /** | 5716 | /** |
| 5717 | * mpt3sas_check_same_4gb_region - checks whether all reply queues in a set are | 5717 | * mpt3sas_check_same_4gb_region - checks whether all reply queues in a set are |
| 5718 | * having same upper 32bits in their base memory address. | 5718 | * having same upper 32bits in their base memory address. |
| 5719 | * @reply_pool_start_address: Base address of a reply queue set | 5719 | * @start_address: Base address of a reply queue set |
| 5720 | * @pool_sz: Size of single Reply Descriptor Post Queues pool size | 5720 | * @pool_sz: Size of single Reply Descriptor Post Queues pool size |
| 5721 | * | 5721 | * |
| 5722 | * Return: 1 if reply queues in a set have a same upper 32bits in their base | 5722 | * Return: 1 if reply queues in a set have a same upper 32bits in their base |
| 5723 | * memory address, else 0. | 5723 | * memory address, else 0. |
| 5724 | */ | 5724 | */ |
| 5725 | |||
| 5726 | static int | 5725 | static int |
| 5727 | mpt3sas_check_same_4gb_region(dma_addr_t start_address, u32 pool_sz) | 5726 | mpt3sas_check_same_4gb_region(dma_addr_t start_address, u32 pool_sz) |
| 5728 | { | 5727 | { |
| @@ -394,10 +394,13 @@ _config_request(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigRequest_t · 393 unmodified lines | |||
| 394 | retry_count++; | 394 | retry_count++; |
| 395 | if (ioc->config_cmds.smid == smid) | 395 | if (ioc->config_cmds.smid == smid) |
| 396 | mpt3sas_base_free_smid(ioc, smid); | 396 | mpt3sas_base_free_smid(ioc, smid); |
| 397 | if ((ioc->shost_recovery) || (ioc->config_cmds.status & | 397 | if (ioc->config_cmds.status & MPT3_CMD_RESET) |
| 398 | MPT3_CMD_RESET) || ioc->pci_error_recovery) | ||
| 399 | goto retry_config; | 398 | goto retry_config; |
| 400 | issue_host_reset = 1; | 399 | if (ioc->shost_recovery || ioc->pci_error_recovery) { |
| 400 | issue_host_reset = 0; | ||
| 401 | r = -EFAULT; | ||
| 402 | } else | ||
| 403 | issue_host_reset = 1; | ||
| 401 | goto free_mem; | 404 | goto free_mem; |
| 402 | } | 405 | } |
| 403 | 406 | ||
| @@ -11035,6 +11035,7 @@ _scsih_expander_node_remove(struct MPT3SAS_ADAPTER *ioc, · 11034 unmodified lines | |||
| 11035 | { | 11035 | { |
| 11036 | struct _sas_port *mpt3sas_port, *next; | 11036 | struct _sas_port *mpt3sas_port, *next; |
| 11037 | unsigned long flags; | 11037 | unsigned long flags; |
| 11038 | int port_id; | ||
| 11038 | 11039 | ||
| 11039 | /* remove sibling ports attached to this expander */ | 11040 | /* remove sibling ports attached to this expander */ |
| 11040 | list_for_each_entry_safe(mpt3sas_port, next, | 11041 | list_for_each_entry_safe(mpt3sas_port, next, |
| @@ -11055,6 +11056,8 @@ _scsih_expander_node_remove(struct MPT3SAS_ADAPTER *ioc, · 14 unmodified lines | |||
| 11055 | mpt3sas_port->hba_port); | 11056 | mpt3sas_port->hba_port); |
| 11056 | } | 11057 | } |
| 11057 | 11058 | ||
| 11059 | port_id = sas_expander->port->port_id; | ||
| 11060 | |||
| 11058 | mpt3sas_transport_port_remove(ioc, sas_expander->sas_address, | 11061 | mpt3sas_transport_port_remove(ioc, sas_expander->sas_address, |
| 11059 | sas_expander->sas_address_parent, sas_expander->port); | 11062 | sas_expander->sas_address_parent, sas_expander->port); |
| 11060 | 11063 | ||
| @@ -11062,7 +11065,7 @@ _scsih_expander_node_remove(struct MPT3SAS_ADAPTER *ioc, · 1 unmodified line | |||
| 11062 | "expander_remove: handle(0x%04x), sas_addr(0x%016llx), port:%d\n", | 11065 | "expander_remove: handle(0x%04x), sas_addr(0x%016llx), port:%d\n", |
| 11063 | sas_expander->handle, (unsigned long long) | 11066 | sas_expander->handle, (unsigned long long) |
| 11064 | sas_expander->sas_address, | 11067 | sas_expander->sas_address, |
| 11065 | sas_expander->port->port_id); | 11068 | port_id); |
| 11066 | 11069 | ||
| 11067 | spin_lock_irqsave(&ioc->sas_node_lock, flags); | 11070 | spin_lock_irqsave(&ioc->sas_node_lock, flags); |
| 11068 | list_del(&sas_expander->list); | 11071 | list_del(&sas_expander->list); |
| @@ -647,6 +647,7 @@ static struct pci_device_id mvs_pci_table[] = { · 646 unmodified lines | |||
| 647 | { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1300), chip_1300 }, | 647 | { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1300), chip_1300 }, |
| 648 | { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1320), chip_1320 }, | 648 | { PCI_VDEVICE(ARECA, PCI_DEVICE_ID_ARECA_1320), chip_1320 }, |
| 649 | { PCI_VDEVICE(ADAPTEC2, 0x0450), chip_6440 }, | 649 | { PCI_VDEVICE(ADAPTEC2, 0x0450), chip_6440 }, |
| 650 | { PCI_VDEVICE(TTI, 0x2640), chip_6440 }, | ||
| 650 | { PCI_VDEVICE(TTI, 0x2710), chip_9480 }, | 651 | { PCI_VDEVICE(TTI, 0x2710), chip_9480 }, |
| 651 | { PCI_VDEVICE(TTI, 0x2720), chip_9480 }, | 652 | { PCI_VDEVICE(TTI, 0x2720), chip_9480 }, |
| 652 | { PCI_VDEVICE(TTI, 0x2721), chip_9480 }, | 653 | { PCI_VDEVICE(TTI, 0x2721), chip_9480 }, |
| @@ -192,10 +192,11 @@ struct sym53c500_data { · 191 unmodified lines | |||
| 192 | int fast_pio; | 192 | int fast_pio; |
| 193 | }; | 193 | }; |
| 194 | 194 | ||
| 195 | static struct scsi_pointer *sym53c500_scsi_pointer(struct scsi_cmnd *cmd) | 195 | struct sym53c500_cmd_priv { |
| 196 | { | 196 | int status; |
| 197 | return scsi_cmd_priv(cmd); | 197 | int message; |
| 198 | } | 198 | int phase; |
| 199 | }; | ||
| 199 | 200 | ||
| 200 | enum Phase { | 201 | enum Phase { |
| 201 | idle, | 202 | idle, |
| @@ -356,7 +357,7 @@ SYM53C500_intr(int irq, void *dev_id) · 154 unmodified lines | |||
| 356 | struct sym53c500_data *data = | 357 | struct sym53c500_data *data = |
| 357 | (struct sym53c500_data *)dev->hostdata; | 358 | (struct sym53c500_data *)dev->hostdata; |
| 358 | struct scsi_cmnd *curSC = data->current_SC; | 359 | struct scsi_cmnd *curSC = data->current_SC; |
| 359 | struct scsi_pointer *scsi_pointer = sym53c500_scsi_pointer(curSC); | 360 | struct sym53c500_cmd_priv *scp = scsi_cmd_priv(curSC); |
| 360 | int fast_pio = data->fast_pio; | 361 | int fast_pio = data->fast_pio; |
| 361 | 362 | ||
| 362 | spin_lock_irqsave(dev->host_lock, flags); | 363 | spin_lock_irqsave(dev->host_lock, flags); |
| @@ -403,12 +404,11 @@ SYM53C500_intr(int irq, void *dev_id) · 40 unmodified lines | |||
| 403 | 404 | ||
| 404 | if (int_reg & 0x20) { /* Disconnect */ | 405 | if (int_reg & 0x20) { /* Disconnect */ |
| 405 | DEB(printk("SYM53C500: disconnect intr received\n")); | 406 | DEB(printk("SYM53C500: disconnect intr received\n")); |
| 406 | if (scsi_pointer->phase != message_in) { /* Unexpected disconnect */ | 407 | if (scp->phase != message_in) { /* Unexpected disconnect */ |
| 407 | curSC->result = DID_NO_CONNECT << 16; | 408 | curSC->result = DID_NO_CONNECT << 16; |
| 408 | } else { /* Command complete, return status and message */ | 409 | } else { /* Command complete, return status and message */ |
| 409 | curSC->result = (scsi_pointer->Status & 0xff) | | 410 | curSC->result = (scp->status & 0xff) | |
| 410 | ((scsi_pointer->Message & 0xff) << 8) | | 411 | ((scp->message & 0xff) << 8) | (DID_OK << 16); |
| 411 | (DID_OK << 16); | ||
| 412 | } | 412 | } |
| 413 | goto idle_out; | 413 | goto idle_out; |
| 414 | } | 414 | } |
| @@ -419,7 +419,7 @@ SYM53C500_intr(int irq, void *dev_id) · 4 unmodified lines | |||
| 419 | struct scatterlist *sg; | 419 | struct scatterlist *sg; |
| 420 | int i; | 420 | int i; |
| 421 | 421 | ||
| 422 | scsi_pointer->phase = data_out; | 422 | scp->phase = data_out; |
| 423 | VDEB(printk("SYM53C500: Data-Out phase\n")); | 423 | VDEB(printk("SYM53C500: Data-Out phase\n")); |
| 424 | outb(FLUSH_FIFO, port_base + CMD_REG); | 424 | outb(FLUSH_FIFO, port_base + CMD_REG); |
| 425 | LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */ | 425 | LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */ |
| @@ -438,7 +438,7 @@ SYM53C500_intr(int irq, void *dev_id) · 12 unmodified lines | |||
| 438 | struct scatterlist *sg; | 438 | struct scatterlist *sg; |
| 439 | int i; | 439 | int i; |
| 440 | 440 | ||
| 441 | scsi_pointer->phase = data_in; | 441 | scp->phase = data_in; |
| 442 | VDEB(printk("SYM53C500: Data-In phase\n")); | 442 | VDEB(printk("SYM53C500: Data-In phase\n")); |
| 443 | outb(FLUSH_FIFO, port_base + CMD_REG); | 443 | outb(FLUSH_FIFO, port_base + CMD_REG); |
| 444 | LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */ | 444 | LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */ |
| @@ -453,12 +453,12 @@ SYM53C500_intr(int irq, void *dev_id) · 8 unmodified lines | |||
| 453 | break; | 453 | break; |
| 454 | 454 | ||
| 455 | case 0x02: /* COMMAND */ | 455 | case 0x02: /* COMMAND */ |
| 456 | scsi_pointer->phase = command_ph; | 456 | scp->phase = command_ph; |
| 457 | printk("SYM53C500: Warning: Unknown interrupt occurred in command phase!\n"); | 457 | printk("SYM53C500: Warning: Unknown interrupt occurred in command phase!\n"); |
| 458 | break; | 458 | break; |
| 459 | 459 | ||
| 460 | case 0x03: /* STATUS */ | 460 | case 0x03: /* STATUS */ |
| 461 | scsi_pointer->phase = status_ph; | 461 | scp->phase = status_ph; |
| 462 | VDEB(printk("SYM53C500: Status phase\n")); | 462 | VDEB(printk("SYM53C500: Status phase\n")); |
| 463 | outb(FLUSH_FIFO, port_base + CMD_REG); | 463 | outb(FLUSH_FIFO, port_base + CMD_REG); |
| 464 | outb(INIT_CMD_COMPLETE, port_base + CMD_REG); | 464 | outb(INIT_CMD_COMPLETE, port_base + CMD_REG); |
| @@ -471,24 +471,22 @@ SYM53C500_intr(int irq, void *dev_id) · 6 unmodified lines | |||
| 471 | 471 | ||
| 472 | case 0x06: /* MESSAGE-OUT */ | 472 | case 0x06: /* MESSAGE-OUT */ |
| 473 | DEB(printk("SYM53C500: Message-Out phase\n")); | 473 | DEB(printk("SYM53C500: Message-Out phase\n")); |
| 474 | scsi_pointer->phase = message_out; | 474 | scp->phase = message_out; |
| 475 | outb(SET_ATN, port_base + CMD_REG); /* Reject the message */ | 475 | outb(SET_ATN, port_base + CMD_REG); /* Reject the message */ |
| 476 | outb(MSG_ACCEPT, port_base + CMD_REG); | 476 | outb(MSG_ACCEPT, port_base + CMD_REG); |
| 477 | break; | 477 | break; |
| 478 | 478 | ||
| 479 | case 0x07: /* MESSAGE-IN */ | 479 | case 0x07: /* MESSAGE-IN */ |
| 480 | VDEB(printk("SYM53C500: Message-In phase\n")); | 480 | VDEB(printk("SYM53C500: Message-In phase\n")); |
| 481 | scsi_pointer->phase = message_in; | 481 | scp->phase = message_in; |
| 482 | 482 | ||
| 483 | scsi_pointer->Status = inb(port_base + SCSI_FIFO); | 483 | scp->status = inb(port_base + SCSI_FIFO); |
| 484 | scsi_pointer->Message = inb(port_base + SCSI_FIFO); | 484 | scp->message = inb(port_base + SCSI_FIFO); |
| 485 | 485 | ||
| 486 | VDEB(printk("SCSI FIFO size=%d\n", inb(port_base + FIFO_FLAGS) & 0x1f)); | 486 | VDEB(printk("SCSI FIFO size=%d\n", inb(port_base + FIFO_FLAGS) & 0x1f)); |
| 487 | DEB(printk("Status = %02x Message = %02x\n", | 487 | DEB(printk("Status = %02x Message = %02x\n", scp->status, scp->message)); |
| 488 | scsi_pointer->Status, scsi_pointer->Message)); | ||
| 489 | 488 | ||
| 490 | if (scsi_pointer->Message == SAVE_POINTERS || | 489 | if (scp->message == SAVE_POINTERS || scp->message == DISCONNECT) { |
| 491 | scsi_pointer->Message == DISCONNECT) { | ||
| 492 | outb(SET_ATN, port_base + CMD_REG); /* Reject message */ | 490 | outb(SET_ATN, port_base + CMD_REG); /* Reject message */ |
| 493 | DEB(printk("Discarding SAVE_POINTERS message\n")); | 491 | DEB(printk("Discarding SAVE_POINTERS message\n")); |
| 494 | } | 492 | } |
| @@ -500,7 +498,7 @@ out: · 5 unmodified lines | |||
| 500 | return IRQ_HANDLED; | 498 | return IRQ_HANDLED; |
| 501 | 499 | ||
| 502 | idle_out: | 500 | idle_out: |
| 503 | scsi_pointer->phase = idle; | 501 | scp->phase = idle; |
| 504 | scsi_done(curSC); | 502 | scsi_done(curSC); |
| 505 | goto out; | 503 | goto out; |
| 506 | } | 504 | } |
| @@ -548,7 +546,7 @@ SYM53C500_info(struct Scsi_Host *SChost) · 41 unmodified lines | |||
| 548 | 546 | ||
| 549 | static int SYM53C500_queue_lck(struct scsi_cmnd *SCpnt) | 547 | static int SYM53C500_queue_lck(struct scsi_cmnd *SCpnt) |
| 550 | { | 548 | { |
| 551 | struct scsi_pointer *scsi_pointer = sym53c500_scsi_pointer(SCpnt); | 549 | struct sym53c500_cmd_priv *scp = scsi_cmd_priv(SCpnt); |
| 552 | int i; | 550 | int i; |
| 553 | int port_base = SCpnt->device->host->io_port; | 551 | int port_base = SCpnt->device->host->io_port; |
| 554 | struct sym53c500_data *data = | 552 | struct sym53c500_data *data = |
| @@ -565,9 +563,9 @@ static int SYM53C500_queue_lck(struct scsi_cmnd *SCpnt) · 10 unmodified lines | |||
| 565 | VDEB(printk("\n")); | 563 | VDEB(printk("\n")); |
| 566 | 564 | ||
| 567 | data->current_SC = SCpnt; | 565 | data->current_SC = SCpnt; |
| 568 | scsi_pointer->phase = command_ph; | 566 | scp->phase = command_ph; |
| 569 | scsi_pointer->Status = 0; | 567 | scp->status = 0; |
| 570 | scsi_pointer->Message = 0; | 568 | scp->message = 0; |
| 571 | 569 | ||
| 572 | /* We are locked here already by the mid layer */ | 570 | /* We are locked here already by the mid layer */ |
| 573 | REG0(port_base); | 571 | REG0(port_base); |
| @@ -682,7 +680,7 @@ static struct scsi_host_template sym53c500_driver_template = { · 108 unmodified lines | |||
| 682 | .this_id = 7, | 680 | .this_id = 7, |
| 683 | .sg_tablesize = 32, | 681 | .sg_tablesize = 32, |
| 684 | .shost_groups = SYM53C500_shost_groups, | 682 | .shost_groups = SYM53C500_shost_groups, |
| 685 | .cmd_size = sizeof(struct scsi_pointer), | 683 | .cmd_size = sizeof(struct sym53c500_cmd_priv), |
| 686 | }; | 684 | }; |
| 687 | 685 | ||
| 688 | static int SYM53C500_config_check(struct pcmcia_device *p_dev, void *priv_data) | 686 | static int SYM53C500_config_check(struct pcmcia_device *p_dev, void *priv_data) |
| @@ -3181,124 +3181,6 @@ static int pmcraid_build_ioadl( · 3180 unmodified lines | |||
| 3181 | return 0; | 3181 | return 0; |
| 3182 | } | 3182 | } |
| 3183 | 3183 | ||
| 3184 | /** | ||
| 3185 | * pmcraid_free_sglist - Frees an allocated SG buffer list | ||
| 3186 | * @sglist: scatter/gather list pointer | ||
| 3187 | * | ||
| 3188 | * Free a DMA'able memory previously allocated with pmcraid_alloc_sglist | ||
| 3189 | * | ||
| 3190 | * Return value: | ||
| 3191 | * none | ||
| 3192 | */ | ||
| 3193 | static void pmcraid_free_sglist(struct pmcraid_sglist *sglist) | ||
| 3194 | { | ||
| 3195 | sgl_free_order(sglist->scatterlist, sglist->order); | ||
| 3196 | kfree(sglist); | ||
| 3197 | } | ||
| 3198 | |||
| 3199 | /** | ||
| 3200 | * pmcraid_alloc_sglist - Allocates memory for a SG list | ||
| 3201 | * @buflen: buffer length | ||
| 3202 | * | ||
| 3203 | * Allocates a DMA'able buffer in chunks and assembles a scatter/gather | ||
| 3204 | * list. | ||
| 3205 | * | ||
| 3206 | * Return value | ||
| 3207 | * pointer to sglist / NULL on failure | ||
| 3208 | */ | ||
| 3209 | static struct pmcraid_sglist *pmcraid_alloc_sglist(int buflen) | ||
| 3210 | { | ||
| 3211 | struct pmcraid_sglist *sglist; | ||
| 3212 | int sg_size; | ||
| 3213 | int order; | ||
| 3214 | |||
| 3215 | sg_size = buflen / (PMCRAID_MAX_IOADLS - 1); | ||
| 3216 | order = (sg_size > 0) ? get_order(sg_size) : 0; | ||
| 3217 | |||
| 3218 | /* Allocate a scatter/gather list for the DMA */ | ||
| 3219 | sglist = kzalloc(sizeof(struct pmcraid_sglist), GFP_KERNEL); | ||
| 3220 | if (sglist == NULL) | ||
| 3221 | return NULL; | ||
| 3222 | |||
| 3223 | sglist->order = order; | ||
| 3224 | sgl_alloc_order(buflen, order, false, GFP_KERNEL | __GFP_ZERO, | ||
| 3225 | &sglist->num_sg); | ||
| 3226 | |||
| 3227 | return sglist; | ||
| 3228 | } | ||
| 3229 | |||
| 3230 | /** | ||
| 3231 | * pmcraid_copy_sglist - Copy user buffer to kernel buffer's SG list | ||
| 3232 | * @sglist: scatter/gather list pointer | ||
| 3233 | * @buffer: buffer pointer | ||
| 3234 | * @len: buffer length | ||
| 3235 | * @direction: data transfer direction | ||
| 3236 | * | ||
| 3237 | * Copy a user buffer into a buffer allocated by pmcraid_alloc_sglist | ||
| 3238 | * | ||
| 3239 | * Return value: | ||
| 3240 | * 0 on success / other on failure | ||
| 3241 | */ | ||
| 3242 | static int pmcraid_copy_sglist( | ||
| 3243 | struct pmcraid_sglist *sglist, | ||
| 3244 | void __user *buffer, | ||
| 3245 | u32 len, | ||
| 3246 | int direction | ||
| 3247 | ) | ||
| 3248 | { | ||
| 3249 | struct scatterlist *sg; | ||
| 3250 | void *kaddr; | ||
| 3251 | int bsize_elem; | ||
| 3252 | int i; | ||
| 3253 | int rc = 0; | ||
| 3254 | |||
| 3255 | /* Determine the actual number of bytes per element */ | ||
| 3256 | bsize_elem = PAGE_SIZE * (1 << sglist->order); | ||
| 3257 | |||
| 3258 | sg = sglist->scatterlist; | ||
| 3259 | |||
| 3260 | for (i = 0; i < (len / bsize_elem); i++, sg = sg_next(sg), buffer += bsize_elem) { | ||
| 3261 | struct page *page = sg_page(sg); | ||
| 3262 | |||
| 3263 | kaddr = kmap(page); | ||
| 3264 | if (direction == DMA_TO_DEVICE) | ||
| 3265 | rc = copy_from_user(kaddr, buffer, bsize_elem); | ||
| 3266 | else | ||
| 3267 | rc = copy_to_user(buffer, kaddr, bsize_elem); | ||
| 3268 | |||
| 3269 | kunmap(page); | ||
| 3270 | |||
| 3271 | if (rc) { | ||
| 3272 | pmcraid_err("failed to copy user data into sg list\n"); | ||
| 3273 | return -EFAULT; | ||
| 3274 | } | ||
| 3275 | |||
| 3276 | sg->length = bsize_elem; | ||
| 3277 | } | ||
| 3278 | |||
| 3279 | if (len % bsize_elem) { | ||
| 3280 | struct page *page = sg_page(sg); | ||
| 3281 | |||
| 3282 | kaddr = kmap(page); | ||
| 3283 | |||
| 3284 | if (direction == DMA_TO_DEVICE) | ||
| 3285 | rc = copy_from_user(kaddr, buffer, len % bsize_elem); | ||
| 3286 | else | ||
| 3287 | rc = copy_to_user(buffer, kaddr, len % bsize_elem); | ||
| 3288 | |||
| 3289 | kunmap(page); | ||
| 3290 | |||
| 3291 | sg->length = len % bsize_elem; | ||
| 3292 | } | ||
| 3293 | |||
| 3294 | if (rc) { | ||
| 3295 | pmcraid_err("failed to copy user data into sg list\n"); | ||
| 3296 | rc = -EFAULT; | ||
| 3297 | } | ||
| 3298 | |||
| 3299 | return rc; | ||
| 3300 | } | ||
| 3301 | |||
| 3302 | /** | 3184 | /** |
| 3303 | * pmcraid_queuecommand_lck - Queue a mid-layer request | 3185 | * pmcraid_queuecommand_lck - Queue a mid-layer request |
| 3304 | * @scsi_cmd: scsi command struct | 3186 | * @scsi_cmd: scsi command struct |
| @@ -3454,365 +3336,6 @@ static int pmcraid_chr_fasync(int fd, struct file *filep, int mode) · 149 unmodified lines | |||
| 3454 | return rc; | 3336 | return rc; |
| 3455 | } | 3337 | } |
| 3456 | 3338 | ||
| 3457 | |||
| 3458 | /** | ||
| 3459 | * pmcraid_build_passthrough_ioadls - builds SG elements for passthrough | ||
| 3460 | * commands sent over IOCTL interface | ||
| 3461 | * | ||
| 3462 | * @cmd : pointer to struct pmcraid_cmd | ||
| 3463 | * @buflen : length of the request buffer | ||
| 3464 | * @direction : data transfer direction | ||
| 3465 | * | ||
| 3466 | * Return value | ||
| 3467 | * 0 on success, non-zero error code on failure | ||
| 3468 | */ | ||
| 3469 | static int pmcraid_build_passthrough_ioadls( | ||
| 3470 | struct pmcraid_cmd *cmd, | ||
| 3471 | int buflen, | ||
| 3472 | int direction | ||
| 3473 | ) | ||
| 3474 | { | ||
| 3475 | struct pmcraid_sglist *sglist = NULL; | ||
| 3476 | struct scatterlist *sg = NULL; | ||
| 3477 | struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; | ||
| 3478 | struct pmcraid_ioadl_desc *ioadl; | ||
| 3479 | int i; | ||
| 3480 | |||
| 3481 | sglist = pmcraid_alloc_sglist(buflen); | ||
| 3482 | |||
| 3483 | if (!sglist) { | ||
| 3484 | pmcraid_err("can't allocate memory for passthrough SGls\n"); | ||
| 3485 | return -ENOMEM; | ||
| 3486 | } | ||
| 3487 | |||
| 3488 | sglist->num_dma_sg = dma_map_sg(&cmd->drv_inst->pdev->dev, | ||
| 3489 | sglist->scatterlist, | ||
| 3490 | sglist->num_sg, direction); | ||
| 3491 | |||
| 3492 | if (!sglist->num_dma_sg || sglist->num_dma_sg > PMCRAID_MAX_IOADLS) { | ||
| 3493 | dev_err(&cmd->drv_inst->pdev->dev, | ||
| 3494 | "Failed to map passthrough buffer!\n"); | ||
| 3495 | pmcraid_free_sglist(sglist); | ||
| 3496 | return -EIO; | ||
| 3497 | } | ||
| 3498 | |||
| 3499 | cmd->sglist = sglist; | ||
| 3500 | ioarcb->request_flags0 |= NO_LINK_DESCS; | ||
| 3501 | |||
| 3502 | ioadl = pmcraid_init_ioadls(cmd, sglist->num_dma_sg); | ||
| 3503 | |||
| 3504 | /* Initialize IOADL descriptor addresses */ | ||
| 3505 | for_each_sg(sglist->scatterlist, sg, sglist->num_dma_sg, i) { | ||
| 3506 | ioadl[i].data_len = cpu_to_le32(sg_dma_len(sg)); | ||
| 3507 | ioadl[i].address = cpu_to_le64(sg_dma_address(sg)); | ||
| 3508 | ioadl[i].flags = 0; | ||
| 3509 | } | ||
| 3510 | |||
| 3511 | /* setup the last descriptor */ | ||
| 3512 | ioadl[i - 1].flags = IOADL_FLAGS_LAST_DESC; | ||
| 3513 | |||
| 3514 | return 0; | ||
| 3515 | } | ||
| 3516 | |||
| 3517 | |||
| 3518 | /** | ||
| 3519 | * pmcraid_release_passthrough_ioadls - release passthrough ioadls | ||
| 3520 | * | ||
| 3521 | * @cmd: pointer to struct pmcraid_cmd for which ioadls were allocated | ||
| 3522 | * @buflen: size of the request buffer | ||
| 3523 | * @direction: data transfer direction | ||
| 3524 | * | ||
| 3525 | * Return value | ||
| 3526 | * 0 on success, non-zero error code on failure | ||
| 3527 | */ | ||
| 3528 | static void pmcraid_release_passthrough_ioadls( | ||
| 3529 | struct pmcraid_cmd *cmd, | ||
| 3530 | int buflen, | ||
| 3531 | int direction | ||
| 3532 | ) | ||
| 3533 | { | ||
| 3534 | struct pmcraid_sglist *sglist = cmd->sglist; | ||
| 3535 | |||
| 3536 | if (buflen > 0) { | ||
| 3537 | dma_unmap_sg(&cmd->drv_inst->pdev->dev, | ||
| 3538 | sglist->scatterlist, | ||
| 3539 | sglist->num_sg, | ||
| 3540 | direction); | ||
| 3541 | pmcraid_free_sglist(sglist); | ||
| 3542 | cmd->sglist = NULL; | ||
| 3543 | } | ||
| 3544 | } | ||
| 3545 | |||
| 3546 | /** | ||
| 3547 | * pmcraid_ioctl_passthrough - handling passthrough IOCTL commands | ||
| 3548 | * | ||
| 3549 | * @pinstance: pointer to adapter instance structure | ||
| 3550 | * @ioctl_cmd: ioctl code | ||
| 3551 | * @buflen: unused | ||
| 3552 | * @arg: pointer to pmcraid_passthrough_buffer user buffer | ||
| 3553 | * | ||
| 3554 | * Return value | ||
| 3555 | * 0 on success, non-zero error code on failure | ||
| 3556 | */ | ||
| 3557 | static long pmcraid_ioctl_passthrough( | ||
| 3558 | struct pmcraid_instance *pinstance, | ||
| 3559 | unsigned int ioctl_cmd, | ||
| 3560 | unsigned int buflen, | ||
| 3561 | void __user *arg | ||
| 3562 | ) | ||
| 3563 | { | ||
| 3564 | struct pmcraid_passthrough_ioctl_buffer *buffer; | ||
| 3565 | struct pmcraid_ioarcb *ioarcb; | ||
| 3566 | struct pmcraid_cmd *cmd; | ||
| 3567 | struct pmcraid_cmd *cancel_cmd; | ||
| 3568 | void __user *request_buffer; | ||
| 3569 | unsigned long request_offset; | ||
| 3570 | unsigned long lock_flags; | ||
| 3571 | void __user *ioasa; | ||
| 3572 | u32 ioasc; | ||
| 3573 | int request_size; | ||
| 3574 | int buffer_size; | ||
| 3575 | u8 direction; | ||
| 3576 | int rc = 0; | ||
| 3577 | |||
| 3578 | /* If IOA reset is in progress, wait 10 secs for reset to complete */ | ||
| 3579 | if (pinstance->ioa_reset_in_progress) { | ||
| 3580 | rc = wait_event_interruptible_timeout( | ||
| 3581 | pinstance->reset_wait_q, | ||
| 3582 | !pinstance->ioa_reset_in_progress, | ||
| 3583 | msecs_to_jiffies(10000)); | ||
| 3584 | |||
| 3585 | if (!rc) | ||
| 3586 | return -ETIMEDOUT; | ||
| 3587 | else if (rc < 0) | ||
| 3588 | return -ERESTARTSYS; | ||
| 3589 | } | ||
| 3590 | |||
| 3591 | /* If adapter is not in operational state, return error */ | ||
| 3592 | if (pinstance->ioa_state != IOA_STATE_OPERATIONAL) { | ||
| 3593 | pmcraid_err("IOA is not operational\n"); | ||
| 3594 | return -ENOTTY; | ||
| 3595 | } | ||
| 3596 | |||
| 3597 | buffer_size = sizeof(struct pmcraid_passthrough_ioctl_buffer); | ||
| 3598 | buffer = kmalloc(buffer_size, GFP_KERNEL); | ||
| 3599 | |||
| 3600 | if (!buffer) { | ||
| 3601 | pmcraid_err("no memory for passthrough buffer\n"); | ||
| 3602 | return -ENOMEM; | ||
| 3603 | } | ||
| 3604 | |||
| 3605 | request_offset = | ||
| 3606 | offsetof(struct pmcraid_passthrough_ioctl_buffer, request_buffer); | ||
| 3607 | |||
| 3608 | request_buffer = arg + request_offset; | ||
| 3609 | |||
| 3610 | rc = copy_from_user(buffer, arg, | ||
| 3611 | sizeof(struct pmcraid_passthrough_ioctl_buffer)); | ||
| 3612 | |||
| 3613 | ioasa = arg + offsetof(struct pmcraid_passthrough_ioctl_buffer, ioasa); | ||
| 3614 | |||
| 3615 | if (rc) { | ||
| 3616 | pmcraid_err("ioctl: can't copy passthrough buffer\n"); | ||
| 3617 | rc = -EFAULT; | ||
| 3618 | goto out_free_buffer; | ||
| 3619 | } | ||
| 3620 | |||
| 3621 | request_size = le32_to_cpu(buffer->ioarcb.data_transfer_length); | ||
| 3622 | |||
| 3623 | if (buffer->ioarcb.request_flags0 & TRANSFER_DIR_WRITE) { | ||
| 3624 | direction = DMA_TO_DEVICE; | ||
| 3625 | } else { | ||
| 3626 | direction = DMA_FROM_DEVICE; | ||
| 3627 | } | ||
| 3628 | |||
| 3629 | if (request_size < 0) { | ||
| 3630 | rc = -EINVAL; | ||
| 3631 | goto out_free_buffer; | ||
| 3632 | } | ||
| 3633 | |||
| 3634 | /* check if we have any additional command parameters */ | ||
| 3635 | if (le16_to_cpu(buffer->ioarcb.add_cmd_param_length) | ||
| 3636 | > PMCRAID_ADD_CMD_PARAM_LEN) { | ||
| 3637 | rc = -EINVAL; | ||
| 3638 | goto out_free_buffer; | ||
| 3639 | } | ||
| 3640 | |||
| 3641 | cmd = pmcraid_get_free_cmd(pinstance); | ||
| 3642 | |||
| 3643 | if (!cmd) { | ||
| 3644 | pmcraid_err("free command block is not available\n"); | ||
| 3645 | rc = -ENOMEM; | ||
| 3646 | goto out_free_buffer; | ||
| 3647 | } | ||
| 3648 | |||
| 3649 | cmd->scsi_cmd = NULL; | ||
| 3650 | ioarcb = &(cmd->ioa_cb->ioarcb); | ||
| 3651 | |||
| 3652 | /* Copy the user-provided IOARCB stuff field by field */ | ||
| 3653 | ioarcb->resource_handle = buffer->ioarcb.resource_handle; | ||
| 3654 | ioarcb->data_transfer_length = buffer->ioarcb.data_transfer_length; | ||
| 3655 | ioarcb->cmd_timeout = buffer->ioarcb.cmd_timeout; | ||
| 3656 | ioarcb->request_type = buffer->ioarcb.request_type; | ||
| 3657 | ioarcb->request_flags0 = buffer->ioarcb.request_flags0; | ||
| 3658 | ioarcb->request_flags1 = buffer->ioarcb.request_flags1; | ||
| 3659 | memcpy(ioarcb->cdb, buffer->ioarcb.cdb, PMCRAID_MAX_CDB_LEN); | ||
| 3660 | |||
| 3661 | if (buffer->ioarcb.add_cmd_param_length) { | ||
| 3662 | ioarcb->add_cmd_param_length = | ||
| 3663 | buffer->ioarcb.add_cmd_param_length; | ||
| 3664 | ioarcb->add_cmd_param_offset = | ||
| 3665 | buffer->ioarcb.add_cmd_param_offset; | ||
| 3666 | memcpy(ioarcb->add_data.u.add_cmd_params, | ||
| 3667 | buffer->ioarcb.add_data.u.add_cmd_params, | ||
| 3668 | le16_to_cpu(buffer->ioarcb.add_cmd_param_length)); | ||
| 3669 | } | ||
| 3670 | |||
| 3671 | /* set hrrq number where the IOA should respond to. Note that all cmds | ||
| 3672 | * generated internally uses hrrq_id 0, exception to this is the cmd | ||
| 3673 | * block of scsi_cmd which is re-used (e.g. cancel/abort), which uses | ||
| 3674 | * hrrq_id assigned here in queuecommand | ||
| 3675 | */ | ||
| 3676 | ioarcb->hrrq_id = atomic_add_return(1, &(pinstance->last_message_id)) % | ||
| 3677 | pinstance->num_hrrq; | ||
| 3678 | |||
| 3679 | if (request_size) { | ||
| 3680 | rc = pmcraid_build_passthrough_ioadls(cmd, | ||
| 3681 | request_size, | ||
| 3682 | direction); | ||
| 3683 | if (rc) { | ||
| 3684 | pmcraid_err("couldn't build passthrough ioadls\n"); | ||
| 3685 | goto out_free_cmd; | ||
| 3686 | } | ||
| 3687 | } | ||
| 3688 | |||
| 3689 | /* If data is being written into the device, copy the data from user | ||
| 3690 | * buffers | ||
| 3691 | */ | ||
| 3692 | if (direction == DMA_TO_DEVICE && request_size > 0) { | ||
| 3693 | rc = pmcraid_copy_sglist(cmd->sglist, | ||
| 3694 | request_buffer, | ||
| 3695 | request_size, | ||
| 3696 | direction); | ||
| 3697 | if (rc) { | ||
| 3698 | pmcraid_err("failed to copy user buffer\n"); | ||
| 3699 | goto out_free_sglist; | ||
| 3700 | } | ||
| 3701 | } | ||
| 3702 | |||
| 3703 | /* passthrough ioctl is a blocking command so, put the user to sleep | ||
| 3704 | * until timeout. Note that a timeout value of 0 means, do timeout. | ||
| 3705 | */ | ||
| 3706 | cmd->cmd_done = pmcraid_internal_done; | ||
| 3707 | init_completion(&cmd->wait_for_completion); | ||
| 3708 | cmd->completion_req = 1; | ||
| 3709 | |||
| 3710 | pmcraid_info("command(%d) (CDB[0] = %x) for %x\n", | ||
| 3711 | le32_to_cpu(cmd->ioa_cb->ioarcb.response_handle) >> 2, | ||
| 3712 | cmd->ioa_cb->ioarcb.cdb[0], | ||
| 3713 | le32_to_cpu(cmd->ioa_cb->ioarcb.resource_handle)); | ||
| 3714 | |||
| 3715 | spin_lock_irqsave(pinstance->host->host_lock, lock_flags); | ||
| 3716 | _pmcraid_fire_command(cmd); | ||
| 3717 | spin_unlock_irqrestore(pinstance->host->host_lock, lock_flags); | ||
| 3718 | |||
| 3719 | /* NOTE ! Remove the below line once abort_task is implemented | ||
| 3720 | * in firmware. This line disables ioctl command timeout handling logic | ||
| 3721 | * similar to IO command timeout handling, making ioctl commands to wait | ||
| 3722 | * until the command completion regardless of timeout value specified in | ||
| 3723 | * ioarcb | ||
| 3724 | */ | ||
| 3725 | buffer->ioarcb.cmd_timeout = 0; | ||
| 3726 | |||
| 3727 | /* If command timeout is specified put caller to wait till that time, | ||
| 3728 | * otherwise it would be blocking wait. If command gets timed out, it | ||
| 3729 | * will be aborted. | ||
| 3730 | */ | ||
| 3731 | if (buffer->ioarcb.cmd_timeout == 0) { | ||
| 3732 | wait_for_completion(&cmd->wait_for_completion); | ||
| 3733 | } else if (!wait_for_completion_timeout( | ||
| 3734 | &cmd->wait_for_completion, | ||
| 3735 | msecs_to_jiffies(le16_to_cpu(buffer->ioarcb.cmd_timeout) * 1000))) { | ||
| 3736 | |||
| 3737 | pmcraid_info("aborting cmd %d (CDB[0] = %x) due to timeout\n", | ||
| 3738 | le32_to_cpu(cmd->ioa_cb->ioarcb.response_handle) >> 2, | ||
| 3739 | cmd->ioa_cb->ioarcb.cdb[0]); | ||
| 3740 | |||
| 3741 | spin_lock_irqsave(pinstance->host->host_lock, lock_flags); | ||
| 3742 | cancel_cmd = pmcraid_abort_cmd(cmd); | ||
| 3743 | spin_unlock_irqrestore(pinstance->host->host_lock, lock_flags); | ||
| 3744 | |||
| 3745 | if (cancel_cmd) { | ||
| 3746 | wait_for_completion(&cancel_cmd->wait_for_completion); | ||
| 3747 | ioasc = le32_to_cpu(cancel_cmd->ioa_cb->ioasa.ioasc); | ||
| 3748 | pmcraid_return_cmd(cancel_cmd); | ||
| 3749 | |||
| 3750 | /* if abort task couldn't find the command i.e it got | ||
| 3751 | * completed prior to aborting, return good completion. | ||
| 3752 | * if command got aborted successfully or there was IOA | ||
| 3753 | * reset due to abort task itself getting timedout then | ||
| 3754 | * return -ETIMEDOUT | ||
| 3755 | */ | ||
| 3756 | if (ioasc == PMCRAID_IOASC_IOA_WAS_RESET || | ||
| 3757 | PMCRAID_IOASC_SENSE_KEY(ioasc) == 0x00) { | ||
| 3758 | if (ioasc != PMCRAID_IOASC_GC_IOARCB_NOTFOUND) | ||
| 3759 | rc = -ETIMEDOUT; | ||
| 3760 | goto out_handle_response; | ||
| 3761 | } | ||
| 3762 | } | ||
| 3763 | |||
| 3764 | /* no command block for abort task or abort task failed to abort | ||
| 3765 | * the IOARCB, then wait for 150 more seconds and initiate reset | ||
| 3766 | * sequence after timeout | ||
| 3767 | */ | ||
| 3768 | if (!wait_for_completion_timeout( | ||
| 3769 | &cmd->wait_for_completion, | ||
| 3770 | msecs_to_jiffies(150 * 1000))) { | ||
| 3771 | pmcraid_reset_bringup(cmd->drv_inst); | ||
| 3772 | rc = -ETIMEDOUT; | ||
| 3773 | } | ||
| 3774 | } | ||
| 3775 | |||
| 3776 | out_handle_response: | ||
| 3777 | /* copy entire IOASA buffer and return IOCTL success. | ||
| 3778 | * If copying IOASA to user-buffer fails, return | ||
| 3779 | * EFAULT | ||
| 3780 | */ | ||
| 3781 | if (copy_to_user(ioasa, &cmd->ioa_cb->ioasa, | ||
| 3782 | sizeof(struct pmcraid_ioasa))) { | ||
| 3783 | pmcraid_err("failed to copy ioasa buffer to user\n"); | ||
| 3784 | rc = -EFAULT; | ||
| 3785 | } | ||
| 3786 | |||
| 3787 | /* If the data transfer was from device, copy the data onto user | ||
| 3788 | * buffers | ||
| 3789 | */ | ||
| 3790 | else if (direction == DMA_FROM_DEVICE && request_size > 0) { | ||
| 3791 | rc = pmcraid_copy_sglist(cmd->sglist, | ||
| 3792 | request_buffer, | ||
| 3793 | request_size, | ||
| 3794 | direction); | ||
| 3795 | if (rc) { | ||
| 3796 | pmcraid_err("failed to copy user buffer\n"); | ||
| 3797 | rc = -EFAULT; | ||
| 3798 | } | ||
| 3799 | } | ||
| 3800 | |||
| 3801 | out_free_sglist: | ||
| 3802 | pmcraid_release_passthrough_ioadls(cmd, request_size, direction); | ||
| 3803 | |||
| 3804 | out_free_cmd: | ||
| 3805 | pmcraid_return_cmd(cmd); | ||
| 3806 | |||
| 3807 | out_free_buffer: | ||
| 3808 | kfree(buffer); | ||
| 3809 | |||
| 3810 | return rc; | ||
| 3811 | } | ||
| 3812 | |||
| 3813 | |||
| 3814 | |||
| 3815 | |||
| 3816 | /** | 3339 | /** |
| 3817 | * pmcraid_ioctl_driver - ioctl handler for commands handled by driver itself | 3340 | * pmcraid_ioctl_driver - ioctl handler for commands handled by driver itself |
| 3818 | * | 3341 | * |
| @@ -3922,20 +3445,6 @@ static long pmcraid_chr_ioctl( · 103 unmodified lines | |||
| 3922 | 3445 | ||
| 3923 | switch (_IOC_TYPE(cmd)) { | 3446 | switch (_IOC_TYPE(cmd)) { |
| 3924 | 3447 | ||
| 3925 | case PMCRAID_PASSTHROUGH_IOCTL: | ||
| 3926 | /* If ioctl code is to download microcode, we need to block | ||
| 3927 | * mid-layer requests. | ||
| 3928 | */ | ||
| 3929 | if (cmd == PMCRAID_IOCTL_DOWNLOAD_MICROCODE) | ||
| 3930 | scsi_block_requests(pinstance->host); | ||
| 3931 | |||
| 3932 | retval = pmcraid_ioctl_passthrough(pinstance, cmd, | ||
| 3933 | hdr->buffer_length, argp); | ||
| 3934 | |||
| 3935 | if (cmd == PMCRAID_IOCTL_DOWNLOAD_MICROCODE) | ||
| 3936 | scsi_unblock_requests(pinstance->host); | ||
| 3937 | break; | ||
| 3938 | |||
| 3939 | case PMCRAID_DRIVER_IOCTL: | 3448 | case PMCRAID_DRIVER_IOCTL: |
| 3940 | arg += sizeof(struct pmcraid_ioctl_header); | 3449 | arg += sizeof(struct pmcraid_ioctl_header); |
| 3941 | retval = pmcraid_ioctl_driver(pinstance, cmd, | 3450 | retval = pmcraid_ioctl_driver(pinstance, cmd, |
| @@ -1022,41 +1022,16 @@ struct pmcraid_ioctl_header { · 1021 unmodified lines | |||
| 1022 | 1022 | ||
| 1023 | #define PMCRAID_IOCTL_SIGNATURE "PMCRAID" | 1023 | #define PMCRAID_IOCTL_SIGNATURE "PMCRAID" |
| 1024 | 1024 | ||
| 1025 | /* | ||
| 1026 | * pmcraid_passthrough_ioctl_buffer - structure given as argument to | ||
| 1027 | * passthrough(or firmware handled) IOCTL commands. Note that ioarcb requires | ||
| 1028 | * 32-byte alignment so, it is necessary to pack this structure to avoid any | ||
| 1029 | * holes between ioctl_header and passthrough buffer | ||
| 1030 | * | ||
| 1031 | * .ioactl_header : ioctl header | ||
| 1032 | * .ioarcb : filled-up ioarcb buffer, driver always reads this buffer | ||
| 1033 | * .ioasa : buffer for ioasa, driver fills this with IOASA from firmware | ||
| 1034 | * .request_buffer: The I/O buffer (flat), driver reads/writes to this based on | ||
| 1035 | * the transfer directions passed in ioarcb.flags0. Contents | ||
| 1036 | * of this buffer are valid only when ioarcb.data_transfer_len | ||
| 1037 | * is not zero. | ||
| 1038 | */ | ||
| 1039 | struct pmcraid_passthrough_ioctl_buffer { | ||
| 1040 | struct pmcraid_ioctl_header ioctl_header; | ||
| 1041 | struct pmcraid_ioarcb ioarcb; | ||
| 1042 | struct pmcraid_ioasa ioasa; | ||
| 1043 | u8 request_buffer[]; | ||
| 1044 | } __attribute__ ((packed, aligned(PMCRAID_IOARCB_ALIGNMENT))); | ||
| 1045 | |||
| 1046 | /* | 1025 | /* |
| 1047 | * keys to differentiate between driver handled IOCTLs and passthrough | 1026 | * keys to differentiate between driver handled IOCTLs and passthrough |
| 1048 | * IOCTLs passed to IOA. driver determines the ioctl type using macro | 1027 | * IOCTLs passed to IOA. driver determines the ioctl type using macro |
| 1049 | * _IOC_TYPE | 1028 | * _IOC_TYPE |
| 1050 | */ | 1029 | */ |
| 1051 | #define PMCRAID_DRIVER_IOCTL 'D' | 1030 | #define PMCRAID_DRIVER_IOCTL 'D' |
| 1052 | #define PMCRAID_PASSTHROUGH_IOCTL 'F' | ||
| 1053 | 1031 | ||
| 1054 | #define DRV_IOCTL(n, size) \ | 1032 | #define DRV_IOCTL(n, size) \ |
| 1055 | _IOC(_IOC_READ|_IOC_WRITE, PMCRAID_DRIVER_IOCTL, (n), (size)) | 1033 | _IOC(_IOC_READ|_IOC_WRITE, PMCRAID_DRIVER_IOCTL, (n), (size)) |
| 1056 | 1034 | ||
| 1057 | #define FMW_IOCTL(n, size) \ | ||
| 1058 | _IOC(_IOC_READ|_IOC_WRITE, PMCRAID_PASSTHROUGH_IOCTL, (n), (size)) | ||
| 1059 | |||
| 1060 | /* | 1035 | /* |
| 1061 | * _ARGSIZE: macro that gives size of the argument type passed to an IOCTL cmd. | 1036 | * _ARGSIZE: macro that gives size of the argument type passed to an IOCTL cmd. |
| 1062 | * This is to facilitate applications avoiding un-necessary memory allocations. | 1037 | * This is to facilitate applications avoiding un-necessary memory allocations. |
| @@ -1069,12 +1044,4 @@ struct pmcraid_passthrough_ioctl_buffer { · 6 unmodified lines | |||
| 1069 | #define PMCRAID_IOCTL_RESET_ADAPTER \ | 1044 | #define PMCRAID_IOCTL_RESET_ADAPTER \ |
| 1070 | DRV_IOCTL(5, sizeof(struct pmcraid_ioctl_header)) | 1045 | DRV_IOCTL(5, sizeof(struct pmcraid_ioctl_header)) |
| 1071 | 1046 | ||
| 1072 | /* passthrough/firmware handled commands */ | ||
| 1073 | #define PMCRAID_IOCTL_PASSTHROUGH_COMMAND \ | ||
| 1074 | FMW_IOCTL(1, sizeof(struct pmcraid_passthrough_ioctl_buffer)) | ||
| 1075 | |||
| 1076 | #define PMCRAID_IOCTL_DOWNLOAD_MICROCODE \ | ||
| 1077 | FMW_IOCTL(2, sizeof(struct pmcraid_passthrough_ioctl_buffer)) | ||
| 1078 | |||
| 1079 | |||
| 1080 | #endif /* _PMCRAID_H */ | 1047 | #endif /* _PMCRAID_H */ |
| @@ -7519,12 +7519,13 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num) · 7518 unmodified lines | |||
| 7519 | struct sdebug_defer *sd_dp; | 7519 | struct sdebug_defer *sd_dp; |
| 7520 | 7520 | ||
| 7521 | sqp = sdebug_q_arr + queue_num; | 7521 | sqp = sdebug_q_arr + queue_num; |
| 7522 | qc_idx = find_first_bit(sqp->in_use_bm, sdebug_max_queue); | ||
| 7523 | if (qc_idx >= sdebug_max_queue) | ||
| 7524 | return 0; | ||
| 7525 | 7522 | ||
| 7526 | spin_lock_irqsave(&sqp->qc_lock, iflags); | 7523 | spin_lock_irqsave(&sqp->qc_lock, iflags); |
| 7527 | 7524 | ||
| 7525 | qc_idx = find_first_bit(sqp->in_use_bm, sdebug_max_queue); | ||
| 7526 | if (qc_idx >= sdebug_max_queue) | ||
| 7527 | goto unlock; | ||
| 7528 | |||
| 7528 | for (first = true; first || qc_idx + 1 < sdebug_max_queue; ) { | 7529 | for (first = true; first || qc_idx + 1 < sdebug_max_queue; ) { |
| 7529 | if (first) { | 7530 | if (first) { |
| 7530 | first = false; | 7531 | first = false; |
| @@ -7589,6 +7590,7 @@ static int sdebug_blk_mq_poll(struct Scsi_Host *shost, unsigned int queue_num) · 58 unmodified lines | |||
| 7589 | break; | 7590 | break; |
| 7590 | } | 7591 | } |
| 7591 | 7592 | ||
| 7593 | unlock: | ||
| 7592 | spin_unlock_irqrestore(&sqp->qc_lock, iflags); | 7594 | spin_unlock_irqrestore(&sqp->qc_lock, iflags); |
| 7593 | 7595 | ||
| 7594 | if (num_entries > 0) | 7596 | if (num_entries > 0) |
| @@ -30,7 +30,7 @@ static inline const char *scmd_name(const struct scsi_cmnd *scmd) · 29 unmodified lines | |||
| 30 | { | 30 | { |
| 31 | struct request *rq = scsi_cmd_to_rq((struct scsi_cmnd *)scmd); | 31 | struct request *rq = scsi_cmd_to_rq((struct scsi_cmnd *)scmd); |
| 32 | 32 | ||
| 33 | if (!rq->q->disk) | 33 | if (!rq->q || !rq->q->disk) |
| 34 | return NULL; | 34 | return NULL; |
| 35 | return rq->q->disk->disk_name; | 35 | return rq->q->disk->disk_name; |
| 36 | } | 36 | } |
| @@ -223,6 +223,8 @@ static int scsi_realloc_sdev_budget_map(struct scsi_device *sdev, · 222 unmodified lines | |||
| 223 | int ret; | 223 | int ret; |
| 224 | struct sbitmap sb_backup; | 224 | struct sbitmap sb_backup; |
| 225 | 225 | ||
| 226 | depth = min_t(unsigned int, depth, scsi_device_max_queue_depth(sdev)); | ||
| 227 | |||
| 226 | /* | 228 | /* |
| 227 | * realloc if new shift is calculated, which is caused by setting | 229 | * realloc if new shift is calculated, which is caused by setting |
| 228 | * up one new default queue depth after calling ->slave_configure | 230 | * up one new default queue depth after calling ->slave_configure |
| @@ -245,6 +247,9 @@ static int scsi_realloc_sdev_budget_map(struct scsi_device *sdev, · 16 unmodified lines | |||
| 245 | scsi_device_max_queue_depth(sdev), | 247 | scsi_device_max_queue_depth(sdev), |
| 246 | new_shift, GFP_KERNEL, | 248 | new_shift, GFP_KERNEL, |
| 247 | sdev->request_queue->node, false, true); | 249 | sdev->request_queue->node, false, true); |
| 250 | if (!ret) | ||
| 251 | sbitmap_resize(&sdev->budget_map, depth); | ||
| 252 | |||
| 248 | if (need_free) { | 253 | if (need_free) { |
| 249 | if (ret) | 254 | if (ret) |
| 250 | sdev->budget_map = sb_backup; | 255 | sdev->budget_map = sb_backup; |
| @@ -1384,10 +1384,6 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev) · 1383 unmodified lines | |||
| 1384 | if (IS_ENABLED(CONFIG_BLK_DEV_BSG)) { | 1384 | if (IS_ENABLED(CONFIG_BLK_DEV_BSG)) { |
| 1385 | sdev->bsg_dev = scsi_bsg_register_queue(sdev); | 1385 | sdev->bsg_dev = scsi_bsg_register_queue(sdev); |
| 1386 | if (IS_ERR(sdev->bsg_dev)) { | 1386 | if (IS_ERR(sdev->bsg_dev)) { |
| 1387 | /* | ||
| 1388 | * We're treating error on bsg register as non-fatal, so | ||
| 1389 | * pretend nothing went wrong. | ||
| 1390 | */ | ||
| 1391 | error = PTR_ERR(sdev->bsg_dev); | 1387 | error = PTR_ERR(sdev->bsg_dev); |
| 1392 | sdev_printk(KERN_INFO, sdev, | 1388 | sdev_printk(KERN_INFO, sdev, |
| 1393 | "Failed to register bsg queue, errno=%d\n", | 1389 | "Failed to register bsg queue, errno=%d\n", |
| @@ -3216,6 +3216,7 @@ static int sd_revalidate_disk(struct gendisk *disk) · 3215 unmodified lines | |||
| 3216 | sd_read_block_limits(sdkp); | 3216 | sd_read_block_limits(sdkp); |
| 3217 | sd_read_block_characteristics(sdkp); | 3217 | sd_read_block_characteristics(sdkp); |
| 3218 | sd_zbc_read_zones(sdkp, buffer); | 3218 | sd_zbc_read_zones(sdkp, buffer); |
| 3219 | sd_read_cpr(sdkp); | ||
| 3219 | } | 3220 | } |
| 3220 | 3221 | ||
| 3221 | sd_print_capacity(sdkp, old_capacity); | 3222 | sd_print_capacity(sdkp, old_capacity); |
| @@ -3225,7 +3226,6 @@ static int sd_revalidate_disk(struct gendisk *disk) · 3 unmodified lines | |||
| 3225 | sd_read_app_tag_own(sdkp, buffer); | 3226 | sd_read_app_tag_own(sdkp, buffer); |
| 3226 | sd_read_write_same(sdkp, buffer); | 3227 | sd_read_write_same(sdkp, buffer); |
| 3227 | sd_read_security(sdkp, buffer); | 3228 | sd_read_security(sdkp, buffer); |
| 3228 | sd_read_cpr(sdkp); | ||
| 3229 | } | 3229 | } |
| 3230 | 3230 | ||
| 3231 | /* | 3231 | /* |
| @@ -3475,6 +3475,7 @@ static int sd_probe(struct device *dev) · 243 unmodified lines | |||
| 3475 | error = device_add_disk(dev, gd, NULL); | 3475 | error = device_add_disk(dev, gd, NULL); |
| 3476 | if (error) { | 3476 | if (error) { |
| 3477 | put_device(&sdkp->disk_dev); | 3477 | put_device(&sdkp->disk_dev); |
| 3478 | blk_cleanup_disk(gd); | ||
| 3478 | goto out; | 3479 | goto out; |
| 3479 | } | 3480 | } |
| 3480 | 3481 | ||
| @@ -535,7 +535,7 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, · 534 unmodified lines | |||
| 535 | 535 | ||
| 536 | scsi_autopm_get_device(sdev); | 536 | scsi_autopm_get_device(sdev); |
| 537 | 537 | ||
| 538 | if (ret != CDROMCLOSETRAY && ret != CDROMEJECT) { | 538 | if (cmd != CDROMCLOSETRAY && cmd != CDROMEJECT) { |
| 539 | ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, arg); | 539 | ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, arg); |
| 540 | if (ret != -ENOSYS) | 540 | if (ret != -ENOSYS) |
| 541 | goto put; | 541 | goto put; |
| @@ -957,18 +957,6 @@ static const struct reset_control_ops ufs_qcom_reset_ops = { · 956 unmodified lines | |||
| 957 | .deassert = ufs_qcom_reset_deassert, | 957 | .deassert = ufs_qcom_reset_deassert, |
| 958 | }; | 958 | }; |
| 959 | 959 | ||
| 960 | #define ANDROID_BOOT_DEV_MAX 30 | ||
| 961 | static char android_boot_dev[ANDROID_BOOT_DEV_MAX]; | ||
| 962 | |||
| 963 | #ifndef MODULE | ||
| 964 | static int __init get_android_boot_dev(char *str) | ||
| 965 | { | ||
| 966 | strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX); | ||
| 967 | return 1; | ||
| 968 | } | ||
| 969 | __setup("androidboot.bootdevice=", get_android_boot_dev); | ||
| 970 | #endif | ||
| 971 | |||
| 972 | /** | 960 | /** |
| 973 | * ufs_qcom_init - bind phy with controller | 961 | * ufs_qcom_init - bind phy with controller |
| 974 | * @hba: host controller instance | 962 | * @hba: host controller instance |
| @@ -988,9 +976,6 @@ static int ufs_qcom_init(struct ufs_hba *hba) · 13 unmodified lines | |||
| 988 | struct resource *res; | 976 | struct resource *res; |
| 989 | struct ufs_clk_info *clki; | 977 | struct ufs_clk_info *clki; |
| 990 | 978 | ||
| 991 | if (strlen(android_boot_dev) && strcmp(android_boot_dev, dev_name(dev))) | ||
| 992 | return -ENODEV; | ||
| 993 | |||
| 994 | host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); | 979 | host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); |
| 995 | if (!host) { | 980 | if (!host) { |
| 996 | err = -ENOMEM; | 981 | err = -ENOMEM; |
| @@ -428,6 +428,12 @@ static int ufs_intel_adl_init(struct ufs_hba *hba) · 427 unmodified lines | |||
| 428 | return ufs_intel_common_init(hba); | 428 | return ufs_intel_common_init(hba); |
| 429 | } | 429 | } |
| 430 | 430 | ||
| 431 | static int ufs_intel_mtl_init(struct ufs_hba *hba) | ||
| 432 | { | ||
| 433 | hba->caps |= UFSHCD_CAP_CRYPTO | UFSHCD_CAP_WB_EN; | ||
| 434 | return ufs_intel_common_init(hba); | ||
| 435 | } | ||
| 436 | |||
| 431 | static struct ufs_hba_variant_ops ufs_intel_cnl_hba_vops = { | 437 | static struct ufs_hba_variant_ops ufs_intel_cnl_hba_vops = { |
| 432 | .name = "intel-pci", | 438 | .name = "intel-pci", |
| 433 | .init = ufs_intel_common_init, | 439 | .init = ufs_intel_common_init, |
| @@ -465,6 +471,16 @@ static struct ufs_hba_variant_ops ufs_intel_adl_hba_vops = { · 31 unmodified lines | |||
| 465 | .device_reset = ufs_intel_device_reset, | 471 | .device_reset = ufs_intel_device_reset, |
| 466 | }; | 472 | }; |
| 467 | 473 | ||
| 474 | static struct ufs_hba_variant_ops ufs_intel_mtl_hba_vops = { | ||
| 475 | .name = "intel-pci", | ||
| 476 | .init = ufs_intel_mtl_init, | ||
| 477 | .exit = ufs_intel_common_exit, | ||
| 478 | .hce_enable_notify = ufs_intel_hce_enable_notify, | ||
| 479 | .link_startup_notify = ufs_intel_link_startup_notify, | ||
| 480 | .resume = ufs_intel_resume, | ||
| 481 | .device_reset = ufs_intel_device_reset, | ||
| 482 | }; | ||
| 483 | |||
| 468 | #ifdef CONFIG_PM_SLEEP | 484 | #ifdef CONFIG_PM_SLEEP |
| 469 | static int ufshcd_pci_restore(struct device *dev) | 485 | static int ufshcd_pci_restore(struct device *dev) |
| 470 | { | 486 | { |
| @@ -579,6 +595,7 @@ static const struct pci_device_id ufshcd_pci_tbl[] = { · 108 unmodified lines | |||
| 579 | { PCI_VDEVICE(INTEL, 0x98FA), (kernel_ulong_t)&ufs_intel_lkf_hba_vops }, | 595 | { PCI_VDEVICE(INTEL, 0x98FA), (kernel_ulong_t)&ufs_intel_lkf_hba_vops }, |
| 580 | { PCI_VDEVICE(INTEL, 0x51FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops }, | 596 | { PCI_VDEVICE(INTEL, 0x51FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops }, |
| 581 | { PCI_VDEVICE(INTEL, 0x54FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops }, | 597 | { PCI_VDEVICE(INTEL, 0x54FF), (kernel_ulong_t)&ufs_intel_adl_hba_vops }, |
| 598 | { PCI_VDEVICE(INTEL, 0x7E47), (kernel_ulong_t)&ufs_intel_mtl_hba_vops }, | ||
| 582 | { } /* terminate list */ | 599 | { } /* terminate list */ |
| 583 | }; | 600 | }; |
| 584 | 601 | ||
| @@ -820,8 +820,6 @@ struct ufs_hba { · 819 unmodified lines | |||
| 820 | enum ufs_pm_level rpm_lvl; | 820 | enum ufs_pm_level rpm_lvl; |
| 821 | /* Desired UFS power management level during system PM */ | 821 | /* Desired UFS power management level during system PM */ |
| 822 | enum ufs_pm_level spm_lvl; | 822 | enum ufs_pm_level spm_lvl; |
| 823 | struct device_attribute rpm_lvl_attr; | ||
| 824 | struct device_attribute spm_lvl_attr; | ||
| 825 | int pm_op_in_progress; | 823 | int pm_op_in_progress; |
| 826 | 824 | ||
| 827 | /* Auto-Hibernate Idle Timer register value */ | 825 | /* Auto-Hibernate Idle Timer register value */ |
| @@ -867,12 +867,6 @@ static struct ufshpb_region *ufshpb_victim_lru_info(struct ufshpb_lu *hpb) · 866 unmodified lines | |||
| 867 | struct ufshpb_region *rgn, *victim_rgn = NULL; | 867 | struct ufshpb_region *rgn, *victim_rgn = NULL; |
| 868 | 868 | ||
| 869 | list_for_each_entry(rgn, &lru_info->lh_lru_rgn, list_lru_rgn) { | 869 | list_for_each_entry(rgn, &lru_info->lh_lru_rgn, list_lru_rgn) { |
| 870 | if (!rgn) { | ||
| 871 | dev_err(&hpb->sdev_ufs_lu->sdev_dev, | ||
| 872 | "%s: no region allocated\n", | ||
| 873 | __func__); | ||
| 874 | return NULL; | ||
| 875 | } | ||
| 876 | if (ufshpb_check_srgns_issue_state(hpb, rgn)) | 870 | if (ufshpb_check_srgns_issue_state(hpb, rgn)) |
| 877 | continue; | 871 | continue; |
| 878 | 872 | ||
| @@ -888,6 +882,11 @@ static struct ufshpb_region *ufshpb_victim_lru_info(struct ufshpb_lu *hpb) · 9 unmodified lines | |||
| 888 | break; | 882 | break; |
| 889 | } | 883 | } |
| 890 | 884 | ||
| 885 | if (!victim_rgn) | ||
| 886 | dev_err(&hpb->sdev_ufs_lu->sdev_dev, | ||
| 887 | "%s: no region allocated\n", | ||
| 888 | __func__); | ||
| 889 | |||
| 891 | return victim_rgn; | 890 | return victim_rgn; |
| 892 | } | 891 | } |
| 893 | 892 | ||
| @@ -988,7 +988,7 @@ static struct virtio_driver virtio_scsi_driver = { · 987 unmodified lines | |||
| 988 | .remove = virtscsi_remove, | 988 | .remove = virtscsi_remove, |
| 989 | }; | 989 | }; |
| 990 | 990 | ||
| 991 | static int __init init(void) | 991 | static int __init virtio_scsi_init(void) |
| 992 | { | 992 | { |
| 993 | int ret = -ENOMEM; | 993 | int ret = -ENOMEM; |
| 994 | 994 | ||
| @@ -1020,14 +1020,14 @@ error: · 25 unmodified lines | |||
| 1020 | return ret; | 1020 | return ret; |
| 1021 | } | 1021 | } |
| 1022 | 1022 | ||
| 1023 | static void __exit fini(void) | 1023 | static void __exit virtio_scsi_fini(void) |
| 1024 | { | 1024 | { |
| 1025 | unregister_virtio_driver(&virtio_scsi_driver); | 1025 | unregister_virtio_driver(&virtio_scsi_driver); |
| 1026 | mempool_destroy(virtscsi_cmd_pool); | 1026 | mempool_destroy(virtscsi_cmd_pool); |
| 1027 | kmem_cache_destroy(virtscsi_cmd_cache); | 1027 | kmem_cache_destroy(virtscsi_cmd_cache); |
| 1028 | } | 1028 | } |
| 1029 | module_init(init); | 1029 | module_init(virtio_scsi_init); |
| 1030 | module_exit(fini); | 1030 | module_exit(virtio_scsi_fini); |
| 1031 | 1031 | ||
| 1032 | MODULE_DEVICE_TABLE(virtio, id_table); | 1032 | MODULE_DEVICE_TABLE(virtio, id_table); |
| 1033 | MODULE_DESCRIPTION("Virtio SCSI HBA driver"); | 1033 | MODULE_DESCRIPTION("Virtio SCSI HBA driver"); |
| @@ -159,6 +159,8 @@ static void zorro7xx_remove_one(struct zorro_dev *z) · 158 unmodified lines | |||
| 159 | scsi_remove_host(host); | 159 | scsi_remove_host(host); |
| 160 | 160 | ||
| 161 | NCR_700_release(host); | 161 | NCR_700_release(host); |
| 162 | if (host->base > 0x01000000) | ||
| 163 | iounmap(hostdata->base); | ||
| 162 | kfree(hostdata); | 164 | kfree(hostdata); |
| 163 | free_irq(host->irq, host); | 165 | free_irq(host->irq, host); |
| 164 | zorro_release_device(z); | 166 | zorro_release_device(z); |
| @@ -1821,6 +1821,7 @@ static struct page *tcmu_try_get_data_page(struct tcmu_dev *udev, uint32_t dpi) · 1820 unmodified lines | |||
| 1821 | mutex_lock(&udev->cmdr_lock); | 1821 | mutex_lock(&udev->cmdr_lock); |
| 1822 | page = xa_load(&udev->data_pages, dpi); | 1822 | page = xa_load(&udev->data_pages, dpi); |
| 1823 | if (likely(page)) { | 1823 | if (likely(page)) { |
| 1824 | get_page(page); | ||
| 1824 | mutex_unlock(&udev->cmdr_lock); | 1825 | mutex_unlock(&udev->cmdr_lock); |
| 1825 | return page; | 1826 | return page; |
| 1826 | } | 1827 | } |
| @@ -1877,6 +1878,7 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf) · 50 unmodified lines | |||
| 1877 | /* For the vmalloc()ed cmd area pages */ | 1878 | /* For the vmalloc()ed cmd area pages */ |
| 1878 | addr = (void *)(unsigned long)info->mem[mi].addr + offset; | 1879 | addr = (void *)(unsigned long)info->mem[mi].addr + offset; |
| 1879 | page = vmalloc_to_page(addr); | 1880 | page = vmalloc_to_page(addr); |
| 1881 | get_page(page); | ||
| 1880 | } else { | 1882 | } else { |
| 1881 | uint32_t dpi; | 1883 | uint32_t dpi; |
| 1882 | 1884 | ||
| @@ -1887,7 +1889,6 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf) · 4 unmodified lines | |||
| 1887 | return VM_FAULT_SIGBUS; | 1889 | return VM_FAULT_SIGBUS; |
| 1888 | } | 1890 | } |
| 1889 | 1891 | ||
| 1890 | get_page(page); | ||
| 1891 | vmf->page = page; | 1892 | vmf->page = page; |
| 1892 | return 0; | 1893 | return 0; |
| 1893 | } | 1894 | } |