[U-Boot] [PATCH] efi_loader: disk: Fix CONFIG_BLK breakage
Tom Rini
trini at konsulko.com
Wed Aug 10 03:43:19 CEST 2016
On Mon, Aug 08, 2016 at 03:44:30PM -0600, Simon Glass wrote:
> Hi Alexander,
>
> On 5 August 2016 at 06:49, Alexander Graf <agraf at suse.de> wrote:
> > When using CONFIG_BLK, there were 2 issues:
> >
> > 1) The name we generate the device with has to match the
> > name we set in efi_set_bootdev()
> >
> > 2) The device we pass into our block functions was wrong,
> > we should not rediscover it but just use the already known
> > pointer.
> >
> > This patch fixes both issues.
> >
> > Signed-off-by: Alexander Graf <agraf at suse.de>
> > ---
> > cmd/bootefi.c | 23 ++++++++++++++++++-----
> > lib/efi_loader/efi_disk.c | 18 +++++++++++-------
> > 2 files changed, 29 insertions(+), 12 deletions(-)
> >
> > diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> > index b8ecf4c..53a6ee3 100644
> > --- a/cmd/bootefi.c
> > +++ b/cmd/bootefi.c
> > @@ -8,6 +8,7 @@
> >
> > #include <common.h>
> > #include <command.h>
> > +#include <dm/device.h>
> > #include <efi_loader.h>
> > #include <errno.h>
> > #include <libfdt.h>
> > @@ -269,18 +270,30 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
> > char devname[32] = { 0 }; /* dp->str is u16[32] long */
> > char *colon;
> >
> > - /* Assemble the condensed device name we use in efi_disk.c */
> > - snprintf(devname, sizeof(devname), "%s%s", dev, devnr);
> > +#if defined(CONFIG_BLK) || defined(CONFIG_ISO_PARTITION)
> > + desc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));
> > +#endif
> > +
> > +#ifdef CONFIG_BLK
> > + if (desc) {
> > + snprintf(devname, sizeof(devname), "%s", desc->bdev->name);
> > + } else
> > +#endif
> > +
> > + {
> > + /* Assemble the condensed device name we use in efi_disk.c */
> > + snprintf(devname, sizeof(devname), "%s%s", dev, devnr);
> > + }
> > +
> > colon = strchr(devname, ':');
> >
> > #ifdef CONFIG_ISO_PARTITION
> > /* For ISOs we create partition block devices */
> > - desc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));
> > if (desc && (desc->type != DEV_TYPE_UNKNOWN) &&
> > (desc->part_type == PART_TYPE_ISO)) {
> > if (!colon)
> > - snprintf(devname, sizeof(devname), "%s%s:1", dev,
> > - devnr);
> > + snprintf(devname, sizeof(devname), "%s:1", devname);
> > +
> > colon = NULL;
> > }
> > #endif
> > diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> > index c434c92..e00a747 100644
> > --- a/lib/efi_loader/efi_disk.c
> > +++ b/lib/efi_loader/efi_disk.c
> > @@ -31,6 +31,8 @@ struct efi_disk_obj {
> > struct efi_device_path_file_path *dp;
> > /* Offset into disk for simple partitions */
> > lbaint_t offset;
> > + /* Internal block device */
> > + const struct blk_desc *desc;
>
> Rather than storing this, can you store the udevice?
Sorry, I had had this patch testing for a bit and missed this.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160809/5a962b39/attachment.sig>
More information about the U-Boot
mailing list