Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EA11AECAAD5 for ; Sun, 28 Aug 2022 18:33:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5926A845E8; Sun, 28 Aug 2022 20:33:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="P3o7Exlm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 01B5A847EF; Sun, 28 Aug 2022 20:33:18 +0200 (CEST) Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 63CD3845E3 for ; Sun, 28 Aug 2022 20:33:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x22f.google.com with SMTP id r10so8176465oie.1 for ; Sun, 28 Aug 2022 11:33:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=g61Sp5DOnht/L87C3NBfXXG6ZOtMPdQbzCzZ2U/FM8c=; b=P3o7ExlmnazpHpGKuA268ITOsITTs52hxwUCAntW6dJo5f35TKtUx8Jsu5YHihuSZB VTTxh6fdCHM3VcRmuk9j8kx2jXO9F7cQ67RDTjHP3eeoY1hNjOf3fvuXL9aV4AK73QEE 3B1WfjmqUnHgouP6HpkILJuSNxnZ1w6uyvzYg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=g61Sp5DOnht/L87C3NBfXXG6ZOtMPdQbzCzZ2U/FM8c=; b=y0u1NRfhaM8y25apv1vuvD5tcGGBcQc90pTt4w4TjVd5sNQUA54W5TUTWZ+lSXjHA+ x+lSOGDhSQmakGvxvYKDF2CYrAAP4117XwiaadJA+1y1Z+wyPnOOyCtf7Ye9nNL9rE3r vKRxlfEYonc0wVN3/ExVfD+pt1Xm7q/gbmpYy0UXF2yjDaWuh8QkvLAx6GgIYFwS5tEp a5k7aOQyKT7iKifZFqG2WIi6XRpTDzh1P4PjMvcSI0iP9CBoKYILKQa/Z7VGmdY3neVQ ma0MYkmb0BvnKPM7Rpyh8BQDMim1m+issBlV7YO3Qw0DHSNU9Zi5X7/Dwn4/NqQbxbKG jz1Q== X-Gm-Message-State: ACgBeo0PGyP0msxzciFPaduDkuqmhsxPRXGgZuBF4z+Q6QL1AR/0obA7 cssKLH7kon6w8pMSnjazMqRF6AFrtPwp0A== X-Google-Smtp-Source: AA6agR5jqM49cNTJsbXM1RW7/Zfe7Yq0X7jJwvT0/8lk5DdvQ415ku7o2Hz7Sz8Aakx+JgfBm+1u+A== X-Received: by 2002:a05:6808:13c8:b0:344:eed4:af2b with SMTP id d8-20020a05680813c800b00344eed4af2bmr5971965oiw.180.1661711590717; Sun, 28 Aug 2022 11:33:10 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id 91-20020a9d0de4000000b006339b36127dsm4299771ots.3.2022.08.28.11.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Aug 2022 11:33:10 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Neil Armstrong , Simon Glass , Alexandru Gagniuc , Artem Lapkin , Joe Hershberger , Leo Yu-Chi Liang , Marek Vasut , Michal Simek Subject: [PATCH 2/8] image: Track when ramdisk processing is completed Date: Sun, 28 Aug 2022 12:32:47 -0600 Message-Id: <20220828183253.822815-3-sjg@chromium.org> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog In-Reply-To: <20220828183253.822815-1-sjg@chromium.org> References: <20220828183253.822815-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean The current switch default is tricky since it relies on #ifdefs to work. Use a bool instead. Also fix the comment on @select, since it has a dual purpose. Signed-off-by: Simon Glass --- boot/image-board.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/boot/image-board.c b/boot/image-board.c index 14b595977e1..2d5e5b6e6f0 100644 --- a/boot/image-board.c +++ b/boot/image-board.c @@ -314,7 +314,7 @@ int genimg_has_config(bootm_headers_t *images) * select_ramdisk() - Select and locate the ramdisk to use * * @images: pointer to the bootm images structure - * @select: name of ramdisk to select, or NULL for any + * @select: name of ramdisk to select, or hex address, NULL for any * @arch: expected ramdisk architecture * @rd_datap: pointer to a ulong variable, will hold ramdisk pointer * @rd_lenp: pointer to a ulong variable, will hold ramdisk length @@ -324,6 +324,7 @@ int genimg_has_config(bootm_headers_t *images) static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch, ulong *rd_datap, ulong *rd_lenp) { + bool done = false; ulong rd_addr; char *buf; @@ -401,6 +402,7 @@ static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch, *rd_datap = image_get_data(rd_hdr); *rd_lenp = image_get_data_size(rd_hdr); + done = true; break; } #endif @@ -419,6 +421,7 @@ static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch, images->fit_hdr_rd = map_sysmem(rd_addr, 0); images->fit_uname_rd = fit_uname_ramdisk; images->fit_noffset_rd = rd_noffset; + done = true; break; #endif case IMAGE_FORMAT_ANDROID: @@ -431,24 +434,29 @@ static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch, unmap_sysmem(ptr); if (ret) return ret; - break; + done = true; } - fallthrough; - default: - if (IS_ENABLED(CONFIG_SUPPORT_RAW_INITRD)) { - char *end = NULL; - - if (select) - end = strchr(select, ':'); - if (end) { - *rd_lenp = hextoul(++end, NULL); - *rd_datap = rd_addr; - break; - } + break; + } + + if (!done) { + if (IS_ENABLED(CONFIG_SUPPORT_RAW_INITRD)) { + char *end = NULL; + + if (select) + end = strchr(select, ':'); + if (end) { + *rd_lenp = hextoul(++end, NULL); + *rd_datap = rd_addr; + done = true; } + } + + if (!done) { puts("Wrong Ramdisk Image Format\n"); return -EINVAL; } + } return 0; } -- 2.37.2.672.g94769d06f0-goog