diff options
author | xypron.glpk@gmx.de <xypron.glpk@gmx.de> | 2017-07-18 20:17:21 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2017-07-19 14:31:40 +0200 |
commit | bfc724625f73f80321945fee306d0c4dc3015898 (patch) | |
tree | 39e5b3cfc3b5727779039622b2dbe32896b9aca5 /lib/efi_loader | |
parent | 49deb455e6e650124c4e6ab1006f5450d2282be8 (diff) |
efi_loader: refactor efi_set_timer
efi_set_timer is refactored to make the function callable internally.
Wrapper function efi_set_timer_ext is provided for EFI applications.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_loader')
-rw-r--r-- | lib/efi_loader/efi_boottime.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 30227cc56c..4cd06b3c4c 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -252,16 +252,14 @@ void efi_timer_check(void) WATCHDOG_RESET(); } -static efi_status_t EFIAPI efi_set_timer(struct efi_event *event, int type, - uint64_t trigger_time) +efi_status_t efi_set_timer(struct efi_event *event, int type, + uint64_t trigger_time) { /* We don't have 64bit division available everywhere, so limit timer * distances to 32bit bits. */ u32 trigger32 = trigger_time; int i; - EFI_ENTRY("%p, %d, %"PRIx64, event, type, trigger_time); - if (trigger32 < trigger_time) { printf("WARNING: Truncating timer from %"PRIx64" to %x\n", trigger_time, trigger32); @@ -283,13 +281,20 @@ static efi_status_t EFIAPI efi_set_timer(struct efi_event *event, int type, timer_get_us() + (trigger32 / 10); break; default: - return EFI_EXIT(EFI_INVALID_PARAMETER); + return EFI_INVALID_PARAMETER; } event->trigger_type = type; event->trigger_time = trigger_time; - return EFI_EXIT(EFI_SUCCESS); + return EFI_SUCCESS; } - return EFI_EXIT(EFI_INVALID_PARAMETER); + return EFI_INVALID_PARAMETER; +} + +static efi_status_t EFIAPI efi_set_timer_ext(struct efi_event *event, int type, + uint64_t trigger_time) +{ + EFI_ENTRY("%p, %d, %"PRIx64, event, type, trigger_time); + return EFI_EXIT(efi_set_timer(event, type, trigger_time)); } static efi_status_t EFIAPI efi_wait_for_event(unsigned long num_events, @@ -1067,7 +1072,7 @@ static const struct efi_boot_services efi_boot_services = { .allocate_pool = efi_allocate_pool_ext, .free_pool = efi_free_pool_ext, .create_event = efi_create_event_ext, - .set_timer = efi_set_timer, + .set_timer = efi_set_timer_ext, .wait_for_event = efi_wait_for_event, .signal_event = efi_signal_event_ext, .close_event = efi_close_event, |