From patchwork Sun Oct 18 05:14:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1383800 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=FcvSFk++; 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=Z7d7KtLf; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=XtW8Shag; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (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 4CDSlB12yWz9sTL for ; Sun, 18 Oct 2020 16:15:31 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jgYbly5h9rlYDUunKU9wrGvjbphDB+9iUgW+9Sl+XjY=; b=FcvSFk++JBqDruHj2amSFt+lV nBbnF+Q63vsvq1Ob3U4BWB4KXA5ma/2HIhXb65T2uJQE4LNavwj8mtEPT85yZg0Z6YKGJ5WawvmEt XzChuJGvu97fGPridrAgPjuDSafwFYoY7Ihd0TUJfnHfIXLoDatBPSLHrnuiNMkdH0kM7JU8g9P0w CSpnsuVItY16CIYkC6vsLpTN+fB0t/AXe7kb4RMXkrVMrilYg8bSyTRnxRi9l3iWitsuWfeF1WkRP X1nxUmtjgTOM/GnIJD6bqEtf7ACqiHhZ2IfG0gjcDokQwYbCei0jF6SO1yPPNsx+/mTSOb7i9DT6a TXCJXk53w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kU12U-00015m-Q7; Sun, 18 Oct 2020 05:15:26 +0000 Received: from esa3.hgst.iphmx.com ([216.71.153.141]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kU12R-00014X-96 for opensbi@lists.infradead.org; Sun, 18 Oct 2020 05:15:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1602998124; x=1634534124; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=okhVt+iMTdVfXszS0dsLcNuV8ShhwR4ytQW+4mn/iYI=; b=Z7d7KtLfXbmhJYRwVwgxwQhsC3NwaDvxcnvu+p4er74ZlBfig/euoRdX 34SpjL9tdpEgUQ1x2tnqSxkADJDAJm6Mhr2VImJKLDlKuvk7ecwezrtnN +oYENM8apSznvl5IiHW6NAMPhdXHx67S8Vnql2kAeuu/S6jekqgB1CCNo 9cRjhDV/09oATwQm+fAFqA9xomjbrWjwYmeIrWsBj+ij0QvRdLQZtE2L1 cbROakE/jkWTZxFRukAlkf2z6nwpl97PnYuLR83jC203WGa2Kfjo1NNmC xWHMo+pAfrsQCLXlOm3xgi0gihKS8SAkTv5EpFqqnHaSBMsGh/zXnRJAs A==; IronPort-SDR: /y76+EfsaiOA6P8+ckcx+qZCKo0xxMziKFr7Bn529/zt3yz+yxlqA51Do3pJ89hXHRFdzgJpbb KQUhjzUj+/YRPe+UncDCj8paKgjXRdplMNAMXd6O/WDTC1DMPF/9MPIgRmPAquN7Q6WHZ61+/m cWVXGnHv+haRqizB0B6JFixB2HmruJHj1KD8fzmO3IFvolxYra7RIzvnFErjSMsw8dMrrN0+9f bfOCTzhys18UPILW1TUuAilKgX6aGMdrOCvVtYeBN2fr5Y3ckNDgxm5+zK+8TCFHa6w1Nfz53N 39s= X-IronPort-AV: E=Sophos;i="5.77,388,1596470400"; d="scan'208";a="154677432" Received: from mail-co1nam11lp2175.outbound.protection.outlook.com (HELO NAM11-CO1-obe.outbound.protection.outlook.com) ([104.47.56.175]) by ob1.hgst.iphmx.com with ESMTP; 18 Oct 2020 13:15:21 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nnhl97FT5g1rldMGLTXutZzlTzIwDvi2Sk780npUIUhDEHBTuLNEw3kDdJzbTAtMfvk320RXYN+Qsg1EfcqDA3gjBbOoNmDzZpUFEkv0zXJJRrcZn1QqQ/8lT5fq6UPU2hgpxF3l7ihURveqCtnxmKCooKBS2ZRCgyGJ9YHXLi9Ca2JWzL2/+q2g7WvslBoGlbdzaEl66Cwa3qEl9PwY3QxlvbBjn1bYsZ0+kEEtaLfjWDFnr85N4uXY6XxqezbveFY3uY2tGFSwPRRUmalId3anvP23AmuQ9c3UkBPWMbnJc4soGBkUNFMU4p2S+lhYVlaHRsadMSOLlCLV9ozHvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DdPr6LoDEYMC+6U/8Pt+p9t2bBwepKOERAgw7gtZ9Hs=; b=lKFNzdkRQhlznBPICJupvDxZ+fgCqY5QYu4efMlPBGJSjSH6AYo92LRf0tI7mIqGSUxHCBWD9+FpvoKBy9U2JhuoaNtWoni0rzEtaN6rcmIUKNi806ZaUtlDa12H1LiVYtaD7CmbOexxAJ2OnJQih6hauAbvQQ/XpppOrPDklY/1h/5CmNoEBKTqqNlOVXAay/9Kj/gLTltR+Km8/atIE4RCuo7X86ZAfN2wYIUshXUGJivh4SV4XytbQ9tyoZBXhzZvFN/9t99V56Qu4fj6z5tOaQON5vKXK7aDc8RW6SvjMSwdYPu8nDIL+oKEIoaHLlon392KibfyTowF46GCWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DdPr6LoDEYMC+6U/8Pt+p9t2bBwepKOERAgw7gtZ9Hs=; b=XtW8ShagnWz7pFW0GcuMr61t/U8Qj+sG69vx2hna+eGVV5gIVVULB+IPua9Q4inc1aOAZNd2o8pwxvpXZS0v5Smo/0PNlaP3zlJvC98aVG/6qD/xk5j/KF7qaZG1jTV+mU++ke5DjuIdO43AlIdJmeK0li1GVmY4Xxaf7dpw9pE= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) by DM5PR04MB0348.namprd04.prod.outlook.com (2603:10b6:3:72::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.20; Sun, 18 Oct 2020 05:15:18 +0000 Received: from DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::d035:e2c6:c11:51dd]) by DM6PR04MB6201.namprd04.prod.outlook.com ([fe80::d035:e2c6:c11:51dd%6]) with mapi id 15.20.3477.028; Sun, 18 Oct 2020 05:15:18 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [PATCH v2 2/5] firmware: Add common FW_FDT_PATH compile-time option Date: Sun, 18 Oct 2020 10:44:46 +0530 Message-Id: <20201018051449.2368918-3-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201018051449.2368918-1-anup.patel@wdc.com> References: <20201018051449.2368918-1-anup.patel@wdc.com> X-Originating-IP: [122.179.120.189] X-ClientProxiedBy: MAXPR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::19) To DM6PR04MB6201.namprd04.prod.outlook.com (2603:10b6:5:127::32) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.179.120.189) by MAXPR0101CA0033.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Sun, 18 Oct 2020 05:15:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 672769f1-2211-4bab-dd0a-08d87324cdfe X-MS-TrafficTypeDiagnostic: DM5PR04MB0348: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Op993t0cuam4OxhbGxLZDzuUPsc06WR6XGvUJ5WipyeKbf9hm68+6uCeU2BaKd4xO6+syz5liGAj1xUX1N0E6D8BoEGhrkcWzxQoxNzIo9E1ZCJnJOiDzrYJLH+x4X7lM3C5WvHUt41po3NvZIlldoJRK5wTQm5MzsQHPJ9F8qTE0QWFvSTVgz9t6GloLLnx9dOAprhRm34OsekHSTOpl4Nc1n9cB0W5XIFgpXLOyH/ySkVe+SijMyUUJKu6dhfYlWv0mGXxTHqX7HyR/ZVItZG8at9Xpg6PyZ5BUL7mnxRYbl+pKbBSc80FcHXx9eRa7fRFrG0/lzh8RLDuhAcgqA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR04MB6201.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(376002)(396003)(39850400004)(136003)(366004)(110136005)(316002)(478600001)(36756003)(6636002)(2906002)(956004)(2616005)(44832011)(6666004)(66946007)(5660300002)(86362001)(83380400001)(54906003)(66556008)(66476007)(8886007)(52116002)(7696005)(26005)(8936002)(8676002)(4326008)(55016002)(186003)(16526019)(1076003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: n77uqUYuFW2+ozn+Lv+0r/SZsJAhf99FghkXQ6RUmpGessu5v4kR3iIe/8p8ASZy/mXCRcICESctTQ0vgvj/+Po8ibeCP2DM578xJMkP9d2VgMDjZIgmJ2/uFOdgoL+MMVlLjUeHAm+6xQ/MHoGlpXuxWZzwnpkkxrZMxGPjVy4mvUk2zZUXWKAVILx7wB9EF21ABBrVHwo5aM1A1bRn4/9vgbkWM5SlSzJFa2ZRbvSWLO4tPFQJ2QKPL5+sGDawwAgruTHCF7uC6zjlIsQ8tDMjS8rFQv3ftihLpRSLE6drroeS/zTfrua6T9/IWVv0/IPxx9hmetLS6M3oJRqjZtCq1jOj+L8w0m1bQGxtjkhVXHFA7yBVG7jgdXH4Ldj4BW+fAu2MpTwLgxKco84MDhiro2k4Fym648KzWKEpabRYK7BEmLgHwBvwu5YkSk80Zpm6TEISUloIrAWFySWWkMgkoGMUDDJCu3nUqbSTLJGM38AukV+TJyO6shmIzEbk7JYMOueIXwfGQk53Z92zMHbxpa098i68j6DUn9IQ2wP01/GgmXbAVJYCu3qdmAGWwdmuCccAqSseTJvuiMRXucMJ+cGvywkW1HMpFkWWBg6PGqp/U4jdFfZCAmY/XcizgLtNPDNRo+xRWJJxnYfOXQ== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 672769f1-2211-4bab-dd0a-08d87324cdfe X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2020 05:15:18.6902 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TjurNycN00QF9Guafsk3rk/ucLGWpqPHgSSoMbvjvXPk03IMF5hf3h4LMXSbBr6zzP57g+7rSlxwuTzTzk9fjQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR04MB0348 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201018_011523_710988_A3CE2D9F X-CRM114-Status: GOOD ( 15.96 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.153.141 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anup Patel , Damien Le Moal , Anup Patel , opensbi@lists.infradead.org Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Currently, only FW_PAYLOAD has mechanism to embed external FDT using FW_PAYLOAD_FDT_PATH compile-time option. This patch adds a common FW_FDT_PATH compile-time option to embed external FDT for all OpenSBI firmwares (i.e FW_JUMP, FW_PAYLOAD, and FW_DYNAMIC). Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- docs/firmware/fw.md | 16 +++++++++++----- firmware/external_deps.mk | 4 ++++ firmware/fw_base.S | 16 ++++++++++++++++ firmware/objects.mk | 7 +++++++ 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/docs/firmware/fw.md b/docs/firmware/fw.md index 4133c23..cc0cc9e 100644 --- a/docs/firmware/fw.md +++ b/docs/firmware/fw.md @@ -51,11 +51,17 @@ case, a *FW_PAYLOAD* firmware allows embedding a flattened device tree in the Firmware Configuration and Compilation -------------------------------------- -All firmware types mandate the definition of the following compile time -configuration parameter. - -* **FW_TEXT_ADDR** - Defines the address at which the previous booting stage - loads OpenSBI firmware. +All firmware types support the following common compile time configuration +parameters: + +* **FW_TEXT_ADDR** - Defines the execution address of the OpenSBI firmware. + This configuration parameter is mandatory. +* **FW_FDT_PATH** - Path to an external flattened device tree binary file to + be embedded in the *.rodata* section of the final firmware. If this option + is not provided then the firmware will expect the FDT to be passed as an + argument by the prior booting stage. +* **FW_FDT_PADDING** - Optional zero bytes padding to the embedded flattened + device tree binary file specified by **FW_FDT_PATH** option. Additionally, each firmware type as a set of type specific configuration parameters. Detailed information for each firmware type can be found in the diff --git a/firmware/external_deps.mk b/firmware/external_deps.mk index 2b8f9f6..f43ac06 100644 --- a/firmware/external_deps.mk +++ b/firmware/external_deps.mk @@ -7,5 +7,9 @@ # Anup Patel # +$(platform_build_dir)/firmware/fw_dynamic.o: $(FW_FDT_PATH) +$(platform_build_dir)/firmware/fw_jump.o: $(FW_FDT_PATH) +$(platform_build_dir)/firmware/fw_payload.o: $(FW_FDT_PATH) + $(platform_build_dir)/firmware/fw_payload.o: $(FW_PAYLOAD_PATH_FINAL) $(platform_build_dir)/firmware/fw_payload.o: $(FW_PAYLOAD_FDT_PATH) diff --git a/firmware/fw_base.S b/firmware/fw_base.S index 0271d9a..95197da 100644 --- a/firmware/fw_base.S +++ b/firmware/fw_base.S @@ -182,6 +182,11 @@ _bss_zero: call fw_save_info MOV_5R a0, s0, a1, s1, a2, s2, a3, s3, a4, s4 +#ifdef FW_FDT_PATH + /* Override previous arg1 */ + la a1, fw_fdt_bin +#endif + /* Override previous arg1 */ MOV_3R s0, a0, s1, a1, s2, a2 call fw_prev_arg1 @@ -668,3 +673,14 @@ _reset_regs: csrw CSR_MSCRATCH, 0 ret + +#ifdef FW_FDT_PATH + .section .rodata + .align 4 + .globl fw_fdt_bin +fw_fdt_bin: + .incbin FW_FDT_PATH +#ifdef FW_FDT_PADDING + .fill FW_FDT_PADDING, 1, 0 +#endif +#endif diff --git a/firmware/objects.mk b/firmware/objects.mk index c980362..2eea54c 100644 --- a/firmware/objects.mk +++ b/firmware/objects.mk @@ -17,6 +17,13 @@ ifdef FW_TEXT_START firmware-genflags-y += -DFW_TEXT_START=$(FW_TEXT_START) endif +ifdef FW_FDT_PATH +firmware-genflags-y += -DFW_FDT_PATH=\"$(FW_FDT_PATH)\" +ifdef FW_FDT_PADDING +firmware-genflags-y += -DFW_FDT_PADDING=$(FW_FDT_PADDING) +endif +endif + firmware-bins-$(FW_DYNAMIC) += fw_dynamic.bin firmware-bins-$(FW_JUMP) += fw_jump.bin