From patchwork Tue Jan 30 14:04:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 768064 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp1384802wro; Tue, 30 Jan 2024 06:05:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IFe48QRlao2134dOm5sui9px1zVj4auEerJ6XOP9PXV3G3ZLcRh7KNVdUSMkfwfl132valw X-Received: by 2002:a05:600c:4ed3:b0:40e:f1f4:89cc with SMTP id g19-20020a05600c4ed300b0040ef1f489ccmr6437112wmq.25.1706623524450; Tue, 30 Jan 2024 06:05:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706623524; cv=none; d=google.com; s=arc-20160816; b=TRejo5oiCp+48DK7NFMsMqEB4c3yDgU9u/WAfQphv3YCfSMwmlt8+I90nmapEnD2H7 k+5XjV0xLScPfc1u2AHoiw4XoR2yrZRITyUVbQpZ6z1D+QSaWH9n06E+KLFrMVSALB5c 7JdF38I9P8sExZtw2OPp+aX3xFE+SZ4oMKTITohOvHV/NZkmGYSrnQJD+8g3Nu2a64ve /8l0Zq9masglV8sA6M5QscktbIOMBomUMJsSC52f9MQuwq2gI1ZvJcLzdpCdG72uuhhn OoEe8x6lG5+aqJUYyHAjpDQZBh2yZtopul4MM5HbsgWqkTEZ5YWMxeWWw61JpWhaAzHd xHAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=BlwLKns/59/R3MiixPKZiqZJiJvLjgygGD+wM3O6NRU=; fh=vG+li7Pp62s8YEAPN/BBeUHvvxWA/r/ouzpCKjSl5Og=; b=m0awaHIiPuy/gDk5PeSnVZ3WkXx3vuMAvPboBSHQZtKSAgOZN0ieP8CfZRsP4p1mW6 4k3bHg4VSW+Cv2gik49FJJsrtG8VnKZGDdQLqHoF8MNzowCvXSEUl3o+aJGMABr0I4Py yG36aXoRn/TV9FIMErLNNAW9lzgkugk7R2kGneAAhomlHdxHScoAeICRlmGQAt2If9ty exH93ykjjg4FZtIX+jsJUH+tpZToRndwxNyLBC4jUeZ8gABpSRx0EBCVWDPuUBdRh50K OslJBYVnhxcsgsoM4wmo/3iY0j8gVJ/TT2audJYvEOhS0vCDFO4K/tyL+zOZ/3dk5QHU zsZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IZ5VLF/y"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id y16-20020a05600c341000b0040efb24138dsi1793289wmp.230.2024.01.30.06.05.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 06:05:24 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IZ5VLF/y"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 858EE87DE3; Tue, 30 Jan 2024 15:05:15 +0100 (CET) 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="IZ5VLF/y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EF5C987DEF; Tue, 30 Jan 2024 15:05:13 +0100 (CET) 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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (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 21A0287DC1 for ; Tue, 30 Jan 2024 15:05:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40fafae5532so2998365e9.1 for ; Tue, 30 Jan 2024 06:05:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706623509; x=1707228309; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=BlwLKns/59/R3MiixPKZiqZJiJvLjgygGD+wM3O6NRU=; b=IZ5VLF/yMSjg+zf1n4LY0sH1m6Elz7Fr8YCcwRrzw5Du8eFjl6t2CeC6x3ZVrygQ5z 0i6DhXtnQD1rQpO4gnfLGnMbiIXcz73VkAf+UMtvZAQqrsj4EktOdt2latMMUEOGmK6+ b9oGNAIL2g+dpHsAouxf7E9Lx3EEduRjKQ43KHCN+vmldnfyB/Ei7n4ihwJLTCbEu0ur z52q+SV3ZHuoQoXLbLULuuEdYcthFrjUTkcy/ccC7n7WccKz2hHlzx3J2/3bwLu5p54f BBtdK0MHSofuNQeJs2YiD/oCr3/Nxs03RPyJrhUx+DSw9BlYMan/Qks9lTqTWVEEepf7 jzbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706623509; x=1707228309; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BlwLKns/59/R3MiixPKZiqZJiJvLjgygGD+wM3O6NRU=; b=L9vLiZwyu9R7MUQUVwFN1dn8WNPVnRipJlgPv1SrH6n0oBHaxbD4j5FHoQmsvq/9pW dIZOuI715+aBPmbaPc0mBhKLkUfE/D0T5StF0qQ6SzoloyK6SiU5ntZPnOqCeCINl3X6 tiXuVpM62N/wLRZHZib9B7S2DGnQ9s08X0nW3l6F7KqsG+KdmFVCdWE1XlPtDd/zp//i d2MD0uFrPF+VUHQ7JTYYqpFyx7feC1WSZLwDhMDbhS0T/NiCgBZL7zHbppSdPOR5OMh9 AeiKYjYdnHMjo28kn7+m1DSIXQj0Nog1aWjhpGGR/8tI1kh8fakiP702SELwFWL8nHU+ j16A== X-Gm-Message-State: AOJu0Ywrr//g57yX5MNo9iuQR0lesdEiOGwHkWAey971S44jaFXaXJa5 hPPc+4VzMaqCVvOMXK68eDIBWJSgZCF0a7oBk4e5+6IRSTxFM+IsR4nePXx7u6Q= X-Received: by 2002:a05:600c:5123:b0:40e:5933:e2c2 with SMTP id o35-20020a05600c512300b0040e5933e2c2mr9494604wms.19.1706623509693; Tue, 30 Jan 2024 06:05:09 -0800 (PST) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id g11-20020a05600c310b00b0040f035bebfcsm1799017wmo.12.2024.01.30.06.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 06:05:09 -0800 (PST) From: Caleb Connolly Date: Tue, 30 Jan 2024 14:04:49 +0000 Subject: [PATCH v3 01/36] arm: init: export prev_bl_fdt_addr MIME-Version: 1.0 Message-Id: <20240130-b4-qcom-common-target-v3-1-e523cbf9e556@linaro.org> References: <20240130-b4-qcom-common-target-v3-0-e523cbf9e556@linaro.org> In-Reply-To: <20240130-b4-qcom-common-target-v3-0-e523cbf9e556@linaro.org> To: Neil Armstrong , Sumit Garg , Ramon Fried , Dzmitry Sankouski , Caleb Connolly , Peng Fan , Jaehoon Chung , Rayagonda Kokatanur , Lukasz Majewski , Sean Anderson , Jorge Ramirez-Ortiz , Stephan Gerhold Cc: Marek Vasut , u-boot@lists.denx.de, Tom Rini , Simon Glass X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1918; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=eNhNBu7hxBtGKiHmy0H7+R0rAFesn+W4Qw9aXxb/3IE=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtSdTPyNpmKJU+9dKFXU/Fsy+QRrJic7418t95MiKlvNv ptGn6rsKGVhEORgkBVTZBE/scyyae1le43tCy7AzGFlAhnCwMUpABNZs4zhn2nLJWmpZ3eeT79W +fWB6DaVdmmmJvFb7/Z9FfQwWcU9fQHDP7v/5ub1XjO8q/wm3k2UYXU6uHea0xbRjasebVmyJCg g9BkA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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.8 at phobos.denx.de X-Virus-Status: Clean When booting U-Boot on board with a locked down first-stage bootloader, we emulate the Linux boot header. By passing the U-Boot FDT through this first-stage bootloader and retrieving it afterwards we can pre-populate the memory nodes and other info like the KASLR address. Add a function to export the FDT addr so that boards can use it over the built-in FDT. Don't check is_addr_accessible() here because we might not yet have a valid mem_map if it's going to be populated from the FDT, let the board do their own validation instead. Reviewed-by: Tom Rini Signed-off-by: Caleb Connolly --- This patch has no dependencies Cc: Simon Glass --- arch/arm/lib/save_prev_bl_data.c | 5 +++++ include/init.h | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/arch/arm/lib/save_prev_bl_data.c b/arch/arm/lib/save_prev_bl_data.c index f7b23faf0d66..b286bac9bf00 100644 --- a/arch/arm/lib/save_prev_bl_data.c +++ b/arch/arm/lib/save_prev_bl_data.c @@ -45,6 +45,11 @@ bool is_addr_accessible(phys_addr_t addr) return false; } +phys_addr_t get_prev_bl_fdt_addr(void) +{ + return reg0; +} + int save_prev_bl_data(void) { struct fdt_header *fdt_blob; diff --git a/include/init.h b/include/init.h index 9a1951d10a01..630d86729c4e 100644 --- a/include/init.h +++ b/include/init.h @@ -168,6 +168,17 @@ defined(CONFIG_SAVE_PREV_BL_FDT_ADDR) * Return: 0 if ok; -ENODATA on error */ int save_prev_bl_data(void); + +/** + * get_prev_bl_fdt_addr - When u-boot is chainloaded, get the address + * of the FDT passed by the previous bootloader. + * + * Return: the address of the FDT passed by the previous bootloader + * or 0 if not found. + */ +phys_addr_t get_prev_bl_fdt_addr(void); +#else +#define get_prev_bl_fdt_addr() 0LLU #endif /**