diff mbox series

[U-Boot,09/11] efi_loader: Fix disk dp's for pre-DM/legacy devices

Message ID 20171010122309.25313-10-robdclark@gmail.com
State Superseded, archived
Delegated to: Alexander Graf
Headers show
Series efi_loader: patches for Shell.efi | expand

Commit Message

Rob Clark Oct. 10, 2017, 12:23 p.m. UTC
This fixes an issue with OpenBSD's bootloader, and I think should also
fix a similar issue with grub2 on legacy devices.  In the legacy case
we were creating disk objects for the partitions, but not also the
parent device.

Reported-by: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 lib/efi_loader/efi_disk.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Alexander Graf Oct. 11, 2017, 2:56 p.m. UTC | #1
On 10.10.17 14:23, Rob Clark wrote:
> This fixes an issue with OpenBSD's bootloader, and I think should also
> fix a similar issue with grub2 on legacy devices.  In the legacy case
> we were creating disk objects for the partitions, but not also the
> parent device.
> 
> Reported-by: Jonathan Gray <jsg@jsg.id.au>
> Signed-off-by: Rob Clark <robdclark@gmail.com>

This patch is already in efi-next?


Alex
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index eb9ce772d1..47b487aa30 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -340,6 +340,8 @@  int efi_disk_register(void)
 		for (i = 0; i < 4; i++) {
 			struct blk_desc *desc;
 			char devname[32] = { 0 }; /* dp->str is u16[32] long */
+			disk_partition_t info;
+			int part = 1;
 
 			desc = blk_get_devnum_by_type(if_type, i);
 			if (!desc)
@@ -349,6 +351,15 @@  int efi_disk_register(void)
 
 			snprintf(devname, sizeof(devname), "%s%d",
 				 if_typename, i);
+
+			/* add devices for each partition: */
+			while (!part_get_info(desc, part, &info)) {
+				efi_disk_add_dev(devname, if_typename, desc,
+						 i, 0, part);
+				part++;
+			}
+
+			/* ... and add block device: */
 			efi_disk_add_dev(devname, if_typename, desc, i, 0, 0);
 			disks++;