Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Call ahc_shutdown() during system shutdown via pm...



details:   https://anonhg.NetBSD.org/src/rev/40b6f6c2b14d
branches:  trunk
changeset: 747099:40b6f6c2b14d
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Wed Sep 02 11:44:11 2009 +0000

description:
Call ahc_shutdown() during system shutdown via pmf_device_register1(9),
as well as pre-pmf(9)'fied kernel did via shutdownhook_establish(9).
Tested on O2.

ahc_suspend() and ahc_resume() are still disabled due to lack of hardware.
Anyone who can test Cardbus APA-1480?

diffstat:

 sys/dev/ic/aic7xxx_osm.c |  21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diffs (63 lines):

diff -r 9da7e1467d97 -r 40b6f6c2b14d sys/dev/ic/aic7xxx_osm.c
--- a/sys/dev/ic/aic7xxx_osm.c  Wed Sep 02 11:10:37 2009 +0000
+++ b/sys/dev/ic/aic7xxx_osm.c  Wed Sep 02 11:44:11 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aic7xxx_osm.c,v 1.32 2009/09/02 11:10:37 tsutsui Exp $ */
+/*     $NetBSD: aic7xxx_osm.c,v 1.33 2009/09/02 11:44:11 tsutsui Exp $ */
 
 /*
  * Bus independent FreeBSD shim for the aic7xxx based adaptec SCSI controllers
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.32 2009/09/02 11:10:37 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.33 2009/09/02 11:44:11 tsutsui Exp $");
 
 #include <dev/ic/aic7xxx_osm.h>
 #include <dev/ic/aic7xxx_inline.h>
@@ -60,6 +60,7 @@
 
 static bool    ahc_pmf_suspend(device_t PMF_FN_PROTO);
 static bool    ahc_pmf_resume(device_t PMF_FN_PROTO);
+static bool    ahc_pmf_shutdown(device_t, int);
 
 
 /*
@@ -126,7 +127,8 @@
        if ((ahc->features & AHC_TWIN) && ahc->flags & AHC_RESET_BUS_B)
                ahc_reset_channel(ahc, 'B', TRUE);
 
-       if (!pmf_device_register(ahc->sc_dev, ahc_pmf_suspend, ahc_pmf_resume))
+       if (!pmf_device_register1(ahc->sc_dev,
+           ahc_pmf_suspend, ahc_pmf_resume, ahc_pmf_shutdown))
                aprint_error_dev(ahc->sc_dev,
                    "couldn't establish power handler\n");
 
@@ -136,7 +138,7 @@
 
 /*
  * XXX we should call the real suspend and resume functions here
- * but for some reason ahc_suspend() panics on shutdown
+ *     but pmf(9) stuff on cardbus backend is untested yet
  */
 
 static bool
@@ -163,6 +165,17 @@
 #endif
 }
 
+static bool
+ahc_pmf_shutdown(device_t dev, int howto)
+{
+       struct ahc_softc *sc = device_private(dev);
+
+       /* Disable all interrupt sources by resetting the controller */
+       ahc_shutdown(sc);
+
+       return true;
+}
+
 /*
  * Catch an interrupt from the adapter
  */



Home | Main Index | Thread Index | Old Index