diff --git a/grub-core/net/drivers/efi/efinet.c b/grub-core/net/drivers/efi/efinet.c index 906a688dc..2a392bc98 100644 --- a/grub-core/net/drivers/efi/efinet.c +++ b/grub-core/net/drivers/efi/efinet.c @@ -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 * diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index b20baa015..6f3e2a71d 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -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,