From: Jeroen Hofstee <jeroen@myspectrum.nl>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Fix device detection for API consumers
Date: Tue, 21 May 2013 20:14:37 +0200 [thread overview]
Message-ID: <519BB98D.7050301@myspectrum.nl> (raw)
In-Reply-To: <20130519100919.GA47317@olymp.kibab.com>
Hello Ilya,
On 05/19/2013 12:09 PM, Ilya Bakulin wrote:
> Hi list,
> I use U-Boot for starting FreeBSD/arm on Globalscale DreamPlug.
> On this platform FreeBSD uses "ubldr" second-stage bootloader, which is
> an U-Boot API consumer and uses U-Boot API to access block devices, network, etc.
> Dreamplug has several block devices accessible: internal SD card, SD card reader,
> and any number of USB-attached mass storage devices.
>
> But when I boot ubldr, I can see only one block device.
>
> I have traced down the problem and it seems to be in U-Boot API. When doing
> block device enumeration, the "more" flag is not set properly on first access.
>
> This patch fixes the problem for me. After applying the patch, FreeBSD ubldr
> is able to see and access all block devices that U-Boot self knows.
>
> diff --git a/api/api_storage.c b/api/api_storage.c
> index c535712..1147e79 100644
> --- a/api/api_storage.c
> +++ b/api/api_storage.c
> @@ -129,6 +129,9 @@ static int dev_stor_get(int type, int first, int *more, struct device_info *di)
> else
> found = 1;
>
> + if (specs[type].max_dev > 1)
> + *more = 1;
> +
> } else {
> for (i = 0; i < specs[type].max_dev; i++)
> if (di->cookie == (void *)get_dev(specs[type].name, i)) {
>
I would personally prefer to set i = 0 in the "first" block and move the
/* provide
hint if.. */ out of the else and into the if (found) block. So there
is only one
place for checking the next device, but haven't tested that, just
looking at the
code. Since *more is already set to 0 initially any early problems which
return 0
will already have more = 0. When a device is found, as an exit routine it is
checked if more devices are present, and might set it to 1.
But more important, read http://www.denx.de/wiki/U-Boot/Patches.
This patch misses a signed-off-by (and please make the commit message
reflect
why the api is broken and optionally the cover letter how you found it,
that is a bit
more to the point in my mind).
Regards,
Jeroen
prev parent reply other threads:[~2013-05-21 18:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-19 10:09 [U-Boot] [PATCH] Fix device detection for API consumers Ilya Bakulin
2013-05-21 18:14 ` Jeroen Hofstee [this message]
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=519BB98D.7050301@myspectrum.nl \
--to=jeroen@myspectrum.nl \
--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