aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas/mpt2sas_base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_base.c')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c128
1 files changed, 76 insertions, 52 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 9ead0399808..e8a6f1cf1e4 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -752,20 +752,19 @@ static u8
752_base_get_cb_idx(struct MPT2SAS_ADAPTER *ioc, u16 smid) 752_base_get_cb_idx(struct MPT2SAS_ADAPTER *ioc, u16 smid)
753{ 753{
754 int i; 754 int i;
755 u8 cb_idx = 0xFF; 755 u8 cb_idx;
756 756
757 if (smid >= ioc->hi_priority_smid) { 757 if (smid < ioc->hi_priority_smid) {
758 if (smid < ioc->internal_smid) {
759 i = smid - ioc->hi_priority_smid;
760 cb_idx = ioc->hpr_lookup[i].cb_idx;
761 } else if (smid <= ioc->hba_queue_depth) {
762 i = smid - ioc->internal_smid;
763 cb_idx = ioc->internal_lookup[i].cb_idx;
764 }
765 } else {
766 i = smid - 1; 758 i = smid - 1;
767 cb_idx = ioc->scsi_lookup[i].cb_idx; 759 cb_idx = ioc->scsi_lookup[i].cb_idx;
768 } 760 } else if (smid < ioc->internal_smid) {
761 i = smid - ioc->hi_priority_smid;
762 cb_idx = ioc->hpr_lookup[i].cb_idx;
763 } else if (smid <= ioc->hba_queue_depth) {
764 i = smid - ioc->internal_smid;
765 cb_idx = ioc->internal_lookup[i].cb_idx;
766 } else
767 cb_idx = 0xFF;
769 return cb_idx; 768 return cb_idx;
770} 769}
771 770
@@ -1430,7 +1429,7 @@ mpt2sas_base_get_smid_scsiio(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx,
1430 struct scsi_cmnd *scmd) 1429 struct scsi_cmnd *scmd)
1431{ 1430{
1432 unsigned long flags; 1431 unsigned long flags;
1433 struct request_tracker *request; 1432 struct scsiio_tracker *request;
1434 u16 smid; 1433 u16 smid;
1435 1434
1436 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); 1435 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
@@ -1442,7 +1441,7 @@ mpt2sas_base_get_smid_scsiio(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx,
1442 } 1441 }
1443 1442
1444 request = list_entry(ioc->free_list.next, 1443 request = list_entry(ioc->free_list.next,
1445 struct request_tracker, tracker_list); 1444 struct scsiio_tracker, tracker_list);
1446 request->scmd = scmd; 1445 request->scmd = scmd;
1447 request->cb_idx = cb_idx; 1446 request->cb_idx = cb_idx;
1448 smid = request->smid; 1447 smid = request->smid;
@@ -1496,48 +1495,47 @@ mpt2sas_base_free_smid(struct MPT2SAS_ADAPTER *ioc, u16 smid)
1496 struct chain_tracker *chain_req, *next; 1495 struct chain_tracker *chain_req, *next;
1497 1496
1498 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); 1497 spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
1499 if (smid >= ioc->hi_priority_smid) { 1498 if (smid < ioc->hi_priority_smid) {
1500 if (smid < ioc->internal_smid) { 1499 /* scsiio queue */
1501 /* hi-priority */ 1500 i = smid - 1;
1502 i = smid - ioc->hi_priority_smid; 1501 if (!list_empty(&ioc->scsi_lookup[i].chain_list)) {
1503 ioc->hpr_lookup[i].cb_idx = 0xFF; 1502 list_for_each_entry_safe(chain_req, next,
1504 list_add_tail(&ioc->hpr_lookup[i].tracker_list, 1503 &ioc->scsi_lookup[i].chain_list, tracker_list) {
1505 &ioc->hpr_free_list); 1504 list_del_init(&chain_req->tracker_list);
1506 } else { 1505 list_add_tail(&chain_req->tracker_list,
1507 /* internal queue */ 1506 &ioc->free_chain_list);
1508 i = smid - ioc->internal_smid; 1507 }
1509 ioc->internal_lookup[i].cb_idx = 0xFF;
1510 list_add_tail(&ioc->internal_lookup[i].tracker_list,
1511 &ioc->internal_free_list);
1512 } 1508 }
1509 ioc->scsi_lookup[i].cb_idx = 0xFF;
1510 ioc->scsi_lookup[i].scmd = NULL;
1511 list_add_tail(&ioc->scsi_lookup[i].tracker_list,
1512 &ioc->free_list);
1513 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); 1513 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
1514 return;
1515 }
1516 1514
1517 /* scsiio queue */ 1515 /*
1518 i = smid - 1; 1516 * See _wait_for_commands_to_complete() call with regards
1519 if (!list_empty(&ioc->scsi_lookup[i].chain_list)) { 1517 * to this code.
1520 list_for_each_entry_safe(chain_req, next, 1518 */
1521 &ioc->scsi_lookup[i].chain_list, tracker_list) { 1519 if (ioc->shost_recovery && ioc->pending_io_count) {
1522 list_del_init(&chain_req->tracker_list); 1520 if (ioc->pending_io_count == 1)
1523 list_add_tail(&chain_req->tracker_list, 1521 wake_up(&ioc->reset_wq);
1524 &ioc->free_chain_list); 1522 ioc->pending_io_count--;
1525 } 1523 }
1524 return;
1525 } else if (smid < ioc->internal_smid) {
1526 /* hi-priority */
1527 i = smid - ioc->hi_priority_smid;
1528 ioc->hpr_lookup[i].cb_idx = 0xFF;
1529 list_add_tail(&ioc->hpr_lookup[i].tracker_list,
1530 &ioc->hpr_free_list);
1531 } else if (smid <= ioc->hba_queue_depth) {
1532 /* internal queue */
1533 i = smid - ioc->internal_smid;
1534 ioc->internal_lookup[i].cb_idx = 0xFF;
1535 list_add_tail(&ioc->internal_lookup[i].tracker_list,
1536 &ioc->internal_free_list);
1526 } 1537 }
1527 ioc->scsi_lookup[i].cb_idx = 0xFF;
1528 ioc->scsi_lookup[i].scmd = NULL;
1529 list_add_tail(&ioc->scsi_lookup[i].tracker_list,
1530 &ioc->free_list);
1531 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); 1538 spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
1532
1533 /*
1534 * See _wait_for_commands_to_complete() call with regards to this code.
1535 */
1536 if (ioc->shost_recovery && ioc->pending_io_count) {
1537 if (ioc->pending_io_count == 1)
1538 wake_up(&ioc->reset_wq);
1539 ioc->pending_io_count--;
1540 }
1541} 1539}
1542 1540
1543/** 1541/**
@@ -1725,6 +1723,31 @@ _base_display_dell_branding(struct MPT2SAS_ADAPTER *ioc)
1725} 1723}
1726 1724
1727/** 1725/**
1726 * _base_display_intel_branding - Display branding string
1727 * @ioc: per adapter object
1728 *
1729 * Return nothing.
1730 */
1731static void
1732_base_display_intel_branding(struct MPT2SAS_ADAPTER *ioc)
1733{
1734 if (ioc->pdev->subsystem_vendor == PCI_VENDOR_ID_INTEL &&
1735 ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2008) {
1736
1737 switch (ioc->pdev->subsystem_device) {
1738 case MPT2SAS_INTEL_RMS2LL080_SSDID:
1739 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
1740 MPT2SAS_INTEL_RMS2LL080_BRANDING);
1741 break;
1742 case MPT2SAS_INTEL_RMS2LL040_SSDID:
1743 printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
1744 MPT2SAS_INTEL_RMS2LL040_BRANDING);
1745 break;
1746 }
1747 }
1748}
1749
1750/**
1728 * _base_display_ioc_capabilities - Disply IOC's capabilities. 1751 * _base_display_ioc_capabilities - Disply IOC's capabilities.
1729 * @ioc: per adapter object 1752 * @ioc: per adapter object
1730 * 1753 *
@@ -1754,6 +1777,7 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc)
1754 ioc->bios_pg3.BiosVersion & 0x000000FF); 1777 ioc->bios_pg3.BiosVersion & 0x000000FF);
1755 1778
1756 _base_display_dell_branding(ioc); 1779 _base_display_dell_branding(ioc);
1780 _base_display_intel_branding(ioc);
1757 1781
1758 printk(MPT2SAS_INFO_FMT "Protocol=(", ioc->name); 1782 printk(MPT2SAS_INFO_FMT "Protocol=(", ioc->name);
1759 1783
@@ -2252,9 +2276,9 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
2252 ioc->name, (unsigned long long) ioc->request_dma)); 2276 ioc->name, (unsigned long long) ioc->request_dma));
2253 total_sz += sz; 2277 total_sz += sz;
2254 2278
2255 sz = ioc->scsiio_depth * sizeof(struct request_tracker); 2279 sz = ioc->scsiio_depth * sizeof(struct scsiio_tracker);
2256 ioc->scsi_lookup_pages = get_order(sz); 2280 ioc->scsi_lookup_pages = get_order(sz);
2257 ioc->scsi_lookup = (struct request_tracker *)__get_free_pages( 2281 ioc->scsi_lookup = (struct scsiio_tracker *)__get_free_pages(
2258 GFP_KERNEL, ioc->scsi_lookup_pages); 2282 GFP_KERNEL, ioc->scsi_lookup_pages);
2259 if (!ioc->scsi_lookup) { 2283 if (!ioc->scsi_lookup) {
2260 printk(MPT2SAS_ERR_FMT "scsi_lookup: get_free_pages failed, " 2284 printk(MPT2SAS_ERR_FMT "scsi_lookup: get_free_pages failed, "