public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 0/2] fwu: Call EFI stack initialization after preboot
@ 2026-03-10 14:59 Michal Simek
  2026-03-10 14:59 ` [PATCH 1/2] event: Introduce EVT_POST_PREBOOT event Michal Simek
  2026-03-10 14:59 ` [PATCH 2/2] fwu: Move boottime checks to EVT_POST_PREBOOT Michal Simek
  0 siblings, 2 replies; 5+ messages in thread
From: Michal Simek @ 2026-03-10 14:59 UTC (permalink / raw)
  To: u-boot, git, xypron.glpk, ilias.apalodimas
  Cc: Casey Connolly, Kory Maincent, Padmarao Begari, Simon Glass,
	Sughosh Ganu, Tom Rini

Hi,

the whole series is trying to address issues we have on platforms where usb
and ufs init are not done before efi initialization. This is happenin on
platforms where A/B update is enabled. FWU code is called early and do EFI
initialization before usb and ufs started that's why they are not visible.

We are workarounding it by starting usb/ufs from board file but this should
be more generic approach.

Thanks,
Michal


Michal Simek (2):
  event: Introduce EVT_POST_PREBOOT event
  fwu: Move boottime checks to EVT_POST_PREBOOT

 common/main.c         | 3 +++
 include/event.h       | 9 +++++++++
 lib/fwu_updates/fwu.c | 2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

-- 
2.43.0

base-commit: e5387628c1d64caf7bcabb5d99d2987bd5bff617
branch: debian-sent3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] event: Introduce EVT_POST_PREBOOT event
  2026-03-10 14:59 [PATCH 0/2] fwu: Call EFI stack initialization after preboot Michal Simek
@ 2026-03-10 14:59 ` Michal Simek
  2026-03-17 12:29   ` Simon Glass
  2026-03-10 14:59 ` [PATCH 2/2] fwu: Move boottime checks to EVT_POST_PREBOOT Michal Simek
  1 sibling, 1 reply; 5+ messages in thread
From: Michal Simek @ 2026-03-10 14:59 UTC (permalink / raw)
  To: u-boot, git, xypron.glpk, ilias.apalodimas
  Cc: Casey Connolly, Simon Glass, Tom Rini

Add a new EVT_POST_PREBOOT event type which is fired in main_loop()
after the preboot command has been executed.

Signed-off-by: Michal Simek <michal.simek@amd.com>
---

 common/main.c   | 3 +++
 include/event.h | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/common/main.c b/common/main.c
index b0b6e74f5d3d..e8b23f3ff293 100644
--- a/common/main.c
+++ b/common/main.c
@@ -19,6 +19,7 @@
 #include <net.h>
 #include <version_string.h>
 #include <efi_loader.h>
+#include <event.h>
 
 static void run_preboot_environment_command(void)
 {
@@ -53,6 +54,8 @@ void main_loop(void)
 	if (IS_ENABLED(CONFIG_USE_PREBOOT))
 		run_preboot_environment_command();
 
+	event_notify_null(EVT_POST_PREBOOT);
+
 	if (IS_ENABLED(CONFIG_UPDATE_TFTP))
 		update_tftp(0UL, NULL, NULL);
 
diff --git a/include/event.h b/include/event.h
index 1d267f1d1054..3ce5f992b04e 100644
--- a/include/event.h
+++ b/include/event.h
@@ -153,6 +153,15 @@ enum event_t {
 	 */
 	EVT_MAIN_LOOP,
 
+	/**
+	 * @EVT_POST_PREBOOT:
+	 * This event is triggered in main_loop() after the preboot command
+	 * has run, so that devices initialised by preboot (e.g. USB, UFS)
+	 * are available to event handlers. Its parameter is NULL.
+	 * A non-zero return value causes the boot to fail.
+	 */
+	EVT_POST_PREBOOT,
+
 	/**
 	 * @EVT_OF_LIVE_BUILT:
 	 * This event is triggered immediately after the live device tree has been
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] fwu: Move boottime checks to EVT_POST_PREBOOT
  2026-03-10 14:59 [PATCH 0/2] fwu: Call EFI stack initialization after preboot Michal Simek
  2026-03-10 14:59 ` [PATCH 1/2] event: Introduce EVT_POST_PREBOOT event Michal Simek
@ 2026-03-10 14:59 ` Michal Simek
  1 sibling, 0 replies; 5+ messages in thread
From: Michal Simek @ 2026-03-10 14:59 UTC (permalink / raw)
  To: u-boot, git, xypron.glpk, ilias.apalodimas
  Cc: Kory Maincent, Padmarao Begari, Sughosh Ganu, Tom Rini

Switch fwu_boottime_checks() from EVT_MAIN_LOOP to EVT_POST_PREBOOT
because there is no reason to call FWU so early. FWU triggers EFI
stack initialization before all devices are visible which prevents
the EFI stack from scanning these devices and adding them to EFI
variables.

Signed-off-by: Michal Simek <michal.simek@amd.com>
---

 lib/fwu_updates/fwu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c
index 37c613014d18..e82600a29a40 100644
--- a/lib/fwu_updates/fwu.c
+++ b/lib/fwu_updates/fwu.c
@@ -796,4 +796,4 @@ static int fwu_boottime_checks(void)
 
 	return 0;
 }
-EVENT_SPY_SIMPLE(EVT_MAIN_LOOP, fwu_boottime_checks);
+EVENT_SPY_SIMPLE(EVT_POST_PREBOOT, fwu_boottime_checks);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] event: Introduce EVT_POST_PREBOOT event
  2026-03-10 14:59 ` [PATCH 1/2] event: Introduce EVT_POST_PREBOOT event Michal Simek
@ 2026-03-17 12:29   ` Simon Glass
  2026-03-17 12:43     ` Michal Simek
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2026-03-17 12:29 UTC (permalink / raw)
  To: Michal Simek
  Cc: u-boot, git, xypron.glpk, ilias.apalodimas, Casey Connolly,
	Tom Rini

Hi Michal,

On Tue, 10 Mar 2026 at 08:59, Michal Simek <michal.simek@amd.com> wrote:
>
> Add a new EVT_POST_PREBOOT event type which is fired in main_loop()
> after the preboot command has been executed.
>
> Signed-off-by: Michal Simek <michal.simek@amd.com>
> ---
>
>  common/main.c   | 3 +++
>  include/event.h | 9 +++++++++
>  2 files changed, 12 insertions(+)
>
> diff --git a/common/main.c b/common/main.c
> index b0b6e74f5d3d..e8b23f3ff293 100644
> --- a/common/main.c
> +++ b/common/main.c
> @@ -19,6 +19,7 @@
>  #include <net.h>
>  #include <version_string.h>
>  #include <efi_loader.h>
> +#include <event.h>
>
>  static void run_preboot_environment_command(void)
>  {
> @@ -53,6 +54,8 @@ void main_loop(void)
>         if (IS_ENABLED(CONFIG_USE_PREBOOT))
>                 run_preboot_environment_command();
>
> +       event_notify_null(EVT_POST_PREBOOT);

This needs error checking if you wish to honour your comment below
(which I agree with).

> +
>         if (IS_ENABLED(CONFIG_UPDATE_TFTP))
>                 update_tftp(0UL, NULL, NULL);
>
> diff --git a/include/event.h b/include/event.h
> index 1d267f1d1054..3ce5f992b04e 100644
> --- a/include/event.h
> +++ b/include/event.h
> @@ -153,6 +153,15 @@ enum event_t {
>          */
>         EVT_MAIN_LOOP,
>
> +       /**
> +        * @EVT_POST_PREBOOT:
> +        * This event is triggered in main_loop() after the preboot command
> +        * has run, so that devices initialised by preboot (e.g. USB, UFS)
> +        * are available to event handlers. Its parameter is NULL.
> +        * A non-zero return value causes the boot to fail.
> +        */
> +       EVT_POST_PREBOOT,
> +
>         /**
>          * @EVT_OF_LIVE_BUILT:
>          * This event is triggered immediately after the live device tree has been
> --
> 2.43.0
>

Regards,
SImon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] event: Introduce EVT_POST_PREBOOT event
  2026-03-17 12:29   ` Simon Glass
@ 2026-03-17 12:43     ` Michal Simek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Simek @ 2026-03-17 12:43 UTC (permalink / raw)
  To: Simon Glass
  Cc: u-boot, git, xypron.glpk, ilias.apalodimas, Casey Connolly,
	Tom Rini



On 3/17/26 13:29, Simon Glass wrote:
> Hi Michal,
> 
> On Tue, 10 Mar 2026 at 08:59, Michal Simek <michal.simek@amd.com> wrote:
>>
>> Add a new EVT_POST_PREBOOT event type which is fired in main_loop()
>> after the preboot command has been executed.
>>
>> Signed-off-by: Michal Simek <michal.simek@amd.com>
>> ---
>>
>>   common/main.c   | 3 +++
>>   include/event.h | 9 +++++++++
>>   2 files changed, 12 insertions(+)
>>
>> diff --git a/common/main.c b/common/main.c
>> index b0b6e74f5d3d..e8b23f3ff293 100644
>> --- a/common/main.c
>> +++ b/common/main.c
>> @@ -19,6 +19,7 @@
>>   #include <net.h>
>>   #include <version_string.h>
>>   #include <efi_loader.h>
>> +#include <event.h>
>>
>>   static void run_preboot_environment_command(void)
>>   {
>> @@ -53,6 +54,8 @@ void main_loop(void)
>>          if (IS_ENABLED(CONFIG_USE_PREBOOT))
>>                  run_preboot_environment_command();
>>
>> +       event_notify_null(EVT_POST_PREBOOT);
> 
> This needs error checking if you wish to honour your comment below
> (which I agree with).

ok. I will also fix this one which should check it too.

event_notify_null(EVT_MAIN_LOOP);

M

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-17 12:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 14:59 [PATCH 0/2] fwu: Call EFI stack initialization after preboot Michal Simek
2026-03-10 14:59 ` [PATCH 1/2] event: Introduce EVT_POST_PREBOOT event Michal Simek
2026-03-17 12:29   ` Simon Glass
2026-03-17 12:43     ` Michal Simek
2026-03-10 14:59 ` [PATCH 2/2] fwu: Move boottime checks to EVT_POST_PREBOOT Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox