From patchwork Thu Feb 27 21:00:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 1246109 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=hy5E+VLZ; 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48T4pG0M29z9sPK for ; Fri, 28 Feb 2020 08:01:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B628B80D34; Thu, 27 Feb 2020 22:00:53 +0100 (CET) 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="hy5E+VLZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4988780829; Thu, 27 Feb 2020 22:00:48 +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.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 esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) (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 7F806804CD for ; Thu, 27 Feb 2020 22:00:44 +0100 (CET) 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=3197e1cb9=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=1582837245; x=1614373245; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vlVgPFOFgb1Pt94s0nGs03azMVL0x9P3ODBmSgAgy6s=; b=hy5E+VLZa3AXCGfVX4LOgdBGIVUnrjLHbrRFRISEFdE/PhfKTLXbR2aH LogFKMTPGMzCmOz2sYiOXYYEswI29VhfYzsdqWYSC2K83kuPf2+5YWCFz NLao449MDBLR9VRQ489zSG7krgUI0Bjp4GNCu4IDM6qZDarx75NatAaWX agHu//3mBpPsLnZx+VMDwkECq+lJdqxB6kX2LuTQClu+OMF9qcjutngo9 zerByELxfCjbAPan9KDOa+VZiIlxwem30eb6Rlbgcg9YuhtwitN85gne5 heHKhKpPbYTZBz6zU0zE5MWM9ukXwiW0UCHcqvn3N4WTLlhmhkrQQI4ay Q==; IronPort-SDR: coicOzVz6FsfkVyIJfhOdgKMt6qP7a4U8QH6YXU1qNIgSJa+42ckdeI667SM1bUv62NipMIMaS VvsY972KYh1w0CGbnHk/n5877qevliT6f5n/v+vZ8kQyjcPs74YplfJZLeX+vt4rV4xgt73o8G rVtRNF0cQ6HyyGgeFoRY+OrzUtMKAPWbmqBNKVFtL9eu7RhVIfPTLGOoxGKhxO+Ajosf0NplFV R8T9FPVyw6cf1GGtH8PMv2npbTuVaKU5uKKgQYQDMsY3ZIlRbwmeDEdh6PjwxS95LHQOyqW6b2 XH8= X-IronPort-AV: E=Sophos;i="5.70,493,1574092800"; d="scan'208";a="135335278" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 28 Feb 2020 05:00:40 +0800 IronPort-SDR: 6nMkxTXRhL71TotW0cHU0SCjhC2kNo+aB/9YkE4XtWTII8L3MrI2KsLUzSAf+WEb28UcJdGe21 ILlRDHdLEBvvZ5XDXsJeikqKDoeuQ/BqdQhImsuwFrnT9PrvgIEkSWhNQVM7+Qqg4qT3js9Tza av940zaVD8MIqOXKMw2ohYaN35CQkF3L/SscLkGB4MMT3c37nNQoCzbOQONk2Io3ZbhNc8jbTI nHPanZh+d+TmL5gLonFT7YI+jJXdcWVCBU7Ycs9MRBumrLyh0oP3bqNGGyoDmmQCbFskcvbwdO en5V/IH/vsD0ps98mLL3viGI Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2020 12:53:02 -0800 IronPort-SDR: fgF6YbqnmtKT/FZAJ2DpwMiALlzdQ1329kN0Ecw+l57D2CCfDCZmVaEf9im9HMmf8WluS27Jg2 /65SWrWXgXMXYpFraxa+Q8ejfzIDb6xlLuSKZTbC1cGuFq3PCntv56ldQaLre0zh0KzJV06Osy nFZadlbyxVlWcVZQdktyfAsAfTVCpa9N88L+E+/H6QLkwToOwP2l/mej52LR7bONs1CYEDwX6A zat0i4X4JF1HCJ5D9SwlO/gCmPX7xxxpvg3SvvIzLSvoqOcmZZ3OO3Jvehubh+mEjlzxklKz8Y 49E= WDCIronportException: Internal Received: from jedi-01.sdcorp.global.sandisk.com (HELO jedi-01.int.fusionio.com) ([10.11.143.218]) by uls-op-cesaip02.wdc.com with ESMTP; 27 Feb 2020 13:00:39 -0800 From: Atish Patra To: u-boot@lists.denx.de Cc: Atish Patra , Alexander Graf , Anup Patel , Bin Meng , Joe Hershberger , Loic Pallardy , Lukas Auer , =?utf-8?q?Marek_Beh?= =?utf-8?b?w7pu?= , Marek Vasut , Patrick Delaunay , Peng Fan , Philippe Reynes , Simon Glass , Simon Goldschmidt , Stefano Babic , Thierry Reding , trini@konsulko.com, Heinrich Schuchardt , Ard Biesheuvel , "leif@nuviainc.com" , abner.chang@hpe.com, daniel.schaefer@hpe.com Subject: [v1 PATCH 1/1] riscv: Add boot hartid to Device tree Date: Thu, 27 Feb 2020 13:00:35 -0800 Message-Id: <20200227210035.6246-2-atish.patra@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200227210035.6246-1-atish.patra@wdc.com> References: <20200227210035.6246-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 Linux booting protocol mandates that register "a0" contains the hartid. However, U-boot can not pass the hartid via a0 during via standard UEFI protocol. DT nodes are commonly used to pass such information to the OS. Add a DT node under chosen node to indicate the boot hartid. EFI stub in Linux kernel will parse this node and pass it to the real kernel in "a0" before jumping to it. Signed-off-by: Atish Patra Reviewed-by: Rick Chen --- arch/riscv/lib/bootm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c index fad16901c5f2..dd359a45c2e1 100644 --- a/arch/riscv/lib/bootm.c +++ b/arch/riscv/lib/bootm.c @@ -28,6 +28,19 @@ __weak void board_quiesce_devices(void) int arch_fixup_fdt(void *blob) { + u32 size; + int chosen_offset, err; + + 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 -1; + } + chosen_offset = fdt_path_offset(blob, "/chosen"); + fdt_setprop_u32(blob, chosen_offset, "boot-hartid", + gd->arch.boot_hart); + return 0; }