nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0052-reopen-SNP-protocol-for-exclusive-use-by-grub.patch

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