From b521d29eb1b0dd7be8ee306729f93d964c4c0288 Mon Sep 17 00:00:00 2001 From: "xypron.glpk@gmx.de" Date: Wed, 19 Jul 2017 19:22:34 +0200 Subject: [PATCH] efi_loader: parameter types for CreateEvent, SetTimer The first argument 'type' of CreateEvent is an 32bit unsigned integer bitmap and not an enum. The second argument 'type' of SetTimer take values of an enum which is called EFI_TIMER_DELAY in the UEFI standard. To avoid confusion rename efi_event_type to efi_timer_delay. Reported-by: Alexander Graf Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- include/efi_api.h | 9 +++++---- include/efi_loader.h | 8 ++++---- lib/efi_loader/efi_boottime.c | 11 ++++++----- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h index d52eea4086..8f881d2903 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -22,7 +22,7 @@ #endif /* Types and defines for EFI CreateEvent */ -enum efi_event_type { +enum efi_timer_delay { EFI_TIMER_STOP = 0, EFI_TIMER_PERIODIC = 1, EFI_TIMER_RELATIVE = 2 @@ -59,14 +59,15 @@ struct efi_boot_services { efi_status_t (EFIAPI *allocate_pool)(int, unsigned long, void **); efi_status_t (EFIAPI *free_pool)(void *); - efi_status_t (EFIAPI *create_event)(enum efi_event_type type, + efi_status_t (EFIAPI *create_event)(uint32_t type, UINTN notify_tpl, void (EFIAPI *notify_function) ( struct efi_event *event, void *context), void *notify_context, struct efi_event **event); - efi_status_t (EFIAPI *set_timer)(struct efi_event *event, int type, - uint64_t trigger_time); + efi_status_t (EFIAPI *set_timer)(struct efi_event *event, + enum efi_timer_delay type, + uint64_t trigger_time); efi_status_t (EFIAPI *wait_for_event)(unsigned long number_of_events, struct efi_event **event, unsigned long *index); efi_status_t (EFIAPI *signal_event)(struct efi_event *event); diff --git a/include/efi_loader.h b/include/efi_loader.h index 7818e1cebb..4bcd35ac77 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -76,13 +76,13 @@ struct efi_object { * @signaled: The notify function was already called */ struct efi_event { - u32 type; + uint32_t type; UINTN notify_tpl; void (EFIAPI *notify_function)(struct efi_event *event, void *context); void *notify_context; u64 trigger_next; u64 trigger_time; - enum efi_event_type trigger_type; + enum efi_timer_delay trigger_type; int signaled; }; @@ -119,13 +119,13 @@ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map); /* Call this to set the current device name */ void efi_set_bootdev(const char *dev, const char *devnr, const char *path); /* Call this to create an event */ -efi_status_t efi_create_event(enum efi_event_type type, UINTN notify_tpl, +efi_status_t efi_create_event(uint32_t type, UINTN notify_tpl, void (EFIAPI *notify_function) ( struct efi_event *event, void *context), void *notify_context, struct efi_event **event); /* Call this to set a timer */ -efi_status_t efi_set_timer(struct efi_event *event, int type, +efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type, uint64_t trigger_time); /* Call this to signal an event */ void efi_signal_event(struct efi_event *event); diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 7d45c18ff7..e0aead47c9 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -207,7 +207,7 @@ static efi_status_t EFIAPI efi_free_pool_ext(void *buffer) */ static struct efi_event efi_events[16]; -efi_status_t efi_create_event(enum efi_event_type type, UINTN notify_tpl, +efi_status_t efi_create_event(uint32_t type, UINTN notify_tpl, void (EFIAPI *notify_function) ( struct efi_event *event, void *context), @@ -242,7 +242,7 @@ efi_status_t efi_create_event(enum efi_event_type type, UINTN notify_tpl, } static efi_status_t EFIAPI efi_create_event_ext( - enum efi_event_type type, UINTN notify_tpl, + uint32_t type, UINTN notify_tpl, void (EFIAPI *notify_function) ( struct efi_event *event, void *context), @@ -280,7 +280,7 @@ void efi_timer_check(void) WATCHDOG_RESET(); } -efi_status_t efi_set_timer(struct efi_event *event, int type, +efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type, uint64_t trigger_time) { int i; @@ -316,8 +316,9 @@ efi_status_t efi_set_timer(struct efi_event *event, int type, return EFI_INVALID_PARAMETER; } -static efi_status_t EFIAPI efi_set_timer_ext(struct efi_event *event, int type, - uint64_t trigger_time) +static efi_status_t EFIAPI efi_set_timer_ext(struct efi_event *event, + enum efi_timer_delay type, + uint64_t trigger_time) { EFI_ENTRY("%p, %d, %"PRIx64, event, type, trigger_time); return EFI_EXIT(efi_set_timer(event, type, trigger_time)); -- 2.39.5