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, ✉ g...@unixarea.de, ⌂ http://www.unixarea.de/  📱 
+49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub

Attachment: signature.asc
Description: PGP signature

Reply via email to