From patchwork Sat May 8 15:15:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1475884 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=YL9PFesP; 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 4FcrWF2CFpz9vFc for ; Sun, 9 May 2021 01:16:25 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9198B82E8E; Sat, 8 May 2021 17:15:50 +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="YL9PFesP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B734B82E87; Sat, 8 May 2021 17:15:38 +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-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) (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 876C782E77 for ; Sat, 8 May 2021 17:15: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=bmeng.cn@gmail.com Received: by mail-pj1-x102b.google.com with SMTP id gx21-20020a17090b1255b02901589d39576eso624563pjb.0 for ; Sat, 08 May 2021 08:15:34 -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=V2uY6L6CH1l/THEbQzLDCuvHXM4g1zpJl49PX58EV04=; b=YL9PFesP5nkwabxfMHg7i2cJS2e33zZEqJ/mRvoQ+TWql7/EgYCdaB9j4LEs+gBrCJ 5iwZe9g9Lohh754VaQOuUT83YSNt6rZro/PWuU5ggLeJtikr8WUo2xyx/noAO8Qc4jMk Z0bZEDOnFajx44TnQi1H1EzuRZjIJvI9JUDNuS0KgMQfjy5SD9yIBXl6m16xRxPiKml1 yEKN02RFzvilyd1HA+z4ifobCnqZp7JZi5W0Q2bBNLd5pBBjHpswm91y0gcWZPQkjb68 vlrWhTLb75POoTLgJN4yy2RFXYji/z2eYaQ+wkE8geS1h83Z0qbXMKPJWml3Nx8VARyN Hq8A== 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=V2uY6L6CH1l/THEbQzLDCuvHXM4g1zpJl49PX58EV04=; b=GUwaBmmGufLIIMGVmNbC9mF7wff3n/xELQYoCy4T9Ty/JFpWW1qBaPhUrSQcLjgbLK ustpU/LtJazy3DXFzLC98MSOJUSaGMxMHCHwCdMwdjkYUzDEauFrcB6/9BIJCapLQNmV BObyyPb7Wgk9F/TxVwZSSkjbMeuowDxTPCg6rB39H2zL5XBYmmyxa1qgYqLiLAr0ELPA 2l3JnpVp0fXSPczspKeM4kVdoKCQZzg2hXrIKfLLSll557cw+cfWO8gCUXVSjh0/vELZ B3DVsDx5Tbc+aIBvlf2rwfBEw4qpSkmt5h5ZfjpGRz3JOCTOZ9rtxEClfrDylu/OJaaD Ux3g== X-Gm-Message-State: AOAM531LVvtT5eCdU8UJ1nTcEMohmju11wLO4j9CdRN0nUmELvddJYKx Vmj9wDDIStBg3IBZMYgau+MfyMJt5rI= X-Google-Smtp-Source: ABdhPJxoPjuYWXmuFlYlmkZRpCuqbSxSNJQG0kTbKfLYRF5NWq3l15/hu6CwLlSSyACTxpP/kTE90g== X-Received: by 2002:a17:903:2403:b029:ee:eaf1:848d with SMTP id e3-20020a1709032403b02900eeeaf1848dmr15422716plo.63.1620486933151; Sat, 08 May 2021 08:15:33 -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 w81sm7144810pfc.106.2021.05.08.08.15.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 May 2021 08:15:32 -0700 (PDT) From: Bin Meng To: Simon Glass , u-boot@lists.denx.de Cc: Rick Chen , Bin Meng Subject: [PATCH v2 05/11] binman: Add support for RISC-V OpenSBI fw_dynamic blob Date: Sat, 8 May 2021 23:15:06 +0800 Message-Id: <20210508151512.14946-6-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210508151512.14946-1-bmeng.cn@gmail.com> References: <20210508151512.14946-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 --- Changes in v2: - drop "size = <16>" in the binman node tools/binman/entries.rst | 13 +++++++++++++ tools/binman/etype/opensbi.py | 23 +++++++++++++++++++++++ tools/binman/ftest.py | 7 +++++++ tools/binman/test/201_opensbi.dts | 14 ++++++++++++++ 4 files changed, 57 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..942183f990 --- /dev/null +++ b/tools/binman/test/201_opensbi.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + opensbi { + filename = "fw_dynamic.bin"; + }; + }; +};