diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2017-10-05 16:36:07 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2017-10-09 07:00:36 +0200 |
commit | 5ca23ed5bc63832baa24a6107537fdd229c458ae (patch) | |
tree | 57e2c3cda8ca96996395128848cd5592c7c0455a /lib/efi_selftest/efi_selftest_util.c | |
parent | 1b6332597f23ea71b94a9ce65e15a0d3f5ea23ed (diff) | |
download | u-boot-5ca23ed5bc63832baa24a6107537fdd229c458ae.zip u-boot-5ca23ed5bc63832baa24a6107537fdd229c458ae.tar.gz u-boot-5ca23ed5bc63832baa24a6107537fdd229c458ae.tar.bz2 |
efi_loader: supply EFI network test
This patch provides an EFI application to check the correct function
of the Simple Network Protocol implementation.
It sends a DHCP request and analyzes the DHCP offer.
Different error conditions including a 10s timeout are checked.
A successful execution will look like this:
=> bootefi nettest
Scanning disk ide.blk#0...
Found 1 disks
WARNING: Invalid device tree, expect boot to fail
Network test
DHCP Discover
DHCP reply received from 192.168.76.2 (52:55:c0:a8:4c:02)
as broadcast message.
OK. The test was completed successfully.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_selftest/efi_selftest_util.c')
-rw-r--r-- | lib/efi_selftest/efi_selftest_util.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/efi_selftest/efi_selftest_util.c b/lib/efi_selftest/efi_selftest_util.c new file mode 100644 index 0000000..c9c295e --- /dev/null +++ b/lib/efi_selftest/efi_selftest_util.c @@ -0,0 +1,25 @@ +/* + * efi_selftest_util + * + * Copyright (c) 2017 Heinrich Schuchardt <xypron.glpk@gmx.de> + * + * SPDX-License-Identifier: GPL-2.0+ + * + * Utility functions + */ + +#include <efi_selftest.h> + +int efi_st_memcmp(const void *buf1, const void *buf2, size_t length) +{ + const u8 *pos1 = buf1; + const u8 *pos2 = buf2; + + for (; length; --length) { + if (*pos1 != *pos2) + return pos1 - pos2; + ++pos1; + ++pos2; + } + return EFI_ST_SUCCESS; +} |