Skip to content
Commit 070938aa authored by Masahisa Kojima's avatar Masahisa Kojima Committed by Ard Biesheuvel
Browse files

Silicon/NXP/Pcf8563RealTimeClockLib: add Voltage-low handling



BcdToDecimal8() in LibGetTime() asserts with the
following condition.
 1) RTC device has not been initialized yet, RTC device
    returns indeterminate value with VL bit(1)
 2) DEBUG build

UEFI boot fails with assertion when it satisfies above conditions.

Aside from boot failure, UEFI shell commands "date/time" expect
that getting time from RTC should succeed when user sets the time.
ShellCommandRunTime() performs GetTime()->update time->SetTime(),
if the first GetTime() fails, user can not set time.
With that, simply returning EFI_DEVICE_ERROR in LibGetTime()
is not applicable to VL bit handling.

To avoid this situation, even if it only occurs in DEBUG build,
RTC driver should check the VL bit in the VL_seconds register.
This VL bit is voltage-low detector, it means integrity of the
clock information is not guaranteed if it sets to 1. In this
case, driver return dummy date/time(01/01/2000 00:00:00) to
proceed succeeding process.

linux driver also checks this bit when driver gets the time
from RTC. If VL bit is 1, linux driver discard the retreived
time data.

Note that if VL bit is 1, GetTime() returns always
01/01/2000 00:00:00 until user sets date/time.

Contributed-under: TianoCore Contribution Agreement 1.1
Co-authored-by: default avatarYoshitoyo Osaki <osaki.yoshitoyo@socionext.com>
Signed-off-by: default avatarMasahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
parent 9336a9f2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment