From patchwork Fri Mar 24 00:40:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 666548 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp237092wrt; Thu, 23 Mar 2023 18:58:18 -0700 (PDT) X-Google-Smtp-Source: AK7set99hq7tr+JSbvUXqoFVQ1b9sPeUbObnP+kLZORM/6U9L9XdUcQvhRtdbGUcljF963Z30n3K X-Received: by 2002:a05:6a20:2d99:b0:d5:b3d1:bff9 with SMTP id bf25-20020a056a202d9900b000d5b3d1bff9mr1180032pzb.52.1679623097941; Thu, 23 Mar 2023 18:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679623097; cv=none; d=google.com; s=arc-20160816; b=EgVz73WJaoQGvyONoApejIGhucbH/kSsOWzNtrgGojiOc50clg6yUSLJfMeJLf1CsW mrx4oaYPMc2av77bwFghxtiFO7JLDkG7TPfCscfJdEBsuIr8hB9LECKEHB6FSuidF1Q3 AZAtjLpv1VBuVmJcGtSfYf1lBY6GaESyxA2NQSQZ1zSPDt/bl+fWtmq3NeqbDOO97N5o u0oYDGoif7xMMAxKzI+5kJniqbR3KxBn5ETu9BmCrmDhfLIjw7b1haemF6RIjcABQuug sqGmwfdWRc7jalDvRKOqIVDHOG6r9ko1RJ9z6P+OhQMjSFXmZM1dAF3MYa3iDwrQYP22 28ug== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nDB1XHpohezTZk244V5Qt1EqPfvozByVCzfTcPgZQes=; b=FAX1eHKi3mUGeXh8VRA4cdlrVyg3m4Pt9IzBQG2WXXbirF+ahiFZzsF2npNFAru1xH ciWiPjiDNoVYcWrZy3PW+CRw9Sr/Xp5UOCjQupKAiO7lrMRWfSEyPykAyblh9fwjlxJA CpE8Xop8Wle/WZhjbyCDVw6C84MEraJLm3k1k9dTY+xY95Da5lQGBOsBSNCxdTQJeUWF Z4mbFHIs+ff0EQ+ART4uUcknSDvSf5/td8fn4w+oC9825XYrhFx2fSt9JnhIBav5x3vN QXXQhc97uGgklKrGiNbFMVpTA1hhnkG06lZ0hSAZhEMD0YvhsShEQS7CYR3ciHoBi0Ev 8Q0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pm++vHhJ; 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 h2-20020a056a00170200b00623b50eb7d0si21976474pfc.214.2023.03.23.18.58.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 18:58:17 -0700 (PDT) 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=pm++vHhJ; 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 DC37385D99; Fri, 24 Mar 2023 02:56:57 +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="pm++vHhJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9E737859D6; Fri, 24 Mar 2023 01:40:56 +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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) (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 BFA4985AA2 for ; Fri, 24 Mar 2023 01:40:53 +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=konrad.dybcio@linaro.org Received: by mail-lf1-x135.google.com with SMTP id h25so183951lfv.6 for ; Thu, 23 Mar 2023 17:40:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679618453; 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=nDB1XHpohezTZk244V5Qt1EqPfvozByVCzfTcPgZQes=; b=pm++vHhJAF1H+ZscYkNkcnKvpn2J72tBQYD3uMepN5EuauMxAw7Rr5+y2XBpagCOy2 w4Ke4hRwnpMQED5+sEj6LMDX2UkGFZ5SD3u2RFAXkBuI1kQAjmGz15quw96fTrDDkOti NHV7fOiiN5uUsLumkDUxShQsPW4fWu01rJtFyBFCEmip2axligj/bHtM24Br+fuWQ59R Yufh3FHTePdQGEwfnAC86/iEJ7Ze+bcLoX9Moj5iaGd8cLKmb/KLwUYnKacZwHcnzhO4 0/h2nDEO3j6fnpxNbfRjaBz5z8tWzrmphA1VHvlvV2MpYyxwYE8QRT6U266B97W6YEIx XN5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679618453; 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=nDB1XHpohezTZk244V5Qt1EqPfvozByVCzfTcPgZQes=; b=6DOak8afhp/syLWRn2aFfukHSaXAXp9d7OM1NpATZt/bbHN5PQ8c6dzR9j/8rxTM7m 0XT4OrsR3aSGavvkm1nMDIbTy1x61RrxcoNXpYQUVkRTpdEOkr1P+jpXwSfXwpzAt94H OEG3kIwEXM0eYiuRRzXgiNZr4q4p89fu9lyqgYzSaxoGJQGPGfKIOXG/1eBvDGvue0WG J+kEP9FdFJ8kdYwpItMSqiYKJ6llPT0aPzSAFaYBD8zJMhMd/6XWEeZnlMxrjHvgXNVn 8/WHS2iqyjurIS/2gSjm74UB2HBEqMywFUlh9jG0xbsmUGrg9tc9MlG0/CO3cKRsR2C2 DvFA== X-Gm-Message-State: AO0yUKXsAbSneVWGi581ImzeNnUwk9mpZGX6u0jJO7FtO+hb1cTqDW+4 uF6hloJlPOkJl1uZKX8URduVOrE7P4q3PZExdEw= X-Received: by 2002:a05:6512:104a:b0:4d8:86c1:4774 with SMTP id c10-20020a056512104a00b004d886c14774mr2539154lfb.9.1679618452846; Thu, 23 Mar 2023 17:40:52 -0700 (PDT) Received: from localhost.localdomain (abxj225.neoplus.adsl.tpnet.pl. [83.9.3.225]) by smtp.gmail.com with ESMTPSA id n22-20020a195516000000b004eafac09d8esm515579lfe.240.2023.03.23.17.40.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Mar 2023 17:40:52 -0700 (PDT) From: Konrad Dybcio To: u-boot@lists.denx.de Cc: Bhupesh Sharma , Konrad Dybcio , Dzmitry Sankouski , Mark Kettenis , Simon Glass , Tom Rini Subject: [PATCH 7/7] arm: Migrate Apple M1 to save_prev_bl_data Date: Fri, 24 Mar 2023 01:40:40 +0100 Message-Id: <20230324004040.572525-7-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230324004040.572525-1-konrad.dybcio@linaro.org> References: <20230324004040.572525-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 24 Mar 2023 02:56:41 +0100 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 Mark's and Dzmitry's approaches come down to the same thing.. Let's unify them by first removing the static keyword from the common file to allow the variable to be reused, then renaming "reg0" to the more sensible fw_dtb_pointer coming from the Apple file and finally remove the mach-apple implementation of this very thing and enable the common approach in the respective defconfig. Only build-tested. Signed-off-by: Konrad Dybcio --- arch/arm/lib/save_prev_bl_data.c | 14 +++++++------- arch/arm/mach-apple/Makefile | 1 - arch/arm/mach-apple/lowlevel_init.S | 17 ----------------- configs/apple_m1_defconfig | 1 + 4 files changed, 8 insertions(+), 25 deletions(-) delete mode 100644 arch/arm/mach-apple/lowlevel_init.S diff --git a/arch/arm/lib/save_prev_bl_data.c b/arch/arm/lib/save_prev_bl_data.c index f7b23faf0d66..a127fec1f149 100644 --- a/arch/arm/lib/save_prev_bl_data.c +++ b/arch/arm/lib/save_prev_bl_data.c @@ -15,7 +15,7 @@ #include #include -static ulong reg0 __section(".data"); +ulong fw_dtb_pointer __section(".data"); /** * Save x0 register value, assuming previous bootloader set it to @@ -23,7 +23,7 @@ static ulong reg0 __section(".data"); */ void save_boot_params(ulong r0) { - reg0 = r0; + fw_dtb_pointer = r0; save_boot_params_ret(); } @@ -51,24 +51,24 @@ int save_prev_bl_data(void) int node; u64 initrd_start_prop; - if (!is_addr_accessible((phys_addr_t)reg0)) + if (!is_addr_accessible((phys_addr_t)fw_dtb_pointer)) return -ENODATA; - fdt_blob = (struct fdt_header *)reg0; + fdt_blob = (struct fdt_header *)fw_dtb_pointer; if (!fdt_valid(&fdt_blob)) { - pr_warn("%s: address 0x%lx is not a valid fdt\n", __func__, reg0); + pr_warn("%s: address 0x%lx is not a valid fdt\n", __func__, fw_dtb_pointer); return -ENODATA; } if (IS_ENABLED(CONFIG_SAVE_PREV_BL_FDT_ADDR)) - env_set_addr("prevbl_fdt_addr", (void *)reg0); + env_set_addr("prevbl_fdt_addr", (void *)fw_dtb_pointer); if (!IS_ENABLED(CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR)) return 0; node = fdt_path_offset(fdt_blob, "/chosen"); if (!node) { pr_warn("%s: chosen node not found in device tree at addr: 0x%lx\n", - __func__, reg0); + __func__, fw_dtb_pointer); return -ENODATA; } /* diff --git a/arch/arm/mach-apple/Makefile b/arch/arm/mach-apple/Makefile index 50b465b9473f..a775d8866ad4 100644 --- a/arch/arm/mach-apple/Makefile +++ b/arch/arm/mach-apple/Makefile @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0+ obj-y += board.o -obj-y += lowlevel_init.o obj-y += rtkit.o obj-$(CONFIG_NVME_APPLE) += sart.o diff --git a/arch/arm/mach-apple/lowlevel_init.S b/arch/arm/mach-apple/lowlevel_init.S deleted file mode 100644 index e1c0d91cef2c..000000000000 --- a/arch/arm/mach-apple/lowlevel_init.S +++ /dev/null @@ -1,17 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2021 Mark Kettenis - */ - -.align 8 -.global fw_dtb_pointer -fw_dtb_pointer: - .quad 0 - -.global save_boot_params -save_boot_params: - /* Stash DTB pointer passed by m1n1 */ - adr x1, fw_dtb_pointer - str x0, [x1] - - b save_boot_params_ret diff --git a/configs/apple_m1_defconfig b/configs/apple_m1_defconfig index b4ecf73cbc78..eb0addb741c5 100644 --- a/configs/apple_m1_defconfig +++ b/configs/apple_m1_defconfig @@ -3,6 +3,7 @@ CONFIG_ARCH_APPLE=y CONFIG_DEFAULT_DEVICE_TREE="t8103-j274" CONFIG_SYS_LOAD_ADDR=0x0 CONFIG_USE_PREBOOT=y +CONFIG_SAVE_PREV_BL_FDT_ADDR=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_BOARD_LATE_INIT=y