summaryrefslogtreecommitdiff
path: root/drivers/efi
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-12-09 12:36:08 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-12-13 23:37:32 +0100
commit287f2f4ab2f9f85383d26e6ff754fff3b95def82 (patch)
tree655d5527a95ab9255413588a223df812c2c1b4b4 /drivers/efi
parent28ec04c5922ceab115d42a9bb50b7e812c0fed89 (diff)
downloadbarebox-287f2f4ab2f9f85383d26e6ff754fff3b95def82.tar.gz
efi: Do not register IPv[46] devices
Some UEFI instances create IPv4 and IPv6 messaging devices as children of the main MAC messaging device. Don't register these in barebox as they would show up as duplicate ethernet devices. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/efi')
-rw-r--r--drivers/efi/efi-device.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c
index 4c10f419b1..79cdd2ef27 100644
--- a/drivers/efi/efi-device.c
+++ b/drivers/efi/efi-device.c
@@ -18,6 +18,7 @@
#include <efi.h>
#include <efi/efi-payload.h>
#include <efi/efi-device.h>
+#include <efi/device-path.h>
#include <linux/err.h>
static int efi_locate_handle(enum efi_locate_search_type search_type,
@@ -180,13 +181,24 @@ static struct efi_device *efi_add_device(efi_handle_t *handle, efi_guid_t **guid
return efidev;
}
-
static int efi_register_device(struct efi_device *efidev)
{
char *dev_path_str;
struct efi_device *parent;
int ret;
+ /*
+ * Some UEFI instances create IPv4 and IPv6 messaging devices as children
+ * of the main MAC messaging device. Don't register these in barebox as
+ * they would show up as duplicate ethernet devices.
+ */
+ if (device_path_to_type(efidev->devpath) == MESSAGING_DEVICE_PATH) {
+ u8 subtype = device_path_to_subtype(efidev->devpath);
+
+ if (subtype == MSG_IPv4_DP || subtype == MSG_IPv6_DP)
+ return -EINVAL;
+ }
+
if (efi_find_device(efidev->handle))
return -EEXIST;