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-01-15 17:54:01 +00:00
2017-10-12 15:45:53 +00:00
2017-12-31 09:23:19 +00:00
2017-04-13 15:43:44 +00:00
2017-11-27 15:20:12 +00:00
2017-03-21 18:02:14 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2018-01-08 21:27:41 +00:00
2017-11-30 20:33:45 +00:00
2017-11-27 15:20:12 +00:00
2017-11-30 20:33:45 +00:00
2018-01-12 22:48:23 +00:00
2018-01-12 22:48:23 +00:00
2017-11-18 14:26:50 +00:00
2017-11-27 15:20:12 +00:00
2018-01-03 00:56:30 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2018-01-12 22:48:23 +00:00
2017-11-27 15:20:12 +00:00
2017-12-19 18:20:38 +00:00
2017-11-27 15:20:12 +00:00
2018-01-03 00:56:30 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2018-01-12 22:48:23 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2018-01-14 15:01:25 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-12-31 09:24:11 +00:00
2017-11-27 15:20:12 +00:00
2017-11-25 04:49:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2018-01-12 23:25:05 +00:00
2018-01-12 23:25:05 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2018-01-12 13:40:50 +00:00
2017-01-25 20:22:32 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2018-01-04 21:59:34 +00:00
2017-11-23 11:25:11 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2018-01-04 22:07:58 +00:00
2017-11-21 14:59:23 +00:00
2018-01-13 00:05:31 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2018-01-05 20:21:46 +00:00
2017-11-27 15:20:12 +00:00
2018-01-08 21:27:41 +00:00
2018-01-08 21:27:41 +00:00
2017-11-27 15:20:12 +00:00
2018-01-13 09:26:24 +00:00
2017-12-25 04:48:39 +00:00
2017-11-27 15:20:12 +00:00
2017-11-20 19:43:44 +00:00
2017-12-19 10:05:45 +00:00
2018-01-12 22:48:23 +00:00
2018-01-12 22:48:23 +00:00
2017-11-20 19:43:44 +00:00
2017-11-25 23:41:05 +00:00
2017-12-31 09:21:01 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-20 19:43:44 +00:00
2017-11-18 14:26:50 +00:00
2017-11-27 15:20:12 +00:00
2017-12-25 04:48:39 +00:00
2016-04-29 22:15:33 +00:00
2016-07-28 21:29:04 +00:00
2018-01-12 22:48:23 +00:00
2017-12-13 16:30:39 +00:00
2016-05-26 19:29:29 +00:00
2016-05-16 09:11:40 +00:00
2017-11-18 14:26:50 +00:00
2016-08-19 10:52:39 +00:00
2017-11-18 14:26:50 +00:00
2018-01-12 22:48:23 +00:00
2018-01-12 22:48:23 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-12-31 09:23:52 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2018-01-07 18:06:30 +00:00
2018-01-12 23:25:05 +00:00
2017-11-27 15:20:12 +00:00
2018-01-14 17:01:37 +00:00
2018-01-08 21:27:41 +00:00
2017-11-27 15:20:12 +00:00
2017-08-07 14:09:57 +00:00
2017-11-27 15:20:12 +00:00
2017-11-30 20:33:45 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-10-05 14:43:30 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:20:12 +00:00
2017-08-16 16:51:55 +00:00
2018-01-13 11:59:49 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:20:12 +00:00
2017-12-25 04:48:39 +00:00
2017-11-20 19:43:44 +00:00
2017-11-28 05:39:48 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-12-31 09:24:41 +00:00
2017-11-20 19:43:44 +00:00
2016-05-20 17:57:47 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:20:12 +00:00
2017-11-20 19:43:44 +00:00
2017-02-07 17:31:24 +00:00
2017-11-20 19:43:44 +00:00
2017-12-25 04:48:39 +00:00
2017-12-21 09:17:48 +00:00
2017-11-27 15:20:12 +00:00
2017-11-18 14:26:50 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-18 14:26:50 +00:00
2017-11-27 15:20:12 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:20:12 +00:00
2018-01-12 23:25:05 +00:00
2017-12-25 04:48:39 +00:00
2017-11-27 15:20:12 +00:00
2017-12-01 11:18:19 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2018-01-11 20:26:17 +00:00
2018-01-12 23:06:35 +00:00
2018-01-12 22:48:23 +00:00
2018-01-12 23:06:35 +00:00
2017-12-31 03:34:00 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-12-31 03:34:00 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +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:20:12 +00:00
2017-11-27 15:20:12 +00:00
2017-11-27 15:20:12 +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:20:12 +00:00
2018-01-10 21:18:46 +00:00
2018-01-12 23:25:05 +00:00
2017-12-01 22:51:02 +00:00
2017-11-20 19:43:44 +00:00
2017-12-19 22:39:05 +00:00
2017-12-23 17:55:19 +00:00
2017-12-13 16:14:38 +00:00
2017-11-27 15:20:12 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2018-01-07 18:07:22 +00:00
2017-12-31 09:23:52 +00:00
2018-01-12 13:39:02 +00:00
2017-11-20 19:43:44 +00:00
2017-11-20 19:43:44 +00:00
2017-06-02 17:31:25 +00:00