grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] efinet: handle get_status() properly


From: Josef Bacik
Subject: [PATCH 1/3] efinet: handle get_status() properly
Date: Wed, 5 Aug 2015 14:36:37 -0400

The EFI SNP documentation isn't super clear on the value that is returned in
txbuf when calling into GetStatus.  The documentation says its the pointer to
the recycle buffer, but the documentation for Transmit() says that it should be
the pointer to the buffer that we transmitted.  On the boxes I'm using it's just
a random pointer (usually 0x1).  It is definitely transmitting stuff, but the
get_status call is not returning the pointer to the txbuf we passed in.  Looking
at a few EFI implementations and other SNP drivers it seems like there is
confusion everywhere on this.  So since we only transmit one buffer at a time,
just assume that a non-NULL txbuf means that our transmit happened properly.
With this patch I can now do networking on our EFI enabled boxes.  Thanks,

cc: Peter Jones <address@hidden>
Signed-off-by: Josef Bacik <address@hidden>
---
 grub-core/net/drivers/efi/efinet.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/grub-core/net/drivers/efi/efinet.c 
b/grub-core/net/drivers/efi/efinet.c
index f27a117..4d3f8aa 100644
--- a/grub-core/net/drivers/efi/efinet.c
+++ b/grub-core/net/drivers/efi/efinet.c
@@ -47,19 +47,11 @@ send_card_buffer (struct grub_net_card *dev,
        if (st != GRUB_EFI_SUCCESS)
          return grub_error (GRUB_ERR_IO,
                             N_("couldn't send network packet"));
-       if (txbuf == dev->txbuf)
+       if (txbuf)
          {
            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"));
@@ -84,8 +76,9 @@ send_card_buffer (struct grub_net_card *dev,
      we run in the GRUB_ERR_TIMEOUT case above.
      Perhaps a timeout in the FW has discarded the recycle buffer.
    */
+  txbuf = NULL;
   st = efi_call_3 (net->get_status, net, 0, &txbuf);
-  dev->txbusy = !(st == GRUB_EFI_SUCCESS && txbuf == dev->txbuf);
+  dev->txbusy = !(st == GRUB_EFI_SUCCESS && txbuf);
 
   return GRUB_ERR_NONE;
 }
-- 
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]