aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/lib
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-03-10 08:24:45 -0500
committerTom Rini <trini@konsulko.com>2022-03-10 08:24:45 -0500
commit6e7de8fd3eccf3119570581569d899809508d8df (patch)
treef9d040341823bf6267a0d65fc5c8539bbe04f555 /arch/x86/lib
parent0bf4e0bb935e5c7fc016142e0228882610ecbf39 (diff)
parent8c187d667c897971a663e2cb21ff901a9e4b60e6 (diff)
downloadu-boot-next.zip
u-boot-next.tar.gz
u-boot-next.tar.bz2
Merge branch '2022-03-09-events-subsystem' into nextnext
To quote the author: It is a common need in U-Boot to have one subsystem notify another when something happens. An example is reading a partition table when a new block device is set up. It is also common to add weak functions and 'hook' functions to modify how U-Boot works. See for example ft_board_setup() and the like. U-Boot would benefit from a generic mechanism to handle these cases, with the ability to hook into various 'events' in a subsystem-independent and transparent way. This series provides a way to create and dispatch events, with a way of registering a 'spy' which watches for events of different types. This allows 'hook' functions to be created in a generic way. It also includes a script to list the hooks in an image, which is a bit easier to debug than weak functions, as well as an 'event' command to do the same from within U-Boot. These 'static' events can be used to replace hooks like misc_init_f(), for example. Also included is basic support for 'dynamic' events, where a spy can be registered at runtime. The need for this is still being figured out.
Diffstat (limited to 'arch/x86/lib')
-rw-r--r--arch/x86/lib/fsp2/fsp_init.c4
-rw-r--r--arch/x86/lib/spl.c5
-rw-r--r--arch/x86/lib/tpl.c10
3 files changed, 6 insertions, 13 deletions
diff --git a/arch/x86/lib/fsp2/fsp_init.c b/arch/x86/lib/fsp2/fsp_init.c
index 5afdce1..b15926e 100644
--- a/arch/x86/lib/fsp2/fsp_init.c
+++ b/arch/x86/lib/fsp2/fsp_init.c
@@ -9,6 +9,7 @@
#include <bootstage.h>
#include <cbfs.h>
#include <dm.h>
+#include <event.h>
#include <init.h>
#include <log.h>
#include <spi.h>
@@ -18,7 +19,7 @@
#include <dm/uclass-internal.h>
#include <asm/fsp2/fsp_internal.h>
-int arch_cpu_init_dm(void)
+int fsp_setup_pinctrl(void *ctx, struct event *event)
{
struct udevice *dev;
ofnode node;
@@ -41,6 +42,7 @@ int arch_cpu_init_dm(void)
return ret;
}
+EVENT_SPY(EVT_DM_POST_INIT, fsp_setup_pinctrl);
#if !defined(CONFIG_TPL_BUILD)
binman_sym_declare(ulong, intel_fsp_m, image_pos);
diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c
index b18c1cd..2d50c62 100644
--- a/arch/x86/lib/spl.c
+++ b/arch/x86/lib/spl.c
@@ -17,6 +17,7 @@
#include <syscon.h>
#include <asm/cpu.h>
#include <asm/cpu_common.h>
+#include <asm/fsp2/fsp_api.h>
#include <asm/global_data.h>
#include <asm/mrccache.h>
#include <asm/mtrr.h>
@@ -27,7 +28,7 @@
DECLARE_GLOBAL_DATA_PTR;
-__weak int arch_cpu_init_dm(void)
+__weak int fsp_setup_pinctrl(void *ctx, struct event *event)
{
return 0;
}
@@ -89,7 +90,7 @@ static int x86_spl_init(void)
return ret;
}
#ifndef CONFIG_TPL
- ret = arch_cpu_init_dm();
+ ret = fsp_setup_pinctrl(NULL, NULL);
if (ret) {
debug("%s: arch_cpu_init_dm() failed\n", __func__);
return ret;
diff --git a/arch/x86/lib/tpl.c b/arch/x86/lib/tpl.c
index 5b57e53..18b05b2 100644
--- a/arch/x86/lib/tpl.c
+++ b/arch/x86/lib/tpl.c
@@ -19,11 +19,6 @@
DECLARE_GLOBAL_DATA_PTR;
-__weak int arch_cpu_init_dm(void)
-{
- return 0;
-}
-
static int x86_tpl_init(void)
{
int ret;
@@ -44,11 +39,6 @@ static int x86_tpl_init(void)
debug("%s: arch_cpu_init() failed\n", __func__);
return ret;
}
- ret = arch_cpu_init_dm();
- if (ret) {
- debug("%s: arch_cpu_init_dm() failed\n", __func__);
- return ret;
- }
preloader_console_init();
return 0;