From patchwork Thu Oct 15 08:12:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1382491 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=aprc5CmX; dkim=permerror header.d=wdc.com header.i=@wdc.com header.a=rsa-sha1 header.s=dkim.wdc.com header.b=awC6eUtF; 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=LyyrURnS; 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 4CBhqH32Q9z9sTK for ; Thu, 15 Oct 2020 19:12:56 +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=ajPaCfW6jgM8LT9T/TWkaufrkPzlbq5lL89h43YRLwA=; b=aprc5CmXAd2/ldWFGxevS+Kc+ CiJSEeghZkTAsUsBxHcVvtQekMJN2rc5JMAmea6qeVF0frWGH+2f/ermoeUsxYlTYqNrAgV7GtDSD 9XJl1nv/snim/B2Uw9knLJJg09RUtrjuRs0wMBH8d4Rja+9bXX5m2gbdjb3KSaUFlQIz3pvi/gGXG lEKNA94kl7Jxk9y/Iw5dlipqqE+/AVgON0xw6ZmOcdzmrvrf2b2gUZpLA2ypzcLNspwuJ9Nvhbhth xxQJxQGdDHi2bDuoqItXz6kUS2O9DInSEC56t65nV+vo31e+m/QpujGMoqJp7BNVvE937r4NuG77x lhjyQkT9w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSyNX-0005Kb-56; Thu, 15 Oct 2020 08:12:51 +0000 Received: from esa2.hgst.iphmx.com ([68.232.143.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSyNU-0005Eq-Vw for opensbi@lists.infradead.org; Thu, 15 Oct 2020 08:12:50 +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=1602750001; x=1634286001; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=SYm6/bNzUfIa/2Fr9T4ANOeiX+hEaCKpC4OaWK6clTs=; b=awC6eUtFs1rJIsdYfvytZt4uODgTcoDu6YJcu6+BWAMslkr+lt42xJ6E CrPw8pxW4aKAjixyBpRt8L895fnBQNItC7rh2lvGM2BCCY8As8nqwBX09 vRBExmXfyNG5U1flTryJvgQs033e6Cz09VlKNIk8+puatZ2PZUjmub6u8 Ac1HQRooQRa1d0So8aeeZTZAvQ4rdnwIYN3RUC7f6ZxvDMmHw3VDhFLyK Ae6M9bDS9S5RKxp4tAdCZVZACR9dlMnoP2scJXEP202P1qPuh7CGf2J5Z ecKimSGSbZqHInx91OYt58zmQ7O8V8ZO1lPR30Z8WR2aMxnprdgwk+uqQ w==; IronPort-SDR: XRS8+5sOPRqk52ShYMGz/+xlhlyA9gEDCoze/uZlMIctgGIV7VZvnNYc2ji94KVwZE8mDNGQ05 touM/JR8h2hIX6yXY5JKSHB+jNpMBVhBGZRv7dKOVEeIb/cfQdyRPAvhiBUsdp3kACQ1WR09LL gCZ5Lt/V/JnHS2gfYwj4GNxyo8zRnYPYPsob6TaV/WZYr3Yk4HBYEg7Fzr+A7x+r3aizY0RYGx 76sWIyvij/5C/Lz7UIhV5BFVhBtHmmyRQK/3lSbfk/v2AmW5mxKaDyZdpMRq0scZ7ucAT9/Ww+ ClU= X-IronPort-AV: E=Sophos;i="5.77,378,1596470400"; d="scan'208";a="253417237" Received: from mail-mw2nam10lp2105.outbound.protection.outlook.com (HELO NAM10-MW2-obe.outbound.protection.outlook.com) ([104.47.55.105]) by ob1.hgst.iphmx.com with ESMTP; 15 Oct 2020 16:19:56 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mqtPR/IJ6jm2VhCJ+LoyhxAlwN0T/2ZJqnX19dkVimYdSMPBqN+B0+HOu3sNKuIWfdQNfFu7tuq9nfPAGMZM57zdpusc/wWdd7qnSZ4VbwAU32fm2KHOij+Nynbu1ffct0EppklhoOQm3T0GahXi+cu4JGwiCr1USWXYhDGpeXcKeFPQW8S8kxRSjK75XGhLI0jOKvVoyJ/j4EAdzPQhDl63X6rZr0ABLeNXW8Z7AN7X478cDAm+eLXCN0vdgxkJum1pJlSan7RDqnpB1bcs2s4ApHzuUz4V39haxaqOzMLUSF5vZjgdgyZR/pgGc76CBJlb76HBXgfJrDaBU+KHjQ== 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=7VB4oTMJy3QhNLDa3oSaikVhcEtxkWtHvlobKjYBzCY=; b=bal1ITzDCs/1tFvWZ0PzXlZ7PMfYddtcMjWAn0d4/wSYR5EismOWYMFpjBMhXzsuTMsrJ8wuFRAyUnkYfi4GPoaCwhtaQbHZdhp7uVHHgSNYZZ9mDcemrL0jhaakn57zuHxO8wyLsoqMilA62S24lD+tGCFPsveLgdy19uUtDaQWg7YKXX0YV/0xeeDvQvmc3/3DAHHsON0VSlQ3IN99FoYKc2HHlPHzqyOTvvr92aWNgm0RSl+8dZ7i7m5doh9sHIaGdYMXyfBVPwDb8TEt6KozbmtUPSJGQJ6iJnGOojlSsvRgGcrIV097bJWyONV7iWztECWIGKvCMwpJwuTEBQ== 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=7VB4oTMJy3QhNLDa3oSaikVhcEtxkWtHvlobKjYBzCY=; b=LyyrURnSjbOxjjP1LhR/7QwKKapb6y9pns8zAN53vlYCoPl7z5DXQqbMABu1oKCCkVhYNwkzp3O1VzWhrfbWLWuV+i/VzQaE3Cd45E/4nts9yOTxFmHlblGe3cs8dFyBqkt0zfYhH+VhabUtMXjdUiJlgNZFGJAY0/ksO4aVs+c= 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 DM6PR04MB5836.namprd04.prod.outlook.com (2603:10b6:5:168::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.22; Thu, 15 Oct 2020 08:12:45 +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.021; Thu, 15 Oct 2020 08:12:45 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Subject: [PATCH 2/5] firmware: Add common FW_FDT_PATH compile-time option Date: Thu, 15 Oct 2020 13:42:08 +0530 Message-Id: <20201015081211.1956554-3-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015081211.1956554-1-anup.patel@wdc.com> References: <20201015081211.1956554-1-anup.patel@wdc.com> X-Originating-IP: [122.167.44.151] X-ClientProxiedBy: MA1PR0101CA0020.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::30) 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.167.44.151) by MA1PR0101CA0020.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Thu, 15 Oct 2020 08:12:42 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5178589e-de04-40b9-41f0-08d870e21855 X-MS-TrafficTypeDiagnostic: DM6PR04MB5836: 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: onKRqIHRpQiZf8QD041Smpa0EB4hzc0S4/RdnlqjSO5EXI3g9MXCPW6m+HBAqzyMmr7kR8Bacj34UkrJCH67fhueNgRHudyoVTs9p+HKUCuNGJpdAGW1lIVGnftj9wy+wPNDsBlCUIRrFWRZtLE6mohHPn3uZLIDoIlUufomwMl1r0U6JHq0jVsWsu5D/pqgwwSHwT8bnyt+72pmHoxTVeEmFXYufjwzz5fHQohcLE+9X0GpVrd6zllb9xCFwPH1gwYF6nnyKkMdWN2CKuxu3pMr7ZBrbDcRD8LTOoLmCwFMQPMqwScDXda4/w0hToWDUjEJFi5NJcH/ggE1q8GIm4md286b0LiMP2FFYzGmgyV7TmZ2PqYqCxAjZCNNP5w0 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)(376002)(396003)(39860400002)(136003)(346002)(366004)(44832011)(8936002)(66946007)(36756003)(478600001)(6636002)(8676002)(2906002)(8886007)(34490700002)(110136005)(186003)(7696005)(66476007)(6666004)(86362001)(4326008)(52116002)(55016002)(1076003)(316002)(2616005)(16526019)(956004)(26005)(5660300002)(66556008)(54906003)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: UVR1EHMPSPdFT4ZaZTpXu1iZp5kPgu9WL8GqxMEkJFVxFVXUab5KQ1Rc4hnfMNJaa4baSlEjJV6w+9nJ3SjuSt8avRrtC3OXwj+T8WV1EifuTMj810Sd9u4ul7MWBBSid5C6RcSv3+bZTtEAPeGF8FVKQczZhWvko9gBmCgjeq+d5o1j220XtQwAo1aWy/l43ROF2Pd4pVVcDe+shBuvEV7es7SN6O+Ke0vvn2akgEx2v7JVuZWn9SyQBD2rOQ2tlMcPa0RaYmWRSEAQeG7++HS9WMfIrWB4fiDI/AccV+edJTy6ZpXYK30sVgaBVp/rzA6ma9rblyTHMnJzJliw6pzuoZcrqZ9MF+e2YGDl+Z8hgu/HQ5yBaAfZZAl2DFNHQaP8V62tQ1Pi0wYfAX7Xv8HST6LM7u2ZL7BeOpw10yUT5aqVFxfK/GrwnajQBmdDbDbp0x9gA5R48FpSsLJ7MOtdUBvOUT/vosAgBc4qpoCIFtdviLw7AMjg45JguLwpUvdNvBOsa6zfnHDdW7fUeTA94ciciSjYjPcKtNX9kp/KcaHym5Hu6CpFRTKb8SM7ntFCQrlrTuVUyucMf4g8PYoyyjVJJ60CnWArG1vLQ13RlyNT/S5v3CJ/f/seXOjWB55cB9G199/YwQaMxHLixQ== X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5178589e-de04-40b9-41f0-08d870e21855 X-MS-Exchange-CrossTenant-AuthSource: DM6PR04MB6201.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2020 08:12:45.0352 (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: FEoSFoPN+vkSisShvNCwmgJU3N8WMC94u+4P00UZZnjlclUC6z4Ut+gKnzhexSEMf2hluXP2TaWIYp5MUm7QXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR04MB5836 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201015_041249_208945_8CD06CCC X-CRM114-Status: GOOD ( 15.83 ) 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 [68.232.143.124 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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 Message has at least one valid DKIM or DK signature 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 commong 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 | 14 +++++++++----- firmware/external_deps.mk | 4 ++++ firmware/fw_base.S | 16 ++++++++++++++++ firmware/objects.mk | 7 +++++++ 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/docs/firmware/fw.md b/docs/firmware/fw.md index 4133c23..1efdadf 100644 --- a/docs/firmware/fw.md +++ b/docs/firmware/fw.md @@ -51,11 +51,15 @@ 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. 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