]> git.sur5r.net Git - u-boot/commitdiff
efi_loader: fix efi_net_get_status
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 5 Oct 2017 14:36:02 +0000 (16:36 +0200)
committerAlexander Graf <agraf@suse.de>
Mon, 9 Oct 2017 05:00:34 +0000 (07:00 +0200)
The returned interrupt status was wrong.

As out transmit buffer is empty we need to always set
EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT.

When we have received a packet we need to set
EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT.

Furthermore we should call efi_timer_check() to handle events.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
include/efi_api.h
lib/efi_loader/efi_net.c

index 2f31464cb3f9813b7d3df3af71d55fc15a6eac0f..1f349db2462befb96b1b2c04de0d6cfaea63ce60 100644 (file)
@@ -600,6 +600,12 @@ struct efi_simple_network_mode {
 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS           0x08
 #define EFI_SIMPLE_NETWORK_RECEIVE_PROMISCUOUS_MULTICAST 0x10
 
+/* interrupt status bit mask */
+#define EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT   0x01
+#define EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT  0x02
+#define EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT   0x04
+#define EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT  0x08
+
 /* revision of the simple network protocol */
 #define EFI_SIMPLE_NETWORK_PROTOCOL_REVISION   0x00010000
 
index cd46d2db534871ab1d20802f18c990e0a9b26903..b16463ba1a1dfec7ed8dd78a2bf1bec48245617e 100644 (file)
@@ -133,9 +133,14 @@ static efi_status_t EFIAPI efi_net_get_status(struct efi_simple_network *this,
 {
        EFI_ENTRY("%p, %p, %p", this, int_status, txbuf);
 
-       /* We send packets synchronously, so nothing is outstanding */
-       if (int_status)
-               *int_status = 0;
+       efi_timer_check();
+
+       if (int_status) {
+               /* We send packets synchronously, so nothing is outstanding */
+               *int_status = EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;
+               if (new_rx_packet)
+                       *int_status |= EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT;
+       }
        if (txbuf)
                *txbuf = new_tx_packet;