Extend struct todr_chip_handle with a todr_quality member. This allows us
authorkettenis <kettenis@openbsd.org>
Wed, 12 Oct 2022 13:39:50 +0000 (13:39 +0000)
committerkettenis <kettenis@openbsd.org>
Wed, 12 Oct 2022 13:39:50 +0000 (13:39 +0000)
commit0701a1582b980c3a7d09f2b4176795598cce62d3
treec69488fbef3991018d7643372217d54184630e6e
parentc1e33626a4530fb442b01561e12030b6a8d97a57
Extend struct todr_chip_handle with a todr_quality member.  This allows us
to assign a quality to RTC implementation and pick the "best" RTC if a
system has multiple RTCs (or multiple interfaces to an RTC).  This allows
us to prefer a battery-backed I2C RTC over an RTC that is part of the SoC
which is only running of the SoC is powered.  It also allows us to
work around issues with firmware RTC interfaces that may lie to us or
even crash the system.

This change makes sure the todr_quality member of the struct is always
initialized.  In most cases the quality will be set to zero; further
adjustments of the quality for specific subsystems/architectures will follow.

ok cheloha@, patrick@
22 files changed:
sys/arch/arm64/dev/aplpmu.c
sys/arch/arm64/dev/aplsmc.c
sys/arch/arm64/dev/efi_machdep.c
sys/arch/loongson/dev/mcclock.c
sys/arch/octeon/dev/octrtc.c
sys/arch/powerpc64/dev/opal.c
sys/arch/sparc64/dev/prtc.c
sys/arch/sparc64/dev/rtc.c
sys/arch/sparc64/dev/sbbc.c
sys/arch/sparc64/dev/vrtc.c
sys/dev/clock_subr.h
sys/dev/fdt/dapmic.c
sys/dev/fdt/plrtc.c
sys/dev/fdt/rkpmic.c
sys/dev/fdt/sxirtc.c
sys/dev/i2c/m41t8x.c
sys/dev/i2c/pcf85063.c
sys/dev/i2c/pcf8523.c
sys/dev/i2c/pcf8563.c
sys/dev/i2c/rs5c372.c
sys/dev/ic/mk48txx.c
sys/kern/kern_time.c