From nobody Tue Apr 23 15:39:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+85577+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+85577+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1641938205; cv=none; d=zohomail.com; s=zohoarc; b=mz9vmFm/mybyLB9wry/kr152xYEHs12smWw39LyKBygd2qeHyeZNiPkYBM/KBgrE8uJpr/7SbPm1ThpckhiDSLpayBQXckl/3Zu+IgktYeqkkrQo4s+62qMpv5jTKq5OcMiJV3J+syYLig3O460YU3Ib+1A9qMRU8UwOqrTICMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641938205; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=AJVBWdmFGkOj2nUQqeUt+HH488sfxlONy7PrBoj3KTw=; b=ZBPMI5KUTSlrqsjxX4RXq9sklEAWH70VO6r8BPBxtJmVVpZLDYgol6lzxg5TiLQXpC1s+IHoOQ6PV/KfbFZbI4uR0xYGm1z6W4vhKIl6kzT0tDmZOBvp00TxNl9ZG9KhLOETPP4acE/akdjDsNl1LoU/w1/mE19nprQ6MghNGMU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+85577+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1641938205257130.48661206041515; Tue, 11 Jan 2022 13:56:45 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id irAuYY1788612xoZvh2PijLl; Tue, 11 Jan 2022 13:56:44 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.14703.1641938203771880755 for ; Tue, 11 Jan 2022 13:56:44 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5BE64ED1; Tue, 11 Jan 2022 13:56:43 -0800 (PST) X-Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 501373F774; Tue, 11 Jan 2022 13:56:41 -0800 (PST) From: "Sunny Wang" To: devel@edk2.groups.io Cc: Sunny Wang , G Edhaya Chandran , Barton Gao , Carolyn Gjertsen , Heinrich Schuchardt , Samer El-Haj-Mahmoud , Sunny Wang Subject: [edk2-devel] [edk2-test][PATCH v1] uefi-sct/SctPkg: Allow some SNP functions to return EFI_UNSUPPORTED Date: Tue, 11 Jan 2022 21:56:19 +0000 Message-Id: <20220111215619.1857-1-Sunny.Wang@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,Sunny.Wang@arm.com X-Gm-Message-State: UBYXGxSxDHoPaSpxIWE5Xewrx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1641938204; bh=DdqZPox3jY7o4q0/aDy7qplshB+CY7NfdYgCUvUBw+s=; h=Cc:Date:From:Reply-To:Subject:To; b=eLRoU65AhnND6z3mpH4PZz4abzlX0qhIfBLQsUJPXPAID+DrYN3V+Zl/o2DBOny6mFR MuUmTeg9z4LZhAAQaeRdr1uMsA1eIyX4n9AFm6BnRR1K4ZF0mhGmEU9KD1/cA2e1aWatE t8mYvbluHfmYD2FdZuoFNCVXXU2MPHAj0zg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1641938206674100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3145 The SimpleNetwork protocol related test cases don't allow some functions to return EFI_UNSUPPORTED, which doesn't comply with UEFI spec. UEFI spec allows EFI_SIMPLE_TEXT_OUT_PROTOCOL functions below to return EFI_UNSUPPORTED. - ReceiveFilters() - Statistics() - NvData() - StationAddress() - Reset() Therefore, update the test cases that consume the functions above to fix this issue. Cc: G Edhaya Chandran Cc: Barton Gao Cc: Carolyn Gjertsen Cc: Heinrich Schuchardt Cc: Samer El-Haj-Mahmoud Signed-off-by: Sunny Wang Reviewed-by: G Edhaya Chandran --- .../BlackBoxTest/PxeBaseCodeBBTestFunction.c | 88 +- .../SimpleNetworkBBTestConformance.c | 598 +- .../SimpleNetworkBBTestFunction.c | 5041 ++++++++--------- .../BlackBoxTest/PxeBaseCodeBBTestFunction.c | 93 +- .../SimpleNetworkBBTestConformance.c | 599 +- .../SimpleNetworkBBTestFunction.c | 341 +- 6 files changed, 3316 insertions(+), 3444 deletions(-) diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PxeBaseCode/BlackBo= xTest/PxeBaseCodeBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Proto= col/PxeBaseCode/BlackBoxTest/PxeBaseCodeBBTestFunction.c index e353c522..b1f05f8c 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PxeBaseCode/BlackBoxTest/P= xeBaseCodeBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PxeBaseCode/BlackBoxTest/P= xeBaseCodeBBTestFunction.c @@ -2,15 +2,16 @@ =20 Copyright 2006 - 2016 Unified EFI, Inc.
Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2022, ARM Limited. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License - which accompanies this distribution. The full text of the license may b= e found at=20 + which accompanies this distribution. The full text of the license may b= e found at http://opensource.org/licenses/bsd-license.php -=20 + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. -=20 + **/ /*++ =20 @@ -24,7 +25,7 @@ Abstract: =20 --*/ =20 -#include "SctLib.h" +#include "SctLib.h" #include "PxeBaseCodeBBTestMain.h" #include "PxeBaseCodeBBTestSupport.h" =20 @@ -203,7 +204,7 @@ BBTestUdpReadFuncSrcPortFilter ( =20 /** * Entrypoint for EFI_PXE_BASE_CODE_PROTOCOL.Start() Function Test. - * It is the new case to add IPv6 into the test scope. The original test = case is switched off.=20 + * It is the new case to add IPv6 into the test scope. The original test = case is switched off. * @param This a pointer of EFI_BB_TEST_PROTOCOL. * @param ClientInterface a pointer to the interface to be tested. * @param TestLevel test "thoroughness" control. @@ -380,7 +381,7 @@ BBTestNewStartFunctionTest ( L"Mode->PxeBisReplyReceived - %s\r\n", BcInterface->Mode->PxeBisReplyReceived ? L"TRUE" : L"= FALSE" ); - } =20 + } if (BcInterface->Mode->IcmpErrorReceived !=3D FALSE) { AssertionType =3D EFI_TEST_ASSERTION_FAILED; StandardLib->RecordMessage ( @@ -605,7 +606,7 @@ BBTestNewStartFunctionTest ( return Status; } } - =20 + // // Enable EFI_PXE_BASE_CODE_PROTOCOL Protocol interface in IPv6 // @@ -627,8 +628,8 @@ BBTestNewStartFunctionTest ( (UINTN)__LINE__, Status ); - =20 - =20 + + if (AssertionType =3D=3D EFI_TEST_ASSERTION_PASSED) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; if (BcInterface->Mode->Started !=3D TRUE) { @@ -720,7 +721,7 @@ BBTestNewStartFunctionTest ( L"Mode->PxeBisReplyReceived - %s\r\n", BcInterface->Mode->PxeBisReplyReceived ? L"TRUE" : = L"FALSE" ); - } =20 + } if (BcInterface->Mode->IcmpErrorReceived !=3D FALSE) { AssertionType =3D EFI_TEST_ASSERTION_FAILED; StandardLib->RecordMessage ( @@ -797,7 +798,7 @@ BBTestNewStartFunctionTest ( L"IS_PXE_PACKET_ZEROED(Mode->ProxyOffer) - Fail\r\n" ); } - =20 + if (IS_PXE_PACKET_ZEROED(&BcInterface->Mode->PxeDiscover) =3D=3D FAL= SE) { AssertionType =3D EFI_TEST_ASSERTION_FAILED; StandardLib->RecordMessage ( @@ -944,13 +945,13 @@ BBTestNewStartFunctionTest ( ); } } - =20 + return Status; } =20 /** * Entrypoint for EFI_PXE_BASE_CODE_PROTOCOL.Statistics() Function Test. - * It is the new case to add IPv6 into the test scope. The original test = case is switched off.=20 + * It is the new case to add IPv6 into the test scope. The original test = case is switched off. * @param This a pointer of EFI_BB_TEST_PROTOCOL. * @param ClientInterface a pointer to the interface to be tested. * @param TestLevel test "thoroughness" control. @@ -974,7 +975,7 @@ BBTestNewSetIpFilterFunctionTest ( UINT8 Index; =20 Index =3D 0; - =20 + // // Get the Standard Library Interface // @@ -1091,7 +1092,7 @@ BBTestNewSetIpFilterFunctionTest ( return Status; } } - =20 + // // Enable EFI_PXE_BASE_CODE_PROTOCOL Protocol interface in IPv6 // @@ -1109,16 +1110,16 @@ BBTestNewSetIpFilterFunctionTest ( ); return Status; } - =20 + SctSetMem (&BcIpFilter, sizeof (BcIpFilter), 0); BcIpFilter.Filters =3D EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP; BcIpFilter.IpCnt =3D 2; - =20 + for (Index =3D 0; Index < 16; Index++) { BcIpFilter.IpList[0].v6.Addr[Index] =3D Index; BcIpFilter.IpList[1].v6.Addr[Index] =3D 16 - Index; } - =20 + Status =3D BcInterface->SetIpFilter (BcInterface, &BcIpFilter); if (Status =3D=3D EFI_SUCCESS) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; @@ -1135,7 +1136,7 @@ BBTestNewSetIpFilterFunctionTest ( (UINTN)__LINE__, Status ); - =20 + if (TRUE =3D=3D IsIpFilterEqual (&BcIpFilter, &(BcInterface->Mode->IpF= ilter))){ AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { @@ -1158,7 +1159,7 @@ BBTestNewSetIpFilterFunctionTest ( =20 /** * Entrypoint for EFI_PXE_BASE_CODE_PROTOCOL.Stop() Function Test. - * It is the new case to add IPv6 into the test scope. The original test = case is switched off.=20 + * It is the new case to add IPv6 into the test scope. The original test = case is switched off. * @param This a pointer of EFI_BB_TEST_PROTOCOL. * @param ClientInterface a pointer to the interface to be tested. * @param TestLevel test "thoroughness" control. @@ -1252,7 +1253,7 @@ BBTestNewStopFunctionTest ( __FILE__, (UINTN)__LINE__, Status - ); + ); } =20 // @@ -1290,7 +1291,7 @@ BBTestNewStopFunctionTest ( __FILE__, (UINTN)__LINE__, Status - ); =20 + ); =20 return Status; } @@ -1607,8 +1608,8 @@ BBTestStartFunctionTest ( ); } if ((0 !=3D BcInterface->Mode->IpFilter.Filters) || (0 !=3D BcInterface= ->Mode->IpFilter.IpCnt)) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - StandardLib->RecordMessage ( + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + StandardLib->RecordMessage ( StandardLib, EFI_VERBOSE_LEVEL_DEFAULT, L"The Mode->IpFilter.Filters or Mode->IpFilter.IpCnt fi= eld is not 0\r\n"); @@ -2032,6 +2033,7 @@ BBTestMtftpFunctionTest ( EFI_PXE_BASE_CODE_PROTOCOL *BcInterface; EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; UINTN FileSize; + EFI_TEST_ASSERTION AssertionType; =20 // // Get support library (Standard Lib, Profile Lib, Logging Lib) @@ -2098,11 +2100,15 @@ BBTestMtftpFunctionTest ( } =20 Status =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); - if (EFI_ERROR(Status)) - { + if (EFI_ERROR(Status)) { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } StandardLib->RecordAssertion ( StandardLib, - EFI_TEST_ASSERTION_FAILED, + AssertionType, gTestGenericFailureGuid, L"EFI_PXE_BASE_CODE_PROTOCOL.ARP - Reset Current MAC", L"%a:%d:Status - %r", @@ -2208,6 +2214,7 @@ BBTestUdpWriteFunctionTest ( EFI_STATUS Status; EFI_PXE_BASE_CODE_PROTOCOL *BcInterface; EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_TEST_ASSERTION AssertionType; =20 // // Get the Standard Library Interface @@ -2296,11 +2303,15 @@ BBTestUdpWriteFunctionTest ( } =20 Status =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); - if (EFI_ERROR(Status)) - { + if (EFI_ERROR(Status)) { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } StandardLib->RecordAssertion ( StandardLib, - EFI_TEST_ASSERTION_FAILED, + AssertionType, gTestGenericFailureGuid, L"EFI_PXE_BASE_CODE_PROTOCOL.ARP - Reset Current MAC", L"%a:%d:Status - %r", @@ -2378,6 +2389,7 @@ BBTestUdpReadFunctionTest ( EFI_PXE_BASE_CODE_PROTOCOL *BcInterface; EFI_PXE_BASE_CODE_IP_FILTER BcIpFilter; EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_TEST_ASSERTION AssertionType; =20 // // Get the Support Library Interface @@ -2473,8 +2485,12 @@ BBTestUdpReadFunctionTest ( } =20 Status =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); - if (EFI_ERROR(Status)) - { + if (EFI_ERROR(Status)) { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } StandardLib->RecordAssertion ( StandardLib, EFI_TEST_ASSERTION_FAILED, @@ -2755,8 +2771,12 @@ BBTestArpFunctionTest ( } =20 Status =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); - if (EFI_ERROR(Status)) - { + if (EFI_ERROR(Status)) { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } StandardLib->RecordAssertion ( StandardLib, EFI_TEST_ASSERTION_FAILED, diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/Black= BoxTest/SimpleNetworkBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EF= I/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c index 9597af5a..5290dbb7 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest= /SimpleNetworkBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest= /SimpleNetworkBBTestConformance.c @@ -2,15 +2,16 @@ =20 Copyright 2006 - 2016 Unified EFI, Inc.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2022, ARM Limited. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License - which accompanies this distribution. The full text of the license may b= e found at=20 + which accompanies this distribution. The full text of the license may b= e found at http://opensource.org/licenses/bsd-license.php -=20 + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. -=20 + **/ /*++ =20 @@ -24,7 +25,7 @@ Abstract: =20 --*/ =20 -#include "SctLib.h" +#include "SctLib.h" #include "SimpleNetworkBBTestMain.h" =20 /** @@ -100,7 +101,7 @@ BBTestStartConformanceTest ( } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // restore SNP status // @@ -108,7 +109,7 @@ BBTestStartConformanceTest ( Status1 =3D SnpInterface->Initialize(SnpInterface, 0, 0); if (EFI_ERROR(Status1)) { return Status1; - } =20 + } } =20 StandardLib->RecordAssertion ( @@ -206,7 +207,7 @@ BBTestStopConformanceTest ( } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Restore SNP status // @@ -311,10 +312,10 @@ BBTestInitializeConformanceTest ( } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Restore SNP status - //=20 + // if (State1 !=3D EfiSimpleNetworkStopped) { Status1 =3D SnpInterface->Start (SnpInterface); if (EFI_ERROR(Status1)) { @@ -332,7 +333,7 @@ BBTestInitializeConformanceTest ( } } =20 - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType, @@ -416,16 +417,19 @@ BBTestResetConformanceTest ( // Call Reset() function when network interface not start. // Status =3D SnpInterface->Reset (SnpInterface, FALSE); - if ((Status =3D=3D EFI_NOT_STARTED) && (SnpInterface->Mode->State =3D=3D= EfiSimpleNetworkStopped)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } } - =20 + // // Restore SNP status - //=20 + // if (State1 !=3D EfiSimpleNetworkStopped) { Status1 =3D SnpInterface->Start (SnpInterface); if (EFI_ERROR(Status1)) { @@ -450,7 +454,7 @@ BBTestResetConformanceTest ( (UINTN)__LINE__, Status ); -=20 + =20 return EFI_SUCCESS; } @@ -528,7 +532,7 @@ BBTestShutdownConformanceTest ( } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Restore SNP status // @@ -626,31 +630,26 @@ BBTestReceiveFilterConformanceTest ( // Call ReceiveFilters() function if network interface not start. // Status =3D SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, N= ULL); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if ((Status =3D=3D EFI_NOT_STARTED) && (SnpInterface->Mode->State =3D=3D= EfiSimpleNetworkStopped)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if ((Status =3D=3D EFI_NOT_STARTED) && (SnpInterface->Mode->State =3D= =3D EfiSimpleNetworkStopped)) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid006, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() when network interface not start.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid006, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke Re= ceiveFilters() when network interface not start.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + =20 // // Assertion Point 5.6.2.2 @@ -662,31 +661,25 @@ BBTestReceiveFilterConformanceTest ( } =20 Status =3D SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, N= ULL); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_DEVICE_ERROR) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_DEVICE_ERROR) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid007, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() when network interface not initialized.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid007, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke Re= ceiveFilters() when network interface not initialized.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); =20 // // Assertion Point 5.6.2.3 @@ -701,31 +694,25 @@ BBTestReceiveFilterConformanceTest ( // Call ReceiveFilters with invalide Enable // Status =3D SnpInterface->ReceiveFilters (SnpInterface, ~(SnpInterface->M= ode->ReceiveFilterMask), 0, FALSE, 0, NULL); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid008, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() with invalid Enable.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid008, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke Re= ceiveFilters() with invalid Enable.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); =20 // // Call ReceiveFilters with invalide MCastFilterCnt @@ -740,85 +727,67 @@ BBTestReceiveFilterConformanceTest ( MAC.Addr[5] =3D 0x02; =20 Status =3D SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETW= ORK_RECEIVE_MULTICAST, 0, FALSE, SnpInterface->Mode->MaxMCastFilterCount + = 1, &MAC); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid009, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke= ReceiveFilters() with invalid MCastFilterCnt is greater than Snp->Mode->Ma= xMCastFilterCount.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid009, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke = ReceiveFilters() with invalid MCastFilterCnt is greater than Snp->Mode->Max= MCastFilterCount.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); =20 Status =3D SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETW= ORK_RECEIVE_MULTICAST, 0, FALSE, 0, &MAC); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid043, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke= ReceiveFilters() with invalid MCastFilterCnt is 0.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid043, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke = ReceiveFilters() with invalid MCastFilterCnt is 0.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); =20 Status =3D SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETW= ORK_RECEIVE_MULTICAST, 0, FALSE, 1, NULL); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid010, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invo= ke ReceiveFilters() with MCastFilterCnt not match MCastFilter.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid010, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invok= e ReceiveFilters() with MCastFilterCnt not match MCastFilter.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); } =20 // @@ -912,7 +881,7 @@ BBTestStationAddressConformanceTest ( // save current snp state // State2 =3D SnpInterface->Mode->State; - =20 + // // Assertion Point 5.7.2.2 // Call StationAddress() function if network interface not initialized. @@ -923,71 +892,60 @@ BBTestStationAddressConformanceTest ( } =20 StatusBuf[1] =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); - =20 + // // Restore SNP Status // if (State1 =3D=3D EfiSimpleNetworkInitialized) { - Status =3D SnpInterface->Initialize(SnpInterface, 0, 0);=20 + Status =3D SnpInterface->Initialize(SnpInterface, 0, 0); if (EFI_ERROR(Status)){ return Status; } } - =20 - if ((StatusBuf[0] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[0] =3D=3D = EFI_UNSUPPORTED)) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"StationAddress isn't supported, Status - %r\n", - StatusBuf[0] - ); + + if ((StatusBuf[0] =3D=3D EFI_NOT_STARTED) && (State2 =3D=3D EfiSimpleNet= workStopped)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if ((StatusBuf[0] =3D=3D EFI_NOT_STARTED) && (State2 =3D=3D EfiSimpleN= etworkStopped)) { + if ((StatusBuf[0] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[0] =3D= =3D EFI_UNSUPPORTED)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid011, - L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke S= tationAddress() when network interface not start.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[0] - ); } - =20 - if ((StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[1] =3D=3D = EFI_UNSUPPORTED)) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"StationAddress isn't supported, Status - %r\n", - StatusBuf[1] - ); + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid011, + L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke St= ationAddress() when network interface not start.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[0] + ); + + + if (StatusBuf[1] =3D=3D EFI_DEVICE_ERROR) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (StatusBuf[1] =3D=3D EFI_DEVICE_ERROR) { + if ((StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[1] =3D= =3D EFI_UNSUPPORTED)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid012, - L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke S= tationAddress() when network interface not initialized.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[1] - ); } - =20 + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid012, + L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke St= ationAddress() when network interface not initialized.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[1] + ); + if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Stop (SnpInterface);=20 + Status =3D SnpInterface->Stop (SnpInterface); if (EFI_ERROR(Status)){ return Status; } @@ -1067,30 +1025,25 @@ BBTestStatisticsConformanceTest ( // Call Statistics() function while network interface is not started. // Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e, &StatisticsTable); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"Statistics isn't supported, Status - %r\n", - Status - ); + if ((Status =3D=3D EFI_NOT_STARTED) && (SnpInterface->Mode->State =3D=3D= EfiSimpleNetworkStopped)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if ((Status =3D=3D EFI_NOT_STARTED) && (SnpInterface->Mode->State =3D= =3D EfiSimpleNetworkStopped)) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid014, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Stati= stics() while network interface not started.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid014, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statis= tics() while network interface not started.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); =20 // // Assertion Point 5.8.2.2 @@ -1102,30 +1055,25 @@ BBTestStatisticsConformanceTest ( } =20 Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e, &StatisticsTable); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"Statistics isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_DEVICE_ERROR) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_DEVICE_ERROR) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid015, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Stati= stics() while network interface is not initialized.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid015, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statis= tics() while network interface is not initialized.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); =20 // // Assertion Point 5.8.2.3 @@ -1143,30 +1091,25 @@ BBTestStatisticsConformanceTest ( StatisticsSize =3D 0; =20 Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e, &StatisticsTable); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"Statistics isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid017, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Stati= stics() with small buffer.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid017, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statis= tics() with small buffer.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); =20 // // Restore SNP State @@ -1182,7 +1125,7 @@ BBTestStatisticsConformanceTest ( return Status; } } - =20 + return EFI_SUCCESS; } =20 @@ -1267,7 +1210,7 @@ BBTestMCastIpToMacConformanceTest ( } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Restore SNP status // @@ -1405,7 +1348,7 @@ BBTestNVDataConformanceTest ( =20 StatusBuf[0] =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterfa= ce->Mode->NvRamAccessSize, Buffer); CheckPoint1State =3D SnpInterface->Mode->State; - =20 + =20 // // Assertion Point 5.10.2.2 @@ -1425,119 +1368,102 @@ BBTestNVDataConformanceTest ( // Check Point A: "Offset" not be a multiple of NvRamAccessSize // StatusBuf[1] =3D SnpInterface->NvData (SnpInterface, TRUE, (SnpInterface= ->Mode->NvRamAccessSize/2), SnpInterface->Mode->NvRamAccessSize, Buffer); -=20 + =20 // // Check Point B: "BufferSize" not be a multiple of NvRamAccessSize // StatusBuf[2] =3D SnpInterface->NvData (SnpInterface, TRUE, 0, (SnpInterf= ace->Mode->NvRamAccessSize/2), Buffer); -=20 + =20 // // Check Point C: "BufferSize" + "Offset" exceeds "NvRamSize" // - StatusBuf[3] =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterfa= ce->Mode->NvRamSize+100, Buffer);=20 + StatusBuf[3] =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterfa= ce->Mode->NvRamSize+100, Buffer); =20 =20 - if (StatusBuf[0] =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - StatusBuf[0] - ); + + if ((StatusBuf[0] =3D=3D EFI_NOT_STARTED) && (CheckPoint1State =3D=3D Ef= iSimpleNetworkStopped)) { + AssertionType[0] =3D EFI_TEST_ASSERTION_PASSED; } else { - if ((StatusBuf[0] =3D=3D EFI_NOT_STARTED) && (CheckPoint1State =3D=3D = EfiSimpleNetworkStopped)) { + if (EFI_UNSUPPORTED =3D=3D StatusBuf[0]) { AssertionType[0] =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType[0] =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[0], - gSimpleNetworkBBTestConformanceAssertionGuid020, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = when network interface not start.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[0] - ); } - - if (StatusBuf[1] =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - StatusBuf[1] - ); + StandardLib->RecordAssertion ( + StandardLib, + AssertionType[0], + gSimpleNetworkBBTestConformanceAssertionGuid020, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() w= hen network interface not start.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[0] + ); + + + if (StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) { + AssertionType[1] =3D EFI_TEST_ASSERTION_PASSED; } else { - if (StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D StatusBuf[1]) { AssertionType[1] =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType[1] =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[1], - gSimpleNetworkBBTestConformanceAssertionGuid021, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = with Offset not be a multiple of NvRamAccessSize.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[1] - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType[1], + gSimpleNetworkBBTestConformanceAssertionGuid021, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() w= ith Offset not be a multiple of NvRamAccessSize.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[1] + ); =20 - if (StatusBuf[2] =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - StatusBuf[2] - ); + + if (StatusBuf[2] =3D=3D EFI_INVALID_PARAMETER) { + AssertionType[2] =3D EFI_TEST_ASSERTION_PASSED; } else { - if (StatusBuf[2] =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D StatusBuf[2]) { AssertionType[2] =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType[2] =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[2], - gSimpleNetworkBBTestConformanceAssertionGuid022, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = with BufferSize not be a multiple of NvRamAccessSize.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[2] - ); } - - if (StatusBuf[3] =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - StatusBuf[3] - ); + StandardLib->RecordAssertion ( + StandardLib, + AssertionType[2], + gSimpleNetworkBBTestConformanceAssertionGuid022, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() w= ith BufferSize not be a multiple of NvRamAccessSize.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[2] + ); + + if (StatusBuf[3] =3D=3D EFI_INVALID_PARAMETER) { + AssertionType[3] =3D EFI_TEST_ASSERTION_PASSED; } else { - if (StatusBuf[3] =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D StatusBuf[3]) { AssertionType[3] =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType[3] =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[3], - gSimpleNetworkBBTestConformanceAssertionGuid023, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = with BufferSize + Offset exceeds NvRamSize.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[3] - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType[3], + gSimpleNetworkBBTestConformanceAssertionGuid023, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() wit= h BufferSize + Offset exceeds NvRamSize.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[3] + ); =20 // // Restore SNP Status @@ -1552,8 +1478,8 @@ BBTestNVDataConformanceTest ( if (EFI_ERROR(Status)) { return Status; } - }=20 - =20 + } + Status =3D gtBS->FreePool (Buffer); if (EFI_ERROR(Status)) { return Status; @@ -1641,7 +1567,7 @@ BBTestGetStatusConformanceTest ( } else { AssertionType[0] =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Assertion Point 5.11.2.2 // Call GetStatus () function if network interface not initialized. @@ -1667,7 +1593,7 @@ BBTestGetStatusConformanceTest ( } else { AssertionType[1] =3D EFI_TEST_ASSERTION_FAILED; } -=20 + /* // // Assertion Point 5.11.2.3 @@ -1696,7 +1622,7 @@ BBTestGetStatusConformanceTest ( AssertionType[2] =3D EFI_TEST_ASSERTION_FAILED; } */ - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[0], @@ -1707,7 +1633,7 @@ BBTestGetStatusConformanceTest ( (UINTN)__LINE__, StatusBuf[0] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[1], @@ -1718,7 +1644,7 @@ BBTestGetStatusConformanceTest ( (UINTN)__LINE__, StatusBuf[1] ); -/* =20 +/* StandardLib->RecordAssertion ( StandardLib, AssertionType[2], @@ -1729,7 +1655,7 @@ BBTestGetStatusConformanceTest ( (UINTN)__LINE__, StatusBuf[2] ); -*/ =20 +*/ // // Restore SNP State // @@ -1902,7 +1828,7 @@ BBTestTransmitConformanceTest ( } else { AssertionType[4] =3D EFI_TEST_ASSERTION_FAILED; } - =20 + =20 // // Check Point D: HeaderSize is nonzero and DestAddr is NULL. @@ -1913,7 +1839,7 @@ BBTestTransmitConformanceTest ( } else { AssertionType[5] =3D EFI_TEST_ASSERTION_FAILED; } -=20 + =20 // // Check Point E: HeaderSize is nonzero and Protocol is NULL. @@ -1935,7 +1861,7 @@ BBTestTransmitConformanceTest ( (UINTN)__LINE__, StatusBuf[0] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[1], @@ -1945,7 +1871,7 @@ BBTestTransmitConformanceTest ( __FILE__, (UINTN)__LINE__, StatusBuf[1] - ); + ); =20 StandardLib->RecordAssertion ( StandardLib, @@ -1957,7 +1883,7 @@ BBTestTransmitConformanceTest ( (UINTN)__LINE__, StatusBuf[2] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[3], @@ -1978,7 +1904,7 @@ BBTestTransmitConformanceTest ( (UINTN)__LINE__, StatusBuf[4] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[5], @@ -1989,7 +1915,7 @@ BBTestTransmitConformanceTest ( (UINTN)__LINE__, StatusBuf[5] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[6], @@ -2119,7 +2045,7 @@ BBTestReceiveConformanceTest ( } else { AssertionType[0] =3D EFI_TEST_ASSERTION_FAILED; } - =20 + =20 // // Assertion Point 5.13.2.2 @@ -2136,7 +2062,7 @@ BBTestReceiveConformanceTest ( } else { AssertionType[1] =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Assertion Point 5.13.2.3 // Call Receive() function with invalid parameters. @@ -2171,7 +2097,7 @@ BBTestReceiveConformanceTest ( (UINTN)__LINE__, StatusBuf[0] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[1], @@ -2208,22 +2134,22 @@ BBTestReceiveConformanceTest ( return Status; } } - =20 + #if 0 // // Assertion Point 5.13.2.4 // No Packet Received in the Network Interface when Receive(). // // We should disable the muticast and broadcast receive filters first. b= ecause - // some muticast or broadcast packets maybe on the LAN=20 + // some muticast or broadcast packets maybe on the LAN // Status =3D SnpInterface->ReceiveFilters ( - SnpInterface,=20 - 0,=20 - EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST | EFI_SIMPL= E_NETWORK_RECEIVE_BROADCAST,=20 - TRUE,=20 - 0,=20 - NULL); + SnpInterface, + 0, + EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST | EFI_SIMP= LE_NETWORK_RECEIVE_BROADCAST, + TRUE, + 0, + NULL); if (EFI_ERROR(Status)) { StandardLib->RecordAssertion ( StandardLib, @@ -2235,7 +2161,7 @@ BBTestReceiveConformanceTest ( (UINTN)__LINE__, Status ); - return Status; + return Status; } =20 Status =3D EFI_SUCCESS; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/Black= BoxTest/SimpleNetworkBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/P= rotocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c index 16f541ee..697a7a03 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest= /SimpleNetworkBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest= /SimpleNetworkBBTestFunction.c @@ -1,894 +1,914 @@ -/** @file - - Copyright 2006 - 2016 Unified EFI, Inc.
- Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
- - This program and the accompanying materials - are licensed and made available under the terms and conditions of the BS= D License - which accompanies this distribution. The full text of the license may b= e found at=20 - http://opensource.org/licenses/bsd-license.php -=20 - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. -=20 -**/ -/*++ - -Module Name: - - SimpleNetworkBBTestFunction.c - -Abstract: - - Basic Test Cases of SimpleNetwork Protocol - ---*/ - +/** @file + + Copyright 2006 - 2016 Unified EFI, Inc.
+ Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2022, ARM Limited. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ +/*++ + +Module Name: + + SimpleNetworkBBTestFunction.c + +Abstract: + + Basic Test Cases of SimpleNetwork Protocol + +--*/ + #include "SctLib.h" -#include "SimpleNetworkBBTestMain.h" - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Start() Function Test. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.1 -// -EFI_STATUS -BBTestStartFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status, Status1; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkStopp= ed. - // If not, change the state to EfiSimpleNetworkStopped. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkInitialized) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Assertion Point 4.1.2.1 - // Call Start() function to change the state from "Stopped" to "Started". - // - Status =3D SnpInterface->Start (SnpInterface); - if ((Status =3D=3D EFI_SUCCESS) && (SnpInterface->Mode->State =3D=3D Efi= SimpleNetworkStarted)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - // - // Restore SNP state - // - if (State1 =3D=3D EfiSimpleNetworkInitialized) { - Status1 =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status1)) { - return Status1; - } - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid001, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Start - Invoke Start() and = verify interface correctness within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Stop() Function Test. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.2 -// -EFI_STATUS -BBTestStopFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status, Status1; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkStart= ed. - // If not, change the state to EfiSimpleNetworkStarted. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkInitialized) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Assertion Point 4.2.2.1 - // Call Stop() function to change the state from "Started" to "Stopped". - // - Status =3D SnpInterface->Stop (SnpInterface); - if ((Status =3D=3D EFI_SUCCESS) && (SnpInterface->Mode->State =3D=3D Efi= SimpleNetworkStopped)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - // - // Restore SNP State - // - if (State1 !=3D EfiSimpleNetworkStopped) { - Status1 =3D SnpInterface->Start(SnpInterface); - if (EFI_ERROR(Status1)) { - return Status1; - } - } - - if (State1 =3D=3D EfiSimpleNetworkInitialized) { - Status1 =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status1)) { - return Status1; - } - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid002, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Stop - Invoke Stop() and ve= rify interface correctness within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Initialize() Function Test. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.3 -// -EFI_STATUS -BBTestInitializeFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkStart= ed. - // If not, change the state to EfiSimpleNetworkStarted. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkInitialized) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Assertion Point 4.3.2.1 - // Call Initialize() function to change the state from "Started" to "Ini= tialized". - // - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if ((Status =3D=3D EFI_SUCCESS) && (SnpInterface->Mode->State =3D=3D Efi= SimpleNetworkInitialized)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid003, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Initialize - Invoke Initial= ize() and verify interface correctness within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - - // - // Assertion Point 4.3.2.2 - // Call Initialize() function with extra Tx/Rx specified to change the s= tate from "Started" to "Initialized". - // - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - - Status =3D SnpInterface->Initialize (SnpInterface, 32, 32); - if ((Status =3D=3D EFI_UNSUPPORTED) || ((Status =3D=3D EFI_SUCCESS) && (= SnpInterface->Mode->State =3D=3D EfiSimpleNetworkInitialized))) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid004, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Initialize - Invoke Initial= ize() with extra Tx/Rx specified and verify interface correctness within te= st case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - - // - // Restore SNP State - // - if (Status =3D=3D EFI_SUCCESS) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - - if (State1 =3D=3D EfiSimpleNetworkInitialized) { - SnpInterface->Initialize (SnpInterface, 0, 0); - } - } - - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Reset() Function Test. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.4 -// -EFI_STATUS -BBTestResetFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status; - EFI_STATUS Status1; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - EFI_SIMPLE_NETWORK_MODE Mode; - UINT32 InterruptStatus; - VOID *TxBuf; - EFI_NETWORK_STATISTICS StatisticsTable1; - UINTN StatisticsSize1; - EFI_NETWORK_STATISTICS StatisticsTable2; - UINTN StatisticsSize2; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. - // If not, change the state to EfiSimpleNetworkInitialized. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Assertion Point 4.4.2.1 - // Call Reset() function with ExtendedVerification is FALSE. - // - SctSetMem (&Mode, sizeof (EFI_SIMPLE_NETWORK_MODE), 0x0); - SctCopyMem (&Mode, SnpInterface->Mode, sizeof (EFI_SIMPLE_NETWORK_MODE)); - - SctSetMem (&StatisticsTable1, sizeof (EFI_NETWORK_STATISTICS), 0x0); - StatisticsSize1 =3D sizeof (EFI_NETWORK_STATISTICS); - Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e1, &StatisticsTable1); - if (EFI_ERROR(Status)) { - return Status; - } - - Status =3D SnpInterface->Reset (SnpInterface, FALSE); - - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - if (EFI_ERROR(Status)) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - if ((Mode.State !=3D SnpInterface->Mode->State) || - (Mode.ReceiveFilterMask !=3D SnpInterface->Mode->ReceiveFilterMask) = || - (Mode.ReceiveFilterSetting !=3D SnpInterface->Mode->ReceiveFilterSet= ting) || - SctCompareMem (&(Mode.CurrentAddress), &(SnpInterface->Mode->Current= Address), sizeof (EFI_MAC_ADDRESS)) || - SctCompareMem (&(Mode.PermanentAddress), &(SnpInterface->Mode->Perma= nentAddress), sizeof (EFI_MAC_ADDRESS))) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - TxBuf =3D NULL; - Status1 =3D SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &Tx= Buf); - if (EFI_ERROR(Status1)) { - return Status1; - } - - if (SnpInterface->Mode->MediaPresent =3D=3D FALSE) { - if (InterruptStatus !=3D 0 || TxBuf !=3D NULL) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - } else { - if ((InterruptStatus & - ~( EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT | - EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT | - EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT | - EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT)) || TxBuf !=3D NULL= ) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - } - - SctSetMem (&StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS), 0x0); - StatisticsSize2 =3D sizeof (EFI_NETWORK_STATISTICS); - Status1 =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSi= ze2, &StatisticsTable2); - if (EFI_ERROR(Status1)) { - return Status1; - } - - if ((StatisticsSize1 !=3D StatisticsSize2) || - SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_NET= WORK_STATISTICS))) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid005, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Reset - Invoke Reset() with= ExtendedVerification is FALSE and verify interface correctness within test= case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - - // - // Assertion Point 4.4.2.2 - // Call Reset() function with ExtendedVerification is TRUE. - // - Status =3D SnpInterface->Reset (SnpInterface, TRUE); - if (Status =3D=3D EFI_SUCCESS) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid006, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Reset - Invoke Reset() with= ExtendedVerification is TRUE and verify interface correctness within test = case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Shutdown() Function Test. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.5 -// -EFI_STATUS -BBTestShutdownFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status, Status1; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. - // If not, change the state to EfiSimpleNetworkInitialized. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Assertion Point 4.5.2.1 - // Call Shutdown() function. - // - Status =3D SnpInterface->Shutdown (SnpInterface); - - if ((Status =3D=3D EFI_SUCCESS) && - (SnpInterface->Mode->State =3D=3D EfiSimpleNetworkStarted)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkInitialized) { - Status1 =3D SnpInterface->Initialize(SnpInterface, 0, 0); - if (EFI_ERROR(Status1)) { - return Status1; - } - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid007, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Shutdown - Invoke Shutdown(= ) and verify interface correctness within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status1 =3D SnpInterface->Stop(SnpInterface); - if (EFI_ERROR(Status1)) { - return Status1; - } - } - - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilter() Function Te= st. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.6 -// -EFI_STATUS -BBTestReceiveFilterFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - EFI_SIMPLE_NETWORK_MODE Mode; - EFI_MAC_ADDRESS MAC; - UINT32 ReceiveFilterMask; - UINT32 SupportedFilter; - UINT32 Index; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. - // If not, change the state to EfiSimpleNetworkInitialized. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // retrieve the supported bit in SnpInterface->Mode->ReceiveFilterMask - // - SupportedFilter =3D 0; - ReceiveFilterMask =3D SnpInterface->Mode->ReceiveFilterMask; - for (Index =3D 0; Index < 5; Index++) { - if ((ReceiveFilterMask & 0x00000001) =3D=3D 0x00000001) { - SupportedFilter =3D 0x00000001 << Index; - break; - } - ReceiveFilterMask =3D ReceiveFilterMask >> 1; - } - - SctSetMem (&Mode, sizeof (EFI_SIMPLE_NETWORK_MODE), 0x0); - SctCopyMem (&Mode, SnpInterface->Mode, sizeof (EFI_SIMPLE_NETWORK_MODE)); - - if (SupportedFilter !=3D 0) { - // - // Assertion Point 4.6.2.1 - // Modify multicast receive filters masks. - // - - // Check point B. Disable Specified bit. - Status =3D SnpInterface->ReceiveFilters (SnpInterface, 0, SupportedFil= ter, FALSE, 0, NULL); - - if ((Status =3D=3D EFI_SUCCESS) && - ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) =3D=3D= 0)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid008, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() to modify multicast receive filters masks(Disable Specified= bit) and verify interface correctness within test case", - L"%a:%d:Status - %r, Filter - %x", - __FILE__, - (UINTN)__LINE__, - Status, +#include "SimpleNetworkBBTestMain.h" + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Start() Function Test. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.1 +// +EFI_STATUS +BBTestStartFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status, Status1; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkStopp= ed. + // If not, change the state to EfiSimpleNetworkStopped. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkInitialized) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Assertion Point 4.1.2.1 + // Call Start() function to change the state from "Stopped" to "Started". + // + Status =3D SnpInterface->Start (SnpInterface); + if ((Status =3D=3D EFI_SUCCESS) && (SnpInterface->Mode->State =3D=3D Efi= SimpleNetworkStarted)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + // + // Restore SNP state + // + if (State1 =3D=3D EfiSimpleNetworkInitialized) { + Status1 =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status1)) { + return Status1; + } + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid001, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Start - Invoke Start() and = verify interface correctness within test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Stop() Function Test. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.2 +// +EFI_STATUS +BBTestStopFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status, Status1; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkStart= ed. + // If not, change the state to EfiSimpleNetworkStarted. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkInitialized) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Assertion Point 4.2.2.1 + // Call Stop() function to change the state from "Started" to "Stopped". + // + Status =3D SnpInterface->Stop (SnpInterface); + if ((Status =3D=3D EFI_SUCCESS) && (SnpInterface->Mode->State =3D=3D Efi= SimpleNetworkStopped)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + // + // Restore SNP State + // + if (State1 !=3D EfiSimpleNetworkStopped) { + Status1 =3D SnpInterface->Start(SnpInterface); + if (EFI_ERROR(Status1)) { + return Status1; + } + } + + if (State1 =3D=3D EfiSimpleNetworkInitialized) { + Status1 =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status1)) { + return Status1; + } + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid002, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Stop - Invoke Stop() and ve= rify interface correctness within test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Initialize() Function Test. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.3 +// +EFI_STATUS +BBTestInitializeFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkStart= ed. + // If not, change the state to EfiSimpleNetworkStarted. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkInitialized) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Assertion Point 4.3.2.1 + // Call Initialize() function to change the state from "Started" to "Ini= tialized". + // + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if ((Status =3D=3D EFI_SUCCESS) && (SnpInterface->Mode->State =3D=3D Efi= SimpleNetworkInitialized)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid003, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Initialize - Invoke Initial= ize() and verify interface correctness within test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // + // Assertion Point 4.3.2.2 + // Call Initialize() function with extra Tx/Rx specified to change the s= tate from "Started" to "Initialized". + // + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D SnpInterface->Initialize (SnpInterface, 32, 32); + if ((Status =3D=3D EFI_UNSUPPORTED) || ((Status =3D=3D EFI_SUCCESS) && (= SnpInterface->Mode->State =3D=3D EfiSimpleNetworkInitialized))) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid004, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Initialize - Invoke Initial= ize() with extra Tx/Rx specified and verify interface correctness within te= st case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + + // + // Restore SNP State + // + if (Status =3D=3D EFI_SUCCESS) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + + if (State1 =3D=3D EfiSimpleNetworkInitialized) { + SnpInterface->Initialize (SnpInterface, 0, 0); + } + } + + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Reset() Function Test. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.4 +// +EFI_STATUS +BBTestResetFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_STATUS Status1; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + EFI_SIMPLE_NETWORK_MODE Mode; + UINT32 InterruptStatus; + VOID *TxBuf; + EFI_NETWORK_STATISTICS StatisticsTable1; + UINTN StatisticsSize1; + EFI_NETWORK_STATISTICS StatisticsTable2; + UINTN StatisticsSize2; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. + // If not, change the state to EfiSimpleNetworkInitialized. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Assertion Point 4.4.2.1 + // Call Reset() function with ExtendedVerification is FALSE. + // + SctSetMem (&Mode, sizeof (EFI_SIMPLE_NETWORK_MODE), 0x0); + SctCopyMem (&Mode, SnpInterface->Mode, sizeof (EFI_SIMPLE_NETWORK_MODE)); + + SctSetMem (&StatisticsTable1, sizeof (EFI_NETWORK_STATISTICS), 0x0); + StatisticsSize1 =3D sizeof (EFI_NETWORK_STATISTICS); + Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e1, &StatisticsTable1); + if (EFI_ERROR(Status)) { + return Status; + } + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + Status =3D SnpInterface->Reset (SnpInterface, FALSE); + if (EFI_ERROR(Status)) { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + + if ((Mode.State !=3D SnpInterface->Mode->State) || + (Mode.ReceiveFilterMask !=3D SnpInterface->Mode->ReceiveFilterMask) = || + (Mode.ReceiveFilterSetting !=3D SnpInterface->Mode->ReceiveFilterSet= ting) || + SctCompareMem (&(Mode.CurrentAddress), &(SnpInterface->Mode->Current= Address), sizeof (EFI_MAC_ADDRESS)) || + SctCompareMem (&(Mode.PermanentAddress), &(SnpInterface->Mode->Perma= nentAddress), sizeof (EFI_MAC_ADDRESS))) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + TxBuf =3D NULL; + Status1 =3D SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &Tx= Buf); + if (EFI_ERROR(Status1)) { + return Status1; + } + + if (SnpInterface->Mode->MediaPresent =3D=3D FALSE) { + if (InterruptStatus !=3D 0 || TxBuf !=3D NULL) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } else { + if ((InterruptStatus & + ~( EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT | + EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT | + EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT | + EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT)) || TxBuf !=3D NULL= ) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + + SctSetMem (&StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS), 0x0); + StatisticsSize2 =3D sizeof (EFI_NETWORK_STATISTICS); + Status1 =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSi= ze2, &StatisticsTable2); + if (EFI_ERROR(Status1)) { + return Status1; + } + + if ((StatisticsSize1 !=3D StatisticsSize2) || + SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_NET= WORK_STATISTICS))) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid005, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Reset - Invoke Reset() with= ExtendedVerification is FALSE and verify interface correctness within test= case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // + // Assertion Point 4.4.2.2 + // Call Reset() function with ExtendedVerification is TRUE. + // + Status =3D SnpInterface->Reset (SnpInterface, TRUE); + if (Status =3D=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid006, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Reset - Invoke Reset() with= ExtendedVerification is TRUE and verify interface correctness within test = case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Shutdown() Function Test. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.5 +// +EFI_STATUS +BBTestShutdownFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status, Status1; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. + // If not, change the state to EfiSimpleNetworkInitialized. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Assertion Point 4.5.2.1 + // Call Shutdown() function. + // + Status =3D SnpInterface->Shutdown (SnpInterface); + + if ((Status =3D=3D EFI_SUCCESS) && + (SnpInterface->Mode->State =3D=3D EfiSimpleNetworkStarted)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkInitialized) { + Status1 =3D SnpInterface->Initialize(SnpInterface, 0, 0); + if (EFI_ERROR(Status1)) { + return Status1; + } + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid007, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Shutdown - Invoke Shutdown(= ) and verify interface correctness within test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status1 =3D SnpInterface->Stop(SnpInterface); + if (EFI_ERROR(Status1)) { + return Status1; + } + } + + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilter() Function Te= st. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.6 +// +EFI_STATUS +BBTestReceiveFilterFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + EFI_SIMPLE_NETWORK_MODE Mode; + EFI_MAC_ADDRESS MAC; + UINT32 ReceiveFilterMask; + UINT32 SupportedFilter; + UINT32 Index; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. + // If not, change the state to EfiSimpleNetworkInitialized. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // retrieve the supported bit in SnpInterface->Mode->ReceiveFilterMask + // + SupportedFilter =3D 0; + ReceiveFilterMask =3D SnpInterface->Mode->ReceiveFilterMask; + for (Index =3D 0; Index < 5; Index++) { + if ((ReceiveFilterMask & 0x00000001) =3D=3D 0x00000001) { + SupportedFilter =3D 0x00000001 << Index; + break; + } + ReceiveFilterMask =3D ReceiveFilterMask >> 1; + } + + SctSetMem (&Mode, sizeof (EFI_SIMPLE_NETWORK_MODE), 0x0); + SctCopyMem (&Mode, SnpInterface->Mode, sizeof (EFI_SIMPLE_NETWORK_MODE)); + + if (SupportedFilter !=3D 0) { + // + // Assertion Point 4.6.2.1 + // Modify multicast receive filters masks. + // + + // Check point B. Disable Specified bit. + Status =3D SnpInterface->ReceiveFilters (SnpInterface, 0, SupportedFil= ter, FALSE, 0, NULL); + if ((Status =3D=3D EFI_SUCCESS) && + ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) =3D=3D= 0)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid008, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() to modify multicast receive filters masks(Disable Specified= bit) and verify interface correctness within test case", + L"%a:%d:Status - %r, Filter - %x", + __FILE__, + (UINTN)__LINE__, + Status, (UINTN)SnpInterface->Mode->ReceiveFilterSetting - ); - - // Check point A. Enable Specified bit. - Status =3D SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter= , 0, FALSE, 0, NULL); - - if ((Status =3D=3D EFI_SUCCESS) && - ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) !=3D 0= )) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid009, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters () to modify multicast receive filters masks (Enable Specifie= d bit) and verify interface correctness within test case", - L"%a:%d:Status - %r, Filter - %x", - __FILE__, - (UINTN)__LINE__, - Status, + ); + + // Check point A. Enable Specified bit. + Status =3D SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter= , 0, FALSE, 0, NULL); + if ((Status =3D=3D EFI_SUCCESS) && + ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) !=3D 0= )) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid009, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters () to modify multicast receive filters masks (Enable Specifie= d bit) and verify interface correctness within test case", + L"%a:%d:Status - %r, Filter - %x", + __FILE__, + (UINTN)__LINE__, + Status, (UINTN)SnpInterface->Mode->ReceiveFilterSetting - ); - - // Check point C. Enable and Disable Specified bit together. - Status =3D SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter= , SupportedFilter, FALSE, 0, NULL); - - if ((Status =3D=3D EFI_SUCCESS) && - ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) =3D=3D= 0)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid010, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() to modify multicast receive filters masks(Enable and Disabl= e Specified bit together) and verify interface correctness within test case= ", - L"%a:%d:Status - %r, Filter - %x", - __FILE__, - (UINTN)__LINE__, - Status, + ); + + // Check point C. Enable and Disable Specified bit together. + Status =3D SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter= , SupportedFilter, FALSE, 0, NULL); + if ((Status =3D=3D EFI_SUCCESS) && + ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) =3D=3D= 0)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid010, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() to modify multicast receive filters masks(Enable and Disabl= e Specified bit together) and verify interface correctness within test case= ", + L"%a:%d:Status - %r, Filter - %x", + __FILE__, + (UINTN)__LINE__, + Status, (UINTN)SnpInterface->Mode->ReceiveFilterSetting - ); - } - - // - // Assertion Point 4.6.2.2 - // Modify multicast receive filters list. - // - if ((SnpInterface->Mode->ReceiveFilterMask & EFI_SIMPLE_NETWORK_RECEIVE_= MULTICAST) !=3D 0) { - SctSetMem (&MAC, sizeof (MAC), 0x00); - MAC.Addr[0] =3D 0x01; - MAC.Addr[1] =3D 0x00; - MAC.Addr[2] =3D 0x5e; - MAC.Addr[3] =3D 0x00; - MAC.Addr[4] =3D 0x00; - MAC.Addr[5] =3D 0x02; - Status =3D SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETW= ORK_RECEIVE_MULTICAST, 0, FALSE, 1, &MAC); - if ((Status =3D=3D EFI_SUCCESS) && - (SnpInterface->Mode->State =3D=3D EfiSimpleNetworkInitialized) && - (SnpInterface->Mode->MCastFilterCount =3D=3D 1) && - (!SctCompareMem (SnpInterface->Mode->MCastFilter, &MAC, sizeof (EFI_= MAC_ADDRESS)))) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else if ((Status =3D=3D EFI_INVALID_PARAMETER) && (SnpInterface->Mod= e->MaxMCastFilterCount =3D=3D 0)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid011, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() to modify multicast receive filters list and verify interfa= ce correctness within test case", - L"%a:%d:Status - %r, Filter - %x, Mask - %x, Count - %d= , Address - %x,%x,%x", - __FILE__, - (UINTN)__LINE__, - Status, + ); + } + + // + // Assertion Point 4.6.2.2 + // Modify multicast receive filters list. + // + if ((SnpInterface->Mode->ReceiveFilterMask & EFI_SIMPLE_NETWORK_RECEIVE_= MULTICAST) !=3D 0) { + SctSetMem (&MAC, sizeof (MAC), 0x00); + MAC.Addr[0] =3D 0x01; + MAC.Addr[1] =3D 0x00; + MAC.Addr[2] =3D 0x5e; + MAC.Addr[3] =3D 0x00; + MAC.Addr[4] =3D 0x00; + MAC.Addr[5] =3D 0x02; + Status =3D SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETW= ORK_RECEIVE_MULTICAST, 0, FALSE, 1, &MAC); + if ((Status =3D=3D EFI_SUCCESS) && + (SnpInterface->Mode->State =3D=3D EfiSimpleNetworkInitialized) && + (SnpInterface->Mode->MCastFilterCount =3D=3D 1) && + (!SctCompareMem (SnpInterface->Mode->MCastFilter, &MAC, sizeof (EFI_= MAC_ADDRESS)))) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else if ((Status =3D=3D EFI_INVALID_PARAMETER) && (SnpInterface->Mod= e->MaxMCastFilterCount =3D=3D 0)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid011, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() to modify multicast receive filters list and verify interfa= ce correctness within test case", + L"%a:%d:Status - %r, Filter - %x, Mask - %x, Count - %d= , Address - %x,%x,%x", + __FILE__, + (UINTN)__LINE__, + Status, (UINTN)SnpInterface->Mode->ReceiveFilterSetting, (UINTN)SnpInterface->Mode->ReceiveFilterMask, (UINTN)SnpInterface->Mode->MCastFilterCount, (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[0], (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[5], (UINTN)SnpInterface->Mode->MCastFilter[1].Addr[0] - ); - } - - // - // Assertion Point 4.6.2.3 - // Reset multicast receive filters list. - // - - Status =3D SnpInterface->ReceiveFilters (SnpInterface, 0, 0, TRUE, 0, NU= LL); - - if ((Status =3D=3D EFI_SUCCESS) && - (SnpInterface->Mode->State =3D=3D EfiSimpleNetworkInitialized) && - (SnpInterface->Mode->MCastFilterCount =3D=3D 0)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid012, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke Rec= eiveFilters() to reset multicast receive filters list and verify interface = correctness within test case", + ); + } + + // + // Assertion Point 4.6.2.3 + // Reset multicast receive filters list. + // + + Status =3D SnpInterface->ReceiveFilters (SnpInterface, 0, 0, TRUE, 0, NU= LL); + if ((Status =3D=3D EFI_SUCCESS) && + (SnpInterface->Mode->State =3D=3D EfiSimpleNetworkInitialized) && + (SnpInterface->Mode->MCastFilterCount =3D=3D 0)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid012, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke Rec= eiveFilters() to reset multicast receive filters list and verify interface = correctness within test case", L"%a:%d:Status - %r, Filter - %x, Mask - %x, Count - %d(%= d), Address - %x, %x, %x", - __FILE__, - (UINTN)__LINE__, - Status, + __FILE__, + (UINTN)__LINE__, + Status, (UINTN)SnpInterface->Mode->ReceiveFilterSetting, (UINTN)SnpInterface->Mode->ReceiveFilterMask, (UINTN)SnpInterface->Mode->MCastFilterCount, @@ -896,1654 +916,1627 @@ BBTestReceiveFilterFunctionTest ( (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[0], (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[5], (UINTN)SnpInterface->Mode->MCastFilter[1].Addr[0] - ); - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress() Function T= est. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.7 -// -EFI_STATUS -BBTestStationAddressFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status; - EFI_STATUS StatusBuf[2]; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - EFI_MAC_ADDRESS MacAddress; - INTN CheckPoint1, CheckPoint2; - EFI_MAC_ADDRESS BackMacAddress; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. - // If not, change the state to EfiSimpleNetworkInitialized. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Assertion Point 4.7.2.1 - // Call StationAddress to reset its MAC Address. - // - StatusBuf[0] =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); - CheckPoint1 =3D SctCompareMem ( - &SnpInterface->Mode->CurrentAddress, - &SnpInterface->Mode->PermanentAddress, - sizeof (EFI_MAC_ADDRESS) - ); - - // - // Assertion Point 4.7.2.2 - // Call StationAddress to modify its MAC Address. - // - SctCopyMem (&BackMacAddress, &SnpInterface->Mode->CurrentAddress, sizeof= (EFI_MAC_ADDRESS)); - - SctSetMem (&MacAddress, sizeof (EFI_MAC_ADDRESS), 0x0); - StatusBuf[1] =3D SnpInterface->StationAddress (SnpInterface, FALSE, &Mac= Address); - CheckPoint2 =3D SctCompareMem ( - &SnpInterface->Mode->CurrentAddress, - &MacAddress, - sizeof (EFI_MAC_ADDRESS) - ); - - // - // restore temperate MAC address - // - SnpInterface->StationAddress (SnpInterface, FALSE, &BackMacAddress); - - if ((StatusBuf[0] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[0] =3D=3D = EFI_UNSUPPORTED)) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"StationAddress isn't supported, Status - %r\n", - StatusBuf[0] - ); - } else { - if ((StatusBuf[0] =3D=3D EFI_SUCCESS) && - (!CheckPoint1)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid013, - L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke R= eceiveFilters() to reset its MAC Address and verify interface correctness w= ithin test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[0] - ); - } - - if ((StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[1] =3D=3D = EFI_UNSUPPORTED)) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"StationAddress isn't supported, Status - %r\n", - StatusBuf[1] - ); - } else { - if ((StatusBuf[1] =3D=3D EFI_SUCCESS) && - (!CheckPoint2)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid014, - L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke R= eceiveFilters() to modify its MAC Address and verify interface correctness = within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[1] - ); - } - - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Statistics() Function Test. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.8 -// -EFI_STATUS -BBTestStatisticsFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - EFI_NETWORK_STATISTICS StatisticsTable1; - EFI_NETWORK_STATISTICS StatisticsTable2; - UINTN StatisticsSize; - EFI_TEST_LOGGING_LIBRARY_PROTOCOL *LoggingLib; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the Logginh Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiTestLoggingLibraryGuid, - (VOID **) &LoggingLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. - // If not, change the state to EfiSimpleNetworkInitialized. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Assertion Point 4.8.2.2 - // Collect statistics information without reset the statistics. - // - StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); - SctSetMem (&StatisticsTable1, sizeof (EFI_NETWORK_STATISTICS), 0x0); - Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e, &StatisticsTable1); - StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); - SctSetMem (&StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS), 0x0); - Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e, &StatisticsTable2); - - LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(S= tatisticsTable1), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX); - LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(S= tatisticsTable2), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX); - - if ((Status =3D=3D EFI_SUCCESS) && - (!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_N= ETWORK_STATISTICS)))) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - if (Status =3D=3D EFI_UNSUPPORTED) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid015, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statist= ics() without reset the statistics and verify interface correctness within = test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - - // - // Assertion Point 4.8.2.1 - // Collect statistics information and reset the statistics. - // - SctSetMem (&StatisticsTable1, sizeof (EFI_NETWORK_STATISTICS), 0x0); - SctSetMem (&StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS), 0x0); - - // As per the UEFI specification a previous call to SnpInterface->Statis= tics - // may set the StatisticsSize greater than size of EFI_NETWORK_STATISTIC= S. - // Since StatisticsSize is an IN/OUT parameter, reset StatisticsSize to - // size of EFI_NETWORK_STATISTICS to avoid memory corruption. - StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); - Status =3D SnpInterface->Statistics (SnpInterface, TRUE, &StatisticsSize= , &StatisticsTable1); - LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(S= tatisticsTable1), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX); - - if ((Status =3D=3D EFI_SUCCESS) && - (!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_N= ETWORK_STATISTICS)))) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - if (Status =3D=3D EFI_UNSUPPORTED) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid016, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statist= ics() and reset the statistics and verify interface correctness within test= case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.MCastIpToMac() Function Tes= t. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.9 -// -EFI_STATUS -BBTestMCastIpToMacFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - EFI_IP_ADDRESS IP; - EFI_MAC_ADDRESS MAC1; - EFI_MAC_ADDRESS MAC2; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. - // If not, change the state to EfiSimpleNetworkInitialized. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Assertion Point 4.9.2.1 - // Change IPV4 to Multicast MAC - // - IP.v4.Addr[0] =3D 234; - IP.v4.Addr[1] =3D 0; - IP.v4.Addr[2] =3D 0; - IP.v4.Addr[3] =3D 1; - SctSetMem (&MAC1, sizeof (EFI_MAC_ADDRESS), 0x0); - SctSetMem (&MAC2, sizeof (EFI_MAC_ADDRESS), 0x0); - MAC2.Addr[0] =3D 0x01; - MAC2.Addr[1] =3D 0x00; - MAC2.Addr[2] =3D 0x5E; - MAC2.Addr[3] =3D 0x00; - MAC2.Addr[4] =3D 0x00; - MAC2.Addr[5] =3D 0x01; - - Status =3D SnpInterface->MCastIpToMac(SnpInterface, FALSE, &IP, &MAC1); - - // - // Do not check the MAC address, because this is based on ethernet. - // - - // if ((Status =3D=3D EFI_SUCCESS) && (!SctCompareMem (&MAC1, &MAC2, siz= eof(EFI_MAC_ADDRESS)))) { - if (Status =3D=3D EFI_SUCCESS) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid017, - L"EFI_SIMPLE_NETWORK_PROTOCOL.MCastIpToMac - Invoke MCast= IpToMac() and verify interface correctness within test case", - L"%a:%d:Status - %r, MAC address - %02x%02x%02x%02x%02x%0= 2x", - __FILE__, - (UINTN)__LINE__, - Status, + ); + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress() Function T= est. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.7 +// +EFI_STATUS +BBTestStationAddressFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_STATUS StatusBuf[2]; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + EFI_MAC_ADDRESS MacAddress; + INTN CheckPoint1, CheckPoint2; + EFI_MAC_ADDRESS BackMacAddress; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. + // If not, change the state to EfiSimpleNetworkInitialized. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Assertion Point 4.7.2.1 + // Call StationAddress to reset its MAC Address. + // + StatusBuf[0] =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); + CheckPoint1 =3D SctCompareMem ( + &SnpInterface->Mode->CurrentAddress, + &SnpInterface->Mode->PermanentAddress, + sizeof (EFI_MAC_ADDRESS) + ); + + // + // Assertion Point 4.7.2.2 + // Call StationAddress to modify its MAC Address. + // + SctCopyMem (&BackMacAddress, &SnpInterface->Mode->CurrentAddress, sizeof= (EFI_MAC_ADDRESS)); + + SctSetMem (&MacAddress, sizeof (EFI_MAC_ADDRESS), 0x0); + StatusBuf[1] =3D SnpInterface->StationAddress (SnpInterface, FALSE, &Mac= Address); + CheckPoint2 =3D SctCompareMem ( + &SnpInterface->Mode->CurrentAddress, + &MacAddress, + sizeof (EFI_MAC_ADDRESS) + ); + + // + // restore temperate MAC address + // + SnpInterface->StationAddress (SnpInterface, FALSE, &BackMacAddress); + + if ((StatusBuf[0] =3D=3D EFI_SUCCESS) && + (!CheckPoint1)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if ((StatusBuf[0] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[0] =3D= =3D EFI_UNSUPPORTED)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid013, + L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke Re= ceiveFilters() to reset its MAC Address and verify interface correctness wi= thin test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[0] + ); + + + if ((StatusBuf[1] =3D=3D EFI_SUCCESS) && + (!CheckPoint2)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if ((StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[1] =3D= =3D EFI_UNSUPPORTED)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid014, + L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke Re= ceiveFilters() to modify its MAC Address and verify interface correctness w= ithin test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[1] + ); + + + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Statistics() Function Test. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.8 +// +EFI_STATUS +BBTestStatisticsFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + EFI_NETWORK_STATISTICS StatisticsTable1; + EFI_NETWORK_STATISTICS StatisticsTable2; + UINTN StatisticsSize; + EFI_TEST_LOGGING_LIBRARY_PROTOCOL *LoggingLib; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the Logginh Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiTestLoggingLibraryGuid, + (VOID **) &LoggingLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. + // If not, change the state to EfiSimpleNetworkInitialized. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Assertion Point 4.8.2.2 + // Collect statistics information without reset the statistics. + // + StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); + SctSetMem (&StatisticsTable1, sizeof (EFI_NETWORK_STATISTICS), 0x0); + Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e, &StatisticsTable1); + StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); + SctSetMem (&StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS), 0x0); + Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e, &StatisticsTable2); + + LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(S= tatisticsTable1), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX); + LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(S= tatisticsTable2), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX); + + if ((Status =3D=3D EFI_SUCCESS) && + (!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_N= ETWORK_STATISTICS)))) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid015, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statist= ics() without reset the statistics and verify interface correctness within = test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // + // Assertion Point 4.8.2.1 + // Collect statistics information and reset the statistics. + // + SctSetMem (&StatisticsTable1, sizeof (EFI_NETWORK_STATISTICS), 0x0); + SctSetMem (&StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS), 0x0); + + // As per the UEFI specification a previous call to SnpInterface->Statis= tics + // may set the StatisticsSize greater than size of EFI_NETWORK_STATISTIC= S. + // Since StatisticsSize is an IN/OUT parameter, reset StatisticsSize to + // size of EFI_NETWORK_STATISTICS to avoid memory corruption. + StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); + Status =3D SnpInterface->Statistics (SnpInterface, TRUE, &StatisticsSize= , &StatisticsTable1); + LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(S= tatisticsTable1), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX); + + if ((Status =3D=3D EFI_SUCCESS) && + (!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_N= ETWORK_STATISTICS)))) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid016, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statist= ics() and reset the statistics and verify interface correctness within test= case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.MCastIpToMac() Function Tes= t. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.9 +// +EFI_STATUS +BBTestMCastIpToMacFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + EFI_IP_ADDRESS IP; + EFI_MAC_ADDRESS MAC1; + EFI_MAC_ADDRESS MAC2; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. + // If not, change the state to EfiSimpleNetworkInitialized. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Assertion Point 4.9.2.1 + // Change IPV4 to Multicast MAC + // + IP.v4.Addr[0] =3D 234; + IP.v4.Addr[1] =3D 0; + IP.v4.Addr[2] =3D 0; + IP.v4.Addr[3] =3D 1; + SctSetMem (&MAC1, sizeof (EFI_MAC_ADDRESS), 0x0); + SctSetMem (&MAC2, sizeof (EFI_MAC_ADDRESS), 0x0); + MAC2.Addr[0] =3D 0x01; + MAC2.Addr[1] =3D 0x00; + MAC2.Addr[2] =3D 0x5E; + MAC2.Addr[3] =3D 0x00; + MAC2.Addr[4] =3D 0x00; + MAC2.Addr[5] =3D 0x01; + + Status =3D SnpInterface->MCastIpToMac(SnpInterface, FALSE, &IP, &MAC1); + + // + // Do not check the MAC address, because this is based on ethernet. + // + + // if ((Status =3D=3D EFI_SUCCESS) && (!SctCompareMem (&MAC1, &MAC2, siz= eof(EFI_MAC_ADDRESS)))) { + if (Status =3D=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid017, + L"EFI_SIMPLE_NETWORK_PROTOCOL.MCastIpToMac - Invoke MCast= IpToMac() and verify interface correctness within test case", + L"%a:%d:Status - %r, MAC address - %02x%02x%02x%02x%02x%0= 2x", + __FILE__, + (UINTN)__LINE__, + Status, (UINTN)MAC1.Addr[0], (UINTN)MAC1.Addr[1], (UINTN)MAC1.Addr[2], (UINTN)MAC1.Addr[3], (UINTN)MAC1.Addr[4], (UINTN)MAC1.Addr[5] - ); - - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - // - // Assertion Point 4.9.2.2 - // Change IPV6 to Multicast MAC - // - - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.NVData() Function Test. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.10 -// -EFI_STATUS -BBTestNVDataFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status; - EFI_STATUS Status1; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - VOID *Buffer; - VOID *Buffer1; - VOID *Buffer2; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. - // If not, change the state to EfiSimpleNetworkInitialized. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status)) { - return Status; - } - } - - if ((SnpInterface->Mode->NvRamAccessSize =3D=3D 0) || (SnpInterface->Mod= e->NvRamSize =3D=3D 0)) { - StandardLib->RecordMessage ( - StandardLib, - EFI_VERBOSE_LEVEL_DEFAULT, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - NvRAM device is = not attached\n" - ); - return EFI_SUCCESS; - } - - Buffer =3D NULL; - Buffer1 =3D NULL; - Buffer2 =3D NULL; - Status =3D gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamS= ize, (VOID **) &Buffer); - if (EFI_ERROR(Status)) { - goto End; - } - Status =3D gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamS= ize, (VOID **) &Buffer1); - if (EFI_ERROR(Status)) { - goto End; - } - Status =3D gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamS= ize, (VOID **) &Buffer2); - if (EFI_ERROR(Status)) { - goto End; - } - - // - // Assertion Point 4.10.2.1 - // Read NVRam - // - - //Check Point A(0, n*NvRamAccessSize) - SctSetMem (Buffer, SnpInterface->Mode->NvRamSize, 0x0); - Status =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mo= de->NvRamSize, Buffer); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - Status - ); - } else { - if (Status =3D=3D EFI_SUCCESS) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid018, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = to read(0, n*NvRamAccessSize) and verify interface correctness within test = case", - L"%a:%d:Status - %r, NvRamSize - %d, NvRamAccessSize - = %d", - __FILE__, - (UINTN)__LINE__, - Status, - (UINTN)SnpInterface->Mode->NvRamSize, - (UINTN)SnpInterface->Mode->NvRamAccessSize - ); - } - - //Check Point B(NvRamAccessSize, (n-1)*NvRamAccessSize) - SctSetMem (Buffer, SnpInterface->Mode->NvRamSize, 0x0); - Status =3D SnpInterface->NvData (SnpInterface, TRUE, SnpInterface->Mode-= >NvRamAccessSize, (SnpInterface->Mode->NvRamSize - SnpInterface->Mode->NvRa= mAccessSize), Buffer); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - Status - ); - } else { - if (Status =3D=3D EFI_SUCCESS) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid019, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = to read(NvRamAccessSize, (n-1)*NvRamAccessSize) and verify interface correc= tness within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - } - - //Check Point C((n-1)*NvRamAccessSize, NvRamAccessSize) - SctSetMem (Buffer, SnpInterface->Mode->NvRamSize, 0x0); - Status =3D SnpInterface->NvData (SnpInterface, TRUE, (SnpInterface->Mode= ->NvRamSize - SnpInterface->Mode->NvRamAccessSize), SnpInterface->Mode->NvR= amAccessSize, Buffer); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - Status - ); - } else { - if (Status =3D=3D EFI_SUCCESS) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid020, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = to read((n-1)*NvRamAccessSize, NvRamAccessSize) and verify interface correc= tness within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - } - - // - // Assertion Point 4.10.2.2 - // Write NVRam - // - - SctSetMem (Buffer1, SnpInterface->Mode->NvRamSize, 0x0); - SctSetMem (Buffer2, SnpInterface->Mode->NvRamSize, 0x0); - // Save the NvData - Status1 =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->M= ode->NvRamSize, Buffer2); - if (EFI_ERROR(Status1)) { - goto End; - } - Status =3D SnpInterface->NvData (SnpInterface, FALSE, 0, SnpInterface->M= ode->NvRamSize, Buffer); - - // Read the buffer content which was written just now. - Status1 =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->M= ode->NvRamSize, Buffer1); - if (EFI_ERROR(Status1)) { - goto End; - } - - // recover the NvData - Status1 =3D SnpInterface->NvData (SnpInterface, FALSE, 0, SnpInterface->= Mode->NvRamSize, Buffer2); - if (EFI_ERROR(Status1)) { - goto End; - } - - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - Status - ); - } else { - if ((Status =3D=3D EFI_SUCCESS) && (!SctCompareMem (Buffer, Buffer1, S= npInterface->Mode->NvRamSize))) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid021, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = to write and verify interface correctness within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - } - -End: - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - gtBS->FreePool (Buffer); - gtBS->FreePool (Buffer1); - gtBS->FreePool (Buffer2); - - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus() Function Test. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.11 -// -EFI_STATUS -BBTestGetStatusFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status; - EFI_STATUS Status1; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - VOID *TxBuf; - UINT32 InterruptStatus; - EFI_STATUS StatCode; - VOID *Buffer; - UINTN HeaderSize; - UINTN BufferSize; - EFI_MAC_ADDRESS SrcAddr; - EFI_MAC_ADDRESS DestAddr; - UINT16 Protocol; - EFI_NETWORK_STATISTICS StatisticsTable; - EFI_NETWORK_STATISTICS StatisticsTable1; - UINTN StatisticsSize; - EFI_EVENT TimeoutEvent; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. - // If not, change the state to EfiSimpleNetworkInitialized. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Initialize the variables. - // - - Buffer =3D NULL; - HeaderSize =3D 0; - BufferSize =3D 0; - SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0xFF); - SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0xFF); - Protocol =3D 0; - Status =3D gtBS->AllocatePool (EfiLoaderData, 1024, (VOID **) &Buffer); - if (EFI_ERROR(Status)) { - return Status; - } - - //Need to put correct conten of a packet into the Buffer. - SctSetMem (Buffer, 1024, 0x0); - HeaderSize =3D SnpInterface->Mode->MediaHeaderSize; - BufferSize =3D 128; - StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); - - Protocol =3D 0x0806; - - // - // Get the Statistics before invoke the Transmit(); - // - SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable); - - Status =3D SnpInterface->Transmit (SnpInterface, HeaderSize, BufferSize,= Buffer, &SnpInterface->Mode->CurrentAddress, &DestAddr, &Protocol); - - // - // Wait the package to be sent - // - if (!EFI_ERROR(Status)) { - StatCode =3DgtBS->CreateEvent ( - EVT_TIMER, - TPL_CALLBACK, - (EFI_EVENT_NOTIFY) NULL, - NULL, - &TimeoutEvent - ); - if (EFI_ERROR(StatCode)) { - StandardLib->RecordAssertion ( - StandardLib, - EFI_TEST_ASSERTION_WARNING, - gTestGenericFailureGuid, - L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - CreateEvent= ", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatCode - ); - gtBS->FreePool (Buffer); - return StatCode; - } - - StatCode =3D gtBS->SetTimer ( - TimeoutEvent, - TimerRelative, - 50000); /* 5 milliseconds */ - if (EFI_ERROR(StatCode)) { - StandardLib->RecordAssertion ( - StandardLib, - EFI_TEST_ASSERTION_WARNING, - gTestGenericFailureGuid, - L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - SetTimer", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatCode - ); - gtBS->FreePool (Buffer); - return StatCode; - } - - for (;;) { - StatCode =3D SnpInterface->GetStatus (SnpInterface, &InterruptStatus= , &TxBuf); - - if (EFI_ERROR(StatCode)) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - break; - } - - if (TxBuf =3D=3D Buffer) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - break; - } - - if (!EFI_ERROR(tBS->CheckEvent (TimeoutEvent))) { - StatCode =3D EFI_TIMEOUT; - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - break; - } - } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid027, - L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - The transmitt= ed buffer should be shown up in the recycled transmit buffer", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatCode - ); - - tBS->CloseEvent (TimeoutEvent); - gtBS->FreePool (Buffer); - - } - - StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); - SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable1); - - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. - // If not, change the state to EfiSimpleNetworkInitialized. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status)) { - return Status; - } - } - - TxBuf =3D NULL; - InterruptStatus =3D 0; - - // - // Wait for the user disconnect the machine from the LAN. - // - SctPrint (L"\nPlease disconnect the machine from the LAN, press any key = within 10 seconds\n"); - SctStallForKey (10, NULL); - - // - // Assertion Point 4.11.2.1 - // Call GetStatus() - // - Status =3D SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &TxB= uf); - Status1 =3D SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &Tx= Buf); - - if (SnpInterface->Mode-> MediaPresentSupported =3D=3D TRUE) { - if (SnpInterface->Mode->MediaPresent =3D=3D FALSE) { - if ((Status1 =3D=3D EFI_SUCCESS) && (Status =3D=3D EFI_SUCCESS) && = (InterruptStatus =3D=3D 0)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - } else { - if ((Status1 =3D=3D EFI_SUCCESS) && (Status =3D=3D EFI_SUCCESS)) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - if (InterruptStatus & - ~( EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT | - EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT | - EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT | - EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT)) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid022, - L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - Invoke GetSt= atus() and verify interface correctness within test case", - L"%a:%d:Status - %r, Status1 - %r, InterruptStatus - %= d", - __FILE__, - (UINTN)__LINE__, - Status, - Status1, + ); + + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + // + // Assertion Point 4.9.2.2 + // Change IPV6 to Multicast MAC + // + + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.NVData() Function Test. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.10 +// +EFI_STATUS +BBTestNVDataFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_STATUS Status1; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + VOID *Buffer; + VOID *Buffer1; + VOID *Buffer2; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. + // If not, change the state to EfiSimpleNetworkInitialized. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status)) { + return Status; + } + } + + if ((SnpInterface->Mode->NvRamAccessSize =3D=3D 0) || (SnpInterface->Mod= e->NvRamSize =3D=3D 0)) { + StandardLib->RecordMessage ( + StandardLib, + EFI_VERBOSE_LEVEL_DEFAULT, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - NvRAM device is = not attached\n" + ); + return EFI_SUCCESS; + } + + Buffer =3D NULL; + Buffer1 =3D NULL; + Buffer2 =3D NULL; + Status =3D gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamS= ize, (VOID **) &Buffer); + if (EFI_ERROR(Status)) { + goto End; + } + Status =3D gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamS= ize, (VOID **) &Buffer1); + if (EFI_ERROR(Status)) { + goto End; + } + Status =3D gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamS= ize, (VOID **) &Buffer2); + if (EFI_ERROR(Status)) { + goto End; + } + + // + // Assertion Point 4.10.2.1 + // Read NVRam + // + + //Check Point A(0, n*NvRamAccessSize) + SctSetMem (Buffer, SnpInterface->Mode->NvRamSize, 0x0); + Status =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mo= de->NvRamSize, Buffer); + if (Status =3D=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid018, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() t= o read(0, n*NvRamAccessSize) and verify interface correctness within test c= ase", + L"%a:%d:Status - %r, NvRamSize - %d, NvRamAccessSize - %= d", + __FILE__, + (UINTN)__LINE__, + Status, + (UINTN)SnpInterface->Mode->NvRamSize, + (UINTN)SnpInterface->Mode->NvRamAccessSize + ); + + //Check Point B(NvRamAccessSize, (n-1)*NvRamAccessSize) + SctSetMem (Buffer, SnpInterface->Mode->NvRamSize, 0x0); + Status =3D SnpInterface->NvData (SnpInterface, TRUE, SnpInterface->Mode-= >NvRamAccessSize, (SnpInterface->Mode->NvRamSize - SnpInterface->Mode->NvRa= mAccessSize), Buffer); + if (Status =3D=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid019, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() t= o read(NvRamAccessSize, (n-1)*NvRamAccessSize) and verify interface correct= ness within test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + + //Check Point C((n-1)*NvRamAccessSize, NvRamAccessSize) + SctSetMem (Buffer, SnpInterface->Mode->NvRamSize, 0x0); + Status =3D SnpInterface->NvData (SnpInterface, TRUE, (SnpInterface->Mode= ->NvRamSize - SnpInterface->Mode->NvRamAccessSize), SnpInterface->Mode->NvR= amAccessSize, Buffer); + if (Status =3D=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid020, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() t= o read((n-1)*NvRamAccessSize, NvRamAccessSize) and verify interface correct= ness within test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // + // Assertion Point 4.10.2.2 + // Write NVRam + // + + SctSetMem (Buffer1, SnpInterface->Mode->NvRamSize, 0x0); + SctSetMem (Buffer2, SnpInterface->Mode->NvRamSize, 0x0); + // Save the NvData + Status1 =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->M= ode->NvRamSize, Buffer2); + if (EFI_ERROR(Status1)) { + goto End; + } + Status =3D SnpInterface->NvData (SnpInterface, FALSE, 0, SnpInterface->M= ode->NvRamSize, Buffer); + + // Read the buffer content which was written just now. + Status1 =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->M= ode->NvRamSize, Buffer1); + if (EFI_ERROR(Status1)) { + goto End; + } + + // recover the NvData + Status1 =3D SnpInterface->NvData (SnpInterface, FALSE, 0, SnpInterface->= Mode->NvRamSize, Buffer2); + if (EFI_ERROR(Status1)) { + goto End; + } + + if ((Status =3D=3D EFI_SUCCESS) && (!SctCompareMem (Buffer, Buffer1, Snp= Interface->Mode->NvRamSize))) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid021, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() t= o write and verify interface correctness within test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + +End: + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + gtBS->FreePool (Buffer); + gtBS->FreePool (Buffer1); + gtBS->FreePool (Buffer2); + + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus() Function Test. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.11 +// +EFI_STATUS +BBTestGetStatusFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_STATUS Status1; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + VOID *TxBuf; + UINT32 InterruptStatus; + EFI_STATUS StatCode; + VOID *Buffer; + UINTN HeaderSize; + UINTN BufferSize; + EFI_MAC_ADDRESS SrcAddr; + EFI_MAC_ADDRESS DestAddr; + UINT16 Protocol; + EFI_NETWORK_STATISTICS StatisticsTable; + EFI_NETWORK_STATISTICS StatisticsTable1; + UINTN StatisticsSize; + EFI_EVENT TimeoutEvent; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. + // If not, change the state to EfiSimpleNetworkInitialized. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Initialize the variables. + // + + Buffer =3D NULL; + HeaderSize =3D 0; + BufferSize =3D 0; + SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0xFF); + SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0xFF); + Protocol =3D 0; + Status =3D gtBS->AllocatePool (EfiLoaderData, 1024, (VOID **) &Buffer); + if (EFI_ERROR(Status)) { + return Status; + } + + //Need to put correct conten of a packet into the Buffer. + SctSetMem (Buffer, 1024, 0x0); + HeaderSize =3D SnpInterface->Mode->MediaHeaderSize; + BufferSize =3D 128; + StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); + + Protocol =3D 0x0806; + + // + // Get the Statistics before invoke the Transmit(); + // + SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable); + + Status =3D SnpInterface->Transmit (SnpInterface, HeaderSize, BufferSize,= Buffer, &SnpInterface->Mode->CurrentAddress, &DestAddr, &Protocol); + + // + // Wait the package to be sent + // + if (!EFI_ERROR(Status)) { + StatCode =3DgtBS->CreateEvent ( + EVT_TIMER, + TPL_CALLBACK, + (EFI_EVENT_NOTIFY) NULL, + NULL, + &TimeoutEvent + ); + if (EFI_ERROR(StatCode)) { + StandardLib->RecordAssertion ( + StandardLib, + EFI_TEST_ASSERTION_WARNING, + gTestGenericFailureGuid, + L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - CreateEvent= ", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatCode + ); + gtBS->FreePool (Buffer); + return StatCode; + } + + StatCode =3D gtBS->SetTimer ( + TimeoutEvent, + TimerRelative, + 50000); /* 5 milliseconds */ + if (EFI_ERROR(StatCode)) { + StandardLib->RecordAssertion ( + StandardLib, + EFI_TEST_ASSERTION_WARNING, + gTestGenericFailureGuid, + L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - SetTimer", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatCode + ); + gtBS->FreePool (Buffer); + return StatCode; + } + + for (;;) { + StatCode =3D SnpInterface->GetStatus (SnpInterface, &InterruptStatus= , &TxBuf); + + if (EFI_ERROR(StatCode)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + break; + } + + if (TxBuf =3D=3D Buffer) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + break; + } + + if (!EFI_ERROR(tBS->CheckEvent (TimeoutEvent))) { + StatCode =3D EFI_TIMEOUT; + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + break; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid027, + L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - The transmitt= ed buffer should be shown up in the recycled transmit buffer", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatCode + ); + + tBS->CloseEvent (TimeoutEvent); + gtBS->FreePool (Buffer); + + } + + StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); + SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable1); + + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. + // If not, change the state to EfiSimpleNetworkInitialized. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status)) { + return Status; + } + } + + TxBuf =3D NULL; + InterruptStatus =3D 0; + + // + // Wait for the user disconnect the machine from the LAN. + // + SctPrint (L"\nPlease disconnect the machine from the LAN, press any key = within 10 seconds\n"); + SctStallForKey (10, NULL); + + // + // Assertion Point 4.11.2.1 + // Call GetStatus() + // + Status =3D SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &TxB= uf); + Status1 =3D SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &Tx= Buf); + + if (SnpInterface->Mode-> MediaPresentSupported =3D=3D TRUE) { + if (SnpInterface->Mode->MediaPresent =3D=3D FALSE) { + if ((Status1 =3D=3D EFI_SUCCESS) && (Status =3D=3D EFI_SUCCESS) && = (InterruptStatus =3D=3D 0)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } else { + if ((Status1 =3D=3D EFI_SUCCESS) && (Status =3D=3D EFI_SUCCESS)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (InterruptStatus & + ~( EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT | + EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT | + EFI_SIMPLE_NETWORK_COMMAND_INTERRUPT | + EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT)) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid022, + L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - Invoke GetSt= atus() and verify interface correctness within test case", + L"%a:%d:Status - %r, Status1 - %r, InterruptStatus - %= d", + __FILE__, + (UINTN)__LINE__, + Status, + Status1, (UINTN)InterruptStatus - ); - } - - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - SctPrint (L"\nNow the machine can be reconnected to the LAN, press any k= ey within 10 seconds\n"); - SctStallForKey (10, NULL); - - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Transmit() Function Test. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.12 -// -EFI_STATUS -BBTestTransmitFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status; - EFI_STATUS StatCode; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - EFI_TEST_LOGGING_LIBRARY_PROTOCOL *LoggingLib; - VOID *Buffer; - UINTN HeaderSize; - UINTN BufferSize; - EFI_MAC_ADDRESS SrcAddr; - EFI_MAC_ADDRESS DestAddr; - UINT16 Protocol; - EFI_NETWORK_STATISTICS StatisticsTable; - EFI_NETWORK_STATISTICS StatisticsTable1; - UINTN StatisticsSize; - UINTN WaitIndex; - EFI_INPUT_KEY Key; - EFI_EVENT TimeoutEvent; - UINT32 IntStatus; - VOID *TxBuf; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the Logginh Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiTestLoggingLibraryGuid, - (VOID **) &LoggingLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. - // If not, change the state to EfiSimpleNetworkInitialized. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Initialize the variables. - // - - Buffer =3D NULL; - HeaderSize =3D 0; - BufferSize =3D 0; - SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0xFF); - SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0xFF); - Protocol =3D 0; - Status =3D gtBS->AllocatePool (EfiLoaderData, 1024, (VOID **) &Buffer); - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Assertion Point 4.12.2.2 - // Call Transmit() with HeaderSize !=3D 0 - // - - //Need to put correct conten of a packet into the Buffer. - SctSetMem (Buffer, 1024, 0x0); - HeaderSize =3D SnpInterface->Mode->MediaHeaderSize; - BufferSize =3D 128; - StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); - - Protocol =3D 0x0806; - - // - // Get the Statistics before invoke the Transmit(); - // - SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable); - - Status =3D SnpInterface->Transmit (SnpInterface, HeaderSize, BufferSize,= Buffer, &SnpInterface->Mode->CurrentAddress, &DestAddr, &Protocol); - - // - // Wait the package to be sent - // - if (!EFI_ERROR(Status)) { - StatCode =3DgtBS->CreateEvent ( - EVT_TIMER, - TPL_CALLBACK, - (EFI_EVENT_NOTIFY) NULL, - NULL, - &TimeoutEvent - ); - if (EFI_ERROR(StatCode)) { - StandardLib->RecordAssertion ( - StandardLib, - EFI_TEST_ASSERTION_WARNING, - gTestGenericFailureGuid, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - CreateEvent", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatCode - ); - gtBS->FreePool (Buffer); - return StatCode; - } - - StatCode =3D gtBS->SetTimer ( - TimeoutEvent, - TimerRelative, - 50000); /* 5 milliseconds */ - if (EFI_ERROR(StatCode)) { - StandardLib->RecordAssertion ( - StandardLib, - EFI_TEST_ASSERTION_WARNING, - gTestGenericFailureGuid, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - SetTimer", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatCode - ); - gtBS->FreePool (Buffer); - return StatCode; - } - - for (;;) { - StatCode =3D SnpInterface->GetStatus (SnpInterface, &IntStatus, &TxB= uf); - - if (EFI_ERROR(StatCode)) { - StandardLib->RecordAssertion ( - StandardLib, - EFI_TEST_ASSERTION_FAILED, - gTestGenericFailureGuid, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - GetStatus", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatCode - ); - gtBS->FreePool (Buffer); - gtBS->CloseEvent (TimeoutEvent); - return StatCode; - } - - if (TxBuf =3D=3D Buffer) { - break; - } - - if (!EFI_ERROR(gtBS->CheckEvent (TimeoutEvent))) { - StatCode =3D EFI_TIMEOUT; - StandardLib->RecordAssertion ( - StandardLib, - EFI_TEST_ASSERTION_FAILED, - gTestGenericFailureGuid, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - Time out", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatCode - ); - gtBS->FreePool (Buffer); - gtBS->CloseEvent (TimeoutEvent); - return StatCode; - } - } - - gtBS->CloseEvent (TimeoutEvent); - } - - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - if (EFI_ERROR(Status) || SnpInterface->Mode->State !=3D EfiSimpleNetwork= Initialized) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); - SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable1); - - // - // Verify the functionality manually. - // - SctPrint (L"Please verify whether the packet is captured by the sniffert= , right press \"Y\", wrong press \"N\""); - - // - // Get the input key. - // - while (1) - { - gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex); - gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key); - if ((Key.UnicodeChar =3D=3D L'Y') || (Key.UnicodeChar =3D=3D L'y') || = (Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { - break; - } - else { - SctPrint (L"Please press \"Y\" or \"N\"\n"); - } - } - if ((Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid024, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - Invoke Transmit(= ) with HeaderSize !=3D 0 and verify interface correctness within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - gtBS->FreePool (Buffer); - - return EFI_SUCCESS; -} - -/** - * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Receive() Function Test. - * @param This a pointer of EFI_BB_TEST_PROTOCOL. - * @param ClientInterface a pointer to the interface to be tested. - * @param TestLevel test "thoroughness" control. - * @param SupportHandle a handle containing protocols required. - * @return EFI_SUCCESS Finish the test successfully. - */ -// -// TDS 4.13 -// -EFI_STATUS -BBTestReceiveFunctionTest ( - IN EFI_BB_TEST_PROTOCOL *This, - IN VOID *ClientInterface, - IN EFI_TEST_LEVEL TestLevel, - IN EFI_HANDLE SupportHandle - ) -{ - EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_STATUS Status; - EFI_TEST_ASSERTION AssertionType; - EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; - EFI_SIMPLE_NETWORK_STATE State1, State2; - EFI_TEST_LOGGING_LIBRARY_PROTOCOL *LoggingLib; - VOID *Buffer; - UINTN HeaderSize; - UINTN BufferSize; - EFI_MAC_ADDRESS SrcAddr; - EFI_MAC_ADDRESS DestAddr; - UINT16 Protocol; - EFI_NETWORK_STATISTICS StatisticsTable; - EFI_NETWORK_STATISTICS StatisticsTable1; - UINTN StatisticsSize; - UINTN WaitIndex; - EFI_INPUT_KEY Key; - - // - // Get the Standard Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiStandardTestLibraryGuid, - (VOID **) &StandardLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the Logginh Library Interface - // - Status =3D gtBS->HandleProtocol ( - SupportHandle, - &gEfiTestLoggingLibraryGuid, - (VOID **) &LoggingLib - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - // - // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested - // - SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; - - // - // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. - // If not, change the state to EfiSimpleNetworkInitialized. - // - State1 =3D SnpInterface->Mode->State; - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Start (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - State2 =3D SnpInterface->Mode->State; - if (State2 =3D=3D EfiSimpleNetworkStarted) { - Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); - if (EFI_ERROR(Status)) { - return Status; - } - } - - // - // Enable receive filters - // - Status =3D SnpInterface->ReceiveFilters ( - SnpInterface, - EFI_SIMPLE_NETWORK_RECEIVE_UNICAST|EFI_SIMPLE_N= ETWORK_RECEIVE_BROADCAST, - 0, - FALSE, - 0, - NULL - ); - if (EFI_ERROR(Status)) { - StandardLib->RecordAssertion ( - StandardLib, - EFI_TEST_ASSERTION_FAILED, - gTestGenericFailureGuid, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Receive - Enable ReceiveF= ilters", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - return Status; - } - - // - // Initialize the variables. - // - - Buffer =3D NULL; - HeaderSize =3D 0; - BufferSize =3D 0; - SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0x0); - SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0x0); - Protocol =3D 0; - Status =3D gtBS->AllocatePool (EfiLoaderData, 1024, (VOID **) &Buffer); - if (EFI_ERROR(Status)) { - return Status; - } - - SctSetMem (Buffer, 1024, 0x0); - StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); - - // - // Get the Statistics before invoke the Receive(); - // - SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable); - - // - // Wait for the host send the packet. - // - SctPrint (L"\nWait for the host send, yes press \"Y\", no press \"N\"\n"= ); - - // - // Get the input key. - // - while (1) - { - gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex); - gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key); - if ((Key.UnicodeChar =3D=3D L'Y') || (Key.UnicodeChar =3D=3D L'y') || = (Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { - break; - } - else { - SctPrint (L"Please press \"Y\" or \"N\""); - } - } - - // - // BufferSize is smaller than the received Packets. - // - BufferSize =3D 0; - Status =3D SnpInterface->Receive (SnpInterface, 0, &BufferSize, Buffer, = NULL, NULL, 0); - if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid041, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Receive - Invoke Receive() = with BufferSize is smaller than the received Packets.", - L"%a:%d:Status - %r, BufferSize Needed - %d", - __FILE__, - (UINTN)__LINE__, - Status, - BufferSize - ); - - // - // Assertion Point 4.13.2.1 - // Call Receive() with all optional NULL - // - BufferSize =3D 1024; - Status =3D SnpInterface->Receive (SnpInterface, 0, &BufferSize, Buffer, = NULL, NULL, 0); - - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - if (EFI_ERROR(Status) || SnpInterface->Mode->State !=3D EfiSimpleNetwork= Initialized) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); - SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable1); - - // - // Verify the functionality manually. - // - LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)Buf= fer, (UINT32)BufferSize/2, EFI_DUMP_HEX); - SctPrint (L"Please verify whether the received packet is right?\nRight p= ress \"Y\", wrong press \"N\"\n"); - - // - // Get the input key. - // - while (1) - { - gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex); - gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key); - if ((Key.UnicodeChar =3D=3D L'Y') || (Key.UnicodeChar =3D=3D L'y') || = (Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { - break; - } - else { - SctPrint (L"Please press \"Y\" or \"N\""); - } - } - if ((Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid025, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Receive - Invoke Receive() = with all optional NULL and verify interface correctness within test case", - L"%a:%d:Status - %r, Received Buffer Size - %d", - __FILE__, - (UINTN)__LINE__, - Status, - BufferSize - ); - - // - // Assertion Point 4.13.2.2 - // Call Receive() with all optional parameters - // - - SctSetMem (Buffer, 1024, 0x0); - BufferSize =3D 1024; - StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); - - // - // Get the Statistics before invoke the Receive(); - // - SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable); - - // - // Wait for the host send the packet. - // - SctPrint (L"Wait for the host send, yes press \"Y\", no press \"N\""); - - // - // Get the input key. - // - while (1) { - gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex); - gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key); - if ((Key.UnicodeChar =3D=3D L'Y') || (Key.UnicodeChar =3D=3D L'y') || = (Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { - break; - } - else { - SctPrint (L"Please press \"Y\" or \"N\""); - } - } - Status =3D SnpInterface->Receive (SnpInterface, &HeaderSize, &BufferSize= , Buffer, &SrcAddr, &DestAddr, &Protocol); - - AssertionType =3D EFI_TEST_ASSERTION_PASSED; - if (EFI_ERROR(Status) || SnpInterface->Mode->State !=3D EfiSimpleNetwork= Initialized) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); - SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable1); - - // - // Verify the functionality manually. - // - LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)Buf= fer, (UINT32)BufferSize/2, EFI_DUMP_HEX); - LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&Sr= cAddr, sizeof (EFI_MAC_ADDRESS)/2, EFI_DUMP_HEX); - LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&De= stAddr, sizeof (EFI_MAC_ADDRESS)/2, EFI_DUMP_HEX); - LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&Pr= otocol, sizeof (UINT16)/2, EFI_DUMP_HEX); - SctPrint (L"Please verify whether the received packet is right?\nRight p= ress \"Y\", wrong press \"N\"\n"); - - // - // Get the input key. - // - while (1) { - gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex); - gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key); - if ((Key.UnicodeChar =3D=3D L'Y') || (Key.UnicodeChar =3D=3D L'y') || = (Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { - break; - } - else { - SctPrint (L"Please press \"Y\" or \"N\""); - } - } - if ((Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid026, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Receive - Invoke Receive() = with all optional parameters and verify interface correctness within test c= ase", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); - // - // Restore SNP State - // - if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Shutdown (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - - Status =3D SnpInterface->Stop (SnpInterface); - if (EFI_ERROR(Status)) { - return Status; - } - } - - return EFI_SUCCESS; -} - + ); + } + + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + SctPrint (L"\nNow the machine can be reconnected to the LAN, press any k= ey within 10 seconds\n"); + SctStallForKey (10, NULL); + + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Transmit() Function Test. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.12 +// +EFI_STATUS +BBTestTransmitFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_STATUS StatCode; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + EFI_TEST_LOGGING_LIBRARY_PROTOCOL *LoggingLib; + VOID *Buffer; + UINTN HeaderSize; + UINTN BufferSize; + EFI_MAC_ADDRESS SrcAddr; + EFI_MAC_ADDRESS DestAddr; + UINT16 Protocol; + EFI_NETWORK_STATISTICS StatisticsTable; + EFI_NETWORK_STATISTICS StatisticsTable1; + UINTN StatisticsSize; + UINTN WaitIndex; + EFI_INPUT_KEY Key; + EFI_EVENT TimeoutEvent; + UINT32 IntStatus; + VOID *TxBuf; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the Logginh Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiTestLoggingLibraryGuid, + (VOID **) &LoggingLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. + // If not, change the state to EfiSimpleNetworkInitialized. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Initialize the variables. + // + + Buffer =3D NULL; + HeaderSize =3D 0; + BufferSize =3D 0; + SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0xFF); + SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0xFF); + Protocol =3D 0; + Status =3D gtBS->AllocatePool (EfiLoaderData, 1024, (VOID **) &Buffer); + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Assertion Point 4.12.2.2 + // Call Transmit() with HeaderSize !=3D 0 + // + + //Need to put correct conten of a packet into the Buffer. + SctSetMem (Buffer, 1024, 0x0); + HeaderSize =3D SnpInterface->Mode->MediaHeaderSize; + BufferSize =3D 128; + StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); + + Protocol =3D 0x0806; + + // + // Get the Statistics before invoke the Transmit(); + // + SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable); + + Status =3D SnpInterface->Transmit (SnpInterface, HeaderSize, BufferSize,= Buffer, &SnpInterface->Mode->CurrentAddress, &DestAddr, &Protocol); + + // + // Wait the package to be sent + // + if (!EFI_ERROR(Status)) { + StatCode =3DgtBS->CreateEvent ( + EVT_TIMER, + TPL_CALLBACK, + (EFI_EVENT_NOTIFY) NULL, + NULL, + &TimeoutEvent + ); + if (EFI_ERROR(StatCode)) { + StandardLib->RecordAssertion ( + StandardLib, + EFI_TEST_ASSERTION_WARNING, + gTestGenericFailureGuid, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - CreateEvent", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatCode + ); + gtBS->FreePool (Buffer); + return StatCode; + } + + StatCode =3D gtBS->SetTimer ( + TimeoutEvent, + TimerRelative, + 50000); /* 5 milliseconds */ + if (EFI_ERROR(StatCode)) { + StandardLib->RecordAssertion ( + StandardLib, + EFI_TEST_ASSERTION_WARNING, + gTestGenericFailureGuid, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - SetTimer", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatCode + ); + gtBS->FreePool (Buffer); + return StatCode; + } + + for (;;) { + StatCode =3D SnpInterface->GetStatus (SnpInterface, &IntStatus, &TxB= uf); + + if (EFI_ERROR(StatCode)) { + StandardLib->RecordAssertion ( + StandardLib, + EFI_TEST_ASSERTION_FAILED, + gTestGenericFailureGuid, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - GetStatus", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatCode + ); + gtBS->FreePool (Buffer); + gtBS->CloseEvent (TimeoutEvent); + return StatCode; + } + + if (TxBuf =3D=3D Buffer) { + break; + } + + if (!EFI_ERROR(gtBS->CheckEvent (TimeoutEvent))) { + StatCode =3D EFI_TIMEOUT; + StandardLib->RecordAssertion ( + StandardLib, + EFI_TEST_ASSERTION_FAILED, + gTestGenericFailureGuid, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - Time out", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatCode + ); + gtBS->FreePool (Buffer); + gtBS->CloseEvent (TimeoutEvent); + return StatCode; + } + } + + gtBS->CloseEvent (TimeoutEvent); + } + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (EFI_ERROR(Status) || SnpInterface->Mode->State !=3D EfiSimpleNetwork= Initialized) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); + SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable1); + + // + // Verify the functionality manually. + // + SctPrint (L"Please verify whether the packet is captured by the sniffert= , right press \"Y\", wrong press \"N\""); + + // + // Get the input key. + // + while (1) + { + gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex); + gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key); + if ((Key.UnicodeChar =3D=3D L'Y') || (Key.UnicodeChar =3D=3D L'y') || = (Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { + break; + } + else { + SctPrint (L"Please press \"Y\" or \"N\"\n"); + } + } + if ((Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid024, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - Invoke Transmit(= ) with HeaderSize !=3D 0 and verify interface correctness within test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + gtBS->FreePool (Buffer); + + return EFI_SUCCESS; +} + +/** + * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.Receive() Function Test. + * @param This a pointer of EFI_BB_TEST_PROTOCOL. + * @param ClientInterface a pointer to the interface to be tested. + * @param TestLevel test "thoroughness" control. + * @param SupportHandle a handle containing protocols required. + * @return EFI_SUCCESS Finish the test successfully. + */ +// +// TDS 4.13 +// +EFI_STATUS +BBTestReceiveFunctionTest ( + IN EFI_BB_TEST_PROTOCOL *This, + IN VOID *ClientInterface, + IN EFI_TEST_LEVEL TestLevel, + IN EFI_HANDLE SupportHandle + ) +{ + EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; + EFI_STATUS Status; + EFI_TEST_ASSERTION AssertionType; + EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_SIMPLE_NETWORK_STATE State1, State2; + EFI_TEST_LOGGING_LIBRARY_PROTOCOL *LoggingLib; + VOID *Buffer; + UINTN HeaderSize; + UINTN BufferSize; + EFI_MAC_ADDRESS SrcAddr; + EFI_MAC_ADDRESS DestAddr; + UINT16 Protocol; + EFI_NETWORK_STATISTICS StatisticsTable; + EFI_NETWORK_STATISTICS StatisticsTable1; + UINTN StatisticsSize; + UINTN WaitIndex; + EFI_INPUT_KEY Key; + + // + // Get the Standard Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiStandardTestLibraryGuid, + (VOID **) &StandardLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the Logginh Library Interface + // + Status =3D gtBS->HandleProtocol ( + SupportHandle, + &gEfiTestLoggingLibraryGuid, + (VOID **) &LoggingLib + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + // + // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested + // + SnpInterface =3D (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface; + + // + // Check whether the state of network interface is EfiSimpleNetworkIniti= alized. + // If not, change the state to EfiSimpleNetworkInitialized. + // + State1 =3D SnpInterface->Mode->State; + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Start (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + State2 =3D SnpInterface->Mode->State; + if (State2 =3D=3D EfiSimpleNetworkStarted) { + Status =3D SnpInterface->Initialize (SnpInterface, 0, 0); + if (EFI_ERROR(Status)) { + return Status; + } + } + + // + // Enable receive filters + // + Status =3D SnpInterface->ReceiveFilters ( + SnpInterface, + EFI_SIMPLE_NETWORK_RECEIVE_UNICAST|EFI_SIMPLE_N= ETWORK_RECEIVE_BROADCAST, + 0, + FALSE, + 0, + NULL + ); + if (EFI_ERROR(Status)) { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gTestGenericFailureGuid, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Receive - Enable ReceiveF= ilters", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + return Status; + } + + // + // Initialize the variables. + // + + Buffer =3D NULL; + HeaderSize =3D 0; + BufferSize =3D 0; + SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0x0); + SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0x0); + Protocol =3D 0; + Status =3D gtBS->AllocatePool (EfiLoaderData, 1024, (VOID **) &Buffer); + if (EFI_ERROR(Status)) { + return Status; + } + + SctSetMem (Buffer, 1024, 0x0); + StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); + + // + // Get the Statistics before invoke the Receive(); + // + SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable); + + // + // Wait for the host send the packet. + // + SctPrint (L"\nWait for the host send, yes press \"Y\", no press \"N\"\n"= ); + + // + // Get the input key. + // + while (1) + { + gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex); + gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key); + if ((Key.UnicodeChar =3D=3D L'Y') || (Key.UnicodeChar =3D=3D L'y') || = (Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { + break; + } + else { + SctPrint (L"Please press \"Y\" or \"N\""); + } + } + + // + // BufferSize is smaller than the received Packets. + // + BufferSize =3D 0; + Status =3D SnpInterface->Receive (SnpInterface, 0, &BufferSize, Buffer, = NULL, NULL, 0); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid041, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Receive - Invoke Receive() = with BufferSize is smaller than the received Packets.", + L"%a:%d:Status - %r, BufferSize Needed - %d", + __FILE__, + (UINTN)__LINE__, + Status, + BufferSize + ); + + // + // Assertion Point 4.13.2.1 + // Call Receive() with all optional NULL + // + BufferSize =3D 1024; + Status =3D SnpInterface->Receive (SnpInterface, 0, &BufferSize, Buffer, = NULL, NULL, 0); + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (EFI_ERROR(Status) || SnpInterface->Mode->State !=3D EfiSimpleNetwork= Initialized) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); + SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable1); + + // + // Verify the functionality manually. + // + LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)Buf= fer, (UINT32)BufferSize/2, EFI_DUMP_HEX); + SctPrint (L"Please verify whether the received packet is right?\nRight p= ress \"Y\", wrong press \"N\"\n"); + + // + // Get the input key. + // + while (1) + { + gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex); + gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key); + if ((Key.UnicodeChar =3D=3D L'Y') || (Key.UnicodeChar =3D=3D L'y') || = (Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { + break; + } + else { + SctPrint (L"Please press \"Y\" or \"N\""); + } + } + if ((Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid025, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Receive - Invoke Receive() = with all optional NULL and verify interface correctness within test case", + L"%a:%d:Status - %r, Received Buffer Size - %d", + __FILE__, + (UINTN)__LINE__, + Status, + BufferSize + ); + + // + // Assertion Point 4.13.2.2 + // Call Receive() with all optional parameters + // + + SctSetMem (Buffer, 1024, 0x0); + BufferSize =3D 1024; + StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); + + // + // Get the Statistics before invoke the Receive(); + // + SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable); + + // + // Wait for the host send the packet. + // + SctPrint (L"Wait for the host send, yes press \"Y\", no press \"N\""); + + // + // Get the input key. + // + while (1) { + gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex); + gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key); + if ((Key.UnicodeChar =3D=3D L'Y') || (Key.UnicodeChar =3D=3D L'y') || = (Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { + break; + } + else { + SctPrint (L"Please press \"Y\" or \"N\""); + } + } + Status =3D SnpInterface->Receive (SnpInterface, &HeaderSize, &BufferSize= , Buffer, &SrcAddr, &DestAddr, &Protocol); + + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (EFI_ERROR(Status) || SnpInterface->Mode->State !=3D EfiSimpleNetwork= Initialized) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + StatisticsSize =3D sizeof (EFI_NETWORK_STATISTICS); + SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &Statist= icsTable1); + + // + // Verify the functionality manually. + // + LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)Buf= fer, (UINT32)BufferSize/2, EFI_DUMP_HEX); + LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&Sr= cAddr, sizeof (EFI_MAC_ADDRESS)/2, EFI_DUMP_HEX); + LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&De= stAddr, sizeof (EFI_MAC_ADDRESS)/2, EFI_DUMP_HEX); + LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&Pr= otocol, sizeof (UINT16)/2, EFI_DUMP_HEX); + SctPrint (L"Please verify whether the received packet is right?\nRight p= ress \"Y\", wrong press \"N\"\n"); + + // + // Get the input key. + // + while (1) { + gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex); + gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key); + if ((Key.UnicodeChar =3D=3D L'Y') || (Key.UnicodeChar =3D=3D L'y') || = (Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { + break; + } + else { + SctPrint (L"Please press \"Y\" or \"N\""); + } + } + if ((Key.UnicodeChar =3D=3D L'N') || (Key.UnicodeChar =3D=3D L'n')) { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid026, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Receive - Invoke Receive() = with all optional parameters and verify interface correctness within test c= ase", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + // + // Restore SNP State + // + if (State1 =3D=3D EfiSimpleNetworkStopped) { + Status =3D SnpInterface->Shutdown (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D SnpInterface->Stop (SnpInterface); + if (EFI_ERROR(Status)) { + return Status; + } + } + + return EFI_SUCCESS; +} + diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/PxeBaseCode/BlackBo= xTest/PxeBaseCodeBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Proto= col/PxeBaseCode/BlackBoxTest/PxeBaseCodeBBTestFunction.c index b9692461..ce945f19 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/PxeBaseCode/BlackBoxTest/P= xeBaseCodeBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/PxeBaseCode/BlackBoxTest/P= xeBaseCodeBBTestFunction.c @@ -2,15 +2,16 @@ =20 Copyright 2006 - 2016 Unified EFI, Inc.
Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2022, ARM Limited. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License - which accompanies this distribution. The full text of the license may b= e found at=20 + which accompanies this distribution. The full text of the license may b= e found at http://opensource.org/licenses/bsd-license.php -=20 + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. -=20 + **/ /*++ =20 @@ -24,7 +25,7 @@ Abstract: =20 --*/ =20 -#include "SctLib.h" +#include "SctLib.h" #include "PxeBaseCodeBBTestMain.h" #include "PxeBaseCodeBBTestSupport.h" =20 @@ -203,7 +204,7 @@ BBTestUdpReadFuncSrcPortFilter ( =20 /** * Entrypoint for EFI_PXE_BASE_CODE_PROTOCOL.Start() Function Test. - * It is the new case to add IPv6 into the test scope. The original test = case is switched off.=20 + * It is the new case to add IPv6 into the test scope. The original test = case is switched off. * @param This a pointer of EFI_BB_TEST_PROTOCOL. * @param ClientInterface a pointer to the interface to be tested. * @param TestLevel test "thoroughness" control. @@ -380,7 +381,7 @@ BBTestNewStartFunctionTest ( L"Mode->PxeBisReplyReceived - %s\r\n", BcInterface->Mode->PxeBisReplyReceived ? L"TRUE" : L"= FALSE" ); - } =20 + } if (BcInterface->Mode->IcmpErrorReceived !=3D FALSE) { AssertionType =3D EFI_TEST_ASSERTION_FAILED; StandardLib->RecordMessage ( @@ -605,7 +606,7 @@ BBTestNewStartFunctionTest ( return Status; } } - =20 + // // Enable EFI_PXE_BASE_CODE_PROTOCOL Protocol interface in IPv6 // @@ -627,8 +628,8 @@ BBTestNewStartFunctionTest ( (UINTN)__LINE__, Status ); - =20 - =20 + + if (AssertionType =3D=3D EFI_TEST_ASSERTION_PASSED) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; if (BcInterface->Mode->Started !=3D TRUE) { @@ -720,7 +721,7 @@ BBTestNewStartFunctionTest ( L"Mode->PxeBisReplyReceived - %s\r\n", BcInterface->Mode->PxeBisReplyReceived ? L"TRUE" : = L"FALSE" ); - } =20 + } if (BcInterface->Mode->IcmpErrorReceived !=3D FALSE) { AssertionType =3D EFI_TEST_ASSERTION_FAILED; StandardLib->RecordMessage ( @@ -797,7 +798,7 @@ BBTestNewStartFunctionTest ( L"IS_PXE_PACKET_ZEROED(Mode->ProxyOffer) - Fail\r\n" ); } - =20 + if (IS_PXE_PACKET_ZEROED(&BcInterface->Mode->PxeDiscover) =3D=3D FAL= SE) { AssertionType =3D EFI_TEST_ASSERTION_FAILED; StandardLib->RecordMessage ( @@ -944,13 +945,13 @@ BBTestNewStartFunctionTest ( ); } } - =20 + return Status; } =20 /** * Entrypoint for EFI_PXE_BASE_CODE_PROTOCOL.Statistics() Function Test. - * It is the new case to add IPv6 into the test scope. The original test = case is switched off.=20 + * It is the new case to add IPv6 into the test scope. The original test = case is switched off. * @param This a pointer of EFI_BB_TEST_PROTOCOL. * @param ClientInterface a pointer to the interface to be tested. * @param TestLevel test "thoroughness" control. @@ -974,7 +975,7 @@ BBTestNewSetIpFilterFunctionTest ( UINT8 Index; =20 Index =3D 0; - =20 + // // Get the Standard Library Interface // @@ -1091,7 +1092,7 @@ BBTestNewSetIpFilterFunctionTest ( return Status; } } - =20 + // // Enable EFI_PXE_BASE_CODE_PROTOCOL Protocol interface in IPv6 // @@ -1109,16 +1110,16 @@ BBTestNewSetIpFilterFunctionTest ( ); return Status; } - =20 + SctSetMem (&BcIpFilter, sizeof (BcIpFilter), 0); BcIpFilter.Filters =3D EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP; BcIpFilter.IpCnt =3D 2; - =20 + for (Index =3D 0; Index < 16; Index++) { BcIpFilter.IpList[0].v6.Addr[Index] =3D Index; BcIpFilter.IpList[1].v6.Addr[Index] =3D 16 - Index; } - =20 + Status =3D BcInterface->SetIpFilter (BcInterface, &BcIpFilter); if (Status =3D=3D EFI_SUCCESS) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; @@ -1135,7 +1136,7 @@ BBTestNewSetIpFilterFunctionTest ( (UINTN)__LINE__, Status ); - =20 + if (TRUE =3D=3D IsIpFilterEqual (&BcIpFilter, &(BcInterface->Mode->IpF= ilter))){ AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { @@ -1158,7 +1159,7 @@ BBTestNewSetIpFilterFunctionTest ( =20 /** * Entrypoint for EFI_PXE_BASE_CODE_PROTOCOL.Stop() Function Test. - * It is the new case to add IPv6 into the test scope. The original test = case is switched off.=20 + * It is the new case to add IPv6 into the test scope. The original test = case is switched off. * @param This a pointer of EFI_BB_TEST_PROTOCOL. * @param ClientInterface a pointer to the interface to be tested. * @param TestLevel test "thoroughness" control. @@ -1252,7 +1253,7 @@ BBTestNewStopFunctionTest ( __FILE__, (UINTN)__LINE__, Status - ); + ); } =20 // @@ -1290,7 +1291,7 @@ BBTestNewStopFunctionTest ( __FILE__, (UINTN)__LINE__, Status - ); =20 + ); =20 return Status; } @@ -1607,8 +1608,8 @@ BBTestStartFunctionTest ( ); } if ((0 !=3D BcInterface->Mode->IpFilter.Filters) || (0 !=3D BcInterface= ->Mode->IpFilter.IpCnt)) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - StandardLib->RecordMessage ( + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + StandardLib->RecordMessage ( StandardLib, EFI_VERBOSE_LEVEL_DEFAULT, L"The Mode->IpFilter.Filters or Mode->IpFilter.IpCnt fi= eld is not 0\r\n"); @@ -2025,14 +2026,14 @@ BBTestMtftpFunctionTest ( ) { EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_TEST_PROFILE_LIBRARY_PROTOCOL *ProfileLib; + EFI_TEST_PROFILE_LIBRARY_PROTOCOL *ProfileLib; EFI_TEST_LOGGING_LIBRARY_PROTOCOL *LoggingLib; EFI_INI_FILE_HANDLE FileHandle; EFI_STATUS Status; EFI_PXE_BASE_CODE_PROTOCOL *BcInterface; EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; UINTN FileSize; - + EFI_TEST_ASSERTION AssertionType; // // Get support library (Standard Lib, Profile Lib, Logging Lib) // @@ -2098,8 +2099,12 @@ BBTestMtftpFunctionTest ( } =20 Status =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); - if (EFI_ERROR(Status)) - { + if (EFI_ERROR(Status)) { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } StandardLib->RecordAssertion ( StandardLib, EFI_TEST_ASSERTION_FAILED, @@ -2202,12 +2207,13 @@ BBTestUdpWriteFunctionTest ( ) { EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_TEST_PROFILE_LIBRARY_PROTOCOL *ProfileLib; + EFI_TEST_PROFILE_LIBRARY_PROTOCOL *ProfileLib; EFI_TEST_LOGGING_LIBRARY_PROTOCOL *LoggingLib; EFI_INI_FILE_HANDLE FileHandle; EFI_STATUS Status; EFI_PXE_BASE_CODE_PROTOCOL *BcInterface; EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_TEST_ASSERTION AssertionType; =20 // // Get the Standard Library Interface @@ -2296,8 +2302,12 @@ BBTestUdpWriteFunctionTest ( } =20 Status =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); - if (EFI_ERROR(Status)) - { + if (EFI_ERROR(Status)) { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } StandardLib->RecordAssertion ( StandardLib, EFI_TEST_ASSERTION_FAILED, @@ -2371,13 +2381,14 @@ BBTestUdpReadFunctionTest ( ) { EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_TEST_PROFILE_LIBRARY_PROTOCOL *ProfileLib; + EFI_TEST_PROFILE_LIBRARY_PROTOCOL *ProfileLib; EFI_TEST_LOGGING_LIBRARY_PROTOCOL *LoggingLib; EFI_INI_FILE_HANDLE FileHandle; EFI_STATUS Status; EFI_PXE_BASE_CODE_PROTOCOL *BcInterface; EFI_PXE_BASE_CODE_IP_FILTER BcIpFilter; EFI_SIMPLE_NETWORK_PROTOCOL *SnpInterface; + EFI_TEST_ASSERTION AssertionType; =20 // // Get the Support Library Interface @@ -2473,8 +2484,12 @@ BBTestUdpReadFunctionTest ( } =20 Status =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); - if (EFI_ERROR(Status)) - { + if (EFI_ERROR(Status)) { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } StandardLib->RecordAssertion ( StandardLib, EFI_TEST_ASSERTION_FAILED, @@ -2644,7 +2659,7 @@ BBTestArpFunctionTest ( ) { EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib; - EFI_TEST_PROFILE_LIBRARY_PROTOCOL *ProfileLib; + EFI_TEST_PROFILE_LIBRARY_PROTOCOL *ProfileLib; EFI_TEST_LOGGING_LIBRARY_PROTOCOL *LoggingLib; EFI_INI_FILE_HANDLE FileHandle; EFI_STATUS Status; @@ -2755,8 +2770,12 @@ BBTestArpFunctionTest ( } =20 Status =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); - if (EFI_ERROR(Status)) - { + if (EFI_ERROR(Status)) { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } StandardLib->RecordAssertion ( StandardLib, EFI_TEST_ASSERTION_FAILED, diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/Black= BoxTest/SimpleNetworkBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IH= V/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c index 4158bbeb..3fc291e1 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest= /SimpleNetworkBBTestConformance.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest= /SimpleNetworkBBTestConformance.c @@ -2,15 +2,16 @@ =20 Copyright 2006 - 2016 Unified EFI, Inc.
Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2022, ARM Limited. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License - which accompanies this distribution. The full text of the license may b= e found at=20 + which accompanies this distribution. The full text of the license may b= e found at http://opensource.org/licenses/bsd-license.php -=20 + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. -=20 + **/ /*++ =20 @@ -24,7 +25,7 @@ Abstract: =20 --*/ =20 -#include "SctLib.h" +#include "SctLib.h" #include "SimpleNetworkBBTestMain.h" =20 /** @@ -100,7 +101,7 @@ BBTestStartConformanceTest ( } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // restore SNP status // @@ -108,7 +109,7 @@ BBTestStartConformanceTest ( Status1 =3D SnpInterface->Initialize(SnpInterface, 0, 0); if (EFI_ERROR(Status1)) { return Status1; - } =20 + } } =20 StandardLib->RecordAssertion ( @@ -206,7 +207,7 @@ BBTestStopConformanceTest ( } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Restore SNP status // @@ -311,10 +312,10 @@ BBTestInitializeConformanceTest ( } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Restore SNP status - //=20 + // if (State1 !=3D EfiSimpleNetworkStopped) { Status1 =3D SnpInterface->Start (SnpInterface); if (EFI_ERROR(Status1)) { @@ -332,7 +333,7 @@ BBTestInitializeConformanceTest ( } } =20 - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType, @@ -416,16 +417,19 @@ BBTestResetConformanceTest ( // Call Reset() function when network interface not start. // Status =3D SnpInterface->Reset (SnpInterface, FALSE); - if ((Status =3D=3D EFI_NOT_STARTED) && (SnpInterface->Mode->State =3D=3D= EfiSimpleNetworkStopped)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } } - =20 + // // Restore SNP status - //=20 + // if (State1 !=3D EfiSimpleNetworkStopped) { Status1 =3D SnpInterface->Start (SnpInterface); if (EFI_ERROR(Status1)) { @@ -450,7 +454,7 @@ BBTestResetConformanceTest ( (UINTN)__LINE__, Status ); -=20 + =20 return EFI_SUCCESS; } @@ -528,7 +532,7 @@ BBTestShutdownConformanceTest ( } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Restore SNP status // @@ -626,32 +630,27 @@ BBTestReceiveFilterConformanceTest ( // Call ReceiveFilters() function if network interface not start. // Status =3D SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, N= ULL); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if ((Status =3D=3D EFI_NOT_STARTED) && (SnpInterface->Mode->State =3D=3D= EfiSimpleNetworkStopped)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if ((Status =3D=3D EFI_NOT_STARTED) && (SnpInterface->Mode->State =3D= =3D EfiSimpleNetworkStopped)) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid006, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() when network interface not start.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } =20 + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid006, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke Re= ceiveFilters() when network interface not start.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + // // Assertion Point 5.6.2.2 // Call ReceiveFilters() function if network interface not initialized. @@ -662,32 +661,27 @@ BBTestReceiveFilterConformanceTest ( } =20 Status =3D SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, N= ULL); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_DEVICE_ERROR) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_DEVICE_ERROR) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid007, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() when network interface not initialized.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } =20 + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid007, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke Re= ceiveFilters() when network interface not initialized.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + // // Assertion Point 5.6.2.3 // Call ReceiveFilters() function with invalid parameters. @@ -701,32 +695,27 @@ BBTestReceiveFilterConformanceTest ( // Call ReceiveFilters with invalide Enable // Status =3D SnpInterface->ReceiveFilters (SnpInterface, ~(SnpInterface->M= ode->ReceiveFilterMask), 0, FALSE, 0, NULL); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid008, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke R= eceiveFilters() with invalid Enable.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } =20 + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid008, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke Re= ceiveFilters() with invalid Enable.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + // // Call ReceiveFilters with invalide MCastFilterCnt // @@ -740,85 +729,70 @@ BBTestReceiveFilterConformanceTest ( MAC.Addr[5] =3D 0x02; =20 Status =3D SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETW= ORK_RECEIVE_MULTICAST, 0, FALSE, SnpInterface->Mode->MaxMCastFilterCount + = 1, &MAC); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid009, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke= ReceiveFilters() with invalid MCastFilterCnt is greater than Snp->Mode->Ma= xMCastFilterCount.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } =20 + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid009, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke = ReceiveFilters() with invalid MCastFilterCnt is greater than Snp->Mode->Max= MCastFilterCount.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + Status =3D SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETW= ORK_RECEIVE_MULTICAST, 0, FALSE, 0, &MAC); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid043, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke= ReceiveFilters() with invalid MCastFilterCnt is 0.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } =20 + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid043, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke = ReceiveFilters() with invalid MCastFilterCnt is 0.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + Status =3D SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETW= ORK_RECEIVE_MULTICAST, 0, FALSE, 1, NULL); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"ReceiveFilters isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_INVALID_PARAMETER) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid010, - L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invo= ke ReceiveFilters() with MCastFilterCnt not match MCastFilter.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid010, + L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invok= e ReceiveFilters() with MCastFilterCnt not match MCastFilter.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); } =20 // @@ -912,7 +886,7 @@ BBTestStationAddressConformanceTest ( // save current snp state // State2 =3D SnpInterface->Mode->State; - =20 + // // Assertion Point 5.7.2.2 // Call StationAddress() function if network interface not initialized. @@ -923,71 +897,59 @@ BBTestStationAddressConformanceTest ( } =20 StatusBuf[1] =3D SnpInterface->StationAddress (SnpInterface, TRUE, NULL); - =20 + // // Restore SNP Status // if (State1 =3D=3D EfiSimpleNetworkInitialized) { - Status =3D SnpInterface->Initialize(SnpInterface, 0, 0);=20 + Status =3D SnpInterface->Initialize(SnpInterface, 0, 0); if (EFI_ERROR(Status)){ return Status; } } - =20 - if ((StatusBuf[0] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[0] =3D=3D = EFI_UNSUPPORTED)) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"StationAddress isn't supported, Status - %r\n", - StatusBuf[0] - ); + + if ((StatusBuf[0] =3D=3D EFI_NOT_STARTED) && (State2 =3D=3D EfiSimpleNet= workStopped)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if ((StatusBuf[0] =3D=3D EFI_NOT_STARTED) && (State2 =3D=3D EfiSimpleN= etworkStopped)) { + if ((StatusBuf[0] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[0] =3D= =3D EFI_UNSUPPORTED)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid011, - L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke S= tationAddress() when network interface not start.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[0] - ); } - =20 - if ((StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[1] =3D=3D = EFI_UNSUPPORTED)) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"StationAddress isn't supported, Status - %r\n", - StatusBuf[1] - ); + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid011, + L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke St= ationAddress() when network interface not start.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[0] + ); + + if (StatusBuf[1] =3D=3D EFI_DEVICE_ERROR) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (StatusBuf[1] =3D=3D EFI_DEVICE_ERROR) { + if ((StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[1] =3D= =3D EFI_UNSUPPORTED)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid012, - L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke S= tationAddress() when network interface not initialized.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[1] - ); } - =20 + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid012, + L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke St= ationAddress() when network interface not initialized.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[1] + ); + if (State1 =3D=3D EfiSimpleNetworkStopped) { - Status =3D SnpInterface->Stop (SnpInterface);=20 + Status =3D SnpInterface->Stop (SnpInterface); if (EFI_ERROR(Status)){ return Status; } @@ -1067,30 +1029,25 @@ BBTestStatisticsConformanceTest ( // Call Statistics() function while network interface is not started. // Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e, &StatisticsTable); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"Statistics isn't supported, Status - %r\n", - Status - ); + if ((Status =3D=3D EFI_NOT_STARTED) && (SnpInterface->Mode->State =3D=3D= EfiSimpleNetworkStopped)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if ((Status =3D=3D EFI_NOT_STARTED) && (SnpInterface->Mode->State =3D= =3D EfiSimpleNetworkStopped)) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid014, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Stati= stics() while network interface not started.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid014, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statis= tics() while network interface not started.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); =20 // // Assertion Point 5.8.2.2 @@ -1102,30 +1059,25 @@ BBTestStatisticsConformanceTest ( } =20 Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e, &StatisticsTable); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"Statistics isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_DEVICE_ERROR) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_DEVICE_ERROR) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid015, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Stati= stics() while network interface is not initialized.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid015, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statis= tics() while network interface is not initialized.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); =20 // // Assertion Point 5.8.2.3 @@ -1143,30 +1095,25 @@ BBTestStatisticsConformanceTest ( StatisticsSize =3D 0; =20 Status =3D SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSiz= e, &StatisticsTable); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"Statistics isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestConformanceAssertionGuid017, - L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Stati= stics() with small buffer.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestConformanceAssertionGuid017, + L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statis= tics() with small buffer.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); =20 // // Restore SNP State @@ -1182,7 +1129,7 @@ BBTestStatisticsConformanceTest ( return Status; } } - =20 + return EFI_SUCCESS; } =20 @@ -1267,7 +1214,7 @@ BBTestMCastIpToMacConformanceTest ( } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Restore SNP status // @@ -1405,7 +1352,7 @@ BBTestNVDataConformanceTest ( =20 StatusBuf[0] =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterfa= ce->Mode->NvRamAccessSize, Buffer); CheckPoint1State =3D SnpInterface->Mode->State; - =20 + =20 // // Assertion Point 5.10.2.2 @@ -1425,119 +1372,99 @@ BBTestNVDataConformanceTest ( // Check Point A: "Offset" not be a multiple of NvRamAccessSize // StatusBuf[1] =3D SnpInterface->NvData (SnpInterface, TRUE, (SnpInterface= ->Mode->NvRamAccessSize/2), SnpInterface->Mode->NvRamAccessSize, Buffer); -=20 + =20 // // Check Point B: "BufferSize" not be a multiple of NvRamAccessSize // StatusBuf[2] =3D SnpInterface->NvData (SnpInterface, TRUE, 0, (SnpInterf= ace->Mode->NvRamAccessSize/2), Buffer); -=20 + =20 // // Check Point C: "BufferSize" + "Offset" exceeds "NvRamSize" // - StatusBuf[3] =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterfa= ce->Mode->NvRamSize+100, Buffer);=20 + StatusBuf[3] =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterfa= ce->Mode->NvRamSize+100, Buffer); =20 =20 - if (StatusBuf[0] =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - StatusBuf[0] - ); + if ((StatusBuf[0] =3D=3D EFI_NOT_STARTED) && (CheckPoint1State =3D=3D Ef= iSimpleNetworkStopped)) { + AssertionType[0] =3D EFI_TEST_ASSERTION_PASSED; } else { - if ((StatusBuf[0] =3D=3D EFI_NOT_STARTED) && (CheckPoint1State =3D=3D = EfiSimpleNetworkStopped)) { + if (EFI_UNSUPPORTED =3D=3D StatusBuf[0]) { AssertionType[0] =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType[0] =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[0], - gSimpleNetworkBBTestConformanceAssertionGuid020, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = when network interface not start.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[0] - ); } - - if (StatusBuf[1] =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - StatusBuf[1] - ); + StandardLib->RecordAssertion ( + StandardLib, + AssertionType[0], + gSimpleNetworkBBTestConformanceAssertionGuid020, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() w= hen network interface not start.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[0] + ); + + if (StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) { + AssertionType[1] =3D EFI_TEST_ASSERTION_PASSED; } else { - if (StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D StatusBuf[1]) { AssertionType[1] =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType[1] =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[1], - gSimpleNetworkBBTestConformanceAssertionGuid021, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = with Offset not be a multiple of NvRamAccessSize.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[1] - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType[1], + gSimpleNetworkBBTestConformanceAssertionGuid021, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() w= ith Offset not be a multiple of NvRamAccessSize.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[1] + ); =20 - if (StatusBuf[2] =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - StatusBuf[2] - ); + if (StatusBuf[2] =3D=3D EFI_INVALID_PARAMETER) { + AssertionType[2] =3D EFI_TEST_ASSERTION_PASSED; } else { - if (StatusBuf[2] =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D StatusBuf[2]) { AssertionType[2] =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType[2] =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[2], - gSimpleNetworkBBTestConformanceAssertionGuid022, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = with BufferSize not be a multiple of NvRamAccessSize.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[2] - ); } - - if (StatusBuf[3] =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - StatusBuf[3] - ); + StandardLib->RecordAssertion ( + StandardLib, + AssertionType[2], + gSimpleNetworkBBTestConformanceAssertionGuid022, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() w= ith BufferSize not be a multiple of NvRamAccessSize.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[2] + ); + + if (StatusBuf[3] =3D=3D EFI_INVALID_PARAMETER) { + AssertionType[3] =3D EFI_TEST_ASSERTION_PASSED; } else { - if (StatusBuf[3] =3D=3D EFI_INVALID_PARAMETER) { + if (EFI_UNSUPPORTED =3D=3D StatusBuf[3]) { AssertionType[3] =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType[3] =3D EFI_TEST_ASSERTION_FAILED; } - StandardLib->RecordAssertion ( - StandardLib, - AssertionType[3], - gSimpleNetworkBBTestConformanceAssertionGuid023, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = with BufferSize + Offset exceeds NvRamSize.", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[3] - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType[3], + gSimpleNetworkBBTestConformanceAssertionGuid023, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() w= ith BufferSize + Offset exceeds NvRamSize.", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[3] + ); =20 // // Restore SNP Status @@ -1552,8 +1479,8 @@ BBTestNVDataConformanceTest ( if (EFI_ERROR(Status)) { return Status; } - }=20 - =20 + } + Status =3D gtBS->FreePool (Buffer); if (EFI_ERROR(Status)) { return Status; @@ -1641,7 +1568,7 @@ BBTestGetStatusConformanceTest ( } else { AssertionType[0] =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Assertion Point 5.11.2.2 // Call GetStatus () function if network interface not initialized. @@ -1667,7 +1594,7 @@ BBTestGetStatusConformanceTest ( } else { AssertionType[1] =3D EFI_TEST_ASSERTION_FAILED; } -=20 + /* // // Assertion Point 5.11.2.3 @@ -1696,7 +1623,7 @@ BBTestGetStatusConformanceTest ( AssertionType[2] =3D EFI_TEST_ASSERTION_FAILED; } */ - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[0], @@ -1707,7 +1634,7 @@ BBTestGetStatusConformanceTest ( (UINTN)__LINE__, StatusBuf[0] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[1], @@ -1718,7 +1645,7 @@ BBTestGetStatusConformanceTest ( (UINTN)__LINE__, StatusBuf[1] ); -/* =20 +/* StandardLib->RecordAssertion ( StandardLib, AssertionType[2], @@ -1729,7 +1656,7 @@ BBTestGetStatusConformanceTest ( (UINTN)__LINE__, StatusBuf[2] ); -*/ =20 +*/ // // Restore SNP State // @@ -1902,7 +1829,7 @@ BBTestTransmitConformanceTest ( } else { AssertionType[4] =3D EFI_TEST_ASSERTION_FAILED; } - =20 + =20 // // Check Point D: HeaderSize is nonzero and DestAddr is NULL. @@ -1913,7 +1840,7 @@ BBTestTransmitConformanceTest ( } else { AssertionType[5] =3D EFI_TEST_ASSERTION_FAILED; } -=20 + =20 // // Check Point E: HeaderSize is nonzero and Protocol is NULL. @@ -1935,7 +1862,7 @@ BBTestTransmitConformanceTest ( (UINTN)__LINE__, StatusBuf[0] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[1], @@ -1945,7 +1872,7 @@ BBTestTransmitConformanceTest ( __FILE__, (UINTN)__LINE__, StatusBuf[1] - ); + ); =20 StandardLib->RecordAssertion ( StandardLib, @@ -1957,7 +1884,7 @@ BBTestTransmitConformanceTest ( (UINTN)__LINE__, StatusBuf[2] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[3], @@ -1978,7 +1905,7 @@ BBTestTransmitConformanceTest ( (UINTN)__LINE__, StatusBuf[4] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[5], @@ -1989,7 +1916,7 @@ BBTestTransmitConformanceTest ( (UINTN)__LINE__, StatusBuf[5] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[6], @@ -2119,7 +2046,7 @@ BBTestReceiveConformanceTest ( } else { AssertionType[0] =3D EFI_TEST_ASSERTION_FAILED; } - =20 + =20 // // Assertion Point 5.13.2.2 @@ -2136,7 +2063,7 @@ BBTestReceiveConformanceTest ( } else { AssertionType[1] =3D EFI_TEST_ASSERTION_FAILED; } - =20 + // // Assertion Point 5.13.2.3 // Call Receive() function with invalid parameters. @@ -2171,7 +2098,7 @@ BBTestReceiveConformanceTest ( (UINTN)__LINE__, StatusBuf[0] ); - =20 + StandardLib->RecordAssertion ( StandardLib, AssertionType[1], @@ -2208,22 +2135,22 @@ BBTestReceiveConformanceTest ( return Status; } } - =20 + #if 0 // // Assertion Point 5.13.2.4 // No Packet Received in the Network Interface when Receive(). // // We should disable the muticast and broadcast receive filters first. b= ecause - // some muticast or broadcast packets maybe on the LAN=20 + // some muticast or broadcast packets maybe on the LAN // Status =3D SnpInterface->ReceiveFilters ( - SnpInterface,=20 - 0,=20 - EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST | EFI_SIMPL= E_NETWORK_RECEIVE_BROADCAST,=20 - TRUE,=20 - 0,=20 - NULL); + SnpInterface, + 0, + EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST | EFI_SIMP= LE_NETWORK_RECEIVE_BROADCAST, + TRUE, + 0, + NULL); if (EFI_ERROR(Status)) { StandardLib->RecordAssertion ( StandardLib, @@ -2235,7 +2162,7 @@ BBTestReceiveConformanceTest ( (UINTN)__LINE__, Status ); - return Status; + return Status; } =20 Status =3D EFI_SUCCESS; diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/Black= BoxTest/SimpleNetworkBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/P= rotocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c index 98a7cbd8..bbfa9bb6 100644 --- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest= /SimpleNetworkBBTestFunction.c +++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest= /SimpleNetworkBBTestFunction.c @@ -2,15 +2,16 @@ =20 Copyright 2006 - 2016 Unified EFI, Inc.
Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2022, ARM Limited. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License - which accompanies this distribution. The full text of the license may b= e found at=20 + which accompanies this distribution. The full text of the license may b= e found at http://opensource.org/licenses/bsd-license.php -=20 + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. -=20 + **/ /*++ =20 @@ -24,7 +25,7 @@ Abstract: =20 --*/ =20 -#include "SctLib.h" +#include "SctLib.h" #include "SimpleNetworkBBTestMain.h" =20 /** @@ -463,11 +464,14 @@ BBTestResetFunctionTest ( return Status; } =20 - Status =3D SnpInterface->Reset (SnpInterface, FALSE); - AssertionType =3D EFI_TEST_ASSERTION_PASSED; + Status =3D SnpInterface->Reset (SnpInterface, FALSE); if (EFI_ERROR(Status)) { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } } =20 if ((Mode.State !=3D SnpInterface->Mode->State) || @@ -529,7 +533,11 @@ BBTestResetFunctionTest ( if (Status =3D=3D EFI_SUCCESS) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } } StandardLib->RecordAssertion ( StandardLib, @@ -758,14 +766,16 @@ BBTestReceiveFilterFunctionTest ( =20 // Check point B. Disable Specified bit. Status =3D SnpInterface->ReceiveFilters (SnpInterface, 0, SupportedFil= ter, FALSE, 0, NULL); - if ((Status =3D=3D EFI_SUCCESS) && ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) =3D=3D= 0)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } } - StandardLib->RecordAssertion ( StandardLib, AssertionType, @@ -775,19 +785,21 @@ BBTestReceiveFilterFunctionTest ( __FILE__, (UINTN)__LINE__, Status, - (UINTN)SnpInterface->Mode->ReceiveFilterSetting + (UINTN)SnpInterface->Mode->ReceiveFilterSetting ); =20 // Check point A. Enable Specified bit. Status =3D SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter= , 0, FALSE, 0, NULL); - if ((Status =3D=3D EFI_SUCCESS) && ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) !=3D 0= )) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } } - StandardLib->RecordAssertion ( StandardLib, AssertionType, @@ -797,19 +809,21 @@ BBTestReceiveFilterFunctionTest ( __FILE__, (UINTN)__LINE__, Status, - (UINTN)SnpInterface->Mode->ReceiveFilterSetting + (UINTN)SnpInterface->Mode->ReceiveFilterSetting ); =20 // Check point C. Enable and Disable Specified bit together. Status =3D SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter= , SupportedFilter, FALSE, 0, NULL); - if ((Status =3D=3D EFI_SUCCESS) && ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) =3D=3D= 0)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } } - StandardLib->RecordAssertion ( StandardLib, AssertionType, @@ -819,7 +833,7 @@ BBTestReceiveFilterFunctionTest ( __FILE__, (UINTN)__LINE__, Status, - (UINTN)SnpInterface->Mode->ReceiveFilterSetting + (UINTN)SnpInterface->Mode->ReceiveFilterSetting ); } =20 @@ -844,9 +858,12 @@ BBTestReceiveFilterFunctionTest ( } else if ((Status =3D=3D EFI_INVALID_PARAMETER) && (SnpInterface->Mod= e->MaxMCastFilterCount =3D=3D 0)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } } - StandardLib->RecordAssertion ( StandardLib, AssertionType, @@ -856,12 +873,12 @@ BBTestReceiveFilterFunctionTest ( __FILE__, (UINTN)__LINE__, Status, - (UINTN)SnpInterface->Mode->ReceiveFilterSetting, - (UINTN)SnpInterface->Mode->ReceiveFilterMask, - (UINTN)SnpInterface->Mode->MCastFilterCount, - (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[0], - (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[5], - (UINTN)SnpInterface->Mode->MCastFilter[1].Addr[0] + (UINTN)SnpInterface->Mode->ReceiveFilterSetting, + (UINTN)SnpInterface->Mode->ReceiveFilterMask, + (UINTN)SnpInterface->Mode->MCastFilterCount, + (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[0], + (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[5], + (UINTN)SnpInterface->Mode->MCastFilter[1].Addr[0] ); } =20 @@ -869,17 +886,18 @@ BBTestReceiveFilterFunctionTest ( // Assertion Point 4.6.2.3 // Reset multicast receive filters list. // - Status =3D SnpInterface->ReceiveFilters (SnpInterface, 0, 0, TRUE, 0, NU= LL); - if ((Status =3D=3D EFI_SUCCESS) && (SnpInterface->Mode->State =3D=3D EfiSimpleNetworkInitialized) && (SnpInterface->Mode->MCastFilterCount =3D=3D 0)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } } - StandardLib->RecordAssertion ( StandardLib, AssertionType, @@ -889,13 +907,13 @@ BBTestReceiveFilterFunctionTest ( __FILE__, (UINTN)__LINE__, Status, - (UINTN)SnpInterface->Mode->ReceiveFilterSetting, - (UINTN)SnpInterface->Mode->ReceiveFilterMask, - (UINTN)SnpInterface->Mode->MCastFilterCount, - (UINTN)Mode.MCastFilterCount, - (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[0], - (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[5], - (UINTN)SnpInterface->Mode->MCastFilter[1].Addr[0] + (UINTN)SnpInterface->Mode->ReceiveFilterSetting, + (UINTN)SnpInterface->Mode->ReceiveFilterMask, + (UINTN)SnpInterface->Mode->MCastFilterCount, + (UINTN)Mode.MCastFilterCount, + (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[0], + (UINTN)SnpInterface->Mode->MCastFilter[0].Addr[5], + (UINTN)SnpInterface->Mode->MCastFilter[1].Addr[0] ); // // Restore SNP State @@ -1012,59 +1030,47 @@ BBTestStationAddressFunctionTest ( // SnpInterface->StationAddress (SnpInterface, FALSE, &BackMacAddress); =20 - if ((StatusBuf[0] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[0] =3D=3D = EFI_UNSUPPORTED)) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"StationAddress isn't supported, Status - %r\n", - StatusBuf[0] - ); + if ((StatusBuf[0] =3D=3D EFI_SUCCESS) && + (!CheckPoint1)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if ((StatusBuf[0] =3D=3D EFI_SUCCESS) && - (!CheckPoint1)) { + if ((StatusBuf[0] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[0] =3D= =3D EFI_UNSUPPORTED)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid013, - L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke R= eceiveFilters() to reset its MAC Address and verify interface correctness w= ithin test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[0] - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid013, + L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke Re= ceiveFilters() to reset its MAC Address and verify interface correctness wi= thin test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[0] + ); =20 - if ((StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[1] =3D=3D = EFI_UNSUPPORTED)) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"StationAddress isn't supported, Status - %r\n", - StatusBuf[1] - ); + if ((StatusBuf[1] =3D=3D EFI_SUCCESS) && + (!CheckPoint2)) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if ((StatusBuf[1] =3D=3D EFI_SUCCESS) && - (!CheckPoint2)) { + if ((StatusBuf[1] =3D=3D EFI_INVALID_PARAMETER) || (StatusBuf[1] =3D= =3D EFI_UNSUPPORTED)) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid014, - L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke R= eceiveFilters() to modify its MAC Address and verify interface correctness = within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - StatusBuf[1] - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid014, + L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke Re= ceiveFilters() to modify its MAC Address and verify interface correctness w= ithin test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + StatusBuf[1] + ); =20 // // Restore SNP State @@ -1181,13 +1187,12 @@ BBTestStatisticsFunctionTest ( (!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_N= ETWORK_STATISTICS)))) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - if (Status =3D=3D EFI_UNSUPPORTED) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } } - StandardLib->RecordAssertion ( StandardLib, AssertionType, @@ -1218,13 +1223,12 @@ BBTestStatisticsFunctionTest ( (!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_N= ETWORK_STATISTICS)))) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - AssertionType =3D EFI_TEST_ASSERTION_FAILED; - } - - if (Status =3D=3D EFI_UNSUPPORTED) { - AssertionType =3D EFI_TEST_ASSERTION_PASSED; + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } } - StandardLib->RecordAssertion ( StandardLib, AssertionType, @@ -1358,12 +1362,12 @@ BBTestMCastIpToMacFunctionTest ( __FILE__, (UINTN)__LINE__, Status, - (UINTN)MAC1.Addr[0], - (UINTN)MAC1.Addr[1], - (UINTN)MAC1.Addr[2], - (UINTN)MAC1.Addr[3], - (UINTN)MAC1.Addr[4], - (UINTN)MAC1.Addr[5] + (UINTN)MAC1.Addr[0], + (UINTN)MAC1.Addr[1], + (UINTN)MAC1.Addr[2], + (UINTN)MAC1.Addr[3], + (UINTN)MAC1.Addr[4], + (UINTN)MAC1.Addr[5] ); =20 // @@ -1487,92 +1491,76 @@ BBTestNVDataFunctionTest ( //Check Point A(0, n*NvRamAccessSize) SctSetMem (Buffer, SnpInterface->Mode->NvRamSize, 0x0); Status =3D SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mo= de->NvRamSize, Buffer); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_SUCCESS) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid018, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = to read(0, n*NvRamAccessSize) and verify interface correctness within test = case", - L"%a:%d:Status - %r, NvRamSize - %d, NvRamAccessSize - = %d", - __FILE__, - (UINTN)__LINE__, - Status, - (UINTN)SnpInterface->Mode->NvRamSize, - (UINTN)SnpInterface->Mode->NvRamAccessSize - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid018, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() t= o read(0, n*NvRamAccessSize) and verify interface correctness within test c= ase", + L"%a:%d:Status - %r, NvRamSize - %d, NvRamAccessSize - %= d", + __FILE__, + (UINTN)__LINE__, + Status, + (UINTN)SnpInterface->Mode->NvRamSize, + (UINTN)SnpInterface->Mode->NvRamAccessSize + ); =20 //Check Point B(NvRamAccessSize, (n-1)*NvRamAccessSize) SctSetMem (Buffer, SnpInterface->Mode->NvRamSize, 0x0); Status =3D SnpInterface->NvData (SnpInterface, TRUE, SnpInterface->Mode-= >NvRamAccessSize, (SnpInterface->Mode->NvRamSize - SnpInterface->Mode->NvRa= mAccessSize), Buffer); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_SUCCESS) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid019, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = to read(NvRamAccessSize, (n-1)*NvRamAccessSize) and verify interface correc= tness within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } =20 + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid019, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() t= o read(NvRamAccessSize, (n-1)*NvRamAccessSize) and verify interface correct= ness within test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + //Check Point C((n-1)*NvRamAccessSize, NvRamAccessSize) SctSetMem (Buffer, SnpInterface->Mode->NvRamSize, 0x0); Status =3D SnpInterface->NvData (SnpInterface, TRUE, (SnpInterface->Mode= ->NvRamSize - SnpInterface->Mode->NvRamAccessSize), SnpInterface->Mode->NvR= amAccessSize, Buffer); - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - Status - ); + if (Status =3D=3D EFI_SUCCESS) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if (Status =3D=3D EFI_SUCCESS) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid020, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = to read((n-1)*NvRamAccessSize, NvRamAccessSize) and verify interface correc= tness within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } =20 + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid020, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() t= o read((n-1)*NvRamAccessSize, NvRamAccessSize) and verify interface correct= ness within test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); + // // Assertion Point 4.10.2.2 // Write NVRam @@ -1599,31 +1587,25 @@ BBTestNVDataFunctionTest ( goto End; } =20 - if (Status =3D=3D EFI_UNSUPPORTED) { - StandardLib->RecordMessage( - StandardLib, - EFI_VERBOSE_LEVEL_QUIET, - L"NvData isn't supported, Status - %r\n", - Status - ); + if ((Status =3D=3D EFI_SUCCESS) && (!SctCompareMem (Buffer, Buffer1, Snp= Interface->Mode->NvRamSize))) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { - if ((Status =3D=3D EFI_SUCCESS) && (!SctCompareMem (Buffer, Buffer1, S= npInterface->Mode->NvRamSize))) { + if (EFI_UNSUPPORTED =3D=3D Status) { AssertionType =3D EFI_TEST_ASSERTION_PASSED; } else { AssertionType =3D EFI_TEST_ASSERTION_FAILED; } - - StandardLib->RecordAssertion ( - StandardLib, - AssertionType, - gSimpleNetworkBBTestFunctionAssertionGuid021, - L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() = to write and verify interface correctness within test case", - L"%a:%d:Status - %r", - __FILE__, - (UINTN)__LINE__, - Status - ); } + StandardLib->RecordAssertion ( + StandardLib, + AssertionType, + gSimpleNetworkBBTestFunctionAssertionGuid021, + L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() t= o write and verify interface correctness within test case", + L"%a:%d:Status - %r", + __FILE__, + (UINTN)__LINE__, + Status + ); =20 End: // @@ -1919,7 +1901,7 @@ BBTestGetStatusFunctionTest ( (UINTN)__LINE__, Status, Status1, - (UINTN)InterruptStatus + (UINTN)InterruptStatus ); } =20 @@ -2322,9 +2304,14 @@ BBTestReceiveFunctionTest ( NULL ); if (EFI_ERROR(Status)) { + if (EFI_UNSUPPORTED =3D=3D Status) { + AssertionType =3D EFI_TEST_ASSERTION_PASSED; + } else { + AssertionType =3D EFI_TEST_ASSERTION_FAILED; + } StandardLib->RecordAssertion ( StandardLib, - EFI_TEST_ASSERTION_FAILED, + AssertionType, gTestGenericFailureGuid, L"EFI_SIMPLE_NETWORK_PROTOCOL.Receive - Enable ReceiveF= ilters", L"%a:%d:Status - %r", --=20 2.32.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#85577): https://edk2.groups.io/g/devel/message/85577 Mute This Topic: https://groups.io/mt/88360239/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-