Commit Graph

4 Commits

Author SHA1 Message Date
Marius Strobl
fce21e7e25 After some input from bde@ and rereading the datasheet use a MTX_SPIN
mutex instead of a MTX_DEF one in order to defer preemption while
reading the date and time registers. If we don't manage to read them
within the time slot where we are guaranteed that no updates occur we
might actually read them during an update in which case the output is
undefined.
2005-06-04 23:24:50 +00:00
Marius Strobl
003daaea5f o mc146818(4):
- Add locking.
  - Account for if the MC146818_NO_CENT_ADJUST flag is set we don't need
    to check wheter year < POSIX_BASE_YEAR.
  - Add some comments about mapping the day of week from the range the
    generic clock code uses to the range the chip uses and which I meant
    to add in the initial version.
  - Minor clean-up, use __func__ instead of hardcoded function names in
    error strings.

o in the rtc(4) front-end additionally:
  - Don't leak resources in case mc146818_attach() fails.
  - Account for ebus(4) defaulting to SYS_RES_MEMORY for the memory
    resources since ebus.c rev. 1.22.
2005-05-19 21:20:42 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Marius Strobl
f46d4a6741 Add a driver back end for MC146818 and compatible clocks based on the
respective NetBSD driver for use with the genclock interface.
It's first use will be on sparc64 but it was also tested on alpha with
a preliminary patch to switch alpha to use the genclock code together
with this driver instead of the respective code in alpha/alpha/clock.c
and the rather MD mcclock(4). Using it on i386 and amd64 won't be that
hard but some changes/extensions to improve the genclock code in general
should be done first, e.g. add locking and make it easier to access the
NVRAM usually coupled with RTCs.
2004-11-17 16:37:25 +00:00