From patchwork Tue Oct 18 11:43:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 616042 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2571060pvb; Tue, 18 Oct 2022 04:46:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ETc+RyV+qIxsqAyKadcT/ous0O21f88uvsA98DfiZIybzqzSpgVOWPA94zQdcihvRIF50 X-Received: by 2002:a63:4e16:0:b0:43f:3554:ff9c with SMTP id c22-20020a634e16000000b0043f3554ff9cmr2347396pgb.578.1666093614933; Tue, 18 Oct 2022 04:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666093614; cv=none; d=google.com; s=arc-20160816; b=XJAEFNeAj1gM3NwEPiXcXucODertYSpMAIx3Hkl9CsQ5Z4Ypdyde8UujofjDs67616 YTSxl+KU5NgLVgSvjMJ7xV6CkXJlb3cROAPcX278kpoItEWSUD5jJUfJtGPqFXxXTffj HEnMVBrpqsLwyCKBvpOMk9hmXwHM4Mry3YHY5t/HtS4Eb7/GXQaNs3qRYfN9FBxWYkzL v3dGsPsHdNnZbrQQzw982Nx56lizgnRtcb0welMnykpmFvUVhqVWU9fqsXEqB8z0Z5YS YKcauU/hTdGShexgglmASdwq2XTjH7jEClhlvGbcSx692FKXYz/QxtrcISWLcgqoQ547 wjcw== 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=GY93zVh/xBpL639G6Vw4uzNRUbNME9CAvtSUa+LEyZ8=; b=mk37+0+ZhlM+IdczHxJelpDJU1xSuk0eN0mK4wmdqZTwSE1yh7pBRWyRPkAUNqzuOK PpE9kK+mUjivmotYCyMI7H9Zq/I4ttD8+trDiOFne1wzUmXWwvXJ+CQi1xnTtffcKRBQ PfbMFh3jMY/jr6PZQTTZCKtMYW5V+mefegsN5rUrN2gJlcfL6hwKlsk0+x/xdCrkgNYI +3KRm0moKpZLXxM04nEylbDtDQdNYzS9hausBRwKYkn+Cz4x0gNSZQKXlW/Ybc1j4tvI fxipaZFk+7msTbrO8nSTHIvyGgaqcyScbkrZ8LYIFJj48PcbqyIu1yba2l3FpGboV5yg LDdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id x19-20020a17090a8a9300b0020d401a03b5si13635034pjn.180.2022.10.18.04.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Oct 2022 04:46:54 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 5875484F6E; Tue, 18 Oct 2022 13:46:49 +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 2FDAB84F79; Tue, 18 Oct 2022 13:44:46 +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 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 148FE84F73 for ; Tue, 18 Oct 2022 13:44:34 +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 AD1B9113E; Tue, 18 Oct 2022 04:44:39 -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 CF4973F7D8; Tue, 18 Oct 2022 04:44:29 -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 v14 08/15] event: Add an event for main_loop Date: Tue, 18 Oct 2022 17:13:30 +0530 Message-Id: <20221018114337.439816-9-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221018114337.439816-1-sughosh.ganu@linaro.org> References: <20221018114337.439816-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 Acked-by: Etienne Carriere --- Changes since V13: None 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 92ca2066ee..62e5e783f1 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -579,6 +579,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 3e6dcbc3dd..e4580b6835 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 };