2015-05-21 19:32:46 +00:00
|
|
|
--- a/drivers/ata/libata-core.c
|
|
|
|
+++ b/drivers/ata/libata-core.c
|
|
|
|
@@ -1581,6 +1581,14 @@ unsigned ata_exec_internal_sg(struct ata
|
2014-12-10 15:51:07 +00:00
|
|
|
return AC_ERR_SYSTEM;
|
|
|
|
}
|
|
|
|
|
2014-12-22 20:46:49 +00:00
|
|
|
+ if (ap->ops->acquire_hw && !ap->ops->acquire_hw(ap, 0, 0)) {
|
2014-12-10 15:51:07 +00:00
|
|
|
+ spin_unlock_irqrestore(ap->lock, flags);
|
2014-12-22 20:46:49 +00:00
|
|
|
+ if (!ap->ops->acquire_hw(ap, 1, (2*HZ))) {
|
2014-12-10 15:51:07 +00:00
|
|
|
+ return AC_ERR_TIMEOUT;
|
|
|
|
+ }
|
|
|
|
+ spin_lock_irqsave(ap->lock, flags);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
/* initialize internal qc */
|
|
|
|
|
|
|
|
/* XXX: Tag 0 is used for drivers with legacy EH as some
|
2015-08-09 11:09:52 +00:00
|
|
|
@@ -4757,6 +4765,9 @@ static struct ata_queued_cmd *ata_qc_new
|
2014-12-10 15:51:07 +00:00
|
|
|
if (unlikely(ap->pflags & ATA_PFLAG_FROZEN))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
+ if (ap->ops->qc_new && ap->ops->qc_new(ap))
|
|
|
|
+ return NULL;
|
|
|
|
+
|
|
|
|
for (i = 0, tag = ap->last_tag + 1; i < max_queue; i++, tag++) {
|
2015-05-21 19:32:46 +00:00
|
|
|
if (ap->flags & ATA_FLAG_LOWTAG)
|
|
|
|
tag = i;
|
2015-08-09 11:09:52 +00:00
|
|
|
@@ -4829,6 +4840,8 @@ void ata_qc_free(struct ata_queued_cmd *
|
2014-12-10 15:51:07 +00:00
|
|
|
if (likely(ata_tag_valid(tag))) {
|
|
|
|
qc->tag = ATA_TAG_POISON;
|
|
|
|
clear_bit(tag, &ap->qc_allocated);
|
|
|
|
+ if (ap->ops->qc_free)
|
|
|
|
+ ap->ops->qc_free(qc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-21 19:32:46 +00:00
|
|
|
--- a/include/linux/libata.h
|
|
|
|
+++ b/include/linux/libata.h
|
2015-08-09 11:09:52 +00:00
|
|
|
@@ -901,6 +901,8 @@ struct ata_port_operations {
|
2014-12-10 15:51:07 +00:00
|
|
|
void (*qc_prep)(struct ata_queued_cmd *qc);
|
|
|
|
unsigned int (*qc_issue)(struct ata_queued_cmd *qc);
|
|
|
|
bool (*qc_fill_rtf)(struct ata_queued_cmd *qc);
|
|
|
|
+ int (*qc_new)(struct ata_port *ap);
|
|
|
|
+ void (*qc_free)(struct ata_queued_cmd *qc);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Configuration and exception handling
|
2015-08-09 11:09:52 +00:00
|
|
|
@@ -991,6 +993,9 @@ struct ata_port_operations {
|
2014-12-10 15:51:07 +00:00
|
|
|
void (*phy_reset)(struct ata_port *ap);
|
|
|
|
void (*eng_timeout)(struct ata_port *ap);
|
|
|
|
|
2014-12-22 20:46:49 +00:00
|
|
|
+ int (*acquire_hw)(struct ata_port *ap, int may_sleep,
|
|
|
|
+ int timeout_jiffies);
|
2014-12-10 15:51:07 +00:00
|
|
|
+
|
|
|
|
/*
|
|
|
|
* ->inherits must be the last field and all the preceding
|
|
|
|
* fields must be pointers.
|