From 874ca2095201b33067662145c3d85a2666c1f091 Mon Sep 17 00:00:00 2001 From: sos Date: Sun, 4 May 2003 09:34:14 +0000 Subject: [PATCH] Grap the ATA lock on all channels before suspend, this makes certain that we have no outstanding ops in transit, which would cause problems on resume. --- sys/dev/ata/ata-all.c | 13 +++++++++++++ sys/dev/ata/ata-all.h | 1 + sys/dev/ata/ata-pci.c | 1 + 3 files changed, 15 insertions(+) diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index c3dbe6edec8..9a5daf701ae 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -240,6 +240,19 @@ ata_detach(device_t dev) return 0; } +int +ata_suspend(device_t dev) +{ + struct ata_channel *ch; + + if (!dev || !(ch = device_get_softc(dev))) + return ENXIO; + + ch->locking(ch, ATA_LF_LOCK); + ATA_SLEEPLOCK_CH(ch, ATA_CONTROL); + return 0; +} + int ata_resume(device_t dev) { diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index 8f261cb3460..44cb042e2b8 100644 --- a/sys/dev/ata/ata-all.h +++ b/sys/dev/ata/ata-all.h @@ -282,6 +282,7 @@ extern struct intr_config_hook *ata_delayed_attach; int ata_probe(device_t); int ata_attach(device_t); int ata_detach(device_t); +int ata_suspend(device_t); int ata_resume(device_t); void ata_start(struct ata_channel *); void ata_reset(struct ata_channel *); diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index 217e35f16c7..0636194d735 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -522,6 +522,7 @@ static device_method_t ata_pcisub_methods[] = { DEVMETHOD(device_probe, ata_pcisub_probe), DEVMETHOD(device_attach, ata_attach), DEVMETHOD(device_detach, ata_detach), + DEVMETHOD(device_suspend, ata_suspend), DEVMETHOD(device_resume, ata_resume), { 0, 0 } }; -- 2.45.2