Port-sparc64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Sun Fire V240 RTC
On 2026-11-20, Julian Coleman <jdc%coris.org.uk@localhost> wrote:
> > The year written in the driver (at least mc146818, where I printed details)
> > seems ok. But after reboot it always gains 30 years.
>
> Oh! 30 years is important here, and I completely missed that earlier.
> We set the rtc offset start year for the DS1307:
>
> https://nxr.netbsd.org/xref/src/sys/arch/sparc64/sparc64/ofw_patch.c#709
>
> and use it in the time calculation:
>
> https://nxr.netbsd.org/xref/src/sys/dev/i2c/ds1307.c#329
> https://nxr.netbsd.org/xref/src/sys/dev/i2c/ds1307.c#560 (get)
> https://nxr.netbsd.org/xref/src/sys/dev/i2c/ds1307.c#588 (set)
Ok. Got it! I'm sure this works pretty well in current, but not in 11.
> However, I realise that I only tested with the offset on the V245 and not
> on the V240. So, either it's not being applied correctly or we shouldn't
> have that on the V240. Can you try removing that block from ofw_patch.c?
> If that fixes it, then we can set the start-year property only for
> V215/V245/V445. If not, then sc->sc_base_year is not being set correctly
> in ds1307.c.
The problem was not to remove the 2000-base, but that the "start-year"
property set by ofw_patch.c was not recognised by the dsrtc driver
in NetBSD-11! The 2000-base is indeed very much needed.
dsrtc_attach() in 11 only does:
#ifdef DSRTC_YEAR_START_2K
sc->sc_model.dm_flags |= DSRTC_FLAG_YEAR_START_2K;
#endif
prop_dictionary_get_bool(dict, "base_year_is_2000", &base_2k);
if (base_2k) sc->sc_model.dm_flags |= DSRTC_FLAG_YEAR_START_2K;
But neither DSRTC_YEAR_START_2K nor "base_year_is_2000" was set
by sparc64 in 11.
When I fix that, then all problems are gone. And it works like in
current. So everything you assumed was correct: the DS1307 time is
likely copied by ALOM to the m5819p, and the 2000-base is needed
for both, V245 and V240.
Sorry for having reported another already fixed issue in 11, as with my
envstat problem, but I did't want to run current on a production
server. :)
--
Frank Wille
Home |
Main Index |
Thread Index |
Old Index