diff mbox series

[U-Boot,v3,2/6] efi_loader: correctly setup device paths for block devices

Message ID 20171211115644.14015-3-xypron.glpk@gmx.de
State Accepted
Delegated to: Alexander Graf
Headers show
Series efi_loader: correct media device paths | expand

Commit Message

Heinrich Schuchardt Dec. 11, 2017, 11:56 a.m. UTC
According to the UEFI spec the numbering of partitions has to
start with 1.

Partion number 0 is reserved for the optional device path for
the complete block device.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v3
	no change
v2
	Do not generate optional device path with partion number 0.
---
 lib/efi_loader/efi_device_path.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 42fe6e1185..6461ea9abc 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -420,7 +420,7 @@  static void *dp_part_fill(void *buf, struct blk_desc *desc, int part)
 	if (desc->part_type == PART_TYPE_ISO) {
 		struct efi_device_path_cdrom_path *cddp = buf;
 
-		cddp->boot_entry = part - 1;
+		cddp->boot_entry = part;
 		cddp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
 		cddp->dp.sub_type = DEVICE_PATH_SUB_TYPE_CDROM_PATH;
 		cddp->dp.length = sizeof(*cddp);
@@ -434,7 +434,7 @@  static void *dp_part_fill(void *buf, struct blk_desc *desc, int part)
 		hddp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE;
 		hddp->dp.sub_type = DEVICE_PATH_SUB_TYPE_HARD_DRIVE_PATH;
 		hddp->dp.length = sizeof(*hddp);
-		hddp->partition_number = part - 1;
+		hddp->partition_number = part;
 		hddp->partition_start = info.start;
 		hddp->partition_end = info.size;
 		if (desc->part_type == PART_TYPE_EFI)