From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B900CC74A5B for ; Wed, 29 Mar 2023 19:28:16 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D933C86037; Wed, 29 Mar 2023 21:28:14 +0200 (CEST) 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="CilsCgyE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 94EAF86032; Wed, 29 Mar 2023 21:28:11 +0200 (CEST) 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 0C6E7859CE for ; Wed, 29 Mar 2023 21:28:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@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 9AC18B82420; Wed, 29 Mar 2023 19:28:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43A67C433D2; Wed, 29 Mar 2023 19:28:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680118084; bh=QncbD0tirGufghHgJFU+VMhd5Yt3wj1bqrSewe6+K5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CilsCgyEWK1RhQmcSu0974Hx9Z1fIk3fzDmDrUi3BNm8YJzdCK10pdANhluoe6ASE i03fcvE4XG22Z6xI/E1TNtzYSNkylpJhWMHXmhCMnnDl9FGS9hTSPVqhd6mnzqC1Hl ngeYPXklOGwdutrbEsMS6VXDvvoElrmf/F8iZq4lrwKGC0m24zy/d7ePHSKzmvF8Za WD+k/iREOjs2V3AW+sGeBgLisCX7cJ/5RjXm1imr2dAn3JPJ2sIWn6SVcG6fTkvXOI SXtVIIVi958ed/DTF4duZHmYNjBdQXbFQBYSKyt/C1spvdVBVnwKPyRBcfNrN7vNTR Q9Vkqv+uSFvPQ== Received: by pali.im (Postfix) id F0B8EB6E; Wed, 29 Mar 2023 21:28:01 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Martin Rowe , Tony Dinh , Stefan Roese , Chris Packham , Baruch Siach Cc: u-boot@lists.denx.de Subject: [PATCH u-boot-mvebu 2/7] cmd: mvebu/bubt: a38x: Do not hardcode SATA block size to 512 Date: Wed, 29 Mar 2023 21:25:53 +0200 Message-Id: <20230329192558.12417-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230329192558.12417-1-pali@kernel.org> References: <20230329192558.12417-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Find SATA block device by blk_get_devnum_by_uclass_id() function and read from it the real block size of the SATA disk. Signed-off-by: Pali Rohár --- cmd/mvebu/bubt.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 49797b23144b..bbe9851dfdeb 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -925,8 +925,11 @@ static int check_image_header(void) offset = le32_to_cpu(hdr->srcaddr); size = le32_to_cpu(hdr->blocksize); - if (hdr->blockid == 0x78) /* SATA id */ - offset *= 512; + if (hdr->blockid == 0x78) { /* SATA id */ + struct blk_desc *blk_dev = blk_get_devnum_by_uclass_id(UCLASS_SCSI, 0); + unsigned long blksz = blk_dev ? blk_dev->blksz : 512; + offset *= blksz; + } if (offset % 4 != 0 || size < 4 || size % 4 != 0) { printf("Error: Bad A38x image blocksize.\n"); -- 2.20.1