libata-scsi.c (7eb49509dd6b2a4ed0c18a0f8c187afbacf98b42) libata-scsi.c (4e5b6260cc9ba84ec127f948173ff7d87581f029)
1/*
2 * libata-scsi.c - helper library for ATA
3 *
4 * Maintained by: Tejun Heo <tj@kernel.org>
5 * Please ALWAYS copy linux-ide@vger.kernel.org
6 * on emails.
7 *
8 * Copyright 2003-2004 Red Hat, Inc. All rights reserved.

--- 1884 unchanged lines hidden (view full) ---

1893 * WARNING: one or two older ATA drives treat 0 as 0...
1894 */
1895 goto nothing_to_do;
1896
1897 qc->flags |= ATA_QCFLAG_IO;
1898 qc->nbytes = n_block * scmd->device->sector_size;
1899
1900 rc = ata_build_rw_tf(&qc->tf, qc->dev, block, n_block, tf_flags,
1/*
2 * libata-scsi.c - helper library for ATA
3 *
4 * Maintained by: Tejun Heo <tj@kernel.org>
5 * Please ALWAYS copy linux-ide@vger.kernel.org
6 * on emails.
7 *
8 * Copyright 2003-2004 Red Hat, Inc. All rights reserved.

--- 1884 unchanged lines hidden (view full) ---

1893 * WARNING: one or two older ATA drives treat 0 as 0...
1894 */
1895 goto nothing_to_do;
1896
1897 qc->flags |= ATA_QCFLAG_IO;
1898 qc->nbytes = n_block * scmd->device->sector_size;
1899
1900 rc = ata_build_rw_tf(&qc->tf, qc->dev, block, n_block, tf_flags,
1901 qc->tag, class);
1901 qc->hw_tag, class);
1902
1903 if (likely(rc == 0))
1904 return 0;
1905
1906 if (rc == -ERANGE)
1907 goto out_of_range;
1908 /* treat all other errors as -EINVAL, fall through */
1909invalid_fld:

--- 1321 unchanged lines hidden (view full) ---

3231 tf->lbah = cdb[17];
3232 tf->device = cdb[24];
3233 tf->command = cdb[25];
3234 tf->auxiliary = get_unaligned_be32(&cdb[28]);
3235 }
3236
3237 /* For NCQ commands copy the tag value */
3238 if (ata_is_ncq(tf->protocol))
1902
1903 if (likely(rc == 0))
1904 return 0;
1905
1906 if (rc == -ERANGE)
1907 goto out_of_range;
1908 /* treat all other errors as -EINVAL, fall through */
1909invalid_fld:

--- 1321 unchanged lines hidden (view full) ---

3231 tf->lbah = cdb[17];
3232 tf->device = cdb[24];
3233 tf->command = cdb[25];
3234 tf->auxiliary = get_unaligned_be32(&cdb[28]);
3235 }
3236
3237 /* For NCQ commands copy the tag value */
3238 if (ata_is_ncq(tf->protocol))
3239 tf->nsect = qc->tag << 3;
3239 tf->nsect = qc->hw_tag << 3;
3240
3241 /* enforce correct master/slave bit */
3242 tf->device = dev->devno ?
3243 tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1;
3244
3245 switch (tf->command) {
3246 /* READ/WRITE LONG use a non-standard sect_size */
3247 case ATA_CMD_READ_LONG:

--- 263 unchanged lines hidden (view full) ---

3511 if (size != len)
3512 goto invalid_param_len;
3513
3514 if (ata_ncq_enabled(dev) && ata_fpdma_dsm_supported(dev)) {
3515 /* Newer devices support queued TRIM commands */
3516 tf->protocol = ATA_PROT_NCQ;
3517 tf->command = ATA_CMD_FPDMA_SEND;
3518 tf->hob_nsect = ATA_SUBCMD_FPDMA_SEND_DSM & 0x1f;
3240
3241 /* enforce correct master/slave bit */
3242 tf->device = dev->devno ?
3243 tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1;
3244
3245 switch (tf->command) {
3246 /* READ/WRITE LONG use a non-standard sect_size */
3247 case ATA_CMD_READ_LONG:

--- 263 unchanged lines hidden (view full) ---

3511 if (size != len)
3512 goto invalid_param_len;
3513
3514 if (ata_ncq_enabled(dev) && ata_fpdma_dsm_supported(dev)) {
3515 /* Newer devices support queued TRIM commands */
3516 tf->protocol = ATA_PROT_NCQ;
3517 tf->command = ATA_CMD_FPDMA_SEND;
3518 tf->hob_nsect = ATA_SUBCMD_FPDMA_SEND_DSM & 0x1f;
3519 tf->nsect = qc->tag << 3;
3519 tf->nsect = qc->hw_tag << 3;
3520 tf->hob_feature = (size / 512) >> 8;
3521 tf->feature = size / 512;
3522
3523 tf->auxiliary = 1;
3524 } else {
3525 tf->protocol = ATA_PROT_DMA;
3526 tf->hob_feature = 0;
3527 tf->feature = ATA_DSM_TRIM;

--- 203 unchanged lines hidden (view full) ---

3731 sect = n_block / 512;
3732 options = cdb[14] & 0xbf;
3733
3734 if (ata_ncq_enabled(qc->dev) &&
3735 ata_fpdma_zac_mgmt_in_supported(qc->dev)) {
3736 tf->protocol = ATA_PROT_NCQ;
3737 tf->command = ATA_CMD_FPDMA_RECV;
3738 tf->hob_nsect = ATA_SUBCMD_FPDMA_RECV_ZAC_MGMT_IN & 0x1f;
3520 tf->hob_feature = (size / 512) >> 8;
3521 tf->feature = size / 512;
3522
3523 tf->auxiliary = 1;
3524 } else {
3525 tf->protocol = ATA_PROT_DMA;
3526 tf->hob_feature = 0;
3527 tf->feature = ATA_DSM_TRIM;

--- 203 unchanged lines hidden (view full) ---

3731 sect = n_block / 512;
3732 options = cdb[14] & 0xbf;
3733
3734 if (ata_ncq_enabled(qc->dev) &&
3735 ata_fpdma_zac_mgmt_in_supported(qc->dev)) {
3736 tf->protocol = ATA_PROT_NCQ;
3737 tf->command = ATA_CMD_FPDMA_RECV;
3738 tf->hob_nsect = ATA_SUBCMD_FPDMA_RECV_ZAC_MGMT_IN & 0x1f;
3739 tf->nsect = qc->tag << 3;
3739 tf->nsect = qc->hw_tag << 3;
3740 tf->feature = sect & 0xff;
3741 tf->hob_feature = (sect >> 8) & 0xff;
3742 tf->auxiliary = ATA_SUBCMD_ZAC_MGMT_IN_REPORT_ZONES | (options << 8);
3743 } else {
3744 tf->command = ATA_CMD_ZAC_MGMT_IN;
3745 tf->feature = ATA_SUBCMD_ZAC_MGMT_IN_REPORT_ZONES;
3746 tf->protocol = ATA_PROT_DMA;
3747 tf->hob_feature = options;

--- 62 unchanged lines hidden (view full) ---

3810
3811 all = cdb[14] & 0x1;
3812
3813 if (ata_ncq_enabled(qc->dev) &&
3814 ata_fpdma_zac_mgmt_out_supported(qc->dev)) {
3815 tf->protocol = ATA_PROT_NCQ_NODATA;
3816 tf->command = ATA_CMD_NCQ_NON_DATA;
3817 tf->feature = ATA_SUBCMD_NCQ_NON_DATA_ZAC_MGMT_OUT;
3740 tf->feature = sect & 0xff;
3741 tf->hob_feature = (sect >> 8) & 0xff;
3742 tf->auxiliary = ATA_SUBCMD_ZAC_MGMT_IN_REPORT_ZONES | (options << 8);
3743 } else {
3744 tf->command = ATA_CMD_ZAC_MGMT_IN;
3745 tf->feature = ATA_SUBCMD_ZAC_MGMT_IN_REPORT_ZONES;
3746 tf->protocol = ATA_PROT_DMA;
3747 tf->hob_feature = options;

--- 62 unchanged lines hidden (view full) ---

3810
3811 all = cdb[14] & 0x1;
3812
3813 if (ata_ncq_enabled(qc->dev) &&
3814 ata_fpdma_zac_mgmt_out_supported(qc->dev)) {
3815 tf->protocol = ATA_PROT_NCQ_NODATA;
3816 tf->command = ATA_CMD_NCQ_NON_DATA;
3817 tf->feature = ATA_SUBCMD_NCQ_NON_DATA_ZAC_MGMT_OUT;
3818 tf->nsect = qc->tag << 3;
3818 tf->nsect = qc->hw_tag << 3;
3819 tf->auxiliary = sa | ((u16)all << 8);
3820 } else {
3821 tf->protocol = ATA_PROT_NODATA;
3822 tf->command = ATA_CMD_ZAC_MGMT_OUT;
3823 tf->feature = sa;
3824 tf->hob_feature = all;
3825 }
3826 tf->lbah = (block >> 16) & 0xff;

--- 1311 unchanged lines hidden ---
3819 tf->auxiliary = sa | ((u16)all << 8);
3820 } else {
3821 tf->protocol = ATA_PROT_NODATA;
3822 tf->command = ATA_CMD_ZAC_MGMT_OUT;
3823 tf->feature = sa;
3824 tf->hob_feature = all;
3825 }
3826 tf->lbah = (block >> 16) & 0xff;

--- 1311 unchanged lines hidden ---