From patchwork Thu Sep 15 08:14:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 606195 Delivered-To: patch@linaro.org Received: by 2002:ab3:1c02:0:b0:1e7:4ce8:c350 with SMTP id u2csp146964lth; Thu, 15 Sep 2022 01:17:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR56RNtUgk0jRh+mKeFtS1OVStKWuAkmlucGitizYOkvcOv6IbZjwUUU3a4ma55MTgo1zZp2 X-Received: by 2002:a17:907:9805:b0:77b:cbe2:c5dd with SMTP id ji5-20020a170907980500b0077bcbe2c5ddmr16151926ejc.41.1663229825273; Thu, 15 Sep 2022 01:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663229825; cv=none; d=google.com; s=arc-20160816; b=d9RvTTtiJQ7QJGNy5SFvE0KnhpsWIhDE7hntne6HoCqtSgJM4R6wXYaUrnsj07s8xI 3mgryFGpTDn3w0Ykr06PUN1gvZnL0bbnxhOQh6ZmIPEqiwGukOxno0Dw0YqCo5Kb7TcK 3jgGhUM7P/3mKTGyYodJk8y78VDj61Wq/mA9jUssU1DpiRqJnXTZArSMuL6Lperzcc/o xeFJn91xonUizNWo1Ur++EJb/uyBYN+rIwKRiyuFJw0C5qdAcUDRfPNzl8BPgU9b3Ssm gKrO66une060rNOrwvutaaEKruqqukD2oT2DAHJMsJgFKegspddQLtlhBwKqotBN9eXP r9yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=8FjBU5yxOaYMtLgep5gyh0oKnI1AU9buHO6Za+23J58=; b=C5p1jQQ8aBS7/sSEV4wvlFXB7weMV2N40nIYCdj4DP8kYAgRuAapmggxxfb4C7hVPU 45qXKJuYHMC5YW7vi0e3lXQlH7bBH/PnGy7udHLNhjRCXpFoG1E5W3/+58wz28tlTGSo iC955XnQ9DUTsGm/KdtJFaL5mIGy8/3ZU0bAHizr0OGxI/7twbSLpLvdzBDbJaza9gd2 BCeBHzqI5hRyMfAB/8KahQmtq2wBZnFKbCcm9B/MPhw/kAnGDe6VHXTW9aKGt8i6Efhr dh/ERtJ2ikRNPNaqOUWwraU9Q7yMPHLDeCjVPKzJycZWO1jHo3zgoHtIAkWRt56uMZz0 0JMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id u26-20020a50951a000000b0045102ae16fesi13030184eda.201.2022.09.15.01.17.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 01:17:05 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 68A1A84B73; Thu, 15 Sep 2022 10:16:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 2E98684B97; Thu, 15 Sep 2022 10:15:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id CA39184B67 for ; Thu, 15 Sep 2022 10:15:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B7B811692; Thu, 15 Sep 2022 01:15:59 -0700 (PDT) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A4EF13F73B; Thu, 15 Sep 2022 01:15:49 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Takahiro Akashi , Patrick Delaunay , Patrice Chotard , Simon Glass , Bin Meng , Tom Rini , Etienne Carriere , Michal Simek , Jassi Brar , Sughosh Ganu Subject: [PATCH v10 08/15] event: Add an event for main_loop Date: Thu, 15 Sep 2022 13:44:44 +0530 Message-Id: <20220915081451.633983-9-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220915081451.633983-1-sughosh.ganu@linaro.org> References: <20220915081451.633983-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 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.6 at phobos.denx.de X-Virus-Status: Clean 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 Reviewed-by: Simon Glass Reviewed-by: Ilias Apalodimas --- Changes since V9: * Add a comment to indicate where the event notification will be called, as suggested by Simon. common/board_r.c | 3 +++ common/event.c | 3 +++ include/event.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/common/board_r.c b/common/board_r.c index 56eb60fa27..1db061e65c 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -576,6 +576,9 @@ static int run_main_loop(void) #ifdef CONFIG_SANDBOX sandbox_main_loop_init(); #endif + + event_notify_null(EVT_MAIN_LOOP); + /* main_loop() can return to retry autoboot, if so just run it again */ for (;;) main_loop(); diff --git a/common/event.c b/common/event.c index 3e34550978..231b9e6ffd 100644 --- a/common/event.c +++ b/common/event.c @@ -38,6 +38,9 @@ const char *const type_name[] = { /* fdt hooks */ "ft_fixup", + + /* main loop events */ + "main_loop", }; _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size"); diff --git a/include/event.h b/include/event.h index e8f2f55c63..8089b464b1 100644 --- a/include/event.h +++ b/include/event.h @@ -34,6 +34,9 @@ enum event_t { /* Device tree fixups before booting */ EVT_FT_FIXUP, + /* To be called once, before calling main_loop() */ + EVT_MAIN_LOOP, + EVT_COUNT };