summaryrefslogtreecommitdiffstats
path: root/drivers/block/efi-block-io.c
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-06-30 14:40:35 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-07-05 14:10:10 +0200
commitf9c9651eabe33f0e3690d1230b9a431d0e3e5706 (patch)
treee8a5c641c5a1270b643908bbe8671ee71553a16d /drivers/block/efi-block-io.c
parent74a67615fb1a2cd3a249e4a6e8871bf7393f0456 (diff)
downloadbarebox-f9c9651eabe33f0e3690d1230b9a431d0e3e5706.tar.gz
barebox-f9c9651eabe33f0e3690d1230b9a431d0e3e5706.tar.xz
block: efi: allow disabling /dev/usbdiskX renaming
Some buggy UEFI implementations have been observed to not set EFI_USB_IO protocol on handles that were instantiated from USB mass storage. This leads to confusing behavior when barebox uses /dev/usbdisk for some USB sticks and doesn't for some others. The proper behavior is not relying on the UEFI and instead check e.g. GUID of the boot disk image: if [ "$bootsource" = usb ]; then mydisk = /dev/usbdisk${bootsource_instance} else mydisk = /dev/disk${bootsource_instance} fi devlookup -v bootdiskguid $mydisk guid if [ "$bootdiskguid" = "my-guid" ]; then boot ${mydisk}.1 else boot boochooser fi When going that way, the renaming to usbdisk is just annoying, so allow disabling it to simplify scripting. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220630124035.4019644-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/block/efi-block-io.c')
-rw-r--r--drivers/block/efi-block-io.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/block/efi-block-io.c b/drivers/block/efi-block-io.c
index 086afb378a..120e4d8f1a 100644
--- a/drivers/block/efi-block-io.c
+++ b/drivers/block/efi-block-io.c
@@ -140,7 +140,8 @@ static void efi_bio_print_info(struct device_d *dev)
static bool is_bio_usbdev(struct efi_device *efidev)
{
- return efi_device_has_guid(efidev, EFI_USB_IO_PROTOCOL_GUID);
+ return IS_ENABLED(CONFIG_EFI_BLK_SEPARATE_USBDISK) &&
+ efi_device_has_guid(efidev, EFI_USB_IO_PROTOCOL_GUID);
}
static int efi_bio_probe(struct efi_device *efidev)