aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ata/ata-lowlevel.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ata/ata-lowlevel.c')
-rw-r--r--sys/dev/ata/ata-lowlevel.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/dev/ata/ata-lowlevel.c b/sys/dev/ata/ata-lowlevel.c
index 566b8f676a59..6c196d60a442 100644
--- a/sys/dev/ata/ata-lowlevel.c
+++ b/sys/dev/ata/ata-lowlevel.c
@@ -141,6 +141,14 @@ ata_begin_transaction(struct ata_request *request)
goto begin_finished;
}
+ /* start DMA engine if necessary */
+ if ((ch->flags & ATA_DMA_BEFORE_CMD) &&
+ ch->dma.start && ch->dma.start(request)) {
+ device_printf(request->parent, "error starting DMA\n");
+ request->result = EIO;
+ goto begin_finished;
+ }
+
/* issue command */
if (ch->hw.command(request)) {
device_printf(request->parent, "error issuing %s command\n",
@@ -150,7 +158,8 @@ ata_begin_transaction(struct ata_request *request)
}
/* start DMA engine */
- if (ch->dma.start && ch->dma.start(request)) {
+ if (!(ch->flags & ATA_DMA_BEFORE_CMD) &&
+ ch->dma.start && ch->dma.start(request)) {
device_printf(request->parent, "error starting DMA\n");
request->result = EIO;
goto begin_finished;