Ian Lepore
862993757a
Add RTC clock conversions for BCD values, with non-panic validation.
...
RTC clock hardware frequently uses BCD numbers. Currently the low-level
bcd2bin() and bin2bcd() functions will KASSERT if given out-of-range BCD
values. Every RTC driver must implement its own code for validating the
unreliable data coming from the hardware to avoid a potential kernel panic.
This change introduces two new functions, clock_bcd_to_ts() and
clock_ts_to_bcd(). The former validates its inputs and returns EINVAL if any
values are out of range. The latter guarantees the returned data will be
valid BCD in a known format (4-digit years, etc).
A new bcd_clocktime structure is used with the new functions. It is similar
to the original clocktime structure, but defines the fields holding BCD
values as uint8_t (uint16_t for year), and adds a PM flag for handling hours
using AM/PM mode.
PR: 224813
Differential Revision: https://reviews.freebsd.org/D13730 (no reviewers)
2018-01-14 17:01:37 +00:00
..
2017-02-28 23:42:47 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2018-01-12 22:57:57 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2018-01-03 09:33:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-12-13 16:13:17 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-12-19 09:59:20 +00:00
2017-12-13 16:13:17 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-12-13 16:13:17 +00:00
2018-01-12 23:34:16 +00:00
2017-11-27 15:01:59 +00:00
2018-01-12 23:41:12 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-12-13 16:13:17 +00:00
2017-12-05 20:19:13 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-12-28 14:26:33 +00:00
2018-01-14 17:01:37 +00:00
2017-12-13 16:13:17 +00:00
2018-01-08 21:27:41 +00:00
2017-11-27 15:01:59 +00:00
2018-01-08 21:27:41 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-12-31 16:48:04 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2018-01-05 21:06:19 +00:00
2018-01-12 22:48:23 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-12-13 16:13:17 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-12-13 16:13:17 +00:00
2017-11-30 20:33:45 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-12-13 16:13:17 +00:00
2017-11-20 19:43:44 +00:00
2018-01-12 22:57:57 +00:00
2017-12-11 19:21:39 +00:00
2017-11-27 15:01:59 +00:00
2017-10-01 19:52:47 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-12-02 00:07:09 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-12-06 02:05:21 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-30 15:10:11 +00:00
2017-11-27 15:01:59 +00:00
2017-12-19 17:59:00 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-12-13 16:13:17 +00:00
2017-11-27 15:01:59 +00:00
2018-01-08 21:27:41 +00:00
2017-11-27 15:01:59 +00:00
2017-12-13 16:13:17 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-12-13 16:13:17 +00:00
2017-12-13 16:13:17 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-28 12:53:55 +00:00
2017-11-27 15:01:59 +00:00
2017-12-31 09:23:02 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-25 04:49:12 +00:00
2017-12-31 22:43:24 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2018-01-12 23:25:05 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-12-13 16:30:39 +00:00
2017-12-13 16:30:39 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-12-31 09:23:35 +00:00
2017-12-13 16:13:17 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-12-20 20:25:28 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-12-13 16:13:17 +00:00
2017-12-13 16:13:17 +00:00
2017-11-27 15:01:59 +00:00
2018-01-14 00:08:34 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-18 14:26:50 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-18 14:26:50 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2018-01-12 22:48:23 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-12-13 16:13:17 +00:00
2017-11-21 14:59:23 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-18 14:26:50 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-12-21 09:17:48 +00:00
2017-12-20 20:25:28 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-12-07 19:40:46 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-12-13 16:13:17 +00:00
2017-12-13 16:13:17 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2018-01-12 23:06:35 +00:00
2018-01-12 23:06:35 +00:00
2018-01-12 22:48:23 +00:00
2017-11-24 13:50:53 +00:00
2017-11-20 19:43:44 +00:00
2018-01-05 22:26:23 +00:00
2017-11-20 19:43:44 +00:00
2018-01-12 23:06:35 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-12-13 16:13:17 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-30 20:33:45 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-12-13 16:13:17 +00:00
2017-11-27 15:01:59 +00:00
2017-12-31 21:00:21 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:01:59 +00:00
2017-11-27 15:01:59 +00:00
2017-11-28 23:40:54 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2018-01-03 00:56:30 +00:00
2017-12-13 16:13:17 +00:00