summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2019-08-31 10:00:58 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2019-09-05 23:18:51 +0200
commit0c7adf4b5face7f7efcc41cc8b23852edbc1b6db (patch)
tree88e5e987ed4b19c49f18d0243e1ad86e27b96b2c
parent7f6d874d176e75e817d2c784b752d6f077069b04 (diff)
efi_selftest: check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT
Check that when the WaitForPacket event occurs EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT is set. Check the return value of Receive(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
-rw-r--r--lib/efi_selftest/efi_selftest_snp.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/efi_selftest/efi_selftest_snp.c b/lib/efi_selftest/efi_selftest_snp.c
index 4c26619001..807b8657b9 100644
--- a/lib/efi_selftest/efi_selftest_snp.c
+++ b/lib/efi_selftest/efi_selftest_snp.c
@@ -268,6 +268,7 @@ static int execute(void)
struct efi_mac_address destaddr;
size_t buffer_size;
u8 *addr;
+
/*
* The timeout is to occur after 10 s.
*/
@@ -298,6 +299,8 @@ static int execute(void)
events[0] = timer;
events[1] = net->wait_for_packet;
for (;;) {
+ u32 int_status;
+
/*
* Wait for packet to be received or timer event.
*/
@@ -323,8 +326,17 @@ static int execute(void)
* Receive packet
*/
buffer_size = sizeof(buffer);
- net->receive(net, NULL, &buffer_size, &buffer,
- &srcaddr, &destaddr, NULL);
+ ret = net->get_status(net, &int_status, NULL);
+ if (ret != EFI_SUCCESS) {
+ efi_st_error("Failed to get status");
+ return EFI_ST_FAILURE;
+ }
+ if (!(int_status & EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT)) {
+ efi_st_error("RX interrupt not set");
+ return EFI_ST_FAILURE;
+ }
+ ret = net->receive(net, NULL, &buffer_size, &buffer,
+ &srcaddr, &destaddr, NULL);
if (ret != EFI_SUCCESS) {
efi_st_error("Failed to receive packet");
return EFI_ST_FAILURE;