struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.
XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
- An argument of struct timeval *tv passed by todr_gettime(9) is used
for a return value and it doesn't contain valid data. Don't read it.
- Instead, use getmicrotime(9) to get a "reasonable" (i.e. current) time
to see expected year value (which is not kept by this device).
- If current time is not valid, assume this is the first todr_gettime(9)
call from inittodr(9) and use file system time for the "reasonable" year.
Fixes silent hangup after mountroot() on sun2.
XXX: MI todr(9) functions seem to get mangled around year ~22000.
-Wcast-qual differently, by instead changing the signatore of those
"functions" to take a "volatile struct timeval*" instead of a
"struct timeval*". Many places, these functions are called with
&time, and time is declared as volatile in <sys/kernel.h>. This
way we can get rid of all the ugly casts which now also triggered
warnings, and caused more code to be added to work around the
problem.
Reviewed by thorpej.