diff options
-rw-r--r-- | drivers/ata/libata-scsi.c | 9 | ||||
-rw-r--r-- | include/scsi/scsi_tcq.h | 14 |
2 files changed, 21 insertions, 2 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 4b95c4387e9e..bbb30d882f05 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -1107,6 +1107,15 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, | |||
1107 | 1107 | ||
1108 | depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); | 1108 | depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); |
1109 | depth = min(ATA_MAX_QUEUE - 1, depth); | 1109 | depth = min(ATA_MAX_QUEUE - 1, depth); |
1110 | |||
1111 | /* | ||
1112 | * If this device is behind a port multiplier, we have | ||
1113 | * to share the tag map between all devices on that PMP. | ||
1114 | * Set up the shared tag map here and we get automatic. | ||
1115 | */ | ||
1116 | if (dev->link->ap->pmp_link) | ||
1117 | scsi_init_shared_tag_map(sdev->host, ATA_MAX_QUEUE - 1); | ||
1118 | |||
1110 | scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); | 1119 | scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); |
1111 | scsi_activate_tcq(sdev, depth); | 1120 | scsi_activate_tcq(sdev, depth); |
1112 | } | 1121 | } |
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index cf4c219c0b5c..17231385cb37 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h | |||
@@ -140,8 +140,18 @@ static inline struct scsi_cmnd *scsi_find_tag(struct scsi_device *sdev, int tag) | |||
140 | */ | 140 | */ |
141 | static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth) | 141 | static inline int scsi_init_shared_tag_map(struct Scsi_Host *shost, int depth) |
142 | { | 142 | { |
143 | shost->bqt = blk_init_tags(depth); | 143 | /* |
144 | return shost->bqt ? 0 : -ENOMEM; | 144 | * If the shared tag map isn't already initialized, do it now. |
145 | * This saves callers from having to check ->bqt when setting up | ||
146 | * devices on the shared host (for libata) | ||
147 | */ | ||
148 | if (!shost->bqt) { | ||
149 | shost->bqt = blk_init_tags(depth); | ||
150 | if (!shost->bqt) | ||
151 | return -ENOMEM; | ||
152 | } | ||
153 | |||
154 | return 0; | ||
145 | } | 155 | } |
146 | 156 | ||
147 | /** | 157 | /** |