power: Add stype parameter in power_suspend/resume eventhandlers
Add enum sleep_type stype parameter in power_suspend/resume event handlers, as with the introduction of s2idle there are more than one type of suspend. Reviewed by: bz Approved by: bz Sponsored by: The FreeBSD Foundation
This commit is contained in:
@@ -74,7 +74,7 @@ extern int acpi_susp_bounce;
|
||||
extern struct susppcb **susppcbs;
|
||||
static cpuset_t suspcpus;
|
||||
|
||||
static void acpi_stop_beep(void *);
|
||||
static void acpi_stop_beep(void *, enum power_stype);
|
||||
|
||||
static int acpi_wakeup_ap(struct acpi_softc *, int);
|
||||
static void acpi_wakeup_cpus(struct acpi_softc *);
|
||||
@@ -88,7 +88,7 @@ static void acpi_wakeup_cpus(struct acpi_softc *);
|
||||
} while (0)
|
||||
|
||||
static void
|
||||
acpi_stop_beep(void *arg)
|
||||
acpi_stop_beep(void *arg, enum power_stype stype)
|
||||
{
|
||||
|
||||
if (acpi_resume_beep != 0)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/cons.h>
|
||||
#include <sys/power.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/sbuf.h>
|
||||
@@ -878,8 +879,8 @@ static int adaerror(union ccb *ccb, uint32_t cam_flags,
|
||||
uint32_t sense_flags);
|
||||
static callout_func_t adasendorderedtag;
|
||||
static void adashutdown(void *arg, int howto);
|
||||
static void adasuspend(void *arg);
|
||||
static void adaresume(void *arg);
|
||||
static void adasuspend(void *arg, enum power_stype stype);
|
||||
static void adaresume(void *arg, enum power_stype stype);
|
||||
|
||||
#ifndef ADA_DEFAULT_TIMEOUT
|
||||
#define ADA_DEFAULT_TIMEOUT 30 /* Timeout in seconds */
|
||||
@@ -3747,7 +3748,7 @@ adashutdown(void *arg, int howto)
|
||||
}
|
||||
|
||||
static void
|
||||
adasuspend(void *arg)
|
||||
adasuspend(void *arg, enum power_stype stype)
|
||||
{
|
||||
|
||||
adaflush();
|
||||
@@ -3760,7 +3761,7 @@ adasuspend(void *arg)
|
||||
}
|
||||
|
||||
static void
|
||||
adaresume(void *arg)
|
||||
adaresume(void *arg, enum power_stype stype)
|
||||
{
|
||||
struct cam_periph *periph;
|
||||
struct ada_softc *softc;
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <sys/eventhandler.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/cons.h>
|
||||
#include <sys/power.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/sbuf.h>
|
||||
@@ -159,7 +160,7 @@ static void ndadone(struct cam_periph *periph,
|
||||
static int ndaerror(union ccb *ccb, uint32_t cam_flags,
|
||||
uint32_t sense_flags);
|
||||
static void ndashutdown(void *arg, int howto);
|
||||
static void ndasuspend(void *arg);
|
||||
static void ndasuspend(void *arg, enum power_stype stype);
|
||||
|
||||
#ifndef NDA_DEFAULT_SEND_ORDERED
|
||||
#define NDA_DEFAULT_SEND_ORDERED 1
|
||||
@@ -1365,7 +1366,7 @@ ndashutdown(void *arg, int howto)
|
||||
}
|
||||
|
||||
static void
|
||||
ndasuspend(void *arg)
|
||||
ndasuspend(void *arg, enum power_stype stype)
|
||||
{
|
||||
|
||||
ndaflush();
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <sys/bus.h>
|
||||
#include <sys/eventhandler.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/power.h>
|
||||
|
||||
#include <contrib/dev/acpica/include/acpi.h>
|
||||
#include <dev/acpica/acpivar.h>
|
||||
@@ -118,7 +119,8 @@ acpi_evaluate_dsm(ACPI_HANDLE ObjHandle, const guid_t *guid,
|
||||
}
|
||||
|
||||
static void
|
||||
linux_handle_power_suspend_event(void *arg __unused)
|
||||
linux_handle_power_suspend_event(void *arg __unused,
|
||||
enum power_stype stype __unused)
|
||||
{
|
||||
/*
|
||||
* Only support S3 for now.
|
||||
@@ -131,7 +133,8 @@ linux_handle_power_suspend_event(void *arg __unused)
|
||||
}
|
||||
|
||||
static void
|
||||
linux_handle_power_resume_event(void *arg __unused)
|
||||
linux_handle_power_resume_event(void *arg __unused,
|
||||
enum power_stype stype __unused)
|
||||
{
|
||||
linux_acpi_target_sleep_state = ACPI_STATE_S0;
|
||||
pm_suspend_target_state = PM_SUSPEND_ON;
|
||||
|
||||
@@ -3468,10 +3468,10 @@ acpi_EnterSleepState(struct acpi_softc *sc, enum power_stype stype)
|
||||
return_ACPI_STATUS (AE_OK);
|
||||
}
|
||||
|
||||
EVENTHANDLER_INVOKE(power_suspend_early);
|
||||
EVENTHANDLER_INVOKE(power_suspend_early, stype);
|
||||
stop_all_proc();
|
||||
suspend_all_fs();
|
||||
EVENTHANDLER_INVOKE(power_suspend);
|
||||
EVENTHANDLER_INVOKE(power_suspend, stype);
|
||||
|
||||
#ifdef EARLY_AP_STARTUP
|
||||
MPASS(mp_ncpus == 1 || smp_started);
|
||||
@@ -3632,7 +3632,7 @@ acpi_EnterSleepState(struct acpi_softc *sc, enum power_stype stype)
|
||||
resume_all_fs();
|
||||
resume_all_proc();
|
||||
|
||||
EVENTHANDLER_INVOKE(power_resume);
|
||||
EVENTHANDLER_INVOKE(power_resume, stype);
|
||||
|
||||
/* Allow another sleep request after a while. */
|
||||
callout_schedule(&acpi_sleep_timer, hz * ACPI_MINIMUM_AWAKETIME);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <sys/module.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/timetc.h>
|
||||
#include <sys/power.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
@@ -69,8 +70,10 @@ bool acpi_timer_disabled = false;
|
||||
static void acpi_timer_identify(driver_t *driver, device_t parent);
|
||||
static int acpi_timer_probe(device_t dev);
|
||||
static int acpi_timer_attach(device_t dev);
|
||||
static void acpi_timer_resume_handler(struct timecounter *);
|
||||
static void acpi_timer_suspend_handler(struct timecounter *);
|
||||
static void acpi_timer_resume_handler(struct timecounter *,
|
||||
enum power_stype);
|
||||
static void acpi_timer_suspend_handler(struct timecounter *,
|
||||
enum power_stype);
|
||||
static u_int acpi_timer_get_timecount(struct timecounter *tc);
|
||||
static u_int acpi_timer_get_timecount_safe(struct timecounter *tc);
|
||||
static int acpi_timer_sysctl_freq(SYSCTL_HANDLER_ARGS);
|
||||
@@ -235,7 +238,7 @@ acpi_timer_attach(device_t dev)
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_timer_resume_handler(struct timecounter *newtc)
|
||||
acpi_timer_resume_handler(struct timecounter *newtc, enum power_stype stype)
|
||||
{
|
||||
struct timecounter *tc;
|
||||
|
||||
@@ -251,7 +254,7 @@ acpi_timer_resume_handler(struct timecounter *newtc)
|
||||
}
|
||||
|
||||
static void
|
||||
acpi_timer_suspend_handler(struct timecounter *newtc)
|
||||
acpi_timer_suspend_handler(struct timecounter *newtc, enum power_stype stype)
|
||||
{
|
||||
struct timecounter *tc;
|
||||
|
||||
|
||||
@@ -195,8 +195,8 @@ static void vt_update_static(void *);
|
||||
#ifndef SC_NO_CUTPASTE
|
||||
static void vt_mouse_paste(void);
|
||||
#endif
|
||||
static void vt_suspend_handler(void *priv);
|
||||
static void vt_resume_handler(void *priv);
|
||||
static void vt_suspend_handler(void *priv, enum power_stype stype);
|
||||
static void vt_resume_handler(void *priv, enum power_stype stype);
|
||||
|
||||
SET_DECLARE(vt_drv_set, struct vt_driver);
|
||||
|
||||
@@ -3330,7 +3330,7 @@ vt_replace_backend(const struct vt_driver *drv, void *softc)
|
||||
}
|
||||
|
||||
static void
|
||||
vt_suspend_handler(void *priv)
|
||||
vt_suspend_handler(void *priv, enum power_stype stype)
|
||||
{
|
||||
struct vt_device *vd;
|
||||
|
||||
@@ -3341,7 +3341,7 @@ vt_suspend_handler(void *priv)
|
||||
}
|
||||
|
||||
static void
|
||||
vt_resume_handler(void *priv)
|
||||
vt_resume_handler(void *priv, enum power_stype stype)
|
||||
{
|
||||
struct vt_device *vd;
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
#include <sys/smp.h>
|
||||
#include <sys/eventhandler.h>
|
||||
#include <sys/timetc.h>
|
||||
#include <sys/power.h>
|
||||
|
||||
#include <geom/geom.h>
|
||||
|
||||
@@ -175,12 +176,12 @@ xctrl_suspend(void)
|
||||
cpuset_t cpu_suspend_map;
|
||||
#endif
|
||||
|
||||
EVENTHANDLER_INVOKE(power_suspend_early);
|
||||
EVENTHANDLER_INVOKE(power_suspend_early, POWER_STYPE_SUSPEND_TO_MEM);
|
||||
xs_lock();
|
||||
stop_all_proc();
|
||||
xs_unlock();
|
||||
suspend_all_fs();
|
||||
EVENTHANDLER_INVOKE(power_suspend);
|
||||
EVENTHANDLER_INVOKE(power_suspend, POWER_STYPE_SUSPEND_TO_MEM);
|
||||
|
||||
#ifdef EARLY_AP_STARTUP
|
||||
MPASS(mp_ncpus == 1 || smp_started);
|
||||
@@ -297,7 +298,7 @@ xctrl_suspend(void)
|
||||
resume_all_fs();
|
||||
resume_all_proc();
|
||||
|
||||
EVENTHANDLER_INVOKE(power_resume);
|
||||
EVENTHANDLER_INVOKE(power_resume, POWER_STYPE_SUSPEND_TO_MEM);
|
||||
|
||||
if (bootverbose)
|
||||
printf("System resumed after suspension\n");
|
||||
|
||||
@@ -84,7 +84,7 @@ static cpuset_t suspcpus;
|
||||
static struct susppcb **susppcbs;
|
||||
#endif
|
||||
|
||||
static void acpi_stop_beep(void *);
|
||||
static void acpi_stop_beep(void *, enum power_stype);
|
||||
|
||||
#ifdef SMP
|
||||
static int acpi_wakeup_ap(struct acpi_softc *, int);
|
||||
@@ -100,7 +100,7 @@ static void acpi_wakeup_cpus(struct acpi_softc *);
|
||||
} while (0)
|
||||
|
||||
static void
|
||||
acpi_stop_beep(void *arg)
|
||||
acpi_stop_beep(void *arg, enum power_stype stype)
|
||||
{
|
||||
|
||||
if (acpi_resume_beep != 0)
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <sys/lock.h>
|
||||
#include <sys/ktr.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/power.h>
|
||||
#include <sys/queue.h>
|
||||
|
||||
#ifdef VIMAGE
|
||||
@@ -201,7 +202,7 @@ EVENTHANDLER_DECLARE(shutdown_post_sync, shutdown_fn); /* after fs sync */
|
||||
EVENTHANDLER_DECLARE(shutdown_final, shutdown_fn);
|
||||
|
||||
/* Power state change events */
|
||||
typedef void (*power_change_fn)(void *);
|
||||
typedef void (*power_change_fn)(void *, enum power_stype stype);
|
||||
EVENTHANDLER_DECLARE(power_resume, power_change_fn);
|
||||
EVENTHANDLER_DECLARE(power_suspend, power_change_fn);
|
||||
EVENTHANDLER_DECLARE(power_suspend_early, power_change_fn);
|
||||
|
||||
Reference in New Issue
Block a user