Commit graph

20 commits

Author SHA1 Message Date
Artur Rojek
6092ce50ef event: add new EVT_SETTINGS_R event
Introduce EVT_SETTINGS_R, triggered post-relocation and before console
init.

This event gives an option to perform any platform-dependent setup,
which needs to take place before show_board_info(). Usage examples
include readout of EEPROM stored settings.

Signed-off-by: Artur Rojek <artur@conclusive.pl>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-23 17:07:06 +03:00
Marek Vasut
1ee16b268d common: event: Remove unused NEEDS_MANUAL_RELOC code bits
The last user of the NEEDS_MANUAL_RELOC has been removed in commit
26af162ac8 ("arch: m68k: Implement relocation")
Remove now unused NEEDS_MANUAL_RELOC code.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2023-09-14 10:42:24 -04:00
Tom Rini
ddec4cae62 Prepare v2023.10-rc4
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmT17FsACgkQFHw5/5Y0
 tywn0gwAlRs5NZ4ierzvDiLQEvYgV6E+lLccwyf8mMfJVHicrrW/ckxqJGS2mrLz
 IoA0pO1oF/HFfR/0pgx9Pb2kuIK1tkCeVNYW6t9EDbEJzrbfdvykBcSB4wgKYpgB
 ZgCga0jsPNM951Y3a3TElNEet4pVTZrDLu0E2UR6zNzr5hpKnfoQTZRfBI1MyCq4
 w4/Eo2wAnnaV1lcobg9LzM6uyDnETxWyTI7DIJYSqkEgT0WcF6zrdW55MaXtrPo5
 RZ4q5MTJQwqnTV5awsmgEt8PSC+XQcPHMPrVCwoOZAdru+5zO3AWpbqq1q6K+y9U
 FEsaJ6HGn5BdITgmIK/lb8oTekfOkDPFF3WuFp5bZ6L0A63ANu/MMWHELyyt5+0z
 TlnU94PVxiLnPMzZtfBPWRQ3jIU5qltJaoW0pKwsoa7P8iUd1WZgYyN+G9WPgwFr
 XUemGRNkgnWfRoxcKGbaYDSB0Llp6m/zqPlGfhlt0ZKXc6igLu3/egRh7/8zLR0i
 y9uBKG45
 =s9vZ
 -----END PGP SIGNATURE-----

Merge tag 'v2023.10-rc4' into next

Prepare v2023.10-rc4
2023-09-04 10:51:58 -04:00
Simon Glass
91caa3bb89 event: Use an event to replace last_stage_init()
Add a new event which handles this function. Convert existing use of
the function to use the new event instead.

Make sure that EVENT is enabled by affected boards, by selecting it from
the LAST_STAGE_INIT option. For x86, enable it by default since all boards
need it.

For controlcenterdc, inline the get_tpm() function and make sure the event
is not built in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-31 13:16:55 -04:00
Simon Glass
13a7db9ab1 x86: Convert arch_fsp_init() to use events
Convert this to use events instead of calling a function directly in the
init sequence.

Rename it to arch_fsp_init_f() to distinguish it from the one that happens
after relocation.

For FSPv2 nothing needs to be done here, so drop the empty function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-31 13:16:54 -04:00
Simon Glass
fb7dfca28a event: Export event_type_name()
Export this function so it can be used with initcall debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-31 13:16:54 -04:00
Simon Glass
ba5e3e1ed0 event: Support a simple spy record
The current event spy is always passed the event context and the event.
The context is always NULL for a static spy. The event is not often used.

Introduce a 'simple' spy which takes no arguments. This allows us to drop
the adaptation code that many of these spy records use.

Update the event script to find these in the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-31 13:16:54 -04:00
Chanho Park
27c7a62986 dm: event: add EVT_DM_POST_INIT_R event type
This patch introduces EVT_DM_POST_INIT_R event type for handling hooks
after relocation.

Fixes: 55171aedda ("dm: Emit the arch_cpu_init_dm() even only before relocation")
Suggested-by: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
Tested-by: Milan P. Stanić <mps@arvanta.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Roland Ruckerbauer <mail@ruabmbua.dev>
Tested-by: Roland Ruckerbauer <mail@ruabmbua.dev>
Fixed missing event name in event.c:
Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-22 08:07:43 -06:00
Jaehoon Chung
b49662083f event: Fix a wrong type_name from dm_post_init to dm_post_init_f
DM_POST_INIT was changed to DM_POST_INIT_F.
To debug correct message, change type_name from dm_post_init to
dm_post_init_f.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
s/an/a/ :
Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-05 11:39:23 -06:00
Christian Taedcke
a1190b4d6a event: Add fpga load event
This enables implementing custom logic after a bitstream was loaded
into the fpga.

Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Link: https://lore.kernel.org/r/20230720072724.11516-1-christian.taedcke-oss@weidmueller.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-07-21 09:00:39 +02:00
Simon Glass
00ba40fa3e Correct SPL uses of NEEDS_MANUAL_RELOC
This converts 3 usages of this option to the non-SPL form, since there is
no SPL_NEEDS_MANUAL_RELOC defined in Kconfig

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-10 07:41:39 -05:00
Simon Glass
19efd43b0f event: Correct duplicate log message in event_notify()
Use a different one for each call.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-23 18:11:39 -05:00
Sughosh Ganu
467bad5e36 event: Add an event for main_loop
Add an event type EVT_MAIN_LOOP that can be used for registering
events that need to be run after the platform has been initialised and
before the main_loop function is called.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
2022-10-31 14:47:32 -04:00
Simon Glass
98887ab802 event: Add an event for device tree fixups
At present there is a confusing array of functions that handle the
device tree fix-ups needed for booting an OS. We should be able to switch
to using events to clean this up.

As a first step, create a new event type and call it from the standard
place.

Note that this event uses the ofnode interface only, since this can
support live tree which is more efficient when making lots of updates.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12 08:17:11 -04:00
Ovidiu Panait
cebc816170 event: fix static events for CONFIG_NEEDS_MANUAL_RELOC
Static events do not currently work post-relocation for boards that enable
CONFIG_NEEDS_MANUAL_RELOC. Relocate event handler pointers for all event
spies to fix this.

Tested on Microblaze.

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
2022-06-06 18:01:20 -04:00
Ovidiu Panait
12c90955a7 event: remove CONFIG_EVENT_DYNAMIC check in event_register()
The whole event_register() function is wrapped in EVENT_DYNAMIC #ifdef
checks, so the inner check is not needed:

 #if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
 ...
 int event_register(...)
 {
     ...
     if (!CONFIG_IS_ENABLED(EVENT_DYNAMIC))
         return -ENOSYS;
 }
 #endif

Signed-off-by: Ovidiu Panait <ovpanait@gmail.com>
2022-06-06 17:47:17 -04:00
Simon Glass
7fe32b3442 event: Convert arch_cpu_init_dm() to use events
Instead of a special function, send an event after driver model is inited
and adjust the boards which use this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-10 08:28:36 -05:00
Simon Glass
42fdcebf85 event: Convert misc_init_f() to use events
This hook can be implmented using events, for the three boards that
actually use it.

Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we
can just use CONFIG_EVENT to control this. Since sandbox always enables
CONFIG_EVENT, we can drop the defconfig lines there too.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-10 08:28:36 -05:00
Simon Glass
5b896ed585 event: Add events for device probe/remove
Generate events when devices are probed or removed, allowing hooks
to be added for these situations.

This is controlled by the DM_EVENT config option.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-10 08:28:36 -05:00
Simon Glass
87a5d1b5d0 event: Add basic support for events
Add a way to create and dispatch events without needing to allocate
memory. Also add a way to 'spy' on events, thus allowing 'hooks' to be
created.

Use a linker list for static events, which we can use to replace functions
like arch_cpu_init_f(). Allow an EVENT_DEBUG option which makes it
easier to see what is going on at runtime, but uses more code space.

Dynamic events allow the creation of a spy at runtime. This is not always
necessary, but can be enabled with EVENT_DYNAMIC if needed.

A 'test' event is the only option for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-10 08:28:36 -05:00