Module Name:    src
Committed By:   tsutsui
Date:           Wed Sep  2 11:44:11 UTC 2009

Modified Files:
        src/sys/dev/ic: aic7xxx_osm.c

Log Message:
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?


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/aic7xxx_osm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/aic7xxx_osm.c
diff -u src/sys/dev/ic/aic7xxx_osm.c:1.32 src/sys/dev/ic/aic7xxx_osm.c:1.33
--- src/sys/dev/ic/aic7xxx_osm.c:1.32	Wed Sep  2 11:10:37 2009
+++ src/sys/dev/ic/aic7xxx_osm.c	Wed Sep  2 11:44:11 2009
@@ -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
  */

Reply via email to