]> git.pld-linux.org Git - packages/grub2.git/commitdiff
EFI network boot fix from ustream
authorJacek Konieczny <jajcus@jajcus.net>
Sat, 30 Nov 2013 14:06:31 +0000 (15:06 +0100)
committerJacek Konieczny <jajcus@jajcus.net>
Sat, 30 Nov 2013 14:06:31 +0000 (15:06 +0100)
grub2-efinet_fix.patch [new file with mode: 0644]
grub2.spec

diff --git a/grub2-efinet_fix.patch b/grub2-efinet_fix.patch
new file mode 100644 (file)
index 0000000..06cb593
--- /dev/null
@@ -0,0 +1,65 @@
+commit c5898eb4505dcd5f367048d33ec5ea9ed40dfdeb (HEAD, tmp)
+Author: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
+Date:   Sun Mar 17 13:33:16 2013 +0100
+
+       Resend a packet if we got the wrong buffer in status.
+    
+    (cherry picked from commit 2f1071d57ec026a7f271b1bfe302d14e86673c0f)
+
+diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
+index 28f2db2..2b344d6 100644
+--- a/grub-core/net/drivers/efi/efinet.c
++++ b/grub-core/net/drivers/efi/efinet.c
+@@ -37,7 +37,6 @@ send_card_buffer (struct grub_net_card *dev,
+   grub_efi_status_t st;
+   grub_efi_simple_network_t *net = dev->efi_net;
+   grub_uint64_t limit_time = grub_get_time_ms () + 4000;
+-  grub_size_t len;
+   if (dev->txbusy)
+     while (1)
+@@ -52,17 +51,26 @@ send_card_buffer (struct grub_net_card *dev,
+           dev->txbusy = 0;
+           break;
+         }
++      if (txbuf)
++        {
++          st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size,
++                           dev->txbuf, NULL, NULL, NULL);
++          if (st != GRUB_EFI_SUCCESS)
++            return grub_error (GRUB_ERR_IO,
++                               N_("couldn't send network packet"));
++        }
+       if (limit_time < grub_get_time_ms ())
+-        return grub_error (GRUB_ERR_TIMEOUT, N_("couldn't send network packet"));
++        return grub_error (GRUB_ERR_TIMEOUT,
++                           N_("couldn't send network packet"));
+       }
+-  len = (pack->tail - pack->data);
+-  if (len > dev->mtu)
+-    len = dev->mtu;
++  dev->last_pkt_size = (pack->tail - pack->data);
++  if (dev->last_pkt_size > dev->mtu)
++    dev->last_pkt_size = dev->mtu;
+-  grub_memcpy (dev->txbuf, pack->data, len);
++  grub_memcpy (dev->txbuf, pack->data, dev->last_pkt_size);
+-  st = efi_call_7 (net->transmit, net, 0, len,
++  st = efi_call_7 (net->transmit, net, 0, dev->last_pkt_size,
+                  dev->txbuf, NULL, NULL, NULL);
+   if (st != GRUB_EFI_SUCCESS)
+     return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
+diff --git a/include/grub/net.h b/include/grub/net.h
+index 3877451..1bd7af2 100644
+--- a/include/grub/net.h
++++ b/include/grub/net.h
+@@ -139,6 +139,7 @@ struct grub_net_card
+     {
+       struct grub_efi_simple_network *efi_net;
+       grub_efi_handle_t efi_handle;
++      grub_size_t last_pkt_size;
+     };
+ #endif
+     void *data;
index 1cbc13632345d59d1a406e2b3b2502cc4bfc8d71..14c219a83c5219a578e9bfcc9841b19a07bb0a99 100644 (file)
@@ -78,6 +78,7 @@ Patch20:      ignore-kernel-symlinks.patch
 Patch21:       choose-preferred-initrd.patch
 Patch22:       %{name}-cfg.patch
 Patch23:       %{name}-freetype_include.patch
+Patch24:       %{name}-efinet_fix.patch
 URL:           http://www.gnu.org/software/grub/
 BuildRequires: autoconf >= 2.53
 BuildRequires: automake >= 1:1.11.1-1
@@ -308,6 +309,7 @@ Motyw starfield dla GRUB-a.
 %patch21 -p1
 %patch22 -p0
 %patch23 -p1
+%patch24 -p1
 
 %build
 # if gold is used then grub doesn't even boot
This page took 2.953778 seconds and 4 git commands to generate.