diff options
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 9c66d4059399..f55b9b3f7b37 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -562,16 +562,28 @@ static const u8 ata_rw_cmds[] = { | |||
562 | ATA_CMD_WRITE_MULTI, | 562 | ATA_CMD_WRITE_MULTI, |
563 | ATA_CMD_READ_MULTI_EXT, | 563 | ATA_CMD_READ_MULTI_EXT, |
564 | ATA_CMD_WRITE_MULTI_EXT, | 564 | ATA_CMD_WRITE_MULTI_EXT, |
565 | 0, | ||
566 | 0, | ||
567 | 0, | ||
568 | ATA_CMD_WRITE_MULTI_FUA_EXT, | ||
565 | /* pio */ | 569 | /* pio */ |
566 | ATA_CMD_PIO_READ, | 570 | ATA_CMD_PIO_READ, |
567 | ATA_CMD_PIO_WRITE, | 571 | ATA_CMD_PIO_WRITE, |
568 | ATA_CMD_PIO_READ_EXT, | 572 | ATA_CMD_PIO_READ_EXT, |
569 | ATA_CMD_PIO_WRITE_EXT, | 573 | ATA_CMD_PIO_WRITE_EXT, |
574 | 0, | ||
575 | 0, | ||
576 | 0, | ||
577 | 0, | ||
570 | /* dma */ | 578 | /* dma */ |
571 | ATA_CMD_READ, | 579 | ATA_CMD_READ, |
572 | ATA_CMD_WRITE, | 580 | ATA_CMD_WRITE, |
573 | ATA_CMD_READ_EXT, | 581 | ATA_CMD_READ_EXT, |
574 | ATA_CMD_WRITE_EXT | 582 | ATA_CMD_WRITE_EXT, |
583 | 0, | ||
584 | 0, | ||
585 | 0, | ||
586 | ATA_CMD_WRITE_FUA_EXT | ||
575 | }; | 587 | }; |
576 | 588 | ||
577 | /** | 589 | /** |
@@ -584,25 +596,32 @@ static const u8 ata_rw_cmds[] = { | |||
584 | * LOCKING: | 596 | * LOCKING: |
585 | * caller. | 597 | * caller. |
586 | */ | 598 | */ |
587 | void ata_rwcmd_protocol(struct ata_queued_cmd *qc) | 599 | int ata_rwcmd_protocol(struct ata_queued_cmd *qc) |
588 | { | 600 | { |
589 | struct ata_taskfile *tf = &qc->tf; | 601 | struct ata_taskfile *tf = &qc->tf; |
590 | struct ata_device *dev = qc->dev; | 602 | struct ata_device *dev = qc->dev; |
603 | u8 cmd; | ||
591 | 604 | ||
592 | int index, lba48, write; | 605 | int index, fua, lba48, write; |
593 | 606 | ||
607 | fua = (tf->flags & ATA_TFLAG_FUA) ? 4 : 0; | ||
594 | lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0; | 608 | lba48 = (tf->flags & ATA_TFLAG_LBA48) ? 2 : 0; |
595 | write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0; | 609 | write = (tf->flags & ATA_TFLAG_WRITE) ? 1 : 0; |
596 | 610 | ||
597 | if (dev->flags & ATA_DFLAG_PIO) { | 611 | if (dev->flags & ATA_DFLAG_PIO) { |
598 | tf->protocol = ATA_PROT_PIO; | 612 | tf->protocol = ATA_PROT_PIO; |
599 | index = dev->multi_count ? 0 : 4; | 613 | index = dev->multi_count ? 0 : 8; |
600 | } else { | 614 | } else { |
601 | tf->protocol = ATA_PROT_DMA; | 615 | tf->protocol = ATA_PROT_DMA; |
602 | index = 8; | 616 | index = 16; |
603 | } | 617 | } |
604 | 618 | ||
605 | tf->command = ata_rw_cmds[index + lba48 + write]; | 619 | cmd = ata_rw_cmds[index + fua + lba48 + write]; |
620 | if (cmd) { | ||
621 | tf->command = cmd; | ||
622 | return 0; | ||
623 | } | ||
624 | return -1; | ||
606 | } | 625 | } |
607 | 626 | ||
608 | static const char * const xfer_mode_str[] = { | 627 | static const char * const xfer_mode_str[] = { |