public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu@linaro.org>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Kazuhiko Sakamoto <sakamoto.kazuhiko@socionext.com>,
	Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	Jassi Brar <jaswinder.singh@linaro.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	u-boot@lists.denx.de
Subject: [PATCH 1/3] efi_selftest: Use EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() for media check
Date: Thu, 16 Sep 2021 17:53:27 +0900	[thread overview]
Message-ID: <163178240747.65790.12394686374882007857.stgit@localhost> (raw)
In-Reply-To: <163178239865.65790.17211919979018423637.stgit@localhost>

According to the UEF specification v2.9, the main purpose of the
EFI_SIMPLE_NETWORK_PROTOCOL::GetStatus() is for checking the link
status via EFI_SIMPLE_NETWORK_MODE::MediaPresent.
So this uses net->get_status() for checking the link status before
running network test.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
---
 lib/efi_selftest/efi_selftest_snp.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/efi_selftest/efi_selftest_snp.c b/lib/efi_selftest/efi_selftest_snp.c
index 79f0467803..cb0db7eea2 100644
--- a/lib/efi_selftest/efi_selftest_snp.c
+++ b/lib/efi_selftest/efi_selftest_snp.c
@@ -309,6 +309,18 @@ static int execute(void)
 		return EFI_ST_FAILURE;
 	}
 
+	/* Check media connected */
+	ret = net->get_status(net, NULL, NULL);
+	if (ret != EFI_SUCCESS) {
+		efi_st_error("Failed to get status");
+		return EFI_ST_FAILURE;
+	}
+	if (net->mode && net->mode->media_present_supported &&
+	    !net->mode->media_present) {
+		efi_st_error("Network media is not connected");
+		return EFI_ST_FAILURE;
+	}
+
 	/*
 	 * Send DHCP discover message
 	 */


  reply	other threads:[~2021-09-16  8:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16  8:53 [PATCH 0/3] efi_selftest: Update SIMPLE_NETWORK_PROTOCOL selftest Masami Hiramatsu
2021-09-16  8:53 ` Masami Hiramatsu [this message]
2021-09-16  8:53 ` [PATCH 2/3] efi_selftest: Do not check EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT Masami Hiramatsu
2021-09-16  9:30   ` Heinrich Schuchardt
2021-09-16  9:57     ` Masami Hiramatsu
2021-09-16  8:53 ` [PATCH 3/3] efi_selftest: Recieve the packets until the receive buffer is empty Masami Hiramatsu
2021-09-16  9:29   ` Heinrich Schuchardt
2021-09-16 10:05     ` Masami Hiramatsu
2021-09-17  3:54 ` [PATCH 0/3] efi_selftest: Update SIMPLE_NETWORK_PROTOCOL selftest Heinrich Schuchardt
2021-09-17  4:47   ` Masami Hiramatsu
2021-10-04  5:08     ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=163178240747.65790.12394686374882007857.stgit@localhost \
    --to=masami.hiramatsu@linaro.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jaswinder.singh@linaro.org \
    --cc=sakamoto.kazuhiko@socionext.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox