nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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