On Sunday 01 April 2012, Pedro de Oliveira wrote: > By reading the DS1687 datasheet I managed to fix it. A diff follows: > > # cvs diff -u sys/dev/ic/ds1687reg.h sys/arch/sgi/dev/dsrtc.c > Index: sys/dev/ic/ds1687reg.h > =================================================================== > RCS file: /cvs/src/sys/dev/ic/ds1687reg.h,v > retrieving revision 1.2 > diff -u -r1.2 ds1687reg.h > --- sys/dev/ic/ds1687reg.h 31 Mar 2008 07:14:00 -0000 1.2 > +++ sys/dev/ic/ds1687reg.h 1 Apr 2012 00:59:52 -0000 > @@ -62,3 +62,5 @@ > #define DS1687_EXT_CTRL 0x4a /* Extended control > register. */ #define DS1687_KICKSTART 0x01 /* Kickstart flag. */ > > +#define DS1687_EXT_CTRL_B 0x4b /* Extended control register B. */ > +#define DS1687_ALRM_ENABLE 0x02 /* Bit 1 - WIE */ > Index: sys/arch/sgi/dev/dsrtc.c > =================================================================== > RCS file: /cvs/src/sys/arch/sgi/dev/dsrtc.c,v > retrieving revision 1.11 > diff -u -r1.11 dsrtc.c > --- sys/arch/sgi/dev/dsrtc.c 7 Nov 2009 14:49:01 -0000 1.11 > +++ sys/arch/sgi/dev/dsrtc.c 1 Apr 2012 00:59:52 -0000 > @@ -315,7 +315,7 @@ > ds1687_set(void *v, struct tod_time *ct) > { > struct dsrtc_softc *sc = v; > - int year, century, ctrl, dm; > + int year, century, ctrl, dm, alarm; > > century = ct->year / 100 + 19; > year = ct->year % 100; > @@ -342,6 +342,16 @@ > (*sc->write)(sc, DS1687_MONTH, tobcd(ct->mon, dm)); > (*sc->write)(sc, DS1687_YEAR, tobcd(year, dm)); > (*sc->write)(sc, DS1687_CENTURY, tobcd(century, dm)); > + > + /* Reset the RTC alarm. */ > + (*sc->write)(sc, DS1687_SEC_ALRM, 0); > + (*sc->write)(sc, DS1687_MIN_ALRM, 0); > + (*sc->write)(sc, DS1687_HOUR_ALRM, 0); > + (*sc->write)(sc, DS1687_DATE_ALRM, 0); > + > + /* Disable the alarm wakeup. */ > + alarm = (*sc->read)(sc, DS1687_EXT_CTRL_B); > + (*sc->write)(sc, DS1687_EXT_CTRL_B, alarm & ~DS1687_ALARM_ENABLE);
Nice - I figured this was the underlying cause. It should be sufficient just to disable the alarm without touching the alarm time registers. However, I am curious as to how the alarm got enabled in the first place (Irix?) and if so, should OpenBSD be touching/undoing it? > /* Enable updates. */ > (*sc->write)(sc, DS1687_CTRL_B, ctrl); > # > > On Sun, Mar 25, 2012 at 9:00 PM, Miod Vallat <m...@online.fr> wrote: > >> But a few days ago I installed OpenBSD/sgi 5.0 (also tried the snapshot, > >> but it crashed) and every day since I installed it, every day at > >> midnight the machine automaticly powers on. > >> > >> Does this happen to anyone else? How can I disable this? > > > > This has happened to me a few years ago on a low-end R5000SC@180 O2, but > > eventually stopped after leaving the machine unplugged for a while > > (read: months). There is probably something slightly wrong in the way > > the Dallas clock registers are updated by OpenBSD, but I have not been > > able to find it so far. > > > > Miod -- "Reason is not automatic. Those who deny it cannot be conquered by it. Do not count on them. Leave them alone." -- Ayn Rand