From patchwork Thu Feb 15 20:52:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 773005 Delivered-To: patch@linaro.org Received: by 2002:adf:9dc2:0:b0:33b:4db1:f5b3 with SMTP id q2csp1034907wre; Thu, 15 Feb 2024 12:53:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWCivG9LKkUYucjqNO64Qu9y1Fh/94RqFZdoMrCAUkgNPCuFaQl4YMdMkePPGKEDi2bqBLDUVrOSxAFRyJeqjCN X-Google-Smtp-Source: AGHT+IGR3usiD9zUtRB0XZeahZe0m4fwIbJkUYj9KITvxej/cGbAdbZAYYllAI44wSw6sTR4wXkE X-Received: by 2002:a17:906:f9d0:b0:a38:20dc:9fb6 with SMTP id lj16-20020a170906f9d000b00a3820dc9fb6mr1920765ejb.25.1708030416017; Thu, 15 Feb 2024 12:53:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708030416; cv=none; d=google.com; s=arc-20160816; b=G3XvAiCK2PXXQ2vaejMhbPjPmfA0Csu6+mM1bgaVFvw5GTDxUR4pMhPhX3DtJ6jGy+ b1SRMjEtXVGl4oRS7cPxlpdlENo+y5VPBc3uY0OxoKbTfLS/lO/GXpt6fsjMsoDJrGQ2 GBwyrkI1Iy2db4SFNEjFNJ3Om24X6PVcluV6ZP3v+4WVIPz0SGNdoe5EOBXOG2kHQTpK LoUrKSLYN23HtQ0CVZ2JTl4BPnV+3xy/ZQE+8z3wbw+e/ACkBM8QreJ65f+gro8uZqav dFUKUlottT3gSLGsHZf1brExbN3V79RO16R/8yD142591KeZ9j71dlmc8BU9tJ4ZLS01 K2aA== 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=guDSjKVkzRQr/oiWIrFpeQ0glvtovKCHaU4MBRIKIUc=; fh=ebaUvPIfKHNmc3b8Up2JRfkQ3kSSoFv/SVLd6SBDo50=; b=tYz1HqrjiVwJvBwYtRW6EvyoxFww3IxRii/aLJz/ZAyU/jG0qPwSkhVf/ZpLmMxDNt 95A7cs9cIp+qXs30wfey/6H0siLDlque9oGT701R3WZU4cWjXvp0omfAZwF4Ju0OfwZp V89t4OkYMBLYQISzFjOyFXPeNSjTYjXw7UYIy5ZyQubqxUBQhzMlk/rStsOmUGfHO9vW jZBFCM9gZmzg0LFvgKwU7pwB4/2UuFJjN6RkwPSCG+Wu/Y5kRclUNj11dotyQfIGc4EX m6ruOzNTXYWUu7OgBq4UnejAR2qRCaslvwUf8I+51Im16o4MPCmaOZohmRAdQFh1a8Rs B7eA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gWBem11n; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id du20-20020a17090772d400b00a3d057ca899si1026072ejc.536.2024.02.15.12.53.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 12:53:35 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gWBem11n; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 D122487F09; Thu, 15 Feb 2024 21:52:52 +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="gWBem11n"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 76E2787E61; Thu, 15 Feb 2024 21:52:45 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (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 1B9C687E3A for ; Thu, 15 Feb 2024 21:52:27 +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-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33d153254b7so41288f8f.0 for ; Thu, 15 Feb 2024 12:52:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708030346; x=1708635146; 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=guDSjKVkzRQr/oiWIrFpeQ0glvtovKCHaU4MBRIKIUc=; b=gWBem11nTX/wGvEKnCNlAywbrEVVk0fFr7mSB2FH9Zm+uEZxU1Bp3T6VaaqdMTZsnw iBuNVRkeKs0/B7TVm1Mkj/A5gji76WinGf7KeGokji55GAhQfxyfJyDHesishUvfG0/E YSO8D5UtEI7RYX0EfdiVOK85N8Ru9rO98lXptErFtPPUxBscZJrbTPghSA/QYdUEGFYY cpLdDNt6xyefwCx3RK3Kz2PXuBfmBZj5XB6QuEWRVEP4h7sIYGDhR7mAvgTeS27fA+Jf dS3V+4hamt6v0FkLeH7v7XHdMO3s23Hv0GOmuslEpLP6hGHnZp+7WRzAfILlxZ/iayA7 8pag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708030346; x=1708635146; 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=guDSjKVkzRQr/oiWIrFpeQ0glvtovKCHaU4MBRIKIUc=; b=jtT0CGTwboctCN8j+8x9Y7LGL5TyIYQwm2hm5dHis4Izg7kNeHCfI6ZHt0kgsgQIou Otl8BWjpZBnbSPgATF/jGoTZ+WKggnwmkR7mjb/bX//O/nrxQHxv6yW0BeJMUyWCiXJk iCSNhDrZO3W7JI2DjCJ9PQHFcJscV0KTfYnS9lyooKnNH+1wYzzY/UG/rb/vnjeihuWz aGeI/0Gc3C7i7/obySYm5myQbeTXE6Gyt8j4FJKBWksvSHMJtCZ4OAS0T5ppe02jiatv KFSBhBnYyjXySmEkcF6R0s7bf55Co9A+sqCh/ntx1qdWTsiBgEhkqYkBqB1zxPZ+kCJG w2TA== X-Forwarded-Encrypted: i=1; AJvYcCXi3xMI3ZlnDF3Gcb5k1WzB4PMyOuCEmq11yY3TJ8bJFa2jDfniYcH90ZyhLKxcc0fu2MfWAHfHrhXaOWQBsoXdML1qjA== X-Gm-Message-State: AOJu0YwbBu6jrkryY3F5TdOyPyAPeO1Sv21Ul9to/9m8EAHEfiCriJcm R1GgbXIhfdSLw27pJaSJ2R2qHrSEnd31GPiz2YUyKG40dM3sGHJqvqxSDh6FNtTxMqYarZW0Min p X-Received: by 2002:a5d:6851:0:b0:33d:1178:ed90 with SMTP id o17-20020a5d6851000000b0033d1178ed90mr1242090wrw.23.1708030346228; Thu, 15 Feb 2024 12:52:26 -0800 (PST) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id e4-20020adfe384000000b0033cfa00e497sm194025wrm.64.2024.02.15.12.52.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 12:52:25 -0800 (PST) From: Caleb Connolly Date: Thu, 15 Feb 2024 20:52:19 +0000 Subject: [PATCH v4 01/39] arm: init: export prev_bl_fdt_addr MIME-Version: 1.0 Message-Id: <20240215-b4-qcom-common-target-v4-1-ed06355c634a@linaro.org> References: <20240215-b4-qcom-common-target-v4-0-ed06355c634a@linaro.org> In-Reply-To: <20240215-b4-qcom-common-target-v4-0-ed06355c634a@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 X-Mailer: b4 0.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=1843; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=FPJv4XmkfyzX4LoiZ1gCS91jQPj/k4xHCJL80+QaPjU=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtRzlc0WqXFzgiddPLzkovS6Gt9mnzzNPJmLh4TWuJXwL X1crKnYUcrCIMjBICumyCJ+Ypll09rL9hrbF1yAmcPKBDKEgYtTACaivYyRoX/iw7RdWjc3qXPv jNpeU761vFlU7e1lPdl1ZxqyOLcpLmL4Zy55XZ+Da6rafQuDxL2Cs5uMxYKvmdd7L1r/wuy/L6P aOgA= 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 Reviewed-by: Sumit Garg --- 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 /**