[U-Boot] [PATCH 11/17] efi_loader: implement WaitForPacket event

Heinrich Schuchardt xypron.glpk at gmx.de
Sun Sep 24 19:57:10 UTC 2017


The WaitForPacket event informs tha a network package has been
received by the SimpleNetworkProtocol.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 lib/efi_loader/efi_net.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index 3498b96f7a..72a023803d 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -24,6 +24,10 @@ static void *new_tx_packet;
  * to check if a new network packet has been received.
  */
 static struct efi_event *network_timer_event;
+/*
+ * This event is signaled when a packet has been received.
+ */
+static struct efi_event *wait_for_packet;
 
 struct efi_net_obj {
 	/* Generic EFI object parent class data */
@@ -227,6 +231,8 @@ static void EFIAPI efi_network_timer_notify(struct efi_event *event,
 		eth_rx();
 		push_packet = NULL;
 	}
+	if (!new_rx_packet)
+		wait_for_packet->signaled = 1;
 	EFI_EXIT(EFI_SUCCESS);
 }
 
@@ -280,6 +286,17 @@ int efi_net_register(void)
 	/* Hook net up to the device list */
 	list_add_tail(&netobj->parent.link, &efi_obj_list);
 
+	/*
+	 * Create WaitForPacket event.
+	 */
+	r = efi_create_event(EVT_NOTIFY_WAIT, TPL_CALLBACK,
+			     efi_network_timer_notify, NULL,
+			     &wait_for_packet);
+	if (r != EFI_SUCCESS) {
+		printf("ERROR: Failed to register network event\n");
+		return r;
+	}
+	netobj->net.wait_for_packet = wait_for_packet;
 	/*
 	 * Create a timer event.
 	 *
-- 
2.14.1



More information about the U-Boot mailing list