diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 68 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 21 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 23 | ||||
-rw-r--r-- | drivers/ata/libata.h | 19 | ||||
-rw-r--r-- | drivers/ata/pata_cs5535.c | 1 | ||||
-rw-r--r-- | drivers/ata/pata_cs5536.c | 1 | ||||
-rw-r--r-- | drivers/ata/pata_pcmcia.c | 1 | ||||
-rw-r--r-- | drivers/ata/pata_sch.c | 2 |
8 files changed, 78 insertions, 58 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 622350d9b2e3..4214bfb13bbd 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -612,7 +612,7 @@ u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev) | |||
612 | if (tf->flags & ATA_TFLAG_LBA48) { | 612 | if (tf->flags & ATA_TFLAG_LBA48) { |
613 | block |= (u64)tf->hob_lbah << 40; | 613 | block |= (u64)tf->hob_lbah << 40; |
614 | block |= (u64)tf->hob_lbam << 32; | 614 | block |= (u64)tf->hob_lbam << 32; |
615 | block |= tf->hob_lbal << 24; | 615 | block |= (u64)tf->hob_lbal << 24; |
616 | } else | 616 | } else |
617 | block |= (tf->device & 0xf) << 24; | 617 | block |= (tf->device & 0xf) << 24; |
618 | 618 | ||
@@ -1712,6 +1712,8 @@ unsigned ata_exec_internal_sg(struct ata_device *dev, | |||
1712 | else | 1712 | else |
1713 | tag = 0; | 1713 | tag = 0; |
1714 | 1714 | ||
1715 | if (test_and_set_bit(tag, &ap->qc_allocated)) | ||
1716 | BUG(); | ||
1715 | qc = __ata_qc_from_tag(ap, tag); | 1717 | qc = __ata_qc_from_tag(ap, tag); |
1716 | 1718 | ||
1717 | qc->tag = tag; | 1719 | qc->tag = tag; |
@@ -4563,6 +4565,37 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
4563 | } | 4565 | } |
4564 | 4566 | ||
4565 | /** | 4567 | /** |
4568 | * ata_qc_new - Request an available ATA command, for queueing | ||
4569 | * @ap: Port associated with device @dev | ||
4570 | * @dev: Device from whom we request an available command structure | ||
4571 | * | ||
4572 | * LOCKING: | ||
4573 | * None. | ||
4574 | */ | ||
4575 | |||
4576 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) | ||
4577 | { | ||
4578 | struct ata_queued_cmd *qc = NULL; | ||
4579 | unsigned int i; | ||
4580 | |||
4581 | /* no command while frozen */ | ||
4582 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) | ||
4583 | return NULL; | ||
4584 | |||
4585 | /* the last tag is reserved for internal command. */ | ||
4586 | for (i = 0; i < ATA_MAX_QUEUE - 1; i++) | ||
4587 | if (!test_and_set_bit(i, &ap->qc_allocated)) { | ||
4588 | qc = __ata_qc_from_tag(ap, i); | ||
4589 | break; | ||
4590 | } | ||
4591 | |||
4592 | if (qc) | ||
4593 | qc->tag = i; | ||
4594 | |||
4595 | return qc; | ||
4596 | } | ||
4597 | |||
4598 | /** | ||
4566 | * ata_qc_new_init - Request an available ATA command, and initialize it | 4599 | * ata_qc_new_init - Request an available ATA command, and initialize it |
4567 | * @dev: Device from whom we request an available command structure | 4600 | * @dev: Device from whom we request an available command structure |
4568 | * @tag: command tag | 4601 | * @tag: command tag |
@@ -4571,20 +4604,16 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
4571 | * None. | 4604 | * None. |
4572 | */ | 4605 | */ |
4573 | 4606 | ||
4574 | struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag) | 4607 | struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev) |
4575 | { | 4608 | { |
4576 | struct ata_port *ap = dev->link->ap; | 4609 | struct ata_port *ap = dev->link->ap; |
4577 | struct ata_queued_cmd *qc; | 4610 | struct ata_queued_cmd *qc; |
4578 | 4611 | ||
4579 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) | 4612 | qc = ata_qc_new(ap); |
4580 | return NULL; | ||
4581 | |||
4582 | qc = __ata_qc_from_tag(ap, tag); | ||
4583 | if (qc) { | 4613 | if (qc) { |
4584 | qc->scsicmd = NULL; | 4614 | qc->scsicmd = NULL; |
4585 | qc->ap = ap; | 4615 | qc->ap = ap; |
4586 | qc->dev = dev; | 4616 | qc->dev = dev; |
4587 | qc->tag = tag; | ||
4588 | 4617 | ||
4589 | ata_qc_reinit(qc); | 4618 | ata_qc_reinit(qc); |
4590 | } | 4619 | } |
@@ -4592,6 +4621,31 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag) | |||
4592 | return qc; | 4621 | return qc; |
4593 | } | 4622 | } |
4594 | 4623 | ||
4624 | /** | ||
4625 | * ata_qc_free - free unused ata_queued_cmd | ||
4626 | * @qc: Command to complete | ||
4627 | * | ||
4628 | * Designed to free unused ata_queued_cmd object | ||
4629 | * in case something prevents using it. | ||
4630 | * | ||
4631 | * LOCKING: | ||
4632 | * spin_lock_irqsave(host lock) | ||
4633 | */ | ||
4634 | void ata_qc_free(struct ata_queued_cmd *qc) | ||
4635 | { | ||
4636 | struct ata_port *ap = qc->ap; | ||
4637 | unsigned int tag; | ||
4638 | |||
4639 | WARN_ON(qc == NULL); /* ata_qc_from_tag _might_ return NULL */ | ||
4640 | |||
4641 | qc->flags = 0; | ||
4642 | tag = qc->tag; | ||
4643 | if (likely(ata_tag_valid(tag))) { | ||
4644 | qc->tag = ATA_TAG_POISON; | ||
4645 | clear_bit(tag, &ap->qc_allocated); | ||
4646 | } | ||
4647 | } | ||
4648 | |||
4595 | void __ata_qc_complete(struct ata_queued_cmd *qc) | 4649 | void __ata_qc_complete(struct ata_queued_cmd *qc) |
4596 | { | 4650 | { |
4597 | struct ata_port *ap = qc->ap; | 4651 | struct ata_port *ap = qc->ap; |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 8077bdf5d30d..32da9a93ce44 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -610,9 +610,6 @@ void ata_scsi_error(struct Scsi_Host *host) | |||
610 | if (ata_ncq_enabled(dev)) | 610 | if (ata_ncq_enabled(dev)) |
611 | ehc->saved_ncq_enabled |= 1 << devno; | 611 | ehc->saved_ncq_enabled |= 1 << devno; |
612 | } | 612 | } |
613 | |||
614 | /* set last reset timestamp to some time in the past */ | ||
615 | ehc->last_reset = jiffies - 60 * HZ; | ||
616 | } | 613 | } |
617 | 614 | ||
618 | ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; | 615 | ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; |
@@ -2281,17 +2278,21 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2281 | if (link->flags & ATA_LFLAG_NO_SRST) | 2278 | if (link->flags & ATA_LFLAG_NO_SRST) |
2282 | softreset = NULL; | 2279 | softreset = NULL; |
2283 | 2280 | ||
2284 | now = jiffies; | 2281 | /* make sure each reset attemp is at least COOL_DOWN apart */ |
2285 | deadline = ata_deadline(ehc->last_reset, ATA_EH_RESET_COOL_DOWN); | 2282 | if (ehc->i.flags & ATA_EHI_DID_RESET) { |
2286 | if (time_before(now, deadline)) | 2283 | now = jiffies; |
2287 | schedule_timeout_uninterruptible(deadline - now); | 2284 | WARN_ON(time_after(ehc->last_reset, now)); |
2285 | deadline = ata_deadline(ehc->last_reset, | ||
2286 | ATA_EH_RESET_COOL_DOWN); | ||
2287 | if (time_before(now, deadline)) | ||
2288 | schedule_timeout_uninterruptible(deadline - now); | ||
2289 | } | ||
2288 | 2290 | ||
2289 | spin_lock_irqsave(ap->lock, flags); | 2291 | spin_lock_irqsave(ap->lock, flags); |
2290 | ap->pflags |= ATA_PFLAG_RESETTING; | 2292 | ap->pflags |= ATA_PFLAG_RESETTING; |
2291 | spin_unlock_irqrestore(ap->lock, flags); | 2293 | spin_unlock_irqrestore(ap->lock, flags); |
2292 | 2294 | ||
2293 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); | 2295 | ata_eh_about_to_do(link, NULL, ATA_EH_RESET); |
2294 | ehc->last_reset = jiffies; | ||
2295 | 2296 | ||
2296 | ata_link_for_each_dev(dev, link) { | 2297 | ata_link_for_each_dev(dev, link) { |
2297 | /* If we issue an SRST then an ATA drive (not ATAPI) | 2298 | /* If we issue an SRST then an ATA drive (not ATAPI) |
@@ -2379,7 +2380,6 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2379 | /* | 2380 | /* |
2380 | * Perform reset | 2381 | * Perform reset |
2381 | */ | 2382 | */ |
2382 | ehc->last_reset = jiffies; | ||
2383 | if (ata_is_host_link(link)) | 2383 | if (ata_is_host_link(link)) |
2384 | ata_eh_freeze_port(ap); | 2384 | ata_eh_freeze_port(ap); |
2385 | 2385 | ||
@@ -2391,6 +2391,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2391 | reset == softreset ? "soft" : "hard"); | 2391 | reset == softreset ? "soft" : "hard"); |
2392 | 2392 | ||
2393 | /* mark that this EH session started with reset */ | 2393 | /* mark that this EH session started with reset */ |
2394 | ehc->last_reset = jiffies; | ||
2394 | if (reset == hardreset) | 2395 | if (reset == hardreset) |
2395 | ehc->i.flags |= ATA_EHI_DID_HARDRESET; | 2396 | ehc->i.flags |= ATA_EHI_DID_HARDRESET; |
2396 | else | 2397 | else |
@@ -2535,7 +2536,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | |||
2535 | ata_eh_done(link, NULL, ATA_EH_RESET); | 2536 | ata_eh_done(link, NULL, ATA_EH_RESET); |
2536 | if (slave) | 2537 | if (slave) |
2537 | ata_eh_done(slave, NULL, ATA_EH_RESET); | 2538 | ata_eh_done(slave, NULL, ATA_EH_RESET); |
2538 | ehc->last_reset = jiffies; | 2539 | ehc->last_reset = jiffies; /* update to completion time */ |
2539 | ehc->i.action |= ATA_EH_REVALIDATE; | 2540 | ehc->i.action |= ATA_EH_REVALIDATE; |
2540 | 2541 | ||
2541 | rc = 0; | 2542 | rc = 0; |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 3fa75eac135d..47c7afcb36f2 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -709,11 +709,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, | |||
709 | { | 709 | { |
710 | struct ata_queued_cmd *qc; | 710 | struct ata_queued_cmd *qc; |
711 | 711 | ||
712 | if (cmd->request->tag != -1) | 712 | qc = ata_qc_new_init(dev); |
713 | qc = ata_qc_new_init(dev, cmd->request->tag); | ||
714 | else | ||
715 | qc = ata_qc_new_init(dev, 0); | ||
716 | |||
717 | if (qc) { | 713 | if (qc) { |
718 | qc->scsicmd = cmd; | 714 | qc->scsicmd = cmd; |
719 | qc->scsidone = done; | 715 | qc->scsidone = done; |
@@ -1108,17 +1104,7 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, | |||
1108 | 1104 | ||
1109 | depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); | 1105 | depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); |
1110 | depth = min(ATA_MAX_QUEUE - 1, depth); | 1106 | depth = min(ATA_MAX_QUEUE - 1, depth); |
1111 | 1107 | scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, depth); | |
1112 | /* | ||
1113 | * If this device is behind a port multiplier, we have | ||
1114 | * to share the tag map between all devices on that PMP. | ||
1115 | * Set up the shared tag map here and we get automatic. | ||
1116 | */ | ||
1117 | if (dev->link->ap->pmp_link) | ||
1118 | scsi_init_shared_tag_map(sdev->host, ATA_MAX_QUEUE - 1); | ||
1119 | |||
1120 | scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); | ||
1121 | scsi_activate_tcq(sdev, depth); | ||
1122 | } | 1108 | } |
1123 | 1109 | ||
1124 | return 0; | 1110 | return 0; |
@@ -1958,11 +1944,6 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) | |||
1958 | hdr[1] |= (1 << 7); | 1944 | hdr[1] |= (1 << 7); |
1959 | 1945 | ||
1960 | memcpy(rbuf, hdr, sizeof(hdr)); | 1946 | memcpy(rbuf, hdr, sizeof(hdr)); |
1961 | |||
1962 | /* if ncq, set tags supported */ | ||
1963 | if (ata_id_has_ncq(args->id)) | ||
1964 | rbuf[7] |= (1 << 1); | ||
1965 | |||
1966 | memcpy(&rbuf[8], "ATA ", 8); | 1947 | memcpy(&rbuf[8], "ATA ", 8); |
1967 | ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); | 1948 | ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); |
1968 | ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); | 1949 | ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index d3831d39bdaa..fe2839e58774 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -74,7 +74,7 @@ extern struct ata_link *ata_dev_phys_link(struct ata_device *dev); | |||
74 | extern void ata_force_cbl(struct ata_port *ap); | 74 | extern void ata_force_cbl(struct ata_port *ap); |
75 | extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); | 75 | extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); |
76 | extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); | 76 | extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); |
77 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag); | 77 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev); |
78 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, | 78 | extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev, |
79 | u64 block, u32 n_block, unsigned int tf_flags, | 79 | u64 block, u32 n_block, unsigned int tf_flags, |
80 | unsigned int tag); | 80 | unsigned int tag); |
@@ -103,6 +103,7 @@ extern int ata_dev_configure(struct ata_device *dev); | |||
103 | extern int sata_down_spd_limit(struct ata_link *link); | 103 | extern int sata_down_spd_limit(struct ata_link *link); |
104 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); | 104 | extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel); |
105 | extern void ata_sg_clean(struct ata_queued_cmd *qc); | 105 | extern void ata_sg_clean(struct ata_queued_cmd *qc); |
106 | extern void ata_qc_free(struct ata_queued_cmd *qc); | ||
106 | extern void ata_qc_issue(struct ata_queued_cmd *qc); | 107 | extern void ata_qc_issue(struct ata_queued_cmd *qc); |
107 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); | 108 | extern void __ata_qc_complete(struct ata_queued_cmd *qc); |
108 | extern int atapi_check_dma(struct ata_queued_cmd *qc); | 109 | extern int atapi_check_dma(struct ata_queued_cmd *qc); |
@@ -118,22 +119,6 @@ extern struct ata_port *ata_port_alloc(struct ata_host *host); | |||
118 | extern void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy); | 119 | extern void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy); |
119 | extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm); | 120 | extern void ata_lpm_schedule(struct ata_port *ap, enum link_pm); |
120 | 121 | ||
121 | /** | ||
122 | * ata_qc_free - free unused ata_queued_cmd | ||
123 | * @qc: Command to complete | ||
124 | * | ||
125 | * Designed to free unused ata_queued_cmd object | ||
126 | * in case something prevents using it. | ||
127 | * | ||
128 | * LOCKING: | ||
129 | * spin_lock_irqsave(host lock) | ||
130 | */ | ||
131 | static inline void ata_qc_free(struct ata_queued_cmd *qc) | ||
132 | { | ||
133 | qc->flags = 0; | ||
134 | qc->tag = ATA_TAG_POISON; | ||
135 | } | ||
136 | |||
137 | /* libata-acpi.c */ | 122 | /* libata-acpi.c */ |
138 | #ifdef CONFIG_ATA_ACPI | 123 | #ifdef CONFIG_ATA_ACPI |
139 | extern void ata_acpi_associate_sata_port(struct ata_port *ap); | 124 | extern void ata_acpi_associate_sata_port(struct ata_port *ap); |
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c index 1b2d4a0f5f74..8b236af84c2e 100644 --- a/drivers/ata/pata_cs5535.c +++ b/drivers/ata/pata_cs5535.c | |||
@@ -72,7 +72,6 @@ | |||
72 | /** | 72 | /** |
73 | * cs5535_cable_detect - detect cable type | 73 | * cs5535_cable_detect - detect cable type |
74 | * @ap: Port to detect on | 74 | * @ap: Port to detect on |
75 | * @deadline: deadline jiffies for the operation | ||
76 | * | 75 | * |
77 | * Perform cable detection for ATA66 capable cable. Return a libata | 76 | * Perform cable detection for ATA66 capable cable. Return a libata |
78 | * cable type. | 77 | * cable type. |
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c index 73f8332cb679..afed92976198 100644 --- a/drivers/ata/pata_cs5536.c +++ b/drivers/ata/pata_cs5536.c | |||
@@ -110,7 +110,6 @@ static inline int cs5536_write(struct pci_dev *pdev, int reg, int val) | |||
110 | /** | 110 | /** |
111 | * cs5536_cable_detect - detect cable type | 111 | * cs5536_cable_detect - detect cable type |
112 | * @ap: Port to detect on | 112 | * @ap: Port to detect on |
113 | * @deadline: deadline jiffies for the operation | ||
114 | * | 113 | * |
115 | * Perform cable detection for ATA66 capable cable. Return a libata | 114 | * Perform cable detection for ATA66 capable cable. Return a libata |
116 | * cable type. | 115 | * cable type. |
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 271cb64d429e..64b2e2281ee7 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c | |||
@@ -416,6 +416,7 @@ static struct pcmcia_device_id pcmcia_devices[] = { | |||
416 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), | 416 | PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), |
417 | PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e), | 417 | PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e), |
418 | PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6), | 418 | PCMCIA_MFC_DEVICE_PROD_ID12(1, "SanDisk", "ConnectPlus", 0x7a954bd9, 0x74be00c6), |
419 | PCMCIA_DEVICE_PROD_ID2("Flash Card", 0x5a362506), | ||
419 | PCMCIA_DEVICE_NULL, | 420 | PCMCIA_DEVICE_NULL, |
420 | }; | 421 | }; |
421 | 422 | ||
diff --git a/drivers/ata/pata_sch.c b/drivers/ata/pata_sch.c index c8cc027789fe..6aeeeeb34124 100644 --- a/drivers/ata/pata_sch.c +++ b/drivers/ata/pata_sch.c | |||
@@ -83,7 +83,7 @@ static struct ata_port_operations sch_pata_ops = { | |||
83 | }; | 83 | }; |
84 | 84 | ||
85 | static struct ata_port_info sch_port_info = { | 85 | static struct ata_port_info sch_port_info = { |
86 | .flags = 0, | 86 | .flags = ATA_FLAG_SLAVE_POSS, |
87 | .pio_mask = ATA_PIO4, /* pio0-4 */ | 87 | .pio_mask = ATA_PIO4, /* pio0-4 */ |
88 | .mwdma_mask = ATA_MWDMA2, /* mwdma0-2 */ | 88 | .mwdma_mask = ATA_MWDMA2, /* mwdma0-2 */ |
89 | .udma_mask = ATA_UDMA5, /* udma0-5 */ | 89 | .udma_mask = ATA_UDMA5, /* udma0-5 */ |