public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Stefan Roese <sr@denx.de>
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
Date: Tue, 11 Apr 2023 20:35:02 +0200	[thread overview]
Message-ID: <20230411183502.k5pmzcpystlbarrd@pali> (raw)
In-Reply-To: <6487bcb7-bc86-f094-f328-7de838670b10@denx.de>

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 <pali@kernel.org>
> > ---
> >   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

  reply	other threads:[~2023-04-11 18:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 19:25 [PATCH u-boot-mvebu 0/7] arm: mvebu: Boot support for 4K Native disks Pali Rohár
2023-03-29 19:25 ` [PATCH u-boot-mvebu 1/7] arm: mvebu: spl: Do not hardcode SATA block size to 512 Pali Rohár
2023-03-29 19:25 ` [PATCH u-boot-mvebu 2/7] cmd: mvebu/bubt: a38x: " Pali Rohár
2023-04-11 12:33   ` Stefan Roese
2023-04-11 18:35     ` Pali Rohár [this message]
2023-04-11 18:35   ` [PATCH v2 u-boot-mvebu] " Pali Rohár
2023-03-29 19:25 ` [PATCH u-boot-mvebu 3/7] tools: imagetool: Extend print_header() by params argument Pali Rohár
2023-03-30  9:17   ` Simon Glass
2023-03-29 19:25 ` [PATCH u-boot-mvebu 4/7] tools: kwbimage: Simplify align code Pali Rohár
2023-03-29 19:25 ` [PATCH u-boot-mvebu 5/7] tools: kwbimage: Add support for SATA images with non-512 byte block size Pali Rohár
2023-03-29 19:25 ` [PATCH u-boot-mvebu 6/7] tools: kwboot: Add support for parsing SATA images with non-512 " Pali Rohár
2023-03-29 19:25 ` [PATCH u-boot-mvebu 7/7] arm: mvebu: spl: Allow to build SATA kwbimage for 4K Native disks Pali Rohár
2023-03-30 10:31   ` Martin Rowe
2023-03-30 20:26 ` [PATCH u-boot-mvebu 0/7] arm: mvebu: Boot support " Tony Dinh
2023-04-14  6:06 ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230411183502.k5pmzcpystlbarrd@pali \
    --to=pali@kernel.org \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox