From owner-freebsd-current@freebsd.org Tue Jan 2 13:00:36 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 73863EA48C0 for ; Tue, 2 Jan 2018 13:00:36 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms-10.1blu.de (ms-10.1blu.de [178.254.4.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 311567E2ED; Tue, 2 Jan 2018 13:00:35 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from [89.204.130.252] (helo=localhost.unixarea.de) by ms-10.1blu.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1eWMB8-0004qk-10; Tue, 02 Jan 2018 14:00:26 +0100 Received: from localhost.my.domain (localhost [127.0.0.1]) by localhost.unixarea.de (8.15.2/8.14.9) with ESMTPS id w02D0MJq002324 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 2 Jan 2018 14:00:22 +0100 (CET) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.15.2/8.14.9/Submit) id w02D0K8E002323; Tue, 2 Jan 2018 14:00:20 +0100 (CET) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Tue, 2 Jan 2018 14:00:20 +0100 From: Matthias Apitz To: Ian Lepore Cc: freebsd-current@freebsd.org, cem@freebsd.org Subject: Re: panic: invalid bcd 194 Message-ID: <20180102130020.GA2236@c720-r314251> Reply-To: Matthias Apitz Mail-Followup-To: Matthias Apitz , Ian Lepore , freebsd-current@freebsd.org, cem@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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline In-Reply-To: <1514851362.1759.8.camel@freebsd.org> X-Operating-System: FreeBSD 12.0-CURRENT r314251 (amd64) X-message-flag: Mails containing HTML will not be read! Please send only plain text. User-Agent: Mutt/1.8.0 (2017-02-23) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 89.204.130.252 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jan 2018 13:00:36 -0000 --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable El d=C3=ADa lunes, enero 01, 2018 a las 05:02:42p. m. -0700, Ian Lepore esc= ribi=C3=B3: > Okay, I've created a pair of patches for this. =C2=A0The first adds some > common support routines usable by all RTC drivers with BCD hardware. > =C2=A0The second one converts the atrtc driver to use those routines. =C2= =A0The > 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). >=20 > The patches are available in a pair of phabricator reviews, plus I'll > attach them to this mail. =C2=A0If 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. >=20 > 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=20 # 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 a= md64 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 --=20 Matthias Apitz, =E2=9C=89 guru@unixarea.de, =E2=8C=82 http://www.unixarea.d= e/ =F0=9F=93=B1 +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub --a8Wt8u1KmwUX3Y2C Content-Type: application/pgp-signature; name="signature.asc" -----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----- --a8Wt8u1KmwUX3Y2C--