* [edk2-test][Patch] uefi-sct\SctPkg: Add new test of PartitionInfo Protocol
@ 2018-10-11 15:35 Eric Jin
2018-10-12 7:44 ` Supreeth Venkatesh
0 siblings, 1 reply; 2+ messages in thread
From: Eric Jin @ 2018-10-11 15:35 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 ++
.../EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.c | 31 +++++
.../EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.h | 41 ++++++
.../BlackBoxTest/PartitionInfoBBTest.inf | 53 ++++++++
.../BlackBoxTest/PartitionInfoBBTestFunction.c | 137 ++++++++++++++++++++
.../BlackBoxTest/PartitionInfoBBTestMain.c | 139 +++++++++++++++++++++
.../BlackBoxTest/PartitionInfoBBTestMain.h | 76 +++++++++++
uefi-sct/SctPkg/UEFI/Protocol/PartitionInfo.h | 93 ++++++++++++++
uefi-sct/SctPkg/UEFI/UEFI.dec | 1 +
uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc | 1 +
12 files changed, 581 insertions(+)
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.c
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.h
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTest.inf
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestFunction.c
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.c
create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.h
create mode 100644 uefi-sct/SctPkg/UEFI/Protocol/PartitionInfo.h
diff --git a/uefi-sct/SctPkg/CommonGenFramework.bat b/uefi-sct/SctPkg/CommonGenFramework.bat
index b566ebf..5c614ea 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%\PartitionInfoBBTest.efi %Framework%\Test\ > NUL
copy %ProcessorType%\UFSDeviceConfigBBTest.efi %Framework%\Test\ > NUL
copy %ProcessorType%\ResetNotificationBBTest.efi %Framework%\Test\ > NUL
diff --git a/uefi-sct/SctPkg/CommonGenFramework.sh b/uefi-sct/SctPkg/CommonGenFramework.sh
index 9efc7da..299f0d6 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/PartitionInfoBBTest.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 22dbfa8..3e9f5e5 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 = 8CF2F62C-BC9B-4821-808D-EC9EC421A1A0
+InterfaceGuid = 8CF2F62C-BC9B-4821-808D-EC9EC421A1A0
+Name = MediaAccessTest\PartitionInfo
+Description =
+
+[Category Data]
+Revision = 0x00010000
CategoryGuid = B81BFAB0-0EB3-4CF9-8465-7FA986361664
InterfaceGuid = B81BFAB0-0EB3-4CF9-8465-7FA986361664
Name = MediaAccessTest\UFSDeviceConfig
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.c
new file mode 100644
index 0000000..b5186d3
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.c
@@ -0,0 +1,31 @@
+/** @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 "PartitionInfoBBTestMain.h"
+
+
+EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid001 = EFI_TEST_PARTITIONINFOBBTESTFUNCTION_ASSERTION_001_GUID;
+EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid002 = EFI_TEST_PARTITIONINFOBBTESTFUNCTION_ASSERTION_002_GUID;
+EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid003 = EFI_TEST_PARTITIONINFOBBTESTFUNCTION_ASSERTION_003_GUID;
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.h
new file mode 100644
index 0000000..e69cc1c
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.h
@@ -0,0 +1,41 @@
+/** @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_PARTITIONINFOBBTESTFUNCTION_ASSERTION_001_GUID \
+{ 0xcaf4ea69, 0x573, 0x4b98, { 0xa3, 0x5b, 0x9b, 0xf, 0x95, 0xaa, 0xe2, 0xa4 } }
+extern EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid001;
+
+#define EFI_TEST_PARTITIONINFOBBTESTFUNCTION_ASSERTION_002_GUID \
+{ 0xec401ac3, 0xec7c, 0x4b1e, { 0x8f, 0x1c, 0x6d, 0xa0, 0x25, 0x2c, 0xbf, 0xbc } }
+extern EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid002;
+
+#define EFI_TEST_PARTITIONINFOBBTESTFUNCTION_ASSERTION_003_GUID \
+{ 0xa807ce2d, 0x3630, 0x4929, { 0xaf, 0xaf, 0xce, 0xb3, 0xb8, 0xea, 0x5c, 0xbd } }
+extern EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid003;
+
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTest.inf
new file mode 100644
index 0000000..0ed5730
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTest.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:
+#
+# PartitionInfoBBTest.inf
+#
+# Abstract:
+#
+# Component description file for Partition Info Protocol Black-Box Test.
+#
+#--*/
+
+[defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = PartitionInfoBBTest
+ FILE_GUID = 57EEBBDC-D0B8-4428-980E-75E11A237642
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializePartitionInfoBBTest
+
+[sources.common]
+ PartitionInfoBBTestFunction.c
+ PartitionInfoBBTestMain.c
+ Guid.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ SctPkg/SctPkg.dec
+ SctPkg/UEFI/UEFI.dec
+
+[LibraryClasses]
+ UefiDriverEntryPoint
+ SctLib
+ EfiTestLib
+
+[Protocols]
+ gBlackBoxEfiPartitionInfoProtocolGuid
+
+[Guids]
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestFunction.c
new file mode 100644
index 0000000..076cf19
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestFunction.c
@@ -0,0 +1,137 @@
+/** @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:
+
+ PartitionInfoBBTestFunction.c
+
+Abstract:
+
+ for EFI Driver Partition Info Protocol's Function Test
+
+--*/
+
+#include "PartitionInfoBBTestMain.h"
+
+EFI_GUID gPartitionInfoEFIUnusedEntryGuid = EFI_UNUSED_ENTRY_GUID;
+EFI_GUID gPartitionInfoEFISystemPartitionGuid = EFI_SYSTEM_PARTITION_GUID;
+EFI_GUID gPartitionInfoEFIPartitionContainingLegacyMBRGuid = EFI_PARTITION_CONTAINING_LEGACY_MBR_GUID;
+
+EFI_STATUS
+BBTestPartitionInfoFunctionTest (
+ 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_PARTITION_INFO_PROTOCOL *PartitionInfo;
+ EFI_TEST_ASSERTION AssertionType;
+
+ PartitionInfo = (EFI_PARTITION_INFO_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;
+ }
+
+
+ if ((PartitionInfo->Revision != EFI_PARTITION_INFO_PROTOCOL_REVISION) ||
+ ((PartitionInfo->Type != PARTITION_TYPE_OTHER) && (PartitionInfo->Type != PARTITION_TYPE_MBR) && (PartitionInfo->Type != PARTITION_TYPE_GPT)) ||
+ ((PartitionInfo->System != 0) && (PartitionInfo->System != 1))) {
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ } else {
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ }
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gPartitionInfoBBTestFunctionAssertionGuid001,
+ L"PartitionInfo - Revision, Type, System test",
+ L"%a:%d:Revision - 0x%08x, Info - %d, System - %d\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ PartitionInfo->Revision,
+ PartitionInfo->Type,
+ PartitionInfo->System
+ );
+
+ if (AssertionType == EFI_TEST_ASSERTION_PASSED) {
+ if (PartitionInfo->Type == PARTITION_TYPE_MBR) {
+ if (PartitionInfo->Info.Mbr.OSIndicator == 0xEF) {
+ if ((PartitionInfo->System != 1))
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ else
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gPartitionInfoBBTestFunctionAssertionGuid003,
+ L"PartitionInfo - Mbr.OSIndicator should be aligned with PartitionInfo->System",
+ L"%a:%d:Mbr.OSIndicator - %d, System - %d\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ PartitionInfo->Info.Mbr.OSIndicator,
+ PartitionInfo->System
+ );
+ }
+ }
+ if (PartitionInfo->Type == PARTITION_TYPE_GPT) {
+ if (!GuidCmp(PartitionInfo->Info.Gpt.PartitionTypeGUID, gPartitionInfoEFISystemPartitionGuid)) {
+ if ((PartitionInfo->System != 1))
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+ else
+ AssertionType = EFI_TEST_ASSERTION_PASSED;
+
+ StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gPartitionInfoBBTestFunctionAssertionGuid002,
+ L"PartitionInfo - Gpt.PartitionTypeGUID should be aligned with PartitionInfo->System",
+ L"%a:%d:Gpt.PartitionTypeGUID - %g, System - %d\n",
+ __FILE__,
+ (UINTN)__LINE__,
+ &PartitionInfo->Info.Gpt.PartitionTypeGUID,
+ PartitionInfo->System
+ );
+ }
+
+ }
+
+ }
+
+ return EFI_SUCCESS;
+}
+
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.c
new file mode 100644
index 0000000..684265e
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.c
@@ -0,0 +1,139 @@
+/** @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:
+
+ PartitionInfoBBTestMain.c
+
+Abstract:
+
+ Test Driver of Partition Info Protocol
+
+--*/
+
+
+#include "PartitionInfoBBTestMain.h"
+
+#define EFI_PARTITION_INFO_TEST_GUID \
+ {0x8cf2f62c, 0xbc9b, 0x4821, {0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0}}
+
+//
+// Global variables
+//
+EFI_HANDLE mImageHandle;
+
+UINT8 EnterEvent;
+
+
+EFI_BB_TEST_PROTOCOL *gBBTestProtocolInterface;
+
+EFI_BB_TEST_PROTOCOL_FIELD gBBTestProtocolField = {
+ EFI_PARTITION_INFO_PROTOCOL_TEST_REVISION,
+ EFI_PARTITION_INFO_TEST_GUID,
+ L"Partition Info Protocol Test",
+ L"UEFI Partition Info Protocol Black-Box Test"
+};
+
+EFI_GUID gSupportProtocolGuid[] = {
+ EFI_STANDARD_TEST_LIBRARY_GUID,
+ EFI_NULL_GUID
+};
+
+EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
+ {
+ EFI_PARTITION_INFO_PROTOCOL_TEST_ENTRY_GUID0101,
+ L"PartitionInfoFunction",
+ L"Function auto test for Partition Info Protocol",
+ EFI_TEST_LEVEL_MINIMAL,
+ gSupportProtocolGuid,
+ EFI_TEST_CASE_AUTO,
+ BBTestPartitionInfoFunctionTest
+ },
+ 0
+};
+
+
+EFI_STATUS
+InitializePartitionInfoBBTest (
+ 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,
+ UnloadPartitionInfoBBTest,
+ &gBBTestProtocolInterface
+ );
+
+}
+
+
+EFI_STATUS
+UnloadPartitionInfoBBTest (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+
+ return EfiUninstallAndFreeBBTestInterface (
+ ImageHandle,
+ gBBTestProtocolInterface
+ );
+}
+
+
+
+INTN
+MemCmp(
+ UINT8 *s1,
+ UINT8 *s2,
+ UINTN n
+ )
+{
+ UINT8 *p1, *p2;
+
+ p1 = s1;
+ p2 = s2;
+ if (n != 0) {
+ do {
+ if (*p1++ != *p2++)
+ return (*--p1 - *--p2);
+ } while (--n != 0);
+ }
+ return (0);
+}
+
+
+
+INTN
+GuidCmp(
+ EFI_GUID GuidGiven,
+ EFI_GUID GuidNeedToCmp
+ )
+{
+ return MemCmp((UINT8 *)&GuidGiven,(UINT8 *)&GuidNeedToCmp,sizeof(EFI_GUID));
+}
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.h
new file mode 100644
index 0000000..93811a7
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.h
@@ -0,0 +1,76 @@
+/** @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:
+
+ PartitionInfoBBTestMain.h
+
+Abstract:
+
+ Test Driver of Partition Info Protocol header file
+
+--*/
+
+#ifndef _PARTITION_INFO_BB_TEST_MAIN
+#define _PARTITION_INFO_BB_TEST_MAIN
+
+#include <Efi.h>
+#include <Library/EfiTestLib.h>
+#include <SctLib.h>
+#include <UEFI/Protocol/PartitionInfo.h>
+#include "Guid.h"
+
+
+#define EFI_PARTITION_INFO_PROTOCOL_TEST_REVISION 0x00010000
+
+//
+// Entry GUIDs for Func Test
+//
+#define EFI_PARTITION_INFO_PROTOCOL_TEST_ENTRY_GUID0101 \
+{ 0xf53c074a, 0x4625, 0x4380, { 0x90, 0x91, 0x4f, 0xfe, 0xd7, 0xf0, 0x3, 0x23 }}
+
+
+//
+//
+//
+EFI_STATUS
+InitializePartitionInfoBBTest (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+EFI_STATUS
+UnloadPartitionInfoBBTest (
+ IN EFI_HANDLE ImageHandle
+ );
+
+//
+//Test Cases
+//
+EFI_STATUS
+BBTestPartitionInfoFunctionTest (
+ IN EFI_BB_TEST_PROTOCOL *This,
+ IN VOID *ClientInterface,
+ IN EFI_TEST_LEVEL TestLevel,
+ IN EFI_HANDLE SupportHandle
+ );
+
+INTN
+GuidCmp(
+ EFI_GUID GuidGiven,
+ EFI_GUID GuidNeedToCmp
+ );
+
+#endif
diff --git a/uefi-sct/SctPkg/UEFI/Protocol/PartitionInfo.h b/uefi-sct/SctPkg/UEFI/Protocol/PartitionInfo.h
new file mode 100644
index 0000000..9fada5d
--- /dev/null
+++ b/uefi-sct/SctPkg/UEFI/Protocol/PartitionInfo.h
@@ -0,0 +1,93 @@
+/** @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:
+
+ PartitionInfo.h
+
+Abstract:
+
+ Partition Info protocol from the UEFI specification.
+
+--*/
+
+#ifndef _PARTITION_INFO_PROTOCOL_H_
+#define _PARTITION_INFO_PROTOCOL_H_
+
+#include <IndustryStandard/Mbr.h>
+#include <Uefi/UefiGpt.h>
+
+#define EFI_PARTITION_INFO_PROTOCOL_GUID \
+ { \
+ 0x8cf2f62c, 0xbc9b, 0x4821, {0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0} \
+ }
+
+#define EFI_UNUSED_ENTRY_GUID \
+{ 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
+extern EFI_GUID gPartitionInfoEFIUnusedEntryGuid;
+
+#define EFI_SYSTEM_PARTITION_GUID \
+{ 0xc12a7328, 0xf81f, 0x11d2, { 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } }
+extern EFI_GUID gPartitionInfoEFISystemPartitionGuid;
+
+#define EFI_PARTITION_CONTAINING_LEGACY_MBR_GUID \
+{ 0x024dee41, 0x33e7, 0x11d3, { 0x9d, 0x69, 0x00, 0x08, 0xc7, 0x81, 0xf3, 0x9f } }
+extern EFI_GUID gPartitionInfoEFIPartitionContainingLegacyMBRGuid;
+
+
+#define EFI_PARTITION_INFO_PROTOCOL_REVISION 0x0001000
+#define PARTITION_TYPE_OTHER 0x00
+#define PARTITION_TYPE_MBR 0x01
+#define PARTITION_TYPE_GPT 0x02
+
+
+
+#pragma pack(1)
+
+///
+/// Partition Information Protocol structure.
+///
+typedef struct {
+ //
+ // Set to EFI_PARTITION_INFO_PROTOCOL_REVISION.
+ //
+ UINT32 Revision;
+ //
+ // Partition info type (PARTITION_TYPE_MBR, PARTITION_TYPE_GPT, or PARTITION_TYPE_OTHER).
+ //
+ UINT32 Type;
+ //
+ // If 1, partition describes an EFI System Partition.
+ //
+ UINT8 System;
+ UINT8 Reserved[7];
+ union {
+ ///
+ /// MBR data
+ ///
+ MBR_PARTITION_RECORD Mbr;
+ ///
+ /// GPT data
+ ///
+ EFI_PARTITION_ENTRY Gpt;
+ } Info;
+} EFI_PARTITION_INFO_PROTOCOL;
+
+#pragma pack()
+
+
+extern EFI_GUID gBlackBoxEfiPartitionInfoProtocolGuid;
+
+#endif
\ No newline at end of file
diff --git a/uefi-sct/SctPkg/UEFI/UEFI.dec b/uefi-sct/SctPkg/UEFI/UEFI.dec
index 0d01d94..14cc5b0 100644
--- a/uefi-sct/SctPkg/UEFI/UEFI.dec
+++ b/uefi-sct/SctPkg/UEFI/UEFI.dec
@@ -182,5 +182,6 @@
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 }}
+ gBlackBoxEfiPartitionInfoProtocolGuid = { 0x8cf2f62c, 0xbc9b, 0x4821, {0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0 }}
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 227a45d..b6149cc 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/PartitionInfo/BlackBoxTest/PartitionInfoBBTest.inf
SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf
SctPkg/TestCase/UEFI/EFI/Protocol/ResetNotification/BlackBoxTest/ResetNotificationBBTest.inf
#
--
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 PartitionInfo Protocol
2018-10-11 15:35 [edk2-test][Patch] uefi-sct\SctPkg: Add new test of PartitionInfo Protocol Eric Jin
@ 2018-10-12 7:44 ` Supreeth Venkatesh
0 siblings, 0 replies; 2+ messages in thread
From: Supreeth Venkatesh @ 2018-10-12 7:44 UTC (permalink / raw)
To: Eric Jin, edk2-devel
Since this was already present in
https://github.com/UEFI/UEFI-SCT/commit/86df722a7bc02a15fba471664c0b2c5dec3797bf
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:35 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 ++
> .../EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.c | 31 +++++
> .../EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.h | 41 ++++++
> .../BlackBoxTest/PartitionInfoBBTest.inf | 53 ++++++++
> .../BlackBoxTest/PartitionInfoBBTestFunction.c | 137 ++++++++++++++++++++
> .../BlackBoxTest/PartitionInfoBBTestMain.c | 139 +++++++++++++++++++++
> .../BlackBoxTest/PartitionInfoBBTestMain.h | 76 +++++++++++
> uefi-sct/SctPkg/UEFI/Protocol/PartitionInfo.h | 93 ++++++++++++++
> uefi-sct/SctPkg/UEFI/UEFI.dec | 1 +
> uefi-sct/SctPkg/UEFI/UEFI_SCT.dsc | 1 +
> 12 files changed, 581 insertions(+)
> create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.c
> create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.h
> create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTest.inf
> create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestFunction.c
> create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.c
> create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.h
> create mode 100644 uefi-sct/SctPkg/UEFI/Protocol/PartitionInfo.h
>
> diff --git a/uefi-sct/SctPkg/CommonGenFramework.bat b/uefi-sct/SctPkg/CommonGenFramework.bat
> index b566ebf..5c614ea 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%\PartitionInfoBBTest.efi %Framework%\Test\ > NUL
> copy %ProcessorType%\UFSDeviceConfigBBTest.efi %Framework%\Test\ > NUL
> copy %ProcessorType%\ResetNotificationBBTest.efi %Framework%\Test\ > NUL
>
> diff --git a/uefi-sct/SctPkg/CommonGenFramework.sh b/uefi-sct/SctPkg/CommonGenFramework.sh
> index 9efc7da..299f0d6 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/PartitionInfoBBTest.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 22dbfa8..3e9f5e5 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 = 8CF2F62C-BC9B-4821-808D-EC9EC421A1A0
> +InterfaceGuid = 8CF2F62C-BC9B-4821-808D-EC9EC421A1A0
> +Name = MediaAccessTest\PartitionInfo
> +Description =
> +
> +[Category Data]
> +Revision = 0x00010000
> CategoryGuid = B81BFAB0-0EB3-4CF9-8465-7FA986361664
> InterfaceGuid = B81BFAB0-0EB3-4CF9-8465-7FA986361664
> Name = MediaAccessTest\UFSDeviceConfig
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.c
> new file mode 100644
> index 0000000..b5186d3
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.c
> @@ -0,0 +1,31 @@
> +/** @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 "PartitionInfoBBTestMain.h"
> +
> +
> +EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid001 = EFI_TEST_PARTITIONINFOBBTESTFUNCTION_ASSERTION_001_GUID;
> +EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid002 = EFI_TEST_PARTITIONINFOBBTESTFUNCTION_ASSERTION_002_GUID;
> +EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid003 = EFI_TEST_PARTITIONINFOBBTESTFUNCTION_ASSERTION_003_GUID;
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.h
> new file mode 100644
> index 0000000..e69cc1c
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/Guid.h
> @@ -0,0 +1,41 @@
> +/** @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_PARTITIONINFOBBTESTFUNCTION_ASSERTION_001_GUID \
> +{ 0xcaf4ea69, 0x573, 0x4b98, { 0xa3, 0x5b, 0x9b, 0xf, 0x95, 0xaa, 0xe2, 0xa4 } }
> +extern EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid001;
> +
> +#define EFI_TEST_PARTITIONINFOBBTESTFUNCTION_ASSERTION_002_GUID \
> +{ 0xec401ac3, 0xec7c, 0x4b1e, { 0x8f, 0x1c, 0x6d, 0xa0, 0x25, 0x2c, 0xbf, 0xbc } }
> +extern EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid002;
> +
> +#define EFI_TEST_PARTITIONINFOBBTESTFUNCTION_ASSERTION_003_GUID \
> +{ 0xa807ce2d, 0x3630, 0x4929, { 0xaf, 0xaf, 0xce, 0xb3, 0xb8, 0xea, 0x5c, 0xbd } }
> +extern EFI_GUID gPartitionInfoBBTestFunctionAssertionGuid003;
> +
> +
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTest.inf
> new file mode 100644
> index 0000000..0ed5730
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTest.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:
> +#
> +# PartitionInfoBBTest.inf
> +#
> +# Abstract:
> +#
> +# Component description file for Partition Info Protocol Black-Box Test.
> +#
> +#--*/
> +
> +[defines]
> + INF_VERSION = 0x00010005
> + BASE_NAME = PartitionInfoBBTest
> + FILE_GUID = 57EEBBDC-D0B8-4428-980E-75E11A237642
> + MODULE_TYPE = UEFI_DRIVER
> + VERSION_STRING = 1.0
> + ENTRY_POINT = InitializePartitionInfoBBTest
> +
> +[sources.common]
> + PartitionInfoBBTestFunction.c
> + PartitionInfoBBTestMain.c
> + Guid.c
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> + SctPkg/SctPkg.dec
> + SctPkg/UEFI/UEFI.dec
> +
> +[LibraryClasses]
> + UefiDriverEntryPoint
> + SctLib
> + EfiTestLib
> +
> +[Protocols]
> + gBlackBoxEfiPartitionInfoProtocolGuid
> +
> +[Guids]
> +
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestFunction.c
> new file mode 100644
> index 0000000..076cf19
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestFunction.c
> @@ -0,0 +1,137 @@
> +/** @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:
> +
> + PartitionInfoBBTestFunction.c
> +
> +Abstract:
> +
> + for EFI Driver Partition Info Protocol's Function Test
> +
> +--*/
> +
> +#include "PartitionInfoBBTestMain.h"
> +
> +EFI_GUID gPartitionInfoEFIUnusedEntryGuid = EFI_UNUSED_ENTRY_GUID;
> +EFI_GUID gPartitionInfoEFISystemPartitionGuid = EFI_SYSTEM_PARTITION_GUID;
> +EFI_GUID gPartitionInfoEFIPartitionContainingLegacyMBRGuid = EFI_PARTITION_CONTAINING_LEGACY_MBR_GUID;
> +
> +EFI_STATUS
> +BBTestPartitionInfoFunctionTest (
> + 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_PARTITION_INFO_PROTOCOL *PartitionInfo;
> + EFI_TEST_ASSERTION AssertionType;
> +
> + PartitionInfo = (EFI_PARTITION_INFO_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;
> + }
> +
> +
> + if ((PartitionInfo->Revision != EFI_PARTITION_INFO_PROTOCOL_REVISION) ||
> + ((PartitionInfo->Type != PARTITION_TYPE_OTHER) && (PartitionInfo->Type != PARTITION_TYPE_MBR) && (PartitionInfo->Type != PARTITION_TYPE_GPT)) ||
> + ((PartitionInfo->System != 0) && (PartitionInfo->System != 1))) {
> + AssertionType = EFI_TEST_ASSERTION_FAILED;
> + } else {
> + AssertionType = EFI_TEST_ASSERTION_PASSED;
> + }
> + StandardLib->RecordAssertion (
> + StandardLib,
> + AssertionType,
> + gPartitionInfoBBTestFunctionAssertionGuid001,
> + L"PartitionInfo - Revision, Type, System test",
> + L"%a:%d:Revision - 0x%08x, Info - %d, System - %d\n",
> + __FILE__,
> + (UINTN)__LINE__,
> + PartitionInfo->Revision,
> + PartitionInfo->Type,
> + PartitionInfo->System
> + );
> +
> + if (AssertionType == EFI_TEST_ASSERTION_PASSED) {
> + if (PartitionInfo->Type == PARTITION_TYPE_MBR) {
> + if (PartitionInfo->Info.Mbr.OSIndicator == 0xEF) {
> + if ((PartitionInfo->System != 1))
> + AssertionType = EFI_TEST_ASSERTION_FAILED;
> + else
> + AssertionType = EFI_TEST_ASSERTION_PASSED;
> + StandardLib->RecordAssertion (
> + StandardLib,
> + AssertionType,
> + gPartitionInfoBBTestFunctionAssertionGuid003,
> + L"PartitionInfo - Mbr.OSIndicator should be aligned with PartitionInfo->System",
> + L"%a:%d:Mbr.OSIndicator - %d, System - %d\n",
> + __FILE__,
> + (UINTN)__LINE__,
> + PartitionInfo->Info.Mbr.OSIndicator,
> + PartitionInfo->System
> + );
> + }
> + }
> + if (PartitionInfo->Type == PARTITION_TYPE_GPT) {
> + if (!GuidCmp(PartitionInfo->Info.Gpt.PartitionTypeGUID, gPartitionInfoEFISystemPartitionGuid)) {
> + if ((PartitionInfo->System != 1))
> + AssertionType = EFI_TEST_ASSERTION_FAILED;
> + else
> + AssertionType = EFI_TEST_ASSERTION_PASSED;
> +
> + StandardLib->RecordAssertion (
> + StandardLib,
> + AssertionType,
> + gPartitionInfoBBTestFunctionAssertionGuid002,
> + L"PartitionInfo - Gpt.PartitionTypeGUID should be aligned with PartitionInfo->System",
> + L"%a:%d:Gpt.PartitionTypeGUID - %g, System - %d\n",
> + __FILE__,
> + (UINTN)__LINE__,
> + &PartitionInfo->Info.Gpt.PartitionTypeGUID,
> + PartitionInfo->System
> + );
> + }
> +
> + }
> +
> + }
> +
> + return EFI_SUCCESS;
> +}
> +
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.c
> new file mode 100644
> index 0000000..684265e
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.c
> @@ -0,0 +1,139 @@
> +/** @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:
> +
> + PartitionInfoBBTestMain.c
> +
> +Abstract:
> +
> + Test Driver of Partition Info Protocol
> +
> +--*/
> +
> +
> +#include "PartitionInfoBBTestMain.h"
> +
> +#define EFI_PARTITION_INFO_TEST_GUID \
> + {0x8cf2f62c, 0xbc9b, 0x4821, {0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0}}
> +
> +//
> +// Global variables
> +//
> +EFI_HANDLE mImageHandle;
> +
> +UINT8 EnterEvent;
> +
> +
> +EFI_BB_TEST_PROTOCOL *gBBTestProtocolInterface;
> +
> +EFI_BB_TEST_PROTOCOL_FIELD gBBTestProtocolField = {
> + EFI_PARTITION_INFO_PROTOCOL_TEST_REVISION,
> + EFI_PARTITION_INFO_TEST_GUID,
> + L"Partition Info Protocol Test",
> + L"UEFI Partition Info Protocol Black-Box Test"
> +};
> +
> +EFI_GUID gSupportProtocolGuid[] = {
> + EFI_STANDARD_TEST_LIBRARY_GUID,
> + EFI_NULL_GUID
> +};
> +
> +EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
> + {
> + EFI_PARTITION_INFO_PROTOCOL_TEST_ENTRY_GUID0101,
> + L"PartitionInfoFunction",
> + L"Function auto test for Partition Info Protocol",
> + EFI_TEST_LEVEL_MINIMAL,
> + gSupportProtocolGuid,
> + EFI_TEST_CASE_AUTO,
> + BBTestPartitionInfoFunctionTest
> + },
> + 0
> +};
> +
> +
> +EFI_STATUS
> +InitializePartitionInfoBBTest (
> + 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,
> + UnloadPartitionInfoBBTest,
> + &gBBTestProtocolInterface
> + );
> +
> +}
> +
> +
> +EFI_STATUS
> +UnloadPartitionInfoBBTest (
> + IN EFI_HANDLE ImageHandle
> + )
> +{
> +
> + return EfiUninstallAndFreeBBTestInterface (
> + ImageHandle,
> + gBBTestProtocolInterface
> + );
> +}
> +
> +
> +
> +INTN
> +MemCmp(
> + UINT8 *s1,
> + UINT8 *s2,
> + UINTN n
> + )
> +{
> + UINT8 *p1, *p2;
> +
> + p1 = s1;
> + p2 = s2;
> + if (n != 0) {
> + do {
> + if (*p1++ != *p2++)
> + return (*--p1 - *--p2);
> + } while (--n != 0);
> + }
> + return (0);
> +}
> +
> +
> +
> +INTN
> +GuidCmp(
> + EFI_GUID GuidGiven,
> + EFI_GUID GuidNeedToCmp
> + )
> +{
> + return MemCmp((UINT8 *)&GuidGiven,(UINT8 *)&GuidNeedToCmp,sizeof(EFI_GUID));
> +}
> diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.h
> new file mode 100644
> index 0000000..93811a7
> --- /dev/null
> +++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Protocol/PartitionInfo/BlackBoxTest/PartitionInfoBBTestMain.h
> @@ -0,0 +1,76 @@
> +/** @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:
> +
> + PartitionInfoBBTestMain.h
> +
> +Abstract:
> +
> + Test Driver of Partition Info Protocol header file
> +
> +--*/
> +
> +#ifndef _PARTITION_INFO_BB_TEST_MAIN
> +#define _PARTITION_INFO_BB_TEST_MAIN
> +
> +#include <Efi.h>
> +#include <Library/EfiTestLib.h>
> +#include <SctLib.h>
> +#include <UEFI/Protocol/PartitionInfo.h>
> +#include "Guid.h"
> +
> +
> +#define EFI_PARTITION_INFO_PROTOCOL_TEST_REVISION 0x00010000
> +
> +//
> +// Entry GUIDs for Func Test
> +//
> +#define EFI_PARTITION_INFO_PROTOCOL_TEST_ENTRY_GUID0101 \
> +{ 0xf53c074a, 0x4625, 0x4380, { 0x90, 0x91, 0x4f, 0xfe, 0xd7, 0xf0, 0x3, 0x23 }}
> +
> +
> +//
> +//
> +//
> +EFI_STATUS
> +InitializePartitionInfoBBTest (
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> + );
> +
> +EFI_STATUS
> +UnloadPartitionInfoBBTest (
> + IN EFI_HANDLE ImageHandle
> + );
> +
> +//
> +//Test Cases
> +//
> +EFI_STATUS
> +BBTestPartitionInfoFunctionTest (
> + IN EFI_BB_TEST_PROTOCOL *This,
> + IN VOID *ClientInterface,
> + IN EFI_TEST_LEVEL TestLevel,
> + IN EFI_HANDLE SupportHandle
> + );
> +
> +INTN
> +GuidCmp(
> + EFI_GUID GuidGiven,
> + EFI_GUID GuidNeedToCmp
> + );
> +
> +#endif
> diff --git a/uefi-sct/SctPkg/UEFI/Protocol/PartitionInfo.h b/uefi-sct/SctPkg/UEFI/Protocol/PartitionInfo.h
> new file mode 100644
> index 0000000..9fada5d
> --- /dev/null
> +++ b/uefi-sct/SctPkg/UEFI/Protocol/PartitionInfo.h
> @@ -0,0 +1,93 @@
> +/** @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:
> +
> + PartitionInfo.h
> +
> +Abstract:
> +
> + Partition Info protocol from the UEFI specification.
> +
> +--*/
> +
> +#ifndef _PARTITION_INFO_PROTOCOL_H_
> +#define _PARTITION_INFO_PROTOCOL_H_
> +
> +#include <IndustryStandard/Mbr.h>
> +#include <Uefi/UefiGpt.h>
> +
> +#define EFI_PARTITION_INFO_PROTOCOL_GUID \
> + { \
> + 0x8cf2f62c, 0xbc9b, 0x4821, {0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0} \
> + }
> +
> +#define EFI_UNUSED_ENTRY_GUID \
> +{ 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
> +extern EFI_GUID gPartitionInfoEFIUnusedEntryGuid;
> +
> +#define EFI_SYSTEM_PARTITION_GUID \
> +{ 0xc12a7328, 0xf81f, 0x11d2, { 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } }
> +extern EFI_GUID gPartitionInfoEFISystemPartitionGuid;
> +
> +#define EFI_PARTITION_CONTAINING_LEGACY_MBR_GUID \
> +{ 0x024dee41, 0x33e7, 0x11d3, { 0x9d, 0x69, 0x00, 0x08, 0xc7, 0x81, 0xf3, 0x9f } }
> +extern EFI_GUID gPartitionInfoEFIPartitionContainingLegacyMBRGuid;
> +
> +
> +#define EFI_PARTITION_INFO_PROTOCOL_REVISION 0x0001000
> +#define PARTITION_TYPE_OTHER 0x00
> +#define PARTITION_TYPE_MBR 0x01
> +#define PARTITION_TYPE_GPT 0x02
> +
> +
> +
> +#pragma pack(1)
> +
> +///
> +/// Partition Information Protocol structure.
> +///
> +typedef struct {
> + //
> + // Set to EFI_PARTITION_INFO_PROTOCOL_REVISION.
> + //
> + UINT32 Revision;
> + //
> + // Partition info type (PARTITION_TYPE_MBR, PARTITION_TYPE_GPT, or PARTITION_TYPE_OTHER).
> + //
> + UINT32 Type;
> + //
> + // If 1, partition describes an EFI System Partition.
> + //
> + UINT8 System;
> + UINT8 Reserved[7];
> + union {
> + ///
> + /// MBR data
> + ///
> + MBR_PARTITION_RECORD Mbr;
> + ///
> + /// GPT data
> + ///
> + EFI_PARTITION_ENTRY Gpt;
> + } Info;
> +} EFI_PARTITION_INFO_PROTOCOL;
> +
> +#pragma pack()
> +
> +
> +extern EFI_GUID gBlackBoxEfiPartitionInfoProtocolGuid;
> +
> +#endif
> \ No newline at end of file
> diff --git a/uefi-sct/SctPkg/UEFI/UEFI.dec b/uefi-sct/SctPkg/UEFI/UEFI.dec
> index 0d01d94..14cc5b0 100644
> --- a/uefi-sct/SctPkg/UEFI/UEFI.dec
> +++ b/uefi-sct/SctPkg/UEFI/UEFI.dec
> @@ -182,5 +182,6 @@
> 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 }}
> + gBlackBoxEfiPartitionInfoProtocolGuid = { 0x8cf2f62c, 0xbc9b, 0x4821, {0x80, 0x8d, 0xec, 0x9e, 0xc4, 0x21, 0xa1, 0xa0 }}
> 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 227a45d..b6149cc 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/PartitionInfo/BlackBoxTest/PartitionInfoBBTest.inf
> SctPkg/TestCase/UEFI/EFI/Protocol/UFSDeviceConfig/BlackBoxTest/UFSDeviceConfigBBTest.inf
> SctPkg/TestCase/UEFI/EFI/Protocol/ResetNotification/BlackBoxTest/ResetNotificationBBTest.inf
> #
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-12 7:45 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:35 [edk2-test][Patch] uefi-sct\SctPkg: Add new test of PartitionInfo Protocol Eric Jin
2018-10-12 7:44 ` Supreeth Venkatesh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox