From patchwork Sat Jan 10 20:28:39 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1453 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=1768076996; bh=jiFd77DZXBzF521tvdwOoJorEW4/nwqkKuBM1vdqabo=; 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=j2ZZ8M5WBpvpkKcqlrx8CUBAvQGUxzuLyRukA/SS21WLZJ6KXAnCoKHlJ3Rbf+T5T IcsRXkiaZQp4A+u0deEAN2k8BLHGsfzoxtvYBzP3+30tD6wa8r4RjJO5DvGLCHRj4c 0ipaDxXvu7ajZIB76YeefiG7sE38tza2qNqnNvT0grqpBa4z8atulLPzqu0YyDYC2e aSgzpFdN1kQySMyY4oyJOLuLgsBN4PNrci0AkFX+YUS7b89tjrHOg4dNrH+DKTjS6P vZw6BjCD4KEVN6MrCDPDXDt5xiCR9NGb0+hpXo//zcemlu+yH01C7i2KSAQ8Axt6wK BRVAquCWHQ8Jw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 648F169291 for ; Sat, 10 Jan 2026 13:29:56 -0700 (MST) 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 VkMyeOGYncFp for ; Sat, 10 Jan 2026 13:29:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768076996; bh=jiFd77DZXBzF521tvdwOoJorEW4/nwqkKuBM1vdqabo=; 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=j2ZZ8M5WBpvpkKcqlrx8CUBAvQGUxzuLyRukA/SS21WLZJ6KXAnCoKHlJ3Rbf+T5T IcsRXkiaZQp4A+u0deEAN2k8BLHGsfzoxtvYBzP3+30tD6wa8r4RjJO5DvGLCHRj4c 0ipaDxXvu7ajZIB76YeefiG7sE38tza2qNqnNvT0grqpBa4z8atulLPzqu0YyDYC2e aSgzpFdN1kQySMyY4oyJOLuLgsBN4PNrci0AkFX+YUS7b89tjrHOg4dNrH+DKTjS6P vZw6BjCD4KEVN6MrCDPDXDt5xiCR9NGb0+hpXo//zcemlu+yH01C7i2KSAQ8Axt6wK BRVAquCWHQ8Jw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 54CD369281 for ; Sat, 10 Jan 2026 13:29:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768076993; bh=j7knzbEoRTTqQh7yb6kuV9hiZ3XCGozElkVaCVuosF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z3FsFJsEz9ta78Tj4xjsmQR/8YZlZwEhMQdn6CP++3ElEAMfY27f+PQCl96CRbo8B PJ9m4DbHv/T8pS5i+9eoq9Kmuiy3XtBxatgOQSzg0t/sfEt0NPwfRCIKYYbW/6TpEa zNNJ56qkiWJavsTQ3I9UIdgb+Gq9vIsPUxYCVMibj2uMyamK63yoc5shdXW4QnWb1j NOGJoyqvW2fDGy7JTtXXcjHwE5KzWD3EowkMJlm+atQyHQLf72VAORgnmkPhck6ju/ LDy3D8kxPYQnlNcaez4DVKVu+TW4cGnJTvF7TAZYsuXKeSmTO2ps2ROqpv/CBYQdqF Th0myeAn1qjnw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9568B69186; Sat, 10 Jan 2026 13:29:53 -0700 (MST) 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 MmKf8HZ4cKcY; Sat, 10 Jan 2026 13:29:53 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768076989; bh=IWSgUaE0NZEyGcp/U+TyrcyqllErGds+o9Lx/MEVe0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KR19NACn0IL7Log4/DfNBciYe/CtY3/3aKJ3JMM0vFLKlhebjsuKQzbDqA9+mSJh7 kScfF9EiwVhh3IgWWUbdmLA5n7LOiCwQBS+p1EwOV0NzLQuqkAsBwUwqlCwUPbSa8t bq7kQR/+ARp24n/ThiKD3AAP7kfv9A21CBNjPZvDnO2qYuVrjShDCiSJuSoUw200Lr YoTLXyElziu0/HzJdvZHZIpcEYxOqk+dyJRQuhyj7Vh7qkZ5aX5cHfVxu7oygX4Uds pVmUC9fBBxRZQt83ARKs1LBD3Cs1JJQ1S+fVsBaTAOVRam/IK6fGaC6xm5CQLiNL/4 0vQSxzCratPAg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2D2836927E; Sat, 10 Jan 2026 13:29:49 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 10 Jan 2026 13:28:39 -0700 Message-ID: <20260110202906.187370-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260110202906.187370-1-sjg@u-boot.org> References: <20260110202906.187370-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: OFDNMV2DVDBP3IWWYYFY6Q6XRUDOVLBP X-Message-ID-Hash: OFDNMV2DVDBP3IWWYYFY6Q6XRUDOVLBP 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: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/26] boot: pxe: Simplify pxe_parse_include() to take only address 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 Change pxe_parse_include() to take just the memory address instead of both a buffer pointer and address. The function now calls map_sysmem() internally to get the buffer, simplifying the caller interface. Move the function to the bottom of the header file while we are here, since it will form part of the new API. Also mark 'inc' const since it is not used. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/pxe_utils.c | 18 +++++++++++------- include/pxe_utils.h | 31 +++++++++++++++---------------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index b55d736beb8..384a4e4f8ab 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -1035,7 +1035,6 @@ int pxe_process_includes(struct pxe_context *ctx, struct pxe_menu *cfg, ulong base) { struct pxe_include *inc; - char *buf; uint i; int r; @@ -1053,9 +1052,7 @@ int pxe_process_includes(struct pxe_context *ctx, struct pxe_menu *cfg, return r; } - buf = map_sysmem(base, 0); - r = pxe_parse_include(ctx, inc, buf, base); - unmap_sysmem(buf); + r = pxe_parse_include(ctx, inc, base); if (r < 0) return r; @@ -1064,10 +1061,17 @@ int pxe_process_includes(struct pxe_context *ctx, struct pxe_menu *cfg, return 0; } -int pxe_parse_include(struct pxe_context *ctx, struct pxe_include *inc, - char *buf, ulong base) +int pxe_parse_include(struct pxe_context *ctx, const struct pxe_include *inc, + ulong addr) { - return parse_pxefile_top(ctx, buf, base, inc->cfg, inc->nest_level); + char *buf; + int ret; + + buf = map_sysmem(addr, 0); + ret = parse_pxefile_top(ctx, buf, addr, inc->cfg, inc->nest_level); + unmap_sysmem(buf); + + return ret; } /* diff --git a/include/pxe_utils.h b/include/pxe_utils.h index a03e00e2a4a..f6ee0417a9b 100644 --- a/include/pxe_utils.h +++ b/include/pxe_utils.h @@ -299,22 +299,6 @@ struct pxe_menu *parse_pxefile(struct pxe_context *ctx, ulong menucfg); int pxe_process_includes(struct pxe_context *ctx, struct pxe_menu *cfg, ulong base); -/** - * pxe_parse_include() - Parse an included file into its target menu - * - * After loading an include file referenced in cfg->includes, call this - * to parse it and merge any labels into the target menu. This may add - * more entries to cfg->includes if the included file has its own includes. - * - * @ctx: PXE context - * @inc: Include info with path and target menu - * @buf: Buffer containing the included file content - * @base: Memory address where buf is located - * Return: 1 on success, -ve on error - */ -int pxe_parse_include(struct pxe_context *ctx, struct pxe_include *inc, - char *buf, ulong base); - /** * format_mac_pxe() - Convert a MAC address to PXE format * @@ -512,4 +496,19 @@ int parse_pxefile_top(struct pxe_context *ctx, char *p, ulong base, */ void label_destroy(struct pxe_label *label); +/** + * pxe_parse_include() - Parse an included file into its target menu + * + * After loading an include file referenced in cfg->includes, call this + * to parse it and merge any labels into the target menu. This may add + * more entries to cfg->includes if the included file has its own includes. + * + * @ctx: PXE context + * @inc: Include info with path and target menu + * @addr: Memory address where file is located + * Return: 1 on success, -ve on error + */ +int pxe_parse_include(struct pxe_context *ctx, const struct pxe_include *inc, + ulong addr); + #endif /* __PXE_UTILS_H */