Like in rest of the acpi(4) stack, queue all resume hooks.

This commit is contained in:
jruoho 2011-03-19 12:57:30 +00:00
parent 523ab18712
commit 8e61d41493
5 changed files with 52 additions and 53 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_cpu.c,v 1.37 2011/03/05 09:47:19 jruoho Exp $ */
/* $NetBSD: acpi_cpu.c,v 1.38 2011/03/19 12:57:30 jruoho Exp $ */
/*-
* Copyright (c) 2010, 2011 Jukka Ruohonen <jruohonen@iki.fi>
@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.37 2011/03/05 09:47:19 jruoho Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.38 2011/03/19 12:57:30 jruoho Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@ -695,17 +695,18 @@ static bool
acpicpu_resume(device_t self, const pmf_qual_t *qual)
{
struct acpicpu_softc *sc = device_private(self);
static const int handler = OSL_NOTIFY_HANDLER;
sc->sc_cold = false;
if ((sc->sc_flags & ACPICPU_FLAG_C) != 0)
(void)acpicpu_cstate_resume(self);
(void)AcpiOsExecute(handler, acpicpu_cstate_resume, self);
if ((sc->sc_flags & ACPICPU_FLAG_P) != 0)
(void)acpicpu_pstate_resume(self);
(void)AcpiOsExecute(handler, acpicpu_pstate_resume, self);
if ((sc->sc_flags & ACPICPU_FLAG_T) != 0)
(void)acpicpu_tstate_resume(self);
(void)AcpiOsExecute(handler, acpicpu_tstate_resume, self);
return true;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_cpu.h,v 1.38 2011/03/17 15:59:36 jruoho Exp $ */
/* $NetBSD: acpi_cpu.h,v 1.39 2011/03/19 12:57:31 jruoho Exp $ */
/*-
* Copyright (c) 2010, 2011 Jukka Ruohonen <jruohonen@iki.fi>
@ -235,16 +235,16 @@ struct acpicpu_softc {
void acpicpu_cstate_attach(device_t);
int acpicpu_cstate_detach(device_t);
void acpicpu_cstate_start(device_t);
bool acpicpu_cstate_suspend(device_t);
bool acpicpu_cstate_resume(device_t);
void acpicpu_cstate_suspend(void *);
void acpicpu_cstate_resume(void *);
void acpicpu_cstate_callback(void *);
void acpicpu_cstate_idle(void);
void acpicpu_pstate_attach(device_t);
int acpicpu_pstate_detach(device_t);
void acpicpu_pstate_start(device_t);
bool acpicpu_pstate_suspend(device_t);
bool acpicpu_pstate_resume(device_t);
void acpicpu_pstate_suspend(void *);
void acpicpu_pstate_resume(void *);
void acpicpu_pstate_callback(void *);
int acpicpu_pstate_get(struct cpu_info *, uint32_t *);
void acpicpu_pstate_set(struct cpu_info *, uint32_t);
@ -252,8 +252,8 @@ void acpicpu_pstate_set(struct cpu_info *, uint32_t);
void acpicpu_tstate_attach(device_t);
int acpicpu_tstate_detach(device_t);
void acpicpu_tstate_start(device_t);
bool acpicpu_tstate_suspend(device_t);
bool acpicpu_tstate_resume(device_t);
void acpicpu_tstate_suspend(void *);
void acpicpu_tstate_resume(void *);
void acpicpu_tstate_callback(void *);
int acpicpu_tstate_get(struct cpu_info *, uint32_t *);
void acpicpu_tstate_set(struct cpu_info *, uint32_t);

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_cpu_cstate.c,v 1.51 2011/03/17 15:32:18 jruoho Exp $ */
/* $NetBSD: acpi_cpu_cstate.c,v 1.52 2011/03/19 12:57:31 jruoho Exp $ */
/*-
* Copyright (c) 2010, 2011 Jukka Ruohonen <jruohonen@iki.fi>
@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.51 2011/03/17 15:32:18 jruoho Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.52 2011/03/19 12:57:31 jruoho Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@ -134,22 +134,16 @@ acpicpu_cstate_start(device_t self)
(void)acpicpu_md_cstate_start(sc);
}
bool
acpicpu_cstate_suspend(device_t self)
void
acpicpu_cstate_suspend(void *aux)
{
return true;
/* Nothing. */
}
bool
acpicpu_cstate_resume(device_t self)
void
acpicpu_cstate_resume(void *aux)
{
static const ACPI_OSD_EXEC_CALLBACK func = acpicpu_cstate_callback;
struct acpicpu_softc *sc = device_private(self);
if ((sc->sc_flags & ACPICPU_FLAG_C_FADT) == 0)
(void)AcpiOsExecute(OSL_NOTIFY_HANDLER, func, sc->sc_dev);
return true;
acpicpu_cstate_callback(aux);
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_cpu_pstate.c,v 1.46 2011/03/17 15:59:36 jruoho Exp $ */
/* $NetBSD: acpi_cpu_pstate.c,v 1.47 2011/03/19 12:57:31 jruoho Exp $ */
/*-
* Copyright (c) 2010, 2011 Jukka Ruohonen <jruohonen@iki.fi>
@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.46 2011/03/17 15:59:36 jruoho Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_pstate.c,v 1.47 2011/03/19 12:57:31 jruoho Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@ -210,15 +210,19 @@ fail:
aprint_error_dev(self, "failed to start P-states (err %d)\n", rv);
}
bool
acpicpu_pstate_suspend(device_t self)
void
acpicpu_pstate_suspend(void *aux)
{
struct acpicpu_softc *sc = device_private(self);
struct acpicpu_pstate *ps = NULL;
struct cpu_info *ci = sc->sc_ci;
struct acpicpu_softc *sc;
struct cpu_info *ci;
device_t self = aux;
uint64_t xc;
int32_t i;
sc = device_private(self);
ci = sc->sc_ci;
/*
* Reset any dynamic limits.
*/
@ -246,28 +250,28 @@ acpicpu_pstate_suspend(device_t self)
mutex_exit(&sc->sc_mtx);
if (__predict_false(ps == NULL))
return true;
return;
if (sc->sc_pstate_saved == ps->ps_freq)
return true;
return;
xc = xc_unicast(0, acpicpu_pstate_set_xcall, &ps->ps_freq, NULL, ci);
xc_wait(xc);
return true;
}
bool
acpicpu_pstate_resume(device_t self)
void
acpicpu_pstate_resume(void *aux)
{
struct acpicpu_softc *sc = device_private(self);
uint32_t freq = sc->sc_pstate_saved;
struct acpicpu_softc *sc;
device_t self = aux;
uint32_t freq;
uint64_t xc;
sc = device_private(self);
freq = sc->sc_pstate_saved;
xc = xc_unicast(0, acpicpu_pstate_set_xcall, &freq, NULL, sc->sc_ci);
xc_wait(xc);
return true;
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_cpu_tstate.c,v 1.26 2011/03/01 05:57:04 jruoho Exp $ */
/* $NetBSD: acpi_cpu_tstate.c,v 1.27 2011/03/19 12:57:31 jruoho Exp $ */
/*-
* Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi>
@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_tstate.c,v 1.26 2011/03/01 05:57:04 jruoho Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_tstate.c,v 1.27 2011/03/19 12:57:31 jruoho Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@ -145,23 +145,23 @@ acpicpu_tstate_start(device_t self)
/* Nothing. */
}
bool
acpicpu_tstate_suspend(device_t self)
void
acpicpu_tstate_suspend(void *aux)
{
struct acpicpu_softc *sc = device_private(self);
struct acpicpu_softc *sc;
device_t self = aux;
sc = device_private(self);
mutex_enter(&sc->sc_mtx);
acpicpu_tstate_reset(sc);
mutex_exit(&sc->sc_mtx);
return true;
}
bool
acpicpu_tstate_resume(device_t self)
void
acpicpu_tstate_resume(void *aux)
{
return true;
/* Nothing. */
}
void