summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2005-04-13 07:14:17 +0000
committersos <sos@FreeBSD.org>2005-04-13 07:14:17 +0000
commit9d28f86771fbb646356b42d213a5fd137b84b26c (patch)
tree12fa8249eea69efd18e2cd9984312ea0494071b7 /sys/dev
parentc94ee5f99fbf2245bfd5e5161fb2d3472845d3d6 (diff)
downloadFreeBSD-src-9d28f86771fbb646356b42d213a5fd137b84b26c.zip
FreeBSD-src-9d28f86771fbb646356b42d213a5fd137b84b26c.tar.gz
Add a ata_setmode method so we dont panic on setmode.
Note that the mode is only set on the device, we (mostly) have no knowledge on how to set mode on the controller if at all possible.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ata/ata-card.c19
-rw-r--r--sys/dev/ata/ata-cbus.c11
-rw-r--r--sys/dev/ata/ata-isa.c14
3 files changed, 40 insertions, 4 deletions
diff --git a/sys/dev/ata/ata-card.c b/sys/dev/ata/ata-card.c
index 8615dde..42906de 100644
--- a/sys/dev/ata/ata-card.c
+++ b/sys/dev/ata/ata-card.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <dev/pccard/pccard_cis.h>
#include <dev/pccard/pccardreg.h>
#include <dev/pccard/pccardvar.h>
+#include <ata_if.h>
#include "pccarddevs.h"
@@ -154,16 +155,28 @@ ata_pccard_detach(device_t dev)
return 0;
}
+static void
+ata_pccard_setmode(device_t parent, device_t dev)
+{
+ struct ata_device *atadev = device_get_softc(dev);
+ int mode = atadev->mode;
+
+ atadev->mode = ata_limit_mode(atadev, mode, ATA_PIO_MAX);
+}
+
static device_method_t ata_pccard_methods[] = {
/* device interface */
- DEVMETHOD(device_probe, pccard_compat_probe),
- DEVMETHOD(device_attach, pccard_compat_attach),
- DEVMETHOD(device_detach, ata_pccard_detach),
+ DEVMETHOD(device_probe, pccard_compat_probe),
+ DEVMETHOD(device_attach, pccard_compat_attach),
+ DEVMETHOD(device_detach, ata_pccard_detach),
/* card interface */
DEVMETHOD(card_compat_match, ata_pccard_match),
DEVMETHOD(card_compat_probe, ata_pccard_probe),
DEVMETHOD(card_compat_attach, ata_attach),
+
+ /* ATA methods */
+ DEVMETHOD(ata_setmode, ata_pccard_setmode),
{ 0, 0 }
};
diff --git a/sys/dev/ata/ata-cbus.c b/sys/dev/ata/ata-cbus.c
index ac26664..d534a54 100644
--- a/sys/dev/ata/ata-cbus.c
+++ b/sys/dev/ata/ata-cbus.c
@@ -332,6 +332,15 @@ ata_cbuschannel_banking(device_t dev, int flags)
return res;
}
+static void
+ata_cbus_setmode(device_t parent, device_t dev)
+{
+ struct ata_device *atadev = device_get_softc(dev);
+ int mode = atadev->mode;
+
+ atadev->mode = ata_limit_mode(atadev, mode, ATA_PIO_MAX);
+}
+
static device_method_t ata_cbuschannel_methods[] = {
/* device interface */
DEVMETHOD(device_probe, ata_cbuschannel_probe),
@@ -342,7 +351,7 @@ static device_method_t ata_cbuschannel_methods[] = {
/* ATA methods */
DEVMETHOD(ata_locking, ata_cbuschannel_banking),
-
+ DEVMETHOD(ata_setmode, ata_cbus_setmode),
{ 0, 0 }
};
diff --git a/sys/dev/ata/ata-isa.c b/sys/dev/ata/ata-isa.c
index a6c50f9..2e8acda 100644
--- a/sys/dev/ata/ata-isa.c
+++ b/sys/dev/ata/ata-isa.c
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <isa/isavar.h>
#include <dev/ata/ata-all.h>
+#include <ata_if.h>
/* local vars */
static struct isa_pnp_id ata_ids[] = {
@@ -109,12 +110,25 @@ ata_isa_probe(device_t dev)
return ata_probe(dev);
}
+static void
+ata_isa_setmode(device_t parent, device_t dev)
+{
+ struct ata_device *atadev = device_get_softc(dev);
+ int mode = atadev->mode;
+
+ atadev->mode = ata_limit_mode(atadev, mode, ATA_PIO_MAX);
+}
+
+
static device_method_t ata_isa_methods[] = {
/* device interface */
DEVMETHOD(device_probe, ata_isa_probe),
DEVMETHOD(device_attach, ata_attach),
DEVMETHOD(device_suspend, ata_suspend),
DEVMETHOD(device_resume, ata_resume),
+
+ /* ATA methods */
+ DEVMETHOD(ata_setmode, ata_isa_setmode),
{ 0, 0 }
};
OpenPOWER on IntegriCloud