From patchwork Sat Apr 18 19:32:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 1272711 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=XcCpmZ57; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 494NT06vmwz9sP7 for ; Sun, 19 Apr 2020 05:34:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7457481C76; Sat, 18 Apr 2020 21:33:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="XcCpmZ57"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5B68781C5E; Sat, 18 Apr 2020 21:33:17 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5F05181C72 for ; Sat, 18 Apr 2020 21:33:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=wdc.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=370d05252=atish.patra@wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1587238385; x=1618774385; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=15wEaSM5+aJTlTiM9DMRllUUNc6sZN1168dhM8zY40U=; b=XcCpmZ57zZVcqYJnvIBrrY24HHejDJRi3lX3f9wVddRtX2IwmchdxVRx ThRZ4ks5IEEVcD4Q4830O12dFqvd0K0ziJx4jwWF7qsNAlNguRsQuzFlD LHSeEbSJwbDQgIX+Iorr75SJ50LB+G/yGTw20Zr6/oRn2RgNKWWYbzDgl 9EBJQSwjs1pEi5JrXqJ96+rGElfU2Y56nOLdEZ2yMh3KBWBG9frKzhJx1 0Y5GGNJO3GHd2+K9d1ao/BnNTerZMmC+oKiyrS6mUC6k8JplckuBPssuO b4DUs8Lx27RTBwk/JN8hjAeUiZMe+oXew3GYwVxJUkChEWBm44qO0FYxs g==; IronPort-SDR: rDquwtU1PYWO0l5zjlfvKuFZ4HHDcxFwWVq8oosBK49m2+1A//c0aI2TOukFU7bQWb57hMDhXN PQTP1RmrmMg27AQIIiTl5/1bkvYXfCmcorZZ0IoGRTy8s7Pm1OsKmVyfDRLA4ODWI4JUJiSueq SbDmgnae1OkDmW9WPCOD00i0XiCBFFZ5j1PQGXuPUMYESNOi+Ug1uJ2ZYAAcKD3Spxp+/Zg9X+ LKGkSZeWyqHT8IlRtFd32b/Ok92RKkbv9nMsBq+WxCMKiKm3OdtzYEpbqkzBlQIOC5mTUx+QHY MQA= X-IronPort-AV: E=Sophos;i="5.72,400,1580745600"; d="scan'208";a="244312818" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 19 Apr 2020 03:32:43 +0800 IronPort-SDR: 6iZcBZq/vsJYbWM+GQwKKcnwEfMWHxmTfOj+/oZTQvOK+KfFWOo3QFCHVx2BcB3neqzQ8MJGcE 7I3CzGes7/qj7MlndvknCkaJecCJsn9uc= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2020 12:23:40 -0700 IronPort-SDR: SRbsH59gwtxJyw+0D85Qq548XdaEqPVdsEWUvfu6ibATRdHWHicikhsL/61BO0MYt67lqU042a oywOe7dQjOzw== WDCIronportException: Internal Received: from cnf007834.ad.shared (HELO yoda.hgst.com) ([10.86.56.8]) by uls-op-cesaip01.wdc.com with ESMTP; 18 Apr 2020 12:32:43 -0700 From: Atish Patra To: u-boot@lists.denx.de Cc: Atish Patra , Bin Meng , Anup Patel , Lukas Auer , Heinrich Schuchardt , agraf@csgraf.de, ard.biesheuvel@linaro.org, Marcus Comstedt , Paul Walmsley , Rick Chen , palmer@dabbelt.com Subject: [PATCH v6 5/6] riscv: Copy the reserved-memory nodes to final DT Date: Sat, 18 Apr 2020 12:32:27 -0700 Message-Id: <20200418193228.44209-6-atish.patra@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200418193228.44209-1-atish.patra@wdc.com> References: <20200418193228.44209-1-atish.patra@wdc.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean The DT used by U-Boot may be different from the DT being passed to the OS if the DT is loaded from external media such as network or mmc. In that case, the reserved-memory node needs to be copied to the DT passed to the OS. Signed-off-by: Atish Patra Reviewed-by: Bin Meng Tested-by: Bin Meng --- arch/riscv/lib/bootm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index 87cadad5016d..8ff8db6bf533 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -28,8 +28,8 @@ __weak void board_quiesce_devices(void) int arch_fixup_fdt(void *blob) { -#ifdef CONFIG_EFI_LOADER int err; +#ifdef CONFIG_EFI_LOADER u32 size; int chosen_offset; @@ -50,6 +50,12 @@ int arch_fixup_fdt(void *blob) /* Overwrite the boot-hartid as U-Boot is the last stage BL */ fdt_setprop_u32(blob, chosen_offset, "boot-hartid", gd->arch.boot_hart); #endif + + /* Copy the reserved-memory node to the DT used by OS */ + err = riscv_fdt_copy_resv_mem_node(gd->fdt_blob, blob); + if (err < 0) + return err; + return 0; }