From patchwork Sat Jan 10 20:28:41 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1455 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=1768077005; bh=JFXwrxke57U3S/RYGwKVsLp1Q6pWSF0WGg2CgS95bfE=; 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=QeOBvkuvazcngJOEwvv1RO8rt+A2q95qx1u8wb8sdFH4YgOwgWdw1vwq3a/HeNy5b AjWXw88iZAqxJmLqIXhoLM9x3+z2ZjG8JrfsvK48TzNXGl2OJuJ8exuoFJ9CwFxHjb gUMVPeAS5o1bbkpq8kJmikEpfNBeAk1OrRVl2rHMUX3ptsYAmvPSetkxz2N2tdB+xY gcEMbAKQPnjB6DFyT0P00DorVQCfAJtrqjfHRcHnEzG2rd4pyE21I7XaKCbbAMmMIT tSuzTV+wz7GW9t0LGXgu/lvbKMSMUXuU9OVlRtuhnvejXOnUBcS3MsE4XSFVcw0hw4 HH7+TvEb/Np6g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9809969299 for ; Sat, 10 Jan 2026 13:30:05 -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 UBJHRKeLEcBw for ; Sat, 10 Jan 2026 13:30:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768077005; bh=JFXwrxke57U3S/RYGwKVsLp1Q6pWSF0WGg2CgS95bfE=; 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=QeOBvkuvazcngJOEwvv1RO8rt+A2q95qx1u8wb8sdFH4YgOwgWdw1vwq3a/HeNy5b AjWXw88iZAqxJmLqIXhoLM9x3+z2ZjG8JrfsvK48TzNXGl2OJuJ8exuoFJ9CwFxHjb gUMVPeAS5o1bbkpq8kJmikEpfNBeAk1OrRVl2rHMUX3ptsYAmvPSetkxz2N2tdB+xY gcEMbAKQPnjB6DFyT0P00DorVQCfAJtrqjfHRcHnEzG2rd4pyE21I7XaKCbbAMmMIT tSuzTV+wz7GW9t0LGXgu/lvbKMSMUXuU9OVlRtuhnvejXOnUBcS3MsE4XSFVcw0hw4 HH7+TvEb/Np6g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6C27C69290 for ; Sat, 10 Jan 2026 13:30:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768077003; bh=izzoFRI0KAKm7agn9h2p7sB8hWex0BCEnjCZrH93Lzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p0mytBrGS/sczQIt+fFeqKfrKm/b8uUaB8GH+rc1DqonVyer/d/e29b/uXbWxutgj Y0eWHuTOkYFqIt1fD/akmSJ0a6YfLtAyCEC8kpGHdD/6nu8Bu+NJl0NlEsE5t/zX43 w9IxXRRxzLqiIEF4BZm6zQrISDSpJT4PxrYQtjHeang8SHJy228Kjj6Cr3dI07PiDU 9KxZt+ORltbbTsG5zE+ttOZolhqqNhfDWer8MbNtf+SokKdLkKYab4gwH3eJeLNklr 6yJme05+qJsGDupOY4Z1xENAX470kvYXVPgAsXYCLOLg3E5IdrTyNAbIETHgdhHCCo k8XCpXorUk8ug== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 67BAD69299; Sat, 10 Jan 2026 13:30:03 -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 vBC99DqMvpxz; Sat, 10 Jan 2026 13:30:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768076998; bh=v+G+VeTYvehjKERzzdbVtzdJN3O5bqCSFqL/Hfm476o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mrCulXrXioj3MQUkTx3L6joUPadsTmOZDz1AAs1vdhJAg96ylOpidkwzn3wsyEO/Q yCFXQwbNoRwAx2FpgY0rjBl0GsdJIumW5Sn/yQnotWOsUXA5VW4NqCIzdHoJgKdcXi s87ilzs3ftAmSsD6YbPInHcF8IQm+C4Vj0Ht0GQmFss1ltcioc2I4/97TdK+OwCF7f LlIgxM1qj100YLw0MfR9p/L2PX6MbO595VUXgeQ+kQT50yimFXNoj0adiV9KfDSTX/ 1WDk8ZiPPkhyl98CjlxxHAlFHUv2bui6LukDl6xz/e3pNt47w0cztvoJ2c2b46Pdt4 bmewE/9mMX1GA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8D6D869186; Sat, 10 Jan 2026 13:29:58 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 10 Jan 2026 13:28:41 -0700 Message-ID: <20260110202906.187370-10-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: MVQ37FOKYMTQTKRTT63QJ57UACJMXTXR X-Message-ID-Hash: MVQ37FOKYMTQTKRTT63QJ57UACJMXTXR 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 09/26] boot: pxe: Replace pxe_fdtoverlay with pxe_file 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 The new struct pxe_file provides a more general way to describe files that need to be loaded. Replace the FDT-overlay-specific struct with the new general-purpose one, setting the type field to PFT_FDTOVERLAY. This change prepares for moving away from callback-based file loading to a model where PXE returns a list of files to load and the caller handles the actual loading. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/pxe_parse.c | 8 +++++--- boot/pxe_utils.c | 4 ++-- include/pxe_utils.h | 13 +------------ test/boot/pxe.c | 12 ++++++------ 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/boot/pxe_parse.c b/boot/pxe_parse.c index f6b7887f603..29bee4d908c 100644 --- a/boot/pxe_parse.c +++ b/boot/pxe_parse.c @@ -106,14 +106,14 @@ static struct pxe_label *label_create(void) if (!label) return NULL; memset(label, 0, sizeof(struct pxe_label)); - alist_init_struct(&label->fdtoverlays, struct pxe_fdtoverlay); + alist_init_struct(&label->fdtoverlays, struct pxe_file); return label; } void label_destroy(struct pxe_label *label) { - struct pxe_fdtoverlay *overlay; + struct pxe_file *overlay; free(label->name); free(label->menu); @@ -326,7 +326,7 @@ static int parse_fdtoverlays(char **c, struct alist *overlays) start = val; while (*val) { - struct pxe_fdtoverlay item; + struct pxe_file item; char *end; /* Skip leading spaces */ @@ -345,7 +345,9 @@ static int parse_fdtoverlays(char **c, struct alist *overlays) item.path = strdup(val); val += strlen(val); } + item.type = PFT_FDTOVERLAY; item.addr = 0; + item.size = 0; if (!item.path || !alist_add(overlays, item)) { free(item.path); diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index 384a4e4f8ab..b4bcba422b8 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -308,7 +308,7 @@ static void label_boot_kaslrseed(struct pxe_context *ctx) static void label_load_fdtoverlays(struct pxe_context *ctx, struct pxe_label *label) { - struct pxe_fdtoverlay *overlay; + struct pxe_file *overlay; ulong fdtoverlay_addr; bool use_lmb; char *envaddr; @@ -357,7 +357,7 @@ static void label_load_fdtoverlays(struct pxe_context *ctx, static void label_apply_fdtoverlays(struct pxe_context *ctx, struct pxe_label *label) { - struct pxe_fdtoverlay *overlay; + struct pxe_file *overlay; struct fdt_header *blob; int err; diff --git a/include/pxe_utils.h b/include/pxe_utils.h index 2f194b91683..75437885dd3 100644 --- a/include/pxe_utils.h +++ b/include/pxe_utils.h @@ -24,17 +24,6 @@ * take a 'include file getter' function. */ -/** - * struct pxe_fdtoverlay - info about an FDT overlay - * - * @path: Path to the overlay file - * @addr: Address where the overlay was loaded (0 if not yet loaded) - */ -struct pxe_fdtoverlay { - char *path; - ulong addr; -}; - /** * struct pxe_label - describes a single label in a pxe file * @@ -50,7 +39,7 @@ struct pxe_fdtoverlay { * @initrd: path to the initrd to use for this label. * @fdt: path to FDT to use * @fdtdir: path to FDT directory to use - * @fdtoverlays: list of FDT overlays to apply (alist of struct pxe_fdtoverlay) + * @fdtoverlays: list of FDT overlays to apply (alist of struct pxe_file) * @files: list of files to load (alist of struct pxe_file) * @say: message to print when this label is selected for booting * @ipappend: flags for appending IP address (0x1) and MAC address (0x3) diff --git a/test/boot/pxe.c b/test/boot/pxe.c index 97049e27ab6..260fc918592 100644 --- a/test/boot/pxe.c +++ b/test/boot/pxe.c @@ -192,9 +192,9 @@ static int pxe_test_parse_norun(struct unit_test_state *uts) ut_assertnull(label->fdtdir); ut_asserteq(2, label->fdtoverlays.count); ut_asserteq_str("/dtb/overlay1.dtbo", - alist_get(&label->fdtoverlays, 0, struct pxe_fdtoverlay)->path); + alist_get(&label->fdtoverlays, 0, struct pxe_file)->path); ut_asserteq_str("/dtb/overlay2.dtbo", - alist_get(&label->fdtoverlays, 1, struct pxe_fdtoverlay)->path); + alist_get(&label->fdtoverlays, 1, struct pxe_file)->path); ut_asserteq_str("Booting default Linux kernel", label->say); ut_asserteq(0, label->ipappend); ut_asserteq(0, label->attempted); @@ -317,13 +317,13 @@ static int pxe_test_parse_norun(struct unit_test_state *uts) /* Verify overlays were loaded to valid addresses */ ut_assert(alist_get(&label->fdtoverlays, 0, - struct pxe_fdtoverlay)->addr >= PXE_OVERLAY_ADDR); + struct pxe_file)->addr >= PXE_OVERLAY_ADDR); ut_assert(alist_get(&label->fdtoverlays, 1, - struct pxe_fdtoverlay)->addr >= PXE_OVERLAY_ADDR); + struct pxe_file)->addr >= PXE_OVERLAY_ADDR); /* Second overlay should be at a higher address than the first */ - ut_assert(alist_get(&label->fdtoverlays, 1, struct pxe_fdtoverlay)->addr > - alist_get(&label->fdtoverlays, 0, struct pxe_fdtoverlay)->addr); + ut_assert(alist_get(&label->fdtoverlays, 1, struct pxe_file)->addr > + alist_get(&label->fdtoverlays, 0, struct pxe_file)->addr); /* Verify no more console output */ ut_assert_console_end();