Bugzilla – Attachment 147389 Details for
Bug 229260
Optical drive (SH-S162L) not configured
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
update-ata_check_atapi_dma.patch
update-ata_check_atapi_dma.patch (text/plain), 4.04 KB, created by
Tejun Heo
on 2007-06-20 14:56:29 UTC
(
hide
)
Description:
update-ata_check_atapi_dma.patch
Filename:
MIME Type:
Creator:
Tejun Heo
Created:
2007-06-20 14:56:29 UTC
Size:
4.04 KB
patch
obsolete
>diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c >index 047eabd..9cbd764 100644 >--- a/drivers/ata/libata-core.c >+++ b/drivers/ata/libata-core.c >@@ -2046,10 +2046,6 @@ int ata_dev_configure(struct ata_device *dev) > dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, > dev->max_sectors); > >- /* limit ATAPI DMA to R/W commands only */ >- if (ata_device_blacklisted(dev) & ATA_HORKAGE_DMA_RW_ONLY) >- dev->horkage |= ATA_HORKAGE_DMA_RW_ONLY; >- > if (ap->ops->dev_config) > ap->ops->dev_config(dev); > >@@ -3780,8 +3776,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { > { "IOMEGA ZIP 250 ATAPI", NULL, ATA_HORKAGE_NODMA }, /* temporary fix */ > > /* Weird ATAPI devices */ >- { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 | >- ATA_HORKAGE_DMA_RW_ONLY }, >+ { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, > > /* Devices we expect to fail diagnostics */ > >@@ -4107,6 +4102,7 @@ static void ata_fill_sg(struct ata_queued_cmd *qc) > if (idx) > ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT); > } >+ > /** > * ata_check_atapi_dma - Check whether ATAPI DMA can be supported > * @qc: Metadata associated with taskfile to check >@@ -4124,33 +4120,19 @@ static void ata_fill_sg(struct ata_queued_cmd *qc) > int ata_check_atapi_dma(struct ata_queued_cmd *qc) > { > struct ata_port *ap = qc->ap; >- int rc = 0; /* Assume ATAPI DMA is OK by default */ >- >- /* some drives can only do ATAPI DMA on read/write */ >- if (unlikely(qc->dev->horkage & ATA_HORKAGE_DMA_RW_ONLY)) { >- struct scsi_cmnd *cmd = qc->scsicmd; >- u8 *scsicmd = cmd->cmnd; >- >- switch (scsicmd[0]) { >- case READ_10: >- case WRITE_10: >- case READ_12: >- case WRITE_12: >- case READ_6: >- case WRITE_6: >- /* atapi dma maybe ok */ >- break; >- default: >- /* turn off atapi dma */ >- return 1; >- } >- } >+ >+ /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a >+ * few ATAPI devices choke on such DMA requests. >+ */ >+ if (unlikely(qc->nbytes & 15)) >+ return 1; > > if (ap->ops->check_atapi_dma) >- rc = ap->ops->check_atapi_dma(qc); >+ return ap->ops->check_atapi_dma(qc); > >- return rc; >+ return 0; > } >+ > /** > * ata_qc_prep - Prepare taskfile for submission > * @qc: Metadata associated with taskfile to be prepared >diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c >index c228df2..4ddf00c 100644 >--- a/drivers/ata/libata-scsi.c >+++ b/drivers/ata/libata-scsi.c >@@ -2384,11 +2384,6 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) > int using_pio = (dev->flags & ATA_DFLAG_PIO); > int nodata = (scmd->sc_data_direction == DMA_NONE); > >- if (!using_pio) >- /* Check whether ATAPI DMA is safe */ >- if (ata_check_atapi_dma(qc)) >- using_pio = 1; >- > memset(qc->cdb, 0, dev->cdb_len); > memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len); > >@@ -2401,19 +2396,22 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) > } > > qc->tf.command = ATA_CMD_PACKET; >+ qc->nbytes = scmd->request_bufflen; >+ >+ /* check whether ATAPI DMA is safe */ >+ if (!using_pio && ata_check_atapi_dma(qc)) >+ using_pio = 1; > >- /* no data, or PIO data xfer */ > if (using_pio || nodata) { >+ /* no data, or PIO data xfer */ > if (nodata) > qc->tf.protocol = ATA_PROT_ATAPI_NODATA; > else > qc->tf.protocol = ATA_PROT_ATAPI; > qc->tf.lbam = (8 * 1024) & 0xff; > qc->tf.lbah = (8 * 1024) >> 8; >- } >- >- /* DMA data xfer */ >- else { >+ } else { >+ /* DMA data xfer */ > qc->tf.protocol = ATA_PROT_ATAPI_DMA; > qc->tf.feature |= ATAPI_PKT_DMA; > >@@ -2422,8 +2420,6 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) > qc->tf.feature |= ATAPI_DMADIR; > } > >- qc->nbytes = scmd->request_bufflen; >- > return 0; > } > >diff --git a/include/linux/libata.h b/include/linux/libata.h >index 745c4f9..e9659ff 100644 >--- a/include/linux/libata.h >+++ b/include/linux/libata.h >@@ -298,7 +298,6 @@ enum { > ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */ > ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */ > ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */ >- ATA_HORKAGE_DMA_RW_ONLY = (1 << 4), /* ATAPI DMA for RW only */ > }; > > enum hsm_task_states {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 229260
:
110439
|
110440
|
112812
|
113034
|
146652
|
146927
| 147389 |
157226
|
158345
|
159331
|
159332
|
159974
|
160145
|
160656
|
160699
|
161349
|
161350
|
173856
|
179005
|
179156
|
179246
|
179479
|
179480
|
179499
|
179500
|
179503
|
179556
|
179801