diff options
Diffstat (limited to 'drivers/ata/pdc_adma.c')
-rw-r--r-- | drivers/ata/pdc_adma.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/ata/pdc_adma.c b/drivers/ata/pdc_adma.c index 8d1b03d5bcb1..199f7e150eb3 100644 --- a/drivers/ata/pdc_adma.c +++ b/drivers/ata/pdc_adma.c | |||
@@ -318,7 +318,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc) | |||
318 | struct scatterlist *sg; | 318 | struct scatterlist *sg; |
319 | struct ata_port *ap = qc->ap; | 319 | struct ata_port *ap = qc->ap; |
320 | struct adma_port_priv *pp = ap->private_data; | 320 | struct adma_port_priv *pp = ap->private_data; |
321 | u8 *buf = pp->pkt; | 321 | u8 *buf = pp->pkt, *last_buf = NULL; |
322 | int i = (2 + buf[3]) * 8; | 322 | int i = (2 + buf[3]) * 8; |
323 | u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0); | 323 | u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0); |
324 | 324 | ||
@@ -334,8 +334,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc) | |||
334 | *(__le32 *)(buf + i) = cpu_to_le32(len); | 334 | *(__le32 *)(buf + i) = cpu_to_le32(len); |
335 | i += 4; | 335 | i += 4; |
336 | 336 | ||
337 | if (ata_sg_is_last(sg, qc)) | 337 | last_buf = &buf[i]; |
338 | pFLAGS |= pEND; | ||
339 | buf[i++] = pFLAGS; | 338 | buf[i++] = pFLAGS; |
340 | buf[i++] = qc->dev->dma_mode & 0xf; | 339 | buf[i++] = qc->dev->dma_mode & 0xf; |
341 | buf[i++] = 0; /* pPKLW */ | 340 | buf[i++] = 0; /* pPKLW */ |
@@ -348,6 +347,10 @@ static int adma_fill_sg(struct ata_queued_cmd *qc) | |||
348 | VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4, | 347 | VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4, |
349 | (unsigned long)addr, len); | 348 | (unsigned long)addr, len); |
350 | } | 349 | } |
350 | |||
351 | if (likely(last_buf)) | ||
352 | *last_buf |= pEND; | ||
353 | |||
351 | return i; | 354 | return i; |
352 | } | 355 | } |
353 | 356 | ||