From: "Sunny Wang" <Sunny.Wang@arm.com>
To: devel@edk2.groups.io
Cc: Sunny Wang <Sunny.Wang@arm.com>,
G Edhaya Chandran <edhaya.chandran@arm.com>,
Barton Gao <gaojie@byosoft.com.cn>,
Carolyn Gjertsen <Carolyn.Gjertsen@amd.com>,
Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>,
Sunny Wang <sunny.wang@arm.com>
Subject: [edk2-test][PATCH v1] uefi-sct/SctPkg: Allow some SNP functions to return EFI_UNSUPPORTED
Date: Tue, 11 Jan 2022 21:56:19 +0000 [thread overview]
Message-ID: <20220111215619.1857-1-Sunny.Wang@arm.com> (raw)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3145
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 <edhaya.chandran@arm.com>
Cc: Barton Gao <gaojie@byosoft.com.cn>
Cc: Carolyn Gjertsen <Carolyn.Gjertsen@amd.com>
Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Signed-off-by: Sunny Wang <sunny.wang@arm.com>
---
.../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/BlackBoxTest/PxeBaseCodeBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PxeBaseCode/BlackBoxTest/PxeBaseCodeBBTestFunction.c
index e353c522..b1f05f8c 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PxeBaseCode/BlackBoxTest/PxeBaseCodeBBTestFunction.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PxeBaseCode/BlackBoxTest/PxeBaseCodeBBTestFunction.c
@@ -2,15 +2,16 @@
Copyright 2006 - 2016 Unified EFI, Inc.<BR>
Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2022, ARM Limited. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
+ which accompanies this distribution. The full text of the license may be 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 IMPLIED.
-
+
**/
/*++
@@ -24,7 +25,7 @@ Abstract:
--*/
-#include "SctLib.h"
+#include "SctLib.h"
#include "PxeBaseCodeBBTestMain.h"
#include "PxeBaseCodeBBTestSupport.h"
@@ -203,7 +204,7 @@ BBTestUdpReadFuncSrcPortFilter (
/**
* 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.
+ * 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"
);
- }
+ }
if (BcInterface->Mode->IcmpErrorReceived != FALSE) {
AssertionType = EFI_TEST_ASSERTION_FAILED;
StandardLib->RecordMessage (
@@ -605,7 +606,7 @@ BBTestNewStartFunctionTest (
return Status;
}
}
-
+
//
// Enable EFI_PXE_BASE_CODE_PROTOCOL Protocol interface in IPv6
//
@@ -627,8 +628,8 @@ BBTestNewStartFunctionTest (
(UINTN)__LINE__,
Status
);
-
-
+
+
if (AssertionType == EFI_TEST_ASSERTION_PASSED) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
if (BcInterface->Mode->Started != TRUE) {
@@ -720,7 +721,7 @@ BBTestNewStartFunctionTest (
L"Mode->PxeBisReplyReceived - %s\r\n",
BcInterface->Mode->PxeBisReplyReceived ? L"TRUE" : L"FALSE"
);
- }
+ }
if (BcInterface->Mode->IcmpErrorReceived != FALSE) {
AssertionType = EFI_TEST_ASSERTION_FAILED;
StandardLib->RecordMessage (
@@ -797,7 +798,7 @@ BBTestNewStartFunctionTest (
L"IS_PXE_PACKET_ZEROED(Mode->ProxyOffer) - Fail\r\n"
);
}
-
+
if (IS_PXE_PACKET_ZEROED(&BcInterface->Mode->PxeDiscover) == FALSE) {
AssertionType = EFI_TEST_ASSERTION_FAILED;
StandardLib->RecordMessage (
@@ -944,13 +945,13 @@ BBTestNewStartFunctionTest (
);
}
}
-
+
return Status;
}
/**
* 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.
+ * 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;
Index = 0;
-
+
//
// Get the Standard Library Interface
//
@@ -1091,7 +1092,7 @@ BBTestNewSetIpFilterFunctionTest (
return Status;
}
}
-
+
//
// Enable EFI_PXE_BASE_CODE_PROTOCOL Protocol interface in IPv6
//
@@ -1109,16 +1110,16 @@ BBTestNewSetIpFilterFunctionTest (
);
return Status;
}
-
+
SctSetMem (&BcIpFilter, sizeof (BcIpFilter), 0);
BcIpFilter.Filters = EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP;
BcIpFilter.IpCnt = 2;
-
+
for (Index = 0; Index < 16; Index++) {
BcIpFilter.IpList[0].v6.Addr[Index] = Index;
BcIpFilter.IpList[1].v6.Addr[Index] = 16 - Index;
}
-
+
Status = BcInterface->SetIpFilter (BcInterface, &BcIpFilter);
if (Status == EFI_SUCCESS) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
@@ -1135,7 +1136,7 @@ BBTestNewSetIpFilterFunctionTest (
(UINTN)__LINE__,
Status
);
-
+
if (TRUE == IsIpFilterEqual (&BcIpFilter, &(BcInterface->Mode->IpFilter))){
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
@@ -1158,7 +1159,7 @@ BBTestNewSetIpFilterFunctionTest (
/**
* 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.
+ * 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
- );
+ );
}
//
@@ -1290,7 +1291,7 @@ BBTestNewStopFunctionTest (
__FILE__,
(UINTN)__LINE__,
Status
- );
+ );
return Status;
}
@@ -1607,8 +1608,8 @@ BBTestStartFunctionTest (
);
}
if ((0 != BcInterface->Mode->IpFilter.Filters) || (0 != BcInterface->Mode->IpFilter.IpCnt)) {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- StandardLib->RecordMessage (
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ StandardLib->RecordMessage (
StandardLib,
EFI_VERBOSE_LEVEL_DEFAULT,
L"The Mode->IpFilter.Filters or Mode->IpFilter.IpCnt field 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;
//
// Get support library (Standard Lib, Profile Lib, Logging Lib)
@@ -2098,11 +2100,15 @@ BBTestMtftpFunctionTest (
}
Status = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
- if (EFI_ERROR(Status))
- {
+ if (EFI_ERROR(Status)) {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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;
//
// Get the Standard Library Interface
@@ -2296,11 +2303,15 @@ BBTestUdpWriteFunctionTest (
}
Status = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
- if (EFI_ERROR(Status))
- {
+ if (EFI_ERROR(Status)) {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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;
//
// Get the Support Library Interface
@@ -2473,8 +2485,12 @@ BBTestUdpReadFunctionTest (
}
Status = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
- if (EFI_ERROR(Status))
- {
+ if (EFI_ERROR(Status)) {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
@@ -2755,8 +2771,12 @@ BBTestArpFunctionTest (
}
Status = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
- if (EFI_ERROR(Status))
- {
+ if (EFI_ERROR(Status)) {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/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 @@
Copyright 2006 - 2016 Unified EFI, Inc.<BR>
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2022, ARM Limited. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
+ which accompanies this distribution. The full text of the license may be 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 IMPLIED.
-
+
**/
/*++
@@ -24,7 +25,7 @@ Abstract:
--*/
-#include "SctLib.h"
+#include "SctLib.h"
#include "SimpleNetworkBBTestMain.h"
/**
@@ -100,7 +101,7 @@ BBTestStartConformanceTest (
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// restore SNP status
//
@@ -108,7 +109,7 @@ BBTestStartConformanceTest (
Status1 = SnpInterface->Initialize(SnpInterface, 0, 0);
if (EFI_ERROR(Status1)) {
return Status1;
- }
+ }
}
StandardLib->RecordAssertion (
@@ -206,7 +207,7 @@ BBTestStopConformanceTest (
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Restore SNP status
//
@@ -311,10 +312,10 @@ BBTestInitializeConformanceTest (
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Restore SNP status
- //
+ //
if (State1 != EfiSimpleNetworkStopped) {
Status1 = SnpInterface->Start (SnpInterface);
if (EFI_ERROR(Status1)) {
@@ -332,7 +333,7 @@ BBTestInitializeConformanceTest (
}
}
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
@@ -416,16 +417,19 @@ BBTestResetConformanceTest (
// Call Reset() function when network interface not start.
//
Status = SnpInterface->Reset (SnpInterface, FALSE);
-
if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
}
-
+
//
// Restore SNP status
- //
+ //
if (State1 != EfiSimpleNetworkStopped) {
Status1 = SnpInterface->Start (SnpInterface);
if (EFI_ERROR(Status1)) {
@@ -450,7 +454,7 @@ BBTestResetConformanceTest (
(UINTN)__LINE__,
Status
);
-
+
return EFI_SUCCESS;
}
@@ -528,7 +532,7 @@ BBTestShutdownConformanceTest (
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Restore SNP status
//
@@ -626,31 +630,26 @@ BBTestReceiveFilterConformanceTest (
// Call ReceiveFilters() function if network interface not start.
//
Status = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, NULL);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid006,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() 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 ReceiveFilters() when network interface not start.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
//
// Assertion Point 5.6.2.2
@@ -662,31 +661,25 @@ BBTestReceiveFilterConformanceTest (
}
Status = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, NULL);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_DEVICE_ERROR) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_DEVICE_ERROR) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid007,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() 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 ReceiveFilters() when network interface not initialized.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
//
// Assertion Point 5.6.2.3
@@ -701,31 +694,25 @@ BBTestReceiveFilterConformanceTest (
// Call ReceiveFilters with invalide Enable
//
Status = SnpInterface->ReceiveFilters (SnpInterface, ~(SnpInterface->Mode->ReceiveFilterMask), 0, FALSE, 0, NULL);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid008,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid Enable.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
}
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestConformanceAssertionGuid008,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid Enable.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
//
// Call ReceiveFilters with invalide MCastFilterCnt
@@ -740,85 +727,67 @@ BBTestReceiveFilterConformanceTest (
MAC.Addr[5] = 0x02;
Status = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, SnpInterface->Mode->MaxMCastFilterCount + 1, &MAC);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = 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->MaxMCastFilterCount.",
- 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->MaxMCastFilterCount.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
Status = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 0, &MAC);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = 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
+ );
Status = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 1, NULL);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid010,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke 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 - Invoke ReceiveFilters() with MCastFilterCnt not match MCastFilter.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
}
//
@@ -912,7 +881,7 @@ BBTestStationAddressConformanceTest (
// save current snp state
//
State2 = SnpInterface->Mode->State;
-
+
//
// Assertion Point 5.7.2.2
// Call StationAddress() function if network interface not initialized.
@@ -923,71 +892,60 @@ BBTestStationAddressConformanceTest (
}
StatusBuf[1] = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
-
+
//
// Restore SNP Status
//
if (State1 == EfiSimpleNetworkInitialized) {
- Status = SnpInterface->Initialize(SnpInterface, 0, 0);
+ Status = SnpInterface->Initialize(SnpInterface, 0, 0);
if (EFI_ERROR(Status)){
return Status;
}
}
-
- if ((StatusBuf[0] == EFI_INVALID_PARAMETER) || (StatusBuf[0] == EFI_UNSUPPORTED)) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"StationAddress isn't supported, Status - %r\n",
- StatusBuf[0]
- );
+
+ if ((StatusBuf[0] == EFI_NOT_STARTED) && (State2 == EfiSimpleNetworkStopped)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if ((StatusBuf[0] == EFI_NOT_STARTED) && (State2 == EfiSimpleNetworkStopped)) {
+ if ((StatusBuf[0] == EFI_INVALID_PARAMETER) || (StatusBuf[0] == EFI_UNSUPPORTED)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid011,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke StationAddress() when network interface not start.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- StatusBuf[0]
- );
}
-
- if ((StatusBuf[1] == EFI_INVALID_PARAMETER) || (StatusBuf[1] == 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 StationAddress() when network interface not start.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[0]
+ );
+
+
+ if (StatusBuf[1] == EFI_DEVICE_ERROR) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (StatusBuf[1] == EFI_DEVICE_ERROR) {
+ if ((StatusBuf[1] == EFI_INVALID_PARAMETER) || (StatusBuf[1] == EFI_UNSUPPORTED)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid012,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke StationAddress() when network interface not initialized.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- StatusBuf[1]
- );
}
-
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestConformanceAssertionGuid012,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke StationAddress() when network interface not initialized.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[1]
+ );
+
if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Stop (SnpInterface);
+ Status = SnpInterface->Stop (SnpInterface);
if (EFI_ERROR(Status)){
return Status;
}
@@ -1067,30 +1025,25 @@ BBTestStatisticsConformanceTest (
// Call Statistics() function while network interface is not started.
//
Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"Statistics isn't supported, Status - %r\n",
- Status
- );
+ if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid014,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() 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 Statistics() while network interface not started.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
//
// Assertion Point 5.8.2.2
@@ -1102,30 +1055,25 @@ BBTestStatisticsConformanceTest (
}
Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"Statistics isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_DEVICE_ERROR) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_DEVICE_ERROR) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid015,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() 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 Statistics() while network interface is not initialized.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
//
// Assertion Point 5.8.2.3
@@ -1143,30 +1091,25 @@ BBTestStatisticsConformanceTest (
StatisticsSize = 0;
Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"Statistics isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_BUFFER_TOO_SMALL) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid017,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() with small buffer.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
}
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestConformanceAssertionGuid017,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() with small buffer.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
//
// Restore SNP State
@@ -1182,7 +1125,7 @@ BBTestStatisticsConformanceTest (
return Status;
}
}
-
+
return EFI_SUCCESS;
}
@@ -1267,7 +1210,7 @@ BBTestMCastIpToMacConformanceTest (
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Restore SNP status
//
@@ -1405,7 +1348,7 @@ BBTestNVDataConformanceTest (
StatusBuf[0] = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamAccessSize, Buffer);
CheckPoint1State = SnpInterface->Mode->State;
-
+
//
// Assertion Point 5.10.2.2
@@ -1425,119 +1368,102 @@ BBTestNVDataConformanceTest (
// Check Point A: "Offset" not be a multiple of NvRamAccessSize
//
StatusBuf[1] = SnpInterface->NvData (SnpInterface, TRUE, (SnpInterface->Mode->NvRamAccessSize/2), SnpInterface->Mode->NvRamAccessSize, Buffer);
-
+
//
// Check Point B: "BufferSize" not be a multiple of NvRamAccessSize
//
StatusBuf[2] = SnpInterface->NvData (SnpInterface, TRUE, 0, (SnpInterface->Mode->NvRamAccessSize/2), Buffer);
-
+
//
// Check Point C: "BufferSize" + "Offset" exceeds "NvRamSize"
//
- StatusBuf[3] = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamSize+100, Buffer);
+ StatusBuf[3] = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamSize+100, Buffer);
- if (StatusBuf[0] == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- StatusBuf[0]
- );
+
+ if ((StatusBuf[0] == EFI_NOT_STARTED) && (CheckPoint1State == EfiSimpleNetworkStopped)) {
+ AssertionType[0] = EFI_TEST_ASSERTION_PASSED;
} else {
- if ((StatusBuf[0] == EFI_NOT_STARTED) && (CheckPoint1State == EfiSimpleNetworkStopped)) {
+ if (EFI_UNSUPPORTED == StatusBuf[0]) {
AssertionType[0] = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType[0] = 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] == 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() when network interface not start.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[0]
+ );
+
+
+ if (StatusBuf[1] == EFI_INVALID_PARAMETER) {
+ AssertionType[1] = EFI_TEST_ASSERTION_PASSED;
} else {
- if (StatusBuf[1] == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == StatusBuf[1]) {
AssertionType[1] = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType[1] = 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() with Offset not be a multiple of NvRamAccessSize.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[1]
+ );
- if (StatusBuf[2] == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- StatusBuf[2]
- );
+
+ if (StatusBuf[2] == EFI_INVALID_PARAMETER) {
+ AssertionType[2] = EFI_TEST_ASSERTION_PASSED;
} else {
- if (StatusBuf[2] == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == StatusBuf[2]) {
AssertionType[2] = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType[2] = 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] == 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() with BufferSize not be a multiple of NvRamAccessSize.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[2]
+ );
+
+ if (StatusBuf[3] == EFI_INVALID_PARAMETER) {
+ AssertionType[3] = EFI_TEST_ASSERTION_PASSED;
} else {
- if (StatusBuf[3] == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == StatusBuf[3]) {
AssertionType[3] = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType[3] = 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() with BufferSize + Offset exceeds NvRamSize.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[3]
+ );
//
// Restore SNP Status
@@ -1552,8 +1478,8 @@ BBTestNVDataConformanceTest (
if (EFI_ERROR(Status)) {
return Status;
}
- }
-
+ }
+
Status = gtBS->FreePool (Buffer);
if (EFI_ERROR(Status)) {
return Status;
@@ -1641,7 +1567,7 @@ BBTestGetStatusConformanceTest (
} else {
AssertionType[0] = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Assertion Point 5.11.2.2
// Call GetStatus () function if network interface not initialized.
@@ -1667,7 +1593,7 @@ BBTestGetStatusConformanceTest (
} else {
AssertionType[1] = EFI_TEST_ASSERTION_FAILED;
}
-
+
/*
//
// Assertion Point 5.11.2.3
@@ -1696,7 +1622,7 @@ BBTestGetStatusConformanceTest (
AssertionType[2] = EFI_TEST_ASSERTION_FAILED;
}
*/
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[0],
@@ -1707,7 +1633,7 @@ BBTestGetStatusConformanceTest (
(UINTN)__LINE__,
StatusBuf[0]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[1],
@@ -1718,7 +1644,7 @@ BBTestGetStatusConformanceTest (
(UINTN)__LINE__,
StatusBuf[1]
);
-/*
+/*
StandardLib->RecordAssertion (
StandardLib,
AssertionType[2],
@@ -1729,7 +1655,7 @@ BBTestGetStatusConformanceTest (
(UINTN)__LINE__,
StatusBuf[2]
);
-*/
+*/
//
// Restore SNP State
//
@@ -1902,7 +1828,7 @@ BBTestTransmitConformanceTest (
} else {
AssertionType[4] = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Check Point D: HeaderSize is nonzero and DestAddr is NULL.
@@ -1913,7 +1839,7 @@ BBTestTransmitConformanceTest (
} else {
AssertionType[5] = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Check Point E: HeaderSize is nonzero and Protocol is NULL.
@@ -1935,7 +1861,7 @@ BBTestTransmitConformanceTest (
(UINTN)__LINE__,
StatusBuf[0]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[1],
@@ -1945,7 +1871,7 @@ BBTestTransmitConformanceTest (
__FILE__,
(UINTN)__LINE__,
StatusBuf[1]
- );
+ );
StandardLib->RecordAssertion (
StandardLib,
@@ -1957,7 +1883,7 @@ BBTestTransmitConformanceTest (
(UINTN)__LINE__,
StatusBuf[2]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[3],
@@ -1978,7 +1904,7 @@ BBTestTransmitConformanceTest (
(UINTN)__LINE__,
StatusBuf[4]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[5],
@@ -1989,7 +1915,7 @@ BBTestTransmitConformanceTest (
(UINTN)__LINE__,
StatusBuf[5]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[6],
@@ -2119,7 +2045,7 @@ BBTestReceiveConformanceTest (
} else {
AssertionType[0] = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Assertion Point 5.13.2.2
@@ -2136,7 +2062,7 @@ BBTestReceiveConformanceTest (
} else {
AssertionType[1] = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Assertion Point 5.13.2.3
// Call Receive() function with invalid parameters.
@@ -2171,7 +2097,7 @@ BBTestReceiveConformanceTest (
(UINTN)__LINE__,
StatusBuf[0]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[1],
@@ -2208,22 +2134,22 @@ BBTestReceiveConformanceTest (
return Status;
}
}
-
+
#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. because
- // some muticast or broadcast packets maybe on the LAN
+ // some muticast or broadcast packets maybe on the LAN
//
Status = SnpInterface->ReceiveFilters (
- SnpInterface,
- 0,
- EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST | EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST,
- TRUE,
- 0,
- NULL);
+ SnpInterface,
+ 0,
+ EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST | EFI_SIMPLE_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;
}
Status = EFI_SUCCESS;
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/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.<BR>
- Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
-
- This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be 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 IMPLIED.
-
-**/
-/*++
-
-Module Name:
-
- SimpleNetworkBBTestFunction.c
-
-Abstract:
-
- Basic Test Cases of SimpleNetwork Protocol
-
---*/
-
+/** @file
+
+ Copyright 2006 - 2016 Unified EFI, Inc.<BR>
+ Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2022, ARM Limited. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be 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 IMPLIED.
+
+**/
+/*++
+
+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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkStopped.
- // If not, change the state to EfiSimpleNetworkStopped.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkInitialized) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = 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 = SnpInterface->Start (SnpInterface);
- if ((Status == EFI_SUCCESS) && (SnpInterface->Mode->State == EfiSimpleNetworkStarted)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- //
- // Restore SNP state
- //
- if (State1 == EfiSimpleNetworkInitialized) {
- Status1 = 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 == EfiSimpleNetworkStopped) {
- Status = 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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkStarted.
- // If not, change the state to EfiSimpleNetworkStarted.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkInitialized) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStopped) {
- Status = 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 = SnpInterface->Stop (SnpInterface);
- if ((Status == EFI_SUCCESS) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- //
- // Restore SNP State
- //
- if (State1 != EfiSimpleNetworkStopped) {
- Status1 = SnpInterface->Start(SnpInterface);
- if (EFI_ERROR(Status1)) {
- return Status1;
- }
- }
-
- if (State1 == EfiSimpleNetworkInitialized) {
- Status1 = 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 verify 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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkStarted.
- // If not, change the state to EfiSimpleNetworkStarted.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkInitialized) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStopped) {
- Status = 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 "Initialized".
- //
- Status = SnpInterface->Initialize (SnpInterface, 0, 0);
- if ((Status == EFI_SUCCESS) && (SnpInterface->Mode->State == EfiSimpleNetworkInitialized)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid003,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Initialize - Invoke Initialize() 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 state from "Started" to "Initialized".
- //
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- Status = SnpInterface->Initialize (SnpInterface, 32, 32);
- if ((Status == EFI_UNSUPPORTED) || ((Status == EFI_SUCCESS) && (SnpInterface->Mode->State == EfiSimpleNetworkInitialized))) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid004,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Initialize - Invoke Initialize() with extra Tx/Rx specified and verify interface correctness within test case",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
-
- //
- // Restore SNP State
- //
- if (Status == EFI_SUCCESS) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- if (State1 == EfiSimpleNetworkInitialized) {
- SnpInterface->Initialize (SnpInterface, 0, 0);
- }
- }
-
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- Status = 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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkInitialized.
- // If not, change the state to EfiSimpleNetworkInitialized.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Start (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = 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 = sizeof (EFI_NETWORK_STATISTICS);
- Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize1, &StatisticsTable1);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- Status = SnpInterface->Reset (SnpInterface, FALSE);
-
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- if (EFI_ERROR(Status)) {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- if ((Mode.State != SnpInterface->Mode->State) ||
- (Mode.ReceiveFilterMask != SnpInterface->Mode->ReceiveFilterMask) ||
- (Mode.ReceiveFilterSetting != SnpInterface->Mode->ReceiveFilterSetting) ||
- SctCompareMem (&(Mode.CurrentAddress), &(SnpInterface->Mode->CurrentAddress), sizeof (EFI_MAC_ADDRESS)) ||
- SctCompareMem (&(Mode.PermanentAddress), &(SnpInterface->Mode->PermanentAddress), sizeof (EFI_MAC_ADDRESS))) {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- TxBuf = NULL;
- Status1 = SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &TxBuf);
- if (EFI_ERROR(Status1)) {
- return Status1;
- }
-
- if (SnpInterface->Mode->MediaPresent == FALSE) {
- if (InterruptStatus != 0 || TxBuf != NULL) {
- AssertionType = 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 != NULL) {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
- }
-
- SctSetMem (&StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS), 0x0);
- StatisticsSize2 = sizeof (EFI_NETWORK_STATISTICS);
- Status1 = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize2, &StatisticsTable2);
- if (EFI_ERROR(Status1)) {
- return Status1;
- }
-
- if ((StatisticsSize1 != StatisticsSize2) ||
- SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS))) {
- AssertionType = 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 = SnpInterface->Reset (SnpInterface, TRUE);
- if (Status == EFI_SUCCESS) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = 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 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- Status = 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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkInitialized.
- // If not, change the state to EfiSimpleNetworkInitialized.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Start (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = SnpInterface->Initialize (SnpInterface, 0, 0);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- //
- // Assertion Point 4.5.2.1
- // Call Shutdown() function.
- //
- Status = SnpInterface->Shutdown (SnpInterface);
-
- if ((Status == EFI_SUCCESS) &&
- (SnpInterface->Mode->State == EfiSimpleNetworkStarted)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- //
- // Restore SNP State
- //
- if (State1 == EfiSimpleNetworkInitialized) {
- Status1 = 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 == EfiSimpleNetworkStopped) {
- Status1 = SnpInterface->Stop(SnpInterface);
- if (EFI_ERROR(Status1)) {
- return Status1;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilter() 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.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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkInitialized.
- // If not, change the state to EfiSimpleNetworkInitialized.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Start (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = SnpInterface->Initialize (SnpInterface, 0, 0);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- //
- // retrieve the supported bit in SnpInterface->Mode->ReceiveFilterMask
- //
- SupportedFilter = 0;
- ReceiveFilterMask = SnpInterface->Mode->ReceiveFilterMask;
- for (Index = 0; Index < 5; Index++) {
- if ((ReceiveFilterMask & 0x00000001) == 0x00000001) {
- SupportedFilter = 0x00000001 << Index;
- break;
- }
- ReceiveFilterMask = ReceiveFilterMask >> 1;
- }
-
- SctSetMem (&Mode, sizeof (EFI_SIMPLE_NETWORK_MODE), 0x0);
- SctCopyMem (&Mode, SnpInterface->Mode, sizeof (EFI_SIMPLE_NETWORK_MODE));
-
- if (SupportedFilter != 0) {
- //
- // Assertion Point 4.6.2.1
- // Modify multicast receive filters masks.
- //
-
- // Check point B. Disable Specified bit.
- Status = SnpInterface->ReceiveFilters (SnpInterface, 0, SupportedFilter, FALSE, 0, NULL);
-
- if ((Status == EFI_SUCCESS) &&
- ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) == 0)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid008,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() 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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkStopped.
+ // If not, change the state to EfiSimpleNetworkStopped.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkInitialized) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = 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 = SnpInterface->Start (SnpInterface);
+ if ((Status == EFI_SUCCESS) && (SnpInterface->Mode->State == EfiSimpleNetworkStarted)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+
+ //
+ // Restore SNP state
+ //
+ if (State1 == EfiSimpleNetworkInitialized) {
+ Status1 = 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 == EfiSimpleNetworkStopped) {
+ Status = 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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkStarted.
+ // If not, change the state to EfiSimpleNetworkStarted.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkInitialized) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStopped) {
+ Status = 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 = SnpInterface->Stop (SnpInterface);
+ if ((Status == EFI_SUCCESS) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+
+ //
+ // Restore SNP State
+ //
+ if (State1 != EfiSimpleNetworkStopped) {
+ Status1 = SnpInterface->Start(SnpInterface);
+ if (EFI_ERROR(Status1)) {
+ return Status1;
+ }
+ }
+
+ if (State1 == EfiSimpleNetworkInitialized) {
+ Status1 = 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 verify 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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkStarted.
+ // If not, change the state to EfiSimpleNetworkStarted.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkInitialized) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStopped) {
+ Status = 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 "Initialized".
+ //
+ Status = SnpInterface->Initialize (SnpInterface, 0, 0);
+ if ((Status == EFI_SUCCESS) && (SnpInterface->Mode->State == EfiSimpleNetworkInitialized)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid003,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.Initialize - Invoke Initialize() 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 state from "Started" to "Initialized".
+ //
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = SnpInterface->Initialize (SnpInterface, 32, 32);
+ if ((Status == EFI_UNSUPPORTED) || ((Status == EFI_SUCCESS) && (SnpInterface->Mode->State == EfiSimpleNetworkInitialized))) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid004,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.Initialize - Invoke Initialize() with extra Tx/Rx specified and verify interface correctness within test case",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+
+ //
+ // Restore SNP State
+ //
+ if (Status == EFI_SUCCESS) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ if (State1 == EfiSimpleNetworkInitialized) {
+ SnpInterface->Initialize (SnpInterface, 0, 0);
+ }
+ }
+
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = 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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkInitialized.
+ // If not, change the state to EfiSimpleNetworkInitialized.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Start (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = 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 = sizeof (EFI_NETWORK_STATISTICS);
+ Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize1, &StatisticsTable1);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ Status = SnpInterface->Reset (SnpInterface, FALSE);
+ if (EFI_ERROR(Status)) {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+
+ if ((Mode.State != SnpInterface->Mode->State) ||
+ (Mode.ReceiveFilterMask != SnpInterface->Mode->ReceiveFilterMask) ||
+ (Mode.ReceiveFilterSetting != SnpInterface->Mode->ReceiveFilterSetting) ||
+ SctCompareMem (&(Mode.CurrentAddress), &(SnpInterface->Mode->CurrentAddress), sizeof (EFI_MAC_ADDRESS)) ||
+ SctCompareMem (&(Mode.PermanentAddress), &(SnpInterface->Mode->PermanentAddress), sizeof (EFI_MAC_ADDRESS))) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+
+ TxBuf = NULL;
+ Status1 = SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &TxBuf);
+ if (EFI_ERROR(Status1)) {
+ return Status1;
+ }
+
+ if (SnpInterface->Mode->MediaPresent == FALSE) {
+ if (InterruptStatus != 0 || TxBuf != NULL) {
+ AssertionType = 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 != NULL) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+
+ SctSetMem (&StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS), 0x0);
+ StatisticsSize2 = sizeof (EFI_NETWORK_STATISTICS);
+ Status1 = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize2, &StatisticsTable2);
+ if (EFI_ERROR(Status1)) {
+ return Status1;
+ }
+
+ if ((StatisticsSize1 != StatisticsSize2) ||
+ SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS))) {
+ AssertionType = 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 = SnpInterface->Reset (SnpInterface, TRUE);
+ if (Status == EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = 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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkInitialized.
+ // If not, change the state to EfiSimpleNetworkInitialized.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Start (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = SnpInterface->Initialize (SnpInterface, 0, 0);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ //
+ // Assertion Point 4.5.2.1
+ // Call Shutdown() function.
+ //
+ Status = SnpInterface->Shutdown (SnpInterface);
+
+ if ((Status == EFI_SUCCESS) &&
+ (SnpInterface->Mode->State == EfiSimpleNetworkStarted)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+
+ //
+ // Restore SNP State
+ //
+ if (State1 == EfiSimpleNetworkInitialized) {
+ Status1 = 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 == EfiSimpleNetworkStopped) {
+ Status1 = SnpInterface->Stop(SnpInterface);
+ if (EFI_ERROR(Status1)) {
+ return Status1;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilter() 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.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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkInitialized.
+ // If not, change the state to EfiSimpleNetworkInitialized.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Start (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = SnpInterface->Initialize (SnpInterface, 0, 0);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ //
+ // retrieve the supported bit in SnpInterface->Mode->ReceiveFilterMask
+ //
+ SupportedFilter = 0;
+ ReceiveFilterMask = SnpInterface->Mode->ReceiveFilterMask;
+ for (Index = 0; Index < 5; Index++) {
+ if ((ReceiveFilterMask & 0x00000001) == 0x00000001) {
+ SupportedFilter = 0x00000001 << Index;
+ break;
+ }
+ ReceiveFilterMask = ReceiveFilterMask >> 1;
+ }
+
+ SctSetMem (&Mode, sizeof (EFI_SIMPLE_NETWORK_MODE), 0x0);
+ SctCopyMem (&Mode, SnpInterface->Mode, sizeof (EFI_SIMPLE_NETWORK_MODE));
+
+ if (SupportedFilter != 0) {
+ //
+ // Assertion Point 4.6.2.1
+ // Modify multicast receive filters masks.
+ //
+
+ // Check point B. Disable Specified bit.
+ Status = SnpInterface->ReceiveFilters (SnpInterface, 0, SupportedFilter, FALSE, 0, NULL);
+ if ((Status == EFI_SUCCESS) &&
+ ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) == 0)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid008,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() 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 = SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter, 0, FALSE, 0, NULL);
-
- if ((Status == EFI_SUCCESS) &&
- ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) != 0)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid009,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters () to modify multicast receive filters masks (Enable Specified 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 = SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter, 0, FALSE, 0, NULL);
+ if ((Status == EFI_SUCCESS) &&
+ ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) != 0)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid009,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters () to modify multicast receive filters masks (Enable 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 C. Enable and Disable Specified bit together.
- Status = SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter, SupportedFilter, FALSE, 0, NULL);
-
- if ((Status == EFI_SUCCESS) &&
- ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) == 0)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid010,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() to modify multicast receive filters masks(Enable and Disable 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 = SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter, SupportedFilter, FALSE, 0, NULL);
+ if ((Status == EFI_SUCCESS) &&
+ ((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) == 0)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid010,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() to modify multicast receive filters masks(Enable and Disable 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) != 0) {
- SctSetMem (&MAC, sizeof (MAC), 0x00);
- MAC.Addr[0] = 0x01;
- MAC.Addr[1] = 0x00;
- MAC.Addr[2] = 0x5e;
- MAC.Addr[3] = 0x00;
- MAC.Addr[4] = 0x00;
- MAC.Addr[5] = 0x02;
- Status = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 1, &MAC);
- if ((Status == EFI_SUCCESS) &&
- (SnpInterface->Mode->State == EfiSimpleNetworkInitialized) &&
- (SnpInterface->Mode->MCastFilterCount == 1) &&
- (!SctCompareMem (SnpInterface->Mode->MCastFilter, &MAC, sizeof (EFI_MAC_ADDRESS)))) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else if ((Status == EFI_INVALID_PARAMETER) && (SnpInterface->Mode->MaxMCastFilterCount == 0)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid011,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() to modify multicast receive filters list and verify interface 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) != 0) {
+ SctSetMem (&MAC, sizeof (MAC), 0x00);
+ MAC.Addr[0] = 0x01;
+ MAC.Addr[1] = 0x00;
+ MAC.Addr[2] = 0x5e;
+ MAC.Addr[3] = 0x00;
+ MAC.Addr[4] = 0x00;
+ MAC.Addr[5] = 0x02;
+ Status = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 1, &MAC);
+ if ((Status == EFI_SUCCESS) &&
+ (SnpInterface->Mode->State == EfiSimpleNetworkInitialized) &&
+ (SnpInterface->Mode->MCastFilterCount == 1) &&
+ (!SctCompareMem (SnpInterface->Mode->MCastFilter, &MAC, sizeof (EFI_MAC_ADDRESS)))) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else if ((Status == EFI_INVALID_PARAMETER) && (SnpInterface->Mode->MaxMCastFilterCount == 0)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid011,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() to modify multicast receive filters list and verify interface 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 = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, TRUE, 0, NULL);
-
- if ((Status == EFI_SUCCESS) &&
- (SnpInterface->Mode->State == EfiSimpleNetworkInitialized) &&
- (SnpInterface->Mode->MCastFilterCount == 0)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid012,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() 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 = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, TRUE, 0, NULL);
+ if ((Status == EFI_SUCCESS) &&
+ (SnpInterface->Mode->State == EfiSimpleNetworkInitialized) &&
+ (SnpInterface->Mode->MCastFilterCount == 0)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid012,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() 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 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- Status = SnpInterface->Stop (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress() 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.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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkInitialized.
- // If not, change the state to EfiSimpleNetworkInitialized.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Start (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = 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] = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
- CheckPoint1 = 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] = SnpInterface->StationAddress (SnpInterface, FALSE, &MacAddress);
- CheckPoint2 = SctCompareMem (
- &SnpInterface->Mode->CurrentAddress,
- &MacAddress,
- sizeof (EFI_MAC_ADDRESS)
- );
-
- //
- // restore temperate MAC address
- //
- SnpInterface->StationAddress (SnpInterface, FALSE, &BackMacAddress);
-
- if ((StatusBuf[0] == EFI_INVALID_PARAMETER) || (StatusBuf[0] == EFI_UNSUPPORTED)) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"StationAddress isn't supported, Status - %r\n",
- StatusBuf[0]
- );
- } else {
- if ((StatusBuf[0] == EFI_SUCCESS) &&
- (!CheckPoint1)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid013,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke ReceiveFilters() to reset its MAC Address and verify interface correctness within test case",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- StatusBuf[0]
- );
- }
-
- if ((StatusBuf[1] == EFI_INVALID_PARAMETER) || (StatusBuf[1] == EFI_UNSUPPORTED)) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"StationAddress isn't supported, Status - %r\n",
- StatusBuf[1]
- );
- } else {
- if ((StatusBuf[1] == EFI_SUCCESS) &&
- (!CheckPoint2)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid014,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke ReceiveFilters() 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 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- Status = 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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the Logginh Library Interface
- //
- Status = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiTestLoggingLibraryGuid,
- (VOID **) &LoggingLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkInitialized.
- // If not, change the state to EfiSimpleNetworkInitialized.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Start (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = 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 = sizeof (EFI_NETWORK_STATISTICS);
- SctSetMem (&StatisticsTable1, sizeof (EFI_NETWORK_STATISTICS), 0x0);
- Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable1);
- StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
- SctSetMem (&StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS), 0x0);
- Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable2);
-
- LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(StatisticsTable1), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX);
- LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(StatisticsTable2), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX);
-
- if ((Status == EFI_SUCCESS) &&
- (!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS)))) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- }
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid015,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() 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->Statistics
- // may set the StatisticsSize greater than size of EFI_NETWORK_STATISTICS.
- // Since StatisticsSize is an IN/OUT parameter, reset StatisticsSize to
- // size of EFI_NETWORK_STATISTICS to avoid memory corruption.
- StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
- Status = SnpInterface->Statistics (SnpInterface, TRUE, &StatisticsSize, &StatisticsTable1);
- LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(StatisticsTable1), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX);
-
- if ((Status == EFI_SUCCESS) &&
- (!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS)))) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- }
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid016,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() 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 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- Status = SnpInterface->Stop (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- return EFI_SUCCESS;
-}
-
-/**
- * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.MCastIpToMac() 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.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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkInitialized.
- // If not, change the state to EfiSimpleNetworkInitialized.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Start (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = 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] = 234;
- IP.v4.Addr[1] = 0;
- IP.v4.Addr[2] = 0;
- IP.v4.Addr[3] = 1;
- SctSetMem (&MAC1, sizeof (EFI_MAC_ADDRESS), 0x0);
- SctSetMem (&MAC2, sizeof (EFI_MAC_ADDRESS), 0x0);
- MAC2.Addr[0] = 0x01;
- MAC2.Addr[1] = 0x00;
- MAC2.Addr[2] = 0x5E;
- MAC2.Addr[3] = 0x00;
- MAC2.Addr[4] = 0x00;
- MAC2.Addr[5] = 0x01;
-
- Status = SnpInterface->MCastIpToMac(SnpInterface, FALSE, &IP, &MAC1);
-
- //
- // Do not check the MAC address, because this is based on ethernet.
- //
-
- // if ((Status == EFI_SUCCESS) && (!SctCompareMem (&MAC1, &MAC2, sizeof(EFI_MAC_ADDRESS)))) {
- if (Status == EFI_SUCCESS) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid017,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.MCastIpToMac - Invoke MCastIpToMac() and verify interface correctness within test case",
- L"%a:%d:Status - %r, MAC address - %02x%02x%02x%02x%02x%02x",
- __FILE__,
- (UINTN)__LINE__,
- Status,
+ );
+ //
+ // Restore SNP State
+ //
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = SnpInterface->Stop (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress() 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.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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkInitialized.
+ // If not, change the state to EfiSimpleNetworkInitialized.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Start (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = 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] = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
+ CheckPoint1 = 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] = SnpInterface->StationAddress (SnpInterface, FALSE, &MacAddress);
+ CheckPoint2 = SctCompareMem (
+ &SnpInterface->Mode->CurrentAddress,
+ &MacAddress,
+ sizeof (EFI_MAC_ADDRESS)
+ );
+
+ //
+ // restore temperate MAC address
+ //
+ SnpInterface->StationAddress (SnpInterface, FALSE, &BackMacAddress);
+
+ if ((StatusBuf[0] == EFI_SUCCESS) &&
+ (!CheckPoint1)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if ((StatusBuf[0] == EFI_INVALID_PARAMETER) || (StatusBuf[0] == EFI_UNSUPPORTED)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid013,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke ReceiveFilters() to reset its MAC Address and verify interface correctness within test case",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[0]
+ );
+
+
+ if ((StatusBuf[1] == EFI_SUCCESS) &&
+ (!CheckPoint2)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if ((StatusBuf[1] == EFI_INVALID_PARAMETER) || (StatusBuf[1] == EFI_UNSUPPORTED)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid014,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke ReceiveFilters() 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 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ Status = 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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the Logginh Library Interface
+ //
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiTestLoggingLibraryGuid,
+ (VOID **) &LoggingLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkInitialized.
+ // If not, change the state to EfiSimpleNetworkInitialized.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Start (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = 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 = sizeof (EFI_NETWORK_STATISTICS);
+ SctSetMem (&StatisticsTable1, sizeof (EFI_NETWORK_STATISTICS), 0x0);
+ Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable1);
+ StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
+ SctSetMem (&StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS), 0x0);
+ Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable2);
+
+ LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(StatisticsTable1), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX);
+ LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(StatisticsTable2), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX);
+
+ if ((Status == EFI_SUCCESS) &&
+ (!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS)))) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid015,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() 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->Statistics
+ // may set the StatisticsSize greater than size of EFI_NETWORK_STATISTICS.
+ // Since StatisticsSize is an IN/OUT parameter, reset StatisticsSize to
+ // size of EFI_NETWORK_STATISTICS to avoid memory corruption.
+ StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
+ Status = SnpInterface->Statistics (SnpInterface, TRUE, &StatisticsSize, &StatisticsTable1);
+ LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&(StatisticsTable1), sizeof (EFI_NETWORK_STATISTICS)/2, EFI_DUMP_HEX);
+
+ if ((Status == EFI_SUCCESS) &&
+ (!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS)))) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid016,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() 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 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ Status = SnpInterface->Stop (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ * Entrypoint for EFI_SIMPLE_NETWORK_PROTOCOL.MCastIpToMac() 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.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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkInitialized.
+ // If not, change the state to EfiSimpleNetworkInitialized.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Start (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = 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] = 234;
+ IP.v4.Addr[1] = 0;
+ IP.v4.Addr[2] = 0;
+ IP.v4.Addr[3] = 1;
+ SctSetMem (&MAC1, sizeof (EFI_MAC_ADDRESS), 0x0);
+ SctSetMem (&MAC2, sizeof (EFI_MAC_ADDRESS), 0x0);
+ MAC2.Addr[0] = 0x01;
+ MAC2.Addr[1] = 0x00;
+ MAC2.Addr[2] = 0x5E;
+ MAC2.Addr[3] = 0x00;
+ MAC2.Addr[4] = 0x00;
+ MAC2.Addr[5] = 0x01;
+
+ Status = SnpInterface->MCastIpToMac(SnpInterface, FALSE, &IP, &MAC1);
+
+ //
+ // Do not check the MAC address, because this is based on ethernet.
+ //
+
+ // if ((Status == EFI_SUCCESS) && (!SctCompareMem (&MAC1, &MAC2, sizeof(EFI_MAC_ADDRESS)))) {
+ if (Status == EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid017,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.MCastIpToMac - Invoke MCastIpToMac() and verify interface correctness within test case",
+ L"%a:%d:Status - %r, MAC address - %02x%02x%02x%02x%02x%02x",
+ __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 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- Status = 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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkInitialized.
- // If not, change the state to EfiSimpleNetworkInitialized.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Start (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = SnpInterface->Initialize (SnpInterface, 0, 0);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- if ((SnpInterface->Mode->NvRamAccessSize == 0) || (SnpInterface->Mode->NvRamSize == 0)) {
- StandardLib->RecordMessage (
- StandardLib,
- EFI_VERBOSE_LEVEL_DEFAULT,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - NvRAM device is not attached\n"
- );
- return EFI_SUCCESS;
- }
-
- Buffer = NULL;
- Buffer1 = NULL;
- Buffer2 = NULL;
- Status = gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamSize, (VOID **) &Buffer);
- if (EFI_ERROR(Status)) {
- goto End;
- }
- Status = gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamSize, (VOID **) &Buffer1);
- if (EFI_ERROR(Status)) {
- goto End;
- }
- Status = gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamSize, (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 = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamSize, Buffer);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- Status
- );
- } else {
- if (Status == EFI_SUCCESS) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = 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 = SnpInterface->NvData (SnpInterface, TRUE, SnpInterface->Mode->NvRamAccessSize, (SnpInterface->Mode->NvRamSize - SnpInterface->Mode->NvRamAccessSize), Buffer);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- Status
- );
- } else {
- if (Status == EFI_SUCCESS) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = 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 correctness 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 = SnpInterface->NvData (SnpInterface, TRUE, (SnpInterface->Mode->NvRamSize - SnpInterface->Mode->NvRamAccessSize), SnpInterface->Mode->NvRamAccessSize, Buffer);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- Status
- );
- } else {
- if (Status == EFI_SUCCESS) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = 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 correctness 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 = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamSize, Buffer2);
- if (EFI_ERROR(Status1)) {
- goto End;
- }
- Status = SnpInterface->NvData (SnpInterface, FALSE, 0, SnpInterface->Mode->NvRamSize, Buffer);
-
- // Read the buffer content which was written just now.
- Status1 = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamSize, Buffer1);
- if (EFI_ERROR(Status1)) {
- goto End;
- }
-
- // recover the NvData
- Status1 = SnpInterface->NvData (SnpInterface, FALSE, 0, SnpInterface->Mode->NvRamSize, Buffer2);
- if (EFI_ERROR(Status1)) {
- goto End;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- Status
- );
- } else {
- if ((Status == EFI_SUCCESS) && (!SctCompareMem (Buffer, Buffer1, SnpInterface->Mode->NvRamSize))) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = 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 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- Status = 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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkInitialized.
- // If not, change the state to EfiSimpleNetworkInitialized.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Start (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = SnpInterface->Initialize (SnpInterface, 0, 0);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- //
- // Initialize the variables.
- //
-
- Buffer = NULL;
- HeaderSize = 0;
- BufferSize = 0;
- SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0xFF);
- SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0xFF);
- Protocol = 0;
- Status = 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 = SnpInterface->Mode->MediaHeaderSize;
- BufferSize = 128;
- StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
-
- Protocol = 0x0806;
-
- //
- // Get the Statistics before invoke the Transmit();
- //
- SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
-
- Status = SnpInterface->Transmit (SnpInterface, HeaderSize, BufferSize, Buffer, &SnpInterface->Mode->CurrentAddress, &DestAddr, &Protocol);
-
- //
- // Wait the package to be sent
- //
- if (!EFI_ERROR(Status)) {
- StatCode =gtBS->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 = 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 = SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &TxBuf);
-
- if (EFI_ERROR(StatCode)) {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- break;
- }
-
- if (TxBuf == Buffer) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- break;
- }
-
- if (!EFI_ERROR(tBS->CheckEvent (TimeoutEvent))) {
- StatCode = EFI_TIMEOUT;
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- break;
- }
- }
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid027,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - The transmitted 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 = sizeof (EFI_NETWORK_STATISTICS);
- SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable1);
-
- //
- // Restore SNP State
- //
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- Status = SnpInterface->Stop (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkInitialized.
- // If not, change the state to EfiSimpleNetworkInitialized.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Start (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = SnpInterface->Initialize (SnpInterface, 0, 0);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- TxBuf = NULL;
- InterruptStatus = 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 = SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &TxBuf);
- Status1 = SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &TxBuf);
-
- if (SnpInterface->Mode-> MediaPresentSupported == TRUE) {
- if (SnpInterface->Mode->MediaPresent == FALSE) {
- if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS) && (InterruptStatus == 0)) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
- } else {
- if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS)) {
- AssertionType = 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 = EFI_TEST_ASSERTION_FAILED;
- }
- } else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
- }
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid022,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - Invoke GetStatus() 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 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ Status = 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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkInitialized.
+ // If not, change the state to EfiSimpleNetworkInitialized.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Start (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = SnpInterface->Initialize (SnpInterface, 0, 0);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ if ((SnpInterface->Mode->NvRamAccessSize == 0) || (SnpInterface->Mode->NvRamSize == 0)) {
+ StandardLib->RecordMessage (
+ StandardLib,
+ EFI_VERBOSE_LEVEL_DEFAULT,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - NvRAM device is not attached\n"
+ );
+ return EFI_SUCCESS;
+ }
+
+ Buffer = NULL;
+ Buffer1 = NULL;
+ Buffer2 = NULL;
+ Status = gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamSize, (VOID **) &Buffer);
+ if (EFI_ERROR(Status)) {
+ goto End;
+ }
+ Status = gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamSize, (VOID **) &Buffer1);
+ if (EFI_ERROR(Status)) {
+ goto End;
+ }
+ Status = gtBS->AllocatePool (EfiLoaderData, SnpInterface->Mode->NvRamSize, (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 = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamSize, Buffer);
+ if (Status == EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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 = SnpInterface->NvData (SnpInterface, TRUE, SnpInterface->Mode->NvRamAccessSize, (SnpInterface->Mode->NvRamSize - SnpInterface->Mode->NvRamAccessSize), Buffer);
+ if (Status == EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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 correctness 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 = SnpInterface->NvData (SnpInterface, TRUE, (SnpInterface->Mode->NvRamSize - SnpInterface->Mode->NvRamAccessSize), SnpInterface->Mode->NvRamAccessSize, Buffer);
+ if (Status == EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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 correctness 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 = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamSize, Buffer2);
+ if (EFI_ERROR(Status1)) {
+ goto End;
+ }
+ Status = SnpInterface->NvData (SnpInterface, FALSE, 0, SnpInterface->Mode->NvRamSize, Buffer);
+
+ // Read the buffer content which was written just now.
+ Status1 = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamSize, Buffer1);
+ if (EFI_ERROR(Status1)) {
+ goto End;
+ }
+
+ // recover the NvData
+ Status1 = SnpInterface->NvData (SnpInterface, FALSE, 0, SnpInterface->Mode->NvRamSize, Buffer2);
+ if (EFI_ERROR(Status1)) {
+ goto End;
+ }
+
+ if ((Status == EFI_SUCCESS) && (!SctCompareMem (Buffer, Buffer1, SnpInterface->Mode->NvRamSize))) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ Status = 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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkInitialized.
+ // If not, change the state to EfiSimpleNetworkInitialized.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Start (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = SnpInterface->Initialize (SnpInterface, 0, 0);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ //
+ // Initialize the variables.
+ //
+
+ Buffer = NULL;
+ HeaderSize = 0;
+ BufferSize = 0;
+ SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0xFF);
+ SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0xFF);
+ Protocol = 0;
+ Status = 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 = SnpInterface->Mode->MediaHeaderSize;
+ BufferSize = 128;
+ StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
+
+ Protocol = 0x0806;
+
+ //
+ // Get the Statistics before invoke the Transmit();
+ //
+ SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
+
+ Status = SnpInterface->Transmit (SnpInterface, HeaderSize, BufferSize, Buffer, &SnpInterface->Mode->CurrentAddress, &DestAddr, &Protocol);
+
+ //
+ // Wait the package to be sent
+ //
+ if (!EFI_ERROR(Status)) {
+ StatCode =gtBS->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 = 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 = SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &TxBuf);
+
+ if (EFI_ERROR(StatCode)) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ break;
+ }
+
+ if (TxBuf == Buffer) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ break;
+ }
+
+ if (!EFI_ERROR(tBS->CheckEvent (TimeoutEvent))) {
+ StatCode = EFI_TIMEOUT;
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ break;
+ }
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid027,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - The transmitted 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 = sizeof (EFI_NETWORK_STATISTICS);
+ SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable1);
+
+ //
+ // Restore SNP State
+ //
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = SnpInterface->Stop (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkInitialized.
+ // If not, change the state to EfiSimpleNetworkInitialized.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Start (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = SnpInterface->Initialize (SnpInterface, 0, 0);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ TxBuf = NULL;
+ InterruptStatus = 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 = SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &TxBuf);
+ Status1 = SnpInterface->GetStatus (SnpInterface, &InterruptStatus, &TxBuf);
+
+ if (SnpInterface->Mode-> MediaPresentSupported == TRUE) {
+ if (SnpInterface->Mode->MediaPresent == FALSE) {
+ if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS) && (InterruptStatus == 0)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ } else {
+ if ((Status1 == EFI_SUCCESS) && (Status == EFI_SUCCESS)) {
+ AssertionType = 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 = EFI_TEST_ASSERTION_FAILED;
+ }
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid022,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.GetStatus - Invoke GetStatus() 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 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- Status = SnpInterface->Stop (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- SctPrint (L"\nNow the machine can be reconnected to the LAN, press any key 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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the Logginh Library Interface
- //
- Status = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiTestLoggingLibraryGuid,
- (VOID **) &LoggingLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkInitialized.
- // If not, change the state to EfiSimpleNetworkInitialized.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Start (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = SnpInterface->Initialize (SnpInterface, 0, 0);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- //
- // Initialize the variables.
- //
-
- Buffer = NULL;
- HeaderSize = 0;
- BufferSize = 0;
- SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0xFF);
- SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0xFF);
- Protocol = 0;
- Status = gtBS->AllocatePool (EfiLoaderData, 1024, (VOID **) &Buffer);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Assertion Point 4.12.2.2
- // Call Transmit() with HeaderSize != 0
- //
-
- //Need to put correct conten of a packet into the Buffer.
- SctSetMem (Buffer, 1024, 0x0);
- HeaderSize = SnpInterface->Mode->MediaHeaderSize;
- BufferSize = 128;
- StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
-
- Protocol = 0x0806;
-
- //
- // Get the Statistics before invoke the Transmit();
- //
- SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
-
- Status = SnpInterface->Transmit (SnpInterface, HeaderSize, BufferSize, Buffer, &SnpInterface->Mode->CurrentAddress, &DestAddr, &Protocol);
-
- //
- // Wait the package to be sent
- //
- if (!EFI_ERROR(Status)) {
- StatCode =gtBS->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 = 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 = SnpInterface->GetStatus (SnpInterface, &IntStatus, &TxBuf);
-
- 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 == Buffer) {
- break;
- }
-
- if (!EFI_ERROR(gtBS->CheckEvent (TimeoutEvent))) {
- StatCode = 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 = EFI_TEST_ASSERTION_PASSED;
- if (EFI_ERROR(Status) || SnpInterface->Mode->State != EfiSimpleNetworkInitialized) {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
- SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable1);
-
- //
- // 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 == L'Y') || (Key.UnicodeChar == L'y') || (Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
- break;
- }
- else {
- SctPrint (L"Please press \"Y\" or \"N\"\n");
- }
- }
- if ((Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid024,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - Invoke Transmit() with HeaderSize != 0 and verify interface correctness within test case",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
-
- //
- // Restore SNP State
- //
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- Status = 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 = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiStandardTestLibraryGuid,
- (VOID **) &StandardLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the Logginh Library Interface
- //
- Status = gtBS->HandleProtocol (
- SupportHandle,
- &gEfiTestLoggingLibraryGuid,
- (VOID **) &LoggingLib
- );
-
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- //
- // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
- //
- SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
-
- //
- // Check whether the state of network interface is EfiSimpleNetworkInitialized.
- // If not, change the state to EfiSimpleNetworkInitialized.
- //
- State1 = SnpInterface->Mode->State;
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Start (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- State2 = SnpInterface->Mode->State;
- if (State2 == EfiSimpleNetworkStarted) {
- Status = SnpInterface->Initialize (SnpInterface, 0, 0);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- //
- // Enable receive filters
- //
- Status = SnpInterface->ReceiveFilters (
- SnpInterface,
- EFI_SIMPLE_NETWORK_RECEIVE_UNICAST|EFI_SIMPLE_NETWORK_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 ReceiveFilters",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
- return Status;
- }
-
- //
- // Initialize the variables.
- //
-
- Buffer = NULL;
- HeaderSize = 0;
- BufferSize = 0;
- SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0x0);
- SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0x0);
- Protocol = 0;
- Status = gtBS->AllocatePool (EfiLoaderData, 1024, (VOID **) &Buffer);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- SctSetMem (Buffer, 1024, 0x0);
- StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
-
- //
- // Get the Statistics before invoke the Receive();
- //
- SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
-
- //
- // 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 == L'Y') || (Key.UnicodeChar == L'y') || (Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
- break;
- }
- else {
- SctPrint (L"Please press \"Y\" or \"N\"");
- }
- }
-
- //
- // BufferSize is smaller than the received Packets.
- //
- BufferSize = 0;
- Status = SnpInterface->Receive (SnpInterface, 0, &BufferSize, Buffer, NULL, NULL, 0);
- if (Status == EFI_BUFFER_TOO_SMALL) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- } else {
- AssertionType = 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 = 1024;
- Status = SnpInterface->Receive (SnpInterface, 0, &BufferSize, Buffer, NULL, NULL, 0);
-
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- if (EFI_ERROR(Status) || SnpInterface->Mode->State != EfiSimpleNetworkInitialized) {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
- SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable1);
-
- //
- // Verify the functionality manually.
- //
- LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)Buffer, (UINT32)BufferSize/2, EFI_DUMP_HEX);
- SctPrint (L"Please verify whether the received packet is right?\nRight press \"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 == L'Y') || (Key.UnicodeChar == L'y') || (Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
- break;
- }
- else {
- SctPrint (L"Please press \"Y\" or \"N\"");
- }
- }
- if ((Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
- AssertionType = 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 = 1024;
- StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
-
- //
- // Get the Statistics before invoke the Receive();
- //
- SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
-
- //
- // 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 == L'Y') || (Key.UnicodeChar == L'y') || (Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
- break;
- }
- else {
- SctPrint (L"Please press \"Y\" or \"N\"");
- }
- }
- Status = SnpInterface->Receive (SnpInterface, &HeaderSize, &BufferSize, Buffer, &SrcAddr, &DestAddr, &Protocol);
-
- AssertionType = EFI_TEST_ASSERTION_PASSED;
- if (EFI_ERROR(Status) || SnpInterface->Mode->State != EfiSimpleNetworkInitialized) {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
- SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable1);
-
- //
- // Verify the functionality manually.
- //
- LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)Buffer, (UINT32)BufferSize/2, EFI_DUMP_HEX);
- LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&SrcAddr, sizeof (EFI_MAC_ADDRESS)/2, EFI_DUMP_HEX);
- LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&DestAddr, sizeof (EFI_MAC_ADDRESS)/2, EFI_DUMP_HEX);
- LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&Protocol, sizeof (UINT16)/2, EFI_DUMP_HEX);
- SctPrint (L"Please verify whether the received packet is right?\nRight press \"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 == L'Y') || (Key.UnicodeChar == L'y') || (Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
- break;
- }
- else {
- SctPrint (L"Please press \"Y\" or \"N\"");
- }
- }
- if ((Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
- AssertionType = 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 case",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
- //
- // Restore SNP State
- //
- if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Shutdown (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
-
- Status = SnpInterface->Stop (SnpInterface);
- if (EFI_ERROR(Status)) {
- return Status;
- }
- }
-
- return EFI_SUCCESS;
-}
-
+ );
+ }
+
+ //
+ // Restore SNP State
+ //
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = SnpInterface->Stop (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ SctPrint (L"\nNow the machine can be reconnected to the LAN, press any key 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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the Logginh Library Interface
+ //
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiTestLoggingLibraryGuid,
+ (VOID **) &LoggingLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkInitialized.
+ // If not, change the state to EfiSimpleNetworkInitialized.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Start (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = SnpInterface->Initialize (SnpInterface, 0, 0);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ //
+ // Initialize the variables.
+ //
+
+ Buffer = NULL;
+ HeaderSize = 0;
+ BufferSize = 0;
+ SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0xFF);
+ SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0xFF);
+ Protocol = 0;
+ Status = gtBS->AllocatePool (EfiLoaderData, 1024, (VOID **) &Buffer);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Assertion Point 4.12.2.2
+ // Call Transmit() with HeaderSize != 0
+ //
+
+ //Need to put correct conten of a packet into the Buffer.
+ SctSetMem (Buffer, 1024, 0x0);
+ HeaderSize = SnpInterface->Mode->MediaHeaderSize;
+ BufferSize = 128;
+ StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
+
+ Protocol = 0x0806;
+
+ //
+ // Get the Statistics before invoke the Transmit();
+ //
+ SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
+
+ Status = SnpInterface->Transmit (SnpInterface, HeaderSize, BufferSize, Buffer, &SnpInterface->Mode->CurrentAddress, &DestAddr, &Protocol);
+
+ //
+ // Wait the package to be sent
+ //
+ if (!EFI_ERROR(Status)) {
+ StatCode =gtBS->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 = 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 = SnpInterface->GetStatus (SnpInterface, &IntStatus, &TxBuf);
+
+ 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 == Buffer) {
+ break;
+ }
+
+ if (!EFI_ERROR(gtBS->CheckEvent (TimeoutEvent))) {
+ StatCode = 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 = EFI_TEST_ASSERTION_PASSED;
+ if (EFI_ERROR(Status) || SnpInterface->Mode->State != EfiSimpleNetworkInitialized) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+
+ StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
+ SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable1);
+
+ //
+ // 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 == L'Y') || (Key.UnicodeChar == L'y') || (Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
+ break;
+ }
+ else {
+ SctPrint (L"Please press \"Y\" or \"N\"\n");
+ }
+ }
+ if ((Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid024,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.Transmit - Invoke Transmit() with HeaderSize != 0 and verify interface correctness within test case",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
+ //
+ // Restore SNP State
+ //
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = 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 = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiStandardTestLibraryGuid,
+ (VOID **) &StandardLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the Logginh Library Interface
+ //
+ Status = gtBS->HandleProtocol (
+ SupportHandle,
+ &gEfiTestLoggingLibraryGuid,
+ (VOID **) &LoggingLib
+ );
+
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ //
+ // Get the EFI_SIMPLE_NETWORK_PROTOCOL Protocol interface to be tested
+ //
+ SnpInterface = (EFI_SIMPLE_NETWORK_PROTOCOL *)ClientInterface;
+
+ //
+ // Check whether the state of network interface is EfiSimpleNetworkInitialized.
+ // If not, change the state to EfiSimpleNetworkInitialized.
+ //
+ State1 = SnpInterface->Mode->State;
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Start (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ State2 = SnpInterface->Mode->State;
+ if (State2 == EfiSimpleNetworkStarted) {
+ Status = SnpInterface->Initialize (SnpInterface, 0, 0);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ //
+ // Enable receive filters
+ //
+ Status = SnpInterface->ReceiveFilters (
+ SnpInterface,
+ EFI_SIMPLE_NETWORK_RECEIVE_UNICAST|EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST,
+ 0,
+ FALSE,
+ 0,
+ NULL
+ );
+ if (EFI_ERROR(Status)) {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gTestGenericFailureGuid,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.Receive - Enable ReceiveFilters",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ return Status;
+ }
+
+ //
+ // Initialize the variables.
+ //
+
+ Buffer = NULL;
+ HeaderSize = 0;
+ BufferSize = 0;
+ SctSetMem (&SrcAddr, sizeof (EFI_MAC_ADDRESS), 0x0);
+ SctSetMem (&DestAddr, sizeof (EFI_MAC_ADDRESS), 0x0);
+ Protocol = 0;
+ Status = gtBS->AllocatePool (EfiLoaderData, 1024, (VOID **) &Buffer);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ SctSetMem (Buffer, 1024, 0x0);
+ StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
+
+ //
+ // Get the Statistics before invoke the Receive();
+ //
+ SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
+
+ //
+ // 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 == L'Y') || (Key.UnicodeChar == L'y') || (Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
+ break;
+ }
+ else {
+ SctPrint (L"Please press \"Y\" or \"N\"");
+ }
+ }
+
+ //
+ // BufferSize is smaller than the received Packets.
+ //
+ BufferSize = 0;
+ Status = SnpInterface->Receive (SnpInterface, 0, &BufferSize, Buffer, NULL, NULL, 0);
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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 = 1024;
+ Status = SnpInterface->Receive (SnpInterface, 0, &BufferSize, Buffer, NULL, NULL, 0);
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (EFI_ERROR(Status) || SnpInterface->Mode->State != EfiSimpleNetworkInitialized) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+
+ StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
+ SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable1);
+
+ //
+ // Verify the functionality manually.
+ //
+ LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)Buffer, (UINT32)BufferSize/2, EFI_DUMP_HEX);
+ SctPrint (L"Please verify whether the received packet is right?\nRight press \"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 == L'Y') || (Key.UnicodeChar == L'y') || (Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
+ break;
+ }
+ else {
+ SctPrint (L"Please press \"Y\" or \"N\"");
+ }
+ }
+ if ((Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
+ AssertionType = 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 = 1024;
+ StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
+
+ //
+ // Get the Statistics before invoke the Receive();
+ //
+ SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
+
+ //
+ // 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 == L'Y') || (Key.UnicodeChar == L'y') || (Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
+ break;
+ }
+ else {
+ SctPrint (L"Please press \"Y\" or \"N\"");
+ }
+ }
+ Status = SnpInterface->Receive (SnpInterface, &HeaderSize, &BufferSize, Buffer, &SrcAddr, &DestAddr, &Protocol);
+
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (EFI_ERROR(Status) || SnpInterface->Mode->State != EfiSimpleNetworkInitialized) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
+
+ StatisticsSize = sizeof (EFI_NETWORK_STATISTICS);
+ SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable1);
+
+ //
+ // Verify the functionality manually.
+ //
+ LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)Buffer, (UINT32)BufferSize/2, EFI_DUMP_HEX);
+ LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&SrcAddr, sizeof (EFI_MAC_ADDRESS)/2, EFI_DUMP_HEX);
+ LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&DestAddr, sizeof (EFI_MAC_ADDRESS)/2, EFI_DUMP_HEX);
+ LoggingLib->DumpBuf (LoggingLib, EFI_VERBOSE_LEVEL_DEFAULT, (CHAR16*)&Protocol, sizeof (UINT16)/2, EFI_DUMP_HEX);
+ SctPrint (L"Please verify whether the received packet is right?\nRight press \"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 == L'Y') || (Key.UnicodeChar == L'y') || (Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
+ break;
+ }
+ else {
+ SctPrint (L"Please press \"Y\" or \"N\"");
+ }
+ }
+ if ((Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
+ AssertionType = 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 case",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+ //
+ // Restore SNP State
+ //
+ if (State1 == EfiSimpleNetworkStopped) {
+ Status = SnpInterface->Shutdown (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+
+ Status = SnpInterface->Stop (SnpInterface);
+ if (EFI_ERROR(Status)) {
+ return Status;
+ }
+ }
+
+ return EFI_SUCCESS;
+}
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/PxeBaseCode/BlackBoxTest/PxeBaseCodeBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/PxeBaseCode/BlackBoxTest/PxeBaseCodeBBTestFunction.c
index b9692461..ce945f19 100644
--- a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/PxeBaseCode/BlackBoxTest/PxeBaseCodeBBTestFunction.c
+++ b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/PxeBaseCode/BlackBoxTest/PxeBaseCodeBBTestFunction.c
@@ -2,15 +2,16 @@
Copyright 2006 - 2016 Unified EFI, Inc.<BR>
Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2022, ARM Limited. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
+ which accompanies this distribution. The full text of the license may be 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 IMPLIED.
-
+
**/
/*++
@@ -24,7 +25,7 @@ Abstract:
--*/
-#include "SctLib.h"
+#include "SctLib.h"
#include "PxeBaseCodeBBTestMain.h"
#include "PxeBaseCodeBBTestSupport.h"
@@ -203,7 +204,7 @@ BBTestUdpReadFuncSrcPortFilter (
/**
* 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.
+ * 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"
);
- }
+ }
if (BcInterface->Mode->IcmpErrorReceived != FALSE) {
AssertionType = EFI_TEST_ASSERTION_FAILED;
StandardLib->RecordMessage (
@@ -605,7 +606,7 @@ BBTestNewStartFunctionTest (
return Status;
}
}
-
+
//
// Enable EFI_PXE_BASE_CODE_PROTOCOL Protocol interface in IPv6
//
@@ -627,8 +628,8 @@ BBTestNewStartFunctionTest (
(UINTN)__LINE__,
Status
);
-
-
+
+
if (AssertionType == EFI_TEST_ASSERTION_PASSED) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
if (BcInterface->Mode->Started != TRUE) {
@@ -720,7 +721,7 @@ BBTestNewStartFunctionTest (
L"Mode->PxeBisReplyReceived - %s\r\n",
BcInterface->Mode->PxeBisReplyReceived ? L"TRUE" : L"FALSE"
);
- }
+ }
if (BcInterface->Mode->IcmpErrorReceived != FALSE) {
AssertionType = EFI_TEST_ASSERTION_FAILED;
StandardLib->RecordMessage (
@@ -797,7 +798,7 @@ BBTestNewStartFunctionTest (
L"IS_PXE_PACKET_ZEROED(Mode->ProxyOffer) - Fail\r\n"
);
}
-
+
if (IS_PXE_PACKET_ZEROED(&BcInterface->Mode->PxeDiscover) == FALSE) {
AssertionType = EFI_TEST_ASSERTION_FAILED;
StandardLib->RecordMessage (
@@ -944,13 +945,13 @@ BBTestNewStartFunctionTest (
);
}
}
-
+
return Status;
}
/**
* 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.
+ * 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;
Index = 0;
-
+
//
// Get the Standard Library Interface
//
@@ -1091,7 +1092,7 @@ BBTestNewSetIpFilterFunctionTest (
return Status;
}
}
-
+
//
// Enable EFI_PXE_BASE_CODE_PROTOCOL Protocol interface in IPv6
//
@@ -1109,16 +1110,16 @@ BBTestNewSetIpFilterFunctionTest (
);
return Status;
}
-
+
SctSetMem (&BcIpFilter, sizeof (BcIpFilter), 0);
BcIpFilter.Filters = EFI_PXE_BASE_CODE_IP_FILTER_STATION_IP;
BcIpFilter.IpCnt = 2;
-
+
for (Index = 0; Index < 16; Index++) {
BcIpFilter.IpList[0].v6.Addr[Index] = Index;
BcIpFilter.IpList[1].v6.Addr[Index] = 16 - Index;
}
-
+
Status = BcInterface->SetIpFilter (BcInterface, &BcIpFilter);
if (Status == EFI_SUCCESS) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
@@ -1135,7 +1136,7 @@ BBTestNewSetIpFilterFunctionTest (
(UINTN)__LINE__,
Status
);
-
+
if (TRUE == IsIpFilterEqual (&BcIpFilter, &(BcInterface->Mode->IpFilter))){
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
@@ -1158,7 +1159,7 @@ BBTestNewSetIpFilterFunctionTest (
/**
* 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.
+ * 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
- );
+ );
}
//
@@ -1290,7 +1291,7 @@ BBTestNewStopFunctionTest (
__FILE__,
(UINTN)__LINE__,
Status
- );
+ );
return Status;
}
@@ -1607,8 +1608,8 @@ BBTestStartFunctionTest (
);
}
if ((0 != BcInterface->Mode->IpFilter.Filters) || (0 != BcInterface->Mode->IpFilter.IpCnt)) {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- StandardLib->RecordMessage (
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ StandardLib->RecordMessage (
StandardLib,
EFI_VERBOSE_LEVEL_DEFAULT,
L"The Mode->IpFilter.Filters or Mode->IpFilter.IpCnt field 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 (
}
Status = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
- if (EFI_ERROR(Status))
- {
+ if (EFI_ERROR(Status)) {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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;
//
// Get the Standard Library Interface
@@ -2296,8 +2302,12 @@ BBTestUdpWriteFunctionTest (
}
Status = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
- if (EFI_ERROR(Status))
- {
+ if (EFI_ERROR(Status)) {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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;
//
// Get the Support Library Interface
@@ -2473,8 +2484,12 @@ BBTestUdpReadFunctionTest (
}
Status = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
- if (EFI_ERROR(Status))
- {
+ if (EFI_ERROR(Status)) {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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 (
}
Status = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
- if (EFI_ERROR(Status))
- {
+ if (EFI_ERROR(Status)) {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/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 @@
Copyright 2006 - 2016 Unified EFI, Inc.<BR>
Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2022, ARM Limited. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
+ which accompanies this distribution. The full text of the license may be 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 IMPLIED.
-
+
**/
/*++
@@ -24,7 +25,7 @@ Abstract:
--*/
-#include "SctLib.h"
+#include "SctLib.h"
#include "SimpleNetworkBBTestMain.h"
/**
@@ -100,7 +101,7 @@ BBTestStartConformanceTest (
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// restore SNP status
//
@@ -108,7 +109,7 @@ BBTestStartConformanceTest (
Status1 = SnpInterface->Initialize(SnpInterface, 0, 0);
if (EFI_ERROR(Status1)) {
return Status1;
- }
+ }
}
StandardLib->RecordAssertion (
@@ -206,7 +207,7 @@ BBTestStopConformanceTest (
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Restore SNP status
//
@@ -311,10 +312,10 @@ BBTestInitializeConformanceTest (
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Restore SNP status
- //
+ //
if (State1 != EfiSimpleNetworkStopped) {
Status1 = SnpInterface->Start (SnpInterface);
if (EFI_ERROR(Status1)) {
@@ -332,7 +333,7 @@ BBTestInitializeConformanceTest (
}
}
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
@@ -416,16 +417,19 @@ BBTestResetConformanceTest (
// Call Reset() function when network interface not start.
//
Status = SnpInterface->Reset (SnpInterface, FALSE);
-
if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
}
-
+
//
// Restore SNP status
- //
+ //
if (State1 != EfiSimpleNetworkStopped) {
Status1 = SnpInterface->Start (SnpInterface);
if (EFI_ERROR(Status1)) {
@@ -450,7 +454,7 @@ BBTestResetConformanceTest (
(UINTN)__LINE__,
Status
);
-
+
return EFI_SUCCESS;
}
@@ -528,7 +532,7 @@ BBTestShutdownConformanceTest (
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Restore SNP status
//
@@ -626,32 +630,27 @@ BBTestReceiveFilterConformanceTest (
// Call ReceiveFilters() function if network interface not start.
//
Status = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, NULL);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid006,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() 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 ReceiveFilters() 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 (
}
Status = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, FALSE, 0, NULL);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_DEVICE_ERROR) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_DEVICE_ERROR) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid007,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() 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 ReceiveFilters() 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 = SnpInterface->ReceiveFilters (SnpInterface, ~(SnpInterface->Mode->ReceiveFilterMask), 0, FALSE, 0, NULL);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid008,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() with invalid Enable.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
}
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestConformanceAssertionGuid008,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke ReceiveFilters() 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] = 0x02;
Status = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, SnpInterface->Mode->MaxMCastFilterCount + 1, &MAC);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = 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->MaxMCastFilterCount.",
- 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->MaxMCastFilterCount.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
+
Status = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 0, &MAC);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = 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
+ );
+
Status = SnpInterface->ReceiveFilters (SnpInterface, EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST, 0, FALSE, 1, NULL);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"ReceiveFilters isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_INVALID_PARAMETER) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid010,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.ReceiveFilters - Invoke 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 - Invoke ReceiveFilters() with MCastFilterCnt not match MCastFilter.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
}
//
@@ -912,7 +886,7 @@ BBTestStationAddressConformanceTest (
// save current snp state
//
State2 = SnpInterface->Mode->State;
-
+
//
// Assertion Point 5.7.2.2
// Call StationAddress() function if network interface not initialized.
@@ -923,71 +897,59 @@ BBTestStationAddressConformanceTest (
}
StatusBuf[1] = SnpInterface->StationAddress (SnpInterface, TRUE, NULL);
-
+
//
// Restore SNP Status
//
if (State1 == EfiSimpleNetworkInitialized) {
- Status = SnpInterface->Initialize(SnpInterface, 0, 0);
+ Status = SnpInterface->Initialize(SnpInterface, 0, 0);
if (EFI_ERROR(Status)){
return Status;
}
}
-
- if ((StatusBuf[0] == EFI_INVALID_PARAMETER) || (StatusBuf[0] == EFI_UNSUPPORTED)) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"StationAddress isn't supported, Status - %r\n",
- StatusBuf[0]
- );
+
+ if ((StatusBuf[0] == EFI_NOT_STARTED) && (State2 == EfiSimpleNetworkStopped)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if ((StatusBuf[0] == EFI_NOT_STARTED) && (State2 == EfiSimpleNetworkStopped)) {
+ if ((StatusBuf[0] == EFI_INVALID_PARAMETER) || (StatusBuf[0] == EFI_UNSUPPORTED)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid011,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke StationAddress() when network interface not start.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- StatusBuf[0]
- );
}
-
- if ((StatusBuf[1] == EFI_INVALID_PARAMETER) || (StatusBuf[1] == 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 StationAddress() when network interface not start.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[0]
+ );
+
+ if (StatusBuf[1] == EFI_DEVICE_ERROR) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (StatusBuf[1] == EFI_DEVICE_ERROR) {
+ if ((StatusBuf[1] == EFI_INVALID_PARAMETER) || (StatusBuf[1] == EFI_UNSUPPORTED)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid012,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke StationAddress() when network interface not initialized.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- StatusBuf[1]
- );
}
-
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestConformanceAssertionGuid012,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke StationAddress() when network interface not initialized.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[1]
+ );
+
if (State1 == EfiSimpleNetworkStopped) {
- Status = SnpInterface->Stop (SnpInterface);
+ Status = SnpInterface->Stop (SnpInterface);
if (EFI_ERROR(Status)){
return Status;
}
@@ -1067,30 +1029,25 @@ BBTestStatisticsConformanceTest (
// Call Statistics() function while network interface is not started.
//
Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"Statistics isn't supported, Status - %r\n",
- Status
- );
+ if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if ((Status == EFI_NOT_STARTED) && (SnpInterface->Mode->State == EfiSimpleNetworkStopped)) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid014,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() 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 Statistics() while network interface not started.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
//
// Assertion Point 5.8.2.2
@@ -1102,30 +1059,25 @@ BBTestStatisticsConformanceTest (
}
Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"Statistics isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_DEVICE_ERROR) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_DEVICE_ERROR) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid015,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() 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 Statistics() while network interface is not initialized.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
//
// Assertion Point 5.8.2.3
@@ -1143,30 +1095,25 @@ BBTestStatisticsConformanceTest (
StatisticsSize = 0;
Status = SnpInterface->Statistics (SnpInterface, FALSE, &StatisticsSize, &StatisticsTable);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"Statistics isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_BUFFER_TOO_SMALL) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_BUFFER_TOO_SMALL) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestConformanceAssertionGuid017,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() with small buffer.",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
}
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestConformanceAssertionGuid017,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.Statistics - Invoke Statistics() with small buffer.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
//
// Restore SNP State
@@ -1182,7 +1129,7 @@ BBTestStatisticsConformanceTest (
return Status;
}
}
-
+
return EFI_SUCCESS;
}
@@ -1267,7 +1214,7 @@ BBTestMCastIpToMacConformanceTest (
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Restore SNP status
//
@@ -1405,7 +1352,7 @@ BBTestNVDataConformanceTest (
StatusBuf[0] = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamAccessSize, Buffer);
CheckPoint1State = SnpInterface->Mode->State;
-
+
//
// Assertion Point 5.10.2.2
@@ -1425,119 +1372,99 @@ BBTestNVDataConformanceTest (
// Check Point A: "Offset" not be a multiple of NvRamAccessSize
//
StatusBuf[1] = SnpInterface->NvData (SnpInterface, TRUE, (SnpInterface->Mode->NvRamAccessSize/2), SnpInterface->Mode->NvRamAccessSize, Buffer);
-
+
//
// Check Point B: "BufferSize" not be a multiple of NvRamAccessSize
//
StatusBuf[2] = SnpInterface->NvData (SnpInterface, TRUE, 0, (SnpInterface->Mode->NvRamAccessSize/2), Buffer);
-
+
//
// Check Point C: "BufferSize" + "Offset" exceeds "NvRamSize"
//
- StatusBuf[3] = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamSize+100, Buffer);
+ StatusBuf[3] = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamSize+100, Buffer);
- if (StatusBuf[0] == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- StatusBuf[0]
- );
+ if ((StatusBuf[0] == EFI_NOT_STARTED) && (CheckPoint1State == EfiSimpleNetworkStopped)) {
+ AssertionType[0] = EFI_TEST_ASSERTION_PASSED;
} else {
- if ((StatusBuf[0] == EFI_NOT_STARTED) && (CheckPoint1State == EfiSimpleNetworkStopped)) {
+ if (EFI_UNSUPPORTED == StatusBuf[0]) {
AssertionType[0] = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType[0] = 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] == 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() when network interface not start.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[0]
+ );
+
+ if (StatusBuf[1] == EFI_INVALID_PARAMETER) {
+ AssertionType[1] = EFI_TEST_ASSERTION_PASSED;
} else {
- if (StatusBuf[1] == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == StatusBuf[1]) {
AssertionType[1] = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType[1] = 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() with Offset not be a multiple of NvRamAccessSize.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[1]
+ );
- if (StatusBuf[2] == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- StatusBuf[2]
- );
+ if (StatusBuf[2] == EFI_INVALID_PARAMETER) {
+ AssertionType[2] = EFI_TEST_ASSERTION_PASSED;
} else {
- if (StatusBuf[2] == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == StatusBuf[2]) {
AssertionType[2] = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType[2] = 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] == 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() with BufferSize not be a multiple of NvRamAccessSize.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[2]
+ );
+
+ if (StatusBuf[3] == EFI_INVALID_PARAMETER) {
+ AssertionType[3] = EFI_TEST_ASSERTION_PASSED;
} else {
- if (StatusBuf[3] == EFI_INVALID_PARAMETER) {
+ if (EFI_UNSUPPORTED == StatusBuf[3]) {
AssertionType[3] = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType[3] = 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() with BufferSize + Offset exceeds NvRamSize.",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[3]
+ );
//
// Restore SNP Status
@@ -1552,8 +1479,8 @@ BBTestNVDataConformanceTest (
if (EFI_ERROR(Status)) {
return Status;
}
- }
-
+ }
+
Status = gtBS->FreePool (Buffer);
if (EFI_ERROR(Status)) {
return Status;
@@ -1641,7 +1568,7 @@ BBTestGetStatusConformanceTest (
} else {
AssertionType[0] = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Assertion Point 5.11.2.2
// Call GetStatus () function if network interface not initialized.
@@ -1667,7 +1594,7 @@ BBTestGetStatusConformanceTest (
} else {
AssertionType[1] = EFI_TEST_ASSERTION_FAILED;
}
-
+
/*
//
// Assertion Point 5.11.2.3
@@ -1696,7 +1623,7 @@ BBTestGetStatusConformanceTest (
AssertionType[2] = EFI_TEST_ASSERTION_FAILED;
}
*/
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[0],
@@ -1707,7 +1634,7 @@ BBTestGetStatusConformanceTest (
(UINTN)__LINE__,
StatusBuf[0]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[1],
@@ -1718,7 +1645,7 @@ BBTestGetStatusConformanceTest (
(UINTN)__LINE__,
StatusBuf[1]
);
-/*
+/*
StandardLib->RecordAssertion (
StandardLib,
AssertionType[2],
@@ -1729,7 +1656,7 @@ BBTestGetStatusConformanceTest (
(UINTN)__LINE__,
StatusBuf[2]
);
-*/
+*/
//
// Restore SNP State
//
@@ -1902,7 +1829,7 @@ BBTestTransmitConformanceTest (
} else {
AssertionType[4] = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Check Point D: HeaderSize is nonzero and DestAddr is NULL.
@@ -1913,7 +1840,7 @@ BBTestTransmitConformanceTest (
} else {
AssertionType[5] = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Check Point E: HeaderSize is nonzero and Protocol is NULL.
@@ -1935,7 +1862,7 @@ BBTestTransmitConformanceTest (
(UINTN)__LINE__,
StatusBuf[0]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[1],
@@ -1945,7 +1872,7 @@ BBTestTransmitConformanceTest (
__FILE__,
(UINTN)__LINE__,
StatusBuf[1]
- );
+ );
StandardLib->RecordAssertion (
StandardLib,
@@ -1957,7 +1884,7 @@ BBTestTransmitConformanceTest (
(UINTN)__LINE__,
StatusBuf[2]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[3],
@@ -1978,7 +1905,7 @@ BBTestTransmitConformanceTest (
(UINTN)__LINE__,
StatusBuf[4]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[5],
@@ -1989,7 +1916,7 @@ BBTestTransmitConformanceTest (
(UINTN)__LINE__,
StatusBuf[5]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[6],
@@ -2119,7 +2046,7 @@ BBTestReceiveConformanceTest (
} else {
AssertionType[0] = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Assertion Point 5.13.2.2
@@ -2136,7 +2063,7 @@ BBTestReceiveConformanceTest (
} else {
AssertionType[1] = EFI_TEST_ASSERTION_FAILED;
}
-
+
//
// Assertion Point 5.13.2.3
// Call Receive() function with invalid parameters.
@@ -2171,7 +2098,7 @@ BBTestReceiveConformanceTest (
(UINTN)__LINE__,
StatusBuf[0]
);
-
+
StandardLib->RecordAssertion (
StandardLib,
AssertionType[1],
@@ -2208,22 +2135,22 @@ BBTestReceiveConformanceTest (
return Status;
}
}
-
+
#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. because
- // some muticast or broadcast packets maybe on the LAN
+ // some muticast or broadcast packets maybe on the LAN
//
Status = SnpInterface->ReceiveFilters (
- SnpInterface,
- 0,
- EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST | EFI_SIMPLE_NETWORK_RECEIVE_BROADCAST,
- TRUE,
- 0,
- NULL);
+ SnpInterface,
+ 0,
+ EFI_SIMPLE_NETWORK_RECEIVE_MULTICAST | EFI_SIMPLE_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;
}
Status = EFI_SUCCESS;
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/SimpleNetwork/BlackBoxTest/SimpleNetworkBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/IHV/Protocol/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 @@
Copyright 2006 - 2016 Unified EFI, Inc.<BR>
Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2022, ARM Limited. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
+ which accompanies this distribution. The full text of the license may be 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 IMPLIED.
-
+
**/
/*++
@@ -24,7 +25,7 @@ Abstract:
--*/
-#include "SctLib.h"
+#include "SctLib.h"
#include "SimpleNetworkBBTestMain.h"
/**
@@ -463,11 +464,14 @@ BBTestResetFunctionTest (
return Status;
}
- Status = SnpInterface->Reset (SnpInterface, FALSE);
-
AssertionType = EFI_TEST_ASSERTION_PASSED;
+ Status = SnpInterface->Reset (SnpInterface, FALSE);
if (EFI_ERROR(Status)) {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
}
if ((Mode.State != SnpInterface->Mode->State) ||
@@ -529,7 +533,11 @@ BBTestResetFunctionTest (
if (Status == EFI_SUCCESS) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
}
StandardLib->RecordAssertion (
StandardLib,
@@ -758,14 +766,16 @@ BBTestReceiveFilterFunctionTest (
// Check point B. Disable Specified bit.
Status = SnpInterface->ReceiveFilters (SnpInterface, 0, SupportedFilter, FALSE, 0, NULL);
-
if ((Status == EFI_SUCCESS) &&
((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) == 0)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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
);
// Check point A. Enable Specified bit.
Status = SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter, 0, FALSE, 0, NULL);
-
if ((Status == EFI_SUCCESS) &&
((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) != 0)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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
);
// Check point C. Enable and Disable Specified bit together.
Status = SnpInterface->ReceiveFilters (SnpInterface, SupportedFilter, SupportedFilter, FALSE, 0, NULL);
-
if ((Status == EFI_SUCCESS) &&
((SnpInterface->Mode->ReceiveFilterSetting & SupportedFilter) == 0)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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
);
}
@@ -844,9 +858,12 @@ BBTestReceiveFilterFunctionTest (
} else if ((Status == EFI_INVALID_PARAMETER) && (SnpInterface->Mode->MaxMCastFilterCount == 0)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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]
);
}
@@ -869,17 +886,18 @@ BBTestReceiveFilterFunctionTest (
// Assertion Point 4.6.2.3
// Reset multicast receive filters list.
//
-
Status = SnpInterface->ReceiveFilters (SnpInterface, 0, 0, TRUE, 0, NULL);
-
if ((Status == EFI_SUCCESS) &&
(SnpInterface->Mode->State == EfiSimpleNetworkInitialized) &&
(SnpInterface->Mode->MCastFilterCount == 0)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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);
- if ((StatusBuf[0] == EFI_INVALID_PARAMETER) || (StatusBuf[0] == EFI_UNSUPPORTED)) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"StationAddress isn't supported, Status - %r\n",
- StatusBuf[0]
- );
+ if ((StatusBuf[0] == EFI_SUCCESS) &&
+ (!CheckPoint1)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if ((StatusBuf[0] == EFI_SUCCESS) &&
- (!CheckPoint1)) {
+ if ((StatusBuf[0] == EFI_INVALID_PARAMETER) || (StatusBuf[0] == EFI_UNSUPPORTED)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid013,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke ReceiveFilters() to reset its MAC Address and verify interface correctness within test case",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- StatusBuf[0]
- );
}
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid013,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke ReceiveFilters() to reset its MAC Address and verify interface correctness within test case",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ StatusBuf[0]
+ );
- if ((StatusBuf[1] == EFI_INVALID_PARAMETER) || (StatusBuf[1] == EFI_UNSUPPORTED)) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"StationAddress isn't supported, Status - %r\n",
- StatusBuf[1]
- );
+ if ((StatusBuf[1] == EFI_SUCCESS) &&
+ (!CheckPoint2)) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if ((StatusBuf[1] == EFI_SUCCESS) &&
- (!CheckPoint2)) {
+ if ((StatusBuf[1] == EFI_INVALID_PARAMETER) || (StatusBuf[1] == EFI_UNSUPPORTED)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
-
- StandardLib->RecordAssertion (
- StandardLib,
- AssertionType,
- gSimpleNetworkBBTestFunctionAssertionGuid014,
- L"EFI_SIMPLE_NETWORK_PROTOCOL.StationAddress - Invoke ReceiveFilters() 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 ReceiveFilters() 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
@@ -1181,13 +1187,12 @@ BBTestStatisticsFunctionTest (
(!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS)))) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
}
-
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
@@ -1218,13 +1223,12 @@ BBTestStatisticsFunctionTest (
(!SctCompareMem (&StatisticsTable1, &StatisticsTable2, sizeof (EFI_NETWORK_STATISTICS)))) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- AssertionType = EFI_TEST_ASSERTION_FAILED;
- }
-
- if (Status == EFI_UNSUPPORTED) {
- AssertionType = EFI_TEST_ASSERTION_PASSED;
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = 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]
);
//
@@ -1487,92 +1491,76 @@ BBTestNVDataFunctionTest (
//Check Point A(0, n*NvRamAccessSize)
SctSetMem (Buffer, SnpInterface->Mode->NvRamSize, 0x0);
Status = SnpInterface->NvData (SnpInterface, TRUE, 0, SnpInterface->Mode->NvRamSize, Buffer);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_SUCCESS) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = 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() 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 = SnpInterface->NvData (SnpInterface, TRUE, SnpInterface->Mode->NvRamAccessSize, (SnpInterface->Mode->NvRamSize - SnpInterface->Mode->NvRamAccessSize), Buffer);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_SUCCESS) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = 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 correctness within test case",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
}
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid019,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() to read(NvRamAccessSize, (n-1)*NvRamAccessSize) and verify interface correctness 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 = SnpInterface->NvData (SnpInterface, TRUE, (SnpInterface->Mode->NvRamSize - SnpInterface->Mode->NvRamAccessSize), SnpInterface->Mode->NvRamAccessSize, Buffer);
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- Status
- );
+ if (Status == EFI_SUCCESS) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if (Status == EFI_SUCCESS) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = 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 correctness within test case",
- L"%a:%d:Status - %r",
- __FILE__,
- (UINTN)__LINE__,
- Status
- );
}
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gSimpleNetworkBBTestFunctionAssertionGuid020,
+ L"EFI_SIMPLE_NETWORK_PROTOCOL.NvData - Invoke NvData() to read((n-1)*NvRamAccessSize, NvRamAccessSize) and verify interface correctness 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;
}
- if (Status == EFI_UNSUPPORTED) {
- StandardLib->RecordMessage(
- StandardLib,
- EFI_VERBOSE_LEVEL_QUIET,
- L"NvData isn't supported, Status - %r\n",
- Status
- );
+ if ((Status == EFI_SUCCESS) && (!SctCompareMem (Buffer, Buffer1, SnpInterface->Mode->NvRamSize))) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
- if ((Status == EFI_SUCCESS) && (!SctCompareMem (Buffer, Buffer1, SnpInterface->Mode->NvRamSize))) {
+ if (EFI_UNSUPPORTED == Status) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = 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() to write and verify interface correctness within test case",
+ L"%a:%d:Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );
End:
//
@@ -1919,7 +1901,7 @@ BBTestGetStatusFunctionTest (
(UINTN)__LINE__,
Status,
Status1,
- (UINTN)InterruptStatus
+ (UINTN)InterruptStatus
);
}
@@ -2322,9 +2304,14 @@ BBTestReceiveFunctionTest (
NULL
);
if (EFI_ERROR(Status)) {
+ if (EFI_UNSUPPORTED == Status) {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ }
StandardLib->RecordAssertion (
StandardLib,
- EFI_TEST_ASSERTION_FAILED,
+ AssertionType,
gTestGenericFailureGuid,
L"EFI_SIMPLE_NETWORK_PROTOCOL.Receive - Enable ReceiveFilters",
L"%a:%d:Status - %r",
--
2.32.0.windows.1
next reply other threads:[~2022-01-11 21:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-11 21:56 Sunny Wang [this message]
2022-01-31 10:48 ` [edk2-test][PATCH v1] uefi-sct/SctPkg: Allow some SNP functions to return EFI_UNSUPPORTED Sunny Wang
2022-01-31 13:14 ` [edk2-devel] " G Edhaya Chandran
2022-02-03 6:16 ` G Edhaya Chandran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220111215619.1857-1-Sunny.Wang@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox