Re: [PATCH] Persistent RTC, against 2.2.16

From: Chris McClellen (chris@transtech.cc)
Date: Fri Aug 11 2000 - 10:43:56 EST


Due to a gaffe in testing I thought this patch worked; it does not.
Please reject.

The alarm -> power on functionality seems to be part of the APM bios.

Does anyone here know how one sets the alarm so that it is persisent?
Setting the RTC alarm does not seem to affect this part of the bios.
Also, the 1.2 APM spec doesnt say anything about setting RTC alarms.

Or am I just missing something ? Should my patch work in theory?
Or is the "alarm" setting you see in APM sections of bios set up screens
derived from RTC alarm? I think they may be vendor extensions?

Any help would be appreciated.

----- Original Message -----
From: Chris McClellen <chris@transtech.cc>
To: Linux Kernel mailing list <linux-kernel@vger.rutgers.edu>; <torvalds@transmeta.com>; <alan@lxorguk.ukuu.org.uk>
Sent: Wednesday, August 09, 2000 11:30 AM
Subject: [PATCH] Persistent RTC, against 2.2.16

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:24 EST