From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7B36C433F5 for ; Fri, 4 Mar 2022 15:43:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8F03483C64; Fri, 4 Mar 2022 16:43:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Ra1Zcjg6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EC28F81277; Fri, 4 Mar 2022 16:43:22 +0100 (CET) Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8BEBE83108 for ; Fri, 4 Mar 2022 16:43:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2c.google.com with SMTP id f14so9986280ioz.1 for ; Fri, 04 Mar 2022 07:43:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=K36luEiqlaqoYjEU/HQ4PVYdVMpAn9HrNUOCgZJUV8U=; b=Ra1Zcjg6uSEtNcTm4eQXbjPDbFgz8yugouGaq0Vq93peKpCz6Ezph8ne/zSSzpi4Sr uxcu3aCtiRA4MmKwW1v52BmB9sItbMohE8H7YSxcXC6dj2lilazvLTD9oAhKWgyZKDZ/ l87ZJDKmBBM11PMZK2nB/4cbyfEmkrEfY3EjY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=K36luEiqlaqoYjEU/HQ4PVYdVMpAn9HrNUOCgZJUV8U=; b=GEYZ7+FIGF5IQernxT6Z6MMbzZsfq0dqZYtMqoo5BQf5wMT7IT/oOqDG8hXK5PS9si bUssYE3ZwYnkDUWrU9G3J4W3rQMg7OvIs4/Os4Xxzg9JuG8iaNuXQdGMOMz66C/zU3Ib 1tthoeUrd6YIBDzSXJ6RM6zjNsDCYyj4+/w0lScZ3cOU8l8r9W3QFwujE+w7RMjPWS9t T25x4Gs9kV8x3yR6MLrkWvNM8gG4RSGF2heO4v4k282wQ8O5lUOAH4HweT6DnQbZxpUS zaxTZUWRrxOJX3XLloVtY6Cl5VVYyhBTTtPzwbxHBivRkDU3Oej89zFvRjWrd0twLl6t dnzw== X-Gm-Message-State: AOAM5308hgC7x5uykoADXHmh8ZOfTZk6Pzc91uq3fmEBkZ6SCBdZWdLR xdx6f7If6YNKxhd/sL7snzILSVJSf+bbqQ== X-Google-Smtp-Source: ABdhPJxbeobo5U8QADQtB+O94IK5xCc+1VN4mv+SdSTTgaQTcW1osAIvXcnZ9YlYAT/wSIGNRcr+EQ== X-Received: by 2002:a6b:8d4b:0:b0:63e:baed:9c69 with SMTP id p72-20020a6b8d4b000000b0063ebaed9c69mr30712306iod.55.1646408596046; Fri, 04 Mar 2022 07:43:16 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id h13-20020a5ecb4d000000b006410cd7bf4asm4758814iok.9.2022.03.04.07.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 07:43:15 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Marek Vasut , Masahiro Yamada , Tom Rini , AKASHI Takahiro , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Heinrich Schuchardt , Simon Glass , Joe Hershberger Subject: [PATCH v2 00/13] event: Provide support for events to connect subsystems Date: Fri, 4 Mar 2022 08:42:55 -0700 Message-Id: <20220304154308.2547711-1-sjg@chromium.org> X-Mailer: git-send-email 2.35.1.616.g0bdcbb4464-goog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean 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. Changes in v2: - Add a 'used' attribute to avoid LTO dropping the code - Update keymile pg-wcom boards also - Make the sandbox function static - Convert arch/arm/mach-imx/imx8/cpu.c also - Add DM_EVENT to ARCH_IMX8 too - Tidy up galileo defconfig and rename quark_init_dm() - Make a few more of the functions static - Add a weak function for spl - Update for patman snake-case change - Use a regular expression in the test to avoid dependency on build dir Simon Glass (12): Makefile: Allow LTO to be disabled for a build sandbox: start: Sort the header files binman: Expand elf support a little event: Add basic support for events event: Add a simple test event: Set up the event system on start-up event: Add events for device probe/remove event: Convert misc_init_f() to use events event: Convert arch_cpu_init_dm() to use events event: Add a command event: Add a script to decode the event-spy list event: Add documentation Tim Harvey (1): phy: nop-phy: Fix phy reset if no reset-gpio defined MAINTAINERS | 10 + Makefile | 18 +- arch/Kconfig | 3 + arch/arm/Kconfig | 4 + arch/arm/config.mk | 4 +- arch/arm/include/asm/global_data.h | 2 +- arch/arm/mach-imx/imx8/cpu.c | 4 +- arch/arm/mach-imx/imx8m/soc.c | 4 +- arch/arm/mach-imx/imx8ulp/soc.c | 4 +- arch/arm/mach-omap2/am33xx/board.c | 4 +- arch/arm/mach-omap2/hwinit-common.c | 5 +- arch/mips/Kconfig | 1 + arch/mips/mach-pic32/cpu.c | 4 +- arch/nios2/cpu/cpu.c | 4 +- arch/riscv/cpu/cpu.c | 5 +- arch/riscv/include/asm/system.h | 5 + arch/riscv/lib/spl.c | 3 +- arch/sandbox/cpu/start.c | 8 +- arch/x86/cpu/baytrail/cpu.c | 4 +- arch/x86/cpu/broadwell/cpu.c | 4 +- arch/x86/cpu/ivybridge/cpu.c | 4 +- arch/x86/cpu/quark/quark.c | 4 +- arch/x86/include/asm/fsp2/fsp_api.h | 8 + arch/x86/lib/fsp2/fsp_init.c | 4 +- arch/x86/lib/spl.c | 5 +- arch/x86/lib/tpl.c | 10 - board/google/chromebook_coral/coral.c | 7 +- board/keymile/kmcent2/kmcent2.c | 4 +- .../keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c | 5 +- cmd/Kconfig | 8 + cmd/Makefile | 1 + cmd/event.c | 27 +++ common/Kconfig | 37 ++- common/Makefile | 2 + common/board_f.c | 13 +- common/board_r.c | 1 + common/event.c | 196 ++++++++++++++++ common/log.c | 1 + configs/chromebook_coral_defconfig | 1 + configs/kmcent2_defconfig | 2 +- configs/pg_wcom_expu1_defconfig | 1 + configs/pg_wcom_expu1_update_defconfig | 1 + configs/pg_wcom_seli8_defconfig | 1 + configs/pg_wcom_seli8_update_defconfig | 1 + configs/sandbox64_defconfig | 1 - configs/sandbox_defconfig | 1 - configs/sandbox_flattree_defconfig | 1 - configs/sandbox_spl_defconfig | 1 - configs/tools-only_defconfig | 1 - doc/build/gcc.rst | 17 ++ doc/develop/event.rst | 66 ++++++ doc/develop/index.rst | 1 + doc/usage/event.rst | 49 ++++ doc/usage/index.rst | 1 + drivers/core/Kconfig | 10 + drivers/core/device-remove.c | 8 + drivers/core/device.c | 9 + drivers/core/root.c | 5 + drivers/phy/nop-phy.c | 12 +- include/asm-generic/global_data.h | 13 ++ include/configs/km/pg-wcom-ls102xa.h | 2 - include/dm/device-internal.h | 10 + include/event.h | 210 ++++++++++++++++++ include/event_internal.h | 35 +++ include/init.h | 12 - include/log.h | 2 + scripts/event_dump.py | 115 ++++++++++ test/common/Makefile | 1 + test/common/event.c | 85 +++++++ test/py/tests/test_event_dump.py | 20 ++ test/test-main.c | 4 + tools/binman/elf.py | 58 ++++- 72 files changed, 1108 insertions(+), 86 deletions(-) create mode 100644 cmd/event.c create mode 100644 common/event.c create mode 100644 doc/develop/event.rst create mode 100644 doc/usage/event.rst create mode 100644 include/event.h create mode 100644 include/event_internal.h create mode 100755 scripts/event_dump.py create mode 100644 test/common/event.c create mode 100644 test/py/tests/test_event_dump.py -- 2.35.1.616.g0bdcbb4464-goog