From patchwork Mon Mar 27 10:45:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 667395 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp1029834wrt; Mon, 27 Mar 2023 03:47:55 -0700 (PDT) X-Google-Smtp-Source: AK7set8wpjo8QWPs91Ow1yWAPQSS1RC4dz/PbbHeZW9WnYlcFwaZvpL7nUFQAqOgPQ4KKYLR+oci X-Received: by 2002:a05:6a20:3396:b0:d9:3937:43a7 with SMTP id f22-20020a056a20339600b000d9393743a7mr9099908pzd.55.1679914074977; Mon, 27 Mar 2023 03:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679914074; cv=none; d=google.com; s=arc-20160816; b=CaQ5/dhcKVeWHJQMtML6Dcr38IxPJL9iFP3ThBbzbpdhjjwrd1b/xRqErhZWdaJq4T TaErkPuxReCSAg58BBkhhn+PjnZKRhifRgUvzSSPLLkOO7OG5uYN4uLwewjzxAUWFmgJ +j9LkwGp+XsZZPdD8jZt55/ESv3IExE4+eeJaVQpBxvarvOwlbZ7sQW3D2AxkBOIyeAV XgrM/b3dm5QQeOvg44qLtLYostV4dVL9sCIKW5xVp5fYyrVNPJ2N1i6DnrRiEvdXInCA sjDfyVoEwbN0HsBp2D6MTiGsiX1PFL2SCb5txhP8X50Wv3JOLcXL/n7ESdNod1GyHALP 5Clg== 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=mmLql0diC28QWAHpPa7Fcb7VnI+99FGaMYo5cHGlw2s=; b=Kqiwidr3nI/pu0W9GlY7+3sFTf+RLOwuvE+4PNXrnYlkv+oUQpRAoCKMF25F0te2kT mPX2PT1ESI+EV/ht63iPUbu9/gO2w6K3CnahQMyqoMSEEW3cOtTHn7La4bLcTx52tnzP G8eMDlaCYmiGFrsIdSTZ+Rby+3vI68BdhM/jsUt+l9gZITA3J89Z0Wsu3az83/huzTat KeH4Hl/Aoj4YneZVtZi2U+ME2PAxTOLMiu9UpsXUnMh95bMKGlfgWkPNFB6TmHnRU/96 RzJI9YZeiFlmmjX4kOVi7QwlNcwV2MBx5rXFuFKwqwyHiKAzor1GHOd7jmrQ9cC4fGfm 2jow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UBIIirty; 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 e65-20020a636944000000b0050f7c2037bfsi9563544pgc.605.2023.03.27.03.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 03:47:54 -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=UBIIirty; 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 34021860BF; Mon, 27 Mar 2023 12:46:51 +0200 (CEST) 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="UBIIirty"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C8ACC85C5F; Mon, 27 Mar 2023 12:45:40 +0200 (CEST) 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-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) (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 348AB85D13 for ; Mon, 27 Mar 2023 12:45:23 +0200 (CEST) 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-x129.google.com with SMTP id i13so10772714lfe.9 for ; Mon, 27 Mar 2023 03:45:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679913922; 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=mmLql0diC28QWAHpPa7Fcb7VnI+99FGaMYo5cHGlw2s=; b=UBIIirtyeGPkOeJS3EEApdl6s+5vcWvuNGHAvxEj/0jwwkr/ER0xc4Zd2ZAKq81gjS II0L/AH0R7qfaRZod8K5b2//56cgcko4+JhHpWhlH+ygEkwinKjsBlkrx7oHXPvvHORc 6KMh570HoB5A6s26eLOGEj1FbQ07/7Jw2ZFrGBYlOeDbKXzvQG096agUdRSs4XM83bSC GW5ELGpOTKDWT60wcj/ryX88qPysWnDA/BYtD3USDcDMPf++CwCyLgoliWUSGco9n2w2 Zp0Y3RqSrDaVMHzrSgLeEkRi4B6hJO0tcFHqwZ0AARMt+akMGYTPetmL+7b4oBiTFcI3 8e9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679913922; 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=mmLql0diC28QWAHpPa7Fcb7VnI+99FGaMYo5cHGlw2s=; b=yMClG2au08Rt+sLWhDbpTSjjSeWEjxGIqhGwHmIXxEeqpJVGUUUoNPRPrAiQ9LVRBP qfFtUk7Nkf0n5UrPfGw9oip9zRUdLFF3JSK1MHk/QNaw9ullhCdRSeCNz7ax8yt3DsLz qOC+VZCILsScYgVfrwR0VPQSqrtj4mZWjudyJ+ZOakLnVmyrnc0kwQ/PalZzeycp8Ja7 6eUxOzvYraGIgVS7uotm02zTTi+k8IVsmT4mxRXfiv3DWZVTRYhuHRzhsWQn0cZLFQf0 lLd3M59lErhHkPZlHYLRwdLJHo1fK9kNOhhnBEYN6qldLbkZAwF8YGVL1ZsuaHk+Bsa8 qmng== X-Gm-Message-State: AAQBX9fp15o+8BApnZJ67g1llM1b1TSgeMkeOk+dBQLJbDKGbN6k31hx 4W17/o6gUwT9T+3N0548nWKFVA== X-Received: by 2002:ac2:4358:0:b0:4ea:fafd:e679 with SMTP id o24-20020ac24358000000b004eafafde679mr3829202lfl.36.1679913922515; Mon, 27 Mar 2023 03:45:22 -0700 (PDT) Received: from [192.168.1.101] (abxj225.neoplus.adsl.tpnet.pl. [83.9.3.225]) by smtp.gmail.com with ESMTPSA id y22-20020a2e95d6000000b0029bfcbeac09sm3715904ljh.41.2023.03.27.03.45.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 03:45:22 -0700 (PDT) From: Konrad Dybcio Date: Mon, 27 Mar 2023 12:45:07 +0200 Subject: [PATCH v2 9/9] arm: Migrate Apple M1 to save_prev_bl_data MIME-Version: 1.0 Message-Id: <20230327-qc_cleanups-v2-9-9a80cc563c76@linaro.org> References: <20230327-qc_cleanups-v2-0-9a80cc563c76@linaro.org> In-Reply-To: <20230327-qc_cleanups-v2-0-9a80cc563c76@linaro.org> To: Ramon Fried , Peng Fan , Jaehoon Chung , Mark Kettenis , Sumit Garg Cc: Bhupesh Sharma , Dzmitry Sankouski , Marijn Suijten , u-boot@lists.denx.de, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1679913910; l=3715; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=1YsCuelIjf40GyBsMn5ST4vFAakSp/+W/I83S2e69zs=; b=0/2kfUDPEuz78PKwo9pQpyu/0ZUuvoox+lfAffJzMm0GKygOTLOXO6Y/aO56Mos0p50MyKsBAAjb ul36+FswBI9UuRkZnJoQxSG5CsX1PSRGdSAhyM6lOa0IwSBAx1/B X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= 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(-) 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