From patchwork Mon Feb 26 17:26:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 775906 Delivered-To: patch@linaro.org Received: by 2002:ab3:621a:0:b0:258:3251:9e33 with SMTP id w26csp1492255lte; Mon, 26 Feb 2024 09:26:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXoa8aWzE9M6Vh3WZiYgQezcnDa9kde/CL548FE8X3wJVVVUNgx6+0RmCCACQg2PG1eMYloeoZ9Dxyj+Cz6eqdX X-Google-Smtp-Source: AGHT+IGloiWANP1SQci4ycPRwnSTANlsUVMwPFtmSqX6moAqhlKN+/R6cf1rIxZaWdAp+/UovrqN X-Received: by 2002:a05:651c:782:b0:2d2:4314:8c06 with SMTP id g2-20020a05651c078200b002d243148c06mr3657207lje.15.1708968391348; Mon, 26 Feb 2024 09:26:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708968391; cv=none; d=google.com; s=arc-20160816; b=QmYXl+Cjshk/GB7UYLz5NqKo1CGbYG39h6rCU3NqyhUndXbwTSsBYhAxreF/ByWZ8R 7co8YSOkaYhu2viegOOLqDhG9ak65hyEJX7IvF54WCy9L+fUGUEKOFRedPsat0Bllqd+ XgadkNo1e7SAIZU0PkGmRdYBRK7ujLOub7YD+KRphmeVr4RawE4MaHlbm1fCtvp9fygm 4Sffbp1INJGgnlc4hUu+lffyT4+IbWrF03PXQaSBij32v1jOm/6q5gNfrOAVx9+aq0+/ SpFrRwK8+q5ql09fG024bmd+5+undTfcDi/TAyf2WiHbdK+bCTeXNPiI3OQ5eFeyiYLz SOZA== 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=z0hCDiTNri44tvXyNMJaRxomK4RdMAbxwZTo74BYQs4=; fh=BXDlRltI5uPEOO2paqrHMUi7WtoISerVHMqlg16wwV4=; b=d+LrPPSJEYZTlgR84LGzsl7xab4aMoDzc6ijzWAMKPnHm/pXpyZ4tfHgs98iZF+eUR JztnXh3frNKW+Z4es74+ImJNoPxcepvP1XCC7Tn5SPxx5DpB9f7YAzgR1+Lha47NUpqf VNUensplDyaZck5E9lqePNHyLcvMDQsH/dROgfwQhGyudGqptzabgH+KkjnJEPPQN5FA K4Lq7++dJ8Ai+dnYv14qinVVOdCaNDg4OtkWerqK3qE+Xa0faUr5MeCe5S1ezjYpf0X8 xyvE2GUUQKJQPkv2Vpsg/W06LT6YeZ0Jn++NmV9y8oqTQHn9d52kFPmjLbLVpsjR3sCE Nt1Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bSlKOo1p; 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 h6-20020a5d5486000000b0033d7ea25f06si2790261wrv.1022.2024.02.26.09.26.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 09:26:31 -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=bSlKOo1p; 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 085B387F4A; Mon, 26 Feb 2024 18:26:30 +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="bSlKOo1p"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9B4FE87F28; Mon, 26 Feb 2024 18:26:28 +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-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (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 DB6C587F25 for ; Mon, 26 Feb 2024 18:26:23 +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-x329.google.com with SMTP id 5b1f17b1804b1-40fd72f7125so26935505e9.1 for ; Mon, 26 Feb 2024 09:26:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708968383; x=1709573183; 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=z0hCDiTNri44tvXyNMJaRxomK4RdMAbxwZTo74BYQs4=; b=bSlKOo1psLPZIJpm1JevNhA9qO/DFjSQFkF0BEuM0+tNS6q2/Z+PvfFOPxpR9PG2WS CPZm2K0vX+YgINIghVOhYoNjiD42Si1HOEV3NC9mJt4guPXjMdO3nKkWEiYJ4kBDh9nG sUWXn4KrDmw24utiUAKnw6nBGpOi+1KTEOvTSsoUiOzhQxlBBSm/2Oa7YXVw28DvO+Bn vDlSAjzy7F8jw5SLt6LssGLzEEjD9upiv9SWHqGs38oJ0KUEharGVwjt+Z1s/TkHWzCt lC1WQw4PACWjKcpWW4JLhCDhNXdEVGmM+4FnxtyqrlegnO+rfPJYqbVcIi34pIK3om+b +8Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708968383; x=1709573183; 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=z0hCDiTNri44tvXyNMJaRxomK4RdMAbxwZTo74BYQs4=; b=SbCvumzcpxTKpy+JSrd+CHR3xY0rKsRT3O+UHKwDCvis2WyxIlSeVi9lRgjwJR/JNH glqEnfA8MtEK4Q+y4SFToVVfmWYGz5tMw93NeBstDy/fFNqhTzh/brBOD5on4H2YI+9K mRheaXy3OkrvrI+RbUjZoPUbAClFJmXIYNXUPpAbvz3sDCARCwSghhrcScpEvpkP4XDa XeyoPctB6h4+yl7Xj4+3AWykAWqmCGHkkpl+SC8OHbO6fePynYd3tIbGA5M6/RvMHBDi FmdxyYMy6rA844y8Tkm79WyddLRsQfQWgChgPfeK8PX4a/ckko9HdcI/rIkVImQKJSMh 02xg== X-Forwarded-Encrypted: i=1; AJvYcCWXTdLTZFTw4B62gd+ni3/i6o37GV85LHTZxflb24Boz0MrpK0cgpeTvnfpnWTzykVdpyqqZEjDJPajmCKyjCqy5FwX4w== X-Gm-Message-State: AOJu0YxU/KHJj6Vq3PYi2L3GkYI21Gy2fGKr/4kM1M+ezxvyRWJ4hin2 s432ScRoUDI3DEgt3faUtekQB04lJAir4N+KjydwSZTRAoYdEBmL1mf0oKxh1po= X-Received: by 2002:a5d:658b:0:b0:33d:2848:79b6 with SMTP id q11-20020a5d658b000000b0033d284879b6mr5455248wru.45.1708968383203; Mon, 26 Feb 2024 09:26:23 -0800 (PST) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id bt1-20020a056000080100b0033d9c7eb63csm9142256wrb.84.2024.02.26.09.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 09:26:22 -0800 (PST) From: Caleb Connolly Date: Mon, 26 Feb 2024 17:26:05 +0000 Subject: [PATCH v5 01/39] arm: init: export prev_bl_fdt_addr MIME-Version: 1.0 Message-Id: <20240226-b4-qcom-common-target-v5-1-10c8e078befb@linaro.org> References: <20240226-b4-qcom-common-target-v5-0-10c8e078befb@linaro.org> In-Reply-To: <20240226-b4-qcom-common-target-v5-0-10c8e078befb@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=2036; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=rDoYKulwRgfSZJ6WGXOQUTKGJ56bse325sV7t1f3MEU=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtQ7J3esPK14X/jBhcQtqU91hLPaO+0L9zPuj3D9ttRSI 2vLx8n8HaUsDIIcDLJiiiziJ5ZZNq29bK+xfcEFmDmsTCBDGLg4BWAiIe8YGVZ+uGz39oDrV8WD MS5SHw7qlL2TK2FJYvTM+p/HH38x7hojw/wSnYK7uleaznC291pOjdIqV1Ze9fHmu55HD7k3f7+ xVR8A 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 Reviewed-by: Sumit Garg Tested-by: Sumit Garg #qcs404 Signed-off-by: Caleb Connolly --- 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 @@ -44,8 +44,13 @@ 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; int node; diff --git a/include/init.h b/include/init.h index 9a1951d10a01..630d86729c4e 100644 --- a/include/init.h +++ b/include/init.h @@ -167,8 +167,19 @@ 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 /** * cpu_secondary_init_r() - CPU-specific secondary initialization