diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-06 15:59:59 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-06 15:59:59 -0500 |
commit | ccf18968b1bbc2fb117190a1984ac2a826dac228 (patch) | |
tree | 7bc8fbf5722aecf1e84fa50c31c657864cba1daa /drivers/scsi/libata-scsi.c | |
parent | e91c021c487110386a07facd0396e6c3b7cf9c1f (diff) | |
parent | d99cf9d679a520d67f81d805b7cb91c68e1847f0 (diff) |
Merge ../torvalds-2.6/
Diffstat (limited to 'drivers/scsi/libata-scsi.c')
-rw-r--r-- | drivers/scsi/libata-scsi.c | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index e0439be4b573..cfbceb504718 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -396,6 +396,22 @@ void ata_dump_status(unsigned id, struct ata_taskfile *tf) | |||
396 | } | 396 | } |
397 | } | 397 | } |
398 | 398 | ||
399 | int ata_scsi_device_resume(struct scsi_device *sdev) | ||
400 | { | ||
401 | struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0]; | ||
402 | struct ata_device *dev = &ap->device[sdev->id]; | ||
403 | |||
404 | return ata_device_resume(ap, dev); | ||
405 | } | ||
406 | |||
407 | int ata_scsi_device_suspend(struct scsi_device *sdev) | ||
408 | { | ||
409 | struct ata_port *ap = (struct ata_port *) &sdev->host->hostdata[0]; | ||
410 | struct ata_device *dev = &ap->device[sdev->id]; | ||
411 | |||
412 | return ata_device_suspend(ap, dev); | ||
413 | } | ||
414 | |||
399 | /** | 415 | /** |
400 | * ata_to_sense_error - convert ATA error to SCSI error | 416 | * ata_to_sense_error - convert ATA error to SCSI error |
401 | * @id: ATA device number | 417 | * @id: ATA device number |
@@ -1080,11 +1096,13 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1080 | scsicmd[0] == WRITE_16) | 1096 | scsicmd[0] == WRITE_16) |
1081 | tf->flags |= ATA_TFLAG_WRITE; | 1097 | tf->flags |= ATA_TFLAG_WRITE; |
1082 | 1098 | ||
1083 | /* Calculate the SCSI LBA and transfer length. */ | 1099 | /* Calculate the SCSI LBA, transfer length and FUA. */ |
1084 | switch (scsicmd[0]) { | 1100 | switch (scsicmd[0]) { |
1085 | case READ_10: | 1101 | case READ_10: |
1086 | case WRITE_10: | 1102 | case WRITE_10: |
1087 | scsi_10_lba_len(scsicmd, &block, &n_block); | 1103 | scsi_10_lba_len(scsicmd, &block, &n_block); |
1104 | if (unlikely(scsicmd[1] & (1 << 3))) | ||
1105 | tf->flags |= ATA_TFLAG_FUA; | ||
1088 | break; | 1106 | break; |
1089 | case READ_6: | 1107 | case READ_6: |
1090 | case WRITE_6: | 1108 | case WRITE_6: |
@@ -1099,6 +1117,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1099 | case READ_16: | 1117 | case READ_16: |
1100 | case WRITE_16: | 1118 | case WRITE_16: |
1101 | scsi_16_lba_len(scsicmd, &block, &n_block); | 1119 | scsi_16_lba_len(scsicmd, &block, &n_block); |
1120 | if (unlikely(scsicmd[1] & (1 << 3))) | ||
1121 | tf->flags |= ATA_TFLAG_FUA; | ||
1102 | break; | 1122 | break; |
1103 | default: | 1123 | default: |
1104 | DPRINTK("no-byte command\n"); | 1124 | DPRINTK("no-byte command\n"); |
@@ -1142,7 +1162,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1142 | tf->device |= (block >> 24) & 0xf; | 1162 | tf->device |= (block >> 24) & 0xf; |
1143 | } | 1163 | } |
1144 | 1164 | ||
1145 | ata_rwcmd_protocol(qc); | 1165 | if (unlikely(ata_rwcmd_protocol(qc) < 0)) |
1166 | goto invalid_fld; | ||
1146 | 1167 | ||
1147 | qc->nsect = n_block; | 1168 | qc->nsect = n_block; |
1148 | tf->nsect = n_block & 0xff; | 1169 | tf->nsect = n_block & 0xff; |
@@ -1160,7 +1181,8 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc, const u8 *scsicm | |||
1160 | if ((block >> 28) || (n_block > 256)) | 1181 | if ((block >> 28) || (n_block > 256)) |
1161 | goto out_of_range; | 1182 | goto out_of_range; |
1162 | 1183 | ||
1163 | ata_rwcmd_protocol(qc); | 1184 | if (unlikely(ata_rwcmd_protocol(qc) < 0)) |
1185 | goto invalid_fld; | ||
1164 | 1186 | ||
1165 | /* Convert LBA to CHS */ | 1187 | /* Convert LBA to CHS */ |
1166 | track = (u32)block / dev->sectors; | 1188 | track = (u32)block / dev->sectors; |
@@ -1695,6 +1717,7 @@ static unsigned int ata_msense_rw_recovery(u8 **ptr_io, const u8 *last) | |||
1695 | unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | 1717 | unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, |
1696 | unsigned int buflen) | 1718 | unsigned int buflen) |
1697 | { | 1719 | { |
1720 | struct ata_device *dev = args->dev; | ||
1698 | u8 *scsicmd = args->cmd->cmnd, *p, *last; | 1721 | u8 *scsicmd = args->cmd->cmnd, *p, *last; |
1699 | const u8 sat_blk_desc[] = { | 1722 | const u8 sat_blk_desc[] = { |
1700 | 0, 0, 0, 0, /* number of blocks: sat unspecified */ | 1723 | 0, 0, 0, 0, /* number of blocks: sat unspecified */ |
@@ -1703,6 +1726,7 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
1703 | }; | 1726 | }; |
1704 | u8 pg, spg; | 1727 | u8 pg, spg; |
1705 | unsigned int ebd, page_control, six_byte, output_len, alloc_len, minlen; | 1728 | unsigned int ebd, page_control, six_byte, output_len, alloc_len, minlen; |
1729 | u8 dpofua; | ||
1706 | 1730 | ||
1707 | VPRINTK("ENTER\n"); | 1731 | VPRINTK("ENTER\n"); |
1708 | 1732 | ||
@@ -1771,9 +1795,17 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
1771 | 1795 | ||
1772 | if (minlen < 1) | 1796 | if (minlen < 1) |
1773 | return 0; | 1797 | return 0; |
1798 | |||
1799 | dpofua = 0; | ||
1800 | if (ata_id_has_fua(args->id) && dev->flags & ATA_DFLAG_LBA48 && | ||
1801 | (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count)) | ||
1802 | dpofua = 1 << 4; | ||
1803 | |||
1774 | if (six_byte) { | 1804 | if (six_byte) { |
1775 | output_len--; | 1805 | output_len--; |
1776 | rbuf[0] = output_len; | 1806 | rbuf[0] = output_len; |
1807 | if (minlen > 2) | ||
1808 | rbuf[2] |= dpofua; | ||
1777 | if (ebd) { | 1809 | if (ebd) { |
1778 | if (minlen > 3) | 1810 | if (minlen > 3) |
1779 | rbuf[3] = sizeof(sat_blk_desc); | 1811 | rbuf[3] = sizeof(sat_blk_desc); |
@@ -1786,6 +1818,8 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
1786 | rbuf[0] = output_len >> 8; | 1818 | rbuf[0] = output_len >> 8; |
1787 | if (minlen > 1) | 1819 | if (minlen > 1) |
1788 | rbuf[1] = output_len; | 1820 | rbuf[1] = output_len; |
1821 | if (minlen > 3) | ||
1822 | rbuf[3] |= dpofua; | ||
1789 | if (ebd) { | 1823 | if (ebd) { |
1790 | if (minlen > 7) | 1824 | if (minlen > 7) |
1791 | rbuf[7] = sizeof(sat_blk_desc); | 1825 | rbuf[7] = sizeof(sat_blk_desc); |
@@ -2446,7 +2480,7 @@ int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) | |||
2446 | if (xlat_func) | 2480 | if (xlat_func) |
2447 | ata_scsi_translate(ap, dev, cmd, done, xlat_func); | 2481 | ata_scsi_translate(ap, dev, cmd, done, xlat_func); |
2448 | else | 2482 | else |
2449 | ata_scsi_simulate(dev->id, cmd, done); | 2483 | ata_scsi_simulate(ap, dev, cmd, done); |
2450 | } else | 2484 | } else |
2451 | ata_scsi_translate(ap, dev, cmd, done, atapi_xlat); | 2485 | ata_scsi_translate(ap, dev, cmd, done, atapi_xlat); |
2452 | 2486 | ||
@@ -2469,14 +2503,16 @@ out_unlock: | |||
2469 | * spin_lock_irqsave(host_set lock) | 2503 | * spin_lock_irqsave(host_set lock) |
2470 | */ | 2504 | */ |
2471 | 2505 | ||
2472 | void ata_scsi_simulate(u16 *id, | 2506 | void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev, |
2473 | struct scsi_cmnd *cmd, | 2507 | struct scsi_cmnd *cmd, |
2474 | void (*done)(struct scsi_cmnd *)) | 2508 | void (*done)(struct scsi_cmnd *)) |
2475 | { | 2509 | { |
2476 | struct ata_scsi_args args; | 2510 | struct ata_scsi_args args; |
2477 | const u8 *scsicmd = cmd->cmnd; | 2511 | const u8 *scsicmd = cmd->cmnd; |
2478 | 2512 | ||
2479 | args.id = id; | 2513 | args.ap = ap; |
2514 | args.dev = dev; | ||
2515 | args.id = dev->id; | ||
2480 | args.cmd = cmd; | 2516 | args.cmd = cmd; |
2481 | args.done = done; | 2517 | args.done = done; |
2482 | 2518 | ||