aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/aha152x.c85
-rw-r--r--drivers/scsi/aha152x.h2
-rw-r--r--drivers/scsi/ahci.c14
-rw-r--r--drivers/scsi/jazz_esp.c21
-rw-r--r--drivers/scsi/libata-core.c4
-rw-r--r--drivers/scsi/libata-scsi.c2
-rw-r--r--drivers/scsi/libata.h1
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c29
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c4
-rw-r--r--drivers/scsi/sata_sil.c52
-rw-r--r--drivers/scsi/scsi_error.c4
-rw-r--r--drivers/scsi/scsi_lib.c2
-rw-r--r--drivers/scsi/scsi_scan.c16
-rw-r--r--drivers/scsi/scsi_transport_fc.c3
-rw-r--r--drivers/scsi/sg.c2
-rw-r--r--drivers/scsi/sr_ioctl.c2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c2
17 files changed, 145 insertions, 100 deletions
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 67d78ed7119a..de80cdfb5b9d 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -1260,16 +1260,15 @@ static void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs)
1260 * Reset the bus 1260 * Reset the bus
1261 * 1261 *
1262 */ 1262 */
1263static int aha152x_bus_reset(Scsi_Cmnd *SCpnt) 1263static int aha152x_bus_reset_host(struct Scsi_Host *shpnt)
1264{ 1264{
1265 struct Scsi_Host *shpnt = SCpnt->device->host;
1266 unsigned long flags; 1265 unsigned long flags;
1267 1266
1268 DO_LOCK(flags); 1267 DO_LOCK(flags);
1269 1268
1270#if defined(AHA152X_DEBUG) 1269#if defined(AHA152X_DEBUG)
1271 if(HOSTDATA(shpnt)->debug & debug_eh) { 1270 if(HOSTDATA(shpnt)->debug & debug_eh) {
1272 printk(DEBUG_LEAD "aha152x_bus_reset(%p)", CMDINFO(SCpnt), SCpnt); 1271 printk(KERN_DEBUG "scsi%d: bus reset", shpnt->host_no);
1273 show_queues(shpnt); 1272 show_queues(shpnt);
1274 } 1273 }
1275#endif 1274#endif
@@ -1277,14 +1276,14 @@ static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
1277 free_hard_reset_SCs(shpnt, &ISSUE_SC); 1276 free_hard_reset_SCs(shpnt, &ISSUE_SC);
1278 free_hard_reset_SCs(shpnt, &DISCONNECTED_SC); 1277 free_hard_reset_SCs(shpnt, &DISCONNECTED_SC);
1279 1278
1280 DPRINTK(debug_eh, DEBUG_LEAD "resetting bus\n", CMDINFO(SCpnt)); 1279 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: resetting bus\n", shpnt->host_no);
1281 1280
1282 SETPORT(SCSISEQ, SCSIRSTO); 1281 SETPORT(SCSISEQ, SCSIRSTO);
1283 mdelay(256); 1282 mdelay(256);
1284 SETPORT(SCSISEQ, 0); 1283 SETPORT(SCSISEQ, 0);
1285 mdelay(DELAY); 1284 mdelay(DELAY);
1286 1285
1287 DPRINTK(debug_eh, DEBUG_LEAD "bus resetted\n", CMDINFO(SCpnt)); 1286 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: bus resetted\n", shpnt->host_no);
1288 1287
1289 setup_expected_interrupts(shpnt); 1288 setup_expected_interrupts(shpnt);
1290 if(HOSTDATA(shpnt)->commands==0) 1289 if(HOSTDATA(shpnt)->commands==0)
@@ -1295,6 +1294,14 @@ static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
1295 return SUCCESS; 1294 return SUCCESS;
1296} 1295}
1297 1296
1297/*
1298 * Reset the bus
1299 *
1300 */
1301static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
1302{
1303 return aha152x_bus_reset_host(SCpnt->device->host);
1304}
1298 1305
1299/* 1306/*
1300 * Restore default values to the AIC-6260 registers and reset the fifos 1307 * Restore default values to the AIC-6260 registers and reset the fifos
@@ -1337,23 +1344,28 @@ static void reset_ports(struct Scsi_Host *shpnt)
1337 * Reset the host (bus and controller) 1344 * Reset the host (bus and controller)
1338 * 1345 *
1339 */ 1346 */
1340int aha152x_host_reset(Scsi_Cmnd * SCpnt) 1347int aha152x_host_reset_host(struct Scsi_Host *shpnt)
1341{ 1348{
1342#if defined(AHA152X_DEBUG) 1349 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: host reset\n", shpnt->host_no);
1343 struct Scsi_Host *shpnt = SCpnt->device->host;
1344#endif
1345
1346 DPRINTK(debug_eh, DEBUG_LEAD "aha152x_host_reset(%p)\n", CMDINFO(SCpnt), SCpnt);
1347 1350
1348 aha152x_bus_reset(SCpnt); 1351 aha152x_bus_reset_host(shpnt);
1349 1352
1350 DPRINTK(debug_eh, DEBUG_LEAD "resetting ports\n", CMDINFO(SCpnt)); 1353 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: resetting ports\n", shpnt->host_no);
1351 reset_ports(SCpnt->device->host); 1354 reset_ports(shpnt);
1352 1355
1353 return SUCCESS; 1356 return SUCCESS;
1354} 1357}
1355 1358
1356/* 1359/*
1360 * Reset the host (bus and controller)
1361 *
1362 */
1363static int aha152x_host_reset(Scsi_Cmnd *SCpnt)
1364{
1365 return aha152x_host_reset_host(SCpnt->device->host);
1366}
1367
1368/*
1357 * Return the "logical geometry" 1369 * Return the "logical geometry"
1358 * 1370 *
1359 */ 1371 */
@@ -1431,22 +1443,18 @@ static void run(void)
1431{ 1443{
1432 int i; 1444 int i;
1433 for (i = 0; i<ARRAY_SIZE(aha152x_host); i++) { 1445 for (i = 0; i<ARRAY_SIZE(aha152x_host); i++) {
1434 struct Scsi_Host *shpnt = aha152x_host[i]; 1446 is_complete(aha152x_host[i]);
1435 if (shpnt && HOSTDATA(shpnt)->service) {
1436 HOSTDATA(shpnt)->service=0;
1437 is_complete(shpnt);
1438 }
1439 } 1447 }
1440} 1448}
1441 1449
1442/* 1450/*
1443 * Interrupts handler 1451 * Interrupt handler
1444 * 1452 *
1445 */ 1453 */
1446
1447static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs) 1454static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs)
1448{ 1455{
1449 struct Scsi_Host *shpnt = lookup_irq(irqno); 1456 struct Scsi_Host *shpnt = lookup_irq(irqno);
1457 unsigned long flags;
1450 unsigned char rev, dmacntrl0; 1458 unsigned char rev, dmacntrl0;
1451 1459
1452 if (!shpnt) { 1460 if (!shpnt) {
@@ -1472,23 +1480,23 @@ static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs)
1472 if ((rev == 0xFF) && (dmacntrl0 == 0xFF)) 1480 if ((rev == 0xFF) && (dmacntrl0 == 0xFF))
1473 return IRQ_NONE; 1481 return IRQ_NONE;
1474 1482
1483 if( TESTLO(DMASTAT, INTSTAT) )
1484 return IRQ_NONE;
1485
1475 /* no more interrupts from the controller, while we're busy. 1486 /* no more interrupts from the controller, while we're busy.
1476 INTEN is restored by the BH handler */ 1487 INTEN is restored by the BH handler */
1477 CLRBITS(DMACNTRL0, INTEN); 1488 CLRBITS(DMACNTRL0, INTEN);
1478 1489
1479#if 0 1490 DO_LOCK(flags);
1480 /* check if there is already something to be 1491 if( HOSTDATA(shpnt)->service==0 ) {
1481 serviced; should not happen */ 1492 HOSTDATA(shpnt)->service=1;
1482 if(HOSTDATA(shpnt)->service) { 1493
1483 printk(KERN_ERR "aha152x%d: lost interrupt (%d)\n", HOSTNO, HOSTDATA(shpnt)->service); 1494 /* Poke the BH handler */
1484 show_queues(shpnt); 1495 INIT_WORK(&aha152x_tq, (void *) run, NULL);
1496 schedule_work(&aha152x_tq);
1485 } 1497 }
1486#endif 1498 DO_UNLOCK(flags);
1487 1499
1488 /* Poke the BH handler */
1489 HOSTDATA(shpnt)->service++;
1490 INIT_WORK(&aha152x_tq, (void *) run, NULL);
1491 schedule_work(&aha152x_tq);
1492 return IRQ_HANDLED; 1500 return IRQ_HANDLED;
1493} 1501}
1494 1502
@@ -2522,7 +2530,18 @@ static void is_complete(struct Scsi_Host *shpnt)
2522 unsigned long flags; 2530 unsigned long flags;
2523 int pending; 2531 int pending;
2524 2532
2533 if(!shpnt)
2534 return;
2535
2525 DO_LOCK(flags); 2536 DO_LOCK(flags);
2537
2538 if( HOSTDATA(shpnt)->service==0 ) {
2539 DO_UNLOCK(flags);
2540 return;
2541 }
2542
2543 HOSTDATA(shpnt)->service = 0;
2544
2526 if(HOSTDATA(shpnt)->in_intr) { 2545 if(HOSTDATA(shpnt)->in_intr) {
2527 DO_UNLOCK(flags); 2546 DO_UNLOCK(flags);
2528 /* aha152x_error never returns.. */ 2547 /* aha152x_error never returns.. */
diff --git a/drivers/scsi/aha152x.h b/drivers/scsi/aha152x.h
index d277613af29b..d2add24d02a3 100644
--- a/drivers/scsi/aha152x.h
+++ b/drivers/scsi/aha152x.h
@@ -332,6 +332,6 @@ struct aha152x_setup {
332 332
333struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *); 333struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
334void aha152x_release(struct Scsi_Host *); 334void aha152x_release(struct Scsi_Host *);
335int aha152x_host_reset(Scsi_Cmnd *); 335int aha152x_host_reset_host(struct Scsi_Host *);
336 336
337#endif /* _AHA152X_H */ 337#endif /* _AHA152X_H */
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index a800fb51168b..559ff7aae3f1 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -742,23 +742,17 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *
742 struct ata_queued_cmd *qc; 742 struct ata_queued_cmd *qc;
743 qc = ata_qc_from_tag(ap, ap->active_tag); 743 qc = ata_qc_from_tag(ap, ap->active_tag);
744 if (!ahci_host_intr(ap, qc)) 744 if (!ahci_host_intr(ap, qc))
745 if (ata_ratelimit()) { 745 if (ata_ratelimit())
746 struct pci_dev *pdev = 746 dev_printk(KERN_WARNING, host_set->dev,
747 to_pci_dev(ap->host_set->dev);
748 dev_printk(KERN_WARNING, &pdev->dev,
749 "unhandled interrupt on port %u\n", 747 "unhandled interrupt on port %u\n",
750 i); 748 i);
751 }
752 749
753 VPRINTK("port %u\n", i); 750 VPRINTK("port %u\n", i);
754 } else { 751 } else {
755 VPRINTK("port %u (no irq)\n", i); 752 VPRINTK("port %u (no irq)\n", i);
756 if (ata_ratelimit()) { 753 if (ata_ratelimit())
757 struct pci_dev *pdev = 754 dev_printk(KERN_WARNING, host_set->dev,
758 to_pci_dev(ap->host_set->dev);
759 dev_printk(KERN_WARNING, &pdev->dev,
760 "interrupt on disabled port %u\n", i); 755 "interrupt on disabled port %u\n", i);
761 }
762 } 756 }
763 757
764 irq_ack |= (1 << i); 758 irq_ack |= (1 << i);
diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c
index a07e930a9c04..fc031c76dade 100644
--- a/drivers/scsi/jazz_esp.c
+++ b/drivers/scsi/jazz_esp.c
@@ -64,27 +64,6 @@ static int jazz_esp_release(struct Scsi_Host *shost)
64 return 0; 64 return 0;
65} 65}
66 66
67static struct scsi_host_template driver_template = {
68 .proc_name = "jazz_esp",
69 .proc_info = &esp_proc_info,
70 .name = "ESP 100/100a/200",
71 .detect = jazz_esp_detect,
72 .slave_alloc = esp_slave_alloc,
73 .slave_destroy = esp_slave_destroy,
74 .release = jazz_esp_release,
75 .info = esp_info,
76 .queuecommand = esp_queue,
77 .eh_abort_handler = esp_abort,
78 .eh_bus_reset_handler = esp_reset,
79 .can_queue = 7,
80 .this_id = 7,
81 .sg_tablesize = SG_ALL,
82 .cmd_per_lun = 1,
83 .use_clustering = DISABLE_CLUSTERING,
84};
85
86#include "scsi_module.c"
87
88/***************************************************************** Detection */ 67/***************************************************************** Detection */
89static int jazz_esp_detect(struct scsi_host_template *tpnt) 68static int jazz_esp_detect(struct scsi_host_template *tpnt)
90{ 69{
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 5f1d7580218d..4f91b0dc572b 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -82,6 +82,10 @@ int atapi_enabled = 0;
82module_param(atapi_enabled, int, 0444); 82module_param(atapi_enabled, int, 0444);
83MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)"); 83MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)");
84 84
85int libata_fua = 0;
86module_param_named(fua, libata_fua, int, 0444);
87MODULE_PARM_DESC(fua, "FUA support (0=off, 1=on)");
88
85MODULE_AUTHOR("Jeff Garzik"); 89MODULE_AUTHOR("Jeff Garzik");
86MODULE_DESCRIPTION("Library module for ATA devices"); 90MODULE_DESCRIPTION("Library module for ATA devices");
87MODULE_LICENSE("GPL"); 91MODULE_LICENSE("GPL");
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 07b1e7cc61df..59503c9ccac9 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -1708,6 +1708,8 @@ static int ata_dev_supports_fua(u16 *id)
1708{ 1708{
1709 unsigned char model[41], fw[9]; 1709 unsigned char model[41], fw[9];
1710 1710
1711 if (!libata_fua)
1712 return 0;
1711 if (!ata_id_has_fua(id)) 1713 if (!ata_id_has_fua(id))
1712 return 0; 1714 return 0;
1713 1715
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index e03ce48b7b4b..fddaf479a544 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -41,6 +41,7 @@ struct ata_scsi_args {
41 41
42/* libata-core.c */ 42/* libata-core.c */
43extern int atapi_enabled; 43extern int atapi_enabled;
44extern int libata_fua;
44extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, 45extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
45 struct ata_device *dev); 46 struct ata_device *dev);
46extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc); 47extern int ata_rwcmd_protocol(struct ata_queued_cmd *qc);
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 7de267e14458..4f39dd01936d 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -793,6 +793,20 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
793 return 0; 793 return 0;
794} 794}
795 795
796static int megasas_slave_configure(struct scsi_device *sdev)
797{
798 /*
799 * Don't export physical disk devices to the disk driver.
800 *
801 * FIXME: Currently we don't export them to the midlayer at all.
802 * That will be fixed once LSI engineers have audited the
803 * firmware for possible issues.
804 */
805 if (sdev->channel < MEGASAS_MAX_PD_CHANNELS && sdev->type == TYPE_DISK)
806 return -ENXIO;
807 return 0;
808}
809
796/** 810/**
797 * megasas_wait_for_outstanding - Wait for all outstanding cmds 811 * megasas_wait_for_outstanding - Wait for all outstanding cmds
798 * @instance: Adapter soft state 812 * @instance: Adapter soft state
@@ -943,6 +957,7 @@ static struct scsi_host_template megasas_template = {
943 .module = THIS_MODULE, 957 .module = THIS_MODULE,
944 .name = "LSI Logic SAS based MegaRAID driver", 958 .name = "LSI Logic SAS based MegaRAID driver",
945 .proc_name = "megaraid_sas", 959 .proc_name = "megaraid_sas",
960 .slave_configure = megasas_slave_configure,
946 .queuecommand = megasas_queue_command, 961 .queuecommand = megasas_queue_command,
947 .eh_device_reset_handler = megasas_reset_device, 962 .eh_device_reset_handler = megasas_reset_device,
948 .eh_bus_reset_handler = megasas_reset_bus_host, 963 .eh_bus_reset_handler = megasas_reset_bus_host,
@@ -1071,20 +1086,6 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
1071 break; 1086 break;
1072 } 1087 }
1073 1088
1074 /*
1075 * Don't export physical disk devices to mid-layer.
1076 */
1077 if (!MEGASAS_IS_LOGICAL(cmd->scmd) &&
1078 (hdr->cmd_status == MFI_STAT_OK) &&
1079 (cmd->scmd->cmnd[0] == INQUIRY)) {
1080
1081 if (((*(u8 *) cmd->scmd->request_buffer) & 0x1F) ==
1082 TYPE_DISK) {
1083 cmd->scmd->result = DID_BAD_TARGET << 16;
1084 exception = 1;
1085 }
1086 }
1087
1088 case MFI_CMD_LD_READ: 1089 case MFI_CMD_LD_READ:
1089 case MFI_CMD_LD_WRITE: 1090 case MFI_CMD_LD_WRITE:
1090 1091
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 0c9edb7051f4..5609847e254a 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -275,10 +275,8 @@ static int aha152x_resume(struct pcmcia_device *dev)
275 275
276 link->state &= ~DEV_SUSPEND; 276 link->state &= ~DEV_SUSPEND;
277 if (link->state & DEV_CONFIG) { 277 if (link->state & DEV_CONFIG) {
278 Scsi_Cmnd tmp;
279 pcmcia_request_configuration(link->handle, &link->conf); 278 pcmcia_request_configuration(link->handle, &link->conf);
280 tmp.device->host = info->host; 279 aha152x_host_reset_host(info->host);
281 aha152x_host_reset(&tmp);
282 } 280 }
283 281
284 return 0; 282 return 0;
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index 17f74d3c10e7..9face3c6aa21 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -49,11 +49,13 @@
49#define DRV_VERSION "0.9" 49#define DRV_VERSION "0.9"
50 50
51enum { 51enum {
52 SIL_FLAG_RERR_ON_DMA_ACT = (1 << 29),
52 SIL_FLAG_MOD15WRITE = (1 << 30), 53 SIL_FLAG_MOD15WRITE = (1 << 30),
53 54
54 sil_3112 = 0, 55 sil_3112 = 0,
55 sil_3112_m15w = 1, 56 sil_3112_m15w = 1,
56 sil_3114 = 2, 57 sil_3512 = 2,
58 sil_3114 = 3,
57 59
58 SIL_FIFO_R0 = 0x40, 60 SIL_FIFO_R0 = 0x40,
59 SIL_FIFO_W0 = 0x41, 61 SIL_FIFO_W0 = 0x41,
@@ -90,7 +92,7 @@ static void sil_post_set_mode (struct ata_port *ap);
90static const struct pci_device_id sil_pci_tbl[] = { 92static const struct pci_device_id sil_pci_tbl[] = {
91 { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, 93 { 0x1095, 0x3112, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
92 { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, 94 { 0x1095, 0x0240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
93 { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112 }, 95 { 0x1095, 0x3512, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3512 },
94 { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 }, 96 { 0x1095, 0x3114, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3114 },
95 { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, 97 { 0x1002, 0x436e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
96 { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w }, 98 { 0x1002, 0x4379, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sil_3112_m15w },
@@ -185,7 +187,8 @@ static const struct ata_port_info sil_port_info[] = {
185 .mwdma_mask = 0x07, /* mwdma0-2 */ 187 .mwdma_mask = 0x07, /* mwdma0-2 */
186 .udma_mask = 0x3f, /* udma0-5 */ 188 .udma_mask = 0x3f, /* udma0-5 */
187 .port_ops = &sil_ops, 189 .port_ops = &sil_ops,
188 }, /* sil_3112_15w - keep it sync'd w/ sil_3112 */ 190 },
191 /* sil_3112_15w - keep it sync'd w/ sil_3112 */
189 { 192 {
190 .sht = &sil_sht, 193 .sht = &sil_sht,
191 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 194 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
@@ -195,11 +198,24 @@ static const struct ata_port_info sil_port_info[] = {
195 .mwdma_mask = 0x07, /* mwdma0-2 */ 198 .mwdma_mask = 0x07, /* mwdma0-2 */
196 .udma_mask = 0x3f, /* udma0-5 */ 199 .udma_mask = 0x3f, /* udma0-5 */
197 .port_ops = &sil_ops, 200 .port_ops = &sil_ops,
198 }, /* sil_3114 */ 201 },
202 /* sil_3512 */
199 { 203 {
200 .sht = &sil_sht, 204 .sht = &sil_sht,
201 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 205 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
202 ATA_FLAG_SRST | ATA_FLAG_MMIO, 206 ATA_FLAG_SRST | ATA_FLAG_MMIO |
207 SIL_FLAG_RERR_ON_DMA_ACT,
208 .pio_mask = 0x1f, /* pio0-4 */
209 .mwdma_mask = 0x07, /* mwdma0-2 */
210 .udma_mask = 0x3f, /* udma0-5 */
211 .port_ops = &sil_ops,
212 },
213 /* sil_3114 */
214 {
215 .sht = &sil_sht,
216 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
217 ATA_FLAG_SRST | ATA_FLAG_MMIO |
218 SIL_FLAG_RERR_ON_DMA_ACT,
203 .pio_mask = 0x1f, /* pio0-4 */ 219 .pio_mask = 0x1f, /* pio0-4 */
204 .mwdma_mask = 0x07, /* mwdma0-2 */ 220 .mwdma_mask = 0x07, /* mwdma0-2 */
205 .udma_mask = 0x3f, /* udma0-5 */ 221 .udma_mask = 0x3f, /* udma0-5 */
@@ -216,12 +232,13 @@ static const struct {
216 unsigned long scr; /* SATA control register block */ 232 unsigned long scr; /* SATA control register block */
217 unsigned long sien; /* SATA Interrupt Enable register */ 233 unsigned long sien; /* SATA Interrupt Enable register */
218 unsigned long xfer_mode;/* data transfer mode register */ 234 unsigned long xfer_mode;/* data transfer mode register */
235 unsigned long sfis_cfg; /* SATA FIS reception config register */
219} sil_port[] = { 236} sil_port[] = {
220 /* port 0 ... */ 237 /* port 0 ... */
221 { 0x80, 0x8A, 0x00, 0x100, 0x148, 0xb4 }, 238 { 0x80, 0x8A, 0x00, 0x100, 0x148, 0xb4, 0x14c },
222 { 0xC0, 0xCA, 0x08, 0x180, 0x1c8, 0xf4 }, 239 { 0xC0, 0xCA, 0x08, 0x180, 0x1c8, 0xf4, 0x1cc },
223 { 0x280, 0x28A, 0x200, 0x300, 0x348, 0x2b4 }, 240 { 0x280, 0x28A, 0x200, 0x300, 0x348, 0x2b4, 0x34c },
224 { 0x2C0, 0x2CA, 0x208, 0x380, 0x3c8, 0x2f4 }, 241 { 0x2C0, 0x2CA, 0x208, 0x380, 0x3c8, 0x2f4, 0x3cc },
225 /* ... port 3 */ 242 /* ... port 3 */
226}; 243};
227 244
@@ -471,6 +488,23 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
471 dev_printk(KERN_WARNING, &pdev->dev, 488 dev_printk(KERN_WARNING, &pdev->dev,
472 "cache line size not set. Driver may not function\n"); 489 "cache line size not set. Driver may not function\n");
473 490
491 /* Apply R_ERR on DMA activate FIS errata workaround */
492 if (probe_ent->host_flags & SIL_FLAG_RERR_ON_DMA_ACT) {
493 int cnt;
494
495 for (i = 0, cnt = 0; i < probe_ent->n_ports; i++) {
496 tmp = readl(mmio_base + sil_port[i].sfis_cfg);
497 if ((tmp & 0x3) != 0x01)
498 continue;
499 if (!cnt)
500 dev_printk(KERN_INFO, &pdev->dev,
501 "Applying R_ERR on DMA activate "
502 "FIS errata fix\n");
503 writel(tmp & ~0x3, mmio_base + sil_port[i].sfis_cfg);
504 cnt++;
505 }
506 }
507
474 if (ent->driver_data == sil_3114) { 508 if (ent->driver_data == sil_3114) {
475 irq_mask = SIL_MASK_4PORT; 509 irq_mask = SIL_MASK_4PORT;
476 510
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 9cf020622134..f988418d805d 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1305,7 +1305,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
1305 * the request was not marked fast fail. Note that above, 1305 * the request was not marked fast fail. Note that above,
1306 * even if the request is marked fast fail, we still requeue 1306 * even if the request is marked fast fail, we still requeue
1307 * for queue congestion conditions (QUEUE_FULL or BUSY) */ 1307 * for queue congestion conditions (QUEUE_FULL or BUSY) */
1308 if ((++scmd->retries) < scmd->allowed 1308 if ((++scmd->retries) <= scmd->allowed
1309 && !blk_noretry_request(scmd->request)) { 1309 && !blk_noretry_request(scmd->request)) {
1310 return NEEDS_RETRY; 1310 return NEEDS_RETRY;
1311 } else { 1311 } else {
@@ -1430,7 +1430,7 @@ static void scsi_eh_flush_done_q(struct list_head *done_q)
1430 list_del_init(&scmd->eh_entry); 1430 list_del_init(&scmd->eh_entry);
1431 if (scsi_device_online(scmd->device) && 1431 if (scsi_device_online(scmd->device) &&
1432 !blk_noretry_request(scmd->request) && 1432 !blk_noretry_request(scmd->request) &&
1433 (++scmd->retries < scmd->allowed)) { 1433 (++scmd->retries <= scmd->allowed)) {
1434 SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush" 1434 SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush"
1435 " retry cmd: %p\n", 1435 " retry cmd: %p\n",
1436 current->comm, 1436 current->comm,
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 3042520c413c..9a05076f9cf4 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1497,7 +1497,7 @@ static void scsi_kill_request(struct request *req, request_queue_t *q)
1497static void scsi_softirq_done(struct request *rq) 1497static void scsi_softirq_done(struct request *rq)
1498{ 1498{
1499 struct scsi_cmnd *cmd = rq->completion_data; 1499 struct scsi_cmnd *cmd = rq->completion_data;
1500 unsigned long wait_for = cmd->allowed * cmd->timeout_per_command; 1500 unsigned long wait_for = (cmd->allowed + 1) * cmd->timeout_per_command;
1501 int disposition; 1501 int disposition;
1502 1502
1503 INIT_LIST_HEAD(&cmd->eh_entry); 1503 INIT_LIST_HEAD(&cmd->eh_entry);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 5d4ca87af3df..9cd4404cf9ab 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -775,8 +775,20 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
775 775
776 transport_configure_device(&sdev->sdev_gendev); 776 transport_configure_device(&sdev->sdev_gendev);
777 777
778 if (sdev->host->hostt->slave_configure) 778 if (sdev->host->hostt->slave_configure) {
779 sdev->host->hostt->slave_configure(sdev); 779 int ret = sdev->host->hostt->slave_configure(sdev);
780 if (ret) {
781 /*
782 * if LLDD reports slave not present, don't clutter
783 * console with alloc failure messages
784 */
785 if (ret != -ENXIO) {
786 sdev_printk(KERN_ERR, sdev,
787 "failed to configure device\n");
788 }
789 return SCSI_SCAN_NO_RESPONSE;
790 }
791 }
780 792
781 /* 793 /*
782 * Ok, the device is now all set up, we can 794 * Ok, the device is now all set up, we can
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 3c3baa9f5f28..1883fee96bd9 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -1532,8 +1532,7 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
1532 } 1532 }
1533 1533
1534 /* Search the bindings array */ 1534 /* Search the bindings array */
1535 if (likely((ids->roles & FC_RPORT_ROLE_FCP_TARGET) && 1535 if (fc_host_tgtid_bind_type(shost) != FC_TGTID_BIND_NONE) {
1536 (fc_host_tgtid_bind_type(shost) != FC_TGTID_BIND_NONE))) {
1537 1536
1538 /* search for a matching consistent binding */ 1537 /* search for a matching consistent binding */
1539 1538
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index af3fea59a456..a8b05ce5de52 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2155,7 +2155,7 @@ sg_link_reserve(Sg_fd * sfp, Sg_request * srp, int size)
2155 2155
2156 srp->res_used = 1; 2156 srp->res_used = 1;
2157 SCSI_LOG_TIMEOUT(4, printk("sg_link_reserve: size=%d\n", size)); 2157 SCSI_LOG_TIMEOUT(4, printk("sg_link_reserve: size=%d\n", size));
2158 rem = size = (size + 1) & (~1); /* round to even for aha1542 */ 2158 rem = size;
2159 2159
2160 for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) { 2160 for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) {
2161 num = sg->length; 2161 num = sg->length;
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c
index 5d02ff4db6cc..b65462f76484 100644
--- a/drivers/scsi/sr_ioctl.c
+++ b/drivers/scsi/sr_ioctl.c
@@ -192,7 +192,7 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)
192 SDev = cd->device; 192 SDev = cd->device;
193 193
194 if (!sense) { 194 if (!sense) {
195 sense = kmalloc(sizeof(*sense), GFP_KERNEL); 195 sense = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);
196 if (!sense) { 196 if (!sense) {
197 err = -ENOMEM; 197 err = -ENOMEM;
198 goto out; 198 goto out;
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 620b4726fbd9..60850cbe3a85 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -918,6 +918,8 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru
918 918
919 tp->usrflags |= (SYM_DISC_ENABLED | SYM_TAGS_ENABLED); 919 tp->usrflags |= (SYM_DISC_ENABLED | SYM_TAGS_ENABLED);
920 tp->usrtags = SYM_SETUP_MAX_TAG; 920 tp->usrtags = SYM_SETUP_MAX_TAG;
921 tp->usr_width = np->maxwide;
922 tp->usr_period = 9;
921 923
922 sym_nvram_setup_target(tp, i, nvram); 924 sym_nvram_setup_target(tp, i, nvram);
923 925