From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91CE6C433EF for ; Thu, 16 Sep 2021 08:59:47 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D0DD461186 for ; Thu, 16 Sep 2021 08:59:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D0DD461186 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6435483146; Thu, 16 Sep 2021 10:59:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kMyURmj+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E727B83116; Thu, 16 Sep 2021 10:59:27 +0200 (CEST) Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8147E831FE for ; Thu, 16 Sep 2021 10:53:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masami.hiramatsu@linaro.org Received: by mail-pf1-x42d.google.com with SMTP id q22so5346308pfu.0 for ; Thu, 16 Sep 2021 01:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=euH7taWnKS6EN6sF95vRGG08aDe82RNM2lP3B2ws+Vc=; b=kMyURmj+umFp8igm+SwvPyiCawq4YqkNeB5zNY615fZ1XT5xRBOqcFdeX7tqeBUId6 uxhw0cCh2NUsrOKzsWEfK7Yn3cJduvlwF0WUa/GOiuBnzuhi0yhaOytqVikPrfCrdcVi iiuC7OmLjQPPaNY2tSX4eTrvfpfCU7CTVoE7VQ96UKcBX1OoTlkeyhPvwJ01oEPUoXec uRuh84FdGOoAQJJWr2owSYPdWLV3/ubM9IOFIRVUbxJhldl1pTKkFfUv20oQrKI0P5id nrEFkwdZUZTDNV/N2aES1Uibeh2i3B4vpoCKTwUUfy9uKQ0Wmgo3mgmK82TiU0TOOOfb ZPYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=euH7taWnKS6EN6sF95vRGG08aDe82RNM2lP3B2ws+Vc=; b=tQKXIVELVOAgifyUf+9GW9Ti7d/8ercz79/9mq+63y49cXsgcJY+3RRfEw4BLI8O4i 50AZlOecMxORvFHcXvZjuQvVXSluLUKMk1cMmr4NsDtNPWGj/LFmZRxss5C2CMwTv8FI DewOH7CYV8BB/bD6FVYxTTvBNsRRMA/Ho2FnFaOKGiy21KzaGxrMKgoaVQRJxKdBZSVU C6i0EAIUpJpK5OA/JW5Ej9E6cjl9G7aweD9GT3hODIsQS3Hg0CtlwfrPdrd1LMrvSq1g CSV0XIhG0fy82lyviyRrVop19aQJwAdQNzEsUYPnPKz0i3dYLXLuYF6xMUUoULMVRUhK +qoA== X-Gm-Message-State: AOAM533RsyqyEIMiuCou6jcdZ0DyqgZv4QJIE+BLp4WhvDaaMCSzJyGM FFN27/pz5UlXE+5KyDMW110Ozg== X-Google-Smtp-Source: ABdhPJxG97B6f1rrH7HXQgGZWh/kHX5V/O6mVUzsYavd82JH8V53DUybCMaBr0yeTeOlTgu+fItTjA== X-Received: by 2002:a65:6389:: with SMTP id h9mr4000835pgv.83.1631782410719; Thu, 16 Sep 2021 01:53:30 -0700 (PDT) Received: from localhost.localdomain (122x208x150x49.ap122.ftth.ucom.ne.jp. [122.208.150.49]) by smtp.gmail.com with ESMTPSA id g3sm2089047pjm.22.2021.09.16.01.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Sep 2021 01:53:30 -0700 (PDT) From: Masami Hiramatsu To: Heinrich Schuchardt Cc: Kazuhiko Sakamoto , Masami Hiramatsu , Jassi Brar , Ilias Apalodimas , 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 Message-Id: <163178240747.65790.12394686374882007857.stgit@localhost> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163178239865.65790.17211919979018423637.stgit@localhost> References: <163178239865.65790.17211919979018423637.stgit@localhost> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean 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 --- 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 */