From patchwork Tue Dec 14 13:22:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1567730 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=I5069b0/; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCzZn4C3vz9s5P for ; Wed, 15 Dec 2021 00:22:57 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A9DD78309A; Tue, 14 Dec 2021 14:22:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="I5069b0/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 90861810EC; Tue, 14 Dec 2021 14:22:36 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (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 0C3AC810EC for ; Tue, 14 Dec 2021 14:22:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BA6B8B819A5; Tue, 14 Dec 2021 13:22:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C95AC34607; Tue, 14 Dec 2021 13:22:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639488148; bh=3X8KYi3wnnmqZ1qJXfTKUVSy+dP4CiMIELCCvLNVqkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I5069b0/8PtG34gBrmCqnLqh5hU3DstatqOOJWaGK7weRXHRFS42QFoegFQYixU28 JOIO1CA45VRG1p3j1zXY5EFjWmoTqfQoz/MEQyrBwWgqWXtVBGofgAe0StnlTATIiW SeJy0kSTF2DCYoNiEI5CwCnK4+EDStR3pXk54ZGBamD3G0hFvo0AiVFEPCR7H714w4 xH5Ed4oWBEisu/7fnoffMEyV1rAsbrlZeqUXFaqySnKMOvBM3RP3j5NVEnGItxSXRL AYbh7c2askoqZoBdJFYNXOWIhbWsGlNFfPKgJM2O/2yYJW+xkdsl82+XXbtLH511N1 FSa8xtwxrQ63A== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell v3 1/9] arm: mvebu: Check that kwbimage offset and blocksize are valid Date: Tue, 14 Dec 2021 14:22:14 +0100 Message-Id: <20211214132222.21324-2-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214132222.21324-1-kabel@kernel.org> References: <20211214132222.21324-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár There are certain restrictions for kwbimage offset and blocksize. Validate them. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/spl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 73c4b9af3e..a6ed4367dd 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -163,6 +163,18 @@ int spl_parse_board_header(struct spl_image_info *spl_image, spl_image->offset *= 512; #endif + if (spl_image->offset % 4 != 0) { + printf("ERROR: Wrong srcaddr (%u) in kwbimage\n", + spl_image->offset); + return -EINVAL; + } + + if (mhdr->blocksize <= 4 || mhdr->blocksize % 4 != 0) { + printf("ERROR: Wrong blocksize (%u) in kwbimage\n", + mhdr->blocksize); + return -EINVAL; + } + spl_image->size = mhdr->blocksize; spl_image->entry_point = mhdr->execaddr; spl_image->load_addr = mhdr->destaddr; From patchwork Tue Dec 14 13:22:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1567732 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=DI2mex1M; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCzbC5tZLz9s5P for ; Wed, 15 Dec 2021 00:23:19 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3F5BC812BB; Tue, 14 Dec 2021 14:22:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="DI2mex1M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1A231812BB; Tue, 14 Dec 2021 14:22:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (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 CBA588129B for ; Tue, 14 Dec 2021 14:22:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5E42CB819A6; Tue, 14 Dec 2021 13:22:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04933C34601; Tue, 14 Dec 2021 13:22:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639488150; bh=M4E/bkdgLK+iIRJXrL90ZtWGdTt2xW/8HHHSk2LG/x0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DI2mex1MSUr3e7zNh0ogI4hUWhJ8HgFIWLDQLqfBZPeMu2KIV1ERRnPIFrn6pDr2S HXRMSc8z/hdhrDj3r+ZVMxiwl/xci5Umy39SE3bw70tSprpf73rieKwyrA/ZmphE08 kDvqzXanSl6SWBpC/DEAU3WNm/bOh+oGCcKbIDIrXjQ9+qrxhiRkdWNDSKduKhHZJv 2PxEoi2P1hePGULOYJTVPm2+breEEYOy7bBmHPfpqcZg4oVL2dDbZKYlScKPSi/OOx OVjlAb1rqB1l+kglxuLDYEekoYNGkF8lqbQI0WE5pU7uPkrhMDSs86j9hw1lHS3v14 7ECwXTpQmX+Fw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell v3 2/9] SPL: Add struct spl_boot_device parameter into spl_parse_board_header() Date: Tue, 14 Dec 2021 14:22:15 +0100 Message-Id: <20211214132222.21324-3-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214132222.21324-1-kabel@kernel.org> References: <20211214132222.21324-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Add parameter spl_boot_device to spl_parse_board_header(), which allows the implementations to see from which device we are booting and do boot-device-specific checks of the image header. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/spl.c | 1 + arch/arm/mach-sunxi/spl_spi_sunxi.c | 2 +- common/spl/spl.c | 4 ++- common/spl/spl_ext.c | 9 ++++-- common/spl/spl_fat.c | 11 +++++--- common/spl/spl_legacy.c | 3 +- common/spl/spl_mmc.c | 43 ++++++++++++++++++----------- common/spl/spl_nand.c | 5 ++-- common/spl/spl_net.c | 2 +- common/spl/spl_nor.c | 4 +-- common/spl/spl_onenand.c | 2 +- common/spl/spl_ram.c | 2 +- common/spl/spl_sata.c | 9 +++--- common/spl/spl_sdp.c | 2 +- common/spl/spl_spi.c | 9 +++--- common/spl/spl_ubi.c | 4 +-- common/spl/spl_usb.c | 4 +-- common/spl/spl_xip.c | 4 +-- common/spl/spl_ymodem.c | 4 +-- drivers/usb/gadget/f_sdp.c | 12 ++++---- include/sdp.h | 3 +- include/spl.h | 7 +++++ 22 files changed, 90 insertions(+), 56 deletions(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index a6ed4367dd..716217083b 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -101,6 +101,7 @@ u32 spl_mmc_boot_mode(const u32 boot_device) #endif int spl_parse_board_header(struct spl_image_info *spl_image, + const struct spl_boot_device *bootdev, const void *image_header, size_t size) { const struct kwbimage_main_hdr_v1 *mhdr = image_header; diff --git a/arch/arm/mach-sunxi/spl_spi_sunxi.c b/arch/arm/mach-sunxi/spl_spi_sunxi.c index 3499c4cc5f..910e805016 100644 --- a/arch/arm/mach-sunxi/spl_spi_sunxi.c +++ b/arch/arm/mach-sunxi/spl_spi_sunxi.c @@ -348,7 +348,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, ret = spl_load_simple_fit(spl_image, &load, load_offset, header); } else { - ret = spl_parse_image_header(spl_image, header); + ret = spl_parse_image_header(spl_image, bootdev, header); if (ret) return ret; diff --git a/common/spl/spl.c b/common/spl/spl.c index 4c101ec5d3..bf2139a058 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -312,6 +312,7 @@ static int spl_load_fit_image(struct spl_image_info *spl_image, #endif __weak int spl_parse_board_header(struct spl_image_info *spl_image, + const struct spl_boot_device *bootdev, const void *image_header, size_t size) { return -EINVAL; @@ -326,6 +327,7 @@ __weak int spl_parse_legacy_header(struct spl_image_info *spl_image, } int spl_parse_image_header(struct spl_image_info *spl_image, + const struct spl_boot_device *bootdev, const struct image_header *header) { #if CONFIG_IS_ENABLED(LOAD_FIT_FULL) @@ -369,7 +371,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image, } #endif - if (!spl_parse_board_header(spl_image, (const void *)header, sizeof(*header))) + if (!spl_parse_board_header(spl_image, bootdev, (const void *)header, sizeof(*header))) return 0; #ifdef CONFIG_SPL_RAW_IMAGE_SUPPORT diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c index 6a28fe9bdb..ebd914c492 100644 --- a/common/spl/spl_ext.c +++ b/common/spl/spl_ext.c @@ -10,6 +10,7 @@ #include int spl_load_image_ext(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition, const char *filename) { @@ -46,7 +47,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image, goto end; } - err = spl_parse_image_header(spl_image, header); + err = spl_parse_image_header(spl_image, bootdev, header); if (err < 0) { puts("spl: ext: failed to parse image header\n"); goto end; @@ -66,6 +67,7 @@ end: #if CONFIG_IS_ENABLED(OS_BOOT) int spl_load_image_ext_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition) { int err; @@ -103,7 +105,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image, } file = env_get("falcon_image_file"); if (file) { - err = spl_load_image_ext(spl_image, block_dev, + err = spl_load_image_ext(spl_image, bootdev, block_dev, partition, file); if (err != 0) { puts("spl: falling back to default\n"); @@ -134,11 +136,12 @@ defaults: return -1; } - return spl_load_image_ext(spl_image, block_dev, partition, + return spl_load_image_ext(spl_image, bootdev, block_dev, partition, CONFIG_SPL_FS_LOAD_KERNEL_NAME); } #else int spl_load_image_ext_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition) { return -ENOSYS; diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c index 576c2e876a..5b270541fc 100644 --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -55,6 +55,7 @@ static ulong spl_fit_read(struct spl_load_info *load, ulong file_offset, } int spl_load_image_fat(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition, const char *filename) { @@ -76,7 +77,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image, err = file_fat_read(filename, (void *)CONFIG_SYS_LOAD_ADDR, 0); if (err <= 0) goto end; - err = spl_parse_image_header(spl_image, + err = spl_parse_image_header(spl_image, bootdev, (struct image_header *)CONFIG_SYS_LOAD_ADDR); if (err == -EAGAIN) return err; @@ -94,7 +95,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image, return spl_load_simple_fit(spl_image, &load, 0, header); } else { - err = spl_parse_image_header(spl_image, header); + err = spl_parse_image_header(spl_image, bootdev, header); if (err) goto end; @@ -114,6 +115,7 @@ end: #if CONFIG_IS_ENABLED(OS_BOOT) int spl_load_image_fat_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition) { int err; @@ -134,7 +136,7 @@ int spl_load_image_fat_os(struct spl_image_info *spl_image, } file = env_get("falcon_image_file"); if (file) { - err = spl_load_image_fat(spl_image, block_dev, + err = spl_load_image_fat(spl_image, bootdev, block_dev, partition, file); if (err != 0) { puts("spl: falling back to default\n"); @@ -160,11 +162,12 @@ defaults: return -1; } - return spl_load_image_fat(spl_image, block_dev, partition, + return spl_load_image_fat(spl_image, bootdev, block_dev, partition, CONFIG_SPL_FS_LOAD_KERNEL_NAME); } #else int spl_load_image_fat_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition) { return -ENOSYS; diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c index 82d0326806..2ec7154423 100644 --- a/common/spl/spl_legacy.c +++ b/common/spl/spl_legacy.c @@ -76,6 +76,7 @@ static inline int spl_image_get_comp(const struct image_header *hdr) } int spl_load_legacy_img(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct spl_load_info *load, ulong header) { __maybe_unused SizeT lzma_len; @@ -87,7 +88,7 @@ int spl_load_legacy_img(struct spl_image_info *spl_image, /* Read header into local struct */ load->read(load, header, sizeof(hdr), &hdr); - ret = spl_parse_image_header(spl_image, &hdr); + ret = spl_parse_image_header(spl_image, bootdev, &hdr); if (ret) return ret; diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index e1a7d25bd0..d550da2d97 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -17,7 +17,9 @@ #include #include -static int mmc_load_legacy(struct spl_image_info *spl_image, struct mmc *mmc, +static int mmc_load_legacy(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, + struct mmc *mmc, ulong sector, struct image_header *header) { u32 image_offset_sectors; @@ -26,7 +28,7 @@ static int mmc_load_legacy(struct spl_image_info *spl_image, struct mmc *mmc, u32 image_offset; int ret; - ret = spl_parse_image_header(spl_image, header); + ret = spl_parse_image_header(spl_image, bootdev, header); if (ret) return ret; @@ -77,6 +79,7 @@ static __maybe_unused unsigned long spl_mmc_raw_uboot_offset(int part) static __maybe_unused int mmc_load_image_raw_sector(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct mmc *mmc, unsigned long sector) { unsigned long count; @@ -116,7 +119,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image, ret = spl_load_imx_container(spl_image, &load, sector); } else { - ret = mmc_load_legacy(spl_image, mmc, sector, header); + ret = mmc_load_legacy(spl_image, bootdev, mmc, sector, header); } end: @@ -181,6 +184,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device) #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION static int mmc_load_image_raw_partition(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct mmc *mmc, int partition, unsigned long sector) { @@ -211,15 +215,16 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image, } #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR - return mmc_load_image_raw_sector(spl_image, mmc, info.start + sector); + return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start + sector); #else - return mmc_load_image_raw_sector(spl_image, mmc, info.start); + return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start); #endif } #endif #if CONFIG_IS_ENABLED(OS_BOOT) static int mmc_load_image_raw_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct mmc *mmc) { int ret; @@ -239,7 +244,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image, } #endif /* CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR */ - ret = mmc_load_image_raw_sector(spl_image, mmc, + ret = mmc_load_image_raw_sector(spl_image, bootdev, mmc, CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR); if (ret) return ret; @@ -257,6 +262,7 @@ int spl_start_uboot(void) return 1; } static int mmc_load_image_raw_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct mmc *mmc) { return -ENOSYS; @@ -264,20 +270,22 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image, #endif #ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION -static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc, +static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, + struct mmc *mmc, const char *filename) { int err = -ENOSYS; #ifdef CONFIG_SPL_FS_FAT if (!spl_start_uboot()) { - err = spl_load_image_fat_os(spl_image, mmc_get_blk_desc(mmc), + err = spl_load_image_fat_os(spl_image, bootdev, mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION); if (!err) return err; } #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME - err = spl_load_image_fat(spl_image, mmc_get_blk_desc(mmc), + err = spl_load_image_fat(spl_image, bootdev, mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, filename); if (!err) @@ -286,13 +294,13 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc, #endif #ifdef CONFIG_SPL_FS_EXT4 if (!spl_start_uboot()) { - err = spl_load_image_ext_os(spl_image, mmc_get_blk_desc(mmc), + err = spl_load_image_ext_os(spl_image, bootdev, mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION); if (!err) return err; } #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME - err = spl_load_image_ext(spl_image, mmc_get_blk_desc(mmc), + err = spl_load_image_ext(spl_image, bootdev, mmc_get_blk_desc(mmc), CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, filename); if (!err) @@ -307,7 +315,9 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc, return err; } #else -static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc, +static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, + struct mmc *mmc, const char *filename) { return -ENOSYS; @@ -410,7 +420,7 @@ int spl_mmc_load(struct spl_image_info *spl_image, debug("spl: mmc boot mode: raw\n"); if (!spl_start_uboot()) { - err = mmc_load_image_raw_os(spl_image, mmc); + err = mmc_load_image_raw_os(spl_image, bootdev, mmc); if (!err) return err; } @@ -418,13 +428,14 @@ int spl_mmc_load(struct spl_image_info *spl_image, raw_sect = spl_mmc_get_uboot_raw_sector(mmc, raw_sect); #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION - err = mmc_load_image_raw_partition(spl_image, mmc, raw_part, + err = mmc_load_image_raw_partition(spl_image, bootdev, + mmc, raw_part, raw_sect); if (!err) return err; #endif #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR - err = mmc_load_image_raw_sector(spl_image, mmc, + err = mmc_load_image_raw_sector(spl_image, bootdev, mmc, raw_sect + spl_mmc_raw_uboot_offset(part)); if (!err) return err; @@ -433,7 +444,7 @@ int spl_mmc_load(struct spl_image_info *spl_image, case MMCSD_MODE_FS: debug("spl: mmc boot mode: fs\n"); - err = spl_mmc_do_fs_boot(spl_image, mmc, filename); + err = spl_mmc_do_fs_boot(spl_image, bootdev, mmc, filename); if (!err) return err; diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index 8ae7d04fa6..8fe592a154 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -65,6 +65,7 @@ struct mtd_info * __weak nand_get_mtd(void) } static int spl_nand_load_element(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, int offset, struct image_header *header) { struct mtd_info *mtd = nand_get_mtd(); @@ -96,7 +97,7 @@ static int spl_nand_load_element(struct spl_image_info *spl_image, load.read = spl_nand_fit_read; return spl_load_imx_container(spl_image, &load, offset / bl_len); } else { - err = spl_parse_image_header(spl_image, header); + err = spl_parse_image_header(spl_image, bootdev, header); if (err) return err; return nand_spl_load_image(offset, spl_image->size, @@ -145,7 +146,7 @@ static int spl_nand_load_image(struct spl_image_info *spl_image, /* load linux */ nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS, sizeof(*header), (void *)header); - err = spl_parse_image_header(spl_image, header); + err = spl_parse_image_header(spl_image, bootdev, header); if (err) return err; if (header->ih_os == IH_OS_LINUX) { diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c index d23b395ab9..a853e6aead 100644 --- a/common/spl/spl_net.c +++ b/common/spl/spl_net.c @@ -58,7 +58,7 @@ static int spl_net_load_image(struct spl_image_info *spl_image, } else { debug("Legacy image\n"); - rv = spl_parse_image_header(spl_image, header); + rv = spl_parse_image_header(spl_image, bootdev, header); if (rv) return rv; diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c index 68c12413fa..0f4fff8493 100644 --- a/common/spl/spl_nor.c +++ b/common/spl/spl_nor.c @@ -66,7 +66,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, /* happy - was a Linux */ int ret; - ret = spl_parse_image_header(spl_image, header); + ret = spl_parse_image_header(spl_image, bootdev, header); if (ret) return ret; @@ -113,7 +113,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, if (IS_ENABLED(CONFIG_SPL_LEGACY_IMAGE_SUPPORT)) { load.bl_len = 1; load.read = spl_nor_load_read; - return spl_load_legacy_img(spl_image, &load, + return spl_load_legacy_img(spl_image, bootdev, &load, spl_nor_get_uboot_base()); } diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c index 93cbf47e82..f80769a027 100644 --- a/common/spl/spl_onenand.c +++ b/common/spl/spl_onenand.c @@ -27,7 +27,7 @@ static int spl_onenand_load_image(struct spl_image_info *spl_image, /* Load u-boot */ onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS, CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header); - ret = spl_parse_image_header(spl_image, header); + ret = spl_parse_image_header(spl_image, bootdev, header); if (ret) return ret; onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS, diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c index df9f3a4d00..3f7f7accc1 100644 --- a/common/spl/spl_ram.c +++ b/common/spl/spl_ram.c @@ -70,7 +70,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image, } header = (struct image_header *)map_sysmem(u_boot_pos, 0); - spl_parse_image_header(spl_image, header); + spl_parse_image_header(spl_image, bootdev, header); } return 0; diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c index e9f6c5f050..1f3a144cdf 100644 --- a/common/spl/spl_sata.c +++ b/common/spl/spl_sata.c @@ -31,6 +31,7 @@ #endif static int spl_sata_load_image_raw(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *stor_dev, unsigned long sector) { struct image_header *header; @@ -45,7 +46,7 @@ static int spl_sata_load_image_raw(struct spl_image_info *spl_image, if (count == 0) return -EIO; - ret = spl_parse_image_header(spl_image, header); + ret = spl_parse_image_header(spl_image, bootdev, header); if (ret) return ret; @@ -90,18 +91,18 @@ static int spl_sata_load_image(struct spl_image_info *spl_image, #if CONFIG_IS_ENABLED(OS_BOOT) if (spl_start_uboot() || - spl_load_image_fat_os(spl_image, stor_dev, + spl_load_image_fat_os(spl_image, bootdev, stor_dev, CONFIG_SYS_SATA_FAT_BOOT_PARTITION)) #endif { err = -ENOSYS; if (IS_ENABLED(CONFIG_SPL_FS_FAT)) { - err = spl_load_image_fat(spl_image, stor_dev, + err = spl_load_image_fat(spl_image, bootdev, stor_dev, CONFIG_SYS_SATA_FAT_BOOT_PARTITION, CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); } else if (IS_ENABLED(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR)) { - err = spl_sata_load_image_raw(spl_image, stor_dev, + err = spl_sata_load_image_raw(spl_image, bootdev, stor_dev, CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR); } } diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c index ae9c09883a..36c31aff09 100644 --- a/common/spl/spl_sdp.c +++ b/common/spl/spl_sdp.c @@ -39,7 +39,7 @@ static int spl_sdp_load_image(struct spl_image_info *spl_image, * or it loads a FIT image and returns it to be handled by the SPL * code. */ - ret = spl_sdp_handle(controller_index, spl_image); + ret = spl_sdp_handle(controller_index, spl_image, bootdev); debug("SDP ended\n"); usb_gadget_release(controller_index); diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index 4e20a23dea..cf3f7ef4c0 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -24,6 +24,7 @@ * the kernel and then device tree. */ static int spi_load_image_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct spi_flash *flash, struct image_header *header) { @@ -36,7 +37,7 @@ static int spi_load_image_os(struct spl_image_info *spl_image, if (image_get_magic(header) != IH_MAGIC) return -1; - err = spl_parse_image_header(spl_image, header); + err = spl_parse_image_header(spl_image, bootdev, header); if (err) return err; @@ -108,7 +109,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, } #if CONFIG_IS_ENABLED(OS_BOOT) - if (spl_start_uboot() || spi_load_image_os(spl_image, flash, header)) + if (spl_start_uboot() || spi_load_image_os(spl_image, bootdev, flash, header)) #endif { /* Load u-boot, mkimage header is 64 bytes. */ @@ -127,7 +128,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, (void *)CONFIG_SYS_LOAD_ADDR); if (err) return err; - err = spl_parse_image_header(spl_image, + err = spl_parse_image_header(spl_image, bootdev, (struct image_header *)CONFIG_SYS_LOAD_ADDR); } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && image_get_magic(header) == FDT_MAGIC) { @@ -154,7 +155,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, err = spl_load_imx_container(spl_image, &load, payload_offs); } else { - err = spl_parse_image_header(spl_image, header); + err = spl_parse_image_header(spl_image, bootdev, header); if (err) return err; err = spi_flash_read(flash, payload_offs + spl_image->offset, diff --git a/common/spl/spl_ubi.c b/common/spl/spl_ubi.c index 2f2d74a02d..bdf5cc4c38 100644 --- a/common/spl/spl_ubi.c +++ b/common/spl/spl_ubi.c @@ -55,7 +55,7 @@ int spl_ubi_load_image(struct spl_image_info *spl_image, ret = ubispl_load_volumes(&info, volumes, 2); if (!ret) { header = (struct image_header *)volumes[0].load_addr; - spl_parse_image_header(spl_image, header); + spl_parse_image_header(spl_image, bootdev, header); puts("Linux loaded.\n"); goto out; } @@ -75,7 +75,7 @@ int spl_ubi_load_image(struct spl_image_info *spl_image, ret = ubispl_load_volumes(&info, volumes, 1); if (!ret) - spl_parse_image_header(spl_image, header); + spl_parse_image_header(spl_image, bootdev, header); out: #ifdef CONFIG_SPL_NAND_SUPPORT if (bootdev->boot_device == BOOT_DEVICE_NAND) diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c index 67d503026c..ccf01c8276 100644 --- a/common/spl/spl_usb.c +++ b/common/spl/spl_usb.c @@ -49,10 +49,10 @@ int spl_usb_load(struct spl_image_info *spl_image, #if CONFIG_IS_ENABLED(OS_BOOT) if (spl_start_uboot() || - spl_load_image_fat_os(spl_image, stor_dev, partition)) + spl_load_image_fat_os(spl_image, bootdev, stor_dev, partition)) #endif { - err = spl_load_image_fat(spl_image, stor_dev, partition, filename); + err = spl_load_image_fat(spl_image, bootdev, stor_dev, partition, filename); } if (err) { diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c index ba4af38a3e..33863fe7d4 100644 --- a/common/spl/spl_xip.c +++ b/common/spl/spl_xip.c @@ -24,7 +24,7 @@ static int spl_xip(struct spl_image_info *spl_image, return 0; } #endif - return(spl_parse_image_header(spl_image, (const struct image_header *) - CONFIG_SYS_UBOOT_BASE)); + return(spl_parse_image_header(spl_image, bootdev, + (const struct image_header *)CONFIG_SYS_UBOOT_BASE)); } SPL_LOAD_IMAGE_METHOD("XIP", 0, BOOT_DEVICE_XIP, spl_xip); diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c index e979f780ad..047df74856 100644 --- a/common/spl/spl_ymodem.c +++ b/common/spl/spl_ymodem.c @@ -112,7 +112,7 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image, addr += res; } - ret = spl_parse_image_header(spl_image, ih); + ret = spl_parse_image_header(spl_image, bootdev, ih); if (ret) return ret; } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && @@ -135,7 +135,7 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image, size += res; } else { ih = (struct image_header *)buf; - ret = spl_parse_image_header(spl_image, ih); + ret = spl_parse_image_header(spl_image, bootdev, ih); if (ret) goto end_stream; #ifdef CONFIG_SPL_GZIP diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c index e48aa2f90d..79936ed05b 100644 --- a/drivers/usb/gadget/f_sdp.c +++ b/drivers/usb/gadget/f_sdp.c @@ -773,7 +773,8 @@ static ulong search_container_header(ulong p, int size) } #endif -static int sdp_handle_in_ep(struct spl_image_info *spl_image) +static int sdp_handle_in_ep(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev) { u8 *data = sdp_func->in_req->buf; u32 status; @@ -862,7 +863,7 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image) /* In SPL, allow jumps to U-Boot images */ struct spl_image_info spl_image = {}; - spl_parse_image_header(&spl_image, header); + spl_parse_image_header(&spl_image, bootdev, header); jump_to_image_no_args(&spl_image); #else /* In U-Boot, allow jumps to scripts */ @@ -910,7 +911,8 @@ static void sdp_handle_out_ep(void) #ifndef CONFIG_SPL_BUILD int sdp_handle(int controller_index) #else -int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image) +int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image, + struct spl_boot_device *bootdev) #endif { int flag = 0; @@ -928,9 +930,9 @@ int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image) usb_gadget_handle_interrupts(controller_index); #ifdef CONFIG_SPL_BUILD - flag = sdp_handle_in_ep(spl_image); + flag = sdp_handle_in_ep(spl_image, bootdev); #else - flag = sdp_handle_in_ep(NULL); + flag = sdp_handle_in_ep(NULL, bootdev); #endif if (sdp_func->ep_int_enable) sdp_handle_out_ep(); diff --git a/include/sdp.h b/include/sdp.h index 6ac64fb1f3..6d89baa04e 100644 --- a/include/sdp.h +++ b/include/sdp.h @@ -14,7 +14,8 @@ int sdp_init(int controller_index); #ifdef CONFIG_SPL_BUILD #include -int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image); +int spl_sdp_handle(int controller_index, struct spl_image_info *spl_image, + struct spl_boot_device *bootdev); #else int sdp_handle(int controller_index); #endif diff --git a/include/spl.h b/include/spl.h index 0af0ee3003..469e7fe1cc 100644 --- a/include/spl.h +++ b/include/spl.h @@ -29,6 +29,7 @@ struct image_header; struct blk_desc; struct image_header; +struct spl_boot_device; /* * u_boot_first_phase() - check if this is the first U-Boot phase @@ -340,6 +341,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, * Returns 0 on success. */ int spl_load_legacy_img(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct spl_load_info *load, ulong header); /** @@ -438,6 +440,7 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image); * @return 0 if a header was correctly parsed, -ve on error */ int spl_parse_image_header(struct spl_image_info *spl_image, + const struct spl_boot_device *bootdev, const struct image_header *header); void spl_board_prepare_for_linux(void); @@ -574,18 +577,22 @@ static inline const char *spl_loader_name(const struct spl_image_loader *loader) /* SPL FAT image functions */ int spl_load_image_fat(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition, const char *filename); int spl_load_image_fat_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition); void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image); /* SPL EXT image functions */ int spl_load_image_ext(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition, const char *filename); int spl_load_image_ext_os(struct spl_image_info *spl_image, + struct spl_boot_device *bootdev, struct blk_desc *block_dev, int partition); /** From patchwork Tue Dec 14 13:22:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1567731 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=CIt3q6jo; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCzZz5PTzz9s5P for ; Wed, 15 Dec 2021 00:23:07 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 499B08129B; Tue, 14 Dec 2021 14:22:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="CIt3q6jo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CA2C18305D; Tue, 14 Dec 2021 14:22:41 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (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 2317180D1C for ; Tue, 14 Dec 2021 14:22:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CBFF2B819A1; Tue, 14 Dec 2021 13:22:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A868C34606; Tue, 14 Dec 2021 13:22:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639488151; bh=feGzhAlBiXMbWzkLDO7w6SiyaA4cqerEy+tzuOt++Qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CIt3q6jo9kVDjbau245m6Oa4IkfciVeKT73WPmJeCFA6GhhV2TF2izniz97qEZjv2 Ipb7TH0xIRYuSr2TehJKJOXjAr/ePeY0otZ6asveee/AsVpct2qbZJ2dr28mIlAocf G4QGnOhAFq/MQr27F91wrbqmtbvz/iN5dMeyINVDhc4Mek7+V8gJ6MnfwcD9Eqqw+J 4wAgq0PBD3f79ZmkgIH8WPy6d9E1P2UC0/azDjO0mjdZvRtd+SjR41UXAbeZOXxgmL 6msaz1mcw4nf6L2RMJlY+2dSBkTr4rmA0KE/q5Oo6FzAb6U1NinVQSUKFq442srY5F CLCQC1FS/TlaA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell v3 3/9] arm: mvebu: Check that kwbimage blockid matches boot mode Date: Tue, 14 Dec 2021 14:22:16 +0100 Message-Id: <20211214132222.21324-4-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214132222.21324-1-kabel@kernel.org> References: <20211214132222.21324-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Each boot mode has its own kwbimage specified by blockid. So check that kwbimage is valid by blockid. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/spl.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 716217083b..4af52c626c 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -118,22 +118,39 @@ int spl_parse_board_header(struct spl_image_info *spl_image, * (including SPL content) which is not included in U-Boot image_header. */ if (mhdr->version != 1 || - ((mhdr->headersz_msb << 16) | mhdr->headersz_lsb) < sizeof(*mhdr) || - ( + ((mhdr->headersz_msb << 16) | mhdr->headersz_lsb) < sizeof(*mhdr)) { + printf("ERROR: Invalid kwbimage v1\n"); + return -EINVAL; + } + #ifdef CONFIG_SPL_SPI_FLASH_SUPPORT - mhdr->blockid != IBR_HDR_SPI_ID && + if (bootdev->boot_device == BOOT_DEVICE_SPI && + mhdr->blockid != IBR_HDR_SPI_ID) { + printf("ERROR: Wrong blockid (%u) in SPI kwbimage\n", + mhdr->blockid); + return -EINVAL; + } #endif + #ifdef CONFIG_SPL_SATA - mhdr->blockid != IBR_HDR_SATA_ID && + if (bootdev->boot_device == BOOT_DEVICE_SATA && + mhdr->blockid != IBR_HDR_SATA_ID) { + printf("ERROR: Wrong blockid (%u) in SATA kwbimage\n", + mhdr->blockid); + return -EINVAL; + } #endif + #ifdef CONFIG_SPL_MMC - mhdr->blockid != IBR_HDR_SDIO_ID && -#endif - 1 - )) { - printf("ERROR: Not valid SPI/NAND/SATA/SDIO kwbimage v1\n"); + if ((bootdev->boot_device == BOOT_DEVICE_MMC1 || + bootdev->boot_device == BOOT_DEVICE_MMC2 || + bootdev->boot_device == BOOT_DEVICE_MMC2_2) && + mhdr->blockid != IBR_HDR_SDIO_ID) { + printf("ERROR: Wrong blockid (%u) in SDIO kwbimage\n", + mhdr->blockid); return -EINVAL; } +#endif spl_image->offset = mhdr->srcaddr; From patchwork Tue Dec 14 13:22:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1567733 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=nF9qmLPM; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCzbQ6vpBz9s5P for ; Wed, 15 Dec 2021 00:23:30 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9AD0482F70; Tue, 14 Dec 2021 14:23:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="nF9qmLPM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E9AB4811BB; Tue, 14 Dec 2021 14:22:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (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 25F71812BB for ; Tue, 14 Dec 2021 14:22:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A0CF3614DC; Tue, 14 Dec 2021 13:22:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11BABC34605; Tue, 14 Dec 2021 13:22:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639488153; bh=WE3RxHYqzD/hET72EKP1P7Njmoqp6DYy4jXqJyM+2JI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nF9qmLPM0rFSIZSt/J6sPOR+fNOQzQ1ZHPNF7dKcahUfj4F3qjgRXlhKeQNWRPETK pMvCjMOIOV7WMySkaHYpdOP/WzRaDaCm4mH4SLaL8AMxMEZ/JMb63ZwivzP6PV0Iex lVTCzd1JBAaigod1USQsPGt+YbuULwxb+Gvp8Ppb8+S97XrboBG6Blkgv4hxB4ne8T b6LxKGFK2yc5A2tgP0b60QAujWyrMcTv4b65zyCSt8TTEMuJfUGBYwZPAbSXQmxgTY ug4IE7jiSzU30mTNe9VRbCNPMqVHDX8ALrKk1prj6rCEp7YVE6IKHCMWf5Qtvi7cE8 2Oi51fo/z8QVw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell v3 4/9] SPL: Add support for checking board / BootROM specific image types Date: Tue, 14 Dec 2021 14:22:17 +0100 Message-Id: <20211214132222.21324-5-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214132222.21324-1-kabel@kernel.org> References: <20211214132222.21324-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Commit 9baab60b8054 ("SPL: Add support for parsing board / BootROM specific image types") added support for loading board specific image types. This commit adds support for a new weak function spl_parse_board_header() which is called after loading boot image. Board may implement this function for checking if loaded board specific image is valid. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- common/spl/spl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/spl/spl.c b/common/spl/spl.c index bf2139a058..cc3b3b3438 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -589,6 +589,12 @@ static struct spl_image_loader *spl_ll_find_loader(uint boot_device) return NULL; } +__weak int spl_check_board_image(struct spl_image_info *spl_image, + const struct spl_boot_device *bootdev) +{ + return 0; +} + static int spl_load_image(struct spl_image_info *spl_image, struct spl_image_loader *loader) { @@ -610,6 +616,9 @@ static int spl_load_image(struct spl_image_info *spl_image, } } #endif + if (!ret) + ret = spl_check_board_image(spl_image, &bootdev); + return ret; } From patchwork Tue Dec 14 13:22:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1567734 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=uIBb0PHa; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCzbf0xQLz9s5P for ; Wed, 15 Dec 2021 00:23:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 96E9B81287; Tue, 14 Dec 2021 14:23:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="uIBb0PHa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 30D5582A70; Tue, 14 Dec 2021 14:22:48 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (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 7233D82C88 for ; Tue, 14 Dec 2021 14:22:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 18C15614DE; Tue, 14 Dec 2021 13:22:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DAF8C34606; Tue, 14 Dec 2021 13:22:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639488154; bh=7RnV2hkWfSPlp7RzsawLn9mCN8koG3w/v+4mHzT7Dys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uIBb0PHaeIIJX6Pca4R+pMjiZZpBvG4TKek9HQ937+d/wlVQWO5KZGJ5kMlLuajlc GCSyDHP32jAtzY2pgddpt9qRyjhfAiXAb2uH/1n5HqIaDgo/dSqey7hiPr8kTANk/2 aszdaZsE5uY5snBtRIy0qGl2vCb9AEF6SeAM8Ym6d1U+o3XvO+qPku8rIHSspW11A+ CBsBVBytLMSPaQmzJeD/1orewVLz1g/hI0kyEq+CJJ2W3wKXW5HAZjaOBHXX0HwoR9 mu8BgU3lAcNTzxxPauRuLhX6k15wUdnbY8eXmJQCyK0AvW1iI/n6j99MnRP+E0Q93L ZExeWTqR8aGig== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell v3 5/9] arm: mvebu: Check for kwbimage data checksum Date: Tue, 14 Dec 2021 14:22:18 +0100 Message-Id: <20211214132222.21324-6-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214132222.21324-1-kabel@kernel.org> References: <20211214132222.21324-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Last 4 bytes of kwbimage boot image is checksum. Verify it via the new spl_check_board_image() function which is called by U-Boot SPL after loading kwbimage. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/spl.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 4af52c626c..af9e45ac7a 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -100,6 +100,33 @@ u32 spl_mmc_boot_mode(const u32 boot_device) } #endif +static u32 checksum32(void *start, u32 len) +{ + u32 csum = 0; + u32 *p = start; + + while (len > 0) { + csum += *p++; + len -= sizeof(u32); + }; + + return csum; +} + +int spl_check_board_image(struct spl_image_info *spl_image, + const struct spl_boot_device *bootdev) +{ + u32 csum = *(u32 *)(spl_image->load_addr + spl_image->size - 4); + + if (checksum32((void *)spl_image->load_addr, + spl_image->size - 4) != csum) { + printf("ERROR: Invalid data checksum in kwbimage\n"); + return -EINVAL; + } + + return 0; +} + int spl_parse_board_header(struct spl_image_info *spl_image, const struct spl_boot_device *bootdev, const void *image_header, size_t size) From patchwork Tue Dec 14 13:22:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1567735 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=TkUmfr5D; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCzbq4Nqlz9s5P for ; Wed, 15 Dec 2021 00:23:51 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 37D788203C; Tue, 14 Dec 2021 14:23:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="TkUmfr5D"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F075F82AB1; Tue, 14 Dec 2021 14:22:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (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 915B280FF4 for ; Tue, 14 Dec 2021 14:22:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 874DA614E6; Tue, 14 Dec 2021 13:22:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E967CC34601; Tue, 14 Dec 2021 13:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639488156; bh=eIdmT6GdN6geVrE+oZ7GLEzyEPDX3GAtZ/59LD+B/Js=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TkUmfr5DKyswENvVANwmGCiRx/fGnMmZZOfSoip7Z9yQDVkOxUAlF+wsFOA5TkX2J 832E7jH/EId3adjSL829PQGV6CUB1/hVWN+pI2JHKtDY70RIqepSPJyC0cME3gobpm h4fdz5iexil5xvz7ACUTmvHIGblRGqHJeyIkgePXM1OTdxsQ+FVo8gzEWZMtibEFiQ wQWGjwEYqDQqV40rBZIrZxuX86wQzVTPyBN3fhuVpsEQ/a/XhIY7UxPwLSRE7H2H1M vCPmag45KOF/RU7uoK05TIxkUbZ8/8djN1ltvetDWI8F0EHJ/CzOBylHaVGl5ff6W9 1O3llm3Tai5Fg== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell v3 6/9] arm: mvebu: spl: Print srcaddr in error message Date: Tue, 14 Dec 2021 14:22:19 +0100 Message-Id: <20211214132222.21324-7-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214132222.21324-1-kabel@kernel.org> References: <20211214132222.21324-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean From: Marek Behún Print the wrong srcaddr (spl_image->offset) in error message also for SATA case. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/spl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index af9e45ac7a..af22d4565a 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -190,7 +190,8 @@ int spl_parse_board_header(struct spl_image_info *spl_image, */ if (mhdr->blockid == IBR_HDR_SATA_ID) { if (spl_image->offset < 1) { - printf("ERROR: Wrong SATA srcaddr in kwbimage\n"); + printf("ERROR: Wrong srcaddr (%u) in SATA kwbimage\n", + spl_image->offset); return -EINVAL; } spl_image->offset -= 1; From patchwork Tue Dec 14 13:22:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1567736 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=jc4SueXB; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCzc14LW0z9s5P for ; Wed, 15 Dec 2021 00:24:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4FC0B8305D; Tue, 14 Dec 2021 14:23:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="jc4SueXB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BC1CB82AB1; Tue, 14 Dec 2021 14:22:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (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 224DC82FB4 for ; Tue, 14 Dec 2021 14:22:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 962B0B819A4; Tue, 14 Dec 2021 13:22:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60816C34607; Tue, 14 Dec 2021 13:22:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639488157; bh=gTsBsNxkbPdBjQ/3/NCPErbTh5rcdyzxSqCeTGxNLJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jc4SueXBoEdc3RnzXJepAkJH3aUMmFNkmfuXhO1EmTD+WUsXePZYFmFeGCNyM/6Nz cOMe0ivAaUQkV6QdlzDx2yTH4P2fTem7HayoIL8wUXJxJUQZHdNB1FgAfjOufd2pi2 a5CwOY0nj3OzZ0WE+DVEB3DLvpBXAGUnx7DNTcd2BMK/S5bt9wBI3pC/G0xcGUhcbf DPzHFvYzSemkU1h1FmguATUXdYjSrvjQdUI2KHmpiA5ABxMO5VazqI4/erRpBlz7Nu dlcWGyQEibgRpjurxcdBHafL9ZZdXoOI9n+OzYFKsiIbYtEjTUSYaQuxArt7G53AcO jwfrUtqxOxdYA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell v3 7/9] arm: mvebu: spl: Use preferred types u8/u16/u32 instead of uintN_t Date: Tue, 14 Dec 2021 14:22:20 +0100 Message-Id: <20211214132222.21324-8-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214132222.21324-1-kabel@kernel.org> References: <20211214132222.21324-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean From: Marek Behún Checkpatch warns about using uint32/16/8_t instead of u32/16/8. Use the preferred types. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/spl.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index af22d4565a..97cb70f147 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -74,23 +74,23 @@ /* Structure of the main header, version 1 (Armada 370/XP/375/38x/39x) */ struct kwbimage_main_hdr_v1 { - uint8_t blockid; /* 0x0 */ - uint8_t flags; /* 0x1 */ - uint16_t nandpagesize; /* 0x2-0x3 */ - uint32_t blocksize; /* 0x4-0x7 */ - uint8_t version; /* 0x8 */ - uint8_t headersz_msb; /* 0x9 */ - uint16_t headersz_lsb; /* 0xA-0xB */ - uint32_t srcaddr; /* 0xC-0xF */ - uint32_t destaddr; /* 0x10-0x13 */ - uint32_t execaddr; /* 0x14-0x17 */ - uint8_t options; /* 0x18 */ - uint8_t nandblocksize; /* 0x19 */ - uint8_t nandbadblklocation; /* 0x1A */ - uint8_t reserved4; /* 0x1B */ - uint16_t reserved5; /* 0x1C-0x1D */ - uint8_t ext; /* 0x1E */ - uint8_t checksum; /* 0x1F */ + u8 blockid; /* 0x0 */ + u8 flags; /* 0x1 */ + u16 nandpagesize; /* 0x2-0x3 */ + u32 blocksize; /* 0x4-0x7 */ + u8 version; /* 0x8 */ + u8 headersz_msb; /* 0x9 */ + u16 headersz_lsb; /* 0xA-0xB */ + u32 srcaddr; /* 0xC-0xF */ + u32 destaddr; /* 0x10-0x13 */ + u32 execaddr; /* 0x14-0x17 */ + u8 options; /* 0x18 */ + u8 nandblocksize; /* 0x19 */ + u8 nandbadblklocation; /* 0x1A */ + u8 reserved4; /* 0x1B */ + u16 reserved5; /* 0x1C-0x1D */ + u8 ext; /* 0x1E */ + u8 checksum; /* 0x1F */ } __packed; #ifdef CONFIG_SPL_MMC From patchwork Tue Dec 14 13:22:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1567737 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=iEuMsGni; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCzcC61vsz9s5P for ; Wed, 15 Dec 2021 00:24:11 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B31F783090; Tue, 14 Dec 2021 14:23:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="iEuMsGni"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E4D9D811BB; Tue, 14 Dec 2021 14:22:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (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 86E7A83022 for ; Tue, 14 Dec 2021 14:22:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 67459614D7; Tue, 14 Dec 2021 13:22:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC217C34606; Tue, 14 Dec 2021 13:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639488158; bh=9RIbjWIscMkddzqx+UO3W+NjNniDyb4CO56LxYh4UtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iEuMsGni5snP0hi62NntgjYfuWXUdRtSAzVrYiKAqLXvHZX4Ip1JvNom16T/CVdJl Iyv5FxXCiWXv2h44+k/oSQOs/Y/p/C6N5Y5Vfry+KPmXinDPBJw/FKutJDw/MGaeRL AZbBdh3vIxMyk/o9KDCpHlqseYYjXIBJYqvIee8WxySd/vpA/3m3wHpMnpSqQ8GHZG wJ1MmwDCBzFwJrOGsscnR6ggQh0BwRl5koAXiR7+wCxUw2alDGNfLXkEL8pRPbjLsF EJDvIcApZy4KcfgLhBsWyLmSZ4VR8kaaiS/TpAPpHtYFsWxsz6LzK/5cg2mx6zDAhl 6Id+FmUbr2CfQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell v3 8/9] arm: mvebu: spl: Use IS_ENABLED() instead of #ifdef where possible Date: Tue, 14 Dec 2021 14:22:21 +0100 Message-Id: <20211214132222.21324-9-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214132222.21324-1-kabel@kernel.org> References: <20211214132222.21324-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean From: Marek Behún Use the preferred if (IS_ENABLED(X)) instead of #ifdef X where possible. There are still places where this is not possible or is more complicated to convert in this file. Leave those be for now. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/spl.c | 43 ++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 97cb70f147..6e2a9e38ec 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -150,26 +150,24 @@ int spl_parse_board_header(struct spl_image_info *spl_image, return -EINVAL; } -#ifdef CONFIG_SPL_SPI_FLASH_SUPPORT - if (bootdev->boot_device == BOOT_DEVICE_SPI && + if (IS_ENABLED(CONFIG_SPL_SPI_FLASH_SUPPORT) && + bootdev->boot_device == BOOT_DEVICE_SPI && mhdr->blockid != IBR_HDR_SPI_ID) { printf("ERROR: Wrong blockid (%u) in SPI kwbimage\n", mhdr->blockid); return -EINVAL; } -#endif -#ifdef CONFIG_SPL_SATA - if (bootdev->boot_device == BOOT_DEVICE_SATA && + if (IS_ENABLED(CONFIG_SPL_SATA) && + bootdev->boot_device == BOOT_DEVICE_SATA && mhdr->blockid != IBR_HDR_SATA_ID) { printf("ERROR: Wrong blockid (%u) in SATA kwbimage\n", mhdr->blockid); return -EINVAL; } -#endif -#ifdef CONFIG_SPL_MMC - if ((bootdev->boot_device == BOOT_DEVICE_MMC1 || + if (IS_ENABLED(CONFIG_SPL_MMC) && + (bootdev->boot_device == BOOT_DEVICE_MMC1 || bootdev->boot_device == BOOT_DEVICE_MMC2 || bootdev->boot_device == BOOT_DEVICE_MMC2_2) && mhdr->blockid != IBR_HDR_SDIO_ID) { @@ -177,18 +175,16 @@ int spl_parse_board_header(struct spl_image_info *spl_image, mhdr->blockid); return -EINVAL; } -#endif spl_image->offset = mhdr->srcaddr; -#ifdef CONFIG_SPL_SATA /* * For SATA srcaddr is specified in number of sectors. * The main header is must be stored at sector number 1. * This expects that sector size is 512 bytes and recalculates * data offset to bytes relative to the main header. */ - if (mhdr->blockid == IBR_HDR_SATA_ID) { + if (IS_ENABLED(CONFIG_SPL_SATA) && mhdr->blockid == IBR_HDR_SATA_ID) { if (spl_image->offset < 1) { printf("ERROR: Wrong srcaddr (%u) in SATA kwbimage\n", spl_image->offset); @@ -197,17 +193,14 @@ int spl_parse_board_header(struct spl_image_info *spl_image, spl_image->offset -= 1; spl_image->offset *= 512; } -#endif -#ifdef CONFIG_SPL_MMC /* * For SDIO (eMMC) srcaddr is specified in number of sectors. * This expects that sector size is 512 bytes and recalculates * data offset to bytes. */ - if (mhdr->blockid == IBR_HDR_SDIO_ID) + if (IS_ENABLED(CONFIG_SPL_MMC) && mhdr->blockid == IBR_HDR_SDIO_ID) spl_image->offset *= 512; -#endif if (spl_image->offset % 4 != 0) { printf("ERROR: Wrong srcaddr (%u) in kwbimage\n", @@ -340,17 +333,17 @@ void board_init_f(ulong dummy) timer_init(); /* Armada 375 does not support SerDes and DDR3 init yet */ -#if !defined(CONFIG_ARMADA_375) - /* First init the serdes PHY's */ - serdes_phy_config(); - - /* Setup DDR */ - ret = ddr3_init(); - if (ret) { - debug("ddr3_init() failed: %d\n", ret); - hang(); + if (!IS_ENABLED(CONFIG_ARMADA_375)) { + /* First init the serdes PHY's */ + serdes_phy_config(); + + /* Setup DDR */ + ret = ddr3_init(); + if (ret) { + debug("ddr3_init() failed: %d\n", ret); + hang(); + } } -#endif /* Initialize Auto Voltage Scaling */ mv_avs_init(); From patchwork Tue Dec 14 13:22:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1567738 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=C0ZLmZjt; dkim-atps=neutral Authentication-Results: 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=) 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 RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JCzcQ3Y1Hz9s5P for ; Wed, 15 Dec 2021 00:24:22 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 741A9830C0; Tue, 14 Dec 2021 14:23:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="C0ZLmZjt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9B04082F03; Tue, 14 Dec 2021 14:23:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (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 C2B9380FD5 for ; Tue, 14 Dec 2021 14:22:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 786BAB819A3; Tue, 14 Dec 2021 13:22:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43ABCC34607; Tue, 14 Dec 2021 13:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639488160; bh=Z0zDJVEVjTXqlcbzi0TmGTCXprHqYiGYVcHo92UNBts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C0ZLmZjtWpfUJv0JrmEPylEAqSNbuSbt9ZuIpHtmyAVJyJkmp9+0cRt92vvPE2VKe 1muW2RSQaN/VhHD6PRQMMlFXhwTC2PbShUQtDdBIzFOepr5L9L1kthU2FZo8mzo8+Q bOdPhFTbZ3ynPEAf3ZpR/hV60fP6SHQy3yNzbAtzrKD7iRu9mgtd5i7PIA3V+Pv6Q+ 9QwthqqCLgRvMBebjTRZCihbN326qWQmEBAPf7uTiv3/A9YaNX+IgWQWdqyHXPE0mu nuRB9cxpS8gULIeyF0cb8xTnD5hAqOOuhh18II4zzW4CLJ9KplyKQQAgKWQaW2kute 9TNzDzjEqKUnA== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell v3 9/9] arm: mvebu: spl: Fix 100 column exceeds Date: Tue, 14 Dec 2021 14:22:22 +0100 Message-Id: <20211214132222.21324-10-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214132222.21324-1-kabel@kernel.org> References: <20211214132222.21324-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean From: Marek Behún Fix 100 column exceeds in arch/arm/mach-mvebu/spl.c. Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/spl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 6e2a9e38ec..c6009e69b7 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -47,7 +47,8 @@ #if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR) && CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR != 0 #error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR must be set to 0 #endif -#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET) && CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 0 +#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET) && \ + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET != 0 #error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET must be set to 0 #endif #endif @@ -58,7 +59,8 @@ * set to 1. Otherwise U-Boot SPL would not be able to load U-Boot proper. */ #ifdef CONFIG_SPL_SATA -#if !defined(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR) || !defined(CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR) || CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR != 1 +#if !defined(CONFIG_SPL_SATA_RAW_U_BOOT_USE_SECTOR) || \ + !defined(CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR) || CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR != 1 #error CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR must be set to 1 #endif #endif