public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rob Clark <robdclark@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC 07/10] efi_loader: use proper device-paths for net
Date: Thu, 27 Jul 2017 17:38:04 -0400	[thread overview]
Message-ID: <20170727213807.7523-8-robdclark@gmail.com> (raw)
In-Reply-To: <20170727213807.7523-1-robdclark@gmail.com>

Signed-off-by: Rob Clark <robdclark@gmail.com>
---
 include/efi_loader.h     |  2 +-
 lib/efi_loader/efi_net.c | 24 +++---------------------
 2 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index f09d0a8003..c5cc15fc4c 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -141,7 +141,7 @@ int efi_disk_register(void);
 /* Called by bootefi to make GOP (graphical) interface available */
 int efi_gop_register(void);
 /* Called by bootefi to make the network interface available */
-int efi_net_register(void **handle);
+int efi_net_register(void);
 /* Called by bootefi to make SMBIOS tables available */
 void efi_smbios_register(void);
 
diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index 0b949d86e8..91f1e4a69e 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -26,9 +26,6 @@ struct efi_net_obj {
 	/* EFI Interface callback struct for network */
 	struct efi_simple_network net;
 	struct efi_simple_network_mode net_mode;
-	/* Device path to the network adapter */
-	struct efi_device_path_mac_addr dp_mac;
-	struct efi_device_path_file_path dp_end;
 	/* PXE struct to transmit dhcp data */
 	struct efi_pxe pxe;
 	struct efi_pxe_mode pxe_mode;
@@ -210,19 +207,9 @@ void efi_net_set_dhcp_ack(void *pkt, int len)
 }
 
 /* This gets called from do_bootefi_exec(). */
-int efi_net_register(void **handle)
+int efi_net_register(void)
 {
 	struct efi_net_obj *netobj;
-	struct efi_device_path_mac_addr dp_net = {
-		.dp.type = DEVICE_PATH_TYPE_MESSAGING_DEVICE,
-		.dp.sub_type = DEVICE_PATH_SUB_TYPE_MSG_MAC_ADDR,
-		.dp.length = sizeof(dp_net),
-	};
-	struct efi_device_path_file_path dp_end = {
-		.dp.type = DEVICE_PATH_TYPE_END,
-		.dp.sub_type = DEVICE_PATH_SUB_TYPE_END,
-		.dp.length = sizeof(dp_end),
-	};
 
 	if (!eth_get_dev()) {
 		/* No eth device active, don't expose any */
@@ -236,7 +223,8 @@ int efi_net_register(void **handle)
 	netobj->parent.protocols[0].guid = &efi_net_guid;
 	netobj->parent.protocols[0].protocol_interface = &netobj->net;
 	netobj->parent.protocols[1].guid = &efi_guid_device_path;
-	netobj->parent.protocols[1].protocol_interface = &netobj->dp_mac;
+	netobj->parent.protocols[1].protocol_interface =
+		efi_dp_from_eth();
 	netobj->parent.protocols[2].guid = &efi_pxe_guid;
 	netobj->parent.protocols[2].protocol_interface = &netobj->pxe;
 	netobj->parent.handle = &netobj->net;
@@ -255,9 +243,6 @@ int efi_net_register(void **handle)
 	netobj->net.receive = efi_net_receive;
 	netobj->net.mode = &netobj->net_mode;
 	netobj->net_mode.state = EFI_NETWORK_STARTED;
-	netobj->dp_mac = dp_net;
-	netobj->dp_end = dp_end;
-	memcpy(netobj->dp_mac.mac.addr, eth_get_ethaddr(), 6);
 	memcpy(netobj->net_mode.current_address.mac_addr, eth_get_ethaddr(), 6);
 	netobj->net_mode.max_packet_size = PKTSIZE;
 
@@ -268,8 +253,5 @@ int efi_net_register(void **handle)
 	/* Hook net up to the device list */
 	list_add_tail(&netobj->parent.link, &efi_obj_list);
 
-	if (handle)
-		*handle = &netobj->net;
-
 	return 0;
 }
-- 
2.13.0

  parent reply	other threads:[~2017-07-27 21:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-27 21:37 [U-Boot] [RFC 00/10] efi_loader: bunch of EFI work for distro boot Rob Clark
2017-07-27 21:37 ` [U-Boot] [RFC 01/10] efi_loader: add back optional efi_handler::open() Rob Clark
2017-07-27 21:37 ` [U-Boot] [RFC 02/10] efi: fill in disk signature bits of hard drive device path Rob Clark
2017-07-27 21:38 ` [U-Boot] [RFC 03/10] efi: add some more device path structures Rob Clark
2017-07-27 21:38 ` [U-Boot] [RFC 04/10] fs: add fs_readdir() Rob Clark
2017-07-27 21:38 ` [U-Boot] [RFC 05/10] efi_loader: add device-path utils Rob Clark
2017-07-27 21:38 ` [U-Boot] [RFC 06/10] efi_loader: use proper device-paths for partitions Rob Clark
2017-07-27 21:38 ` Rob Clark [this message]
2017-07-27 21:38 ` [U-Boot] [RFC 08/10] efi_loader: refactor boot device and loaded_image handling Rob Clark
2017-07-27 21:38 ` [U-Boot] [RFC 09/10] efi_loader: add file/filesys support Rob Clark
2017-07-27 21:38 ` [U-Boot] [RFC 10/10] efi_loader: support load_image() from a file-path Rob Clark
2017-07-27 22:50   ` Rob Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170727213807.7523-8-robdclark@gmail.com \
    --to=robdclark@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox