diff options
author | Hannes Reinecke <hare@suse.de> | 2014-11-05 07:08:20 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-11-05 11:22:06 -0500 |
commit | 1cbd772d9aaf6c697935cb855860b66cebacf950 (patch) | |
tree | fe83656bbb9a39f4a8b85ebb6afce18b05492840 /drivers/scsi/libsas/sas_ata.c | |
parent | 9a23c1d6f0f5dbac4c9b73fa6cea7c9ee3d29074 (diff) |
libsas: use ata_dev_classify()
Use the ata device class from libata in libsas instead of checking
the supported command set and switch to using ata_dev_classify()
instead of our own method.
Cc: Tejun Heo <tj@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/scsi/libsas/sas_ata.c')
-rw-r--r-- | drivers/scsi/libsas/sas_ata.c | 66 |
1 files changed, 11 insertions, 55 deletions
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 766098af4eb7..9f68db7ed5f1 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
@@ -138,7 +138,7 @@ static void sas_ata_task_done(struct sas_task *task) | |||
138 | 138 | ||
139 | if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD || | 139 | if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD || |
140 | ((stat->stat == SAM_STAT_CHECK_CONDITION && | 140 | ((stat->stat == SAM_STAT_CHECK_CONDITION && |
141 | dev->sata_dev.command_set == ATAPI_COMMAND_SET))) { | 141 | dev->sata_dev.class == ATA_DEV_ATAPI))) { |
142 | memcpy(dev->sata_dev.fis, resp->ending_fis, ATA_RESP_FIS_SIZE); | 142 | memcpy(dev->sata_dev.fis, resp->ending_fis, ATA_RESP_FIS_SIZE); |
143 | 143 | ||
144 | if (!link->sactive) { | 144 | if (!link->sactive) { |
@@ -278,7 +278,7 @@ static struct sas_internal *dev_to_sas_internal(struct domain_device *dev) | |||
278 | return to_sas_internal(dev->port->ha->core.shost->transportt); | 278 | return to_sas_internal(dev->port->ha->core.shost->transportt); |
279 | } | 279 | } |
280 | 280 | ||
281 | static void sas_get_ata_command_set(struct domain_device *dev); | 281 | static int sas_get_ata_command_set(struct domain_device *dev); |
282 | 282 | ||
283 | int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) | 283 | int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) |
284 | { | 284 | { |
@@ -303,8 +303,7 @@ int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) | |||
303 | } | 303 | } |
304 | memcpy(dev->frame_rcvd, &dev->sata_dev.rps_resp.rps.fis, | 304 | memcpy(dev->frame_rcvd, &dev->sata_dev.rps_resp.rps.fis, |
305 | sizeof(struct dev_to_host_fis)); | 305 | sizeof(struct dev_to_host_fis)); |
306 | /* TODO switch to ata_dev_classify() */ | 306 | dev->sata_dev.class = sas_get_ata_command_set(dev); |
307 | sas_get_ata_command_set(dev); | ||
308 | } | 307 | } |
309 | return 0; | 308 | return 0; |
310 | } | 309 | } |
@@ -425,18 +424,7 @@ static int sas_ata_hard_reset(struct ata_link *link, unsigned int *class, | |||
425 | if (ret && ret != -EAGAIN) | 424 | if (ret && ret != -EAGAIN) |
426 | sas_ata_printk(KERN_ERR, dev, "reset failed (errno=%d)\n", ret); | 425 | sas_ata_printk(KERN_ERR, dev, "reset failed (errno=%d)\n", ret); |
427 | 426 | ||
428 | /* XXX: if the class changes during the reset the upper layer | 427 | *class = dev->sata_dev.class; |
429 | * should be informed, if the device has gone away we assume | ||
430 | * libsas will eventually delete it | ||
431 | */ | ||
432 | switch (dev->sata_dev.command_set) { | ||
433 | case ATA_COMMAND_SET: | ||
434 | *class = ATA_DEV_ATA; | ||
435 | break; | ||
436 | case ATAPI_COMMAND_SET: | ||
437 | *class = ATA_DEV_ATAPI; | ||
438 | break; | ||
439 | } | ||
440 | 428 | ||
441 | ap->cbl = ATA_CBL_SATA; | 429 | ap->cbl = ATA_CBL_SATA; |
442 | return ret; | 430 | return ret; |
@@ -626,50 +614,18 @@ void sas_ata_task_abort(struct sas_task *task) | |||
626 | complete(waiting); | 614 | complete(waiting); |
627 | } | 615 | } |
628 | 616 | ||
629 | static void sas_get_ata_command_set(struct domain_device *dev) | 617 | static int sas_get_ata_command_set(struct domain_device *dev) |
630 | { | 618 | { |
631 | struct dev_to_host_fis *fis = | 619 | struct dev_to_host_fis *fis = |
632 | (struct dev_to_host_fis *) dev->frame_rcvd; | 620 | (struct dev_to_host_fis *) dev->frame_rcvd; |
621 | struct ata_taskfile tf; | ||
633 | 622 | ||
634 | if (dev->dev_type == SAS_SATA_PENDING) | 623 | if (dev->dev_type == SAS_SATA_PENDING) |
635 | return; | 624 | return ATA_DEV_UNKNOWN; |
625 | |||
626 | ata_tf_from_fis((const u8 *)fis, &tf); | ||
636 | 627 | ||
637 | if ((fis->sector_count == 1 && /* ATA */ | 628 | return ata_dev_classify(&tf); |
638 | fis->lbal == 1 && | ||
639 | fis->lbam == 0 && | ||
640 | fis->lbah == 0 && | ||
641 | fis->device == 0) | ||
642 | || | ||
643 | (fis->sector_count == 0 && /* CE-ATA (mATA) */ | ||
644 | fis->lbal == 0 && | ||
645 | fis->lbam == 0xCE && | ||
646 | fis->lbah == 0xAA && | ||
647 | (fis->device & ~0x10) == 0)) | ||
648 | |||
649 | dev->sata_dev.command_set = ATA_COMMAND_SET; | ||
650 | |||
651 | else if ((fis->interrupt_reason == 1 && /* ATAPI */ | ||
652 | fis->lbal == 1 && | ||
653 | fis->byte_count_low == 0x14 && | ||
654 | fis->byte_count_high == 0xEB && | ||
655 | (fis->device & ~0x10) == 0)) | ||
656 | |||
657 | dev->sata_dev.command_set = ATAPI_COMMAND_SET; | ||
658 | |||
659 | else if ((fis->sector_count == 1 && /* SEMB */ | ||
660 | fis->lbal == 1 && | ||
661 | fis->lbam == 0x3C && | ||
662 | fis->lbah == 0xC3 && | ||
663 | fis->device == 0) | ||
664 | || | ||
665 | (fis->interrupt_reason == 1 && /* SATA PM */ | ||
666 | fis->lbal == 1 && | ||
667 | fis->byte_count_low == 0x69 && | ||
668 | fis->byte_count_high == 0x96 && | ||
669 | (fis->device & ~0x10) == 0)) | ||
670 | |||
671 | /* Treat it as a superset? */ | ||
672 | dev->sata_dev.command_set = ATAPI_COMMAND_SET; | ||
673 | } | 629 | } |
674 | 630 | ||
675 | void sas_probe_sata(struct asd_sas_port *port) | 631 | void sas_probe_sata(struct asd_sas_port *port) |
@@ -775,7 +731,7 @@ int sas_discover_sata(struct domain_device *dev) | |||
775 | if (dev->dev_type == SAS_SATA_PM) | 731 | if (dev->dev_type == SAS_SATA_PM) |
776 | return -ENODEV; | 732 | return -ENODEV; |
777 | 733 | ||
778 | sas_get_ata_command_set(dev); | 734 | dev->sata_dev.class = sas_get_ata_command_set(dev); |
779 | sas_fill_in_rphy(dev, dev->rphy); | 735 | sas_fill_in_rphy(dev, dev->rphy); |
780 | 736 | ||
781 | res = sas_notify_lldd_dev_found(dev); | 737 | res = sas_notify_lldd_dev_found(dev); |