From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50EC5C433EF for ; Fri, 29 Oct 2021 05:49:35 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8969E60F4B for ; Fri, 29 Oct 2021 05:49:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8969E60F4B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EAACE83480; Fri, 29 Oct 2021 07:49:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ZAOX0zOF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 94C3783564; Fri, 29 Oct 2021 07:49:29 +0200 (CEST) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 C47FE83390 for ; Fri, 29 Oct 2021 07:49:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x433.google.com with SMTP id k7so14294479wrd.13 for ; Thu, 28 Oct 2021 22:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=S6ormLfWS90FGzApNIYQ6R2i7mgKj84m5NI7SFzDg7U=; b=ZAOX0zOFjYujg4Sh2/AuRviRa+OoRV6s87/Plhbi/o/Qv9EQVA8NGM50KYEgYUTtpG 71uYbZwfLVtMJfFZxzsY9CUNMfqNs+bqv60gY4dLjqtgHIdie1rP6ILhh2kEmV8TkvhJ r6pDYCMkoCz/EgeyTt3ijoBAGqImWOebjYQK/+9wNVwhjiwodUSvfVURTQINpZCx+dUz 9YMePjWhKxtSXsj9F/zikKChH0Ev+BZrKJRrlDd5FtupKiCr77Xg7DuSbO5Nvf+wp/8e OQXsohu9CIkq6Aq7ZriXJaF4m/MQ5trjOOD/ufexirs7/XvTIccOi06Q+bCERhxg75FK QEpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=S6ormLfWS90FGzApNIYQ6R2i7mgKj84m5NI7SFzDg7U=; b=CPn32hqgcZGporUn/1unU3HC+U1pUm1bmAVZq5719HdsyalITt9b1ud8paFbLFZAPC zyQNTfF6eF7Mu8JCLhpWXVD+YN2R0W9xu80YwpVOnKkJdBuU9vEzELNzwyd45tLEhmA/ TeEv46a/B9YEMN9ooM+5SrPRSocuSdRM6Ab9beb0uhpq7p8mAw3htnm6mM8hPaEWdo9Z /6diOFwpDNX05blNQ4qQFjN/VfWKkOimEoAqSPxEIC9mfK38H2TECa/m2pLMlGrNBJ6j Ia2damOY+0KVf5P9AbyQlJ+4d5NCOzOAx0YjLY3q2HS+OWCkgZzQeKIWYlqtE4MrXiFg t9Lw== X-Gm-Message-State: AOAM533Gh6WKKOfgSHh+LGZWeRKTgF15gjofbPRCx3dOY4pg8rSI4CQq jKvI75hfZNIbYMZwlfAcanKncg== X-Google-Smtp-Source: ABdhPJxzWMAtS6tTRfWopR0rS5ocm7ZJl5aE7VpyWy5ImKtwzBGWC2pvVHDKVAsPKM80K8kFh4pkTg== X-Received: by 2002:adf:f348:: with SMTP id e8mr11915645wrp.31.1635486565333; Thu, 28 Oct 2021 22:49:25 -0700 (PDT) Received: from enceladus (ppp-94-66-220-13.home.otenet.gr. [94.66.220.13]) by smtp.gmail.com with ESMTPSA id j7sm5764016wmq.32.2021.10.28.22.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 22:49:25 -0700 (PDT) Date: Fri, 29 Oct 2021 08:49:22 +0300 From: Ilias Apalodimas To: Simon Glass Cc: U-Boot Mailing List , Mark Kettenis , Heinrich Schuchardt , Tom Rini , Sean Anderson , Jerry Van Baren Subject: Re: [PATCH v5 19/26] fdt: Move MULTI_DTB_FIT handling out of fdtdec_setup() Message-ID: References: <20211026002344.405160-1-sjg@chromium.org> <20211026002344.405160-20-sjg@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211026002344.405160-20-sjg@chromium.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Hi Simon, Since those patch series are too long and borderline unreviewable, I'd much rather split them on different patchsets (i.e one with cleanups and one with the actual proposal). On Mon, Oct 25, 2021 at 06:23:37PM -0600, Simon Glass wrote: > This logic is a bit convoluted for one function. Move the mulit-FIT part > into its own function. > > Signed-off-by: Simon Glass > --- > > (no changes since v1) > > lib/fdtdec.c | 62 ++++++++++++++++++++++++++++++++-------------------- > 1 file changed, 38 insertions(+), 24 deletions(-) > > diff --git a/lib/fdtdec.c b/lib/fdtdec.c > index 688741108c7..58ea8f70cfe 100644 > --- a/lib/fdtdec.c > +++ b/lib/fdtdec.c > @@ -1591,13 +1591,46 @@ __weak int fdtdec_board_setup(const void *fdt_blob) > return 0; > } > > +/** > + * setup_multi_dtb_fit() - locate the correct dtb from a FIT > + * > + * This supports the CONFIG_MULTI_DTB_FIT feature, looking for the dtb in a > + * supplied FIT > + * > + * It accepts the current value of gd->fdt_blob, which points to the FIT, then > + * updates that gd->fdt_blob, to point to the chosen dtb so that U-Boot uses the > + * correct one > + */ > +static void setup_multi_dtb_fit(void) > +{ > +# if CONFIG_IS_ENABLED(MULTI_DTB_FIT) > + void *blob; > + > + /* > + * Try and uncompress the blob. > + * Unfortunately there is no way to know how big the input blob really > + * is. So let us set the maximum input size arbitrarily high. 16MB > + * ought to be more than enough for packed DTBs. > + */ > + if (uncompress_blob(gd->fdt_blob, 0x1000000, &blob) == 0) > + gd->fdt_blob = blob; > + > + /* > + * Check if blob is a FIT images containings DTBs. > + * If so, pick the most relevant > + */ > + blob = locate_dtb_in_fit(gd->fdt_blob); > + if (blob) { > + gd->multi_dtb_fit = gd->fdt_blob; > + gd->fdt_blob = blob; > + } > +#endif /* # MULTI_DTB_FIT */ > +} > + > int fdtdec_setup(void) > { > int ret; > #if CONFIG_IS_ENABLED(OF_CONTROL) > -# if CONFIG_IS_ENABLED(MULTI_DTB_FIT) > - void *fdt_blob; > -# endif > # ifdef CONFIG_OF_EMBED > /* Get a pointer to the FDT */ > # ifdef CONFIG_SPL_BUILD > @@ -1616,27 +1649,8 @@ int fdtdec_setup(void) > (unsigned long)map_to_sysmem(gd->fdt_blob)), 0); > # endif > > -# if CONFIG_IS_ENABLED(MULTI_DTB_FIT) > - /* > - * Try and uncompress the blob. > - * Unfortunately there is no way to know how big the input blob really > - * is. So let us set the maximum input size arbitrarily high. 16MB > - * ought to be more than enough for packed DTBs. > - */ > - if (uncompress_blob(gd->fdt_blob, 0x1000000, &fdt_blob) == 0) > - gd->fdt_blob = fdt_blob; > - > - /* > - * Check if blob is a FIT images containings DTBs. > - * If so, pick the most relevant > - */ > - fdt_blob = locate_dtb_in_fit(gd->fdt_blob); > - if (fdt_blob) { > - gd->multi_dtb_fit = gd->fdt_blob; > - gd->fdt_blob = fdt_blob; > - } > - > -# endif > + if (CONFIG_IS_ENABLED(MULTI_DTB_FIT)) > + setup_multi_dtb_fit(); > #endif > > ret = fdtdec_prepare_fdt(); > -- > 2.33.0.1079.g6e70778dc9-goog > Reviewed-by: Ilias Apalodimas