aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-06-04 01:13:15 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-06-04 01:13:15 -0400
commita0ea7328e3f4971bbc2287c344650b08c2cec375 (patch)
treedfc70d052a2f78aaed66fcffb6b7bfaf9b6a0d67
parent70c85233814949184070ee35f8929dde64402dc9 (diff)
[libata] ahci: finish ATAPI support (hopefully)
-rw-r--r--drivers/scsi/ahci.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 1799233dcf9f..9a547ca9c864 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -50,6 +50,7 @@ enum {
50 AHCI_CMD_SLOT_SZ = 32 * 32, 50 AHCI_CMD_SLOT_SZ = 32 * 32,
51 AHCI_RX_FIS_SZ = 256, 51 AHCI_RX_FIS_SZ = 256,
52 AHCI_CMD_TBL_HDR = 0x80, 52 AHCI_CMD_TBL_HDR = 0x80,
53 AHCI_CMD_TBL_CDB = 0x40,
53 AHCI_CMD_TBL_SZ = AHCI_CMD_TBL_HDR + (AHCI_MAX_SG * 16), 54 AHCI_CMD_TBL_SZ = AHCI_CMD_TBL_HDR + (AHCI_MAX_SG * 16),
54 AHCI_PORT_PRIV_DMA_SZ = AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_SZ + 55 AHCI_PORT_PRIV_DMA_SZ = AHCI_CMD_SLOT_SZ + AHCI_CMD_TBL_SZ +
55 AHCI_RX_FIS_SZ, 56 AHCI_RX_FIS_SZ,
@@ -510,7 +511,8 @@ static void ahci_fill_sg(struct ata_queued_cmd *qc)
510 511
511static void ahci_qc_prep(struct ata_queued_cmd *qc) 512static void ahci_qc_prep(struct ata_queued_cmd *qc)
512{ 513{
513 struct ahci_port_priv *pp = qc->ap->private_data; 514 struct ata_port *ap = qc->ap;
515 struct ahci_port_priv *pp = ap->private_data;
514 u32 opts; 516 u32 opts;
515 const u32 cmd_fis_len = 5; /* five dwords */ 517 const u32 cmd_fis_len = 5; /* five dwords */
516 518
@@ -522,18 +524,8 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
522 opts = (qc->n_elem << 16) | cmd_fis_len; 524 opts = (qc->n_elem << 16) | cmd_fis_len;
523 if (qc->tf.flags & ATA_TFLAG_WRITE) 525 if (qc->tf.flags & ATA_TFLAG_WRITE)
524 opts |= AHCI_CMD_WRITE; 526 opts |= AHCI_CMD_WRITE;
525 527 if (is_atapi_taskfile(&qc->tf))
526 switch (qc->tf.protocol) {
527 case ATA_PROT_ATAPI:
528 case ATA_PROT_ATAPI_NODATA:
529 case ATA_PROT_ATAPI_DMA:
530 opts |= AHCI_CMD_ATAPI; 528 opts |= AHCI_CMD_ATAPI;
531 break;
532
533 default:
534 /* do nothing */
535 break;
536 }
537 529
538 pp->cmd_slot[0].opts = cpu_to_le32(opts); 530 pp->cmd_slot[0].opts = cpu_to_le32(opts);
539 pp->cmd_slot[0].status = 0; 531 pp->cmd_slot[0].status = 0;
@@ -545,6 +537,10 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
545 * a SATA Register - Host to Device command FIS. 537 * a SATA Register - Host to Device command FIS.
546 */ 538 */
547 ata_tf_to_fis(&qc->tf, pp->cmd_tbl, 0); 539 ata_tf_to_fis(&qc->tf, pp->cmd_tbl, 0);
540 if (opts & AHCI_CMD_ATAPI) {
541 memset(pp->cmd_tbl + AHCI_CMD_TBL_CDB, 0, 32);
542 memcpy(pp->cmd_tbl + AHCI_CMD_TBL_CDB, qc->cdb, ap->cdb_len);
543 }
548 544
549 if (!(qc->flags & ATA_QCFLAG_DMAMAP)) 545 if (!(qc->flags & ATA_QCFLAG_DMAMAP))
550 return; 546 return;