public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-test][Patch] uefi-sct\SctPkg: Add new test of UFSDeviceConfig Protocol
@ 2018-10-11 15:01 Eric Jin
  2018-10-12  8:22 ` Supreeth Venkatesh
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Jin @ 2018-10-11 15:01 UTC (permalink / raw)
  To: edk2-devel

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Jin <eric.jin@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
---
 uefi-sct/SctPkg/CommonGenFramework.bat             |   1 +
 uefi-sct/SctPkg/CommonGenFramework.sh              |   1 +
 uefi-sct/SctPkg/Config/Data/Category.ini           |   7 +
 .../Protocol/UFSDeviceConfig/BlackBoxTest/Guid.c   |  35 +++
 .../Protocol/UFSDeviceConfig/BlackBoxTest/Guid.h   |  51 ++++
 .../BlackBoxTest/UFSDeviceConfigBBTest.inf         |  53 +++++
 .../UFSDeviceConfigBBTestConformance.c             | 260 +++++++++++++++++++++
 .../BlackBoxTest/UFSDeviceConfigBBTestMain.c       | 123 ++++++++++
 .../BlackBoxTest/UFSDeviceConfigBBTestMain.h       |  92 ++++++++
 uefi-sct/SctPkg/UEFI/Protocol/UFSDeviceConfig.h    | 146 ++++++++++++
 uefi-sct/SctPkg/UEFI/UEFI.dec                      |   1 +
 uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc                  |   1 +
 12 files changed, 771 insertions(+)
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.c
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.h
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestConformance.c
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.c
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.h
 create mode 100644 uefi-sct/SctPkg/UEFI/Protocol/UFSDeviceConfig.h

diff --git a/uefi-sct/SctPkg/CommonGenFramework.bat b/uefi-sct/SctPkg/CommonGenFramework.bat
index cf7f619..b566ebf 100644
--- a/uefi-sct/SctPkg/CommonGenFramework.bat
+++ b/uefi-sct/SctPkg/CommonGenFramework.bat
@@ -186,6 +186,7 @@ copy %ProcessorType%\RamDiskProtocolBBTest.efi                %Framework%\Test\
 copy %ProcessorType%\NVMEPassThruBBTest.efi                   %Framework%\Test\ > NUL
 copy %ProcessorType%\EraseBlockBBTest.efi                     %Framework%\Test\ > NUL
 copy %ProcessorType%\SDMMCPassThruBBTest.efi                  %Framework%\Test\ > NUL
+copy %ProcessorType%\UFSDeviceConfigBBTest.efi                %Framework%\Test\ > NUL
 copy %ProcessorType%\ResetNotificationBBTest.efi              %Framework%\Test\ > NUL
 
 rem *********************************************
diff --git a/uefi-sct/SctPkg/CommonGenFramework.sh b/uefi-sct/SctPkg/CommonGenFramework.sh
index a37c76b..9efc7da 100755
--- a/uefi-sct/SctPkg/CommonGenFramework.sh
+++ b/uefi-sct/SctPkg/CommonGenFramework.sh
@@ -219,6 +219,7 @@ then
     cp $ProcessorType/NVMEPassThruBBTest.efi                   $Framework/Test/ > NUL
     cp $ProcessorType/EraseBlockBBTest.efi                     $Framework/Test/ > NUL
     cp $ProcessorType/SDMMCPassThruBBTest.efi                  $Framework/Test/ > NUL
+    cp $ProcessorType/UFSDeviceConfigBBTest.efi                $Framework/Test/ > NUL
     cp $ProcessorType/ResetNotificationBBTest.efi              $Framework/Test/ > NUL
 
     # *********************************************
diff --git a/uefi-sct/SctPkg/Config/Data/Category.ini b/uefi-sct/SctPkg/Config/Data/Category.ini
index 14cb2a2..22dbfa8 100644
--- a/uefi-sct/SctPkg/Config/Data/Category.ini
+++ b/uefi-sct/SctPkg/Config/Data/Category.ini
@@ -404,6 +404,13 @@ Description   =
 
 [Category Data]
 Revision      = 0x00010000
+CategoryGuid  = B81BFAB0-0EB3-4CF9-8465-7FA986361664
+InterfaceGuid = B81BFAB0-0EB3-4CF9-8465-7FA986361664
+Name          = MediaAccessTest\UFSDeviceConfig
+Description   =
+
+[Category Data]
+Revision      = 0x00010000
 CategoryGuid  = 1D85CD7F-F43D-11D2-9A0C-0090273FC14D
 InterfaceGuid = 1D85CD7F-F43D-11D2-9A0C-0090273FC14D
 Name          = StringServiceTest\UnicodeCollationProtocolTest
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.c
new file mode 100644
index 0000000..705ca00
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.c
@@ -0,0 +1,35 @@
+/** @file
+
+  Copyright (c) 2018, 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:
+
+   Guid.c
+
+ Abstract:
+
+   GUIDs auto-generated for EFI test assertion.
+
+--*/
+
+#include "UFSDeviceConfigBBTestMain.h"
+
+
+EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid001 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_001_GUID;
+EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid002 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_002_GUID;
+EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid003 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_003_GUID;
+EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid004 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_004_GUID;
+EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid005 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_005_GUID;
+EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid006 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_006_GUID;
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.h
new file mode 100644
index 0000000..6385320
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.h
@@ -0,0 +1,51 @@
+/** @file
+
+  Copyright (c) 2018, 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:
+
+   Guid.h
+
+ Abstract:
+
+   GUIDs auto-generated for EFI test assertion.
+
+--*/
+
+
+
+
+#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_001_GUID \
+{ 0x2ae62c80, 0x3d9a, 0x43c2, { 0x83, 0xb, 0xbd, 0xd7, 0xd9, 0x92, 0x21, 0x1 } }
+extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid001;
+
+#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_002_GUID \
+{ 0x9f416cd1, 0x7e63, 0x4106, { 0x87, 0xe8, 0xc, 0xd, 0x87, 0xe7, 0x97, 0x5e } }
+extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid002;
+
+#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_003_GUID \
+{ 0xe17a7831, 0x1620, 0x4d71, { 0x90, 0xdd, 0x82, 0x57, 0xda, 0x51, 0x82, 0x13 } }
+extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid003;
+
+#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_004_GUID \
+{ 0x9664372d, 0x4171, 0x41e6, { 0xad, 0xfb, 0x8d, 0xe1, 0x3e, 0xd0, 0x2, 0xe  } }
+extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid004;
+
+#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_005_GUID \
+{ 0xfdea1cff, 0x68af, 0x4808, { 0x89, 0x16, 0x7f, 0x17, 0xa, 0xfc, 0x47, 0xb3 } }
+extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid005;
+
+#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_006_GUID \
+{ 0x1ef56bb1, 0xd8e6, 0x45c1, { 0xbb, 0x95, 0x82, 0x47, 0xf, 0xdd, 0x44, 0x4f } }
+extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid006;
\ No newline at end of file
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf
new file mode 100644
index 0000000..7785e11
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf
@@ -0,0 +1,53 @@
+## @file
+#
+#  Copyright (c) 2018, 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:
+#
+#   UFSDeviceConfigBBTest.inf
+#
+# Abstract:
+#
+#   Component description file for UFS Device Config Protocol Black-Box Test.
+#
+#--*/
+
+[defines]
+  INF_VERSION          = 0x00010005
+  BASE_NAME            = UFSDeviceConfigBBTest
+  FILE_GUID            = FDDC6693-45C7-43D6-B752-F5B57032D37F
+  MODULE_TYPE          = UEFI_DRIVER
+  VERSION_STRING       = 1.0
+  ENTRY_POINT          = InitializeUFSDeviceConfigBBTest
+
+[sources.common]
+  UFSDeviceConfigBBTestConformance.c
+  UFSDeviceConfigBBTestMain.c
+  Guid.c
+  
+[Packages]
+  MdePkg/MdePkg.dec
+  SctPkg/SctPkg.dec
+  SctPkg/UEFI/UEFI.dec
+
+[LibraryClasses]
+  UefiDriverEntryPoint
+  SctLib
+  EfiTestLib
+
+[Protocols]
+  gBlackBoxEfiUFSDeviceConfigProtocolGuid
+
+[Guids]
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestConformance.c
new file mode 100644
index 0000000..4c8f7c5
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestConformance.c
@@ -0,0 +1,260 @@
+/** @file
+
+  Copyright (c) 2018, 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:
+
+    UFSDeviceConfigConformance.c
+
+Abstract:
+
+    for EFI UFS Device Config Protocol's Conformance Test
+
+--*/
+
+#include "UFSDeviceConfigBBTestMain.h"
+
+EFI_STATUS
+BBTestRwUfsDescriptorConfTest (
+  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_UFS_DEVICE_CONFIG_PROTOCOL        *UFSDeviceConfig;
+  EFI_TEST_ASSERTION                    AssertionType;
+  
+  UINT8                                 Descriptor;
+  UINT32                                DescSize;  
+  
+  UFSDeviceConfig = (EFI_UFS_DEVICE_CONFIG_PROTOCOL*)ClientInterface;
+
+  //
+  // Get the Standard Library Interface
+  //
+  Status = gtBS->HandleProtocol (
+                   SupportHandle,
+                   &gEfiStandardTestLibraryGuid,
+                   (VOID **) &StandardLib
+                   );
+
+  if ( EFI_ERROR(Status) ) {
+    StandardLib->RecordAssertion (
+                   StandardLib,
+                   EFI_TEST_ASSERTION_FAILED,
+                   gTestGenericFailureGuid,
+                   L"BS.HandleProtocol - Handle standard test library",
+                   L"%a:%d:Status - %r\n",
+                   __FILE__,
+                   (UINTN)__LINE__,
+                   Status
+                   );
+    return Status;
+  }
+  
+  Status = UFSDeviceConfig->RwUfsDescriptor(UFSDeviceConfig, TRUE, 0, 0, 0, NULL, &DescSize);
+  if (Status == EFI_INVALID_PARAMETER) 
+    AssertionType = EFI_TEST_ASSERTION_PASSED;
+  else
+    AssertionType = EFI_TEST_ASSERTION_FAILED;
+  
+  StandardLib->RecordAssertion (
+                 StandardLib,
+                 AssertionType,
+                 gUFSDeviceConfigBBTestConfAssertionGuid001,
+                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsDescriptor- RwUfsDescriptor() returns EFI_INVALID_PARAMETER when Descriptor is NULL.",
+                 L"%a:%d: Status - %r",
+                 __FILE__,
+                 (UINTN)__LINE__,
+                 Status
+                 );  
+  
+  Status = UFSDeviceConfig->RwUfsDescriptor(UFSDeviceConfig, TRUE, 0, 0, 0, &Descriptor, NULL);
+  if (Status == EFI_INVALID_PARAMETER) 
+    AssertionType = EFI_TEST_ASSERTION_PASSED;
+  else
+    AssertionType = EFI_TEST_ASSERTION_FAILED; 
+
+  StandardLib->RecordAssertion (
+                 StandardLib,
+                 AssertionType,
+                 gUFSDeviceConfigBBTestConfAssertionGuid002,
+                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsDescriptor- RwUfsDescriptor() returns EFI_INVALID_PARAMETER when DescSize is NULL.",
+                 L"%a:%d: Status - %r",
+                 __FILE__,
+                 (UINTN)__LINE__,
+                 Status
+                 );  
+
+
+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+BBTestRwUfsFlagConfTest (
+  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_UFS_DEVICE_CONFIG_PROTOCOL        *UFSDeviceConfig;
+  EFI_TEST_ASSERTION                    AssertionType;
+  
+  UINT8                                 Flag;
+  
+  UFSDeviceConfig = (EFI_UFS_DEVICE_CONFIG_PROTOCOL*)ClientInterface;
+
+  //
+  // Get the Standard Library Interface
+  //
+  Status = gtBS->HandleProtocol (
+                   SupportHandle,
+                   &gEfiStandardTestLibraryGuid,
+                   (VOID **) &StandardLib
+                   );
+
+  if ( EFI_ERROR(Status) ) {
+    StandardLib->RecordAssertion (
+                   StandardLib,
+                   EFI_TEST_ASSERTION_FAILED,
+                   gTestGenericFailureGuid,
+                   L"BS.HandleProtocol - Handle standard test library",
+                   L"%a:%d:Status - %r\n",
+                   __FILE__,
+                   (UINTN)__LINE__,
+                   Status
+                   );
+    return Status;
+  }
+  
+  Status = UFSDeviceConfig->RwUfsFlag(UFSDeviceConfig, TRUE, 0, &Flag);
+  if (Status == EFI_INVALID_PARAMETER) 
+    AssertionType = EFI_TEST_ASSERTION_PASSED;
+  else
+    AssertionType = EFI_TEST_ASSERTION_FAILED;
+  
+  StandardLib->RecordAssertion (
+                 StandardLib,
+                 AssertionType,
+                 gUFSDeviceConfigBBTestConfAssertionGuid003,
+                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsFlag- RwUfsFlag() returns EFI_INVALID_PARAMETER when FlagId is an invalid UFS flag ID.",
+                 L"%a:%d: Status - %r",
+                 __FILE__,
+                 (UINTN)__LINE__,
+                 Status
+                 );  
+  
+  Status = UFSDeviceConfig->RwUfsFlag(UFSDeviceConfig, TRUE, 1, NULL);
+  if (Status == EFI_INVALID_PARAMETER) 
+    AssertionType = EFI_TEST_ASSERTION_PASSED;
+  else
+    AssertionType = EFI_TEST_ASSERTION_FAILED; 
+
+  StandardLib->RecordAssertion (
+                 StandardLib,
+                 AssertionType,
+                 gUFSDeviceConfigBBTestConfAssertionGuid004,
+                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsFlag- RwUfsFlag() returns EFI_INVALID_PARAMETER when Flag is NULL.",
+                 L"%a:%d: Status - %r",
+                 __FILE__,
+                 (UINTN)__LINE__,
+                 Status
+                 );  
+  
+  return EFI_SUCCESS;
+}
+  
+EFI_STATUS
+BBTestRwUfsAttributeConfTest (
+  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_UFS_DEVICE_CONFIG_PROTOCOL        *UFSDeviceConfig;
+  EFI_TEST_ASSERTION                    AssertionType;
+  
+  UINT8                                 Attribute;
+  UINT32                                AttrSize;  
+  
+  UFSDeviceConfig = (EFI_UFS_DEVICE_CONFIG_PROTOCOL*)ClientInterface;
+
+  //
+  // Get the Standard Library Interface
+  //
+  Status = gtBS->HandleProtocol (
+                   SupportHandle,
+                   &gEfiStandardTestLibraryGuid,
+                   (VOID **) &StandardLib
+                   );
+
+  if ( EFI_ERROR(Status) ) {
+    StandardLib->RecordAssertion (
+                   StandardLib,
+                   EFI_TEST_ASSERTION_FAILED,
+                   gTestGenericFailureGuid,
+                   L"BS.HandleProtocol - Handle standard test library",
+                   L"%a:%d:Status - %r\n",
+                   __FILE__,
+                   (UINTN)__LINE__,
+                   Status
+                   );
+    return Status;
+  }
+
+  Status = UFSDeviceConfig->RwUfsAttribute(UFSDeviceConfig, TRUE, 0, 0, 0, NULL, &AttrSize);
+  if (Status == EFI_INVALID_PARAMETER) 
+    AssertionType = EFI_TEST_ASSERTION_PASSED;
+  else
+    AssertionType = EFI_TEST_ASSERTION_FAILED;
+  
+  StandardLib->RecordAssertion (
+                 StandardLib,
+                 AssertionType,
+                 gUFSDeviceConfigBBTestConfAssertionGuid005,
+                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsAttribute- RwUfsAttribute() returns EFI_INVALID_PARAMETER when Attribute is NULL.",
+                 L"%a:%d: Status - %r",
+                 __FILE__,
+                 (UINTN)__LINE__,
+                 Status
+                 );  
+  
+  Status = UFSDeviceConfig->RwUfsAttribute(UFSDeviceConfig, TRUE, 0, 0, 0, &Attribute, NULL);
+  if (Status == EFI_INVALID_PARAMETER) 
+    AssertionType = EFI_TEST_ASSERTION_PASSED;
+  else
+    AssertionType = EFI_TEST_ASSERTION_FAILED; 
+
+  StandardLib->RecordAssertion (
+                 StandardLib,
+                 AssertionType,
+                 gUFSDeviceConfigBBTestConfAssertionGuid006,
+                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsAttribute- RwUfsAttribute() returns EFI_INVALID_PARAMETER when AttrSize is NULL.",
+                 L"%a:%d: Status - %r",
+                 __FILE__,
+                 (UINTN)__LINE__,
+                 Status
+                 );    
+  
+  return EFI_SUCCESS;
+}
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.c
new file mode 100644
index 0000000..04caf3c
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.c
@@ -0,0 +1,123 @@
+/** @file
+
+  Copyright (c) 2018, 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:
+
+  UFSDeviceConfigBBTestMain.c
+
+Abstract:
+
+  Test Driver of UFS Device Config Protocol
+
+--*/
+
+
+#include "UFSDeviceConfigBBTestMain.h"
+
+#define EFI_UFS_DEVICE_CONFIG_TEST_GUID \
+  { 0xb81bfab0, 0xeb3, 0x4cf9, { 0x84, 0x65, 0x7f, 0xa9, 0x86, 0x36, 0x16, 0x64}}
+
+//
+// Global variables
+//
+EFI_HANDLE mImageHandle;
+
+
+EFI_BB_TEST_PROTOCOL *gBBTestProtocolInterface;
+
+EFI_BB_TEST_PROTOCOL_FIELD gBBTestProtocolField = {
+  EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_REVISION,
+  EFI_UFS_DEVICE_CONFIG_TEST_GUID,
+  L"UFS Device Config Protocol Test",
+  L"UEFI UFS Device Config Protocol Black-Box Test"
+};
+
+EFI_GUID gSupportProtocolGuid[] = {
+  EFI_STANDARD_TEST_LIBRARY_GUID,
+  EFI_NULL_GUID
+};
+
+EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
+  {
+    EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0101,
+    L"RwUfsDescriptorConformance",
+    L"Conformance auto test for RwUfsDescriptor",
+    EFI_TEST_LEVEL_MINIMAL,
+    gSupportProtocolGuid,
+    EFI_TEST_CASE_AUTO,
+    BBTestRwUfsDescriptorConfTest
+  },
+    {
+    EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0102,
+    L"RwUfsFlagConformance",
+    L"Conformance auto test for RwUfsFlag",
+    EFI_TEST_LEVEL_MINIMAL,
+    gSupportProtocolGuid,
+    EFI_TEST_CASE_AUTO,
+    BBTestRwUfsFlagConfTest
+  },
+    {
+    EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0103,
+    L"RwUfsAttributeConformance",
+    L"Conformance auto test for RwUfsAttribute",
+    EFI_TEST_LEVEL_MINIMAL,
+    gSupportProtocolGuid,
+    EFI_TEST_CASE_AUTO,
+    BBTestRwUfsAttributeConfTest
+  },
+ 0
+};
+
+
+EFI_STATUS
+InitializeUFSDeviceConfigBBTest (
+  IN EFI_HANDLE                   ImageHandle,
+  IN EFI_SYSTEM_TABLE             *SystemTable
+  )
+{
+
+  EfiInitializeTestLib (ImageHandle, SystemTable);
+
+  //
+  // initialize test utility lib
+  //
+
+  SctInitializeLib (ImageHandle, SystemTable);
+
+  mImageHandle = ImageHandle;
+
+  return EfiInitAndInstallBBTestInterface (
+             &ImageHandle,
+             &gBBTestProtocolField,
+             gBBTestEntryField,
+             UnloadUFSDeviceConfigBBTest,
+             &gBBTestProtocolInterface
+             );
+
+}
+
+
+EFI_STATUS
+UnloadUFSDeviceConfigBBTest (
+  IN EFI_HANDLE                   ImageHandle
+  )
+{
+
+  return EfiUninstallAndFreeBBTestInterface (
+           ImageHandle,
+           gBBTestProtocolInterface
+           );
+}
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.h
new file mode 100644
index 0000000..61c32ce
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.h
@@ -0,0 +1,92 @@
+/** @file
+
+  Copyright (c) 2018, 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:
+
+  UFSDeviceConfigBBTestMain.h
+
+Abstract:
+
+  Test Driver of UFS Device Config Protocol header file
+
+--*/
+
+#ifndef _UFS_DEVICE_CONFIG_BB_TEST_MAIN
+#define _UFS_DEVICE_CONFIG_BB_TEST_MAIN
+
+#include <Efi.h>
+#include <Library/EfiTestLib.h>
+#include <SctLib.h>
+#include <UEFI/Protocol/UFSDeviceConfig.h>
+#include "Guid.h"
+
+
+#define EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_REVISION    0x00010000
+
+//
+// Entry GUIDs for Conf Test
+//
+#define EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0101 \
+{ 0xd30731cd, 0xa679, 0x41fc, { 0x9f, 0xa6, 0x65, 0x27, 0xab, 0x62, 0x4a, 0x5d  }}
+
+#define EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0102 \
+{ 0xecbc61af, 0x878d, 0x4215, { 0x87, 0xb, 0xed, 0xf0, 0x2c, 0xf4, 0x5a, 0x96 }}
+
+#define EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0103 \
+{ 0x52834ee4, 0x611e, 0x4995, { 0xae, 0xc3, 0x72, 0xf5, 0x8, 0x2b, 0x18, 0x4f }}
+
+
+//
+//
+//
+EFI_STATUS
+InitializeUFSDeviceConfigBBTest (
+  IN EFI_HANDLE                   ImageHandle,
+  IN EFI_SYSTEM_TABLE             *SystemTable
+  );
+  
+EFI_STATUS
+UnloadUFSDeviceConfigBBTest (
+  IN EFI_HANDLE                   ImageHandle
+  ); 
+  
+//
+//Test Cases
+//
+EFI_STATUS
+BBTestRwUfsDescriptorConfTest (
+  IN EFI_BB_TEST_PROTOCOL       *This,
+  IN VOID                       *ClientInterface,
+  IN EFI_TEST_LEVEL             TestLevel,
+  IN EFI_HANDLE                 SupportHandle
+  );
+  
+EFI_STATUS
+BBTestRwUfsFlagConfTest (
+  IN EFI_BB_TEST_PROTOCOL       *This,
+  IN VOID                       *ClientInterface,
+  IN EFI_TEST_LEVEL             TestLevel,
+  IN EFI_HANDLE                 SupportHandle
+  );
+  
+EFI_STATUS
+BBTestRwUfsAttributeConfTest (
+  IN EFI_BB_TEST_PROTOCOL       *This,
+  IN VOID                       *ClientInterface,
+  IN EFI_TEST_LEVEL             TestLevel,
+  IN EFI_HANDLE                 SupportHandle
+  );
+
+#endif
diff --git a/uefi-sct/SctPkg/UEFI/Protocol/UFSDeviceConfig.h b/uefi-sct/SctPkg/UEFI/Protocol/UFSDeviceConfig.h
new file mode 100644
index 0000000..aec3da7
--- /dev/null
+++ b/uefi-sct/SctPkg/UEFI/Protocol/UFSDeviceConfig.h
@@ -0,0 +1,146 @@
+/** @file
+
+  Copyright (c) 2018, 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:
+
+  UFSDeviceConfig.h
+
+Abstract:
+
+  UFS Device Config protocol from the UEFI specification.
+
+--*/
+
+#ifndef _UFS_DEVICE_CONFIG_PROTOCOL_H_
+#define _UFS_DEVICE_CONFIG_PROTOCOL_H_
+
+#define EFI_UFS_DEVICE_CONFIG_GUID \
+  { 0xb81bfab0, 0xeb3, 0x4cf9, { 0x84, 0x65, 0x7f, 0xa9, 0x86, 0x36, 0x16, 0x64 }}
+
+
+//
+// Forward reference for pure ANSI compatability
+//
+typedef struct _EFI_UFS_DEVICE_CONFIG_PROTOCOL  EFI_UFS_DEVICE_CONFIG_PROTOCOL;
+
+/**
+  Read or write specified device descriptor of a UFS device.
+
+  The service is used to read/write UFS device descriptors. The consumer of this API is responsible
+  for allocating the data buffer pointed by Descriptor.
+
+  @param[in]      This          The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.
+  @param[in]      Read          The boolean variable to show r/w direction.
+  @param[in]      DescId        The ID of device descriptor.
+  @param[in]      Index         The Index of device descriptor.
+  @param[in]      Selector      The Selector of device descriptor.
+  @param[in, out] Descriptor    The buffer of device descriptor to be read or written.
+  @param[in, out] DescSize      The size of device descriptor buffer. On input, the size, in bytes,
+                                of the data buffer specified by Descriptor. On output, the number
+                                of bytes that were actually transferred.
+
+  @retval EFI_SUCCESS           The device descriptor is read/written successfully.
+  @retval EFI_INVALID_PARAMETER This is NULL or Descriptor is NULL or DescSize is NULL.
+                                DescId, Index and Selector are invalid combination to point to a
+                                type of UFS device descriptor.
+  @retval EFI_DEVICE_ERROR      The device descriptor is not read/written successfully.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UFS_DEVICE_CONFIG_RW_DESCRIPTOR) (
+  IN EFI_UFS_DEVICE_CONFIG_PROTOCOL    *This,
+  IN BOOLEAN                           Read,
+  IN UINT8                             DescId,
+  IN UINT8                             Index,
+  IN UINT8                             Selector,
+  IN OUT UINT8                         *Descriptor,
+  IN OUT UINT32                        *DescSize
+  );
+
+/**
+  Read or write specified flag of a UFS device.
+
+  The service is used to read/write UFS flag descriptors. The consumer of this API is responsible
+  for allocating the buffer pointed by Flag. The buffer size is 1 byte as UFS flag descriptor is
+  just a single Boolean value that represents a TRUE or FALSE, '0' or '1', ON or OFF type of value.
+
+  @param[in]      This          The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.
+  @param[in]      Read          The boolean variable to show r/w direction.
+  @param[in]      FlagId        The ID of flag to be read or written.
+  @param[in, out] Flag          The buffer to set or clear flag.
+
+  @retval EFI_SUCCESS           The flag descriptor is set/clear successfully.
+  @retval EFI_INVALID_PARAMETER This is NULL or Flag is NULL.
+                                FlagId is an invalid UFS flag ID.
+  @retval EFI_DEVICE_ERROR      The flag is not set/clear successfully.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UFS_DEVICE_CONFIG_RW_FLAG) (
+  IN EFI_UFS_DEVICE_CONFIG_PROTOCOL    *This,
+  IN BOOLEAN                           Read,
+  IN UINT8                             FlagId,
+  IN OUT UINT8                         *Flag
+  );
+
+/**
+  Read or write specified attribute of a UFS device.
+
+  The service is used to read/write UFS attributes. The consumer of this API is responsible for
+  allocating the data buffer pointed by Attribute.
+
+  @param[in]      This          The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.
+  @param[in]      Read          The boolean variable to show r/w direction.
+  @param[in]      AttrId        The ID of Attribute.
+  @param[in]      Index         The Index of Attribute.
+  @param[in]      Selector      The Selector of Attribute.
+  @param[in, out] Attribute     The buffer of Attribute to be read or written.
+  @param[in, out] AttrSize      The size of Attribute buffer. On input, the size, in bytes, of the
+                                data buffer specified by Attribute. On output, the number of bytes
+                                that were actually transferred.
+
+  @retval EFI_SUCCESS           The attribute is read/written successfully.
+  @retval EFI_INVALID_PARAMETER This is NULL or Attribute is NULL or AttrSize is NULL.
+                                AttrId, Index and Selector are invalid combination to point to a
+                                type of UFS attribute.
+  @retval EFI_DEVICE_ERROR      The attribute is not read/written successfully.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UFS_DEVICE_CONFIG_RW_ATTRIBUTE) (
+  IN EFI_UFS_DEVICE_CONFIG_PROTOCOL    *This,
+  IN BOOLEAN                           Read,
+  IN UINT8                             AttrId,
+  IN UINT8                             Index,
+  IN UINT8                             Selector,
+  IN OUT UINT8                         *Attribute,
+  IN OUT UINT32                        *AttrSize
+  );
+
+///
+/// UFS Device Config Protocol structure.
+///
+struct _EFI_UFS_DEVICE_CONFIG_PROTOCOL {
+  EFI_UFS_DEVICE_CONFIG_RW_DESCRIPTOR    RwUfsDescriptor;
+  EFI_UFS_DEVICE_CONFIG_RW_FLAG          RwUfsFlag;
+  EFI_UFS_DEVICE_CONFIG_RW_ATTRIBUTE     RwUfsAttribute;
+};
+
+
+extern EFI_GUID gBlackBoxEfiUFSDeviceConfigProtocolGuid;
+#endif
\ No newline at end of file
diff --git a/uefi-sct/SctPkg/UEFI/UEFI.dec b/uefi-sct/SctPkg/UEFI/UEFI.dec
index efa52ff..0d01d94 100644
--- a/uefi-sct/SctPkg/UEFI/UEFI.dec
+++ b/uefi-sct/SctPkg/UEFI/UEFI.dec
@@ -182,4 +182,5 @@
   gBlackBoxEfiRamDiskProtocolGuid = { 0xab38a0df, 0x6873, 0x44a9, { 0x87, 0xe6, 0xd4, 0xeb, 0x56, 0x14, 0x84, 0x49 }}
   gBlackBoxEfiEraseBlockProtocolGuid = { 0x95a9a93e, 0xa86e, 0x4926, {0xaa, 0xef, 0x99, 0x18, 0xe7, 0x72, 0xd9, 0x87}}
   gBlackBoxEfiSDMMCPassThruProtocolGuid = { 0x716ef0d9, 0xff83, 0x4f69, { 0x81, 0xe9, 0x51, 0x8b, 0xd3, 0x9a, 0x8e, 0x70 }}
+  gBlackBoxEfiUFSDeviceConfigProtocolGuid = { 0xb81bfab0, 0xeb3, 0x4cf9, { 0x84, 0x65, 0x7f, 0xa9, 0x86, 0x36, 0x16, 0x64 }}
   gBlackBoxEfiResetNotificationProtocolGuid = { 0x9da34ae0, 0xeaf9, 0x4bbf, { 0x8e, 0xc3, 0xfd, 0x60, 0x22, 0x6c, 0x44, 0xbe } }
\ No newline at end of file
diff --git a/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc b/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc
index 315d30b..227a45d 100644
--- a/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc
+++ b/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc
@@ -284,6 +284,7 @@ SctPkg/TestCase/UEFI/EFI/Protocol/NVMEPassThru/BlackBoxTest/NVMEPassThruBBTest.i
 SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBlockBBTest.inf
 SctPkg/TestCase/UEFI/EFI/Protocol/SDMMCPassThru/BlackBoxTest/SDMMCPassThruBBTest.inf
 
+SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf
 SctPkg/TestCase/UEFI/EFI/Protocol/ResetNotification/BlackBoxTest/ResetNotificationBBTest.inf
 #
 # Dependency files for UEFI/EFI Compliant Test
-- 
2.9.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-test][Patch] uefi-sct\SctPkg: Add new test of UFSDeviceConfig Protocol
  2018-10-11 15:01 [edk2-test][Patch] uefi-sct\SctPkg: Add new test of UFSDeviceConfig Protocol Eric Jin
@ 2018-10-12  8:22 ` Supreeth Venkatesh
  0 siblings, 0 replies; 2+ messages in thread
From: Supreeth Venkatesh @ 2018-10-12  8:22 UTC (permalink / raw)
  To: Eric Jin, edk2-devel

Since this was already present in 
https://github.com/UEFI/UEFI-SCT/commit/473942ebc2135b066bb8713d62182e160611597a 
and it is just migrating over to new repository.

Reviewed-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>

if commit msg is changed to uefi-sct/SctPkg instead of uefi-sct\SctPkg, 
while pushing upstream.


On 10/11/2018 04:01 PM, Eric Jin wrote:
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Jin <eric.jin@intel.com>
> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
> ---
>   uefi-sct/SctPkg/CommonGenFramework.bat             |   1 +
>   uefi-sct/SctPkg/CommonGenFramework.sh              |   1 +
>   uefi-sct/SctPkg/Config/Data/Category.ini           |   7 +
>   .../Protocol/UFSDeviceConfig/BlackBoxTest/Guid.c   |  35 +++
>   .../Protocol/UFSDeviceConfig/BlackBoxTest/Guid.h   |  51 ++++
>   .../BlackBoxTest/UFSDeviceConfigBBTest.inf         |  53 +++++
>   .../UFSDeviceConfigBBTestConformance.c             | 260 +++++++++++++++++++++
>   .../BlackBoxTest/UFSDeviceConfigBBTestMain.c       | 123 ++++++++++
>   .../BlackBoxTest/UFSDeviceConfigBBTestMain.h       |  92 ++++++++
>   uefi-sct/SctPkg/UEFI/Protocol/UFSDeviceConfig.h    | 146 ++++++++++++
>   uefi-sct/SctPkg/UEFI/UEFI.dec                      |   1 +
>   uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc                  |   1 +
>   12 files changed, 771 insertions(+)
>   create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.c
>   create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.h
>   create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf
>   create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestConformance.c
>   create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.c
>   create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.h
>   create mode 100644 uefi-sct/SctPkg/UEFI/Protocol/UFSDeviceConfig.h
>
> diff --git a/uefi-sct/SctPkg/CommonGenFramework.bat b/uefi-sct/SctPkg/CommonGenFramework.bat
> index cf7f619..b566ebf 100644
> --- a/uefi-sct/SctPkg/CommonGenFramework.bat
> +++ b/uefi-sct/SctPkg/CommonGenFramework.bat
> @@ -186,6 +186,7 @@ copy %ProcessorType%\RamDiskProtocolBBTest.efi                %Framework%\Test\
>   copy %ProcessorType%\NVMEPassThruBBTest.efi                   %Framework%\Test\ > NUL
>   copy %ProcessorType%\EraseBlockBBTest.efi                     %Framework%\Test\ > NUL
>   copy %ProcessorType%\SDMMCPassThruBBTest.efi                  %Framework%\Test\ > NUL
> +copy %ProcessorType%\UFSDeviceConfigBBTest.efi                %Framework%\Test\ > NUL
>   copy %ProcessorType%\ResetNotificationBBTest.efi              %Framework%\Test\ > NUL
>   
>   rem *********************************************
> diff --git a/uefi-sct/SctPkg/CommonGenFramework.sh b/uefi-sct/SctPkg/CommonGenFramework.sh
> index a37c76b..9efc7da 100755
> --- a/uefi-sct/SctPkg/CommonGenFramework.sh
> +++ b/uefi-sct/SctPkg/CommonGenFramework.sh
> @@ -219,6 +219,7 @@ then
>       cp $ProcessorType/NVMEPassThruBBTest.efi                   $Framework/Test/ > NUL
>       cp $ProcessorType/EraseBlockBBTest.efi                     $Framework/Test/ > NUL
>       cp $ProcessorType/SDMMCPassThruBBTest.efi                  $Framework/Test/ > NUL
> +    cp $ProcessorType/UFSDeviceConfigBBTest.efi                $Framework/Test/ > NUL
>       cp $ProcessorType/ResetNotificationBBTest.efi              $Framework/Test/ > NUL
>   
>       # *********************************************
> diff --git a/uefi-sct/SctPkg/Config/Data/Category.ini b/uefi-sct/SctPkg/Config/Data/Category.ini
> index 14cb2a2..22dbfa8 100644
> --- a/uefi-sct/SctPkg/Config/Data/Category.ini
> +++ b/uefi-sct/SctPkg/Config/Data/Category.ini
> @@ -404,6 +404,13 @@ Description   =
>   
>   [Category Data]
>   Revision      = 0x00010000
> +CategoryGuid  = B81BFAB0-0EB3-4CF9-8465-7FA986361664
> +InterfaceGuid = B81BFAB0-0EB3-4CF9-8465-7FA986361664
> +Name          = MediaAccessTest\UFSDeviceConfig
> +Description   =
> +
> +[Category Data]
> +Revision      = 0x00010000
>   CategoryGuid  = 1D85CD7F-F43D-11D2-9A0C-0090273FC14D
>   InterfaceGuid = 1D85CD7F-F43D-11D2-9A0C-0090273FC14D
>   Name          = StringServiceTest\UnicodeCollationProtocolTest
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.c
> new file mode 100644
> index 0000000..705ca00
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.c
> @@ -0,0 +1,35 @@
> +/** @file
> +
> +  Copyright (c) 2018, 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:
> +
> +   Guid.c
> +
> + Abstract:
> +
> +   GUIDs auto-generated for EFI test assertion.
> +
> +--*/
> +
> +#include "UFSDeviceConfigBBTestMain.h"
> +
> +
> +EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid001 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_001_GUID;
> +EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid002 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_002_GUID;
> +EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid003 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_003_GUID;
> +EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid004 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_004_GUID;
> +EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid005 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_005_GUID;
> +EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid006 = EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_006_GUID;
> +
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.h
> new file mode 100644
> index 0000000..6385320
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/Guid.h
> @@ -0,0 +1,51 @@
> +/** @file
> +
> +  Copyright (c) 2018, 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:
> +
> +   Guid.h
> +
> + Abstract:
> +
> +   GUIDs auto-generated for EFI test assertion.
> +
> +--*/
> +
> +
> +
> +
> +#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_001_GUID \
> +{ 0x2ae62c80, 0x3d9a, 0x43c2, { 0x83, 0xb, 0xbd, 0xd7, 0xd9, 0x92, 0x21, 0x1 } }
> +extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid001;
> +
> +#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_002_GUID \
> +{ 0x9f416cd1, 0x7e63, 0x4106, { 0x87, 0xe8, 0xc, 0xd, 0x87, 0xe7, 0x97, 0x5e } }
> +extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid002;
> +
> +#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_003_GUID \
> +{ 0xe17a7831, 0x1620, 0x4d71, { 0x90, 0xdd, 0x82, 0x57, 0xda, 0x51, 0x82, 0x13 } }
> +extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid003;
> +
> +#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_004_GUID \
> +{ 0x9664372d, 0x4171, 0x41e6, { 0xad, 0xfb, 0x8d, 0xe1, 0x3e, 0xd0, 0x2, 0xe  } }
> +extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid004;
> +
> +#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_005_GUID \
> +{ 0xfdea1cff, 0x68af, 0x4808, { 0x89, 0x16, 0x7f, 0x17, 0xa, 0xfc, 0x47, 0xb3 } }
> +extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid005;
> +
> +#define EFI_TEST_UFSDEVICECONFIGBBTESTCONF_ASSERTION_006_GUID \
> +{ 0x1ef56bb1, 0xd8e6, 0x45c1, { 0xbb, 0x95, 0x82, 0x47, 0xf, 0xdd, 0x44, 0x4f } }
> +extern EFI_GUID gUFSDeviceConfigBBTestConfAssertionGuid006;
> \ No newline at end of file
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf
> new file mode 100644
> index 0000000..7785e11
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf
> @@ -0,0 +1,53 @@
> +## @file
> +#
> +#  Copyright (c) 2018, 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:
> +#
> +#   UFSDeviceConfigBBTest.inf
> +#
> +# Abstract:
> +#
> +#   Component description file for UFS Device Config Protocol Black-Box Test.
> +#
> +#--*/
> +
> +[defines]
> +  INF_VERSION          = 0x00010005
> +  BASE_NAME            = UFSDeviceConfigBBTest
> +  FILE_GUID            = FDDC6693-45C7-43D6-B752-F5B57032D37F
> +  MODULE_TYPE          = UEFI_DRIVER
> +  VERSION_STRING       = 1.0
> +  ENTRY_POINT          = InitializeUFSDeviceConfigBBTest
> +
> +[sources.common]
> +  UFSDeviceConfigBBTestConformance.c
> +  UFSDeviceConfigBBTestMain.c
> +  Guid.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  SctPkg/SctPkg.dec
> +  SctPkg/UEFI/UEFI.dec
> +
> +[LibraryClasses]
> +  UefiDriverEntryPoint
> +  SctLib
> +  EfiTestLib
> +
> +[Protocols]
> +  gBlackBoxEfiUFSDeviceConfigProtocolGuid
> +
> +[Guids]
> +
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestConformance.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestConformance.c
> new file mode 100644
> index 0000000..4c8f7c5
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestConformance.c
> @@ -0,0 +1,260 @@
> +/** @file
> +
> +  Copyright (c) 2018, 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:
> +
> +    UFSDeviceConfigConformance.c
> +
> +Abstract:
> +
> +    for EFI UFS Device Config Protocol's Conformance Test
> +
> +--*/
> +
> +#include "UFSDeviceConfigBBTestMain.h"
> +
> +EFI_STATUS
> +BBTestRwUfsDescriptorConfTest (
> +  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_UFS_DEVICE_CONFIG_PROTOCOL        *UFSDeviceConfig;
> +  EFI_TEST_ASSERTION                    AssertionType;
> +
> +  UINT8                                 Descriptor;
> +  UINT32                                DescSize;
> +
> +  UFSDeviceConfig = (EFI_UFS_DEVICE_CONFIG_PROTOCOL*)ClientInterface;
> +
> +  //
> +  // Get the Standard Library Interface
> +  //
> +  Status = gtBS->HandleProtocol (
> +                   SupportHandle,
> +                   &gEfiStandardTestLibraryGuid,
> +                   (VOID **) &StandardLib
> +                   );
> +
> +  if ( EFI_ERROR(Status) ) {
> +    StandardLib->RecordAssertion (
> +                   StandardLib,
> +                   EFI_TEST_ASSERTION_FAILED,
> +                   gTestGenericFailureGuid,
> +                   L"BS.HandleProtocol - Handle standard test library",
> +                   L"%a:%d:Status - %r\n",
> +                   __FILE__,
> +                   (UINTN)__LINE__,
> +                   Status
> +                   );
> +    return Status;
> +  }
> +
> +  Status = UFSDeviceConfig->RwUfsDescriptor(UFSDeviceConfig, TRUE, 0, 0, 0, NULL, &DescSize);
> +  if (Status == EFI_INVALID_PARAMETER)
> +    AssertionType = EFI_TEST_ASSERTION_PASSED;
> +  else
> +    AssertionType = EFI_TEST_ASSERTION_FAILED;
> +
> +  StandardLib->RecordAssertion (
> +                 StandardLib,
> +                 AssertionType,
> +                 gUFSDeviceConfigBBTestConfAssertionGuid001,
> +                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsDescriptor- RwUfsDescriptor() returns EFI_INVALID_PARAMETER when Descriptor is NULL.",
> +                 L"%a:%d: Status - %r",
> +                 __FILE__,
> +                 (UINTN)__LINE__,
> +                 Status
> +                 );
> +
> +  Status = UFSDeviceConfig->RwUfsDescriptor(UFSDeviceConfig, TRUE, 0, 0, 0, &Descriptor, NULL);
> +  if (Status == EFI_INVALID_PARAMETER)
> +    AssertionType = EFI_TEST_ASSERTION_PASSED;
> +  else
> +    AssertionType = EFI_TEST_ASSERTION_FAILED;
> +
> +  StandardLib->RecordAssertion (
> +                 StandardLib,
> +                 AssertionType,
> +                 gUFSDeviceConfigBBTestConfAssertionGuid002,
> +                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsDescriptor- RwUfsDescriptor() returns EFI_INVALID_PARAMETER when DescSize is NULL.",
> +                 L"%a:%d: Status - %r",
> +                 __FILE__,
> +                 (UINTN)__LINE__,
> +                 Status
> +                 );
> +
> +
> +  return EFI_SUCCESS;
> +}
> +
> +EFI_STATUS
> +BBTestRwUfsFlagConfTest (
> +  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_UFS_DEVICE_CONFIG_PROTOCOL        *UFSDeviceConfig;
> +  EFI_TEST_ASSERTION                    AssertionType;
> +
> +  UINT8                                 Flag;
> +
> +  UFSDeviceConfig = (EFI_UFS_DEVICE_CONFIG_PROTOCOL*)ClientInterface;
> +
> +  //
> +  // Get the Standard Library Interface
> +  //
> +  Status = gtBS->HandleProtocol (
> +                   SupportHandle,
> +                   &gEfiStandardTestLibraryGuid,
> +                   (VOID **) &StandardLib
> +                   );
> +
> +  if ( EFI_ERROR(Status) ) {
> +    StandardLib->RecordAssertion (
> +                   StandardLib,
> +                   EFI_TEST_ASSERTION_FAILED,
> +                   gTestGenericFailureGuid,
> +                   L"BS.HandleProtocol - Handle standard test library",
> +                   L"%a:%d:Status - %r\n",
> +                   __FILE__,
> +                   (UINTN)__LINE__,
> +                   Status
> +                   );
> +    return Status;
> +  }
> +
> +  Status = UFSDeviceConfig->RwUfsFlag(UFSDeviceConfig, TRUE, 0, &Flag);
> +  if (Status == EFI_INVALID_PARAMETER)
> +    AssertionType = EFI_TEST_ASSERTION_PASSED;
> +  else
> +    AssertionType = EFI_TEST_ASSERTION_FAILED;
> +
> +  StandardLib->RecordAssertion (
> +                 StandardLib,
> +                 AssertionType,
> +                 gUFSDeviceConfigBBTestConfAssertionGuid003,
> +                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsFlag- RwUfsFlag() returns EFI_INVALID_PARAMETER when FlagId is an invalid UFS flag ID.",
> +                 L"%a:%d: Status - %r",
> +                 __FILE__,
> +                 (UINTN)__LINE__,
> +                 Status
> +                 );
> +
> +  Status = UFSDeviceConfig->RwUfsFlag(UFSDeviceConfig, TRUE, 1, NULL);
> +  if (Status == EFI_INVALID_PARAMETER)
> +    AssertionType = EFI_TEST_ASSERTION_PASSED;
> +  else
> +    AssertionType = EFI_TEST_ASSERTION_FAILED;
> +
> +  StandardLib->RecordAssertion (
> +                 StandardLib,
> +                 AssertionType,
> +                 gUFSDeviceConfigBBTestConfAssertionGuid004,
> +                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsFlag- RwUfsFlag() returns EFI_INVALID_PARAMETER when Flag is NULL.",
> +                 L"%a:%d: Status - %r",
> +                 __FILE__,
> +                 (UINTN)__LINE__,
> +                 Status
> +                 );
> +
> +  return EFI_SUCCESS;
> +}
> +
> +EFI_STATUS
> +BBTestRwUfsAttributeConfTest (
> +  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_UFS_DEVICE_CONFIG_PROTOCOL        *UFSDeviceConfig;
> +  EFI_TEST_ASSERTION                    AssertionType;
> +
> +  UINT8                                 Attribute;
> +  UINT32                                AttrSize;
> +
> +  UFSDeviceConfig = (EFI_UFS_DEVICE_CONFIG_PROTOCOL*)ClientInterface;
> +
> +  //
> +  // Get the Standard Library Interface
> +  //
> +  Status = gtBS->HandleProtocol (
> +                   SupportHandle,
> +                   &gEfiStandardTestLibraryGuid,
> +                   (VOID **) &StandardLib
> +                   );
> +
> +  if ( EFI_ERROR(Status) ) {
> +    StandardLib->RecordAssertion (
> +                   StandardLib,
> +                   EFI_TEST_ASSERTION_FAILED,
> +                   gTestGenericFailureGuid,
> +                   L"BS.HandleProtocol - Handle standard test library",
> +                   L"%a:%d:Status - %r\n",
> +                   __FILE__,
> +                   (UINTN)__LINE__,
> +                   Status
> +                   );
> +    return Status;
> +  }
> +
> +  Status = UFSDeviceConfig->RwUfsAttribute(UFSDeviceConfig, TRUE, 0, 0, 0, NULL, &AttrSize);
> +  if (Status == EFI_INVALID_PARAMETER)
> +    AssertionType = EFI_TEST_ASSERTION_PASSED;
> +  else
> +    AssertionType = EFI_TEST_ASSERTION_FAILED;
> +
> +  StandardLib->RecordAssertion (
> +                 StandardLib,
> +                 AssertionType,
> +                 gUFSDeviceConfigBBTestConfAssertionGuid005,
> +                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsAttribute- RwUfsAttribute() returns EFI_INVALID_PARAMETER when Attribute is NULL.",
> +                 L"%a:%d: Status - %r",
> +                 __FILE__,
> +                 (UINTN)__LINE__,
> +                 Status
> +                 );
> +
> +  Status = UFSDeviceConfig->RwUfsAttribute(UFSDeviceConfig, TRUE, 0, 0, 0, &Attribute, NULL);
> +  if (Status == EFI_INVALID_PARAMETER)
> +    AssertionType = EFI_TEST_ASSERTION_PASSED;
> +  else
> +    AssertionType = EFI_TEST_ASSERTION_FAILED;
> +
> +  StandardLib->RecordAssertion (
> +                 StandardLib,
> +                 AssertionType,
> +                 gUFSDeviceConfigBBTestConfAssertionGuid006,
> +                 L"EFI_UFS_DEVICE_CONFIG_PROTOCOL.RwUfsAttribute- RwUfsAttribute() returns EFI_INVALID_PARAMETER when AttrSize is NULL.",
> +                 L"%a:%d: Status - %r",
> +                 __FILE__,
> +                 (UINTN)__LINE__,
> +                 Status
> +                 );
> +
> +  return EFI_SUCCESS;
> +}
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.c
> new file mode 100644
> index 0000000..04caf3c
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.c
> @@ -0,0 +1,123 @@
> +/** @file
> +
> +  Copyright (c) 2018, 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:
> +
> +  UFSDeviceConfigBBTestMain.c
> +
> +Abstract:
> +
> +  Test Driver of UFS Device Config Protocol
> +
> +--*/
> +
> +
> +#include "UFSDeviceConfigBBTestMain.h"
> +
> +#define EFI_UFS_DEVICE_CONFIG_TEST_GUID \
> +  { 0xb81bfab0, 0xeb3, 0x4cf9, { 0x84, 0x65, 0x7f, 0xa9, 0x86, 0x36, 0x16, 0x64}}
> +
> +//
> +// Global variables
> +//
> +EFI_HANDLE mImageHandle;
> +
> +
> +EFI_BB_TEST_PROTOCOL *gBBTestProtocolInterface;
> +
> +EFI_BB_TEST_PROTOCOL_FIELD gBBTestProtocolField = {
> +  EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_REVISION,
> +  EFI_UFS_DEVICE_CONFIG_TEST_GUID,
> +  L"UFS Device Config Protocol Test",
> +  L"UEFI UFS Device Config Protocol Black-Box Test"
> +};
> +
> +EFI_GUID gSupportProtocolGuid[] = {
> +  EFI_STANDARD_TEST_LIBRARY_GUID,
> +  EFI_NULL_GUID
> +};
> +
> +EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
> +  {
> +    EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0101,
> +    L"RwUfsDescriptorConformance",
> +    L"Conformance auto test for RwUfsDescriptor",
> +    EFI_TEST_LEVEL_MINIMAL,
> +    gSupportProtocolGuid,
> +    EFI_TEST_CASE_AUTO,
> +    BBTestRwUfsDescriptorConfTest
> +  },
> +    {
> +    EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0102,
> +    L"RwUfsFlagConformance",
> +    L"Conformance auto test for RwUfsFlag",
> +    EFI_TEST_LEVEL_MINIMAL,
> +    gSupportProtocolGuid,
> +    EFI_TEST_CASE_AUTO,
> +    BBTestRwUfsFlagConfTest
> +  },
> +    {
> +    EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0103,
> +    L"RwUfsAttributeConformance",
> +    L"Conformance auto test for RwUfsAttribute",
> +    EFI_TEST_LEVEL_MINIMAL,
> +    gSupportProtocolGuid,
> +    EFI_TEST_CASE_AUTO,
> +    BBTestRwUfsAttributeConfTest
> +  },
> + 0
> +};
> +
> +
> +EFI_STATUS
> +InitializeUFSDeviceConfigBBTest (
> +  IN EFI_HANDLE                   ImageHandle,
> +  IN EFI_SYSTEM_TABLE             *SystemTable
> +  )
> +{
> +
> +  EfiInitializeTestLib (ImageHandle, SystemTable);
> +
> +  //
> +  // initialize test utility lib
> +  //
> +
> +  SctInitializeLib (ImageHandle, SystemTable);
> +
> +  mImageHandle = ImageHandle;
> +
> +  return EfiInitAndInstallBBTestInterface (
> +             &ImageHandle,
> +             &gBBTestProtocolField,
> +             gBBTestEntryField,
> +             UnloadUFSDeviceConfigBBTest,
> +             &gBBTestProtocolInterface
> +             );
> +
> +}
> +
> +
> +EFI_STATUS
> +UnloadUFSDeviceConfigBBTest (
> +  IN EFI_HANDLE                   ImageHandle
> +  )
> +{
> +
> +  return EfiUninstallAndFreeBBTestInterface (
> +           ImageHandle,
> +           gBBTestProtocolInterface
> +           );
> +}
> +
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.h
> new file mode 100644
> index 0000000..61c32ce
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTestMain.h
> @@ -0,0 +1,92 @@
> +/** @file
> +
> +  Copyright (c) 2018, 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:
> +
> +  UFSDeviceConfigBBTestMain.h
> +
> +Abstract:
> +
> +  Test Driver of UFS Device Config Protocol header file
> +
> +--*/
> +
> +#ifndef _UFS_DEVICE_CONFIG_BB_TEST_MAIN
> +#define _UFS_DEVICE_CONFIG_BB_TEST_MAIN
> +
> +#include <Efi.h>
> +#include <Library/EfiTestLib.h>
> +#include <SctLib.h>
> +#include <UEFI/Protocol/UFSDeviceConfig.h>
> +#include "Guid.h"
> +
> +
> +#define EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_REVISION    0x00010000
> +
> +//
> +// Entry GUIDs for Conf Test
> +//
> +#define EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0101 \
> +{ 0xd30731cd, 0xa679, 0x41fc, { 0x9f, 0xa6, 0x65, 0x27, 0xab, 0x62, 0x4a, 0x5d  }}
> +
> +#define EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0102 \
> +{ 0xecbc61af, 0x878d, 0x4215, { 0x87, 0xb, 0xed, 0xf0, 0x2c, 0xf4, 0x5a, 0x96 }}
> +
> +#define EFI_UFS_DEVICE_CONFIG_PROTOCOL_TEST_ENTRY_GUID0103 \
> +{ 0x52834ee4, 0x611e, 0x4995, { 0xae, 0xc3, 0x72, 0xf5, 0x8, 0x2b, 0x18, 0x4f }}
> +
> +
> +//
> +//
> +//
> +EFI_STATUS
> +InitializeUFSDeviceConfigBBTest (
> +  IN EFI_HANDLE                   ImageHandle,
> +  IN EFI_SYSTEM_TABLE             *SystemTable
> +  );
> +
> +EFI_STATUS
> +UnloadUFSDeviceConfigBBTest (
> +  IN EFI_HANDLE                   ImageHandle
> +  );
> +
> +//
> +//Test Cases
> +//
> +EFI_STATUS
> +BBTestRwUfsDescriptorConfTest (
> +  IN EFI_BB_TEST_PROTOCOL       *This,
> +  IN VOID                       *ClientInterface,
> +  IN EFI_TEST_LEVEL             TestLevel,
> +  IN EFI_HANDLE                 SupportHandle
> +  );
> +
> +EFI_STATUS
> +BBTestRwUfsFlagConfTest (
> +  IN EFI_BB_TEST_PROTOCOL       *This,
> +  IN VOID                       *ClientInterface,
> +  IN EFI_TEST_LEVEL             TestLevel,
> +  IN EFI_HANDLE                 SupportHandle
> +  );
> +
> +EFI_STATUS
> +BBTestRwUfsAttributeConfTest (
> +  IN EFI_BB_TEST_PROTOCOL       *This,
> +  IN VOID                       *ClientInterface,
> +  IN EFI_TEST_LEVEL             TestLevel,
> +  IN EFI_HANDLE                 SupportHandle
> +  );
> +
> +#endif
> diff --git a/uefi-sct/SctPkg/UEFI/Protocol/UFSDeviceConfig.h b/uefi-sct/SctPkg/UEFI/Protocol/UFSDeviceConfig.h
> new file mode 100644
> index 0000000..aec3da7
> --- /dev/null
> +++ b/uefi-sct/SctPkg/UEFI/Protocol/UFSDeviceConfig.h
> @@ -0,0 +1,146 @@
> +/** @file
> +
> +  Copyright (c) 2018, 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:
> +
> +  UFSDeviceConfig.h
> +
> +Abstract:
> +
> +  UFS Device Config protocol from the UEFI specification.
> +
> +--*/
> +
> +#ifndef _UFS_DEVICE_CONFIG_PROTOCOL_H_
> +#define _UFS_DEVICE_CONFIG_PROTOCOL_H_
> +
> +#define EFI_UFS_DEVICE_CONFIG_GUID \
> +  { 0xb81bfab0, 0xeb3, 0x4cf9, { 0x84, 0x65, 0x7f, 0xa9, 0x86, 0x36, 0x16, 0x64 }}
> +
> +
> +//
> +// Forward reference for pure ANSI compatability
> +//
> +typedef struct _EFI_UFS_DEVICE_CONFIG_PROTOCOL  EFI_UFS_DEVICE_CONFIG_PROTOCOL;
> +
> +/**
> +  Read or write specified device descriptor of a UFS device.
> +
> +  The service is used to read/write UFS device descriptors. The consumer of this API is responsible
> +  for allocating the data buffer pointed by Descriptor.
> +
> +  @param[in]      This          The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.
> +  @param[in]      Read          The boolean variable to show r/w direction.
> +  @param[in]      DescId        The ID of device descriptor.
> +  @param[in]      Index         The Index of device descriptor.
> +  @param[in]      Selector      The Selector of device descriptor.
> +  @param[in, out] Descriptor    The buffer of device descriptor to be read or written.
> +  @param[in, out] DescSize      The size of device descriptor buffer. On input, the size, in bytes,
> +                                of the data buffer specified by Descriptor. On output, the number
> +                                of bytes that were actually transferred.
> +
> +  @retval EFI_SUCCESS           The device descriptor is read/written successfully.
> +  @retval EFI_INVALID_PARAMETER This is NULL or Descriptor is NULL or DescSize is NULL.
> +                                DescId, Index and Selector are invalid combination to point to a
> +                                type of UFS device descriptor.
> +  @retval EFI_DEVICE_ERROR      The device descriptor is not read/written successfully.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EFI_UFS_DEVICE_CONFIG_RW_DESCRIPTOR) (
> +  IN EFI_UFS_DEVICE_CONFIG_PROTOCOL    *This,
> +  IN BOOLEAN                           Read,
> +  IN UINT8                             DescId,
> +  IN UINT8                             Index,
> +  IN UINT8                             Selector,
> +  IN OUT UINT8                         *Descriptor,
> +  IN OUT UINT32                        *DescSize
> +  );
> +
> +/**
> +  Read or write specified flag of a UFS device.
> +
> +  The service is used to read/write UFS flag descriptors. The consumer of this API is responsible
> +  for allocating the buffer pointed by Flag. The buffer size is 1 byte as UFS flag descriptor is
> +  just a single Boolean value that represents a TRUE or FALSE, '0' or '1', ON or OFF type of value.
> +
> +  @param[in]      This          The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.
> +  @param[in]      Read          The boolean variable to show r/w direction.
> +  @param[in]      FlagId        The ID of flag to be read or written.
> +  @param[in, out] Flag          The buffer to set or clear flag.
> +
> +  @retval EFI_SUCCESS           The flag descriptor is set/clear successfully.
> +  @retval EFI_INVALID_PARAMETER This is NULL or Flag is NULL.
> +                                FlagId is an invalid UFS flag ID.
> +  @retval EFI_DEVICE_ERROR      The flag is not set/clear successfully.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EFI_UFS_DEVICE_CONFIG_RW_FLAG) (
> +  IN EFI_UFS_DEVICE_CONFIG_PROTOCOL    *This,
> +  IN BOOLEAN                           Read,
> +  IN UINT8                             FlagId,
> +  IN OUT UINT8                         *Flag
> +  );
> +
> +/**
> +  Read or write specified attribute of a UFS device.
> +
> +  The service is used to read/write UFS attributes. The consumer of this API is responsible for
> +  allocating the data buffer pointed by Attribute.
> +
> +  @param[in]      This          The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.
> +  @param[in]      Read          The boolean variable to show r/w direction.
> +  @param[in]      AttrId        The ID of Attribute.
> +  @param[in]      Index         The Index of Attribute.
> +  @param[in]      Selector      The Selector of Attribute.
> +  @param[in, out] Attribute     The buffer of Attribute to be read or written.
> +  @param[in, out] AttrSize      The size of Attribute buffer. On input, the size, in bytes, of the
> +                                data buffer specified by Attribute. On output, the number of bytes
> +                                that were actually transferred.
> +
> +  @retval EFI_SUCCESS           The attribute is read/written successfully.
> +  @retval EFI_INVALID_PARAMETER This is NULL or Attribute is NULL or AttrSize is NULL.
> +                                AttrId, Index and Selector are invalid combination to point to a
> +                                type of UFS attribute.
> +  @retval EFI_DEVICE_ERROR      The attribute is not read/written successfully.
> +
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *EFI_UFS_DEVICE_CONFIG_RW_ATTRIBUTE) (
> +  IN EFI_UFS_DEVICE_CONFIG_PROTOCOL    *This,
> +  IN BOOLEAN                           Read,
> +  IN UINT8                             AttrId,
> +  IN UINT8                             Index,
> +  IN UINT8                             Selector,
> +  IN OUT UINT8                         *Attribute,
> +  IN OUT UINT32                        *AttrSize
> +  );
> +
> +///
> +/// UFS Device Config Protocol structure.
> +///
> +struct _EFI_UFS_DEVICE_CONFIG_PROTOCOL {
> +  EFI_UFS_DEVICE_CONFIG_RW_DESCRIPTOR    RwUfsDescriptor;
> +  EFI_UFS_DEVICE_CONFIG_RW_FLAG          RwUfsFlag;
> +  EFI_UFS_DEVICE_CONFIG_RW_ATTRIBUTE     RwUfsAttribute;
> +};
> +
> +
> +extern EFI_GUID gBlackBoxEfiUFSDeviceConfigProtocolGuid;
> +#endif
> \ No newline at end of file
> diff --git a/uefi-sct/SctPkg/UEFI/UEFI.dec b/uefi-sct/SctPkg/UEFI/UEFI.dec
> index efa52ff..0d01d94 100644
> --- a/uefi-sct/SctPkg/UEFI/UEFI.dec
> +++ b/uefi-sct/SctPkg/UEFI/UEFI.dec
> @@ -182,4 +182,5 @@
>     gBlackBoxEfiRamDiskProtocolGuid = { 0xab38a0df, 0x6873, 0x44a9, { 0x87, 0xe6, 0xd4, 0xeb, 0x56, 0x14, 0x84, 0x49 }}
>     gBlackBoxEfiEraseBlockProtocolGuid = { 0x95a9a93e, 0xa86e, 0x4926, {0xaa, 0xef, 0x99, 0x18, 0xe7, 0x72, 0xd9, 0x87}}
>     gBlackBoxEfiSDMMCPassThruProtocolGuid = { 0x716ef0d9, 0xff83, 0x4f69, { 0x81, 0xe9, 0x51, 0x8b, 0xd3, 0x9a, 0x8e, 0x70 }}
> +  gBlackBoxEfiUFSDeviceConfigProtocolGuid = { 0xb81bfab0, 0xeb3, 0x4cf9, { 0x84, 0x65, 0x7f, 0xa9, 0x86, 0x36, 0x16, 0x64 }}
>     gBlackBoxEfiResetNotificationProtocolGuid = { 0x9da34ae0, 0xeaf9, 0x4bbf, { 0x8e, 0xc3, 0xfd, 0x60, 0x22, 0x6c, 0x44, 0xbe } }
> \ No newline at end of file
> diff --git a/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc b/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc
> index 315d30b..227a45d 100644
> --- a/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc
> +++ b/uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc
> @@ -284,6 +284,7 @@ SctPkg/TestCase/UEFI/EFI/Protocol/NVMEPassThru/BlackBoxTest/NVMEPassThruBBTest.i
>   SctPkg/TestCase/UEFI/EFI/Protocol/EraseBlock/BlackBoxTest/EraseBlockBBTest.inf
>   SctPkg/TestCase/UEFI/EFI/Protocol/SDMMCPassThru/BlackBoxTest/SDMMCPassThruBBTest.inf
>   
> +SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf
>   SctPkg/TestCase/UEFI/EFI/Protocol/ResetNotification/BlackBoxTest/ResetNotificationBBTest.inf
>   #
>   # Dependency files for UEFI/EFI Compliant Test



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-12  8:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-11 15:01 [edk2-test][Patch] uefi-sct\SctPkg: Add new test of UFSDeviceConfig Protocol Eric Jin
2018-10-12  8:22 ` Supreeth Venkatesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox