dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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