mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
efi_loader: search all possible disk partitions
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> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
fdd04563ce
commit
16a73b249d
1 changed files with 12 additions and 8 deletions
|
@ -254,18 +254,19 @@ static int efi_disk_create_eltorito(struct blk_desc *desc,
|
||||||
#if CONFIG_IS_ENABLED(ISO_PARTITION)
|
#if CONFIG_IS_ENABLED(ISO_PARTITION)
|
||||||
char devname[32] = { 0 }; /* dp->str is u16[32] long */
|
char devname[32] = { 0 }; /* dp->str is u16[32] long */
|
||||||
disk_partition_t info;
|
disk_partition_t info;
|
||||||
int part = 1;
|
int part;
|
||||||
|
|
||||||
if (desc->part_type != PART_TYPE_ISO)
|
if (desc->part_type != PART_TYPE_ISO)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* and devices for each partition: */
|
/* 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,
|
snprintf(devname, sizeof(devname), "%s:%d", pdevname,
|
||||||
part);
|
part);
|
||||||
efi_disk_add_dev(devname, if_typename, desc, diskid,
|
efi_disk_add_dev(devname, if_typename, desc, diskid,
|
||||||
info.start, part);
|
info.start, part);
|
||||||
part++;
|
|
||||||
disks++;
|
disks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,15 +300,16 @@ int efi_disk_register(void)
|
||||||
struct blk_desc *desc = dev_get_uclass_platdata(dev);
|
struct blk_desc *desc = dev_get_uclass_platdata(dev);
|
||||||
const char *if_typename = dev->driver->name;
|
const char *if_typename = dev->driver->name;
|
||||||
disk_partition_t info;
|
disk_partition_t info;
|
||||||
int part = 1;
|
int part;
|
||||||
|
|
||||||
printf("Scanning disk %s...\n", dev->name);
|
printf("Scanning disk %s...\n", dev->name);
|
||||||
|
|
||||||
/* add devices for each partition: */
|
/* 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,
|
efi_disk_add_dev(dev->name, if_typename, desc,
|
||||||
desc->devnum, 0, part);
|
desc->devnum, 0, part);
|
||||||
part++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ... and add block device: */
|
/* ... and add block device: */
|
||||||
|
@ -341,7 +343,7 @@ int efi_disk_register(void)
|
||||||
struct blk_desc *desc;
|
struct blk_desc *desc;
|
||||||
char devname[32] = { 0 }; /* dp->str is u16[32] long */
|
char devname[32] = { 0 }; /* dp->str is u16[32] long */
|
||||||
disk_partition_t info;
|
disk_partition_t info;
|
||||||
int part = 1;
|
int part;
|
||||||
|
|
||||||
desc = blk_get_devnum_by_type(if_type, i);
|
desc = blk_get_devnum_by_type(if_type, i);
|
||||||
if (!desc)
|
if (!desc)
|
||||||
|
@ -353,7 +355,9 @@ int efi_disk_register(void)
|
||||||
if_typename, i);
|
if_typename, i);
|
||||||
|
|
||||||
/* add devices for each partition: */
|
/* 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,
|
efi_disk_add_dev(devname, if_typename, desc,
|
||||||
i, 0, part);
|
i, 0, part);
|
||||||
part++;
|
part++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue