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 BC3B1C7619A for ; Tue, 11 Apr 2023 18:35:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8E91985FFA; Tue, 11 Apr 2023 20:35:18 +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="okNv23D1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5331C85FFA; Tue, 11 Apr 2023 20:35:14 +0200 (CEST) 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 7949A85D77 for ; Tue, 11 Apr 2023 20:35:08 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 9487360EC7; Tue, 11 Apr 2023 18:35:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7898C433EF; Tue, 11 Apr 2023 18:35:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681238106; bh=0ekmWdwFW/dq5znG7oQtqnOkDKLfaoaeVhXfSqPCCIQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=okNv23D11kH9gH3uirY+w7oTfiw8WNvVDkjpqg/dw7gcJzr6P4/v0UeiuzPhg1syc lo++HOcUPr1tx6/3228N3AM4nmX/NSLUUNvRaWOLzdDT88REI0LaksfbCd3k/EyOyi YnJe5TFAEUTysiZzKLWpjn6TKvO+vKUb3zt18qqTbYpjDebezpUTFLPziU1XurcKin 7+ocK5SgS2H3K1EGYYx28a3KnBNfafWqSMfG+oGFuWbCxNj0EQ6cWtdwFmw/WXWvS/ dQcr2vQOqInP8wck9a177EmOxhgzesxYOjUl3U0OxOEaoRLlrp3sxSPgGRRYwhpIij 09F9j/Ijmhyvg== Received: by pali.im (Postfix) id 113D5854; Tue, 11 Apr 2023 20:35:02 +0200 (CEST) Date: Tue, 11 Apr 2023 20:35:02 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Stefan Roese Cc: u-boot@lists.denx.de Subject: Re: [PATCH u-boot-mvebu 2/7] cmd: mvebu/bubt: a38x: Do not hardcode SATA block size to 512 Message-ID: <20230411183502.k5pmzcpystlbarrd@pali> References: <20230329192558.12417-1-pali@kernel.org> <20230329192558.12417-3-pali@kernel.org> <6487bcb7-bc86-f094-f328-7de838670b10@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6487bcb7-bc86-f094-f328-7de838670b10@denx.de> User-Agent: NeoMutt/20180716 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 On Tuesday 11 April 2023 14:33:31 Stefan Roese wrote: > Hi Pali, > > On 3/29/23 21:25, Pali Rohár wrote: > > 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); > > A CI world build leads to this error for some targets. Here the log > for "maxbcm_defconfig": > > /opt/kernel.org/gcc-12.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld.bfd: > cmd/mvebu/bubt.o: in function `check_image_header': > /home/stefan/git/u-boot/u-boot-marvell/cmd/mvebu/bubt.c:928: undefined > reference to `blk_get_devnum_by_uclass_id' > make: *** [Makefile:1757: u-boot] Error 1 > > Could you please take a look? Ok, I looked at it. Issue is that this board does not have enabled CONFIG_BLK which exports blk_get_devnum_by_uclass_id symbol. Probably this board does not have SATA at all, so any SATA related code is not relevant for it. I'm sending v2 patch with fixup to call blk_get_devnum_by_uclass_id() function only in case we have config BLK enabled. > Thanks, > Stefan > > > + 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"); > > Viele Grüße, > Stefan Roese > > -- > DENX Software Engineering GmbH, Managing Director: Erika Unter > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de