aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ahci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ahci.c')
-rw-r--r--drivers/scsi/ahci.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 57ef7ae387d9..7b0640bc0079 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -474,11 +474,12 @@ static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
474 ata_tf_from_fis(d2h_fis, tf); 474 ata_tf_from_fis(d2h_fis, tf);
475} 475}
476 476
477static void ahci_fill_sg(struct ata_queued_cmd *qc) 477static unsigned int ahci_fill_sg(struct ata_queued_cmd *qc)
478{ 478{
479 struct ahci_port_priv *pp = qc->ap->private_data; 479 struct ahci_port_priv *pp = qc->ap->private_data;
480 struct scatterlist *sg; 480 struct scatterlist *sg;
481 struct ahci_sg *ahci_sg; 481 struct ahci_sg *ahci_sg;
482 unsigned int n_sg = 0;
482 483
483 VPRINTK("ENTER\n"); 484 VPRINTK("ENTER\n");
484 485
@@ -493,8 +494,12 @@ static void ahci_fill_sg(struct ata_queued_cmd *qc)
493 ahci_sg->addr = cpu_to_le32(addr & 0xffffffff); 494 ahci_sg->addr = cpu_to_le32(addr & 0xffffffff);
494 ahci_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16); 495 ahci_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16);
495 ahci_sg->flags_size = cpu_to_le32(sg_len - 1); 496 ahci_sg->flags_size = cpu_to_le32(sg_len - 1);
497
496 ahci_sg++; 498 ahci_sg++;
499 n_sg++;
497 } 500 }
501
502 return n_sg;
498} 503}
499 504
500static void ahci_qc_prep(struct ata_queued_cmd *qc) 505static void ahci_qc_prep(struct ata_queued_cmd *qc)
@@ -503,13 +508,14 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
503 struct ahci_port_priv *pp = ap->private_data; 508 struct ahci_port_priv *pp = ap->private_data;
504 u32 opts; 509 u32 opts;
505 const u32 cmd_fis_len = 5; /* five dwords */ 510 const u32 cmd_fis_len = 5; /* five dwords */
511 unsigned int n_elem;
506 512
507 /* 513 /*
508 * Fill in command slot information (currently only one slot, 514 * Fill in command slot information (currently only one slot,
509 * slot 0, is currently since we don't do queueing) 515 * slot 0, is currently since we don't do queueing)
510 */ 516 */
511 517
512 opts = (qc->n_elem << 16) | cmd_fis_len; 518 opts = cmd_fis_len;
513 if (qc->tf.flags & ATA_TFLAG_WRITE) 519 if (qc->tf.flags & ATA_TFLAG_WRITE)
514 opts |= AHCI_CMD_WRITE; 520 opts |= AHCI_CMD_WRITE;
515 if (is_atapi_taskfile(&qc->tf)) 521 if (is_atapi_taskfile(&qc->tf))
@@ -533,7 +539,9 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
533 if (!(qc->flags & ATA_QCFLAG_DMAMAP)) 539 if (!(qc->flags & ATA_QCFLAG_DMAMAP))
534 return; 540 return;
535 541
536 ahci_fill_sg(qc); 542 n_elem = ahci_fill_sg(qc);
543
544 pp->cmd_slot[0].opts |= cpu_to_le32(n_elem << 16);
537} 545}
538 546
539static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) 547static void ahci_intr_error(struct ata_port *ap, u32 irq_stat)