nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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