aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-04-12 16:54:43 -0400
committerJeff Garzik <jeff@garzik.org>2006-04-12 16:54:43 -0400
commita890b15c0990cc8d686edcc85f5fccde71ad5ce9 (patch)
tree73162355b58283a2531f13fbbf663809f95c1483 /drivers/scsi
parent79fa1b677be3a985cc66b9218a4dd09818f1051b (diff)
parent26ec634c31a11a003040e10b4d650495158632fd (diff)
Merge branch 'upstream'
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/3w-xxxx.c3
-rw-r--r--drivers/scsi/ahci.c45
-rw-r--r--drivers/scsi/ata_piix.c1
-rw-r--r--drivers/scsi/hosts.c12
-rw-r--r--drivers/scsi/libata-core.c126
-rw-r--r--drivers/scsi/libata-eh.c7
-rw-r--r--drivers/scsi/libata-scsi.c9
-rw-r--r--drivers/scsi/libata.h7
-rw-r--r--drivers/scsi/pdc_adma.c1
-rw-r--r--drivers/scsi/sata_mv.c1
-rw-r--r--drivers/scsi/sata_nv.c1
-rw-r--r--drivers/scsi/sata_promise.c1
-rw-r--r--drivers/scsi/sata_qstor.c1
-rw-r--r--drivers/scsi/sata_sil.c1
-rw-r--r--drivers/scsi/sata_sil24.c246
-rw-r--r--drivers/scsi/sata_sis.c1
-rw-r--r--drivers/scsi/sata_svw.c3
-rw-r--r--drivers/scsi/sata_sx4.c1
-rw-r--r--drivers/scsi/sata_uli.c1
-rw-r--r--drivers/scsi/sata_via.c1
-rw-r--r--drivers/scsi/sata_vsc.c1
-rw-r--r--drivers/scsi/scsi_error.c4
22 files changed, 276 insertions, 198 deletions
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index 25f678d0780b..e8e41e6eb42a 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -1508,10 +1508,12 @@ static void tw_transfer_internal(TW_Device_Extension *tw_dev, int request_id,
1508 struct scsi_cmnd *cmd = tw_dev->srb[request_id]; 1508 struct scsi_cmnd *cmd = tw_dev->srb[request_id];
1509 void *buf; 1509 void *buf;
1510 unsigned int transfer_len; 1510 unsigned int transfer_len;
1511 unsigned long flags = 0;
1511 1512
1512 if (cmd->use_sg) { 1513 if (cmd->use_sg) {
1513 struct scatterlist *sg = 1514 struct scatterlist *sg =
1514 (struct scatterlist *)cmd->request_buffer; 1515 (struct scatterlist *)cmd->request_buffer;
1516 local_irq_save(flags);
1515 buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; 1517 buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset;
1516 transfer_len = min(sg->length, len); 1518 transfer_len = min(sg->length, len);
1517 } else { 1519 } else {
@@ -1526,6 +1528,7 @@ static void tw_transfer_internal(TW_Device_Extension *tw_dev, int request_id,
1526 1528
1527 sg = (struct scatterlist *)cmd->request_buffer; 1529 sg = (struct scatterlist *)cmd->request_buffer;
1528 kunmap_atomic(buf - sg->offset, KM_IRQ0); 1530 kunmap_atomic(buf - sg->offset, KM_IRQ0);
1531 local_irq_restore(flags);
1529 } 1532 }
1530} 1533}
1531 1534
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index ff48066d4c4f..1b8429cb3c96 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -207,7 +207,6 @@ static struct scsi_host_template ahci_sht = {
207 .name = DRV_NAME, 207 .name = DRV_NAME,
208 .ioctl = ata_scsi_ioctl, 208 .ioctl = ata_scsi_ioctl,
209 .queuecommand = ata_scsi_queuecmd, 209 .queuecommand = ata_scsi_queuecmd,
210 .eh_strategy_handler = ata_scsi_error,
211 .can_queue = ATA_DEF_QUEUE, 210 .can_queue = ATA_DEF_QUEUE,
212 .this_id = ATA_SHT_THIS_ID, 211 .this_id = ATA_SHT_THIS_ID,
213 .sg_tablesize = AHCI_MAX_SG, 212 .sg_tablesize = AHCI_MAX_SG,
@@ -517,25 +516,7 @@ static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, u32 opts)
517 pp->cmd_slot[0].tbl_addr_hi = cpu_to_le32((pp->cmd_tbl_dma >> 16) >> 16); 516 pp->cmd_slot[0].tbl_addr_hi = cpu_to_le32((pp->cmd_tbl_dma >> 16) >> 16);
518} 517}
519 518
520static int ahci_poll_register(void __iomem *reg, u32 mask, u32 val, 519static int ahci_softreset(struct ata_port *ap, unsigned int *class)
521 unsigned long interval_msec,
522 unsigned long timeout_msec)
523{
524 unsigned long timeout;
525 u32 tmp;
526
527 timeout = jiffies + (timeout_msec * HZ) / 1000;
528 do {
529 tmp = readl(reg);
530 if ((tmp & mask) == val)
531 return 0;
532 msleep(interval_msec);
533 } while (time_before(jiffies, timeout));
534
535 return -1;
536}
537
538static int ahci_softreset(struct ata_port *ap, int verbose, unsigned int *class)
539{ 520{
540 struct ahci_host_priv *hpriv = ap->host_set->private_data; 521 struct ahci_host_priv *hpriv = ap->host_set->private_data;
541 struct ahci_port_priv *pp = ap->private_data; 522 struct ahci_port_priv *pp = ap->private_data;
@@ -544,6 +525,7 @@ static int ahci_softreset(struct ata_port *ap, int verbose, unsigned int *class)
544 const u32 cmd_fis_len = 5; /* five dwords */ 525 const u32 cmd_fis_len = 5; /* five dwords */
545 const char *reason = NULL; 526 const char *reason = NULL;
546 struct ata_taskfile tf; 527 struct ata_taskfile tf;
528 u32 tmp;
547 u8 *fis; 529 u8 *fis;
548 int rc; 530 int rc;
549 531
@@ -565,8 +547,6 @@ static int ahci_softreset(struct ata_port *ap, int verbose, unsigned int *class)
565 /* check BUSY/DRQ, perform Command List Override if necessary */ 547 /* check BUSY/DRQ, perform Command List Override if necessary */
566 ahci_tf_read(ap, &tf); 548 ahci_tf_read(ap, &tf);
567 if (tf.command & (ATA_BUSY | ATA_DRQ)) { 549 if (tf.command & (ATA_BUSY | ATA_DRQ)) {
568 u32 tmp;
569
570 if (!(hpriv->cap & HOST_CAP_CLO)) { 550 if (!(hpriv->cap & HOST_CAP_CLO)) {
571 rc = -EIO; 551 rc = -EIO;
572 reason = "port busy but no CLO"; 552 reason = "port busy but no CLO";
@@ -576,10 +556,10 @@ static int ahci_softreset(struct ata_port *ap, int verbose, unsigned int *class)
576 tmp = readl(port_mmio + PORT_CMD); 556 tmp = readl(port_mmio + PORT_CMD);
577 tmp |= PORT_CMD_CLO; 557 tmp |= PORT_CMD_CLO;
578 writel(tmp, port_mmio + PORT_CMD); 558 writel(tmp, port_mmio + PORT_CMD);
579 readl(port_mmio + PORT_CMD); /* flush */
580 559
581 if (ahci_poll_register(port_mmio + PORT_CMD, PORT_CMD_CLO, 0x0, 560 tmp = ata_wait_register(port_mmio + PORT_CMD,
582 1, 500)) { 561 PORT_CMD_CLO, PORT_CMD_CLO, 1, 500);
562 if (tmp & PORT_CMD_CLO) {
583 rc = -EIO; 563 rc = -EIO;
584 reason = "CLO failed"; 564 reason = "CLO failed";
585 goto fail_restart; 565 goto fail_restart;
@@ -600,9 +580,9 @@ static int ahci_softreset(struct ata_port *ap, int verbose, unsigned int *class)
600 fis[1] &= ~(1 << 7); /* turn off Command FIS bit */ 580 fis[1] &= ~(1 << 7); /* turn off Command FIS bit */
601 581
602 writel(1, port_mmio + PORT_CMD_ISSUE); 582 writel(1, port_mmio + PORT_CMD_ISSUE);
603 readl(port_mmio + PORT_CMD_ISSUE); /* flush */
604 583
605 if (ahci_poll_register(port_mmio + PORT_CMD_ISSUE, 0x1, 0x0, 1, 500)) { 584 tmp = ata_wait_register(port_mmio + PORT_CMD_ISSUE, 0x1, 0x1, 1, 500);
585 if (tmp & 0x1) {
606 rc = -EIO; 586 rc = -EIO;
607 reason = "1st FIS failed"; 587 reason = "1st FIS failed";
608 goto fail; 588 goto fail;
@@ -647,22 +627,19 @@ static int ahci_softreset(struct ata_port *ap, int verbose, unsigned int *class)
647 fail_restart: 627 fail_restart:
648 ahci_start_engine(ap); 628 ahci_start_engine(ap);
649 fail: 629 fail:
650 if (verbose) 630 printk(KERN_ERR "ata%u: softreset failed (%s)\n",
651 printk(KERN_ERR "ata%u: softreset failed (%s)\n", 631 ap->id, reason);
652 ap->id, reason);
653 else
654 DPRINTK("EXIT, rc=%d reason=\"%s\"\n", rc, reason);
655 return rc; 632 return rc;
656} 633}
657 634
658static int ahci_hardreset(struct ata_port *ap, int verbose, unsigned int *class) 635static int ahci_hardreset(struct ata_port *ap, unsigned int *class)
659{ 636{
660 int rc; 637 int rc;
661 638
662 DPRINTK("ENTER\n"); 639 DPRINTK("ENTER\n");
663 640
664 ahci_stop_engine(ap); 641 ahci_stop_engine(ap);
665 rc = sata_std_hardreset(ap, verbose, class); 642 rc = sata_std_hardreset(ap, class);
666 ahci_start_engine(ap); 643 ahci_start_engine(ap);
667 644
668 if (rc == 0) 645 if (rc == 0)
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index 83839706f5e0..62dabf74188e 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -209,7 +209,6 @@ static struct scsi_host_template piix_sht = {
209 .name = DRV_NAME, 209 .name = DRV_NAME,
210 .ioctl = ata_scsi_ioctl, 210 .ioctl = ata_scsi_ioctl,
211 .queuecommand = ata_scsi_queuecmd, 211 .queuecommand = ata_scsi_queuecmd,
212 .eh_strategy_handler = ata_scsi_error,
213 .can_queue = ATA_DEF_QUEUE, 212 .can_queue = ATA_DEF_QUEUE,
214 .this_id = ATA_SHT_THIS_ID, 213 .this_id = ATA_SHT_THIS_ID,
215 .sg_tablesize = LIBATA_MAX_PRD, 214 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index ef57f253031c..dfcb96f3e60c 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -294,18 +294,6 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
294 if (sht->unchecked_isa_dma && privsize) 294 if (sht->unchecked_isa_dma && privsize)
295 gfp_mask |= __GFP_DMA; 295 gfp_mask |= __GFP_DMA;
296 296
297 /* Check to see if this host has any error handling facilities */
298 if (!sht->eh_strategy_handler && !sht->eh_abort_handler &&
299 !sht->eh_device_reset_handler && !sht->eh_bus_reset_handler &&
300 !sht->eh_host_reset_handler) {
301 printk(KERN_ERR "ERROR: SCSI host `%s' has no error handling\n"
302 "ERROR: This is not a safe way to run your "
303 "SCSI host\n"
304 "ERROR: The error handling must be added to "
305 "this driver\n", sht->proc_name);
306 dump_stack();
307 }
308
309 shost = kzalloc(sizeof(struct Scsi_Host) + privsize, gfp_mask); 297 shost = kzalloc(sizeof(struct Scsi_Host) + privsize, gfp_mask);
310 if (!shost) 298 if (!shost)
311 return NULL; 299 return NULL;
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 2b2feb6462a9..5d38a6cc5736 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1425,12 +1425,9 @@ static int ata_bus_probe(struct ata_port *ap)
1425 /* read IDENTIFY page and configure devices */ 1425 /* read IDENTIFY page and configure devices */
1426 for (i = 0; i < ATA_MAX_DEVICES; i++) { 1426 for (i = 0; i < ATA_MAX_DEVICES; i++) {
1427 dev = &ap->device[i]; 1427 dev = &ap->device[i];
1428 dev->class = classes[i];
1429 1428
1430 if (!tries[i]) { 1429 if (tries[i])
1431 ata_down_xfermask_limit(ap, dev, 1); 1430 dev->class = classes[i];
1432 ata_dev_disable(ap, dev);
1433 }
1434 1431
1435 if (!ata_dev_enabled(dev)) 1432 if (!ata_dev_enabled(dev))
1436 continue; 1433 continue;
@@ -1458,12 +1455,12 @@ static int ata_bus_probe(struct ata_port *ap)
1458 break; 1455 break;
1459 } 1456 }
1460 rc = 0; 1457 rc = 0;
1461 } else { 1458 } else
1462 rc = ata_set_mode(ap, &dev); 1459 rc = ata_set_mode(ap, &dev);
1463 if (rc) { 1460
1464 down_xfermask = 1; 1461 if (rc) {
1465 goto fail; 1462 down_xfermask = 1;
1466 } 1463 goto fail;
1467 } 1464 }
1468 1465
1469 for (i = 0; i < ATA_MAX_DEVICES; i++) 1466 for (i = 0; i < ATA_MAX_DEVICES; i++)
@@ -1491,6 +1488,11 @@ static int ata_bus_probe(struct ata_port *ap)
1491 tries[dev->devno] = 0; 1488 tries[dev->devno] = 0;
1492 } 1489 }
1493 1490
1491 if (!tries[dev->devno]) {
1492 ata_down_xfermask_limit(ap, dev, 1);
1493 ata_dev_disable(ap, dev);
1494 }
1495
1494 goto retry; 1496 goto retry;
1495} 1497}
1496 1498
@@ -1750,7 +1752,7 @@ int ata_set_sata_spd_needed(struct ata_port *ap)
1750 * 0 if spd doesn't need to be changed, 1 if spd has been 1752 * 0 if spd doesn't need to be changed, 1 if spd has been
1751 * changed. -EOPNOTSUPP if SCR registers are inaccessible. 1753 * changed. -EOPNOTSUPP if SCR registers are inaccessible.
1752 */ 1754 */
1753static int ata_set_sata_spd(struct ata_port *ap) 1755int ata_set_sata_spd(struct ata_port *ap)
1754{ 1756{
1755 u32 scontrol; 1757 u32 scontrol;
1756 1758
@@ -2246,8 +2248,10 @@ static unsigned int ata_bus_softreset(struct ata_port *ap,
2246 * the bus shows 0xFF because the odd clown forgets the D7 2248 * the bus shows 0xFF because the odd clown forgets the D7
2247 * pulldown resistor. 2249 * pulldown resistor.
2248 */ 2250 */
2249 if (ata_check_status(ap) == 0xFF) 2251 if (ata_check_status(ap) == 0xFF) {
2252 printk(KERN_ERR "ata%u: SRST failed (status 0xFF)\n", ap->id);
2250 return AC_ERR_OTHER; 2253 return AC_ERR_OTHER;
2254 }
2251 2255
2252 ata_bus_post_reset(ap, devmask); 2256 ata_bus_post_reset(ap, devmask);
2253 2257
@@ -2383,12 +2387,16 @@ void ata_std_probeinit(struct ata_port *ap)
2383 if ((ap->flags & ATA_FLAG_SATA) && ap->ops->scr_read) { 2387 if ((ap->flags & ATA_FLAG_SATA) && ap->ops->scr_read) {
2384 u32 spd; 2388 u32 spd;
2385 2389
2390 /* set cable type and resume link */
2391 ap->cbl = ATA_CBL_SATA;
2386 sata_phy_resume(ap); 2392 sata_phy_resume(ap);
2387 2393
2394 /* init sata_spd_limit to the current value */
2388 spd = (scr_read(ap, SCR_CONTROL) & 0xf0) >> 4; 2395 spd = (scr_read(ap, SCR_CONTROL) & 0xf0) >> 4;
2389 if (spd) 2396 if (spd)
2390 ap->sata_spd_limit &= (1 << spd) - 1; 2397 ap->sata_spd_limit &= (1 << spd) - 1;
2391 2398
2399 /* wait for device */
2392 if (sata_dev_present(ap)) 2400 if (sata_dev_present(ap))
2393 ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT); 2401 ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT);
2394 } 2402 }
@@ -2397,7 +2405,6 @@ void ata_std_probeinit(struct ata_port *ap)
2397/** 2405/**
2398 * ata_std_softreset - reset host port via ATA SRST 2406 * ata_std_softreset - reset host port via ATA SRST
2399 * @ap: port to reset 2407 * @ap: port to reset
2400 * @verbose: fail verbosely
2401 * @classes: resulting classes of attached devices 2408 * @classes: resulting classes of attached devices
2402 * 2409 *
2403 * Reset host port using ATA SRST. This function is to be used 2410 * Reset host port using ATA SRST. This function is to be used
@@ -2409,7 +2416,7 @@ void ata_std_probeinit(struct ata_port *ap)
2409 * RETURNS: 2416 * RETURNS:
2410 * 0 on success, -errno otherwise. 2417 * 0 on success, -errno otherwise.
2411 */ 2418 */
2412int ata_std_softreset(struct ata_port *ap, int verbose, unsigned int *classes) 2419int ata_std_softreset(struct ata_port *ap, unsigned int *classes)
2413{ 2420{
2414 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS; 2421 unsigned int slave_possible = ap->flags & ATA_FLAG_SLAVE_POSS;
2415 unsigned int devmask = 0, err_mask; 2422 unsigned int devmask = 0, err_mask;
@@ -2435,12 +2442,8 @@ int ata_std_softreset(struct ata_port *ap, int verbose, unsigned int *classes)
2435 DPRINTK("about to softreset, devmask=%x\n", devmask); 2442 DPRINTK("about to softreset, devmask=%x\n", devmask);
2436 err_mask = ata_bus_softreset(ap, devmask); 2443 err_mask = ata_bus_softreset(ap, devmask);
2437 if (err_mask) { 2444 if (err_mask) {
2438 if (verbose) 2445 printk(KERN_ERR "ata%u: SRST failed (err_mask=0x%x)\n",
2439 printk(KERN_ERR "ata%u: SRST failed (err_mask=0x%x)\n", 2446 ap->id, err_mask);
2440 ap->id, err_mask);
2441 else
2442 DPRINTK("EXIT, softreset failed (err_mask=0x%x)\n",
2443 err_mask);
2444 return -EIO; 2447 return -EIO;
2445 } 2448 }
2446 2449
@@ -2457,7 +2460,6 @@ int ata_std_softreset(struct ata_port *ap, int verbose, unsigned int *classes)
2457/** 2460/**
2458 * sata_std_hardreset - reset host port via SATA phy reset 2461 * sata_std_hardreset - reset host port via SATA phy reset
2459 * @ap: port to reset 2462 * @ap: port to reset
2460 * @verbose: fail verbosely
2461 * @class: resulting class of attached device 2463 * @class: resulting class of attached device
2462 * 2464 *
2463 * SATA phy-reset host port using DET bits of SControl register. 2465 * SATA phy-reset host port using DET bits of SControl register.
@@ -2470,7 +2472,7 @@ int ata_std_softreset(struct ata_port *ap, int verbose, unsigned int *classes)
2470 * RETURNS: 2472 * RETURNS:
2471 * 0 on success, -errno otherwise. 2473 * 0 on success, -errno otherwise.
2472 */ 2474 */
2473int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class) 2475int sata_std_hardreset(struct ata_port *ap, unsigned int *class)
2474{ 2476{
2475 u32 scontrol; 2477 u32 scontrol;
2476 2478
@@ -2510,11 +2512,8 @@ int sata_std_hardreset(struct ata_port *ap, int verbose, unsigned int *class)
2510 } 2512 }
2511 2513
2512 if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) { 2514 if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) {
2513 if (verbose) 2515 printk(KERN_ERR
2514 printk(KERN_ERR "ata%u: COMRESET failed " 2516 "ata%u: COMRESET failed (device not ready)\n", ap->id);
2515 "(device not ready)\n", ap->id);
2516 else
2517 DPRINTK("EXIT, device not ready\n");
2518 return -EIO; 2517 return -EIO;
2519 } 2518 }
2520 2519
@@ -2545,10 +2544,6 @@ void ata_std_postreset(struct ata_port *ap, unsigned int *classes)
2545{ 2544{
2546 DPRINTK("ENTER\n"); 2545 DPRINTK("ENTER\n");
2547 2546
2548 /* set cable type if it isn't already set */
2549 if (ap->cbl == ATA_CBL_NONE && ap->flags & ATA_FLAG_SATA)
2550 ap->cbl = ATA_CBL_SATA;
2551
2552 /* print link status */ 2547 /* print link status */
2553 if (ap->cbl == ATA_CBL_SATA) 2548 if (ap->cbl == ATA_CBL_SATA)
2554 sata_print_link_status(ap); 2549 sata_print_link_status(ap);
@@ -2598,7 +2593,7 @@ int ata_std_probe_reset(struct ata_port *ap, unsigned int *classes)
2598 ata_reset_fn_t hardreset; 2593 ata_reset_fn_t hardreset;
2599 2594
2600 hardreset = NULL; 2595 hardreset = NULL;
2601 if (ap->flags & ATA_FLAG_SATA && ap->ops->scr_read) 2596 if (ap->cbl == ATA_CBL_SATA && ap->ops->scr_read)
2602 hardreset = sata_std_hardreset; 2597 hardreset = sata_std_hardreset;
2603 2598
2604 return ata_drive_probe_reset(ap, ata_std_probeinit, 2599 return ata_drive_probe_reset(ap, ata_std_probeinit,
@@ -2606,16 +2601,15 @@ int ata_std_probe_reset(struct ata_port *ap, unsigned int *classes)
2606 ata_std_postreset, classes); 2601 ata_std_postreset, classes);
2607} 2602}
2608 2603
2609int ata_do_reset(struct ata_port *ap, 2604int ata_do_reset(struct ata_port *ap, ata_reset_fn_t reset,
2610 ata_reset_fn_t reset, ata_postreset_fn_t postreset, 2605 ata_postreset_fn_t postreset, unsigned int *classes)
2611 int verbose, unsigned int *classes)
2612{ 2606{
2613 int i, rc; 2607 int i, rc;
2614 2608
2615 for (i = 0; i < ATA_MAX_DEVICES; i++) 2609 for (i = 0; i < ATA_MAX_DEVICES; i++)
2616 classes[i] = ATA_DEV_UNKNOWN; 2610 classes[i] = ATA_DEV_UNKNOWN;
2617 2611
2618 rc = reset(ap, verbose, classes); 2612 rc = reset(ap, classes);
2619 if (rc) 2613 if (rc)
2620 return rc; 2614 return rc;
2621 2615
@@ -2659,8 +2653,6 @@ int ata_do_reset(struct ata_port *ap,
2659 * - If classification is supported, fill classes[] with 2653 * - If classification is supported, fill classes[] with
2660 * recognized class codes. 2654 * recognized class codes.
2661 * - If classification is not supported, leave classes[] alone. 2655 * - If classification is not supported, leave classes[] alone.
2662 * - If verbose is non-zero, print error message on failure;
2663 * otherwise, shut up.
2664 * 2656 *
2665 * LOCKING: 2657 * LOCKING:
2666 * Kernel thread context (may sleep) 2658 * Kernel thread context (may sleep)
@@ -2680,7 +2672,7 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
2680 probeinit(ap); 2672 probeinit(ap);
2681 2673
2682 if (softreset && !ata_set_sata_spd_needed(ap)) { 2674 if (softreset && !ata_set_sata_spd_needed(ap)) {
2683 rc = ata_do_reset(ap, softreset, postreset, 0, classes); 2675 rc = ata_do_reset(ap, softreset, postreset, classes);
2684 if (rc == 0 && classes[0] != ATA_DEV_UNKNOWN) 2676 if (rc == 0 && classes[0] != ATA_DEV_UNKNOWN)
2685 goto done; 2677 goto done;
2686 printk(KERN_INFO "ata%u: softreset failed, will try " 2678 printk(KERN_INFO "ata%u: softreset failed, will try "
@@ -2692,7 +2684,7 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
2692 goto done; 2684 goto done;
2693 2685
2694 while (1) { 2686 while (1) {
2695 rc = ata_do_reset(ap, hardreset, postreset, 0, classes); 2687 rc = ata_do_reset(ap, hardreset, postreset, classes);
2696 if (rc == 0) { 2688 if (rc == 0) {
2697 if (classes[0] != ATA_DEV_UNKNOWN) 2689 if (classes[0] != ATA_DEV_UNKNOWN)
2698 goto done; 2690 goto done;
@@ -2713,7 +2705,7 @@ int ata_drive_probe_reset(struct ata_port *ap, ata_probeinit_fn_t probeinit,
2713 ap->id); 2705 ap->id);
2714 ssleep(5); 2706 ssleep(5);
2715 2707
2716 rc = ata_do_reset(ap, softreset, postreset, 0, classes); 2708 rc = ata_do_reset(ap, softreset, postreset, classes);
2717 } 2709 }
2718 2710
2719 done: 2711 done:
@@ -4846,7 +4838,7 @@ static struct ata_port * ata_host_add(const struct ata_probe_ent *ent,
4846 4838
4847 host->transportt = &ata_scsi_transport_template; 4839 host->transportt = &ata_scsi_transport_template;
4848 4840
4849 ap = (struct ata_port *) &host->hostdata[0]; 4841 ap = ata_shost_to_port(host);
4850 4842
4851 ata_host_init(ap, host, host_set, ent, port_no); 4843 ata_host_init(ap, host, host_set, ent, port_no);
4852 4844
@@ -5059,7 +5051,7 @@ void ata_host_set_remove(struct ata_host_set *host_set)
5059 5051
5060int ata_scsi_release(struct Scsi_Host *host) 5052int ata_scsi_release(struct Scsi_Host *host)
5061{ 5053{
5062 struct ata_port *ap = (struct ata_port *) &host->hostdata[0]; 5054 struct ata_port *ap = ata_shost_to_port(host);
5063 int i; 5055 int i;
5064 5056
5065 DPRINTK("ENTER\n"); 5057 DPRINTK("ENTER\n");
@@ -5226,6 +5218,52 @@ int ata_ratelimit(void)
5226 return rc; 5218 return rc;
5227} 5219}
5228 5220
5221/**
5222 * ata_wait_register - wait until register value changes
5223 * @reg: IO-mapped register
5224 * @mask: Mask to apply to read register value
5225 * @val: Wait condition
5226 * @interval_msec: polling interval in milliseconds
5227 * @timeout_msec: timeout in milliseconds
5228 *
5229 * Waiting for some bits of register to change is a common
5230 * operation for ATA controllers. This function reads 32bit LE
5231 * IO-mapped register @reg and tests for the following condition.
5232 *
5233 * (*@reg & mask) != val
5234 *
5235 * If the condition is met, it returns; otherwise, the process is
5236 * repeated after @interval_msec until timeout.
5237 *
5238 * LOCKING:
5239 * Kernel thread context (may sleep)
5240 *
5241 * RETURNS:
5242 * The final register value.
5243 */
5244u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
5245 unsigned long interval_msec,
5246 unsigned long timeout_msec)
5247{
5248 unsigned long timeout;
5249 u32 tmp;
5250
5251 tmp = ioread32(reg);
5252
5253 /* Calculate timeout _after_ the first read to make sure
5254 * preceding writes reach the controller before starting to
5255 * eat away the timeout.
5256 */
5257 timeout = jiffies + (timeout_msec * HZ) / 1000;
5258
5259 while ((tmp & mask) == val && time_before(jiffies, timeout)) {
5260 msleep(interval_msec);
5261 tmp = ioread32(reg);
5262 }
5263
5264 return tmp;
5265}
5266
5229/* 5267/*
5230 * libata is essentially a library of internal helper functions for 5268 * libata is essentially a library of internal helper functions for
5231 * low-level ATA host controller drivers. As such, the API/ABI is 5269 * low-level ATA host controller drivers. As such, the API/ABI is
@@ -5262,6 +5300,7 @@ EXPORT_SYMBOL_GPL(ata_bmdma_irq_clear);
5262EXPORT_SYMBOL_GPL(ata_bmdma_status); 5300EXPORT_SYMBOL_GPL(ata_bmdma_status);
5263EXPORT_SYMBOL_GPL(ata_bmdma_stop); 5301EXPORT_SYMBOL_GPL(ata_bmdma_stop);
5264EXPORT_SYMBOL_GPL(ata_port_probe); 5302EXPORT_SYMBOL_GPL(ata_port_probe);
5303EXPORT_SYMBOL_GPL(ata_set_sata_spd);
5265EXPORT_SYMBOL_GPL(sata_phy_reset); 5304EXPORT_SYMBOL_GPL(sata_phy_reset);
5266EXPORT_SYMBOL_GPL(__sata_phy_reset); 5305EXPORT_SYMBOL_GPL(__sata_phy_reset);
5267EXPORT_SYMBOL_GPL(ata_bus_reset); 5306EXPORT_SYMBOL_GPL(ata_bus_reset);
@@ -5276,6 +5315,7 @@ EXPORT_SYMBOL_GPL(ata_dev_classify);
5276EXPORT_SYMBOL_GPL(ata_dev_pair); 5315EXPORT_SYMBOL_GPL(ata_dev_pair);
5277EXPORT_SYMBOL_GPL(ata_port_disable); 5316EXPORT_SYMBOL_GPL(ata_port_disable);
5278EXPORT_SYMBOL_GPL(ata_ratelimit); 5317EXPORT_SYMBOL_GPL(ata_ratelimit);
5318EXPORT_SYMBOL_GPL(ata_wait_register);
5279EXPORT_SYMBOL_GPL(ata_busy_sleep); 5319EXPORT_SYMBOL_GPL(ata_busy_sleep);
5280EXPORT_SYMBOL_GPL(ata_port_queue_task); 5320EXPORT_SYMBOL_GPL(ata_port_queue_task);
5281EXPORT_SYMBOL_GPL(ata_scsi_ioctl); 5321EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
diff --git a/drivers/scsi/libata-eh.c b/drivers/scsi/libata-eh.c
index 9a8eea11b0be..16db62211716 100644
--- a/drivers/scsi/libata-eh.c
+++ b/drivers/scsi/libata-eh.c
@@ -64,7 +64,7 @@
64enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd) 64enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd)
65{ 65{
66 struct Scsi_Host *host = cmd->device->host; 66 struct Scsi_Host *host = cmd->device->host;
67 struct ata_port *ap = (struct ata_port *) &host->hostdata[0]; 67 struct ata_port *ap = ata_shost_to_port(host);
68 unsigned long flags; 68 unsigned long flags;
69 struct ata_queued_cmd *qc; 69 struct ata_queued_cmd *qc;
70 enum scsi_eh_timer_return ret = EH_HANDLED; 70 enum scsi_eh_timer_return ret = EH_HANDLED;
@@ -97,9 +97,9 @@ enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd)
97 * RETURNS: 97 * RETURNS:
98 * Zero. 98 * Zero.
99 */ 99 */
100int ata_scsi_error(struct Scsi_Host *host) 100void ata_scsi_error(struct Scsi_Host *host)
101{ 101{
102 struct ata_port *ap = (struct ata_port *)&host->hostdata[0]; 102 struct ata_port *ap = ata_shost_to_port(host);
103 103
104 DPRINTK("ENTER\n"); 104 DPRINTK("ENTER\n");
105 105
@@ -116,7 +116,6 @@ int ata_scsi_error(struct Scsi_Host *host)
116 scsi_eh_flush_done_q(&ap->eh_done_q); 116 scsi_eh_flush_done_q(&ap->eh_done_q);
117 117
118 DPRINTK("EXIT\n"); 118 DPRINTK("EXIT\n");
119 return 0;
120} 119}
121 120
122/** 121/**
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index c9c001490293..9871f8272df0 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -98,6 +98,7 @@ static const u8 def_control_mpage[CONTROL_MPAGE_LEN] = {
98 * It just needs the eh_timed_out hook. 98 * It just needs the eh_timed_out hook.
99 */ 99 */
100struct scsi_transport_template ata_scsi_transport_template = { 100struct scsi_transport_template ata_scsi_transport_template = {
101 .eh_strategy_handler = ata_scsi_error,
101 .eh_timed_out = ata_scsi_timed_out, 102 .eh_timed_out = ata_scsi_timed_out,
102}; 103};
103 104
@@ -394,7 +395,7 @@ void ata_dump_status(unsigned id, struct ata_taskfile *tf)
394 395
395int ata_scsi_device_resume(struct scsi_device *sdev) 396int ata_scsi_device_resume(struct scsi_device *sdev)
396{ 397{
397 struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0]; 398 struct ata_port *ap = ata_shost_to_port(sdev->host);
398 struct ata_device *dev = &ap->device[sdev->id]; 399 struct ata_device *dev = &ap->device[sdev->id];
399 400
400 return ata_device_resume(ap, dev); 401 return ata_device_resume(ap, dev);
@@ -402,7 +403,7 @@ int ata_scsi_device_resume(struct scsi_device *sdev)
402 403
403int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state) 404int ata_scsi_device_suspend(struct scsi_device *sdev, pm_message_t state)
404{ 405{
405 struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0]; 406 struct ata_port *ap = ata_shost_to_port(sdev->host);
406 struct ata_device *dev = &ap->device[sdev->id]; 407 struct ata_device *dev = &ap->device[sdev->id];
407 408
408 return ata_device_suspend(ap, dev, state); 409 return ata_device_suspend(ap, dev, state);
@@ -703,7 +704,7 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
703 struct ata_port *ap; 704 struct ata_port *ap;
704 struct ata_device *dev; 705 struct ata_device *dev;
705 706
706 ap = (struct ata_port *) &sdev->host->hostdata[0]; 707 ap = ata_shost_to_port(sdev->host);
707 dev = &ap->device[sdev->id]; 708 dev = &ap->device[sdev->id];
708 709
709 ata_scsi_dev_config(sdev, dev); 710 ata_scsi_dev_config(sdev, dev);
@@ -2477,7 +2478,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))
2477 struct scsi_device *scsidev = cmd->device; 2478 struct scsi_device *scsidev = cmd->device;
2478 struct Scsi_Host *shost = scsidev->host; 2479 struct Scsi_Host *shost = scsidev->host;
2479 2480
2480 ap = (struct ata_port *) &shost->hostdata[0]; 2481 ap = ata_shost_to_port(shost);
2481 2482
2482 spin_unlock(shost->host_lock); 2483 spin_unlock(shost->host_lock);
2483 spin_lock(&ap->host_set->lock); 2484 spin_lock(&ap->host_set->lock);
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h
index 652c08e3808e..3f8b0a863781 100644
--- a/drivers/scsi/libata.h
+++ b/drivers/scsi/libata.h
@@ -56,10 +56,8 @@ extern int ata_set_sata_spd_needed(struct ata_port *ap);
56extern int ata_down_xfermask_limit(struct ata_port *ap, struct ata_device *dev, 56extern int ata_down_xfermask_limit(struct ata_port *ap, struct ata_device *dev,
57 int force_pio0); 57 int force_pio0);
58extern int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev); 58extern int ata_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev);
59extern int ata_do_reset(struct ata_port *ap, 59extern int ata_do_reset(struct ata_port *ap, ata_reset_fn_t reset,
60 ata_reset_fn_t reset, 60 ata_postreset_fn_t postreset, unsigned int *classes);
61 ata_postreset_fn_t postreset,
62 int verbose, unsigned int *classes);
63extern void ata_qc_free(struct ata_queued_cmd *qc); 61extern void ata_qc_free(struct ata_queued_cmd *qc);
64extern void ata_qc_issue(struct ata_queued_cmd *qc); 62extern void ata_qc_issue(struct ata_queued_cmd *qc);
65extern int ata_check_atapi_dma(struct ata_queued_cmd *qc); 63extern int ata_check_atapi_dma(struct ata_queued_cmd *qc);
@@ -105,5 +103,6 @@ extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args,
105 103
106/* libata-eh.c */ 104/* libata-eh.c */
107extern enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd); 105extern enum scsi_eh_timer_return ata_scsi_timed_out(struct scsi_cmnd *cmd);
106extern void ata_scsi_error(struct Scsi_Host *host);
108 107
109#endif /* __LIBATA_H__ */ 108#endif /* __LIBATA_H__ */
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c
index 1fca6f1afa99..a341fa8d3291 100644
--- a/drivers/scsi/pdc_adma.c
+++ b/drivers/scsi/pdc_adma.c
@@ -143,7 +143,6 @@ static struct scsi_host_template adma_ata_sht = {
143 .name = DRV_NAME, 143 .name = DRV_NAME,
144 .ioctl = ata_scsi_ioctl, 144 .ioctl = ata_scsi_ioctl,
145 .queuecommand = ata_scsi_queuecmd, 145 .queuecommand = ata_scsi_queuecmd,
146 .eh_strategy_handler = ata_scsi_error,
147 .can_queue = ATA_DEF_QUEUE, 146 .can_queue = ATA_DEF_QUEUE,
148 .this_id = ATA_SHT_THIS_ID, 147 .this_id = ATA_SHT_THIS_ID,
149 .sg_tablesize = LIBATA_MAX_PRD, 148 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index fd9f2173f062..08665ea1e94e 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -378,7 +378,6 @@ static struct scsi_host_template mv_sht = {
378 .name = DRV_NAME, 378 .name = DRV_NAME,
379 .ioctl = ata_scsi_ioctl, 379 .ioctl = ata_scsi_ioctl,
380 .queuecommand = ata_scsi_queuecmd, 380 .queuecommand = ata_scsi_queuecmd,
381 .eh_strategy_handler = ata_scsi_error,
382 .can_queue = MV_USE_Q_DEPTH, 381 .can_queue = MV_USE_Q_DEPTH,
383 .this_id = ATA_SHT_THIS_ID, 382 .this_id = ATA_SHT_THIS_ID,
384 .sg_tablesize = MV_MAX_SG_CT / 2, 383 .sg_tablesize = MV_MAX_SG_CT / 2,
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c
index 3a0004c3c8b5..70c51088d371 100644
--- a/drivers/scsi/sata_nv.c
+++ b/drivers/scsi/sata_nv.c
@@ -201,7 +201,6 @@ static struct scsi_host_template nv_sht = {
201 .name = DRV_NAME, 201 .name = DRV_NAME,
202 .ioctl = ata_scsi_ioctl, 202 .ioctl = ata_scsi_ioctl,
203 .queuecommand = ata_scsi_queuecmd, 203 .queuecommand = ata_scsi_queuecmd,
204 .eh_strategy_handler = ata_scsi_error,
205 .can_queue = ATA_DEF_QUEUE, 204 .can_queue = ATA_DEF_QUEUE,
206 .this_id = ATA_SHT_THIS_ID, 205 .this_id = ATA_SHT_THIS_ID,
207 .sg_tablesize = LIBATA_MAX_PRD, 206 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 03c647cbfb59..aaf896a0c63a 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -112,7 +112,6 @@ static struct scsi_host_template pdc_ata_sht = {
112 .name = DRV_NAME, 112 .name = DRV_NAME,
113 .ioctl = ata_scsi_ioctl, 113 .ioctl = ata_scsi_ioctl,
114 .queuecommand = ata_scsi_queuecmd, 114 .queuecommand = ata_scsi_queuecmd,
115 .eh_strategy_handler = ata_scsi_error,
116 .can_queue = ATA_DEF_QUEUE, 115 .can_queue = ATA_DEF_QUEUE,
117 .this_id = ATA_SHT_THIS_ID, 116 .this_id = ATA_SHT_THIS_ID,
118 .sg_tablesize = LIBATA_MAX_PRD, 117 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index 1b7a9316810c..54283e06070e 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -132,7 +132,6 @@ static struct scsi_host_template qs_ata_sht = {
132 .name = DRV_NAME, 132 .name = DRV_NAME,
133 .ioctl = ata_scsi_ioctl, 133 .ioctl = ata_scsi_ioctl,
134 .queuecommand = ata_scsi_queuecmd, 134 .queuecommand = ata_scsi_queuecmd,
135 .eh_strategy_handler = ata_scsi_error,
136 .can_queue = ATA_DEF_QUEUE, 135 .can_queue = ATA_DEF_QUEUE,
137 .this_id = ATA_SHT_THIS_ID, 136 .this_id = ATA_SHT_THIS_ID,
138 .sg_tablesize = QS_MAX_PRD, 137 .sg_tablesize = QS_MAX_PRD,
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index f29c3e733a00..c9333577330e 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -146,7 +146,6 @@ static struct scsi_host_template sil_sht = {
146 .name = DRV_NAME, 146 .name = DRV_NAME,
147 .ioctl = ata_scsi_ioctl, 147 .ioctl = ata_scsi_ioctl,
148 .queuecommand = ata_scsi_queuecmd, 148 .queuecommand = ata_scsi_queuecmd,
149 .eh_strategy_handler = ata_scsi_error,
150 .can_queue = ATA_DEF_QUEUE, 149 .can_queue = ATA_DEF_QUEUE,
151 .this_id = ATA_SHT_THIS_ID, 150 .this_id = ATA_SHT_THIS_ID,
152 .sg_tablesize = LIBATA_MAX_PRD, 151 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index 646756abb10e..e9fd869140c5 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -86,6 +86,13 @@ enum {
86 /* HOST_SLOT_STAT bits */ 86 /* HOST_SLOT_STAT bits */
87 HOST_SSTAT_ATTN = (1 << 31), 87 HOST_SSTAT_ATTN = (1 << 31),
88 88
89 /* HOST_CTRL bits */
90 HOST_CTRL_M66EN = (1 << 16), /* M66EN PCI bus signal */
91 HOST_CTRL_TRDY = (1 << 17), /* latched PCI TRDY */
92 HOST_CTRL_STOP = (1 << 18), /* latched PCI STOP */
93 HOST_CTRL_DEVSEL = (1 << 19), /* latched PCI DEVSEL */
94 HOST_CTRL_REQ64 = (1 << 20), /* latched PCI REQ64 */
95
89 /* 96 /*
90 * Port registers 97 * Port registers
91 * (8192 bytes @ +0x0000, +0x2000, +0x4000 and +0x6000 @ BAR2) 98 * (8192 bytes @ +0x0000, +0x2000, +0x4000 and +0x6000 @ BAR2)
@@ -142,8 +149,12 @@ enum {
142 PORT_IRQ_PWR_CHG = (1 << 3), /* power management change */ 149 PORT_IRQ_PWR_CHG = (1 << 3), /* power management change */
143 PORT_IRQ_PHYRDY_CHG = (1 << 4), /* PHY ready change */ 150 PORT_IRQ_PHYRDY_CHG = (1 << 4), /* PHY ready change */
144 PORT_IRQ_COMWAKE = (1 << 5), /* COMWAKE received */ 151 PORT_IRQ_COMWAKE = (1 << 5), /* COMWAKE received */
145 PORT_IRQ_UNK_FIS = (1 << 6), /* Unknown FIS received */ 152 PORT_IRQ_UNK_FIS = (1 << 6), /* unknown FIS received */
146 PORT_IRQ_SDB_FIS = (1 << 11), /* SDB FIS received */ 153 PORT_IRQ_DEV_XCHG = (1 << 7), /* device exchanged */
154 PORT_IRQ_8B10B = (1 << 8), /* 8b/10b decode error threshold */
155 PORT_IRQ_CRC = (1 << 9), /* CRC error threshold */
156 PORT_IRQ_HANDSHAKE = (1 << 10), /* handshake error threshold */
157 PORT_IRQ_SDB_NOTIFY = (1 << 11), /* SDB notify received */
147 158
148 /* bits[27:16] are unmasked (raw) */ 159 /* bits[27:16] are unmasked (raw) */
149 PORT_IRQ_RAW_SHIFT = 16, 160 PORT_IRQ_RAW_SHIFT = 16,
@@ -174,7 +185,7 @@ enum {
174 PORT_CERR_CMD_PCIPERR = 27, /* ctrl[15:13] 110 - PCI parity err while fetching PRB */ 185 PORT_CERR_CMD_PCIPERR = 27, /* ctrl[15:13] 110 - PCI parity err while fetching PRB */
175 PORT_CERR_XFR_UNDEF = 32, /* PSD ecode 00 - undefined */ 186 PORT_CERR_XFR_UNDEF = 32, /* PSD ecode 00 - undefined */
176 PORT_CERR_XFR_TGTABRT = 33, /* PSD ecode 01 - target abort */ 187 PORT_CERR_XFR_TGTABRT = 33, /* PSD ecode 01 - target abort */
177 PORT_CERR_XFR_MSGABRT = 34, /* PSD ecode 10 - master abort */ 188 PORT_CERR_XFR_MSTABRT = 34, /* PSD ecode 10 - master abort */
178 PORT_CERR_XFR_PCIPERR = 35, /* PSD ecode 11 - PCI prity err during transfer */ 189 PORT_CERR_XFR_PCIPERR = 35, /* PSD ecode 11 - PCI prity err during transfer */
179 PORT_CERR_SENDSERVICE = 36, /* FIS received while sending service */ 190 PORT_CERR_SENDSERVICE = 36, /* FIS received while sending service */
180 191
@@ -207,6 +218,11 @@ enum {
207 BID_SIL3132 = 1, 218 BID_SIL3132 = 1,
208 BID_SIL3131 = 2, 219 BID_SIL3131 = 2,
209 220
221 /* host flags */
222 SIL24_COMMON_FLAGS = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
223 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA,
224 SIL24_FLAG_PCIX_IRQ_WOC = (1 << 24), /* IRQ loss errata on PCI-X */
225
210 IRQ_STAT_4PORTS = 0xf, 226 IRQ_STAT_4PORTS = 0xf,
211}; 227};
212 228
@@ -281,7 +297,6 @@ static struct scsi_host_template sil24_sht = {
281 .name = DRV_NAME, 297 .name = DRV_NAME,
282 .ioctl = ata_scsi_ioctl, 298 .ioctl = ata_scsi_ioctl,
283 .queuecommand = ata_scsi_queuecmd, 299 .queuecommand = ata_scsi_queuecmd,
284 .eh_strategy_handler = ata_scsi_error,
285 .can_queue = ATA_DEF_QUEUE, 300 .can_queue = ATA_DEF_QUEUE,
286 .this_id = ATA_SHT_THIS_ID, 301 .this_id = ATA_SHT_THIS_ID,
287 .sg_tablesize = LIBATA_MAX_PRD, 302 .sg_tablesize = LIBATA_MAX_PRD,
@@ -334,9 +349,8 @@ static struct ata_port_info sil24_port_info[] = {
334 /* sil_3124 */ 349 /* sil_3124 */
335 { 350 {
336 .sht = &sil24_sht, 351 .sht = &sil24_sht,
337 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 352 .host_flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(4) |
338 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | 353 SIL24_FLAG_PCIX_IRQ_WOC,
339 SIL24_NPORTS2FLAG(4),
340 .pio_mask = 0x1f, /* pio0-4 */ 354 .pio_mask = 0x1f, /* pio0-4 */
341 .mwdma_mask = 0x07, /* mwdma0-2 */ 355 .mwdma_mask = 0x07, /* mwdma0-2 */
342 .udma_mask = 0x3f, /* udma0-5 */ 356 .udma_mask = 0x3f, /* udma0-5 */
@@ -345,9 +359,7 @@ static struct ata_port_info sil24_port_info[] = {
345 /* sil_3132 */ 359 /* sil_3132 */
346 { 360 {
347 .sht = &sil24_sht, 361 .sht = &sil24_sht,
348 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 362 .host_flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(2),
349 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
350 SIL24_NPORTS2FLAG(2),
351 .pio_mask = 0x1f, /* pio0-4 */ 363 .pio_mask = 0x1f, /* pio0-4 */
352 .mwdma_mask = 0x07, /* mwdma0-2 */ 364 .mwdma_mask = 0x07, /* mwdma0-2 */
353 .udma_mask = 0x3f, /* udma0-5 */ 365 .udma_mask = 0x3f, /* udma0-5 */
@@ -356,9 +368,7 @@ static struct ata_port_info sil24_port_info[] = {
356 /* sil_3131/sil_3531 */ 368 /* sil_3131/sil_3531 */
357 { 369 {
358 .sht = &sil24_sht, 370 .sht = &sil24_sht,
359 .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | 371 .host_flags = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(1),
360 ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
361 SIL24_NPORTS2FLAG(1),
362 .pio_mask = 0x1f, /* pio0-4 */ 372 .pio_mask = 0x1f, /* pio0-4 */
363 .mwdma_mask = 0x07, /* mwdma0-2 */ 373 .mwdma_mask = 0x07, /* mwdma0-2 */
364 .udma_mask = 0x3f, /* udma0-5 */ 374 .udma_mask = 0x3f, /* udma0-5 */
@@ -427,15 +437,30 @@ static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
427 *tf = pp->tf; 437 *tf = pp->tf;
428} 438}
429 439
430static int sil24_softreset(struct ata_port *ap, int verbose, 440static int sil24_init_port(struct ata_port *ap)
431 unsigned int *class) 441{
442 void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr;
443 u32 tmp;
444
445 writel(PORT_CS_INIT, port + PORT_CTRL_STAT);
446 ata_wait_register(port + PORT_CTRL_STAT,
447 PORT_CS_INIT, PORT_CS_INIT, 10, 100);
448 tmp = ata_wait_register(port + PORT_CTRL_STAT,
449 PORT_CS_RDY, 0, 10, 100);
450
451 if ((tmp & (PORT_CS_INIT | PORT_CS_RDY)) != PORT_CS_RDY)
452 return -EIO;
453 return 0;
454}
455
456static int sil24_softreset(struct ata_port *ap, unsigned int *class)
432{ 457{
433 void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; 458 void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr;
434 struct sil24_port_priv *pp = ap->private_data; 459 struct sil24_port_priv *pp = ap->private_data;
435 struct sil24_prb *prb = &pp->cmd_block[0].ata.prb; 460 struct sil24_prb *prb = &pp->cmd_block[0].ata.prb;
436 dma_addr_t paddr = pp->cmd_block_dma; 461 dma_addr_t paddr = pp->cmd_block_dma;
437 unsigned long timeout = jiffies + ATA_TMOUT_BOOT * HZ; 462 u32 mask, irq_enable, irq_stat;
438 u32 irq_enable, irq_stat; 463 const char *reason;
439 464
440 DPRINTK("ENTER\n"); 465 DPRINTK("ENTER\n");
441 466
@@ -449,34 +474,35 @@ static int sil24_softreset(struct ata_port *ap, int verbose,
449 irq_enable = readl(port + PORT_IRQ_ENABLE_SET); 474 irq_enable = readl(port + PORT_IRQ_ENABLE_SET);
450 writel(irq_enable, port + PORT_IRQ_ENABLE_CLR); 475 writel(irq_enable, port + PORT_IRQ_ENABLE_CLR);
451 476
452 /* 477 /* put the port into known state */
453 * XXX: Not sure whether the following sleep is needed or not. 478 if (sil24_init_port(ap)) {
454 * The original driver had it. So.... 479 reason ="port not ready";
455 */ 480 goto err;
456 msleep(10); 481 }
457 482
458 prb->ctrl = PRB_CTRL_SRST; 483 /* do SRST */
484 prb->ctrl = cpu_to_le16(PRB_CTRL_SRST);
459 prb->fis[1] = 0; /* no PM yet */ 485 prb->fis[1] = 0; /* no PM yet */
460 486
461 writel((u32)paddr, port + PORT_CMD_ACTIVATE); 487 writel((u32)paddr, port + PORT_CMD_ACTIVATE);
488 writel((u64)paddr >> 32, port + PORT_CMD_ACTIVATE + 4);
462 489
463 do { 490 mask = (PORT_IRQ_COMPLETE | PORT_IRQ_ERROR) << PORT_IRQ_RAW_SHIFT;
464 irq_stat = readl(port + PORT_IRQ_STAT); 491 irq_stat = ata_wait_register(port + PORT_IRQ_STAT, mask, 0x0,
465 writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */ 492 100, ATA_TMOUT_BOOT / HZ * 1000);
466
467 irq_stat >>= PORT_IRQ_RAW_SHIFT;
468 if (irq_stat & (PORT_IRQ_COMPLETE | PORT_IRQ_ERROR))
469 break;
470 493
471 msleep(100); 494 writel(irq_stat, port + PORT_IRQ_STAT); /* clear IRQs */
472 } while (time_before(jiffies, timeout)); 495 irq_stat >>= PORT_IRQ_RAW_SHIFT;
473 496
474 /* restore IRQs */ 497 /* restore IRQs */
475 writel(irq_enable, port + PORT_IRQ_ENABLE_SET); 498 writel(irq_enable, port + PORT_IRQ_ENABLE_SET);
476 499
477 if (!(irq_stat & PORT_IRQ_COMPLETE)) { 500 if (!(irq_stat & PORT_IRQ_COMPLETE)) {
478 DPRINTK("EXIT, srst failed\n"); 501 if (irq_stat & PORT_IRQ_ERROR)
479 return -EIO; 502 reason = "SRST command error";
503 else
504 reason = "timeout";
505 goto err;
480 } 506 }
481 507
482 sil24_update_tf(ap); 508 sil24_update_tf(ap);
@@ -488,15 +514,55 @@ static int sil24_softreset(struct ata_port *ap, int verbose,
488 out: 514 out:
489 DPRINTK("EXIT, class=%u\n", *class); 515 DPRINTK("EXIT, class=%u\n", *class);
490 return 0; 516 return 0;
517
518 err:
519 printk(KERN_ERR "ata%u: softreset failed (%s)\n", ap->id, reason);
520 return -EIO;
491} 521}
492 522
493static int sil24_hardreset(struct ata_port *ap, int verbose, 523static int sil24_hardreset(struct ata_port *ap, unsigned int *class)
494 unsigned int *class)
495{ 524{
496 unsigned int dummy_class; 525 void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr;
526 const char *reason;
527 int tout_msec;
528 u32 tmp;
529
530 /* sil24 does the right thing(tm) without any protection */
531 ata_set_sata_spd(ap);
532
533 tout_msec = 100;
534 if (sata_dev_present(ap))
535 tout_msec = 5000;
497 536
498 /* sil24 doesn't report device signature after hard reset */ 537 writel(PORT_CS_DEV_RST, port + PORT_CTRL_STAT);
499 return sata_std_hardreset(ap, verbose, &dummy_class); 538 tmp = ata_wait_register(port + PORT_CTRL_STAT,
539 PORT_CS_DEV_RST, PORT_CS_DEV_RST, 10, tout_msec);
540
541 /* SStatus oscillates between zero and valid status for short
542 * duration after DEV_RST, give it time to settle.
543 */
544 msleep(100);
545
546 if (tmp & PORT_CS_DEV_RST) {
547 if (!sata_dev_present(ap))
548 return 0;
549 reason = "link not ready";
550 goto err;
551 }
552
553 if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) {
554 reason = "device not ready";
555 goto err;
556 }
557
558 /* sil24 doesn't report device class code after hardreset,
559 * leave *class alone.
560 */
561 return 0;
562
563 err:
564 printk(KERN_ERR "ata%u: hardreset failed (%s)\n", ap->id, reason);
565 return -EIO;
500} 566}
501 567
502static int sil24_probe_reset(struct ata_port *ap, unsigned int *classes) 568static int sil24_probe_reset(struct ata_port *ap, unsigned int *classes)
@@ -532,6 +598,7 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc)
532 union sil24_cmd_block *cb = pp->cmd_block + qc->tag; 598 union sil24_cmd_block *cb = pp->cmd_block + qc->tag;
533 struct sil24_prb *prb; 599 struct sil24_prb *prb;
534 struct sil24_sge *sge; 600 struct sil24_sge *sge;
601 u16 ctrl = 0;
535 602
536 switch (qc->tf.protocol) { 603 switch (qc->tf.protocol) {
537 case ATA_PROT_PIO: 604 case ATA_PROT_PIO:
@@ -539,7 +606,6 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc)
539 case ATA_PROT_NODATA: 606 case ATA_PROT_NODATA:
540 prb = &cb->ata.prb; 607 prb = &cb->ata.prb;
541 sge = cb->ata.sge; 608 sge = cb->ata.sge;
542 prb->ctrl = 0;
543 break; 609 break;
544 610
545 case ATA_PROT_ATAPI: 611 case ATA_PROT_ATAPI:
@@ -552,12 +618,10 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc)
552 618
553 if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) { 619 if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) {
554 if (qc->tf.flags & ATA_TFLAG_WRITE) 620 if (qc->tf.flags & ATA_TFLAG_WRITE)
555 prb->ctrl = PRB_CTRL_PACKET_WRITE; 621 ctrl = PRB_CTRL_PACKET_WRITE;
556 else 622 else
557 prb->ctrl = PRB_CTRL_PACKET_READ; 623 ctrl = PRB_CTRL_PACKET_READ;
558 } else 624 }
559 prb->ctrl = 0;
560
561 break; 625 break;
562 626
563 default: 627 default:
@@ -566,6 +630,7 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc)
566 BUG(); 630 BUG();
567 } 631 }
568 632
633 prb->ctrl = cpu_to_le16(ctrl);
569 ata_tf_to_fis(&qc->tf, prb->fis, 0); 634 ata_tf_to_fis(&qc->tf, prb->fis, 0);
570 635
571 if (qc->flags & ATA_QCFLAG_DMAMAP) 636 if (qc->flags & ATA_QCFLAG_DMAMAP)
@@ -580,6 +645,8 @@ static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc)
580 dma_addr_t paddr = pp->cmd_block_dma + qc->tag * sizeof(*pp->cmd_block); 645 dma_addr_t paddr = pp->cmd_block_dma + qc->tag * sizeof(*pp->cmd_block);
581 646
582 writel((u32)paddr, port + PORT_CMD_ACTIVATE); 647 writel((u32)paddr, port + PORT_CMD_ACTIVATE);
648 writel((u64)paddr >> 32, port + PORT_CMD_ACTIVATE + 4);
649
583 return 0; 650 return 0;
584} 651}
585 652
@@ -728,6 +795,10 @@ static inline void sil24_host_intr(struct ata_port *ap)
728 slot_stat = readl(port + PORT_SLOT_STAT); 795 slot_stat = readl(port + PORT_SLOT_STAT);
729 if (!(slot_stat & HOST_SSTAT_ATTN)) { 796 if (!(slot_stat & HOST_SSTAT_ATTN)) {
730 struct sil24_port_priv *pp = ap->private_data; 797 struct sil24_port_priv *pp = ap->private_data;
798
799 if (ap->flags & SIL24_FLAG_PCIX_IRQ_WOC)
800 writel(PORT_IRQ_COMPLETE, port + PORT_IRQ_STAT);
801
731 /* 802 /*
732 * !HOST_SSAT_ATTN guarantees successful completion, 803 * !HOST_SSAT_ATTN guarantees successful completion,
733 * so reading back tf registers is unnecessary for 804 * so reading back tf registers is unnecessary for
@@ -859,6 +930,7 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
859 void __iomem *host_base = NULL; 930 void __iomem *host_base = NULL;
860 void __iomem *port_base = NULL; 931 void __iomem *port_base = NULL;
861 int i, rc; 932 int i, rc;
933 u32 tmp;
862 934
863 if (!printed_version++) 935 if (!printed_version++)
864 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 936 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
@@ -911,35 +983,51 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
911 /* 983 /*
912 * Configure the device 984 * Configure the device
913 */ 985 */
914 /* 986 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
915 * FIXME: This device is certainly 64-bit capable. We just 987 rc = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
916 * don't know how to use it. After fixing 32bit activation in 988 if (rc) {
917 * this function, enable 64bit masks here. 989 rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
918 */ 990 if (rc) {
919 rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK); 991 dev_printk(KERN_ERR, &pdev->dev,
920 if (rc) { 992 "64-bit DMA enable failed\n");
921 dev_printk(KERN_ERR, &pdev->dev, 993 goto out_free;
922 "32-bit DMA enable failed\n"); 994 }
923 goto out_free; 995 }
924 } 996 } else {
925 rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK); 997 rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
926 if (rc) { 998 if (rc) {
927 dev_printk(KERN_ERR, &pdev->dev, 999 dev_printk(KERN_ERR, &pdev->dev,
928 "32-bit consistent DMA enable failed\n"); 1000 "32-bit DMA enable failed\n");
929 goto out_free; 1001 goto out_free;
1002 }
1003 rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
1004 if (rc) {
1005 dev_printk(KERN_ERR, &pdev->dev,
1006 "32-bit consistent DMA enable failed\n");
1007 goto out_free;
1008 }
930 } 1009 }
931 1010
932 /* GPIO off */ 1011 /* GPIO off */
933 writel(0, host_base + HOST_FLASH_CMD); 1012 writel(0, host_base + HOST_FLASH_CMD);
934 1013
935 /* Mask interrupts during initialization */ 1014 /* Apply workaround for completion IRQ loss on PCI-X errata */
1015 if (probe_ent->host_flags & SIL24_FLAG_PCIX_IRQ_WOC) {
1016 tmp = readl(host_base + HOST_CTRL);
1017 if (tmp & (HOST_CTRL_TRDY | HOST_CTRL_STOP | HOST_CTRL_DEVSEL))
1018 dev_printk(KERN_INFO, &pdev->dev,
1019 "Applying completion IRQ loss on PCI-X "
1020 "errata fix\n");
1021 else
1022 probe_ent->host_flags &= ~SIL24_FLAG_PCIX_IRQ_WOC;
1023 }
1024
1025 /* clear global reset & mask interrupts during initialization */
936 writel(0, host_base + HOST_CTRL); 1026 writel(0, host_base + HOST_CTRL);
937 1027
938 for (i = 0; i < probe_ent->n_ports; i++) { 1028 for (i = 0; i < probe_ent->n_ports; i++) {
939 void __iomem *port = port_base + i * PORT_REGS_SIZE; 1029 void __iomem *port = port_base + i * PORT_REGS_SIZE;
940 unsigned long portu = (unsigned long)port; 1030 unsigned long portu = (unsigned long)port;
941 u32 tmp;
942 int cnt;
943 1031
944 probe_ent->port[i].cmd_addr = portu + PORT_PRB; 1032 probe_ent->port[i].cmd_addr = portu + PORT_PRB;
945 probe_ent->port[i].scr_addr = portu + PORT_SCONTROL; 1033 probe_ent->port[i].scr_addr = portu + PORT_SCONTROL;
@@ -953,18 +1041,20 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
953 tmp = readl(port + PORT_CTRL_STAT); 1041 tmp = readl(port + PORT_CTRL_STAT);
954 if (tmp & PORT_CS_PORT_RST) { 1042 if (tmp & PORT_CS_PORT_RST) {
955 writel(PORT_CS_PORT_RST, port + PORT_CTRL_CLR); 1043 writel(PORT_CS_PORT_RST, port + PORT_CTRL_CLR);
956 readl(port + PORT_CTRL_STAT); /* sync */ 1044 tmp = ata_wait_register(port + PORT_CTRL_STAT,
957 for (cnt = 0; cnt < 10; cnt++) { 1045 PORT_CS_PORT_RST,
958 msleep(10); 1046 PORT_CS_PORT_RST, 10, 100);
959 tmp = readl(port + PORT_CTRL_STAT);
960 if (!(tmp & PORT_CS_PORT_RST))
961 break;
962 }
963 if (tmp & PORT_CS_PORT_RST) 1047 if (tmp & PORT_CS_PORT_RST)
964 dev_printk(KERN_ERR, &pdev->dev, 1048 dev_printk(KERN_ERR, &pdev->dev,
965 "failed to clear port RST\n"); 1049 "failed to clear port RST\n");
966 } 1050 }
967 1051
1052 /* Configure IRQ WoC */
1053 if (probe_ent->host_flags & SIL24_FLAG_PCIX_IRQ_WOC)
1054 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_STAT);
1055 else
1056 writel(PORT_CS_IRQ_WOC, port + PORT_CTRL_CLR);
1057
968 /* Zero error counters. */ 1058 /* Zero error counters. */
969 writel(0x8000, port + PORT_DECODE_ERR_THRESH); 1059 writel(0x8000, port + PORT_DECODE_ERR_THRESH);
970 writel(0x8000, port + PORT_CRC_ERR_THRESH); 1060 writel(0x8000, port + PORT_CRC_ERR_THRESH);
@@ -973,14 +1063,13 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
973 writel(0x0000, port + PORT_CRC_ERR_CNT); 1063 writel(0x0000, port + PORT_CRC_ERR_CNT);
974 writel(0x0000, port + PORT_HSHK_ERR_CNT); 1064 writel(0x0000, port + PORT_HSHK_ERR_CNT);
975 1065
976 /* FIXME: 32bit activation? */ 1066 /* Always use 64bit activation */
977 writel(0, port + PORT_ACTIVATE_UPPER_ADDR); 1067 writel(PORT_CS_32BIT_ACTV, port + PORT_CTRL_CLR);
978 writel(PORT_CS_32BIT_ACTV, port + PORT_CTRL_STAT);
979 1068
980 /* Configure interrupts */ 1069 /* Configure interrupts */
981 writel(0xffff, port + PORT_IRQ_ENABLE_CLR); 1070 writel(0xffff, port + PORT_IRQ_ENABLE_CLR);
982 writel(PORT_IRQ_COMPLETE | PORT_IRQ_ERROR | PORT_IRQ_SDB_FIS, 1071 writel(PORT_IRQ_COMPLETE | PORT_IRQ_ERROR |
983 port + PORT_IRQ_ENABLE_SET); 1072 PORT_IRQ_SDB_NOTIFY, port + PORT_IRQ_ENABLE_SET);
984 1073
985 /* Clear interrupts */ 1074 /* Clear interrupts */
986 writel(0x0fff0fff, port + PORT_IRQ_STAT); 1075 writel(0x0fff0fff, port + PORT_IRQ_STAT);
@@ -988,11 +1077,6 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
988 1077
989 /* Clear port multiplier enable and resume bits */ 1078 /* Clear port multiplier enable and resume bits */
990 writel(PORT_CS_PM_EN | PORT_CS_RESUME, port + PORT_CTRL_CLR); 1079 writel(PORT_CS_PM_EN | PORT_CS_RESUME, port + PORT_CTRL_CLR);
991
992 /* Reset itself */
993 if (__sil24_reset_controller(port))
994 dev_printk(KERN_ERR, &pdev->dev,
995 "failed to reset controller\n");
996 } 1080 }
997 1081
998 /* Turn on interrupts */ 1082 /* Turn on interrupts */
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
index eb3cf5b534dc..3097821688dc 100644
--- a/drivers/scsi/sata_sis.c
+++ b/drivers/scsi/sata_sis.c
@@ -87,7 +87,6 @@ static struct scsi_host_template sis_sht = {
87 .name = DRV_NAME, 87 .name = DRV_NAME,
88 .ioctl = ata_scsi_ioctl, 88 .ioctl = ata_scsi_ioctl,
89 .queuecommand = ata_scsi_queuecmd, 89 .queuecommand = ata_scsi_queuecmd,
90 .eh_strategy_handler = ata_scsi_error,
91 .can_queue = ATA_DEF_QUEUE, 90 .can_queue = ATA_DEF_QUEUE,
92 .this_id = ATA_SHT_THIS_ID, 91 .this_id = ATA_SHT_THIS_ID,
93 .sg_tablesize = ATA_MAX_PRD, 92 .sg_tablesize = ATA_MAX_PRD,
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
index a20bc8154753..d5eb5375e265 100644
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -257,7 +257,7 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
257 int len, index; 257 int len, index;
258 258
259 /* Find the ata_port */ 259 /* Find the ata_port */
260 ap = (struct ata_port *) &shost->hostdata[0]; 260 ap = ata_shost_to_port(shost);
261 if (ap == NULL) 261 if (ap == NULL)
262 return 0; 262 return 0;
263 263
@@ -290,7 +290,6 @@ static struct scsi_host_template k2_sata_sht = {
290 .name = DRV_NAME, 290 .name = DRV_NAME,
291 .ioctl = ata_scsi_ioctl, 291 .ioctl = ata_scsi_ioctl,
292 .queuecommand = ata_scsi_queuecmd, 292 .queuecommand = ata_scsi_queuecmd,
293 .eh_strategy_handler = ata_scsi_error,
294 .can_queue = ATA_DEF_QUEUE, 293 .can_queue = ATA_DEF_QUEUE,
295 .this_id = ATA_SHT_THIS_ID, 294 .this_id = ATA_SHT_THIS_ID,
296 .sg_tablesize = LIBATA_MAX_PRD, 295 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index 13dba63f6167..4c07ba1f6e62 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -182,7 +182,6 @@ static struct scsi_host_template pdc_sata_sht = {
182 .name = DRV_NAME, 182 .name = DRV_NAME,
183 .ioctl = ata_scsi_ioctl, 183 .ioctl = ata_scsi_ioctl,
184 .queuecommand = ata_scsi_queuecmd, 184 .queuecommand = ata_scsi_queuecmd,
185 .eh_strategy_handler = ata_scsi_error,
186 .can_queue = ATA_DEF_QUEUE, 185 .can_queue = ATA_DEF_QUEUE,
187 .this_id = ATA_SHT_THIS_ID, 186 .this_id = ATA_SHT_THIS_ID,
188 .sg_tablesize = LIBATA_MAX_PRD, 187 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
index 513dd78ea6fe..15f81bfc30f0 100644
--- a/drivers/scsi/sata_uli.c
+++ b/drivers/scsi/sata_uli.c
@@ -81,7 +81,6 @@ static struct scsi_host_template uli_sht = {
81 .name = DRV_NAME, 81 .name = DRV_NAME,
82 .ioctl = ata_scsi_ioctl, 82 .ioctl = ata_scsi_ioctl,
83 .queuecommand = ata_scsi_queuecmd, 83 .queuecommand = ata_scsi_queuecmd,
84 .eh_strategy_handler = ata_scsi_error,
85 .can_queue = ATA_DEF_QUEUE, 84 .can_queue = ATA_DEF_QUEUE,
86 .this_id = ATA_SHT_THIS_ID, 85 .this_id = ATA_SHT_THIS_ID,
87 .sg_tablesize = LIBATA_MAX_PRD, 86 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
index de4e0eb224bb..17aefab5f42f 100644
--- a/drivers/scsi/sata_via.c
+++ b/drivers/scsi/sata_via.c
@@ -94,7 +94,6 @@ static struct scsi_host_template svia_sht = {
94 .name = DRV_NAME, 94 .name = DRV_NAME,
95 .ioctl = ata_scsi_ioctl, 95 .ioctl = ata_scsi_ioctl,
96 .queuecommand = ata_scsi_queuecmd, 96 .queuecommand = ata_scsi_queuecmd,
97 .eh_strategy_handler = ata_scsi_error,
98 .can_queue = ATA_DEF_QUEUE, 97 .can_queue = ATA_DEF_QUEUE,
99 .this_id = ATA_SHT_THIS_ID, 98 .this_id = ATA_SHT_THIS_ID,
100 .sg_tablesize = LIBATA_MAX_PRD, 99 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
index b7d6a31628c2..0372be7ff1c9 100644
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -270,7 +270,6 @@ static struct scsi_host_template vsc_sata_sht = {
270 .name = DRV_NAME, 270 .name = DRV_NAME,
271 .ioctl = ata_scsi_ioctl, 271 .ioctl = ata_scsi_ioctl,
272 .queuecommand = ata_scsi_queuecmd, 272 .queuecommand = ata_scsi_queuecmd,
273 .eh_strategy_handler = ata_scsi_error,
274 .can_queue = ATA_DEF_QUEUE, 273 .can_queue = ATA_DEF_QUEUE,
275 .this_id = ATA_SHT_THIS_ID, 274 .this_id = ATA_SHT_THIS_ID,
276 .sg_tablesize = LIBATA_MAX_PRD, 275 .sg_tablesize = LIBATA_MAX_PRD,
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 5f0fdfb2618c..1c75646f9689 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1537,8 +1537,8 @@ int scsi_error_handler(void *data)
1537 * what we need to do to get it up and online again (if we can). 1537 * what we need to do to get it up and online again (if we can).
1538 * If we fail, we end up taking the thing offline. 1538 * If we fail, we end up taking the thing offline.
1539 */ 1539 */
1540 if (shost->hostt->eh_strategy_handler) 1540 if (shost->transportt->eh_strategy_handler)
1541 shost->hostt->eh_strategy_handler(shost); 1541 shost->transportt->eh_strategy_handler(shost);
1542 else 1542 else
1543 scsi_unjam_host(shost); 1543 scsi_unjam_host(shost);
1544 1544