From patchwork Tue May 23 11:36:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1785097 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=Lny46qFT; 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QQXNm1WGtz20Pr for ; Tue, 23 May 2023 21:37:28 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C3FD885F72; Tue, 23 May 2023 13:37:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="Lny46qFT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BF2A285DE2; Tue, 23 May 2023 13:37:08 +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=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071d.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::71d]) (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 AB85B85F72 for ; Tue, 23 May 2023 13:37:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FGCBSeI/5n97AXoTF8ituMqwNYA31aeM3X4onqu3Zp1kNZby/uYJf7im7m/bZjUNz8Kzx2NyqkwwxYqoH1fyq76KXieinsW0KmvwrwsOmeHBX+u48gMNJqLunh6sIzJ5xxc/s4diafmkB/FGn//s4AYjdnW8wmOM35LF8s1nQNKx7FS5kSoYeapQb1XH2xjS/zBPlbLmG4+nWIMthCopp3QqAbs9qPNpp67Qe8Fv682zJMecemCWRp/JiDGIdiP9/YJjcJZEosRzTQqdJu8grSaCru7jyjNjv+ao06x/8g8GN1Po28Rc3AcLX9ONuhqTOFL0eRhcUWWwv9G4y8VM6w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=K03pFXP4fanQvaPWcqVjSa8/xmknKS5VZROaAv8TjmA=; b=f5TldonQbPlB2J+59OvsFa51NXz+jvIlH5hbYHpvdm0AwBQi86oBVOjEYAPmFsTIHPSf7TmQFl4FQIeAxATdPNH/BOZtW8w5SHvRoEqXwVrgdOjNxrW0B0boCpnb28dzM2Fof6HAHLvy4BBv1axE51zzIXUML+ettlp6XffI6KNmefvy1Kpeta6vBGsgHWk6Ork+XI2wYcrd/eSPmVR1OydSwFrlkKLyTanO0dkwGPaUE2JMnjV651ralJtUQWwaK9/qj9bFBtHp+UztcmZ4dgUYFCW6+XSFM5D1JwCYXQf35gt5UCCysBJkJ8G4x5KGgeuEwMwT7uyMbXo8zhF1nQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=K03pFXP4fanQvaPWcqVjSa8/xmknKS5VZROaAv8TjmA=; b=Lny46qFTsJrTDNQSFFjaaTvZZjR7SvlxqGMOVkRk9JOa5PaBznjDXhzhmZI99C7QL8+gjHCD+RF5tI8HYpcuw6FGabKaJ3+FQm9QcJoK7Me+HjrewT+RpHhFHC4GakTpz0/lrTEBHOSXSYtfrk9DT6ilGztGGXmzkP5Twh/rHsI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) by PAXPR10MB5230.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:283::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Tue, 23 May 2023 11:37:01 +0000 Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8edd:b6b0:d2dd:ee12]) by DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8edd:b6b0:d2dd:ee12%7]) with mapi id 15.20.6411.028; Tue, 23 May 2023 11:37:00 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Stefano Babic , Fabio Estevam , "NXP i.MX U-Boot Team" , Rasmus Villemoes Subject: [PATCH 1/2] imx: spl_imx_romapi: avoid tricky use of spl_load_simple_fit() to get full FIT size Date: Tue, 23 May 2023 13:36:50 +0200 Message-Id: <20230523113651.292806-1-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.37.2 X-ClientProxiedBy: MM0P280CA0118.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:9::8) To DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR10MB7100:EE_|PAXPR10MB5230:EE_ X-MS-Office365-Filtering-Correlation-Id: f668f53a-09f2-4b5b-6310-08db5b8205f7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: onplE9zJM/u0IlPJTl4hLy8D1ABU7Y8UA3ZzUg9J9OLMgWjrn9oFANftbsSYZHxsPp+Xnurr7nHMWJ9mPlB5VTlIWfnTXZlDtkCbzAB4s0Wx3Ga2o76495JveS6evi+VfDlmWyFHz8gRZzvDSAKOSqRtKBZu31ANHn16sw5MYPgk/9JT84uiOHpsulTTfJb8EE4lsV6n8dhntGg4ZslzZLPHJF5CldMWiOje7OZFNb/8Qal5pNvfOTAGCEMflHJOPkKqWeD1NRy74HZbTjLTP5NG2KxmXOiU5jms3RN0vZJi9w2zHWRGWg45ti+ElWlRwj6axRG9I2Prh5C11ZVD+F+YooOz7EIiJuP3sbZSq0Lqx1AgEdfh4JPjoHCBAqO4QrnzBR4QEy4tOOXWNH77/H4f7vXhI7yprAuaE4kVk3oyOfcZ2NIrcWqx1fknaQHEVky9ofD+sJIF34xieAD6l2MEykhW5mUe4L4lIepMHBCrQdy1icPDkcB3ajcKzlWy/5FpW6Z9F3t0R8SxKwa5RtcY5cK1SDgWwtLJj6NGycrKeT0mJ4EOK36n2v4AKyKT38d5PDKMlWHEoz/QxoYDPFKE79TwvYxDmPgM/bNL7UbWJsiPxsIdQMk1OQfRm6F0 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(346002)(39850400004)(366004)(376002)(396003)(451199021)(38100700002)(38350700002)(83380400001)(1076003)(26005)(6506007)(6512007)(107886003)(44832011)(36756003)(2616005)(2906002)(186003)(316002)(6666004)(66946007)(66476007)(4326008)(6916009)(66556008)(52116002)(41300700001)(6486002)(54906003)(478600001)(86362001)(8676002)(8976002)(8936002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AO/D6p0GWZkHKH1hSqqxu0/N99zdSZAryu4W9r3Waru7X2zLaXDCnHeSGYQFo4PDFE5soSgkQ7ophB4pmAyJrvJUZNx46ZIxdT5YfImOPehfAM3QJk+OYbMzkY/39D+E+a63EaenCv3I0NmOqFAcLiuc151X+zxRySB4AF1oVigjHsRImLDLt7yQEW0sfx3KkhVZZA/3PZuQKyHcwnIvvU8UpGc/UT9IW7VMGXONdMsHRGkoLrOB51LfE+TfyytiWVQPkbWhTO/J1znYsRkwOs7gcYMFhRBeU6UDCkbj1eHCej5Ak5ueyJNwfXMf43Iy/5x/GhFqbphrehOu1BQ1SDt7rFi0PBbFrhkvxNFdRVLajCFUhCphQfc1IQAB09AJzz3RofSGZBACIeUImDnPCfW/8SQEhErK7FSSSkp5xGZV9w7yEqw83ANA4Rl8MaX1Ti89n3CXed+GFg4UlO2SoNtJPJg779eNEMkDMy55flSsYaL27CwXPaZwd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k7kYmv0mwQ4Ys/rFrSEMC1oOVVIPBHmA== X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: f668f53a-09f2-4b5b-6310-08db5b8205f7 X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 11:37:00.8330 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 88CDEnZjqTuDAuUyNWrWGhew2UA5F8vxi73Ij4ba/Bo1kCcbhJTMazJhXDgZXbo/7LDNJ0EuUG55H5E3qag8VI0TpN7iJNANpaNY/0/V92I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR10MB5230 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean Currently, spl_imx_romapi uses a somewhat tricky workaround for the fact that a FIT image with external data doesn't directly allow one to know the full size of the file: It does a dummy spl_load_simple_fit(), having the ->read callback remember the largest offset requested, and then does a last call to rom_api_download_image() to fetch the remaining part of the full FIT image. We can avoid that by just keeping track of how much we have downloaded already, and if the ->read() requests something outside the current valid buffer, fetch up to the end of the current request. The current method also suffers from not working when CONFIG_IMX_HAB is enabled, because the first call of spl_load_simple_fit() will have written garbage to the various locations, so the board_spl_fit_post_load() call panics. The downstream NXP kernel carries a workaround for this, but that workaround should not be necessary with this, since we only ever memcpy() valid image data. This only affects the CONFIG_SPL_LOAD_FIT case - I don't have any hardware or experience with the CONFIG_SPL_LOAD_IMX_CONTAINER case, so I leave that alone for now. Signed-off-by: Rasmus Villemoes --- arch/arm/mach-imx/spl_imx_romapi.c | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c index 830d5d12c2..e4e2297ac0 100644 --- a/arch/arm/mach-imx/spl_imx_romapi.c +++ b/arch/arm/mach-imx/spl_imx_romapi.c @@ -126,6 +126,41 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image, return 0; } +struct stream_state { + u8 *base; + u8 *end; + u32 pagesize; +}; + +static ulong spl_romapi_read_stream(struct spl_load_info *load, ulong sector, + ulong count, void *buf) +{ + struct stream_state *ss = load->priv; + u8 *end = (u8*)(sector + count); + u32 bytes; + int ret; + + if (end > ss->end) { + bytes = end - ss->end; + bytes += ss->pagesize - 1; + bytes /= ss->pagesize; + bytes *= ss->pagesize; + + debug("downloading another 0x%x bytes\n", bytes); + ret = rom_api_download_image(ss->end, 0, bytes); + + if (ret != ROM_API_OKAY) { + printf("Failure download %d\n", bytes); + return 0; + } + + ss->end = end; + } + + memcpy(buf, (void *)(sector), count); + return count; +} + static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector, ulong count, void *buf) { @@ -309,6 +344,21 @@ static int spl_romapi_load_image_stream(struct spl_image_info *spl_image, } } + if (IS_ENABLED(CONFIG_SPL_LOAD_FIT)) { + struct stream_state ss; + + ss.base = phdr; + ss.end = p; + ss.pagesize = pagesize; + + memset(&load, 0, sizeof(load)); + load.bl_len = 1; + load.read = spl_romapi_read_stream; + load.priv = &ss; + + return spl_load_simple_fit(spl_image, &load, (ulong)phdr, phdr); + } + total = img_total_size(phdr); total += 3; total &= ~0x3; From patchwork Tue May 23 11:36:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1785096 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=YPO7P+xg; 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QQXNc0D3Jz20Pr for ; Tue, 23 May 2023 21:37:20 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4F1B985EE5; Tue, 23 May 2023 13:37:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="YPO7P+xg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7FEDD8565E; Tue, 23 May 2023 13:37:08 +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=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2071d.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::71d]) (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 258C485F06 for ; Tue, 23 May 2023 13:37:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JBuFGiyrQN1Yf1paz6CYuJPK2JI5GJ9KK/brMNJeOA5/5+d2bSxZmNXcmP3nhc0Q5X8FFPgwbU7hVcyL67DzGrzZxhas5QT8RzM0FD9o2/TUYjSG82MSZf0n7RJcyqj/8dt86pxF6z3ttwi9i2FuQnVdrcrCABBLh84DDd7fc9BKV2Dz0bh6YdaNiocurCShLiueYNJtKQu+f+JPlrmugr9nDDmHauJlzFYHvnaXzyzSEhkj7EBxHWyuTVN6vziUnQupVWIOtXyRrRL7eOBlr0IozMAP4B8Gpo3RHw2DcSta2x2taMV2OLEzuMBEKUOD0onN50eL5pe2SlMDH+2ZDg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wCctuKOU+4hgoJFsZOkknAFS8YWsDuUyg/AEpm2kUJA=; b=K5WXRgfajE3M0UR0EGzOc/R89tl9tngDimnDB9hsRMZg+2tsTn72El0Y/8Wu87UYaBO1WquN2L0xeyvoz9smCrteO8QLthPaGBNNUq05/7lbgKhSNTQhjBPksjznLmJUpMfZzR21DMFF7wu4zKEjEgCpnnlb+EHAgt/9cKi7p9oqQ2Eaii7SmAYEAwVN+TG+wQhyvGIgHqhhExcM1pOE9FTMW+s69O/vj0NNBgQ8VyfY7HjJSFIFRV0VuXAcYGLhG+ikgzfRhbOYLBMtrR5NZXH9akhy0oWMexJgFiq6GeL4mc+SkoaHcWP5E/UT8E1Dchv2gD0dydjfPI5AHd1gyA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wCctuKOU+4hgoJFsZOkknAFS8YWsDuUyg/AEpm2kUJA=; b=YPO7P+xgITjsYhrdehGea9KJM9mvtetXW/xht2jfPTeO+kQWcwLNINGkIAFYdcBS9Byslw15cgej0z/2FVmm7P0bakFrehdXr1DUVraFNtjQ8bjT7rWIVPX7aBU2lpO4kPxpz9M3KuYmHoD00CiLYGH70MXq03KE+WNIb4pVZfM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=prevas.dk; Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) by PAXPR10MB5230.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:283::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Tue, 23 May 2023 11:37:01 +0000 Received: from DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8edd:b6b0:d2dd:ee12]) by DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM ([fe80::8edd:b6b0:d2dd:ee12%7]) with mapi id 15.20.6411.028; Tue, 23 May 2023 11:37:01 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Stefano Babic , Fabio Estevam , "NXP i.MX U-Boot Team" , Rasmus Villemoes Subject: [PATCH 2/2] imx: spl_imx_romapi.c: remove dead code Date: Tue, 23 May 2023 13:36:51 +0200 Message-Id: <20230523113651.292806-2-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230523113651.292806-1-rasmus.villemoes@prevas.dk> References: <20230523113651.292806-1-rasmus.villemoes@prevas.dk> X-ClientProxiedBy: MM0P280CA0118.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:9::8) To DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:45a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR10MB7100:EE_|PAXPR10MB5230:EE_ X-MS-Office365-Filtering-Correlation-Id: 315f1f45-7b4f-488a-4dcd-08db5b820660 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BZcKGGG/n1QDc3Am5xk+N2lnsooQxND8nq2TbRRx7mQGkh4+mKsLWLn16EvhuEp81lyxIEcrOu4qk+Z5S/hxKaRrN4E4UfOwdtXzLqtouAlNr+Q/qq2T8BdMHH/mtA+AOqcC1Z1Q8/qlfNTbIWcf3D4EtC1tLKeH584M332c9TWIxqn/Mjg1FlzqwW4AjGa5ALmRXJPq7gMAv3rjLL43sXoBaq7rxXAlgMCzp+D354PJTc4lTQY4fDxJYCKi7BLT3uZeqO+/sR/jXYnxFOlFIeYg70YKfE2cYxFtWsbJe3ElbJikwS6hXrUw6xRDIU5f6vwftJxlij4+/Cl4wDnnndjegMv768xWfY8vf/FV3aiRDAdyAin9ToXQ4WkhbSAH6tRbSFiIVR+UReXr4PQxW+/pNoK/QTw4mG0F1j70RZE6OA2tXTjs2T7U3/V6rEs6k93MphYrdyHmtHlmOFT1VwOjlohUl67StGMB1NXx6cwEXorbTbmYKCvGKDvpnSeRkA7gdKO0GGJGjT8NV4szRkGK9J8t+qR6FtrAKRhW/4o/9euz0o0FDPhB92Ua+LGQJJEghTAxliKxCSVcKl2neW4DrMOnc5kL/XRorxgeIypkSAJ3H+LpPjhZCzU3ykDb X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(346002)(39850400004)(366004)(376002)(396003)(451199021)(38100700002)(38350700002)(83380400001)(1076003)(26005)(6506007)(6512007)(107886003)(44832011)(36756003)(2616005)(2906002)(186003)(316002)(6666004)(66946007)(66476007)(4326008)(6916009)(66556008)(52116002)(41300700001)(6486002)(54906003)(478600001)(86362001)(8676002)(8976002)(8936002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OZ7tuphAXZPA7yOUcgKWcOq9kmUkgCHAqZh4W1HsxN00Zk8GXugcT7AdhQgpYMFiVH/5W/9Pl/JForowYZlpUmOtzky2yDRCAqRmXkWDjv23LVvvD8Z7Rwm3u2AUnjpqwRD6grC5FE/2Ygw0P8m7VngeWXZe9WFEKlgMbsnaoredqnrePPb8K4wm4VpXDt4rl/6UBZ1bvZqSfVerOg05RV6keMaK5pjUTUBkKzkHQ7KhADsJskmQZZ3bB+pB7p86de+PwioCWy7wPzxw54XUD+gL1jrLBZVFPYRZ2CRY3WticnaXGU70WBtPBR6gR3l2wcTVL0n8ss97AHUhnnbnDKxxVgLo7tXl64gJ7SkiNg5w7JsB2q1ItinLzbqjDM8nbLWn1JIx9fcJuBK2jeT5hCs+aFNfbNagklf5Pm42pIEpFzajzPO/j1GtjH4b6uKflOF8eN4Bj5AY1qeony5C8Rk7n14XW07/JakXfl/+ViKUvGdq7dzqkdxr79pTKRSrmSMBgoQPlayuEd5MPeZsnNJ/2GJkJu1d9+mYTN+Ka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atorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 315f1f45-7b4f-488a-4dcd-08db5b820660 X-MS-Exchange-CrossTenant-AuthSource: DB9PR10MB7100.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 11:37:01.5533 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9D8UcJP/L8dWP457U8Fb9b+0VA3oKPFfwBPtomdSVfcDz54/s++9Uo5x/9HjRWHiHmInrjFlHPXFTIAtm6yPscsbF7VuDJ/sTkDTn3kueJs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR10MB5230 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean These IS_ENABLED(CONFIG_SPL_LOAD_FIT) cases can no longer be reached, and thus get_fit_image_size() is also redundant. Signed-off-by: Rasmus Villemoes --- arch/arm/mach-imx/spl_imx_romapi.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c index e4e2297ac0..d34102990f 100644 --- a/arch/arm/mach-imx/spl_imx_romapi.c +++ b/arch/arm/mach-imx/spl_imx_romapi.c @@ -177,23 +177,6 @@ static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector, return count; } -static ulong get_fit_image_size(void *fit) -{ - struct spl_image_info spl_image; - struct spl_load_info spl_load_info; - ulong last = (ulong)fit; - - memset(&spl_load_info, 0, sizeof(spl_load_info)); - spl_load_info.bl_len = 1; - spl_load_info.read = spl_ram_load_read; - spl_load_info.priv = &last; - - spl_load_simple_fit(&spl_image, &spl_load_info, - (uintptr_t)fit, fit); - - return last - (ulong)fit; -} - static u8 *search_fit_header(u8 *p, int size) { int i; @@ -254,9 +237,7 @@ static int img_info_size(void *img_hdr) static int img_total_size(void *img_hdr) { - if (IS_ENABLED(CONFIG_SPL_LOAD_FIT)) { - return get_fit_image_size(img_hdr); - } else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) { + if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) { int total = get_container_size((ulong)img_hdr, NULL); if (total < 0) { @@ -379,9 +360,7 @@ static int spl_romapi_load_image_stream(struct spl_image_info *spl_image, load.bl_len = 1; load.read = spl_ram_load_read; - if (IS_ENABLED(CONFIG_SPL_LOAD_FIT)) - return spl_load_simple_fit(spl_image, &load, (ulong)phdr, phdr); - else if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) + if (IS_ENABLED(CONFIG_SPL_LOAD_IMX_CONTAINER)) return spl_load_imx_container(spl_image, &load, (ulong)phdr); return -1;