From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Thu, 11 Dec 2025 22:01:33 +0100 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vTnn3-00AQnD-2G for lore@lore.pengutronix.de; Thu, 11 Dec 2025 22:01:33 +0100 Received: from bombadil.infradead.org ([2607:7c80:54:3::133]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1vTnn2-0004M1-TQ for lore@pengutronix.de; Thu, 11 Dec 2025 22:01:33 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=O7JYfUD/YnxmjHssWHk6qQHfhCr1b0gCWoPZbPBSNhs=; b=j/rG9gt/BE9+vm9yX+9OS5zmzG qdPMtG4bOfX5yCRuurnzmys8UgdpX19Fioc0b8SDdMGtuq7+6cQrnLMzZH1OBxav4pVaO2UhceYFS sKbys9yji5wLFkFUgL45Ka4/Fht4ilzH36NC7cnhBIt+TWY9GQtQs2veolAxyKkLVy+tAwHoCHdoe nS3uZisiPLHEBQtTlOwPhb5dtN97FM6bWFek6Z6Pbd+av71ubHsOHpMqnSaiPg6orzCB/ER+iiDLm 3GoNI0i5gqZYOgTubVUvIG3eTx/3LQrxh/IzuWw5WPtosi/fBf85IsBs5XYYxwFqLmqVlZZ8chfUY Ye+O77Ow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vTnmT-0000000HIxO-2dlQ; Thu, 11 Dec 2025 21:00:57 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vTnmO-0000000HIu4-0SBg for barebox@lists.infradead.org; Thu, 11 Dec 2025 21:00:53 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1vTnmM-0003vK-Fy; Thu, 11 Dec 2025 22:00:50 +0100 Received: from dude05.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::54]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vTnmM-005Ba2-0v; Thu, 11 Dec 2025 22:00:50 +0100 Received: from localhost ([::1] helo=dude05.red.stw.pengutronix.de) by dude05.red.stw.pengutronix.de with esmtp (Exim 4.98.2) (envelope-from ) id 1vTnmM-0000000DJ5q-0k6j; Thu, 11 Dec 2025 22:00:50 +0100 From: Ahmad Fatoum To: barebox@lists.infradead.org Cc: Ahmad Fatoum Date: Thu, 11 Dec 2025 22:00:47 +0100 Message-ID: <20251211210049.3170349-5-a.fatoum@pengutronix.de> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251211210049.3170349-1-a.fatoum@pengutronix.de> References: <20251211210049.3170349-1-a.fatoum@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251211_130052_182229_D0917C6F X-CRM114-Status: GOOD ( 11.80 ) X-BeenThere: barebox@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "barebox" X-SA-Exim-Connect-IP: 2607:7c80:54:3::133 X-SA-Exim-Mail-From: barebox-bounces+lore=pengutronix.de@lists.infradead.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-4.0 required=4.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Subject: [PATCH 5/5] boot: assign names to bootentry providers X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on metis.whiteo.stw.pengutronix.de) This allows board- or functionality-specific (like EFI loader support) to invoke a specific bootentry provider by name. Signed-off-by: Ahmad Fatoum --- arch/arm/boards/protonic-imx6/board.c | 1 + common/blspec.c | 1 + common/boot.c | 15 +++++++++++++++ common/bootchooser.c | 1 + common/bootdef.c | 1 + include/boot.h | 2 ++ 6 files changed, 21 insertions(+) diff --git a/arch/arm/boards/protonic-imx6/board.c b/arch/arm/boards/protonic-imx6/board.c index 80558ce15817..c15a349c8a88 100644 --- a/arch/arm/boards/protonic-imx6/board.c +++ b/arch/arm/boards/protonic-imx6/board.c @@ -461,6 +461,7 @@ static int prt_imx6_bootentry_generate(struct bootentries *bootentries, } static struct bootentry_provider prt_imx6_bootentry_provider = { + .name = "prt-imx6", .generate = prt_imx6_bootentry_generate, }; diff --git a/common/blspec.c b/common/blspec.c index bc2c3204ad62..624e4c115272 100644 --- a/common/blspec.c +++ b/common/blspec.c @@ -639,6 +639,7 @@ static int blspec_bootentry_generate(struct bootentries *bootentries, } static struct bootentry_provider blspec_bootentry_provider = { + .name = "blspec", .generate = blspec_bootentry_generate, }; diff --git a/common/boot.c b/common/boot.c index 14525d31ae2d..1059e6d995d3 100644 --- a/common/boot.c +++ b/common/boot.c @@ -288,6 +288,21 @@ int bootentry_register_provider(struct bootentry_provider *p) return 0; } +struct bootentry_provider *get_bootentry_provider(const char *name) +{ + struct bootentry_provider *p; + + if (!name) + return NULL; + + list_for_each_entry(p, &bootentry_providers, list) { + if (streq_ptr(p->name, name)) + return p; + } + + return NULL; +} + /* * nfs_find_mountpath - Check if a given url is already mounted */ diff --git a/common/bootchooser.c b/common/bootchooser.c index a79eee8ca2c4..2905a0ca677e 100644 --- a/common/bootchooser.c +++ b/common/bootchooser.c @@ -962,6 +962,7 @@ static int bootchooser_add_entry(struct bootentries *entries, const char *name) } static struct bootentry_provider bootchooser_entry_provider = { + .name = "bootchooser", .generate = bootchooser_add_entry, }; diff --git a/common/bootdef.c b/common/bootdef.c index e8140d3a6bce..85471d92d3c5 100644 --- a/common/bootdef.c +++ b/common/bootdef.c @@ -31,6 +31,7 @@ static int bootdef_add_entry(struct bootentries *entries, const char *name) } static struct bootentry_provider bootdef_entry_provider = { + .name = "bootdef", .generate = bootdef_add_entry, }; diff --git a/include/boot.h b/include/boot.h index c1676364cadc..ae32b9ead93f 100644 --- a/include/boot.h +++ b/include/boot.h @@ -26,12 +26,14 @@ struct bootentry { int bootentries_add_entry(struct bootentries *entries, struct bootentry *entry); struct bootentry_provider { + const char *name; int (*generate)(struct bootentries *bootentries, const char *name); /* internal fields */ struct list_head list; }; int bootentry_register_provider(struct bootentry_provider *provider); +struct bootentry_provider *get_bootentry_provider(const char *name); #define bootentries_for_each_entry(bootentries, entry) \ list_for_each_entry(entry, &bootentries->entries, list) -- 2.47.3