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
This commit is contained in:
Thomas Cort 2013-08-02 10:10:59 -04:00
parent 6d7eff8023
commit 1b95bbbfe9

View file

@ -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.