Module Name: src Committed By: jruoho Date: Tue Jan 11 18:25:26 UTC 2011
Modified Files: src/sys/arch/x86/x86: cpu.c Log Message: Use pmf_device_register1(9) and add cpu_shutdown(), which calls cpu_suspend(). To generate a diff of this commit: cvs rdiff -u -r1.78 -r1.79 src/sys/arch/x86/x86/cpu.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/cpu.c diff -u src/sys/arch/x86/x86/cpu.c:1.78 src/sys/arch/x86/x86/cpu.c:1.79 --- src/sys/arch/x86/x86/cpu.c:1.78 Sat Nov 6 11:46:04 2010 +++ src/sys/arch/x86/x86/cpu.c Tue Jan 11 18:25:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.78 2010/11/06 11:46:04 uebayasi Exp $ */ +/* $NetBSD: cpu.c,v 1.79 2011/01/11 18:25:25 jruoho Exp $ */ /*- * Copyright (c) 2000, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.78 2010/11/06 11:46:04 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.79 2011/01/11 18:25:25 jruoho Exp $"); #include "opt_ddb.h" #include "opt_mpbios.h" /* for MPDEBUG */ @@ -122,6 +122,7 @@ static bool cpu_suspend(device_t, const pmf_qual_t *); static bool cpu_resume(device_t, const pmf_qual_t *); +static bool cpu_shutdown(device_t, int); struct cpu_softc { device_t sc_dev; /* device tree glue */ @@ -427,7 +428,7 @@ pat_init(ci); atomic_or_32(&cpus_attached, ci->ci_cpumask); - if (!pmf_device_register(self, cpu_suspend, cpu_resume)) + if (!pmf_device_register1(self, cpu_suspend, cpu_resume, cpu_shutdown)) aprint_error_dev(self, "couldn't establish power handler\n"); if (mp_verbose) { @@ -1036,7 +1037,7 @@ mutex_enter(&cpu_lock); err = cpu_setstate(ci, false); mutex_exit(&cpu_lock); - + if (err) return false; } @@ -1067,6 +1068,12 @@ return err == 0; } +static bool +cpu_shutdown(device_t dv, int how) +{ + return cpu_suspend(dv, NULL); +} + void cpu_get_tsc_freq(struct cpu_info *ci) {