diff options
author | Pavel Machek <pavel@suse.cz> | 2008-06-23 05:01:31 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-14 15:59:33 -0400 |
commit | ec6add99307d5149e17f6e358f19f0205b622407 (patch) | |
tree | de25764d878f17119f8c449fa38a460f7bddad0f | |
parent | 18f7ba4c2f4be6b37d925931f04d6cc28d88d1ee (diff) |
[libata] sata_svw: update code comments relating to data corruption
Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r-- | drivers/ata/sata_svw.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c index 16aa6839aa5a..fb13b82aacba 100644 --- a/drivers/ata/sata_svw.c +++ b/drivers/ata/sata_svw.c | |||
@@ -253,21 +253,29 @@ static void k2_bmdma_start_mmio(struct ata_queued_cmd *qc) | |||
253 | /* start host DMA transaction */ | 253 | /* start host DMA transaction */ |
254 | dmactl = readb(mmio + ATA_DMA_CMD); | 254 | dmactl = readb(mmio + ATA_DMA_CMD); |
255 | writeb(dmactl | ATA_DMA_START, mmio + ATA_DMA_CMD); | 255 | writeb(dmactl | ATA_DMA_START, mmio + ATA_DMA_CMD); |
256 | /* There is a race condition in certain SATA controllers that can | 256 | /* This works around possible data corruption. |
257 | be seen when the r/w command is given to the controller before the | 257 | |
258 | host DMA is started. On a Read command, the controller would initiate | 258 | On certain SATA controllers that can be seen when the r/w |
259 | the command to the drive even before it sees the DMA start. When there | 259 | command is given to the controller before the host DMA is |
260 | are very fast drives connected to the controller, or when the data request | 260 | started. |
261 | hits in the drive cache, there is the possibility that the drive returns a part | 261 | |
262 | or all of the requested data to the controller before the DMA start is issued. | 262 | On a Read command, the controller would initiate the |
263 | In this case, the controller would become confused as to what to do with the data. | 263 | command to the drive even before it sees the DMA |
264 | In the worst case when all the data is returned back to the controller, the | 264 | start. When there are very fast drives connected to the |
265 | controller could hang. In other cases it could return partial data returning | 265 | controller, or when the data request hits in the drive |
266 | in data corruption. This problem has been seen in PPC systems and can also appear | 266 | cache, there is the possibility that the drive returns a |
267 | on an system with very fast disks, where the SATA controller is sitting behind a | 267 | part or all of the requested data to the controller before |
268 | number of bridges, and hence there is significant latency between the r/w command | 268 | the DMA start is issued. In this case, the controller |
269 | and the start command. */ | 269 | would become confused as to what to do with the data. In |
270 | /* issue r/w command if the access is to ATA*/ | 270 | the worst case when all the data is returned back to the |
271 | controller, the controller could hang. In other cases it | ||
272 | could return partial data returning in data | ||
273 | corruption. This problem has been seen in PPC systems and | ||
274 | can also appear on an system with very fast disks, where | ||
275 | the SATA controller is sitting behind a number of bridges, | ||
276 | and hence there is significant latency between the r/w | ||
277 | command and the start command. */ | ||
278 | /* issue r/w command if the access is to ATA */ | ||
271 | if (qc->tf.protocol == ATA_PROT_DMA) | 279 | if (qc->tf.protocol == ATA_PROT_DMA) |
272 | ap->ops->sff_exec_command(ap, &qc->tf); | 280 | ap->ops->sff_exec_command(ap, &qc->tf); |
273 | } | 281 | } |