aboutsummaryrefslogtreecommitdiff
path: root/cmd
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 /cmd
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 'cmd')
-rw-r--r--cmd/Kconfig17
-rw-r--r--cmd/Makefile1
-rw-r--r--cmd/event.c27
3 files changed, 45 insertions, 0 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index d10deed..d2aa06a 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1638,6 +1638,15 @@ config CMD_NFS
help
Boot image via network using NFS protocol.
+config NFS_TIMEOUT
+ int "Timeout in milliseconds for NFS mounts"
+ depends on CMD_NFS
+ default 2000
+ help
+ Timeout in milliseconds used in NFS protocol. If you encounter
+ "ERROR: Cannot umount" in nfs command, try longer timeout such as
+ 10000.
+
config CMD_MII
bool "mii"
imply CMD_MDIO
@@ -2367,6 +2376,14 @@ config CMD_DIAG
available tests and running either all the tests, or specific tests
identified by name.
+config CMD_EVENT
+ bool "event - Show information about events"
+ default y if EVENT_DEBUG
+ help
+ This enables the 'event' command which provides information about
+ events and event-handler routines. This can help to device event
+ hadling.
+
config CMD_IRQ
bool "irq - Show information about interrupts"
depends on !ARM && !MIPS && !RISCV && !SH
diff --git a/cmd/Makefile b/cmd/Makefile
index 166c652..0d2b2ee 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_CMD_DIAG) += diag.o
endif
obj-$(CONFIG_CMD_ADTIMG) += adtimg.o
obj-$(CONFIG_CMD_ABOOTIMG) += abootimg.o
+obj-$(CONFIG_CMD_EVENT) += event.o
obj-$(CONFIG_CMD_EXTENSION) += extension_board.o
obj-$(CONFIG_CMD_ECHO) += echo.o
obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
diff --git a/cmd/event.c b/cmd/event.c
new file mode 100644
index 0000000..9cac202
--- /dev/null
+++ b/cmd/event.c
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Command-line access to events
+ *
+ * Copyright 2021 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <common.h>
+#include <command.h>
+#include <event.h>
+
+static int do_event_list(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+ event_show_spy_list();
+
+ return 0;
+}
+
+#ifdef CONFIG_SYS_LONGHELP
+static char event_help_text[] =
+ "event list - list event spies";
+#endif
+
+U_BOOT_CMD_WITH_SUBCMDS(event, "Events", event_help_text,
+ U_BOOT_SUBCMD_MKENT(list, 1, 1, do_event_list));