Module Name: src Committed By: pgoyette Date: Sat Jul 17 21:34:39 UTC 2010
Modified Files: src/sys/arch/x86/x86: ipmi.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/x86/ipmi.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/arch/x86/x86/ipmi.c diff -u src/sys/arch/x86/x86/ipmi.c:1.46 src/sys/arch/x86/x86/ipmi.c:1.47 --- src/sys/arch/x86/x86/ipmi.c:1.46 Sat Apr 10 19:02:39 2010 +++ src/sys/arch/x86/x86/ipmi.c Sat Jul 17 21:34:39 2010 @@ -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; +}