grub2/0001-efinet-Check-for-immediate-completition.patch
Dirk Mueller 033239acc6 - add 0001-efinet-Check-for-immediate-completition.patch,
0001-efinet-enable-hardware-filters-when-opening-interfac.patch,
  grub2-arm64-efinet-handle-get_status-on-buggy-firmware-properly.patch
  (bsc#947203)

OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=178
2015-09-23 20:06:52 +00:00

52 lines
1.7 KiB
Diff

From cf2b4a36c408084852c44dea045331f039b895d2 Mon Sep 17 00:00:00 2001
From: Martin Wilck <martin.wilck@ts.fujitsu.com>
Date: Fri, 27 Mar 2015 14:27:56 +0100
Subject: [PATCH] efinet: Check for immediate completition.
This both speeds GRUB up and workarounds unexpected EFI behaviour.
---
grub-core/net/drivers/efi/efinet.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c
index 2b344d6..f171f20 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -37,11 +37,12 @@ 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;
+ void *txbuf;
if (dev->txbusy)
while (1)
{
- void *txbuf = NULL;
+ txbuf = NULL;
st = efi_call_3 (net->get_status, net, 0, &txbuf);
if (st != GRUB_EFI_SUCCESS)
return grub_error (GRUB_ERR_IO,
@@ -74,7 +75,18 @@ send_card_buffer (struct grub_net_card *dev,
dev->txbuf, NULL, NULL, NULL);
if (st != GRUB_EFI_SUCCESS)
return grub_error (GRUB_ERR_IO, N_("couldn't send network packet"));
- dev->txbusy = 1;
+
+ /*
+ The card may have sent out the packet immediately - set txbusy
+ to 0 in this case.
+ Cases were observed where checking txbuf at the next call
+ of send_card_buffer() is too late: 0 is returned in txbuf and
+ we run in the GRUB_ERR_TIMEOUT case above.
+ Perhaps a timeout in the FW has discarded the recycle buffer.
+ */
+ st = efi_call_3 (net->get_status, net, 0, &txbuf);
+ dev->txbusy = !(st == GRUB_EFI_SUCCESS && txbuf == dev->txbuf);
+
return GRUB_ERR_NONE;
}
--
2.5.1