From patchwork Sun Mar 22 23:57:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2043 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774223876; bh=lxr6+or2hQYay0Adh96S8qTy0sGSaLHtus/ulfzq2ZA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=NQoyrVvS37BgjvMWh2aL9/E6AMSA1On1fJgZ5nSMu7xuponsDtdZ2cyx9fvleW3HP u0N6k7TCJM48A35+XwArXn8T/tG0UvbaZBnqZG6c7jdizezIV+LELbeTu77CaOyplt r395wkHV73i4gKwCDGQOG7qjHdzGDugEmh5oH2E95CfVOI1fBNSoiAodHfcq4SWzA3 KypDBzacmL19c6stEdTGW619VnnyNdXGEpFR+4qXbJr0oj5tqsYIjZ5bZl7oK0G6DE ZBnoNNXRbAmTtglReUrmdh02gIUAxnrIejpxVGLzYaqcQRdnsITmhIYjNHf168mpeW Bd0GqkLfCujYQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 02FE76A1DA for ; Sun, 22 Mar 2026 17:57:56 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id RVeLp75MvPDl for ; Sun, 22 Mar 2026 17:57:55 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774223871; bh=lxr6+or2hQYay0Adh96S8qTy0sGSaLHtus/ulfzq2ZA=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=n13al/HSzhNRJ23HjyuEimiWnOOqnNlmS62gop/8aqx3b4jqyrCHXC5+Va1GvfBya d1fZIojNJPBll2dDIEPPRGwZLaowBMmsN/xptTCswEPnqcqkTcv207tZ+2nWUmq4Ep h9AN42YU4eAayZZGJif/58K/TsMuN/iKhDQyHCl6GKXDlBzKkv12NtEGZNhz9ggOg8 yvhLDvTdFgymqqt1H46m5eNZTOsVfbG8ZZ/ybaRuzyaCxkTNW6MAOIGe27vbx3FVlF ynQOk+7gqhfnan1twclhWEktiI0cCx+z4/FlcFfSSQsAK1Ewk1wxtzkc3u/1fx5mMc NqcwIvgMbjMEA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8FAC86A1EF for ; Sun, 22 Mar 2026 17:57:51 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774223868; bh=meSic3xTvFnVH2WZrK/IJapgAXpnjQtrcXFwZCBHnko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3ym2Puy9bTUfpqlHSdyKJ8CkubsPtmahRyoDLz+svYM7bf6XYDuowJrx5EUtPRc+ ZPpuMnEG7VuyYKqq2pvDhuup8GLwBxm47ZMsWuwXsN4dUXLF3HcbhYaRW70Zjubleu 3Erfo7toPaS8261xtQGT/9mCunr3HqDPvil9kgeoB1Fg0cn7ztRYFV8TnXRL92lzhC yVP0je+AmdSVWZ/aXB2NvUco7hBrMhgmmlyjSUtY+QfHO8MXHAgeViPj2kerWzQ8oE SHNg0bmq7YDGmuz8Mi0pGIOvUXymrV0hWMhxnh8ntesnsLJuMNaAYW7vDZmlamzYv5 H5dq3fopztEQQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 044ED6A1F3; Sun, 22 Mar 2026 17:57:48 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 0UEVQC7awqeX; Sun, 22 Mar 2026 17:57:47 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774223865; bh=eNy1xa6HV4Tkc7ywH9i6nYKWin+FxhexJ67mT0tLPXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f0KsNPDbWrA3VQm3eufjzkAS/L3aiMluzLsqF8uxkb18uamH/zYLTKufpqc9ZsHYv bRvvV3u/sNNVBEGdvZcfMXKWHbdwe3aDmK0iLoA5Z28tHXJgU73CcL8izKwSmub2Je 3o6P0OozFY8QOVu3jmFnjIcEP2TixV2MbtolSpzQk1SzYMDoIPKapcOy6a30fMVaYf z2l+jbVDV+qhT3d5VcZvy2gNBh6vzLaagVPbF46XwvEk9lcoYv1zeL3xeysaR+2ou+ QB5OLlHY/5+ks537MAnEQf+wc0QP0wlXrWbEeRKe4FtHdNRYCoUi3hic7TOVrsXVoH 1O3orKJLJBnUQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B45966A1DE; Sun, 22 Mar 2026 17:57:45 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Sun, 22 Mar 2026 17:57:09 -0600 Message-ID: <20260322235719.1729267-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260322235719.1729267-1-sjg@u-boot.org> References: <20260322235719.1729267-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: YDFDO2XZJA7INZV6CFIKF7GHUO6TOOK6 X-Message-ID-Hash: YDFDO2XZJA7INZV6CFIKF7GHUO6TOOK6 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/14] extlinux: Move pxe_context to new extlinux_priv struct List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Move struct pxe_context from extlinux_plat (platform data) to a new extlinux_priv (private runtime data), since the context is runtime state rather than configuration. The info field stays in extlinux_plat as it is only used temporarily during context setup. Add priv_auto to the extlinux and pxe drivers. The VBE driver is not changed here as it has its own priv struct (abrec_priv). This is a preparatory step towards replacing the single context with an alist of contexts for multi-entry support. Signed-off-by: Simon Glass --- boot/bootmeth_extlinux.c | 11 ++++++----- boot/bootmeth_pxe.c | 11 ++++++----- boot/ext_pxe_common.c | 4 ++-- include/extlinux.h | 13 ++++++++++--- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c index 1fd2547d2b3..ad2f32ca8a5 100644 --- a/boot/bootmeth_extlinux.c +++ b/boot/bootmeth_extlinux.c @@ -217,18 +217,18 @@ static int extlinux_read_bootflow(struct udevice *dev, struct bootflow *bflow) static int extlinux_local_boot(struct udevice *dev, struct bootflow *bflow) { - struct extlinux_plat *plat = dev_get_plat(dev); + struct extlinux_priv *priv = dev_get_priv(dev); - return extlinux_boot(dev, bflow, &plat->ctx, extlinux_getfile, true, + return extlinux_boot(dev, bflow, &priv->ctx, extlinux_getfile, true, bflow->fname, false); } #if CONFIG_IS_ENABLED(BOOTSTD_FULL) static int extlinux_local_read_all(struct udevice *dev, struct bootflow *bflow) { - struct extlinux_plat *plat = dev_get_plat(dev); + struct extlinux_priv *priv = dev_get_priv(dev); - return extlinux_read_all(dev, bflow, &plat->ctx, extlinux_getfile, + return extlinux_read_all(dev, bflow, &priv->ctx, extlinux_getfile, true, bflow->fname); } #endif @@ -267,5 +267,6 @@ U_BOOT_DRIVER(bootmeth_1extlinux) = { .of_match = extlinux_bootmeth_ids, .ops = &extlinux_bootmeth_ops, .bind = extlinux_bootmeth_bind, - .plat_auto = sizeof(struct extlinux_plat) + .plat_auto = sizeof(struct extlinux_plat), + .priv_auto = sizeof(struct extlinux_priv), }; diff --git a/boot/bootmeth_pxe.c b/boot/bootmeth_pxe.c index 91e05a44841..55e7f60c5cd 100644 --- a/boot/bootmeth_pxe.c +++ b/boot/bootmeth_pxe.c @@ -145,18 +145,18 @@ static int extlinux_pxe_read_file(struct udevice *dev, struct bootflow *bflow, static int extlinux_pxe_boot(struct udevice *dev, struct bootflow *bflow) { - struct extlinux_plat *plat = dev_get_plat(dev); + struct extlinux_priv *priv = dev_get_priv(dev); - return extlinux_boot(dev, bflow, &plat->ctx, extlinux_pxe_getfile, + return extlinux_boot(dev, bflow, &priv->ctx, extlinux_pxe_getfile, false, bflow->subdir, false); } #if CONFIG_IS_ENABLED(BOOTSTD_FULL) static int extlinux_pxe_read_all(struct udevice *dev, struct bootflow *bflow) { - struct extlinux_plat *plat = dev_get_plat(dev); + struct extlinux_priv *priv = dev_get_priv(dev); - return extlinux_read_all(dev, bflow, &plat->ctx, + return extlinux_read_all(dev, bflow, &priv->ctx, extlinux_pxe_getfile, false, bflow->subdir); } #endif @@ -193,5 +193,6 @@ U_BOOT_DRIVER(bootmeth_zpxe) = { .of_match = extlinux_bootmeth_pxe_ids, .ops = &extlinux_bootmeth_pxe_ops, .bind = extlinux_bootmeth_pxe_bind, - .plat_auto = sizeof(struct extlinux_plat) + .plat_auto = sizeof(struct extlinux_plat), + .priv_auto = sizeof(struct extlinux_priv), }; diff --git a/boot/ext_pxe_common.c b/boot/ext_pxe_common.c index 46302d3e962..5a4b6455a53 100644 --- a/boot/ext_pxe_common.c +++ b/boot/ext_pxe_common.c @@ -85,8 +85,8 @@ static int extlinux_setup(struct udevice *dev, struct bootflow *bflow, plat->info.dev = dev; plat->info.bflow = bflow; - ret = pxe_setup_ctx(ctx, getfile, &plat->info, allow_abs_path, bootfile, - false, plat->use_fallback, bflow); + ret = pxe_setup_ctx(ctx, getfile, &plat->info, allow_abs_path, + bootfile, false, plat->use_fallback, bflow); if (ret) return log_msg_ret("ctx", ret); log_debug("bootfl flags %x\n", bflow->flags); diff --git a/include/extlinux.h b/include/extlinux.h index cf9191874f0..66500f4c8cf 100644 --- a/include/extlinux.h +++ b/include/extlinux.h @@ -23,18 +23,25 @@ struct extlinux_info { }; /** - * struct extlinux_plat - locate state for this bootmeth + * struct extlinux_plat - platform data for this bootmeth * * @use_falllback: true to boot with the fallback option - * @ctx: holds the PXE context, if it should be saved * @info: information used for the getfile() method */ struct extlinux_plat { bool use_fallback; - struct pxe_context ctx; struct extlinux_info info; }; +/** + * struct extlinux_priv - private runtime data for this bootmeth + * + * @ctx: holds the PXE context + */ +struct extlinux_priv { + struct pxe_context ctx; +}; + /** * extlinux_set_property() - set an extlinux property *