Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58066
b: refs/heads/master
c: b9a4197
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Jun 27, 2007
1 parent a4f7c40 commit ced3c6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e00f1ff3c8977eff07d0214d2f3478ac947bda0f
refs/heads/master: b9a4197e266a40d5d1d16c9fb2a852cf10743afe
33 changes: 10 additions & 23 deletions trunk/drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4109,6 +4109,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
Expand All @@ -4126,33 +4127,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
Expand Down

0 comments on commit ced3c6c

Please sign in to comment.