- updated to 2.04
[packages/grub2.git] / efi-net-fix.patch
1 diff -ur grub-2.04.orig/grub-core/net/drivers/efi/efinet.c grub-2.04/grub-core/net/drivers/efi/efinet.c
2 --- grub-2.04.orig/grub-core/net/drivers/efi/efinet.c   2019-08-18 15:57:09.662000000 +0200
3 +++ grub-2.04/grub-core/net/drivers/efi/efinet.c        2019-08-18 15:57:25.366000000 +0200
4 @@ -330,6 +330,7 @@
5  {
6    struct grub_net_card *card;
7    grub_efi_device_path_t *dp;
8 +  grub_efi_simple_network_t *net;
9  
10    dp = grub_efi_get_device_path (hnd);
11    if (! dp)
12 @@ -383,6 +384,21 @@
13                                     &pxe_mode->dhcp_ack,
14                                     sizeof (pxe_mode->dhcp_ack),
15                                     1, device, path);
16 +    net = grub_efi_open_protocol (card->efi_handle, &net_io_guid,
17 +                                 GRUB_EFI_OPEN_PROTOCOL_BY_EXCLUSIVE);
18 +    if (net) {
19 +      if (net->mode->state == GRUB_EFI_NETWORK_STOPPED
20 +         && efi_call_1 (net->start, net) != GRUB_EFI_SUCCESS)
21 +       continue;
22 +
23 +      if (net->mode->state == GRUB_EFI_NETWORK_STOPPED)
24 +       continue;
25 +
26 +      if (net->mode->state == GRUB_EFI_NETWORK_STARTED
27 +         && efi_call_3 (net->initialize, net, 0, 0) != GRUB_EFI_SUCCESS)
28 +       continue;
29 +      card->efi_net = net;
30 +    }
31      return;
32    }
33  }