summaryrefslogtreecommitdiff
path: root/cmd/bootefi.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2016-08-05 14:49:53 +0200
committerTom Rini <trini@konsulko.com>2016-08-08 13:32:59 -0400
commitf9d334bdfce2358c6eada4138a2102afc46fb124 (patch)
treee34acbe5ded88b6f42c415570e2affa9d20fc6a8 /cmd/bootefi.c
parent45313e83b842ab31464e2593ab2e39aa0287fbf7 (diff)
downloadu-boot-f9d334bdfce2358c6eada4138a2102afc46fb124.tar.gz
u-boot-f9d334bdfce2358c6eada4138a2102afc46fb124.tar.bz2
u-boot-f9d334bdfce2358c6eada4138a2102afc46fb124.zip
efi_loader: disk: Fix CONFIG_BLK breakage
When using CONFIG_BLK, there were 2 issues: 1) The name we generate the device with has to match the name we set in efi_set_bootdev() 2) The device we pass into our block functions was wrong, we should not rediscover it but just use the already known pointer. This patch fixes both issues. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'cmd/bootefi.c')
-rw-r--r--cmd/bootefi.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index d66892e69e..b52ba9cf21 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <command.h>
+#include <dm/device.h>
#include <efi_loader.h>
#include <errno.h>
#include <libfdt.h>
@@ -265,18 +266,30 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path)
char devname[32] = { 0 }; /* dp->str is u16[32] long */
char *colon;
- /* Assemble the condensed device name we use in efi_disk.c */
- snprintf(devname, sizeof(devname), "%s%s", dev, devnr);
+#if defined(CONFIG_BLK) || defined(CONFIG_ISO_PARTITION)
+ desc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));
+#endif
+
+#ifdef CONFIG_BLK
+ if (desc) {
+ snprintf(devname, sizeof(devname), "%s", desc->bdev->name);
+ } else
+#endif
+
+ {
+ /* Assemble the condensed device name we use in efi_disk.c */
+ snprintf(devname, sizeof(devname), "%s%s", dev, devnr);
+ }
+
colon = strchr(devname, ':');
#ifdef CONFIG_ISO_PARTITION
/* For ISOs we create partition block devices */
- desc = blk_get_dev(dev, simple_strtol(devnr, NULL, 10));
if (desc && (desc->type != DEV_TYPE_UNKNOWN) &&
(desc->part_type == PART_TYPE_ISO)) {
if (!colon)
- snprintf(devname, sizeof(devname), "%s%s:1", dev,
- devnr);
+ snprintf(devname, sizeof(devname), "%s:1", devname);
+
colon = NULL;
}
#endif