* [U-Boot] [PATCH] efi_loader: search all possible disk partitions
@ 2017-10-10 2:55 Jonathan Gray
2017-10-10 8:01 ` [U-Boot] " Alexander Graf
2017-10-10 12:38 ` [U-Boot] [PATCH] " Peter Robinson
0 siblings, 2 replies; 4+ messages in thread
From: Jonathan Gray @ 2017-10-10 2:55 UTC (permalink / raw)
To: u-boot
When searching for partitions don't stop if a partition is not present
for a given partition number as there may be valid partitions after.
Search for up to MAX_SEARCH_PARTITIONS matching the other callers of
part_get_info().
This allows OpenBSD to boot via the efi_loader on rpi_3 again after
changes made after U-Boot 2017.09. With MBR partitioning OpenBSD will
by default use the fourth partition for the 0xA6 (OpenBSD) partition.
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
---
lib/efi_loader/efi_disk.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 47b487aa30..6b192701a8 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -254,18 +254,19 @@ static int efi_disk_create_eltorito(struct blk_desc *desc,
#if CONFIG_IS_ENABLED(ISO_PARTITION)
char devname[32] = { 0 }; /* dp->str is u16[32] long */
disk_partition_t info;
- int part = 1;
+ int part;
if (desc->part_type != PART_TYPE_ISO)
return 0;
/* and devices for each partition: */
- while (!part_get_info(desc, part, &info)) {
+ for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
+ if (part_get_info(desc, part, &info))
+ continue;
snprintf(devname, sizeof(devname), "%s:%d", pdevname,
part);
efi_disk_add_dev(devname, if_typename, desc, diskid,
info.start, part);
- part++;
disks++;
}
@@ -299,15 +300,16 @@ int efi_disk_register(void)
struct blk_desc *desc = dev_get_uclass_platdata(dev);
const char *if_typename = dev->driver->name;
disk_partition_t info;
- int part = 1;
+ int part;
printf("Scanning disk %s...\n", dev->name);
/* add devices for each partition: */
- while (!part_get_info(desc, part, &info)) {
+ for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
+ if (part_get_info(desc, part, &info))
+ continue;
efi_disk_add_dev(dev->name, if_typename, desc,
desc->devnum, 0, part);
- part++;
}
/* ... and add block device: */
@@ -341,7 +343,7 @@ int efi_disk_register(void)
struct blk_desc *desc;
char devname[32] = { 0 }; /* dp->str is u16[32] long */
disk_partition_t info;
- int part = 1;
+ int part;
desc = blk_get_devnum_by_type(if_type, i);
if (!desc)
@@ -353,7 +355,9 @@ int efi_disk_register(void)
if_typename, i);
/* add devices for each partition: */
- while (!part_get_info(desc, part, &info)) {
+ for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
+ if (part_get_info(desc, part, &info))
+ continue;
efi_disk_add_dev(devname, if_typename, desc,
i, 0, part);
part++;
--
2.14.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] efi_loader: search all possible disk partitions
2017-10-10 2:55 [U-Boot] [PATCH] efi_loader: search all possible disk partitions Jonathan Gray
@ 2017-10-10 8:01 ` Alexander Graf
2017-10-10 10:37 ` Jonathan Gray
2017-10-10 12:38 ` [U-Boot] [PATCH] " Peter Robinson
1 sibling, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2017-10-10 8:01 UTC (permalink / raw)
To: u-boot
> When searching for partitions don't stop if a partition is not present
> for a given partition number as there may be valid partitions after.
>
> Search for up to MAX_SEARCH_PARTITIONS matching the other callers of
> part_get_info().
>
> This allows OpenBSD to boot via the efi_loader on rpi_3 again after
> changes made after U-Boot 2017.09. With MBR partitioning OpenBSD will
> by default use the fourth partition for the 0xA6 (OpenBSD) partition.
>
> Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Thanks, applied to efi-next
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] efi_loader: search all possible disk partitions
2017-10-10 8:01 ` [U-Boot] " Alexander Graf
@ 2017-10-10 10:37 ` Jonathan Gray
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Gray @ 2017-10-10 10:37 UTC (permalink / raw)
To: u-boot
On Tue, Oct 10, 2017 at 10:01:46AM +0200, Alexander Graf wrote:
> > When searching for partitions don't stop if a partition is not present
> > for a given partition number as there may be valid partitions after.
> >
> > Search for up to MAX_SEARCH_PARTITIONS matching the other callers of
> > part_get_info().
> >
> > This allows OpenBSD to boot via the efi_loader on rpi_3 again after
> > changes made after U-Boot 2017.09. With MBR partitioning OpenBSD will
> > by default use the fourth partition for the 0xA6 (OpenBSD) partition.
> >
> > Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
>
> Thanks, applied to efi-next
>
> Alex
>
Thanks, looking over it again I realised one of the loops is now
incrementing the partition number twice per loop so I have sent a
further patch to the list to correct that.
-------------- next part --------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] efi_loader: search all possible disk partitions
2017-10-10 2:55 [U-Boot] [PATCH] efi_loader: search all possible disk partitions Jonathan Gray
2017-10-10 8:01 ` [U-Boot] " Alexander Graf
@ 2017-10-10 12:38 ` Peter Robinson
1 sibling, 0 replies; 4+ messages in thread
From: Peter Robinson @ 2017-10-10 12:38 UTC (permalink / raw)
To: u-boot
On Tue, Oct 10, 2017 at 3:55 AM, Jonathan Gray <jsg@jsg.id.au> wrote:
> When searching for partitions don't stop if a partition is not present
> for a given partition number as there may be valid partitions after.
>
> Search for up to MAX_SEARCH_PARTITIONS matching the other callers of
> part_get_info().
>
> This allows OpenBSD to boot via the efi_loader on rpi_3 again after
> changes made after U-Boot 2017.09. With MBR partitioning OpenBSD will
> by default use the fourth partition for the 0xA6 (OpenBSD) partition.
>
> Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Tested on the Pine64, fixes the issues I saw with that device.
> ---
> lib/efi_loader/efi_disk.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index 47b487aa30..6b192701a8 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -254,18 +254,19 @@ static int efi_disk_create_eltorito(struct blk_desc *desc,
> #if CONFIG_IS_ENABLED(ISO_PARTITION)
> char devname[32] = { 0 }; /* dp->str is u16[32] long */
> disk_partition_t info;
> - int part = 1;
> + int part;
>
> if (desc->part_type != PART_TYPE_ISO)
> return 0;
>
> /* and devices for each partition: */
> - while (!part_get_info(desc, part, &info)) {
> + for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
> + if (part_get_info(desc, part, &info))
> + continue;
> snprintf(devname, sizeof(devname), "%s:%d", pdevname,
> part);
> efi_disk_add_dev(devname, if_typename, desc, diskid,
> info.start, part);
> - part++;
> disks++;
> }
>
> @@ -299,15 +300,16 @@ int efi_disk_register(void)
> struct blk_desc *desc = dev_get_uclass_platdata(dev);
> const char *if_typename = dev->driver->name;
> disk_partition_t info;
> - int part = 1;
> + int part;
>
> printf("Scanning disk %s...\n", dev->name);
>
> /* add devices for each partition: */
> - while (!part_get_info(desc, part, &info)) {
> + for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
> + if (part_get_info(desc, part, &info))
> + continue;
> efi_disk_add_dev(dev->name, if_typename, desc,
> desc->devnum, 0, part);
> - part++;
> }
>
> /* ... and add block device: */
> @@ -341,7 +343,7 @@ int efi_disk_register(void)
> struct blk_desc *desc;
> char devname[32] = { 0 }; /* dp->str is u16[32] long */
> disk_partition_t info;
> - int part = 1;
> + int part;
>
> desc = blk_get_devnum_by_type(if_type, i);
> if (!desc)
> @@ -353,7 +355,9 @@ int efi_disk_register(void)
> if_typename, i);
>
> /* add devices for each partition: */
> - while (!part_get_info(desc, part, &info)) {
> + for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
> + if (part_get_info(desc, part, &info))
> + continue;
> efi_disk_add_dev(devname, if_typename, desc,
> i, 0, part);
> part++;
> --
> 2.14.2
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-10 12:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-10 2:55 [U-Boot] [PATCH] efi_loader: search all possible disk partitions Jonathan Gray
2017-10-10 8:01 ` [U-Boot] " Alexander Graf
2017-10-10 10:37 ` Jonathan Gray
2017-10-10 12:38 ` [U-Boot] [PATCH] " Peter Robinson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.