diff options
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 577770fdee86..932d9cc98d2f 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) { |
@@ -272,7 +272,7 @@ static struct sas_internal *dev_to_sas_internal(struct domain_device *dev) | |||
272 | return to_sas_internal(dev->port->ha->core.shost->transportt); | 272 | return to_sas_internal(dev->port->ha->core.shost->transportt); |
273 | } | 273 | } |
274 | 274 | ||
275 | static void sas_get_ata_command_set(struct domain_device *dev); | 275 | static int sas_get_ata_command_set(struct domain_device *dev); |
276 | 276 | ||
277 | int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) | 277 | int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) |
278 | { | 278 | { |
@@ -297,8 +297,7 @@ int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy) | |||
297 | } | 297 | } |
298 | memcpy(dev->frame_rcvd, &dev->sata_dev.rps_resp.rps.fis, | 298 | memcpy(dev->frame_rcvd, &dev->sata_dev.rps_resp.rps.fis, |
299 | sizeof(struct dev_to_host_fis)); | 299 | sizeof(struct dev_to_host_fis)); |
300 | /* TODO switch to ata_dev_classify() */ | 300 | dev->sata_dev.class = sas_get_ata_command_set(dev); |
301 | sas_get_ata_command_set(dev); | ||
302 | } | 301 | } |
303 | return 0; | 302 | return 0; |
304 | } | 303 | } |
@@ -419,18 +418,7 @@ static int sas_ata_hard_reset(struct ata_link *link, unsigned int *class, | |||
419 | if (ret && ret != -EAGAIN) | 418 | if (ret && ret != -EAGAIN) |
420 | sas_ata_printk(KERN_ERR, dev, "reset failed (errno=%d)\n", ret); | 419 | sas_ata_printk(KERN_ERR, dev, "reset failed (errno=%d)\n", ret); |
421 | 420 | ||
422 | /* XXX: if the class changes during the reset the upper layer | 421 | *class = dev->sata_dev.class; |
423 | * should be informed, if the device has gone away we assume | ||
424 | * libsas will eventually delete it | ||
425 | */ | ||
426 | switch (dev->sata_dev.command_set) { | ||
427 | case ATA_COMMAND_SET: | ||
428 | *class = ATA_DEV_ATA; | ||
429 | break; | ||
430 | case ATAPI_COMMAND_SET: | ||
431 | *class = ATA_DEV_ATAPI; | ||
432 | break; | ||
433 | } | ||
434 | 422 | ||
435 | ap->cbl = ATA_CBL_SATA; | 423 | ap->cbl = ATA_CBL_SATA; |
436 | return ret; | 424 | return ret; |
@@ -619,50 +607,18 @@ void sas_ata_task_abort(struct sas_task *task) | |||
619 | complete(waiting); | 607 | complete(waiting); |
620 | } | 608 | } |
621 | 609 | ||
622 | static void sas_get_ata_command_set(struct domain_device *dev) | 610 | static int sas_get_ata_command_set(struct domain_device *dev) |
623 | { | 611 | { |
624 | struct dev_to_host_fis *fis = | 612 | struct dev_to_host_fis *fis = |
625 | (struct dev_to_host_fis *) dev->frame_rcvd; | 613 | (struct dev_to_host_fis *) dev->frame_rcvd; |
614 | struct ata_taskfile tf; | ||
626 | 615 | ||
627 | if (dev->dev_type == SAS_SATA_PENDING) | 616 | if (dev->dev_type == SAS_SATA_PENDING) |
628 | return; | 617 | return ATA_DEV_UNKNOWN; |
618 | |||
619 | ata_tf_from_fis((const u8 *)fis, &tf); | ||
629 | 620 | ||
630 | if ((fis->sector_count == 1 && /* ATA */ | 621 | return ata_dev_classify(&tf); |
631 | fis->lbal == 1 && | ||
632 | fis->lbam == 0 && | ||
633 | fis->lbah == 0 && | ||
634 | fis->device == 0) | ||
635 | || | ||
636 | (fis->sector_count == 0 && /* CE-ATA (mATA) */ | ||
637 | fis->lbal == 0 && | ||
638 | fis->lbam == 0xCE && | ||
639 | fis->lbah == 0xAA && | ||
640 | (fis->device & ~0x10) == 0)) | ||
641 | |||
642 | dev->sata_dev.command_set = ATA_COMMAND_SET; | ||
643 | |||
644 | else if ((fis->interrupt_reason == 1 && /* ATAPI */ | ||
645 | fis->lbal == 1 && | ||
646 | fis->byte_count_low == 0x14 && | ||
647 | fis->byte_count_high == 0xEB && | ||
648 | (fis->device & ~0x10) == 0)) | ||
649 | |||
650 | dev->sata_dev.command_set = ATAPI_COMMAND_SET; | ||
651 | |||
652 | else if ((fis->sector_count == 1 && /* SEMB */ | ||
653 | fis->lbal == 1 && | ||
654 | fis->lbam == 0x3C && | ||
655 | fis->lbah == 0xC3 && | ||
656 | fis->device == 0) | ||
657 | || | ||
658 | (fis->interrupt_reason == 1 && /* SATA PM */ | ||
659 | fis->lbal == 1 && | ||
660 | fis->byte_count_low == 0x69 && | ||
661 | fis->byte_count_high == 0x96 && | ||
662 | (fis->device & ~0x10) == 0)) | ||
663 | |||
664 | /* Treat it as a superset? */ | ||
665 | dev->sata_dev.command_set = ATAPI_COMMAND_SET; | ||
666 | } | 622 | } |
667 | 623 | ||
668 | void sas_probe_sata(struct asd_sas_port *port) | 624 | void sas_probe_sata(struct asd_sas_port *port) |
@@ -768,7 +724,7 @@ int sas_discover_sata(struct domain_device *dev) | |||
768 | if (dev->dev_type == SAS_SATA_PM) | 724 | if (dev->dev_type == SAS_SATA_PM) |
769 | return -ENODEV; | 725 | return -ENODEV; |
770 | 726 | ||
771 | sas_get_ata_command_set(dev); | 727 | dev->sata_dev.class = sas_get_ata_command_set(dev); |
772 | sas_fill_in_rphy(dev, dev->rphy); | 728 | sas_fill_in_rphy(dev, dev->rphy); |
773 | 729 | ||
774 | res = sas_notify_lldd_dev_found(dev); | 730 | res = sas_notify_lldd_dev_found(dev); |