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