diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-16 15:12:58 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-16 15:12:58 -0500 |
commit | 3be4bb06b53df2c0a760eeaa5f53448faddedfca (patch) | |
tree | 67dc02f39e48a8a37d8f3e4a38422d86f5164820 /drivers/scsi | |
parent | 85d6162d6cea9220e483989817eac0cebc03070e (diff) | |
parent | 7bdd720869ff75700b48b132ee71852615b55808 (diff) |
Merge branch 'upstream-fixes'
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ahci.c | 39 | ||||
-rw-r--r-- | drivers/scsi/ata_piix.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 70 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 77 | ||||
-rw-r--r-- | drivers/scsi/libata.h | 4 | ||||
-rw-r--r-- | drivers/scsi/sata_promise.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sata_qstor.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sata_sil24.c | 21 | ||||
-rw-r--r-- | drivers/scsi/sata_svw.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sata_sx4.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sata_vsc.c | 2 |
11 files changed, 133 insertions, 90 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 4e96ec5f2ff9..83467a05dc8e 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <asm/io.h> | 48 | #include <asm/io.h> |
49 | 49 | ||
50 | #define DRV_NAME "ahci" | 50 | #define DRV_NAME "ahci" |
51 | #define DRV_VERSION "1.01" | 51 | #define DRV_VERSION "1.2" |
52 | 52 | ||
53 | 53 | ||
54 | enum { | 54 | enum { |
@@ -558,13 +558,26 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc) | |||
558 | pp->cmd_slot[0].opts |= cpu_to_le32(n_elem << 16); | 558 | pp->cmd_slot[0].opts |= cpu_to_le32(n_elem << 16); |
559 | } | 559 | } |
560 | 560 | ||
561 | static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) | 561 | static void ahci_restart_port(struct ata_port *ap, u32 irq_stat) |
562 | { | 562 | { |
563 | void __iomem *mmio = ap->host_set->mmio_base; | 563 | void __iomem *mmio = ap->host_set->mmio_base; |
564 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); | 564 | void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); |
565 | u32 tmp; | 565 | u32 tmp; |
566 | int work; | 566 | int work; |
567 | 567 | ||
568 | if ((ap->device[0].class != ATA_DEV_ATAPI) || | ||
569 | ((irq_stat & PORT_IRQ_TF_ERR) == 0)) | ||
570 | printk(KERN_WARNING "ata%u: port reset, " | ||
571 | "p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n", | ||
572 | ap->id, | ||
573 | irq_stat, | ||
574 | readl(mmio + HOST_IRQ_STAT), | ||
575 | readl(port_mmio + PORT_IRQ_STAT), | ||
576 | readl(port_mmio + PORT_CMD), | ||
577 | readl(port_mmio + PORT_TFDATA), | ||
578 | readl(port_mmio + PORT_SCR_STAT), | ||
579 | readl(port_mmio + PORT_SCR_ERR)); | ||
580 | |||
568 | /* stop DMA */ | 581 | /* stop DMA */ |
569 | tmp = readl(port_mmio + PORT_CMD); | 582 | tmp = readl(port_mmio + PORT_CMD); |
570 | tmp &= ~PORT_CMD_START; | 583 | tmp &= ~PORT_CMD_START; |
@@ -602,8 +615,6 @@ static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) | |||
602 | tmp |= PORT_CMD_START; | 615 | tmp |= PORT_CMD_START; |
603 | writel(tmp, port_mmio + PORT_CMD); | 616 | writel(tmp, port_mmio + PORT_CMD); |
604 | readl(port_mmio + PORT_CMD); /* flush */ | 617 | readl(port_mmio + PORT_CMD); /* flush */ |
605 | |||
606 | printk(KERN_WARNING "ata%u: error occurred, port reset\n", ap->id); | ||
607 | } | 618 | } |
608 | 619 | ||
609 | static void ahci_eng_timeout(struct ata_port *ap) | 620 | static void ahci_eng_timeout(struct ata_port *ap) |
@@ -614,17 +625,17 @@ static void ahci_eng_timeout(struct ata_port *ap) | |||
614 | struct ata_queued_cmd *qc; | 625 | struct ata_queued_cmd *qc; |
615 | unsigned long flags; | 626 | unsigned long flags; |
616 | 627 | ||
617 | DPRINTK("ENTER\n"); | 628 | printk(KERN_WARNING "ata%u: handling error/timeout\n", ap->id); |
618 | 629 | ||
619 | spin_lock_irqsave(&host_set->lock, flags); | 630 | spin_lock_irqsave(&host_set->lock, flags); |
620 | 631 | ||
621 | ahci_intr_error(ap, readl(port_mmio + PORT_IRQ_STAT)); | ||
622 | |||
623 | qc = ata_qc_from_tag(ap, ap->active_tag); | 632 | qc = ata_qc_from_tag(ap, ap->active_tag); |
624 | if (!qc) { | 633 | if (!qc) { |
625 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", | 634 | printk(KERN_ERR "ata%u: BUG: timeout without command\n", |
626 | ap->id); | 635 | ap->id); |
627 | } else { | 636 | } else { |
637 | ahci_restart_port(ap, readl(port_mmio + PORT_IRQ_STAT)); | ||
638 | |||
628 | /* hack alert! We cannot use the supplied completion | 639 | /* hack alert! We cannot use the supplied completion |
629 | * function from inside the ->eh_strategy_handler() thread. | 640 | * function from inside the ->eh_strategy_handler() thread. |
630 | * libata is the only user of ->eh_strategy_handler() in | 641 | * libata is the only user of ->eh_strategy_handler() in |
@@ -659,9 +670,19 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
659 | } | 670 | } |
660 | 671 | ||
661 | if (status & PORT_IRQ_FATAL) { | 672 | if (status & PORT_IRQ_FATAL) { |
662 | ahci_intr_error(ap, status); | 673 | unsigned int err_mask; |
674 | if (status & PORT_IRQ_TF_ERR) | ||
675 | err_mask = AC_ERR_DEV; | ||
676 | else if (status & PORT_IRQ_IF_ERR) | ||
677 | err_mask = AC_ERR_ATA_BUS; | ||
678 | else | ||
679 | err_mask = AC_ERR_HOST_BUS; | ||
680 | |||
681 | /* command processing has stopped due to error; restart */ | ||
682 | ahci_restart_port(ap, status); | ||
683 | |||
663 | if (qc) | 684 | if (qc) |
664 | ata_qc_complete(qc, AC_ERR_OTHER); | 685 | ata_qc_complete(qc, err_mask); |
665 | } | 686 | } |
666 | 687 | ||
667 | return 1; | 688 | return 1; |
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 855428ff37e9..333d69dd84ef 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -50,7 +50,7 @@ | |||
50 | #include <linux/libata.h> | 50 | #include <linux/libata.h> |
51 | 51 | ||
52 | #define DRV_NAME "ata_piix" | 52 | #define DRV_NAME "ata_piix" |
53 | #define DRV_VERSION "1.04" | 53 | #define DRV_VERSION "1.05" |
54 | 54 | ||
55 | enum { | 55 | enum { |
56 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ | 56 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index d81db3a3d4b9..bb604dfbdef6 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -1263,7 +1263,7 @@ retry: | |||
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | /* ATAPI-specific feature tests */ | 1265 | /* ATAPI-specific feature tests */ |
1266 | else { | 1266 | else if (dev->class == ATA_DEV_ATAPI) { |
1267 | if (ata_id_is_ata(dev->id)) /* sanity check */ | 1267 | if (ata_id_is_ata(dev->id)) /* sanity check */ |
1268 | goto err_out_nosup; | 1268 | goto err_out_nosup; |
1269 | 1269 | ||
@@ -1570,11 +1570,13 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, | |||
1570 | 1570 | ||
1571 | /* | 1571 | /* |
1572 | * Find the mode. | 1572 | * Find the mode. |
1573 | */ | 1573 | */ |
1574 | 1574 | ||
1575 | if (!(s = ata_timing_find_mode(speed))) | 1575 | if (!(s = ata_timing_find_mode(speed))) |
1576 | return -EINVAL; | 1576 | return -EINVAL; |
1577 | 1577 | ||
1578 | memcpy(t, s, sizeof(*s)); | ||
1579 | |||
1578 | /* | 1580 | /* |
1579 | * If the drive is an EIDE drive, it can tell us it needs extended | 1581 | * If the drive is an EIDE drive, it can tell us it needs extended |
1580 | * PIO/MW_DMA cycle timing. | 1582 | * PIO/MW_DMA cycle timing. |
@@ -1595,7 +1597,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, | |||
1595 | * Convert the timing to bus clock counts. | 1597 | * Convert the timing to bus clock counts. |
1596 | */ | 1598 | */ |
1597 | 1599 | ||
1598 | ata_timing_quantize(s, t, T, UT); | 1600 | ata_timing_quantize(t, t, T, UT); |
1599 | 1601 | ||
1600 | /* | 1602 | /* |
1601 | * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T | 1603 | * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T |
@@ -2399,7 +2401,7 @@ static void ata_sg_clean(struct ata_queued_cmd *qc) | |||
2399 | if (qc->flags & ATA_QCFLAG_SINGLE) | 2401 | if (qc->flags & ATA_QCFLAG_SINGLE) |
2400 | assert(qc->n_elem == 1); | 2402 | assert(qc->n_elem == 1); |
2401 | 2403 | ||
2402 | DPRINTK("unmapping %u sg elements\n", qc->n_elem); | 2404 | VPRINTK("unmapping %u sg elements\n", qc->n_elem); |
2403 | 2405 | ||
2404 | /* if we padded the buffer out to 32-bit bound, and data | 2406 | /* if we padded the buffer out to 32-bit bound, and data |
2405 | * xfer direction is from-device, we must copy from the | 2407 | * xfer direction is from-device, we must copy from the |
@@ -2409,7 +2411,8 @@ static void ata_sg_clean(struct ata_queued_cmd *qc) | |||
2409 | pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ); | 2411 | pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ); |
2410 | 2412 | ||
2411 | if (qc->flags & ATA_QCFLAG_SG) { | 2413 | if (qc->flags & ATA_QCFLAG_SG) { |
2412 | dma_unmap_sg(ap->host_set->dev, sg, qc->n_elem, dir); | 2414 | if (qc->n_elem) |
2415 | dma_unmap_sg(ap->host_set->dev, sg, qc->n_elem, dir); | ||
2413 | /* restore last sg */ | 2416 | /* restore last sg */ |
2414 | sg[qc->orig_n_elem - 1].length += qc->pad_len; | 2417 | sg[qc->orig_n_elem - 1].length += qc->pad_len; |
2415 | if (pad_buf) { | 2418 | if (pad_buf) { |
@@ -2419,8 +2422,10 @@ static void ata_sg_clean(struct ata_queued_cmd *qc) | |||
2419 | kunmap_atomic(psg->page, KM_IRQ0); | 2422 | kunmap_atomic(psg->page, KM_IRQ0); |
2420 | } | 2423 | } |
2421 | } else { | 2424 | } else { |
2422 | dma_unmap_single(ap->host_set->dev, sg_dma_address(&sg[0]), | 2425 | if (sg_dma_len(&sg[0]) > 0) |
2423 | sg_dma_len(&sg[0]), dir); | 2426 | dma_unmap_single(ap->host_set->dev, |
2427 | sg_dma_address(&sg[0]), sg_dma_len(&sg[0]), | ||
2428 | dir); | ||
2424 | /* restore sg */ | 2429 | /* restore sg */ |
2425 | sg->length += qc->pad_len; | 2430 | sg->length += qc->pad_len; |
2426 | if (pad_buf) | 2431 | if (pad_buf) |
@@ -2619,6 +2624,11 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc) | |||
2619 | sg->length, qc->pad_len); | 2624 | sg->length, qc->pad_len); |
2620 | } | 2625 | } |
2621 | 2626 | ||
2627 | if (!sg->length) { | ||
2628 | sg_dma_address(sg) = 0; | ||
2629 | goto skip_map; | ||
2630 | } | ||
2631 | |||
2622 | dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt, | 2632 | dma_address = dma_map_single(ap->host_set->dev, qc->buf_virt, |
2623 | sg->length, dir); | 2633 | sg->length, dir); |
2624 | if (dma_mapping_error(dma_address)) { | 2634 | if (dma_mapping_error(dma_address)) { |
@@ -2628,6 +2638,7 @@ static int ata_sg_setup_one(struct ata_queued_cmd *qc) | |||
2628 | } | 2638 | } |
2629 | 2639 | ||
2630 | sg_dma_address(sg) = dma_address; | 2640 | sg_dma_address(sg) = dma_address; |
2641 | skip_map: | ||
2631 | sg_dma_len(sg) = sg->length; | 2642 | sg_dma_len(sg) = sg->length; |
2632 | 2643 | ||
2633 | DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg), | 2644 | DPRINTK("mapped buffer of %d bytes for %s\n", sg_dma_len(sg), |
@@ -2655,7 +2666,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) | |||
2655 | struct ata_port *ap = qc->ap; | 2666 | struct ata_port *ap = qc->ap; |
2656 | struct scatterlist *sg = qc->__sg; | 2667 | struct scatterlist *sg = qc->__sg; |
2657 | struct scatterlist *lsg = &sg[qc->n_elem - 1]; | 2668 | struct scatterlist *lsg = &sg[qc->n_elem - 1]; |
2658 | int n_elem, dir; | 2669 | int n_elem, pre_n_elem, dir, trim_sg = 0; |
2659 | 2670 | ||
2660 | VPRINTK("ENTER, ata%u\n", ap->id); | 2671 | VPRINTK("ENTER, ata%u\n", ap->id); |
2661 | assert(qc->flags & ATA_QCFLAG_SG); | 2672 | assert(qc->flags & ATA_QCFLAG_SG); |
@@ -2689,13 +2700,24 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) | |||
2689 | sg_dma_len(psg) = ATA_DMA_PAD_SZ; | 2700 | sg_dma_len(psg) = ATA_DMA_PAD_SZ; |
2690 | /* trim last sg */ | 2701 | /* trim last sg */ |
2691 | lsg->length -= qc->pad_len; | 2702 | lsg->length -= qc->pad_len; |
2703 | if (lsg->length == 0) | ||
2704 | trim_sg = 1; | ||
2692 | 2705 | ||
2693 | DPRINTK("padding done, sg[%d].length=%u pad_len=%u\n", | 2706 | DPRINTK("padding done, sg[%d].length=%u pad_len=%u\n", |
2694 | qc->n_elem - 1, lsg->length, qc->pad_len); | 2707 | qc->n_elem - 1, lsg->length, qc->pad_len); |
2695 | } | 2708 | } |
2696 | 2709 | ||
2710 | pre_n_elem = qc->n_elem; | ||
2711 | if (trim_sg && pre_n_elem) | ||
2712 | pre_n_elem--; | ||
2713 | |||
2714 | if (!pre_n_elem) { | ||
2715 | n_elem = 0; | ||
2716 | goto skip_map; | ||
2717 | } | ||
2718 | |||
2697 | dir = qc->dma_dir; | 2719 | dir = qc->dma_dir; |
2698 | n_elem = dma_map_sg(ap->host_set->dev, sg, qc->n_elem, dir); | 2720 | n_elem = dma_map_sg(ap->host_set->dev, sg, pre_n_elem, dir); |
2699 | if (n_elem < 1) { | 2721 | if (n_elem < 1) { |
2700 | /* restore last sg */ | 2722 | /* restore last sg */ |
2701 | lsg->length += qc->pad_len; | 2723 | lsg->length += qc->pad_len; |
@@ -2704,6 +2726,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) | |||
2704 | 2726 | ||
2705 | DPRINTK("%d sg elements mapped\n", n_elem); | 2727 | DPRINTK("%d sg elements mapped\n", n_elem); |
2706 | 2728 | ||
2729 | skip_map: | ||
2707 | qc->n_elem = n_elem; | 2730 | qc->n_elem = n_elem; |
2708 | 2731 | ||
2709 | return 0; | 2732 | return 0; |
@@ -3263,32 +3286,11 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) | |||
3263 | { | 3286 | { |
3264 | struct ata_port *ap = qc->ap; | 3287 | struct ata_port *ap = qc->ap; |
3265 | struct ata_host_set *host_set = ap->host_set; | 3288 | struct ata_host_set *host_set = ap->host_set; |
3266 | struct ata_device *dev = qc->dev; | ||
3267 | u8 host_stat = 0, drv_stat; | 3289 | u8 host_stat = 0, drv_stat; |
3268 | unsigned long flags; | 3290 | unsigned long flags; |
3269 | 3291 | ||
3270 | DPRINTK("ENTER\n"); | 3292 | DPRINTK("ENTER\n"); |
3271 | 3293 | ||
3272 | /* FIXME: doesn't this conflict with timeout handling? */ | ||
3273 | if (qc->dev->class == ATA_DEV_ATAPI && qc->scsicmd) { | ||
3274 | struct scsi_cmnd *cmd = qc->scsicmd; | ||
3275 | |||
3276 | if (!(cmd->eh_eflags & SCSI_EH_CANCEL_CMD)) { | ||
3277 | |||
3278 | /* finish completing original command */ | ||
3279 | spin_lock_irqsave(&host_set->lock, flags); | ||
3280 | __ata_qc_complete(qc); | ||
3281 | spin_unlock_irqrestore(&host_set->lock, flags); | ||
3282 | |||
3283 | atapi_request_sense(ap, dev, cmd); | ||
3284 | |||
3285 | cmd->result = (CHECK_CONDITION << 1) | (DID_OK << 16); | ||
3286 | scsi_finish_command(cmd); | ||
3287 | |||
3288 | goto out; | ||
3289 | } | ||
3290 | } | ||
3291 | |||
3292 | spin_lock_irqsave(&host_set->lock, flags); | 3294 | spin_lock_irqsave(&host_set->lock, flags); |
3293 | 3295 | ||
3294 | /* hack alert! We cannot use the supplied completion | 3296 | /* hack alert! We cannot use the supplied completion |
@@ -3327,7 +3329,6 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) | |||
3327 | 3329 | ||
3328 | spin_unlock_irqrestore(&host_set->lock, flags); | 3330 | spin_unlock_irqrestore(&host_set->lock, flags); |
3329 | 3331 | ||
3330 | out: | ||
3331 | DPRINTK("EXIT\n"); | 3332 | DPRINTK("EXIT\n"); |
3332 | } | 3333 | } |
3333 | 3334 | ||
@@ -3411,16 +3412,11 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | |||
3411 | 3412 | ||
3412 | qc = ata_qc_new(ap); | 3413 | qc = ata_qc_new(ap); |
3413 | if (qc) { | 3414 | if (qc) { |
3414 | qc->__sg = NULL; | ||
3415 | qc->flags = 0; | ||
3416 | qc->scsicmd = NULL; | 3415 | qc->scsicmd = NULL; |
3417 | qc->ap = ap; | 3416 | qc->ap = ap; |
3418 | qc->dev = dev; | 3417 | qc->dev = dev; |
3419 | qc->cursect = qc->cursg = qc->cursg_ofs = 0; | ||
3420 | qc->nsect = 0; | ||
3421 | qc->nbytes = qc->curbytes = 0; | ||
3422 | 3418 | ||
3423 | ata_tf_init(ap, &qc->tf, dev->devno); | 3419 | ata_qc_reinit(qc); |
3424 | } | 3420 | } |
3425 | 3421 | ||
3426 | return qc; | 3422 | return qc; |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 0df4b682965d..3b4ca55a3332 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -1955,22 +1955,44 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8 | |||
1955 | done(cmd); | 1955 | done(cmd); |
1956 | } | 1956 | } |
1957 | 1957 | ||
1958 | void atapi_request_sense(struct ata_port *ap, struct ata_device *dev, | 1958 | static int atapi_sense_complete(struct ata_queued_cmd *qc,unsigned int err_mask) |
1959 | struct scsi_cmnd *cmd) | ||
1960 | { | 1959 | { |
1961 | DECLARE_COMPLETION(wait); | 1960 | if (err_mask && ((err_mask & AC_ERR_DEV) == 0)) |
1962 | struct ata_queued_cmd *qc; | 1961 | /* FIXME: not quite right; we don't want the |
1963 | unsigned long flags; | 1962 | * translation of taskfile registers into |
1964 | int rc; | 1963 | * a sense descriptors, since that's only |
1964 | * correct for ATA, not ATAPI | ||
1965 | */ | ||
1966 | ata_gen_ata_desc_sense(qc); | ||
1965 | 1967 | ||
1966 | DPRINTK("ATAPI request sense\n"); | 1968 | qc->scsidone(qc->scsicmd); |
1969 | return 0; | ||
1970 | } | ||
1967 | 1971 | ||
1968 | qc = ata_qc_new_init(ap, dev); | 1972 | /* is it pointless to prefer PIO for "safety reasons"? */ |
1969 | BUG_ON(qc == NULL); | 1973 | static inline int ata_pio_use_silly(struct ata_port *ap) |
1974 | { | ||
1975 | return (ap->flags & ATA_FLAG_PIO_DMA); | ||
1976 | } | ||
1977 | |||
1978 | static void atapi_request_sense(struct ata_queued_cmd *qc) | ||
1979 | { | ||
1980 | struct ata_port *ap = qc->ap; | ||
1981 | struct scsi_cmnd *cmd = qc->scsicmd; | ||
1982 | |||
1983 | DPRINTK("ATAPI request sense\n"); | ||
1970 | 1984 | ||
1971 | /* FIXME: is this needed? */ | 1985 | /* FIXME: is this needed? */ |
1972 | memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer)); | 1986 | memset(cmd->sense_buffer, 0, sizeof(cmd->sense_buffer)); |
1973 | 1987 | ||
1988 | ap->ops->tf_read(ap, &qc->tf); | ||
1989 | |||
1990 | /* fill these in, for the case where they are -not- overwritten */ | ||
1991 | cmd->sense_buffer[0] = 0x70; | ||
1992 | cmd->sense_buffer[2] = qc->tf.feature >> 4; | ||
1993 | |||
1994 | ata_qc_reinit(qc); | ||
1995 | |||
1974 | ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer)); | 1996 | ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer)); |
1975 | qc->dma_dir = DMA_FROM_DEVICE; | 1997 | qc->dma_dir = DMA_FROM_DEVICE; |
1976 | 1998 | ||
@@ -1981,22 +2003,20 @@ void atapi_request_sense(struct ata_port *ap, struct ata_device *dev, | |||
1981 | qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; | 2003 | qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; |
1982 | qc->tf.command = ATA_CMD_PACKET; | 2004 | qc->tf.command = ATA_CMD_PACKET; |
1983 | 2005 | ||
1984 | qc->tf.protocol = ATA_PROT_ATAPI; | 2006 | if (ata_pio_use_silly(ap)) { |
1985 | qc->tf.lbam = (8 * 1024) & 0xff; | 2007 | qc->tf.protocol = ATA_PROT_ATAPI_DMA; |
1986 | qc->tf.lbah = (8 * 1024) >> 8; | 2008 | qc->tf.feature |= ATAPI_PKT_DMA; |
2009 | } else { | ||
2010 | qc->tf.protocol = ATA_PROT_ATAPI; | ||
2011 | qc->tf.lbam = (8 * 1024) & 0xff; | ||
2012 | qc->tf.lbah = (8 * 1024) >> 8; | ||
2013 | } | ||
1987 | qc->nbytes = SCSI_SENSE_BUFFERSIZE; | 2014 | qc->nbytes = SCSI_SENSE_BUFFERSIZE; |
1988 | 2015 | ||
1989 | qc->waiting = &wait; | 2016 | qc->complete_fn = atapi_sense_complete; |
1990 | qc->complete_fn = ata_qc_complete_noop; | ||
1991 | 2017 | ||
1992 | spin_lock_irqsave(&ap->host_set->lock, flags); | 2018 | if (ata_qc_issue(qc)) |
1993 | rc = ata_qc_issue(qc); | 2019 | ata_qc_complete(qc, AC_ERR_OTHER); |
1994 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | ||
1995 | |||
1996 | if (rc) | ||
1997 | ata_port_disable(ap); | ||
1998 | else | ||
1999 | wait_for_completion(&wait); | ||
2000 | 2020 | ||
2001 | DPRINTK("EXIT\n"); | 2021 | DPRINTK("EXIT\n"); |
2002 | } | 2022 | } |
@@ -2008,19 +2028,8 @@ static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | |||
2008 | VPRINTK("ENTER, err_mask 0x%X\n", err_mask); | 2028 | VPRINTK("ENTER, err_mask 0x%X\n", err_mask); |
2009 | 2029 | ||
2010 | if (unlikely(err_mask & AC_ERR_DEV)) { | 2030 | if (unlikely(err_mask & AC_ERR_DEV)) { |
2011 | DPRINTK("request check condition\n"); | ||
2012 | |||
2013 | /* FIXME: command completion with check condition | ||
2014 | * but no sense causes the error handler to run, | ||
2015 | * which then issues REQUEST SENSE, fills in the sense | ||
2016 | * buffer, and completes the command (for the second | ||
2017 | * time). We need to issue REQUEST SENSE some other | ||
2018 | * way, to avoid completing the command twice. | ||
2019 | */ | ||
2020 | cmd->result = SAM_STAT_CHECK_CONDITION; | 2031 | cmd->result = SAM_STAT_CHECK_CONDITION; |
2021 | 2032 | atapi_request_sense(qc); | |
2022 | qc->scsidone(cmd); | ||
2023 | |||
2024 | return 1; | 2033 | return 1; |
2025 | } | 2034 | } |
2026 | 2035 | ||
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index fad051ca4672..8ebaa694d18e 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -29,7 +29,7 @@ | |||
29 | #define __LIBATA_H__ | 29 | #define __LIBATA_H__ |
30 | 30 | ||
31 | #define DRV_NAME "libata" | 31 | #define DRV_NAME "libata" |
32 | #define DRV_VERSION "1.12" /* must be exactly four chars */ | 32 | #define DRV_VERSION "1.20" /* must be exactly four chars */ |
33 | 33 | ||
34 | struct ata_scsi_args { | 34 | struct ata_scsi_args { |
35 | u16 *id; | 35 | u16 *id; |
@@ -54,8 +54,6 @@ extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); | |||
54 | 54 | ||
55 | 55 | ||
56 | /* libata-scsi.c */ | 56 | /* libata-scsi.c */ |
57 | extern void atapi_request_sense(struct ata_port *ap, struct ata_device *dev, | ||
58 | struct scsi_cmnd *cmd); | ||
59 | extern void ata_scsi_scan_host(struct ata_port *ap); | 57 | extern void ata_scsi_scan_host(struct ata_port *ap); |
60 | extern int ata_scsi_error(struct Scsi_Host *host); | 58 | extern int ata_scsi_error(struct Scsi_Host *host); |
61 | extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, | 59 | extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 242d906987ad..8a8e3e3ef0ed 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "sata_promise.h" | 46 | #include "sata_promise.h" |
47 | 47 | ||
48 | #define DRV_NAME "sata_promise" | 48 | #define DRV_NAME "sata_promise" |
49 | #define DRV_VERSION "1.02" | 49 | #define DRV_VERSION "1.03" |
50 | 50 | ||
51 | 51 | ||
52 | enum { | 52 | enum { |
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index 4a6d3067d23c..a8987f5ff5cc 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <linux/libata.h> | 41 | #include <linux/libata.h> |
42 | 42 | ||
43 | #define DRV_NAME "sata_qstor" | 43 | #define DRV_NAME "sata_qstor" |
44 | #define DRV_VERSION "0.04" | 44 | #define DRV_VERSION "0.05" |
45 | 45 | ||
46 | enum { | 46 | enum { |
47 | QS_PORTS = 4, | 47 | QS_PORTS = 4, |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 55e744d6db88..cb1933a3bd55 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -139,6 +139,7 @@ enum { | |||
139 | PORT_CS_DEV_RST = (1 << 1), /* device reset */ | 139 | PORT_CS_DEV_RST = (1 << 1), /* device reset */ |
140 | PORT_CS_INIT = (1 << 2), /* port initialize */ | 140 | PORT_CS_INIT = (1 << 2), /* port initialize */ |
141 | PORT_CS_IRQ_WOC = (1 << 3), /* interrupt write one to clear */ | 141 | PORT_CS_IRQ_WOC = (1 << 3), /* interrupt write one to clear */ |
142 | PORT_CS_CDB16 = (1 << 5), /* 0=12b cdb, 1=16b cdb */ | ||
142 | PORT_CS_RESUME = (1 << 6), /* port resume */ | 143 | PORT_CS_RESUME = (1 << 6), /* port resume */ |
143 | PORT_CS_32BIT_ACTV = (1 << 10), /* 32-bit activation */ | 144 | PORT_CS_32BIT_ACTV = (1 << 10), /* 32-bit activation */ |
144 | PORT_CS_PM_EN = (1 << 13), /* port multiplier enable */ | 145 | PORT_CS_PM_EN = (1 << 13), /* port multiplier enable */ |
@@ -188,11 +189,29 @@ enum { | |||
188 | 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 */ |
189 | PORT_CERR_SENDSERVICE = 36, /* FIS received while sending service */ | 190 | PORT_CERR_SENDSERVICE = 36, /* FIS received while sending service */ |
190 | 191 | ||
192 | /* bits of PRB control field */ | ||
193 | PRB_CTRL_PROTOCOL = (1 << 0), /* override def. ATA protocol */ | ||
194 | PRB_CTRL_PACKET_READ = (1 << 4), /* PACKET cmd read */ | ||
195 | PRB_CTRL_PACKET_WRITE = (1 << 5), /* PACKET cmd write */ | ||
196 | PRB_CTRL_NIEN = (1 << 6), /* Mask completion irq */ | ||
197 | PRB_CTRL_SRST = (1 << 7), /* Soft reset request (ign BSY?) */ | ||
198 | |||
199 | /* PRB protocol field */ | ||
200 | PRB_PROT_PACKET = (1 << 0), | ||
201 | PRB_PROT_TCQ = (1 << 1), | ||
202 | PRB_PROT_NCQ = (1 << 2), | ||
203 | PRB_PROT_READ = (1 << 3), | ||
204 | PRB_PROT_WRITE = (1 << 4), | ||
205 | PRB_PROT_TRANSPARENT = (1 << 5), | ||
206 | |||
191 | /* | 207 | /* |
192 | * Other constants | 208 | * Other constants |
193 | */ | 209 | */ |
194 | SGE_TRM = (1 << 31), /* Last SGE in chain */ | 210 | SGE_TRM = (1 << 31), /* Last SGE in chain */ |
195 | PRB_SOFT_RST = (1 << 7), /* Soft reset request (ign BSY?) */ | 211 | SGE_LNK = (1 << 30), /* linked list |
212 | Points to SGT, not SGE */ | ||
213 | SGE_DRD = (1 << 29), /* discard data read (/dev/null) | ||
214 | data address ignored */ | ||
196 | 215 | ||
197 | /* board id */ | 216 | /* board id */ |
198 | BID_SIL3124 = 0, | 217 | BID_SIL3124 = 0, |
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index 57e5a9d964c3..6e7f7c83a75a 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c | |||
@@ -54,7 +54,7 @@ | |||
54 | #endif /* CONFIG_PPC_OF */ | 54 | #endif /* CONFIG_PPC_OF */ |
55 | 55 | ||
56 | #define DRV_NAME "sata_svw" | 56 | #define DRV_NAME "sata_svw" |
57 | #define DRV_VERSION "1.06" | 57 | #define DRV_VERSION "1.07" |
58 | 58 | ||
59 | /* Taskfile registers offsets */ | 59 | /* Taskfile registers offsets */ |
60 | #define K2_SATA_TF_CMD_OFFSET 0x00 | 60 | #define K2_SATA_TF_CMD_OFFSET 0x00 |
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index b4bbe48acab0..dcc3ad9a9d6e 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "sata_promise.h" | 46 | #include "sata_promise.h" |
47 | 47 | ||
48 | #define DRV_NAME "sata_sx4" | 48 | #define DRV_NAME "sata_sx4" |
49 | #define DRV_VERSION "0.7" | 49 | #define DRV_VERSION "0.8" |
50 | 50 | ||
51 | 51 | ||
52 | enum { | 52 | enum { |
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index 77a6e4b9262d..fcfa486965b4 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c | |||
@@ -47,7 +47,7 @@ | |||
47 | #include <linux/libata.h> | 47 | #include <linux/libata.h> |
48 | 48 | ||
49 | #define DRV_NAME "sata_vsc" | 49 | #define DRV_NAME "sata_vsc" |
50 | #define DRV_VERSION "1.0" | 50 | #define DRV_VERSION "1.1" |
51 | 51 | ||
52 | /* Interrupt register offsets (from chip base address) */ | 52 | /* Interrupt register offsets (from chip base address) */ |
53 | #define VSC_SATA_INT_STAT_OFFSET 0x00 | 53 | #define VSC_SATA_INT_STAT_OFFSET 0x00 |