aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_nv.c
diff options
context:
space:
mode:
authorRobert Hancock <hancockr@shaw.ca>2007-02-19 20:02:27 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-21 04:58:19 -0500
commit41949ed5c11a9d6e7af1afd62957d8d1988c803e (patch)
tree12f11d4df52e68ad40b24c95ef5e699b0f72fc7d /drivers/ata/sata_nv.c
parent08af7414786a3f35b686f68ada3de0b202c03d8c (diff)
sata_nv: cleanup CPB and APRD initialization
Clean up the initialization of the CPB and APRD structures so that we strictly follow the rules for ordering of writes to the CPB flags and response flags, and prevent duplicate initialization. Signed-off-by: Robert Hancock <hancockr@shaw.ca> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_nv.c')
-rw-r--r--drivers/ata/sata_nv.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 367027bc4cd7..067352da2c2d 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -1164,11 +1164,7 @@ static void nv_adma_fill_aprd(struct ata_queued_cmd *qc,
1164 int idx, 1164 int idx,
1165 struct nv_adma_prd *aprd) 1165 struct nv_adma_prd *aprd)
1166{ 1166{
1167 u8 flags; 1167 u8 flags = 0;
1168
1169 memset(aprd, 0, sizeof(struct nv_adma_prd));
1170
1171 flags = 0;
1172 if (qc->tf.flags & ATA_TFLAG_WRITE) 1168 if (qc->tf.flags & ATA_TFLAG_WRITE)
1173 flags |= NV_APRD_WRITE; 1169 flags |= NV_APRD_WRITE;
1174 if (idx == qc->n_elem - 1) 1170 if (idx == qc->n_elem - 1)
@@ -1179,6 +1175,7 @@ static void nv_adma_fill_aprd(struct ata_queued_cmd *qc,
1179 aprd->addr = cpu_to_le64(((u64)sg_dma_address(sg))); 1175 aprd->addr = cpu_to_le64(((u64)sg_dma_address(sg)));
1180 aprd->len = cpu_to_le32(((u32)sg_dma_len(sg))); /* len in bytes */ 1176 aprd->len = cpu_to_le32(((u32)sg_dma_len(sg))); /* len in bytes */
1181 aprd->flags = flags; 1177 aprd->flags = flags;
1178 aprd->packet_len = 0;
1182} 1179}
1183 1180
1184static void nv_adma_fill_sg(struct ata_queued_cmd *qc, struct nv_adma_cpb *cpb) 1181static void nv_adma_fill_sg(struct ata_queued_cmd *qc, struct nv_adma_cpb *cpb)
@@ -1199,6 +1196,8 @@ static void nv_adma_fill_sg(struct ata_queued_cmd *qc, struct nv_adma_cpb *cpb)
1199 } 1196 }
1200 if (idx > 5) 1197 if (idx > 5)
1201 cpb->next_aprd = cpu_to_le64(((u64)(pp->aprd_dma + NV_ADMA_SGTBL_SZ * qc->tag))); 1198 cpb->next_aprd = cpu_to_le64(((u64)(pp->aprd_dma + NV_ADMA_SGTBL_SZ * qc->tag)));
1199 else
1200 cpb->next_aprd = cpu_to_le64(0);
1202} 1201}
1203 1202
1204static int nv_adma_use_reg_mode(struct ata_queued_cmd *qc) 1203static int nv_adma_use_reg_mode(struct ata_queued_cmd *qc)
@@ -1231,7 +1230,10 @@ static void nv_adma_qc_prep(struct ata_queued_cmd *qc)
1231 return; 1230 return;
1232 } 1231 }
1233 1232
1234 memset(cpb, 0, sizeof(struct nv_adma_cpb)); 1233 cpb->resp_flags = NV_CPB_RESP_DONE;
1234 wmb();
1235 cpb->ctl_flags = 0;
1236 wmb();
1235 1237
1236 cpb->len = 3; 1238 cpb->len = 3;
1237 cpb->tag = qc->tag; 1239 cpb->tag = qc->tag;
@@ -1255,6 +1257,8 @@ static void nv_adma_qc_prep(struct ata_queued_cmd *qc)
1255 finished filling in all of the contents */ 1257 finished filling in all of the contents */
1256 wmb(); 1258 wmb();
1257 cpb->ctl_flags = ctl_flags; 1259 cpb->ctl_flags = ctl_flags;
1260 wmb();
1261 cpb->resp_flags = 0;
1258} 1262}
1259 1263
1260static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc) 1264static unsigned int nv_adma_qc_issue(struct ata_queued_cmd *qc)