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 Use pmf_device_register1(9) and add cpu_shu...



details:   https://anonhg.NetBSD.org/src/rev/7e2b3d1f5552
branches:  trunk
changeset: 760718:7e2b3d1f5552
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Tue Jan 11 18:25:25 2011 +0000

description:
Use pmf_device_register1(9) and add cpu_shutdown(), which calls cpu_suspend().

diffstat:

 sys/arch/x86/x86/cpu.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (57 lines):

diff -r b584fe640fb6 -r 7e2b3d1f5552 sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c    Tue Jan 11 16:34:27 2011 +0000
+++ b/sys/arch/x86/x86/cpu.c    Tue Jan 11 18:25:25 2011 +0000
@@ -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)
 {



Home | Main Index | Thread Index | Old Index