[PATCH] Persistent RTC, against 2.2.16

From: Chris McClellen (chris@transtech.cc)
Date: Wed Aug 09 2000 - 10:30:17 EST


The problem:

We have machines in the field that we would like to power cycle;
that is, turn off, and have them turn themselves back on w/o a human
in general. This of course won't always work, but it will in general.

This is possible -- we can halt w/poweroff. But, before we do, we can
set the rtc alarm via /dev/rtc. We can also set up the interrupt on
alarm via /dev/rtc. The mobos have wake-on-alarm, and they will
power themselves back on when the alarm interrupt goes off.

So, we can set the alarm, poweroff, and it will powerback on....

Except that /dev/rtc will clear the alarm interrupt enable when the
device is closed (rtc_release). In fact, it clears all rtc interrupt
enables. So, when the process that sets AIE exits, AIE gets cleared,
thwarting our efforts.

Solution:

Added a RTC_PERSIST status that can be read/set via ioctls.

By default it is _NOT_ set, giving original /dev/rtc behavior.

When Set the following occurs:
- AIE is not cleared when rtc_release is called. The other interrupt
  enables get cleared as normal. I thought this would be desired, but
  it would be trivial to not clear the other IEs if persist is set.
- RTC_PERSIST remains between opens/closes.
  + If we cleared persist on close, then during halt someone could
    open/close /dev/rtc and undo our AIE. Thus, once set, RTC_PERSIST
    remains between open/close until unset via ioctl.

We would like to see this make it into the official kernel
so we dont have to maintain special patched kernels in the field.
Of course we can, but it would be nice to be able to just use stock
kernels in the future.

See the attached patch.



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:18 EST