Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216028/?format=api
{ "id": 2216028, "url": "http://patchwork.ozlabs.org/api/patches/2216028/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20260325165431.1027591-5-sjg@chromium.org/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "name": "U-Boot", "link_name": "uboot", "list_id": "u-boot.lists.denx.de", "list_email": "u-boot@lists.denx.de", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260325165431.1027591-5-sjg@chromium.org>", "list_archive_url": null, "date": "2026-03-25T16:54:13", "name": "[04/13] boot: Move type and OS checking into a new function", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ce2f5a8b7ea06b829bca1bdda6e30220c9151ba8", "submitter": { "id": 6170, "url": "http://patchwork.ozlabs.org/api/people/6170/?format=api", "name": "Simon Glass", "email": "sjg@chromium.org" }, "delegate": { "id": 3651, "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api", "username": "trini", "first_name": "Tom", "last_name": "Rini", "email": "trini@ti.com" }, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20260325165431.1027591-5-sjg@chromium.org/mbox/", "series": [ { "id": 497475, "url": "http://patchwork.ozlabs.org/api/series/497475/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=497475", "date": "2026-03-25T16:54:09", "name": "boot: Make fit_image_load() easier to maintain", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497475/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216028/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216028/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<u-boot-bounces@lists.denx.de>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256\n header.s=google header.b=QQsUzcrP;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org", "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de", "phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org\n header.b=\"QQsUzcrP\";\n\tdkim-atps=neutral", "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org", "phobos.denx.de;\n spf=pass smtp.mailfrom=sjg@chromium.org" ], "Received": [ "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgtMv2hXnz1y1K\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 03:56:11 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id C4D6F83FA7;\n\tWed, 25 Mar 2026 17:55:45 +0100 (CET)", "by phobos.denx.de (Postfix, from userid 109)\n id 2359383FB6; Wed, 25 Mar 2026 17:55:44 +0100 (CET)", "from mail-oi1-x233.google.com (mail-oi1-x233.google.com\n [IPv6:2607:f8b0:4864:20::233])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id D25D583FAF\n for <u-boot@lists.denx.de>; Wed, 25 Mar 2026 17:55:41 +0100 (CET)", "by mail-oi1-x233.google.com with SMTP id\n 5614622812f47-466f1c3c627so5325b6e.1\n for <u-boot@lists.denx.de>; Wed, 25 Mar 2026 09:55:41 -0700 (PDT)", "from chromium.org ([73.34.74.121]) by smtp.gmail.com with ESMTPSA id\n 5614622812f47-46a7099df08sm30481b6e.15.2026.03.25.09.55.36\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 25 Mar 2026 09:55:38 -0700 (PDT)" ], "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de", "X-Spam-Level": "", "X-Spam-Status": "No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=chromium.org; s=google; t=1774457739; x=1775062539; darn=lists.denx.de;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=DsVAD4+4Y029fRGCZEiSkMOUYbOgsQQ3d5i8iCrRDW4=;\n b=QQsUzcrPTnWdblUBfMxN2KdAmWO6FbgUtoJE89EGZ8vFV8dZ+iFK+9u96xskRkDjdv\n BQ71vurOyi5GWI4IawaBIJ21kn7ZnXoygX0s0v0GHeHlwYeubqBa/ufMuYvuB37KLqw1\n 9cfFjQxSL0egZa+nCQEqx3WpoMGIivASjr4zw=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774457739; x=1775062539;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=DsVAD4+4Y029fRGCZEiSkMOUYbOgsQQ3d5i8iCrRDW4=;\n b=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5c7f5165mr2049323b6e.57.1774457739493;\n Wed, 25 Mar 2026 09:55:39 -0700 (PDT)", "From": "Simon Glass <sjg@chromium.org>", "To": "u-boot@lists.denx.de", "Cc": "Simon Glass <sjg@chromium.org>,\n James Hilliard <james.hilliard1@gmail.com>,\n Jonas Karlman <jonas@kwiboo.se>,\n Marek Vasut <marek.vasut+renesas@mailbox.org>,\n Mayuresh Chitale <mchitale@ventanamicro.com>,\n Neil Armstrong <neil.armstrong@linaro.org>,\n Quentin Schulz <quentin.schulz@cherry.de>,\n Shiji Yang <yangshiji66@outlook.com>, Tom Rini <trini@konsulko.com>,\n Wolfgang Wallner <wolfgang.wallner@at.abb.com>", "Subject": "[PATCH 04/13] boot: Move type and OS checking into a new function", "Date": "Wed, 25 Mar 2026 10:54:13 -0600", "Message-ID": "<20260325165431.1027591-5-sjg@chromium.org>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20260325165431.1027591-1-sjg@chromium.org>", "References": "<20260325165431.1027591-1-sjg@chromium.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "u-boot@lists.denx.de", "X-Mailman-Version": "2.1.39", "Precedence": "list", "List-Id": "U-Boot discussion <u-boot.lists.denx.de>", "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>", "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>", "List-Post": "<mailto:u-boot@lists.denx.de>", "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>", "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>", "Errors-To": "u-boot-bounces@lists.denx.de", "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>", "X-Virus-Scanned": "clamav-milter 0.103.8 at phobos.denx.de", "X-Virus-Status": "Clean" }, "content": "Move the code which checks whether the image can be loaded into a\nseparate check_allowed() function.\n\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\n boot/image-fit.c | 98 ++++++++++++++++++++++++++++++------------------\n include/image.h | 4 +-\n 2 files changed, 63 insertions(+), 39 deletions(-)", "diff": "diff --git a/boot/image-fit.c b/boot/image-fit.c\nindex 5680cc8b496..3a6120e9151 100644\n--- a/boot/image-fit.c\n+++ b/boot/image-fit.c\n@@ -2177,9 +2177,64 @@ static int select_image(const void *fit, struct bootm_headers *images,\n \treturn noffset;\n }\n \n+/**\n+ * check_allowed() - Check if an image is allowed to be loaded\n+ *\n+ * @fit: FIT to check\n+ * @noffset: Node offset of the image being loaded\n+ * @image_type: Type of the image\n+ * @arch: Expected architecture for the image\n+ * @bootstage_id: ID of starting bootstage to use for progress updates\n+ * Return: 0 if OK, -EIO if not\n+ */\n+static int check_allowed(const void *fit, int noffset,\n+\t\t\t enum image_type_t image_type, enum image_arch_t arch,\n+\t\t\t int bootstage_id)\n+{\n+\tbool type_ok, os_ok;\n+\tuint8_t os;\n+\n+\tbootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL);\n+\ttype_ok = fit_image_check_type(fit, noffset, image_type) ||\n+\t\t fit_image_check_type(fit, noffset, IH_TYPE_FIRMWARE) ||\n+\t\t fit_image_check_type(fit, noffset, IH_TYPE_TEE) ||\n+\t\t fit_image_check_type(fit, noffset, IH_TYPE_TFA_BL31) ||\n+\t\t (image_type == IH_TYPE_KERNEL &&\n+\t\t fit_image_check_type(fit, noffset, IH_TYPE_KERNEL_NOLOAD));\n+\n+\tos_ok = image_type == IH_TYPE_FLATDT ||\n+\t\timage_type == IH_TYPE_FPGA ||\n+\t\tfit_image_check_os(fit, noffset, IH_OS_LINUX) ||\n+\t\tfit_image_check_os(fit, noffset, IH_OS_U_BOOT) ||\n+\t\tfit_image_check_os(fit, noffset, IH_OS_TEE) ||\n+\t\tfit_image_check_os(fit, noffset, IH_OS_OPENRTOS) ||\n+\t\tfit_image_check_os(fit, noffset, IH_OS_EFI) ||\n+\t\tfit_image_check_os(fit, noffset, IH_OS_VXWORKS) ||\n+\t\tfit_image_check_os(fit, noffset, IH_OS_ELF);\n+\n+\t/*\n+\t * If either of the checks fail, we should report an error, but\n+\t * if the image type is coming from the \"loadables\" field, we\n+\t * don't care what it is\n+\t */\n+\tif ((!type_ok || !os_ok) && image_type != IH_TYPE_LOADABLE) {\n+\t\tfit_image_get_os(fit, noffset, &os);\n+\t\tprintf(\"No %s %s %s Image\\n\",\n+\t\t genimg_get_os_name(os),\n+\t\t genimg_get_arch_name(arch),\n+\t\t genimg_get_type_name(image_type));\n+\t\tbootstage_error(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL);\n+\t\treturn -EIO;\n+\t}\n+\n+\tbootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL_OK);\n+\n+\treturn 0;\n+}\n+\n int fit_image_load(struct bootm_headers *images, ulong addr,\n \t\t const char **fit_unamep, const char **fit_uname_configp,\n-\t\t int arch, int ph_type, int bootstage_id,\n+\t\t enum image_arch_t arch, int ph_type, int bootstage_id,\n \t\t enum fit_load_op load_op, ulong *datap, ulong *lenp)\n {\n \tint image_type = image_ph_type(ph_type);\n@@ -2191,10 +2246,10 @@ int fit_image_load(struct bootm_headers *images, ulong addr,\n \tvoid *buf;\n \tvoid *loadbuf;\n \tsize_t size;\n-\tint type_ok, os_ok;\n \tulong load, load_end, data, len;\n-\tuint8_t os, comp, os_arch;\n+\tuint8_t comp, os_arch;\n \tconst char *prop_name;\n+\tint ret;\n \n \tfit = map_sysmem(addr, 0);\n \tprop_name = fit_get_image_type_property(ph_type);\n@@ -2221,40 +2276,9 @@ int fit_image_load(struct bootm_headers *images, ulong addr,\n \tfit_image_get_arch(fit, noffset, &os_arch);\n \timages_set_arch(images, os_arch);\n \n-\tbootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL);\n-\ttype_ok = fit_image_check_type(fit, noffset, image_type) ||\n-\t\t fit_image_check_type(fit, noffset, IH_TYPE_FIRMWARE) ||\n-\t\t fit_image_check_type(fit, noffset, IH_TYPE_TEE) ||\n-\t\t fit_image_check_type(fit, noffset, IH_TYPE_TFA_BL31) ||\n-\t\t (image_type == IH_TYPE_KERNEL &&\n-\t\t fit_image_check_type(fit, noffset, IH_TYPE_KERNEL_NOLOAD));\n-\n-\tos_ok = image_type == IH_TYPE_FLATDT ||\n-\t\timage_type == IH_TYPE_FPGA ||\n-\t\tfit_image_check_os(fit, noffset, IH_OS_LINUX) ||\n-\t\tfit_image_check_os(fit, noffset, IH_OS_U_BOOT) ||\n-\t\tfit_image_check_os(fit, noffset, IH_OS_TEE) ||\n-\t\tfit_image_check_os(fit, noffset, IH_OS_OPENRTOS) ||\n-\t\tfit_image_check_os(fit, noffset, IH_OS_EFI) ||\n-\t\tfit_image_check_os(fit, noffset, IH_OS_VXWORKS) ||\n-\t\tfit_image_check_os(fit, noffset, IH_OS_ELF);\n-\n-\t/*\n-\t * If either of the checks fail, we should report an error, but\n-\t * if the image type is coming from the \"loadables\" field, we\n-\t * don't care what it is\n-\t */\n-\tif ((!type_ok || !os_ok) && image_type != IH_TYPE_LOADABLE) {\n-\t\tfit_image_get_os(fit, noffset, &os);\n-\t\tprintf(\"No %s %s %s Image\\n\",\n-\t\t genimg_get_os_name(os),\n-\t\t genimg_get_arch_name(arch),\n-\t\t genimg_get_type_name(image_type));\n-\t\tbootstage_error(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL);\n-\t\treturn -EIO;\n-\t}\n-\n-\tbootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ALL_OK);\n+\tret = check_allowed(fit, noffset, image_type, arch, bootstage_id);\n+\tif (ret)\n+\t\treturn ret;\n \n \t/* get image data address and length */\n \tif (fit_image_get_data(fit, noffset, (const void **)&buf, &size)) {\ndiff --git a/include/image.h b/include/image.h\nindex 5e11dc92559..726d82deb22 100644\n--- a/include/image.h\n+++ b/include/image.h\n@@ -111,7 +111,7 @@ enum {\n * New IDs *MUST* be appended at the end of the list and *NEVER*\n * inserted for backward compatibility.\n */\n-enum {\n+enum image_arch_t {\n \tIH_ARCH_INVALID\t\t= 0,\t/* Invalid CPU\t*/\n \tIH_ARCH_ALPHA,\t\t\t/* Alpha\t*/\n \tIH_ARCH_ARM,\t\t\t/* ARM\t\t*/\n@@ -760,7 +760,7 @@ int boot_get_fdt_fit(struct bootm_headers *images, ulong addr,\n */\n int fit_image_load(struct bootm_headers *images, ulong addr,\n \t\t const char **fit_unamep, const char **fit_uname_configp,\n-\t\t int arch, int image_ph_type, int bootstage_id,\n+\t\t enum image_arch_t arch, int image_ph_type, int bootstage_id,\n \t\t enum fit_load_op load_op, ulong *datap, ulong *lenp);\n \n /**\n", "prefixes": [ "04/13" ] }