From 1b95bbbfe97796bc3ce61a9152082c1b32521485 Mon Sep 17 00:00:00 2001 From: Thomas Cort Date: Fri, 2 Aug 2013 10:10:59 -0400 Subject: [PATCH] pm: notify readclock of reboot(RBT_POWEROFF) Some ARM chips handle power-off with RTC alarms. PM notifies readclock (the driver for RTCs) about the impending power-off. If the power-off mechanism is an RTC alarm, readclock will set the alarm. If not, there is no effect. Change-Id: Iee00066def2a0f742cdf0dbde8e32b376edf1b78 --- servers/pm/misc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/servers/pm/misc.c b/servers/pm/misc.c index 0576a5513..d37e4d768 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -298,6 +298,15 @@ int do_reboot() abort_flag = (unsigned) m_in.reboot_flag; if (abort_flag >= RBT_INVALID) return(EINVAL); + /* notify readclock (some arm systems power off via RTC alarms) */ + if (abort_flag == RBT_POWEROFF) { + endpoint_t readclock_ep; + if (ds_retrieve_label_endpt("readclock.drv", &readclock_ep) == OK) { + message m; /* no params to set, nothing we can do if it fails */ + _taskcall(readclock_ep, RTCDEV_PWR_OFF, &m); + } + } + /* Order matters here. When VFS is told to reboot, it exits all its * processes, and then would be confused if they're exited again by * SIGKILL. So first kill, then reboot. -- 2.44.0