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

Jonathan Gray jsg at jsg.id.au
Tue Nov 21 12:01:00 UTC 2017


On Tue, Nov 21, 2017 at 04:59:33PM +1100, Jonathan Gray wrote:
> On Sat, Nov 18, 2017 at 03:25:29PM +1100, Jonathan Gray wrote:
> >
> > While U-Boot 2017.11 release works with vexpress/qemu with the
> > efi loader it is broken on at least rpi_3 and tinker-rk3288.
> > MEDIA_DEVICE is not found again.
> 
> The loaded image paths look like the below.
> 
> vexpress and qemu_arm (virt) have a MEDIA_DEVICE, rpi_3 and
> tinkerboard do not.
> 
> Having boot_targets load bootarm.efi from mmc on rpi_3 works but having
> it load from usb does not.

The following efi_dp_match call should match but doesn't as two bytes in
the dp path nodes differ.

Forcing this to match returns the correct dp with a MEDIA_DEVICE and allows
the system to boot.

This turns out to be the partition_signature.  It is uninitialised memory.
The diff below to zero that part of the device path node fixes the
comparison.

find_obj efi_dp_match
/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/USBClass(0,0,9,0,0)/USBClass(424,9514,9,0,2)/USBClass(781,5581,0,0,0)/HD(Part0,MBRType=01,SigType=00)
/VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/USBClass(0,0,9,0,0)/USBClass(424,9514,9,0,2)/USBClass(781,5581,0,0,0)/HD(Part0,MBRType=01,SigType=00)
efi_dp_match depth 0 alen 20 blen 20
efi_dp_match A
01 04 14 00 b9 73 1d e6 84 a3 cc 4a ae ab 82 e8
28 f3 62 8b 
efi_dp_match B
01 04 14 00 b9 73 1d e6 84 a3 cc 4a ae ab 82 e8
28 f3 62 8b 
efi_dp_match depth 1 alen 11 blen 11
efi_dp_match A
03 0f 0b 00 00 00 00 00 09 00 00 
efi_dp_match B
03 0f 0b 00 00 00 00 00 09 00 00 
efi_dp_match depth 2 alen 11 blen 11
efi_dp_match A
03 0f 0b 00 24 04 14 95 09 00 02 
efi_dp_match B
03 0f 0b 00 24 04 14 95 09 00 02 
efi_dp_match depth 3 alen 11 blen 11
efi_dp_match A
03 0f 0b 00 81 07 81 55 00 00 00 
efi_dp_match B
03 0f 0b 00 81 07 81 55 00 00 00 
efi_dp_match depth 4 alen 42 blen 42
efi_dp_match A
04 01 2a 00 00 00 00 00 00 20 00 00 00 00 00 00
00 80 00 00 00 00 00 00 15 55 55 55 55 55 d5 c1
55 55 51 55 55 45 51 55 01 00 
efi_dp_match B
04 01 2a 00 00 00 00 00 00 20 00 00 00 00 00 00
00 80 00 00 00 00 00 00 57 15 05 15 55 55 55 50
d5 55 55 55 55 55 50 75 01 00

diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index f6e368e029..8045532a29 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -431,6 +431,9 @@ static void *dp_part_fill(void *buf, struct blk_desc *desc, int part)
 		if (hddp->signature_type != 0)
 			memcpy(hddp->partition_signature, &desc->guid_sig,
 			       sizeof(hddp->partition_signature));
+		else
+			memset(hddp->partition_signature, 0,
+			       sizeof(hddp->partition_signature));
 
 		buf = &hddp[1];
 	}


More information about the U-Boot mailing list