From patchwork Mon Apr 6 20:44:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 1267081 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=AAJgxekA; 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 48x2tq1sRjz9sP7 for ; Tue, 7 Apr 2020 06:58:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C29738006D; Mon, 6 Apr 2020 22:58:04 +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="AAJgxekA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 330A58006D; Mon, 6 Apr 2020 22:58:03 +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 esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) (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 8206580199 for ; Mon, 6 Apr 2020 22:54:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=wdc.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=prvs=358c7da5f=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=1586206448; x=1617742448; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z8CGjJF2UQihHs927Igkajd9xRVmjHuVwfs+ZEExYjM=; b=AAJgxekAF8Rg+0FFw8BywuozJrG9lEVCg89E2bzKsoVrEpG6Q7pGEBDc QCxktL8ue1a9uuktw6DyvbfPSxYaBwKRMgSATV2Lmv0T8DK5f34JdEzsC DCRP7H6Ky1wdic82FN8CQ0jEM5SyUuZsXAgFMvbTWdAzEIFrulRQ7QiV1 BLMGXv3hZUBP5nuame9nsiivxOpj69/WK7LikSTb2srjlGs/r0vllIncD yaSHqMApTnpMO/0XWhSHprxpbkDNupjnSauOYUQDd95aqjieRZK9NhAYQ 71T5ZCil5BT5t02AmD688yftaEmN2eHqVxzMXRb8/06YWdHN2unTc5L2m w==; IronPort-SDR: HOFFi5mCOQFsurcUDsd3sie5FuMXC8R/jeMN3D82+z8YOJO3O3x24pjclu3ZI/YO70pxBXTYa2 p/JHmskzFhjWz3e9lyEVZkwZb84HE+3AYjhN9M7IGDv4fJ+1jRfXf3upMjHBo8muE2yxKorC+x Fmre0VMvabj/vrrSiL2QZMZ+DsIc9UfSPm83n51gR49shR9XlmtbzNCTxiRDKYcYz3/duNZ0tR uD8WxDeFtTpflLs/ZKw9SQKgvjjZCx2oyLt211ZE/wH4uwdVFPmFiQUi8YzoeeiytfCupuOsyr laE= X-IronPort-AV: E=Sophos;i="5.72,352,1580745600"; d="scan'208";a="136167715" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 07 Apr 2020 04:45:00 +0800 IronPort-SDR: GVwzMmR9iVSa1pUYpnHC5vDy5Evm9OsvNU46GsIvhZrJHM+iF7sF+DGS5Nv+SiS1ybc5JSRPok cEQ+HNtOiCVOtiuSEvS5MeaMTykjnsjV0BFtWNPfWJ7flx7y50Us3HXFuXKAfyORyYcK3V7LOj xWi9PiAMikZknbfxilFUusAo7JEUVeHwFwO+C+4Hsl9C525seurhTmzS/3MgSfBMLlSIYJ09PR zMULiH9OqSJ01sz3ABcIiWyYqemQ3feP59fTzeJVzj61JM234GlLRp1bLwxComGjuQFd/if5i8 7ZJg4TniL4Kkh+DC9RxTDwAv 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; 06 Apr 2020 13:36:17 -0700 IronPort-SDR: FX2hp2kJGLi6FatSzd8F0qIIio1FbwlVYtHPk42tIHaJPLrSjWquavy444N+iX30eiMrsOwNQ8 aKJQhyIZmmn6V+Pf2JHKQ9U6dfFRLxD5oGVWzxhlW4EozW5CaqCl9JfLlDDBR57N8mcZQ9hSTg e/gGLLqTfiJaRE7+xEscyPDeOYe3BbHQoH1Kf1LXvrM/IDm5UtlJgKEps2nA/aFb0PQel/XJ83 MolzWBaq1Lu+Bm2YjWUwsORB46wA2hYJ4Am3fe1Sx4w/jAB3O/aNU/fgHU9hajjSpPRjycc8ay rRU= WDCIronportException: Internal Received: from thd007499.ad.shared (HELO yoda.hgst.com) ([10.86.55.81]) by uls-op-cesaip01.wdc.com with ESMTP; 06 Apr 2020 13:45:00 -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 v5 6/6] riscv: Move all fdt fixups together Date: Mon, 6 Apr 2020 13:44:53 -0700 Message-Id: <20200406204453.231945-7-atish.patra@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200406204453.231945-1-atish.patra@wdc.com> References: <20200406204453.231945-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 Keep all the fdt fixups together for better code management. Signed-off-by: Atish Patra Reviewed-by: Bin Meng --- arch/riscv/lib/bootm.c | 33 --------------------------------- arch/riscv/lib/fdt_fixup.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index 8ff8db6bf533..0d06095da11a 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -26,39 +26,6 @@ __weak void board_quiesce_devices(void) { } -int arch_fixup_fdt(void *blob) -{ - int err; -#ifdef CONFIG_EFI_LOADER - u32 size; - int chosen_offset; - - size = fdt_totalsize(blob); - err = fdt_open_into(blob, blob, size + 32); - if (err < 0) { - printf("Device Tree can't be expanded to accommodate new node"); - return err; - } - chosen_offset = fdt_path_offset(blob, "/chosen"); - if (chosen_offset < 0) { - err = fdt_add_subnode(blob, 0, "chosen"); - if (err < 0) { - printf("chosen node can not be added\n"); - return err; - } - } - /* 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; -} - /** * announce_and_cleanup() - Print message and prepare for kernel boot * diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c index af12e484db9b..20e0759f135b 100644 --- a/arch/riscv/lib/fdt_fixup.c +++ b/arch/riscv/lib/fdt_fixup.c @@ -115,3 +115,36 @@ int board_fix_fdt(void *fdt) return 0; } #endif + +int arch_fixup_fdt(void *blob) +{ + int err; +#ifdef CONFIG_EFI_LOADER + u32 size; + int chosen_offset; + + size = fdt_totalsize(blob); + err = fdt_open_into(blob, blob, size + 32); + if (err < 0) { + printf("Device Tree can't be expanded to accommodate new node"); + return err; + } + chosen_offset = fdt_path_offset(blob, "/chosen"); + if (chosen_offset < 0) { + err = fdt_add_subnode(blob, 0, "chosen"); + if (err < 0) { + printf("chosen node can not be added\n"); + return err; + } + } + /* 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; +}