From 0968abbf73ef800a48d7c042a3cc2e2f27edad00 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 27 Oct 2008 09:38:22 +0100 Subject: [PATCH] libata: fix bug with devices using ncq behind sata port multipliers All devices across a port multiplier must use unique tags, so we have to share the tag map on an ata_port basis. Signed-off-by: Jens Axboe --- drivers/ata/libata-scsi.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 4b95c43..4b98f23 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1103,10 +1103,20 @@ static int ata_scsi_dev_config(struct scsi_device *sdev, set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events); if (dev->flags & ATA_DFLAG_NCQ) { + struct Scsi_Host *shost = sdev->host; int depth; depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id)); depth = min(ATA_MAX_QUEUE - 1, depth); + + /* + * On PMP, we share the tag map across devices on the ata_port. + * So if we haven't set up this shared map already, do it + * before 'attaching' the first device to the map. + */ + if (dev->link->ap->pmp_link && !shost->bqt) + scsi_init_shared_tag_map(shost, ATA_MAX_QUEUE - 1); + scsi_set_tag_type(sdev, MSG_SIMPLE_TAG); scsi_activate_tcq(sdev, depth); } -- 1.6.0.2.588.g3102