Add a function to retrieve the EFI realtime clock capabilities.

This commit is contained in:
Ian Lepore 2018-03-01 22:57:14 +00:00
parent 58dcf3ff97
commit 35e313cfe8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=330257
2 changed files with 18 additions and 3 deletions

View File

@ -241,7 +241,7 @@ efi_get_table(struct uuid *uuid, void **ptr)
}
static int
efi_get_time_locked(struct efi_tm *tm)
efi_get_time_locked(struct efi_tm *tm, struct efi_tmcap *tmcap)
{
efi_status status;
int error;
@ -250,7 +250,7 @@ efi_get_time_locked(struct efi_tm *tm)
error = efi_enter();
if (error != 0)
return (error);
status = efi_runtime->rt_gettime(tm, NULL);
status = efi_runtime->rt_gettime(tm, tmcap);
efi_leave();
error = efi_status_to_errno(status);
return (error);
@ -264,7 +264,21 @@ efi_get_time(struct efi_tm *tm)
if (efi_runtime == NULL)
return (ENXIO);
EFI_TIME_LOCK()
error = efi_get_time_locked(tm);
error = efi_get_time_locked(tm, NULL);
EFI_TIME_UNLOCK()
return (error);
}
int
efi_get_time_capabilities(struct efi_tmcap *tmcap)
{
struct efi_tm dummy;
int error;
if (efi_runtime == NULL)
return (ENXIO);
EFI_TIME_LOCK()
error = efi_get_time_locked(&dummy, tmcap);
EFI_TIME_UNLOCK()
return (error);
}

View File

@ -179,6 +179,7 @@ void efi_destroy_1t1_map(void);
int efi_rt_ok(void);
int efi_get_table(struct uuid *uuid, void **ptr);
int efi_get_time(struct efi_tm *tm);
int efi_get_time_capabilities(struct efi_tmcap *tmcap);
int efi_reset_system(void);
int efi_set_time(struct efi_tm *tm);
int efi_var_get(uint16_t *name, struct uuid *vendor, uint32_t *attrib,