Improve error messages from clock_if.m method failures.

Print error message in verbose mode when CLOCK_SETTIME() clock_if.m
method failed.  For EFIRT RTC clock, add error code for the failure of
CLOCK_GETTIME() report.

Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Approved by:    re (rgrimes)
Differential revision:	https://reviews.freebsd.org/D16972
This commit is contained in:
Konstantin Belousov 2018-09-02 20:17:51 +00:00
parent 9eb958988a
commit 420382368a
2 changed files with 6 additions and 2 deletions

View File

@ -74,7 +74,8 @@ efirtc_probe(device_t dev)
*/
if ((error = efi_get_time(&tm)) != 0) {
if (bootverbose)
device_printf(dev, "cannot read EFI realtime clock\n");
device_printf(dev, "cannot read EFI realtime clock, "
"error %d\n", error);
return (error);
}
device_set_desc(dev, "EFI Realtime Clock");

View File

@ -138,6 +138,7 @@ settime_task_func(void *arg, int pending)
{
struct timespec ts;
struct rtc_instance *rtc;
int error;
rtc = arg;
if (!(rtc->flags & CLOCKF_SETTIME_NO_TS)) {
@ -150,7 +151,9 @@ settime_task_func(void *arg, int pending)
ts.tv_sec = 0;
ts.tv_nsec = 0;
}
CLOCK_SETTIME(rtc->clockdev, &ts);
error = CLOCK_SETTIME(rtc->clockdev, &ts);
if (error != 0 && bootverbose)
device_printf(rtc->clockdev, "CLOCK_SETTIME error %d\n", error);
}
static void