From patchwork Thu Mar 15 16:33:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 131815 Delivered-To: patch@linaro.org Received: by 10.80.210.197 with SMTP id q5csp1692710edg; Thu, 15 Mar 2018 09:33:44 -0700 (PDT) X-Google-Smtp-Source: AG47ELt6zS3hkbkKlMWgszAAr+AvM7HPKxfZXQHeu+/kQ4bUKvFz1oE7jtlQp9M+HQ7ijGvAaJRE X-Received: by 10.80.211.2 with SMTP id g2mr9512913edh.96.1521131624516; Thu, 15 Mar 2018 09:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521131624; cv=none; d=google.com; s=arc-20160816; b=FoUIv+GH14vl/F417pNe+MWlmJyVFtwSGQ2Ydqk0QxNOEhswOYrtUu242/nsSJ7lcv TaPoW0IO6KoP5bhiDrVewrZh0frlOkIK7mONv/8UZZfrJ7/k3ukOefCYn9gZVpdZMVsk 0ls6+reoO+m5QV2pzlc9sTO2f+ZrnzMFgmqD1x+WX4zKyLw5XAnWlyTJnK+YHHpWOC58 YfsDT3kG+Cq7IA1PBZVUODIu1/x7X+PPaRCQ0DzWS+M/0cCPSnjAKrD8vZUGfDnbtOj8 G1C4MupbDx0mvBty7UEFrjkVFyXIJMhQKCAtkYp2zhbPEmYxUjhwGcgh7vQE6npkLiB+ Rtug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :arc-authentication-results; bh=G8PYUlrR1v757f+XXwHEWGSINrU9tAtE9RklKDqQclk=; b=wZu3H9S3xG5UiB03yef4F5ttClSJuMoEVYCXA2JpHuDVSiOUWJzHQN1vHQoW1xluQ7 shjnLwJqkssdNLf9ciIJfkr/HdZ7SGdW1XkRUuBaad8P7UqNNBJD4Zgak9eZ2H3rfwxS JZBbuC4qRfiprXYRHgI5A340JDX1q9W2VKfG9c3pLIc3dpnSWYMGFrvrw65kdoaQVciz kTmeMuNtDTuzx9b4Hq6FppNwzBDUXncqa8rqW85ipPS1PAA1RDNpIhShMGydI33UvVIJ 6AmnjXtv1hXdtbta1VzhH+87Ld9ma0XlAx/kvpa3a8Eh7iAYE5X+JOUC3qxRe9wWGytL Cphg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id a5si854767edi.265.2018.03.15.09.33.44; Thu, 15 Mar 2018 09:33:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 0A3C9C21DE8; Thu, 15 Mar 2018 16:33:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id E0FCBC21D74; Thu, 15 Mar 2018 16:33:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5951AC21D74; Thu, 15 Mar 2018 16:33:39 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 09D8AC21C29 for ; Thu, 15 Mar 2018 16:33:39 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B2C78B047; Thu, 15 Mar 2018 16:33:38 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 15 Mar 2018 17:33:38 +0100 Message-Id: <20180315163338.77456-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH] efi_loader: Fix network DP with DM_ETH X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When CONFIG_DM_ETH is set, we assemble the device path properly with a full device hierarchy. Our helper function dp_fill() even put the MAC node itself in it for us. However, for non-DM compatibility we also have code in that added the MAC node manually. That code now runs on top of the existing MAC node: Handle 0x3db2f6b0 /HardwareVendor(e61d73b9-a384-4acc-aeab-82e828f3628b)[0: ] /USBClass(0,0,9,0,0)/USBClass(424,9514,9,0,2)/MacAddr(b8:27:eb:e1:81:47,1) /MacAddr(b8:27:eb:e1:81:47,57)/EndEntire We obviously don't need the additional node and in fact, grub chokes on it and fails to match the DP against the ethernet device node. So this patch moves the additional MAC node into the non-DM code path: Handle 0x3db3fde0 /HardwareVendor(e61d73b9-a384-4acc-aeab-82e828f3628b)[0: ] /USBClass(0,0,9,0,0)/USBClass(424,9514,9,0,2)/MacAddr(b8:27:eb:e1:81:47,1) /EndEntire While at it, we also mark the non-DM MAC node as ethernet. Fixes: b66c60dde9d ("efi_loader: add device-path utils") Signed-off-by: Alexander Graf --- lib/efi_loader/efi_device_path.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 3c735e60d3..22627824f0 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -749,7 +749,9 @@ struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part, #ifdef CONFIG_CMD_NET struct efi_device_path *efi_dp_from_eth(void) { +#ifndef CONFIG_DM_ETH struct efi_device_path_mac_addr *ndp; +#endif void *buf, *start; unsigned dpsize = 0; @@ -759,8 +761,8 @@ struct efi_device_path *efi_dp_from_eth(void) dpsize += dp_size(eth_get_dev()); #else dpsize += sizeof(ROOT); -#endif dpsize += sizeof(*ndp); +#endif start = buf = dp_alloc(dpsize + sizeof(END)); if (!buf) @@ -771,14 +773,15 @@ struct efi_device_path *efi_dp_from_eth(void) #else memcpy(buf, &ROOT, sizeof(ROOT)); buf += sizeof(ROOT); -#endif ndp = buf; ndp->dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE; ndp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR; ndp->dp.length = sizeof(*ndp); + ndp->if_type = 1; /* Ethernet */ memcpy(ndp->mac.addr, eth_get_ethaddr(), ARP_HLEN); buf = &ndp[1]; +#endif *((struct efi_device_path *)buf) = END;