diff options
author | Tejun Heo <htejun@gmail.com> | 2007-07-16 01:29:38 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-20 08:02:10 -0400 |
commit | 9977126c4b65c1396b665f7a0eeb8c7dede336f9 (patch) | |
tree | 91901f1356a57ba311bc5c95c4825504642f7d04 | |
parent | fe36cb53cfd82f3c0796a0826e1c9caf198c8f97 (diff) |
libata: add @is_cmd to ata_tf_to_fis()
Add @is_cmd to ata_tf_to_fis(). This controls bit 7 of the second
byte which tells the device whether this H2D FIS is for a command or
not. This cleans up ahci a bit and will be used by PMP.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/ata/ahci.c | 10 | ||||
-rw-r--r-- | drivers/ata/libata-core.c | 14 | ||||
-rw-r--r-- | drivers/ata/sata_qstor.c | 2 | ||||
-rw-r--r-- | drivers/ata/sata_sil24.c | 2 | ||||
-rw-r--r-- | include/linux/libata.h | 3 |
5 files changed, 16 insertions, 15 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index eaec5e506f5e..61c5b6e68de4 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1020,8 +1020,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class, | |||
1020 | cmd_fis_len | AHCI_CMD_RESET | AHCI_CMD_CLR_BUSY); | 1020 | cmd_fis_len | AHCI_CMD_RESET | AHCI_CMD_CLR_BUSY); |
1021 | 1021 | ||
1022 | tf.ctl |= ATA_SRST; | 1022 | tf.ctl |= ATA_SRST; |
1023 | ata_tf_to_fis(&tf, fis, 0); | 1023 | ata_tf_to_fis(&tf, 0, 0, fis); |
1024 | fis[1] &= ~(1 << 7); /* turn off Command FIS bit */ | ||
1025 | 1024 | ||
1026 | writel(1, port_mmio + PORT_CMD_ISSUE); | 1025 | writel(1, port_mmio + PORT_CMD_ISSUE); |
1027 | 1026 | ||
@@ -1039,8 +1038,7 @@ static int ahci_softreset(struct ata_port *ap, unsigned int *class, | |||
1039 | ahci_fill_cmd_slot(pp, 0, cmd_fis_len); | 1038 | ahci_fill_cmd_slot(pp, 0, cmd_fis_len); |
1040 | 1039 | ||
1041 | tf.ctl &= ~ATA_SRST; | 1040 | tf.ctl &= ~ATA_SRST; |
1042 | ata_tf_to_fis(&tf, fis, 0); | 1041 | ata_tf_to_fis(&tf, 0, 0, fis); |
1043 | fis[1] &= ~(1 << 7); /* turn off Command FIS bit */ | ||
1044 | 1042 | ||
1045 | writel(1, port_mmio + PORT_CMD_ISSUE); | 1043 | writel(1, port_mmio + PORT_CMD_ISSUE); |
1046 | readl(port_mmio + PORT_CMD_ISSUE); /* flush */ | 1044 | readl(port_mmio + PORT_CMD_ISSUE); /* flush */ |
@@ -1088,7 +1086,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class, | |||
1088 | /* clear D2H reception area to properly wait for D2H FIS */ | 1086 | /* clear D2H reception area to properly wait for D2H FIS */ |
1089 | ata_tf_init(ap->device, &tf); | 1087 | ata_tf_init(ap->device, &tf); |
1090 | tf.command = 0x80; | 1088 | tf.command = 0x80; |
1091 | ata_tf_to_fis(&tf, d2h_fis, 0); | 1089 | ata_tf_to_fis(&tf, 0, 0, d2h_fis); |
1092 | 1090 | ||
1093 | rc = sata_std_hardreset(ap, class, deadline); | 1091 | rc = sata_std_hardreset(ap, class, deadline); |
1094 | 1092 | ||
@@ -1205,7 +1203,7 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc) | |||
1205 | */ | 1203 | */ |
1206 | cmd_tbl = pp->cmd_tbl + qc->tag * AHCI_CMD_TBL_SZ; | 1204 | cmd_tbl = pp->cmd_tbl + qc->tag * AHCI_CMD_TBL_SZ; |
1207 | 1205 | ||
1208 | ata_tf_to_fis(&qc->tf, cmd_tbl, 0); | 1206 | ata_tf_to_fis(&qc->tf, 0, 1, cmd_tbl); |
1209 | if (is_atapi) { | 1207 | if (is_atapi) { |
1210 | memset(cmd_tbl + AHCI_CMD_TBL_CDB, 0, 32); | 1208 | memset(cmd_tbl + AHCI_CMD_TBL_CDB, 0, 32); |
1211 | memcpy(cmd_tbl + AHCI_CMD_TBL_CDB, qc->cdb, qc->dev->cdb_len); | 1209 | memcpy(cmd_tbl + AHCI_CMD_TBL_CDB, qc->cdb, qc->dev->cdb_len); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index e2ecb7a4628e..39a8e986a4ea 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -111,8 +111,9 @@ MODULE_VERSION(DRV_VERSION); | |||
111 | /** | 111 | /** |
112 | * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure | 112 | * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure |
113 | * @tf: Taskfile to convert | 113 | * @tf: Taskfile to convert |
114 | * @fis: Buffer into which data will output | ||
115 | * @pmp: Port multiplier port | 114 | * @pmp: Port multiplier port |
115 | * @is_cmd: This FIS is for command | ||
116 | * @fis: Buffer into which data will output | ||
116 | * | 117 | * |
117 | * Converts a standard ATA taskfile to a Serial ATA | 118 | * Converts a standard ATA taskfile to a Serial ATA |
118 | * FIS structure (Register - Host to Device). | 119 | * FIS structure (Register - Host to Device). |
@@ -120,12 +121,13 @@ MODULE_VERSION(DRV_VERSION); | |||
120 | * LOCKING: | 121 | * LOCKING: |
121 | * Inherited from caller. | 122 | * Inherited from caller. |
122 | */ | 123 | */ |
123 | 124 | void ata_tf_to_fis(const struct ata_taskfile *tf, u8 pmp, int is_cmd, u8 *fis) | |
124 | void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp) | ||
125 | { | 125 | { |
126 | fis[0] = 0x27; /* Register - Host to Device FIS */ | 126 | fis[0] = 0x27; /* Register - Host to Device FIS */ |
127 | fis[1] = (pmp & 0xf) | (1 << 7); /* Port multiplier number, | 127 | fis[1] = pmp & 0xf; /* Port multiplier number*/ |
128 | bit 7 indicates Command FIS */ | 128 | if (is_cmd) |
129 | fis[1] |= (1 << 7); /* bit 7 indicates Command FIS */ | ||
130 | |||
129 | fis[2] = tf->command; | 131 | fis[2] = tf->command; |
130 | fis[3] = tf->feature; | 132 | fis[3] = tf->feature; |
131 | 133 | ||
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c index 9ab554da89bf..5aef4ac37012 100644 --- a/drivers/ata/sata_qstor.c +++ b/drivers/ata/sata_qstor.c | |||
@@ -337,7 +337,7 @@ static void qs_qc_prep(struct ata_queued_cmd *qc) | |||
337 | buf[28] = dflags; | 337 | buf[28] = dflags; |
338 | 338 | ||
339 | /* frame information structure (FIS) */ | 339 | /* frame information structure (FIS) */ |
340 | ata_tf_to_fis(&qc->tf, &buf[32], 0); | 340 | ata_tf_to_fis(&qc->tf, 0, 1, &buf[32]); |
341 | } | 341 | } |
342 | 342 | ||
343 | static inline void qs_packet_start(struct ata_queued_cmd *qc) | 343 | static inline void qs_packet_start(struct ata_queued_cmd *qc) |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index ac43a30ebe29..a11007b5071e 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -699,7 +699,7 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc) | |||
699 | } | 699 | } |
700 | 700 | ||
701 | prb->ctrl = cpu_to_le16(ctrl); | 701 | prb->ctrl = cpu_to_le16(ctrl); |
702 | ata_tf_to_fis(&qc->tf, prb->fis, 0); | 702 | ata_tf_to_fis(&qc->tf, 0, 1, prb->fis); |
703 | 703 | ||
704 | if (qc->flags & ATA_QCFLAG_DMAMAP) | 704 | if (qc->flags & ATA_QCFLAG_DMAMAP) |
705 | sil24_fill_sg(qc, sge); | 705 | sil24_fill_sg(qc, sge); |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 47cd2a1c5544..5d3df6cde272 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -764,7 +764,8 @@ extern unsigned int ata_dev_try_classify(struct ata_port *, unsigned int, u8 *); | |||
764 | */ | 764 | */ |
765 | extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); | 765 | extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf); |
766 | extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); | 766 | extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf); |
767 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp); | 767 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, |
768 | u8 pmp, int is_cmd, u8 *fis); | ||
768 | extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); | 769 | extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); |
769 | extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device); | 770 | extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device); |
770 | extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); | 771 | extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); |