c78952
From 0ff5bf3deefdb17dbadb51a11acc50b96e2ed797 Mon Sep 17 00:00:00 2001
6f1e3d
From: Fedora Ninjas <grub2-owner@fedoraproject.org>
6f1e3d
Date: Sat, 15 Feb 2014 15:10:22 -0500
31cddd
Subject: [PATCH] reopen SNP protocol for exclusive use by grub
6f1e3d
6f1e3d
---
6f1e3d
 grub-core/net/drivers/efi/efinet.c | 16 ++++++++++++++++
6f1e3d
 1 file changed, 16 insertions(+)
6f1e3d
6f1e3d
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
ec4acb
index 5388f952ba9..ea0e0ca360e 100644
6f1e3d
--- a/grub-core/net/drivers/efi/efinet.c
6f1e3d
+++ b/grub-core/net/drivers/efi/efinet.c
6f1e3d
@@ -330,6 +330,7 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
6f1e3d
 {
6f1e3d
   struct grub_net_card *card;
6f1e3d
   grub_efi_device_path_t *dp;
6f1e3d
+  grub_efi_simple_network_t *net;
6f1e3d
 
6f1e3d
   dp = grub_efi_get_device_path (hnd);
6f1e3d
   if (! dp)
6f1e3d
@@ -383,6 +384,21 @@ grub_efi_net_config_real (grub_efi_handle_t hnd, char **device,
6f1e3d
 				    &pxe_mode->dhcp_ack,
6f1e3d
 				    sizeof (pxe_mode->dhcp_ack),
6f1e3d
 				    1, device, path);
6f1e3d
+    net = grub_efi_open_protocol (card->efi_handle, &net_io_guid,
6f1e3d
+				  GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
6f1e3d
+    if (net) {
6f1e3d
+      if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
6f1e3d
+	  && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
6f1e3d
+	continue;
6f1e3d
+
6f1e3d
+      if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
6f1e3d
+	continue;
6f1e3d
+
6f1e3d
+      if (net->mode->state == GRUB_EFI_NETWORK_STARTED
6f1e3d
+	  && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
6f1e3d
+	continue;
6f1e3d
+      card->efi_net = net;
6f1e3d
+    }
6f1e3d
     return;
6f1e3d
   }
6f1e3d
 }