Commit 9bc9664d5ee16155b42baf92282ba7198ef4e873
Committed by
Alexander Graf
1 parent
65436f91c5
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
efi_loader: add check_tpl parameter to efi_signal_event
In ExitBootServices we need to signal events irrespective of the current TPL level. A new parameter check_tpl is added to efi_signal_event(). Function efi_console_timer_notify() gets some comments. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Showing 3 changed files with 20 additions and 11 deletions Side-by-side Diff
include/efi_loader.h
... | ... | @@ -240,7 +240,7 @@ |
240 | 240 | efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type, |
241 | 241 | uint64_t trigger_time); |
242 | 242 | /* Call this to signal an event */ |
243 | -void efi_signal_event(struct efi_event *event); | |
243 | +void efi_signal_event(struct efi_event *event, bool check_tpl); | |
244 | 244 | |
245 | 245 | /* open file system: */ |
246 | 246 | struct efi_simple_file_system_protocol *efi_simple_file_system( |
lib/efi_loader/efi_boottime.c
... | ... | @@ -149,13 +149,14 @@ |
149 | 149 | * For the SignalEvent service see efi_signal_event_ext. |
150 | 150 | * |
151 | 151 | * @event event to signal |
152 | + * @check_tpl check the TPL level | |
152 | 153 | */ |
153 | -void efi_signal_event(struct efi_event *event) | |
154 | +void efi_signal_event(struct efi_event *event, bool check_tpl) | |
154 | 155 | { |
155 | 156 | if (event->notify_function) { |
156 | 157 | event->is_queued = true; |
157 | 158 | /* Check TPL */ |
158 | - if (efi_tpl >= event->notify_tpl) | |
159 | + if (check_tpl && efi_tpl >= event->notify_tpl) | |
159 | 160 | return; |
160 | 161 | EFI_CALL_VOID(event->notify_function(event, |
161 | 162 | event->notify_context)); |
... | ... | @@ -565,7 +566,7 @@ |
565 | 566 | if (!efi_events[i].type) |
566 | 567 | continue; |
567 | 568 | if (efi_events[i].is_queued) |
568 | - efi_signal_event(&efi_events[i]); | |
569 | + efi_signal_event(&efi_events[i], true); | |
569 | 570 | if (!(efi_events[i].type & EVT_TIMER) || |
570 | 571 | now < efi_events[i].trigger_next) |
571 | 572 | continue; |
... | ... | @@ -581,7 +582,7 @@ |
581 | 582 | continue; |
582 | 583 | } |
583 | 584 | efi_events[i].is_signaled = true; |
584 | - efi_signal_event(&efi_events[i]); | |
585 | + efi_signal_event(&efi_events[i], true); | |
585 | 586 | } |
586 | 587 | WATCHDOG_RESET(); |
587 | 588 | } |
... | ... | @@ -690,7 +691,7 @@ |
690 | 691 | if (!event[i]->type || event[i]->type & EVT_NOTIFY_SIGNAL) |
691 | 692 | return EFI_EXIT(EFI_INVALID_PARAMETER); |
692 | 693 | if (!event[i]->is_signaled) |
693 | - efi_signal_event(event[i]); | |
694 | + efi_signal_event(event[i], true); | |
694 | 695 | } |
695 | 696 | |
696 | 697 | /* Wait for signal */ |
... | ... | @@ -740,7 +741,7 @@ |
740 | 741 | break; |
741 | 742 | event->is_signaled = true; |
742 | 743 | if (event->type & EVT_NOTIFY_SIGNAL) |
743 | - efi_signal_event(event); | |
744 | + efi_signal_event(event, true); | |
744 | 745 | break; |
745 | 746 | } |
746 | 747 | return EFI_EXIT(EFI_SUCCESS); |
... | ... | @@ -797,7 +798,7 @@ |
797 | 798 | if (!event->type || event->type & EVT_NOTIFY_SIGNAL) |
798 | 799 | break; |
799 | 800 | if (!event->is_signaled) |
800 | - efi_signal_event(event); | |
801 | + efi_signal_event(event, true); | |
801 | 802 | if (event->is_signaled) |
802 | 803 | return EFI_EXIT(EFI_SUCCESS); |
803 | 804 | return EFI_EXIT(EFI_NOT_READY); |
lib/efi_loader/efi_console.c
... | ... | @@ -482,17 +482,25 @@ |
482 | 482 | { |
483 | 483 | } |
484 | 484 | |
485 | +/* | |
486 | + * Notification function of the console timer event. | |
487 | + * | |
488 | + * event: console timer event | |
489 | + * context: not used | |
490 | + */ | |
485 | 491 | static void EFIAPI efi_console_timer_notify(struct efi_event *event, |
486 | 492 | void *context) |
487 | 493 | { |
488 | 494 | EFI_ENTRY("%p, %p", event, context); |
495 | + | |
496 | + /* Check if input is available */ | |
489 | 497 | if (tstc()) { |
498 | + /* Queue the wait for key event */ | |
490 | 499 | efi_con_in.wait_for_key->is_signaled = true; |
491 | - efi_signal_event(efi_con_in.wait_for_key); | |
492 | - } | |
500 | + efi_signal_event(efi_con_in.wait_for_key, true); | |
501 | + } | |
493 | 502 | EFI_EXIT(EFI_SUCCESS); |
494 | 503 | } |
495 | - | |
496 | 504 | |
497 | 505 | /* This gets called from do_bootefi_exec(). */ |
498 | 506 | int efi_console_register(void) |