NetBSD-Bugs archive

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

kern/38819: ahc should use pmf



>Number:         38819
>Category:       kern
>Synopsis:       ahc should use pmf
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 01 16:00:00 +0000 2008
>Originator:     Kurt Schreiner
>Release:        4.99.63
>Organization:
Johannes Gutenberg-Universitaet Mainz
>Environment:
NetBSD isunopti 4.99.63 NetBSD 4.99.63 (W2100Z) #103: Fri May 30 16:32:09 MEST 
2008  ks@isunopti:/u/NetBSD/arch/amd64/obj/sys/arch/amd64/compile/W2100Z amd64
>Description:
ahd on this machine hangs during shutdown
>How-To-Repeat:
shutdown a system w/ ahd...
>Fix:
The following patches (copied from what mcallan@ did for ahc) remedies the 
problem:

>-1029: cvs -z1 diff -u sys/dev/ic/aic79xx.c
Index: sys/dev/ic/aic79xx.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/aic79xx.c,v
retrieving revision 1.38
diff -u -r1.38 aic79xx.c
--- sys/dev/ic/aic79xx.c        21 Mar 2008 08:17:30 -0000      1.38
+++ sys/dev/ic/aic79xx.c        1 Jun 2008 08:23:34 -0000
@@ -6177,9 +6177,6 @@
        ahd_timer_reset(&ahd->stat_timer, AHD_STAT_UPDATE_US,
                        ahd_stat_timer, ahd);
 
-       /* We have to wait until after any system dumps... */
-       ahd->shutdown_hook = shutdownhook_establish(ahd_shutdown, ahd);
-
        return (0);
 }

>-1030: cvs -z1 diff -u sys/dev/ic/aic79xx_osm.c
Index: sys/dev/ic/aic79xx_osm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/aic79xx_osm.c,v
retrieving revision 1.19
diff -u -r1.19 aic79xx_osm.c
--- sys/dev/ic/aic79xx_osm.c    8 Apr 2008 12:07:25 -0000       1.19
+++ sys/dev/ic/aic79xx_osm.c    1 Jun 2008 08:23:54 -0000
@@ -767,8 +767,7 @@
        if (ahd->sc_child != NULL)
                rv = config_detach((void *)ahd->sc_child, flags);
 
-       shutdownhook_disestablish(ahd->shutdown_hook);
-
+       pmf_device_deregister(self);
        ahd_free(ahd);
 
        return rv;

>-1031: cvs -z1 diff -u sys/dev/ic/aic79xxvar.hIndex: sys/dev/ic/aic79xxvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/aic79xxvar.h,v
retrieving revision 1.23
diff -u -r1.23 aic79xxvar.h
--- sys/dev/ic/aic79xxvar.h     21 Mar 2008 08:17:30 -0000      1.23
+++ sys/dev/ic/aic79xxvar.h     1 Jun 2008 08:24:34 -0000
@@ -1071,7 +1071,6 @@
        bus_space_tag_t           tags[2];
        bus_space_handle_t        bshs[2];
 
-       void                     *shutdown_hook;
        struct scb_data           scb_data;
 
        struct hardware_scb      *next_queued_hscb;

>-1032: cvs -z1 diff -u sys/dev/pci/ahd_pci.c
Index: sys/dev/pci/ahd_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/ahd_pci.c,v
retrieving revision 1.27
diff -u -r1.27 ahd_pci.c
--- sys/dev/pci/ahd_pci.c       21 Mar 2008 08:17:30 -0000      1.27
+++ sys/dev/pci/ahd_pci.c       1 Jun 2008 08:25:00 -0000
@@ -267,6 +267,9 @@
 
 static int     ahd_pci_intr(struct ahd_softc *);
 
+static bool    ahd_pci_suspend(device_t PMF_FN_PROTO);
+static bool    ahd_pci_resume(device_t PMF_FN_PROTO);
+
 static const struct ahd_pci_identity *
 ahd_find_pci_device(pcireg_t id, pcireg_t subid)
 {
@@ -559,12 +562,39 @@
        if (error != 0)
                return;
 
+       pmf_device_register(self, ahd_pci_suspend, ahd_pci_resume);
        /*
         * Link this softc in with all other ahd instances.
         */
        ahd_attach(ahd);
 }
 
+/*
+ *
+ */
+
+static bool
+ahd_pci_suspend(device_t dev PMF_FN_ARGS)
+{
+       struct ahd_softc *sc = device_private(dev);
+#if 0
+       return (ahd_suspend(sc) == 0);
+#else
+       ahd_shutdown(sc);
+       return true;
+#endif
+}
+static bool
+ahd_pci_resume(device_t dev PMF_FN_ARGS)
+{
+#if 0
+       struct ahd_softc *sc = device_private(dev);
+       return (ahd_resume(sc) == 0);
+#else
+       return true;
+#endif
+}
+
 CFATTACH_DECL(ahd_pci, sizeof(struct ahd_softc),
     ahd_pci_probe, ahd_pci_attach, NULL, NULL);
 






Home | Main Index | Thread Index | Old Index