Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Register ipmi(4) with power management subs...



details:   https://anonhg.NetBSD.org/src/rev/5347292fedb3
branches:  trunk
changeset: 756430:5347292fedb3
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sat Jul 17 21:34:39 2010 +0000

description:
Register ipmi(4) with power management subsystem so we might have a chance
of suspending.  Suspending will still be denied if the watchdog is active.

As discussed on tech-kern@

XXX The pmf handlers for this and all other watchdogs should be factored
XXX out into a common handler for a generic wdog(4) pseudo-device, but
XXX that's left for the future.

diffstat:

 sys/arch/x86/x86/ipmi.c |  21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diffs (53 lines):

diff -r 3eefcfbda7fa -r 5347292fedb3 sys/arch/x86/x86/ipmi.c
--- a/sys/arch/x86/x86/ipmi.c   Sat Jul 17 19:31:47 2010 +0000
+++ b/sys/arch/x86/x86/ipmi.c   Sat Jul 17 21:34:39 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ipmi.c,v 1.46 2010/04/10 19:02:39 pgoyette Exp $ */
+/*     $NetBSD: ipmi.c,v 1.47 2010/07/17 21:34:39 pgoyette Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.46 2010/04/10 19:02:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.47 2010/07/17 21:34:39 pgoyette Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -225,6 +225,8 @@
 int     add_child_sensors(struct ipmi_softc *, uint8_t *, int, int, int,
     int, int, int, const char *);
 
+bool   ipmi_suspend(device_t, const pmf_qual_t *);
+
 struct ipmi_if kcs_if = {
        "KCS",
        IPMI_IF_KCS_NREGS,
@@ -1934,6 +1936,10 @@
        sc->sc_wdog.smw_tickle = ipmi_watchdog_tickle;
        sysmon_wdog_register(&sc->sc_wdog);
 
+       /* Set up a power handler so we can possibly sleep */
+       if (!pmf_device_register(self, ipmi_suspend, NULL))
+                aprint_error_dev(self, "couldn't establish a power handler\n");
+
        mutex_enter(&sc->sc_poll_mtx);
        while (sc->sc_thread_running) {
                ipmi_refresh_sensors(sc);
@@ -2093,3 +2099,14 @@
                    device_xname(sc->sc_dev), rc);
        }
 }
+
+bool
+ipmi_suspend(device_t dev, const pmf_qual_t *qual)
+{
+       struct ipmi_softc *sc = device_private(dev);
+
+       /* Don't allow suspend if watchdog is armed */
+       if ((sc->sc_wdog.smw_mode & WDOG_MODE_MASK) != WDOG_MODE_DISARMED)
+               return false;
+       return true;
+}



Home | Main Index | Thread Index | Old Index