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 07614C433F5 for ; Tue, 11 Oct 2022 15:49:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 63D6C84F2A; Tue, 11 Oct 2022 17:48:49 +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="CPdZqB4r"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1B0E284F1C; Tue, 11 Oct 2022 17:48:25 +0200 (CEST) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (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 1CFCA84F11 for ; Tue, 11 Oct 2022 17:48:16 +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-io1-xd32.google.com with SMTP id 187so11141380iov.10 for ; Tue, 11 Oct 2022 08:48:16 -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:subject:date :message-id:reply-to; bh=wQDPqofHgMMwNl9IE29uGJLP1XLqhxiKh+XKBiyMdLU=; b=CPdZqB4rjNgqKoAtUQuCSB/GkKANrpM7VP6kL4YNFKe2rVOcP6V1HQCWil9M9AnD4y AiCtWGiSHm3lBNl1r1QU6n4wkYEvNL2YDyyHz3ZcXE1lUiRzybr3y88epddXb7xANGpg P/9lUIRGkmUZU0Xuk8lbC5YTykKmg3G6nqmik= 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 :subject:date:message-id:reply-to; bh=wQDPqofHgMMwNl9IE29uGJLP1XLqhxiKh+XKBiyMdLU=; b=rBBCDVjPkgZvUi+o7qh6eJjKJnqEE1ITnCjnNu7y7UaU6WcW2ese7C7EGgmMqyJJVt VFvZjZT1wQrEHtfu940yej8nf/ibDtCoqZkd1/q1cFMFDmC31/DcRFi8Q7HAuSt586q4 uGzxCo6WXckj3FtvCPaEV01x3oRCurbextYd7Od1RrWIZ11zhva2X5W99EZQihf34D/t y7pB0yp6DJXPiZIMzCXBQr7JppN8cCTEQAMzdVH+fbI5cJRnoshQ/Ok9mJ7p9VHNJMDf mYyiSvgGHfx9mTe93wLjhRKWFIMVwqFCD05wSSUX4HJgR5QK4l8qY+8GnWlI0D9ZZRPy 24QA== X-Gm-Message-State: ACrzQf1nDlI2aEBaCw0d3vjwfy36lsJUAaEHcPzB5zDgrayNChUsZjH4 MBfw0b2GTaeWsUazTytg4K/XMserMu/x8g== X-Google-Smtp-Source: AMsMyM5CeLPYxekZmIaDHr9lPA733I/xMh86piDvCi1NDhQZha8KFzQJpHj5BQoDoJSUo/mujPSRqw== X-Received: by 2002:a05:6602:2c54:b0:6bc:9749:9096 with SMTP id x20-20020a0566022c5400b006bc97499096mr694527iov.157.1665503294198; Tue, 11 Oct 2022 08:48:14 -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 r12-20020a922a0c000000b002f9b55e7e92sm4988680ile.0.2022.10.11.08.48.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 08:48:13 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Artem Lapkin , Daniel Golle , Heinrich Schuchardt , Marek Vasut Subject: [PATCH v2 09/14] boot: Pass the correct FDT to the EVT_FT_FIXUP event Date: Tue, 11 Oct 2022 09:47:15 -0600 Message-Id: <20221011154720.550320-10-sjg@chromium.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20221011154720.550320-1-sjg@chromium.org> References: <20221011154720.550320-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 Now that we support multiple device trees with the ofnode interface, we can pass the correct FDT to this event. This allows the 'working' FDT to be fixed up, as expected, so long as OFNODE_MULTI_TREE is enabled. Also make sure we don't try to do this with livetree, which does not support fixups yet. Signed-off-by: Simon Glass --- (no changes since v1) boot/image-fdt.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/boot/image-fdt.c b/boot/image-fdt.c index f651940d9b4..b830a0ab418 100644 --- a/boot/image-fdt.c +++ b/boot/image-fdt.c @@ -665,15 +665,18 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob, goto err; } } - if (CONFIG_IS_ENABLED(EVENT)) { + if (!of_live_active() && CONFIG_IS_ENABLED(EVENT)) { struct event_ft_fixup fixup; - fixup.tree = oftree_default(); + fixup.tree = oftree_from_fdt(blob); fixup.images = images; - ret = event_notify(EVT_FT_FIXUP, &fixup, sizeof(fixup)); - if (ret) { - printf("ERROR: fdt fixup event failed: %d\n", ret); - goto err; + if (oftree_valid(fixup.tree)) { + ret = event_notify(EVT_FT_FIXUP, &fixup, sizeof(fixup)); + if (ret) { + printf("ERROR: fdt fixup event failed: %d\n", + ret); + goto err; + } } } -- 2.38.0.rc1.362.ged0d419d3c-goog