Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jan 2018 14:00:20 +0100
From:      Matthias Apitz <guru@unixarea.de>
To:        Ian Lepore <ian@freebsd.org>
Cc:        freebsd-current@freebsd.org, cem@freebsd.org
Subject:   Re: panic: invalid bcd 194
Message-ID:  <20180102130020.GA2236@c720-r314251>
In-Reply-To: <1514851362.1759.8.camel@freebsd.org>
References:  <20171230210711.GA75976@c720-r314251> <20171230211154.GT1684@kib.kiev.ua> <20171230214819.GA2191@c720-r314251> <20171231083624.GA2175@c720-r314251> <1514740790.12000.20.camel@freebsd.org> <20180101085425.GA2301@c720-r314251> <1514851362.1759.8.camel@freebsd.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
El día lunes, enero 01, 2018 a las 05:02:42p. m. -0700, Ian Lepore escribió:

> Okay, I've created a pair of patches for this.  The first adds some
> common support routines usable by all RTC drivers with BCD hardware.
>  The second one converts the atrtc driver to use those routines.  The
> common code was tested using an i2c RTC chip, but I don't have an x86
> testbed, so the atrtc patch is currently untested (it compiles).
> 
> The patches are available in a pair of phabricator reviews, plus I'll
> attach them to this mail.  If the list scrubs the attachements, you can
> download the patches from the phab urls below, just hit the Actions
> button and look for Download Raw Diff.
> 
> https://reviews.freebsd.org/D13730
> https://reviews.freebsd.org/D13731

Ian, I've applied your patches by hand to the kernel source r314251 and
added in addition two printf's to atrtc.c to see the entry in
atrtc_gettime() and atrtc_set(). I've compiled the kernel with

# make buildworld -DNO_CLEAN

and copied over the new kernel with 

# cp /usr/obj/usr/src/sys/GENERIC/kernel /boot/kernel/kernel

The kernel boots fine as:

FreeBSD c720-r314251 12.0-CURRENT FreeBSD 12.0-CURRENT #2 r314251M: Tue Jan  2 12:53:31 CET 2018     guru@c720-r314251:/usr/obj/usr/src/sys/GENERIC  amd64

but: while the current date is read with the correct time, the year is 1970:

# date
Tue Jan  2 1970, 13:45:24 CET

One can set the date/time with the date(1) command or ntpdate.

The debug messages are (the first line is from boot, the others from the
date or ntpdate):

# grep DEBUG /var/log/messages
Jan  2 13:43:02 c720-r314251 kernel: BCD DEBUG: atrtc_gettime() entry
Jan  2 13:43:02 c720-r314251 kernel: BCD DEBUG: atrtc_gettime() entry
Jan  2 13:44:00 c720-r314251 kernel: BCD DEBUG: atrtc_set() entry

-- 
Matthias Apitz, ✉ guru@unixarea.de, ⌂ http://www.unixarea.de/  📱 +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEXmn7rBYYViyzy/vBR8z35Hb+nREFAlpLgl0ACgkQR8z35Hb+
nRHsyQ//cxV91HKEXAOYKLqEAiuf51a0p831jjMF2OCMC7IZ6QfKXbfgtUEQiNAp
DUQzaptRr34Eo0fPftoR98goMQu5Ja3acCORkZrekub+IDD8O6wf3lxSbRHyNlFV
P8AxQrFN2Ju4d0qN/3Jt47ie66EntjcDUfIQXH0GaqWhG0f1kQzMSIcOGX/neRjZ
G4h7a1xjqqdmFuQRokCUhsiMAD4F1TWtcPfqUzgAe7U59h8zWhFiSq0Eqgmsfdlw
HL+bK51/8KJBLU3oaFt0+YhtBTGywj9Lf2ygfNFNEXxojk0B7Y7IvF/K5lHam5xF
tDFJcT+cJQPu27ePMkyhxmXkztEEjF9L6TUrNjWvWDgA6Lui88Jjh5FlGactZ8F0
l9CHKb1pLEhVRjg+HvHg/Cmv88sLH5z5bOJ6HSy6oWaVW11ACmyh9Cj/fpMdjOgc
OenXtSIMZaNmz0oWQqG8NeJhOcLoHQ8fQA4so6CPfA90eAW/tsAenqjCtq+8oXqb
NvxUxSZCCtJCBAmb4wanESreygICaKTexd+PdjRjRFvrSgx4LqDQnGfJossBuz32
hf05K1QIl8L9qlFFViJzW9QG07z/UKo7ipLpxvsNAKqvoQgaBopzOcbJiKJM8M9L
tm4nB/vrHJoAiN5Jv6Dg9gUC4/PaeencoKKvuySRiUSdpsRCw3g=
=20DS
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180102130020.GA2236>