]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Hopefully fix EFI problem. Not tested
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 5 Oct 2011 21:33:36 +0000 (23:33 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 5 Oct 2011 21:33:36 +0000 (23:33 +0200)
grub-core/net/drivers/efi/efinet.c
include/grub/efi/api.h

index 906a688dc06572bdb40cfcf62aa6e10ccbe47237..2a392bc98a86c237b7ba32b341bfb0b3480e6ac2 100644 (file)
@@ -35,11 +35,22 @@ send_card_buffer (const 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;
   st = efi_call_7 (net->transmit, net, 0, (pack->tail - pack->data),
                   pack->data, NULL, NULL, NULL);
   if (st != GRUB_EFI_SUCCESS)
-    return grub_error (GRUB_ERR_IO, "Couldn't send network packet.");
-  return GRUB_ERR_NONE;
+    return grub_error (GRUB_ERR_IO, "couldn't send network packet");
+  while (1)
+    {
+      void *txbuf = NULL;
+      st = efi_call_3 (net->get_status, net, 0, &txbuf);
+      if (st != GRUB_EFI_SUCCESS)
+       return grub_error (GRUB_ERR_IO, "couldn't send network packet");
+      if (txbuf)
+       return GRUB_ERR_NONE;
+      if (limit_time < grub_get_time_ms ())
+       return grub_error (GRUB_ERR_TIMEOUT, "couldn't send network packet");
+    }
 }
 
 static struct grub_net_buff *
index b20baa015d34ddff44031ffb4ac02f05f4a5afc0..6f3e2a71da8afbd290c65be3b7a1a9d5aa25e0fa 100644 (file)
@@ -1301,7 +1301,9 @@ struct grub_efi_simple_network
   void (*statistics) (void);
   void (*mcastiptomac) (void);
   void (*nvdata) (void);
-  void (*getstatus) (void);
+  grub_efi_status_t (*get_status) (struct grub_efi_simple_network *this,
+                                  grub_uint32_t *int_status,
+                                  void **txbuf);
   grub_efi_status_t (*transmit) (struct grub_efi_simple_network *this,
                                 grub_efi_uintn_t header_size,
                                 grub_efi_uintn_t buffer_size,