diff options
author | Tejun Heo <htejun@gmail.com> | 2007-09-23 00:14:12 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-12 14:55:41 -0400 |
commit | da917d69d0ea63f5390716cba6e77f490ce96df9 (patch) | |
tree | 214670f42be4c140bbd05226adc8f86db51ee725 /include/linux/libata.h | |
parent | 31cc23b34913bc173680bdc87af79e551bf8cc0d (diff) |
libata-pmp-prep: implement qc_defer helpers
Implement ap->nr_active_links (the number of links with active qcs),
ap->excl_link (pointer to link which can be used by ->qc_defer and is
cleared when a qc with ATA_QCFLAG_CLEAR_EXCL completes), and
ata_link_active().
These can be used by ->qc_defer() to implement proper command
exclusion. This set of helpers seem enough for both sil24 (ATAPI
exclusion needed) and cmd-switching PMP.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index b0d4ca0d27b4..f9f81fd93293 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -216,6 +216,7 @@ enum { | |||
216 | ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, | 216 | ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, |
217 | ATA_QCFLAG_IO = (1 << 3), /* standard IO command */ | 217 | ATA_QCFLAG_IO = (1 << 3), /* standard IO command */ |
218 | ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ | 218 | ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ |
219 | ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */ | ||
219 | 220 | ||
220 | ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */ | 221 | ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */ |
221 | ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */ | 222 | ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */ |
@@ -579,11 +580,13 @@ struct ata_port { | |||
579 | struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; | 580 | struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; |
580 | unsigned long qc_allocated; | 581 | unsigned long qc_allocated; |
581 | unsigned int qc_active; | 582 | unsigned int qc_active; |
583 | int nr_active_links; /* #links with active qcs */ | ||
582 | 584 | ||
583 | struct ata_link link; /* host default link */ | 585 | struct ata_link link; /* host default link */ |
584 | 586 | ||
585 | int nr_pmp_links; /* nr of available PMP links */ | 587 | int nr_pmp_links; /* nr of available PMP links */ |
586 | struct ata_link *pmp_link; /* array of PMP links */ | 588 | struct ata_link *pmp_link; /* array of PMP links */ |
589 | struct ata_link *excl_link; /* for PMP qc exclusion */ | ||
587 | 590 | ||
588 | struct ata_port_stats stats; | 591 | struct ata_port_stats stats; |
589 | struct ata_host *host; | 592 | struct ata_host *host; |
@@ -1104,6 +1107,11 @@ static inline int ata_link_max_devices(const struct ata_link *link) | |||
1104 | return 1; | 1107 | return 1; |
1105 | } | 1108 | } |
1106 | 1109 | ||
1110 | static inline int ata_link_active(struct ata_link *link) | ||
1111 | { | ||
1112 | return ata_tag_valid(link->active_tag) || link->sactive; | ||
1113 | } | ||
1114 | |||
1107 | static inline struct ata_link *ata_port_first_link(struct ata_port *ap) | 1115 | static inline struct ata_link *ata_port_first_link(struct ata_port *ap) |
1108 | { | 1116 | { |
1109 | if (ap->nr_pmp_links) | 1117 | if (ap->nr_pmp_links) |