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>
This commit is contained in:
@@ -216,6 +216,7 @@ enum {
|
||||
ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
|
||||
ATA_QCFLAG_IO = (1 << 3), /* standard IO command */
|
||||
ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */
|
||||
ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */
|
||||
|
||||
ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */
|
||||
ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */
|
||||
@@ -579,11 +580,13 @@ struct ata_port {
|
||||
struct ata_queued_cmd qcmd[ATA_MAX_QUEUE];
|
||||
unsigned long qc_allocated;
|
||||
unsigned int qc_active;
|
||||
int nr_active_links; /* #links with active qcs */
|
||||
|
||||
struct ata_link link; /* host default link */
|
||||
|
||||
int nr_pmp_links; /* nr of available PMP links */
|
||||
struct ata_link *pmp_link; /* array of PMP links */
|
||||
struct ata_link *excl_link; /* for PMP qc exclusion */
|
||||
|
||||
struct ata_port_stats stats;
|
||||
struct ata_host *host;
|
||||
@@ -1104,6 +1107,11 @@ static inline int ata_link_max_devices(const struct ata_link *link)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int ata_link_active(struct ata_link *link)
|
||||
{
|
||||
return ata_tag_valid(link->active_tag) || link->sactive;
|
||||
}
|
||||
|
||||
static inline struct ata_link *ata_port_first_link(struct ata_port *ap)
|
||||
{
|
||||
if (ap->nr_pmp_links)
|
||||
|
Reference in New Issue
Block a user