aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mvsas
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-28 19:44:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-28 19:44:18 -0400
commitec7ae517537ae5c7b0b2cd7f562dfa3e7a05b954 (patch)
treee6b0c64a51a7c0aa0efd09d4f7a80872e3b1657a /drivers/scsi/mvsas
parent97d2eb13a019ec09cc1a7ea2d3705c0b117b3c0d (diff)
parent590134fa78fbdbe5fea78c7ae0b2c3364bc9572f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (204 commits) [SCSI] qla4xxx: export address/port of connection (fix udev disk names) [SCSI] ipr: Fix BUG on adapter dump timeout [SCSI] megaraid_sas: Fix instance access in megasas_reset_timer [SCSI] hpsa: change confusing message to be more clear [SCSI] iscsi class: fix vlan configuration [SCSI] qla4xxx: fix data alignment and use nl helpers [SCSI] iscsi class: fix link local mispelling [SCSI] iscsi class: Replace iscsi_get_next_target_id with IDA [SCSI] aacraid: use lower snprintf() limit [SCSI] lpfc 8.3.27: Change driver version to 8.3.27 [SCSI] lpfc 8.3.27: T10 additions for SLI4 [SCSI] lpfc 8.3.27: Fix queue allocation failure recovery [SCSI] lpfc 8.3.27: Change algorithm for getting physical port name [SCSI] lpfc 8.3.27: Changed worst case mailbox timeout [SCSI] lpfc 8.3.27: Miscellanous logic and interface fixes [SCSI] megaraid_sas: Changelog and version update [SCSI] megaraid_sas: Add driver workaround for PERC5/1068 kdump kernel panic [SCSI] megaraid_sas: Add multiple MSI-X vector/multiple reply queue support [SCSI] megaraid_sas: Add support for MegaRAID 9360/9380 12GB/s controllers [SCSI] megaraid_sas: Clear FUSION_IN_RESET before enabling interrupts ...
Diffstat (limited to 'drivers/scsi/mvsas')
-rw-r--r--drivers/scsi/mvsas/mv_94xx.c35
-rw-r--r--drivers/scsi/mvsas/mv_defs.h2
-rw-r--r--drivers/scsi/mvsas/mv_init.c13
-rw-r--r--drivers/scsi/mvsas/mv_sas.c79
-rw-r--r--drivers/scsi/mvsas/mv_sas.h4
5 files changed, 68 insertions, 65 deletions
diff --git a/drivers/scsi/mvsas/mv_94xx.c b/drivers/scsi/mvsas/mv_94xx.c
index 3501291618fd..7e423e5ad5e1 100644
--- a/drivers/scsi/mvsas/mv_94xx.c
+++ b/drivers/scsi/mvsas/mv_94xx.c
@@ -398,6 +398,16 @@ static int __devinit mvs_94xx_init(struct mvs_info *mvi)
398 /* init phys */ 398 /* init phys */
399 mvs_phy_hacks(mvi); 399 mvs_phy_hacks(mvi);
400 400
401 /* disable non data frame retry */
402 tmp = mvs_cr32(mvi, CMD_SAS_CTL1);
403 if ((revision == VANIR_A0_REV) ||
404 (revision == VANIR_B0_REV) ||
405 (revision == VANIR_C0_REV)) {
406 tmp &= ~0xffff;
407 tmp |= 0x007f;
408 mvs_cw32(mvi, CMD_SAS_CTL1, tmp);
409 }
410
401 /* set LED blink when IO*/ 411 /* set LED blink when IO*/
402 mw32(MVS_PA_VSR_ADDR, VSR_PHY_ACT_LED); 412 mw32(MVS_PA_VSR_ADDR, VSR_PHY_ACT_LED);
403 tmp = mr32(MVS_PA_VSR_PORT); 413 tmp = mr32(MVS_PA_VSR_PORT);
@@ -500,6 +510,27 @@ static int __devinit mvs_94xx_init(struct mvs_info *mvi)
500 tmp |= CINT_PHY_MASK; 510 tmp |= CINT_PHY_MASK;
501 mw32(MVS_INT_MASK, tmp); 511 mw32(MVS_INT_MASK, tmp);
502 512
513 tmp = mvs_cr32(mvi, CMD_LINK_TIMER);
514 tmp |= 0xFFFF0000;
515 mvs_cw32(mvi, CMD_LINK_TIMER, tmp);
516
517 /* tune STP performance */
518 tmp = 0x003F003F;
519 mvs_cw32(mvi, CMD_PL_TIMER, tmp);
520
521 /* This can improve expander large block size seq write performance */
522 tmp = mvs_cr32(mvi, CMD_PORT_LAYER_TIMER1);
523 tmp |= 0xFFFF007F;
524 mvs_cw32(mvi, CMD_PORT_LAYER_TIMER1, tmp);
525
526 /* change the connection open-close behavior (bit 9)
527 * set bit8 to 1 for performance tuning */
528 tmp = mvs_cr32(mvi, CMD_SL_MODE0);
529 tmp |= 0x00000300;
530 /* set bit0 to 0 to enable retry for no_dest reject case */
531 tmp &= 0xFFFFFFFE;
532 mvs_cw32(mvi, CMD_SL_MODE0, tmp);
533
503 /* Enable SRS interrupt */ 534 /* Enable SRS interrupt */
504 mw32(MVS_INT_MASK_SRS_0, 0xFFFF); 535 mw32(MVS_INT_MASK_SRS_0, 0xFFFF);
505 536
@@ -823,6 +854,10 @@ static void mvs_94xx_fix_phy_info(struct mvs_info *mvi, int i,
823 phy->att_dev_info = PORT_DEV_STP_TRGT | 1; 854 phy->att_dev_info = PORT_DEV_STP_TRGT | 1;
824 } 855 }
825 856
857 /* enable spin up bit */
858 mvs_write_port_cfg_addr(mvi, i, PHYR_PHY_STAT);
859 mvs_write_port_cfg_data(mvi, i, 0x04);
860
826} 861}
827 862
828void mvs_94xx_phy_set_link_rate(struct mvs_info *mvi, u32 phy_id, 863void mvs_94xx_phy_set_link_rate(struct mvs_info *mvi, u32 phy_id,
diff --git a/drivers/scsi/mvsas/mv_defs.h b/drivers/scsi/mvsas/mv_defs.h
index dec7cadb7485..f5451940d289 100644
--- a/drivers/scsi/mvsas/mv_defs.h
+++ b/drivers/scsi/mvsas/mv_defs.h
@@ -387,6 +387,8 @@ enum sas_cmd_port_registers {
387 CMD_SL_MODE0 = 0x1BC, /* SL Mode 0 */ 387 CMD_SL_MODE0 = 0x1BC, /* SL Mode 0 */
388 CMD_SL_MODE1 = 0x1C0, /* SL Mode 1 */ 388 CMD_SL_MODE1 = 0x1C0, /* SL Mode 1 */
389 CMD_PND_FIFO_CTL1 = 0x1C4, /* Pending FIFO Control 1 */ 389 CMD_PND_FIFO_CTL1 = 0x1C4, /* Pending FIFO Control 1 */
390 CMD_PORT_LAYER_TIMER1 = 0x1E0, /* Port Layer Timer 1 */
391 CMD_LINK_TIMER = 0x1E4, /* Link Timer */
390}; 392};
391 393
392enum mvs_info_flags { 394enum mvs_info_flags {
diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c
index 4e9af66fd1d3..621b5e072758 100644
--- a/drivers/scsi/mvsas/mv_init.c
+++ b/drivers/scsi/mvsas/mv_init.c
@@ -59,7 +59,7 @@ static struct scsi_host_template mvs_sht = {
59 .name = DRV_NAME, 59 .name = DRV_NAME,
60 .queuecommand = sas_queuecommand, 60 .queuecommand = sas_queuecommand,
61 .target_alloc = sas_target_alloc, 61 .target_alloc = sas_target_alloc,
62 .slave_configure = mvs_slave_configure, 62 .slave_configure = sas_slave_configure,
63 .slave_destroy = sas_slave_destroy, 63 .slave_destroy = sas_slave_destroy,
64 .scan_finished = mvs_scan_finished, 64 .scan_finished = mvs_scan_finished,
65 .scan_start = mvs_scan_start, 65 .scan_start = mvs_scan_start,
@@ -74,7 +74,7 @@ static struct scsi_host_template mvs_sht = {
74 .use_clustering = ENABLE_CLUSTERING, 74 .use_clustering = ENABLE_CLUSTERING,
75 .eh_device_reset_handler = sas_eh_device_reset_handler, 75 .eh_device_reset_handler = sas_eh_device_reset_handler,
76 .eh_bus_reset_handler = sas_eh_bus_reset_handler, 76 .eh_bus_reset_handler = sas_eh_bus_reset_handler,
77 .slave_alloc = mvs_slave_alloc, 77 .slave_alloc = sas_slave_alloc,
78 .target_destroy = sas_target_destroy, 78 .target_destroy = sas_target_destroy,
79 .ioctl = sas_ioctl, 79 .ioctl = sas_ioctl,
80 .shost_attrs = mvst_host_attrs, 80 .shost_attrs = mvst_host_attrs,
@@ -707,6 +707,15 @@ static struct pci_device_id __devinitdata mvs_pci_table[] = {
707 { PCI_VDEVICE(TTI, 0x2760), chip_9480 }, 707 { PCI_VDEVICE(TTI, 0x2760), chip_9480 },
708 { 708 {
709 .vendor = 0x1b4b, 709 .vendor = 0x1b4b,
710 .device = 0x9480,
711 .subvendor = PCI_ANY_ID,
712 .subdevice = 0x9480,
713 .class = 0,
714 .class_mask = 0,
715 .driver_data = chip_9480,
716 },
717 {
718 .vendor = 0x1b4b,
710 .device = 0x9445, 719 .device = 0x9445,
711 .subvendor = PCI_ANY_ID, 720 .subvendor = PCI_ANY_ID,
712 .subdevice = 0x9480, 721 .subdevice = 0x9480,
diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index 4958fefff365..a4884a57cf79 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -214,7 +214,7 @@ int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
214 break; 214 break;
215 case PHY_FUNC_RELEASE_SPINUP_HOLD: 215 case PHY_FUNC_RELEASE_SPINUP_HOLD:
216 default: 216 default:
217 rc = -EOPNOTSUPP; 217 rc = -ENOSYS;
218 } 218 }
219 msleep(200); 219 msleep(200);
220 return rc; 220 return rc;
@@ -265,6 +265,12 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i)
265 id->dev_type = phy->identify.device_type; 265 id->dev_type = phy->identify.device_type;
266 id->initiator_bits = SAS_PROTOCOL_ALL; 266 id->initiator_bits = SAS_PROTOCOL_ALL;
267 id->target_bits = phy->identify.target_port_protocols; 267 id->target_bits = phy->identify.target_port_protocols;
268
269 /* direct attached SAS device */
270 if (phy->att_dev_info & PORT_SSP_TRGT_MASK) {
271 MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_PHY_STAT);
272 MVS_CHIP_DISP->write_port_cfg_data(mvi, i, 0x00);
273 }
268 } else if (phy->phy_type & PORT_TYPE_SATA) { 274 } else if (phy->phy_type & PORT_TYPE_SATA) {
269 /*Nothing*/ 275 /*Nothing*/
270 } 276 }
@@ -276,36 +282,6 @@ static void mvs_bytes_dmaed(struct mvs_info *mvi, int i)
276 PORTE_BYTES_DMAED); 282 PORTE_BYTES_DMAED);
277} 283}
278 284
279int mvs_slave_alloc(struct scsi_device *scsi_dev)
280{
281 struct domain_device *dev = sdev_to_domain_dev(scsi_dev);
282 if (dev_is_sata(dev)) {
283 /* We don't need to rescan targets
284 * if REPORT_LUNS request is failed
285 */
286 if (scsi_dev->lun > 0)
287 return -ENXIO;
288 scsi_dev->tagged_supported = 1;
289 }
290
291 return sas_slave_alloc(scsi_dev);
292}
293
294int mvs_slave_configure(struct scsi_device *sdev)
295{
296 struct domain_device *dev = sdev_to_domain_dev(sdev);
297 int ret = sas_slave_configure(sdev);
298
299 if (ret)
300 return ret;
301 if (!dev_is_sata(dev)) {
302 sas_change_queue_depth(sdev,
303 MVS_QUEUE_SIZE,
304 SCSI_QDEPTH_DEFAULT);
305 }
306 return 0;
307}
308
309void mvs_scan_start(struct Scsi_Host *shost) 285void mvs_scan_start(struct Scsi_Host *shost)
310{ 286{
311 int i, j; 287 int i, j;
@@ -426,7 +402,7 @@ static int mvs_task_prep_smp(struct mvs_info *mvi,
426 /* generate open address frame hdr (first 12 bytes) */ 402 /* generate open address frame hdr (first 12 bytes) */
427 /* initiator, SMP, ftype 1h */ 403 /* initiator, SMP, ftype 1h */
428 buf_oaf[0] = (1 << 7) | (PROTOCOL_SMP << 4) | 0x01; 404 buf_oaf[0] = (1 << 7) | (PROTOCOL_SMP << 4) | 0x01;
429 buf_oaf[1] = dev->linkrate & 0xf; 405 buf_oaf[1] = min(sas_port->linkrate, dev->linkrate) & 0xf;
430 *(u16 *)(buf_oaf + 2) = 0xFFFF; /* SAS SPEC */ 406 *(u16 *)(buf_oaf + 2) = 0xFFFF; /* SAS SPEC */
431 memcpy(buf_oaf + 4, dev->sas_addr, SAS_ADDR_SIZE); 407 memcpy(buf_oaf + 4, dev->sas_addr, SAS_ADDR_SIZE);
432 408
@@ -571,7 +547,7 @@ static int mvs_task_prep_ata(struct mvs_info *mvi,
571 /* generate open address frame hdr (first 12 bytes) */ 547 /* generate open address frame hdr (first 12 bytes) */
572 /* initiator, STP, ftype 1h */ 548 /* initiator, STP, ftype 1h */
573 buf_oaf[0] = (1 << 7) | (PROTOCOL_STP << 4) | 0x1; 549 buf_oaf[0] = (1 << 7) | (PROTOCOL_STP << 4) | 0x1;
574 buf_oaf[1] = dev->linkrate & 0xf; 550 buf_oaf[1] = min(sas_port->linkrate, dev->linkrate) & 0xf;
575 *(u16 *)(buf_oaf + 2) = cpu_to_be16(mvi_dev->device_id + 1); 551 *(u16 *)(buf_oaf + 2) = cpu_to_be16(mvi_dev->device_id + 1);
576 memcpy(buf_oaf + 4, dev->sas_addr, SAS_ADDR_SIZE); 552 memcpy(buf_oaf + 4, dev->sas_addr, SAS_ADDR_SIZE);
577 553
@@ -679,7 +655,7 @@ static int mvs_task_prep_ssp(struct mvs_info *mvi,
679 /* generate open address frame hdr (first 12 bytes) */ 655 /* generate open address frame hdr (first 12 bytes) */
680 /* initiator, SSP, ftype 1h */ 656 /* initiator, SSP, ftype 1h */
681 buf_oaf[0] = (1 << 7) | (PROTOCOL_SSP << 4) | 0x1; 657 buf_oaf[0] = (1 << 7) | (PROTOCOL_SSP << 4) | 0x1;
682 buf_oaf[1] = dev->linkrate & 0xf; 658 buf_oaf[1] = min(sas_port->linkrate, dev->linkrate) & 0xf;
683 *(u16 *)(buf_oaf + 2) = cpu_to_be16(mvi_dev->device_id + 1); 659 *(u16 *)(buf_oaf + 2) = cpu_to_be16(mvi_dev->device_id + 1);
684 memcpy(buf_oaf + 4, dev->sas_addr, SAS_ADDR_SIZE); 660 memcpy(buf_oaf + 4, dev->sas_addr, SAS_ADDR_SIZE);
685 661
@@ -1241,6 +1217,12 @@ static void mvs_port_notify_formed(struct asd_sas_phy *sas_phy, int lock)
1241 port->wide_port_phymap = sas_port->phy_mask; 1217 port->wide_port_phymap = sas_port->phy_mask;
1242 mv_printk("set wide port phy map %x\n", sas_port->phy_mask); 1218 mv_printk("set wide port phy map %x\n", sas_port->phy_mask);
1243 mvs_update_wideport(mvi, sas_phy->id); 1219 mvs_update_wideport(mvi, sas_phy->id);
1220
1221 /* direct attached SAS device */
1222 if (phy->att_dev_info & PORT_SSP_TRGT_MASK) {
1223 MVS_CHIP_DISP->write_port_cfg_addr(mvi, i, PHYR_PHY_STAT);
1224 MVS_CHIP_DISP->write_port_cfg_data(mvi, i, 0x04);
1225 }
1244 } 1226 }
1245 if (lock) 1227 if (lock)
1246 spin_unlock_irqrestore(&mvi->lock, flags); 1228 spin_unlock_irqrestore(&mvi->lock, flags);
@@ -1387,28 +1369,6 @@ void mvs_dev_gone(struct domain_device *dev)
1387 mvs_dev_gone_notify(dev); 1369 mvs_dev_gone_notify(dev);
1388} 1370}
1389 1371
1390static struct sas_task *mvs_alloc_task(void)
1391{
1392 struct sas_task *task = kzalloc(sizeof(struct sas_task), GFP_KERNEL);
1393
1394 if (task) {
1395 INIT_LIST_HEAD(&task->list);
1396 spin_lock_init(&task->task_state_lock);
1397 task->task_state_flags = SAS_TASK_STATE_PENDING;
1398 init_timer(&task->timer);
1399 init_completion(&task->completion);
1400 }
1401 return task;
1402}
1403
1404static void mvs_free_task(struct sas_task *task)
1405{
1406 if (task) {
1407 BUG_ON(!list_empty(&task->list));
1408 kfree(task);
1409 }
1410}
1411
1412static void mvs_task_done(struct sas_task *task) 1372static void mvs_task_done(struct sas_task *task)
1413{ 1373{
1414 if (!del_timer(&task->timer)) 1374 if (!del_timer(&task->timer))
@@ -1432,7 +1392,7 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,
1432 struct sas_task *task = NULL; 1392 struct sas_task *task = NULL;
1433 1393
1434 for (retry = 0; retry < 3; retry++) { 1394 for (retry = 0; retry < 3; retry++) {
1435 task = mvs_alloc_task(); 1395 task = sas_alloc_task(GFP_KERNEL);
1436 if (!task) 1396 if (!task)
1437 return -ENOMEM; 1397 return -ENOMEM;
1438 1398
@@ -1490,15 +1450,14 @@ static int mvs_exec_internal_tmf_task(struct domain_device *dev,
1490 SAS_ADDR(dev->sas_addr), 1450 SAS_ADDR(dev->sas_addr),
1491 task->task_status.resp, 1451 task->task_status.resp,
1492 task->task_status.stat); 1452 task->task_status.stat);
1493 mvs_free_task(task); 1453 sas_free_task(task);
1494 task = NULL; 1454 task = NULL;
1495 1455
1496 } 1456 }
1497 } 1457 }
1498ex_err: 1458ex_err:
1499 BUG_ON(retry == 3 && task != NULL); 1459 BUG_ON(retry == 3 && task != NULL);
1500 if (task != NULL) 1460 sas_free_task(task);
1501 mvs_free_task(task);
1502 return res; 1461 return res;
1503} 1462}
1504 1463
diff --git a/drivers/scsi/mvsas/mv_sas.h b/drivers/scsi/mvsas/mv_sas.h
index 44b474513223..c04a4f5b5972 100644
--- a/drivers/scsi/mvsas/mv_sas.h
+++ b/drivers/scsi/mvsas/mv_sas.h
@@ -46,7 +46,7 @@
46#include "mv_defs.h" 46#include "mv_defs.h"
47 47
48#define DRV_NAME "mvsas" 48#define DRV_NAME "mvsas"
49#define DRV_VERSION "0.8.2" 49#define DRV_VERSION "0.8.16"
50#define MVS_ID_NOT_MAPPED 0x7f 50#define MVS_ID_NOT_MAPPED 0x7f
51#define WIDE_PORT_MAX_PHY 4 51#define WIDE_PORT_MAX_PHY 4
52#define mv_printk(fmt, arg ...) \ 52#define mv_printk(fmt, arg ...) \
@@ -458,8 +458,6 @@ int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
458 void *funcdata); 458 void *funcdata);
459void __devinit mvs_set_sas_addr(struct mvs_info *mvi, int port_id, 459void __devinit mvs_set_sas_addr(struct mvs_info *mvi, int port_id,
460 u32 off_lo, u32 off_hi, u64 sas_addr); 460 u32 off_lo, u32 off_hi, u64 sas_addr);
461int mvs_slave_alloc(struct scsi_device *scsi_dev);
462int mvs_slave_configure(struct scsi_device *sdev);
463void mvs_scan_start(struct Scsi_Host *shost); 461void mvs_scan_start(struct Scsi_Host *shost);
464int mvs_scan_finished(struct Scsi_Host *shost, unsigned long time); 462int mvs_scan_finished(struct Scsi_Host *shost, unsigned long time);
465int mvs_queue_command(struct sas_task *task, const int num, 463int mvs_queue_command(struct sas_task *task, const int num,