]> git.sur5r.net Git - u-boot/commitdiff
efi_loader: correctly setup device paths for block devices
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Mon, 11 Dec 2017 11:56:40 +0000 (12:56 +0100)
committerAlexander Graf <agraf@suse.de>
Sat, 16 Dec 2017 22:07:55 +0000 (23:07 +0100)
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>
Signed-off-by: Alexander Graf <agraf@suse.de>
lib/efi_loader/efi_device_path.c

index 50330ddac794cdfc2f368723a9517f6a9613f0c7..5de2c0388fdc52dafb1816a186f441352d114950 100644 (file)
@@ -435,7 +435,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);
@@ -449,7 +449,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)