From e29bfdefccf5eeea7d608b0eba4cc3ab25cb424e Mon Sep 17 00:00:00 2001 From: sos Date: Mon, 3 Mar 2003 11:15:32 +0000 Subject: Always set the setmode funcptr. --- sys/dev/ata/ata-card.c | 9 +++++++++ sys/dev/ata/ata-isa.c | 9 +++++++++ sys/dev/ata/atapi-all.c | 4 +++- 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/dev/ata/ata-card.c b/sys/dev/ata/ata-card.c index 31ff4ab..8adf0b2 100644 --- a/sys/dev/ata/ata-card.c +++ b/sys/dev/ata/ata-card.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -66,6 +67,12 @@ ata_pccard_locknoop(struct ata_channel *ch, int type) { } +static void +ata_pccard_setmode(struct ata_device *atadev, int mode) +{ + atadev->mode = ata_limit_mode(atadev, mode, ATA_PIO_MAX); +} + static int ata_pccard_probe(device_t dev) { @@ -111,6 +118,8 @@ ata_pccard_probe(device_t dev) ch->unit = 0; ch->flags |= (ATA_USE_16BIT | ATA_NO_SLAVE); ch->locking = ata_pccard_locknoop; + ch->device[MASTER].setmode = ata_pccard_setmode; + ch->device[SLAVE].setmode = ata_pccard_setmode; return ata_probe(dev); } diff --git a/sys/dev/ata/ata-isa.c b/sys/dev/ata/ata-isa.c index c54b537..fba5b73 100644 --- a/sys/dev/ata/ata-isa.c +++ b/sys/dev/ata/ata-isa.c @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -59,6 +60,12 @@ ata_isa_lock(struct ata_channel *ch, int type) { } +static void +ata_isa_setmode(struct ata_device *atadev, int mode) +{ + atadev->mode = ata_limit_mode(atadev, mode, ATA_PIO_MAX); +} + static int ata_isa_probe(device_t dev) { @@ -88,6 +95,8 @@ ata_isa_probe(device_t dev) ch->unit = 0; ch->flags |= ATA_USE_16BIT; ch->locking = ata_isa_lock; + ch->device[MASTER].setmode = ata_isa_setmode; + ch->device[SLAVE].setmode = ata_isa_setmode; return ata_probe(dev); } diff --git a/sys/dev/ata/atapi-all.c b/sys/dev/ata/atapi-all.c index 4bccf38..f9f5392 100644 --- a/sys/dev/ata/atapi-all.c +++ b/sys/dev/ata/atapi-all.c @@ -71,8 +71,10 @@ atapi_attach(struct ata_device *atadev) ata_pmode(atadev->param), ata_wmode(atadev->param), ata_umode(atadev->param), atadev->param->support_dma); + /* use DMA if allowed and if drive/controller supports it */ ATA_SLEEPLOCK_CH(atadev->channel, ATA_CONTROL); - if (atapi_dma && !(atadev->param->drq_type == ATAPI_DRQT_INTR)) + if (atapi_dma && atadev->channel->dma && + !(atadev->param->drq_type == ATAPI_DRQT_INTR)) atadev->setmode(atadev, ATA_DMA_MAX); else atadev->setmode(atadev, ATA_PIO_MAX); -- cgit v1.1