Module Name: src
Committed By: jruoho
Date: Tue Oct 18 05:16:02 UTC 2011
Modified Files:
src/sys/arch/x86/x86: cpu.c
Log Message:
As cpu_shutdown() is a wrapper to cpu_suspend(), modify slightly to prevent
setting low frequencies for active non-bootstrap processors during shutdown.
To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 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.95 src/sys/arch/x86/x86/cpu.c:1.96
--- src/sys/arch/x86/x86/cpu.c:1.95 Mon Oct 17 22:38:01 2011
+++ src/sys/arch/x86/x86/cpu.c Tue Oct 18 05:16:02 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.95 2011/10/17 22:38:01 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.96 2011/10/18 05:16:02 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.95 2011/10/17 22:38:01 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.96 2011/10/18 05:16:02 jruoho Exp $");
#include "opt_ddb.h"
#include "opt_mpbios.h" /* for MPDEBUG */
@@ -123,6 +123,7 @@ static void cpu_attach(device_t, device_
static void cpu_defer(device_t);
static int cpu_rescan(device_t, const char *, const int *);
static void cpu_childdetached(device_t, device_t);
+static bool cpu_stop(device_t);
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);
@@ -1092,16 +1093,13 @@ cpu_offline_md(void)
/* XXX joerg restructure and restart CPUs individually */
static bool
-cpu_suspend(device_t dv, const pmf_qual_t *qual)
+cpu_stop(device_t dv)
{
struct cpu_softc *sc = device_private(dv);
struct cpu_info *ci = sc->sc_info;
int err;
- if ((ci->ci_flags & CPUF_PRESENT) == 0)
- return true;
-
- cpufreq_suspend(ci);
+ KASSERT((ci->ci_flags & CPUF_PRESENT) != 0);
if ((ci->ci_flags & CPUF_PRIMARY) != 0)
return true;
@@ -1124,6 +1122,21 @@ cpu_suspend(device_t dv, const pmf_qual_
}
static bool
+cpu_suspend(device_t dv, const pmf_qual_t *qual)
+{
+ struct cpu_softc *sc = device_private(dv);
+ struct cpu_info *ci = sc->sc_info;
+
+ if ((ci->ci_flags & CPUF_PRESENT) == 0)
+ return true;
+ else {
+ cpufreq_suspend(ci);
+ }
+
+ return cpu_stop(dv);
+}
+
+static bool
cpu_resume(device_t dv, const pmf_qual_t *qual)
{
struct cpu_softc *sc = device_private(dv);
@@ -1160,10 +1173,13 @@ cpu_shutdown(device_t dv, int how)
struct cpu_softc *sc = device_private(dv);
struct cpu_info *ci = sc->sc_info;
- if (ci->ci_flags & CPUF_BSP)
+ if ((ci->ci_flags & CPUF_BSP) != 0)
return false;
- return cpu_suspend(dv, NULL);
+ if ((ci->ci_flags & CPUF_PRESENT) == 0)
+ return true;
+
+ return cpu_stop(dv);
}
void