[U-Boot] [PATCH 0/2] efi_loader: (network) event handling

Some changes were made in iPXE which made it impossible to boot from iSCSI with U-Boot anymore.
The first patch ensures that queued events are executed when RestoreTPL is called. This mimics what EDK2 does. iPXE relies on this behavior when using this pattern:
bs->RestoreTPL ( TPL_APPLICATION ); bs->RaiseTPL ( TPL_CALLBACK );
iPXE has raised the TPL level at which the application is running (in discordance with the recommendations of the UEFI spec). So we have to run the timer event of the network service at a higher level (TPL_NOTIFY).
Heinrich Schuchardt (2): efi_loader: RestoreTPL should execute queued events efi_loader: use TPL_NOTIFY for network timer event
lib/efi_loader/efi_boottime.c | 5 +++++ lib/efi_loader/efi_net.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-)

When the TPL is lowered queued events may become eligible for execution.
iPXE uses the following pattern to request event execution:
bs->RestoreTPL ( TPL_APPLICATION ); bs->RaiseTPL ( TPL_CALLBACK );
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- lib/efi_loader/efi_boottime.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index 1ff0568d47..89d97326a8 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -277,6 +277,11 @@ static void EFIAPI efi_restore_tpl(efi_uintn_t old_tpl) efi_tpl = old_tpl; if (efi_tpl > TPL_HIGH_LEVEL) efi_tpl = TPL_HIGH_LEVEL; + + /* + * Lowering the TPL may have made queued events eligible for execution. + */ + efi_timer_check();
EFI_EXIT(EFI_SUCCESS); }

We use a timer to poll the network.
iPXE is used for booting from iSCSI drives. It has been changed to run at TPL_CALLBACK most of the time (which is not what the UEFI spec recommends).
By changing our timer to TPL_NOTIFY we can ensure that it is nevertheless executed.
Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- lib/efi_loader/efi_net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c index b88dc91f58..3d860e658e 100644 --- a/lib/efi_loader/efi_net.c +++ b/lib/efi_loader/efi_net.c @@ -353,8 +353,10 @@ efi_status_t efi_net_register(void) * * The notification function is used to check if a new network packet * has been received. + * + * iPXE is running at TPL_CALLBACK most of the time. Use a higher TPL. */ - r = efi_create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_CALLBACK, + r = efi_create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_NOTIFY, efi_network_timer_notify, NULL, NULL, &network_timer_event); if (r != EFI_SUCCESS) {
participants (1)
-
Heinrich Schuchardt