From patchwork Wed May 5 14:15:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1474360 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=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=F/Uck6JS; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4FZzLm2BnDz9sVb for ; Thu, 6 May 2021 00:17:36 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7A7F382D3E; Wed, 5 May 2021 16:16:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="F/Uck6JS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D9FA582D2C; Wed, 5 May 2021 16:16:27 +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,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (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 7B7FF82D17 for ; Wed, 5 May 2021 16:16:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x62a.google.com with SMTP id h7so1179515plt.1 for ; Wed, 05 May 2021 07:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ty7v3a4LpxfHGZOStR12XjWB6imfx5va9LZ88lvYhzA=; b=F/Uck6JSLd8vsMB7t15Zi+E3j6tGXv9jm9oZ6ezV/NKrugkqzQKHZmN5wiwqB6q0/N zPAPTcGnBpVDXg9y3/++ZsSabn21EGYjkq61UmqJEnkO4BuhVGRMjMnA+uVfc6tP4w7h Si6aa6dbQdNGxsvpojKtjdxiQpgtOHwA6guPytXsYS27b7DO+yYw73EGSSxLOYKK+mIZ DgtHWQyThraInfQ4vJwaDdl9wTqOQgr/wTCVCMXXeWSJ7p09rFyVx9VZopSJKMLojord aR+5RaGIyNzKw4yB0KtFLiWFc9pDkSr3FAwk99+wK5CYuD0o0TywjPWnxNFvyxmrPNJ4 jw4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ty7v3a4LpxfHGZOStR12XjWB6imfx5va9LZ88lvYhzA=; b=OsOtnBFwIqLJBR/vxKPwEj+QrgbG17GRGR5SRkiMjfSiIYF1kvk+pPC2Qk/f6bcJVD 2FQ4pulnlrTtWOpEXh0Pg/V36rZSjuyeXd93mgyidtqh2gzvo+/qExEOxbkAd2WE4niJ mlrgBVLuZe837DhVOOA23MgjHaa+iXRCpoHtPC8bp2I7TlOG+ESW2f7JP7i7u0JZiT2U Y0P/yj8o+OCsqnlgBB+Dvhxo3msUUO1YR+Bo797d9vhHsGEAoBnbWrV80XBwuIJYGGwe 05A4Lf2RazzVO4hAMZaTzq7GaejrEa78l9ErByBnZh+I5mG8O9+oF1OpNjWEVqhsk7fn m9Cw== X-Gm-Message-State: AOAM530EdFWa4nowtZ35KCjCPx+27G3AJyr4jKOJUh7+0cB0Dkv029yU ZLmieY/qBMesXepkgZK73L8= X-Google-Smtp-Source: ABdhPJzWC73bNQF/QDSKxKczmFk8IMuisKHq1WKA7cRy+lY5S+/eaWY/5rbCI0uBVoW88HDtiNiuIQ== X-Received: by 2002:a17:903:248e:b029:ec:9fd5:eef4 with SMTP id p14-20020a170903248eb02900ec9fd5eef4mr31463437plw.81.1620224181031; Wed, 05 May 2021 07:16:21 -0700 (PDT) Received: from i9-aorus-gtx1080.localdomain (144.168.56.201.16clouds.com. [144.168.56.201]) by smtp.gmail.com with ESMTPSA id t10sm7831482pju.18.2021.05.05.07.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 07:16:20 -0700 (PDT) From: Bin Meng To: Simon Glass , u-boot@lists.denx.de Cc: Rick Chen , Bin Meng Subject: [PATCH 6/9] binman: Add support for RISC-V OpenSBI fw_dynamic blob Date: Wed, 5 May 2021 22:15:54 +0800 Message-Id: <20210505141557.23901-7-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210505141557.23901-1-bmeng.cn@gmail.com> References: <20210505141557.23901-1-bmeng.cn@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.4 at phobos.denx.de X-Virus-Status: Clean Add an entry for RISC-V OpenSBI's 'fw_dynamic' firmware payload. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- tools/binman/entries.rst | 13 +++++++++++++ tools/binman/etype/opensbi.py | 23 +++++++++++++++++++++++ tools/binman/ftest.py | 7 +++++++ tools/binman/test/201_opensbi.dts | 16 ++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 tools/binman/etype/opensbi.py create mode 100644 tools/binman/test/201_opensbi.dts diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst index f1c3b7de7a..dcac700c46 100644 --- a/tools/binman/entries.rst +++ b/tools/binman/entries.rst @@ -761,6 +761,19 @@ binman. +Entry: opensbi: RISC-V OpenSBI fw_dynamic blob +---------------------------------------------- + +Properties / Entry arguments: + - opensbi-path: Filename of file to read into entry. This is typically + called fw_dynamic.bin + +This entry holds the run-time firmware, typically started by U-Boot SPL. +See the U-Boot README for your architecture or board for how to use it. See +https://github.com/riscv/opensbi for more information about OpenSBI. + + + Entry: powerpc-mpc85xx-bootpg-resetvec: PowerPC mpc85xx bootpg + resetvec code for U-Boot ----------------------------------------------------------------------------------------- diff --git a/tools/binman/etype/opensbi.py b/tools/binman/etype/opensbi.py new file mode 100644 index 0000000000..74d473d535 --- /dev/null +++ b/tools/binman/etype/opensbi.py @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Copyright (C) 2021, Bin Meng +# +# Entry-type module for RISC-V OpenSBI binary blob +# + +from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg + +class Entry_opensbi(Entry_blob_named_by_arg): + """RISC-V OpenSBI fw_dynamic blob + + Properties / Entry arguments: + - opensbi-path: Filename of file to read into entry. This is typically + called fw_dynamic.bin + + This entry holds the run-time firmware, typically started by U-Boot SPL. + See the U-Boot README for your architecture or board for how to use it. See + https://github.com/riscv/opensbi for more information about OpenSBI. + """ + def __init__(self, section, etype, node): + super().__init__(section, etype, node, 'opensbi') + self.external = True diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index b0daccbc3b..5383eec489 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -76,6 +76,7 @@ FSP_M_DATA = b'fsp_m' FSP_S_DATA = b'fsp_s' FSP_T_DATA = b'fsp_t' ATF_BL31_DATA = b'bl31' +OPENSBI_DATA = b'opensbi' SCP_DATA = b'scp' TEST_FDT1_DATA = b'fdt1' TEST_FDT2_DATA = b'test-fdt2' @@ -178,6 +179,7 @@ class TestFunctional(unittest.TestCase): TestFunctional._MakeInputFile('compress', COMPRESS_DATA) TestFunctional._MakeInputFile('compress_big', COMPRESS_DATA_BIG) TestFunctional._MakeInputFile('bl31.bin', ATF_BL31_DATA) + TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA) TestFunctional._MakeInputFile('scp.bin', SCP_DATA) # Add a few .dtb files for testing @@ -4535,5 +4537,10 @@ class TestFunctional(unittest.TestCase): expected += tools.GetBytes(0, 88 - len(expected)) + U_BOOT_NODTB_DATA self.assertEqual(expected, data) + def testPackOpenSBI(self): + """Test that an image with an OpenSBI binary can be created""" + data = self._DoReadFile('201_opensbi.dts') + self.assertEqual(OPENSBI_DATA, data[:len(OPENSBI_DATA)]) + if __name__ == "__main__": unittest.main() diff --git a/tools/binman/test/201_opensbi.dts b/tools/binman/test/201_opensbi.dts new file mode 100644 index 0000000000..16c01a946a --- /dev/null +++ b/tools/binman/test/201_opensbi.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + size = <16>; + + opensbi { + filename = "fw_dynamic.bin"; + }; + }; +};