public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Sakar Arora <sakar.arora@arm.com>
To: edk2-devel@lists.01.org
Cc: Supreeth.Venkatesh@arm.com, prasanth.pulla@arm.com
Subject: [edk2-test][RFC PATCH 09/12] uefi-sct/SctPkg: sbbr: UEFI SMBIOS Base Requirements
Date: Tue,  6 Nov 2018 14:17:43 +0530	[thread overview]
Message-ID: <1541494066-16288-9-git-send-email-sakar.arora@arm.com> (raw)
In-Reply-To: <1541494066-16288-1-git-send-email-sakar.arora@arm.com>

From: John Powell <john.powell@arm.com>

Tests that SMBIOS3 table is properly accessible from UEFI and
that it is in the correct memory region.

Change-Id: I113ead8183f02886e0facded0ed2ad4e213677d8
Signed-off-by: John Powell <john.powell@arm.com>
---
 uefi-sct/SctPkg/CommonGenFramework.sh              |   3 +
 uefi-sct/SctPkg/Config/Data/Category.ini           |   7 +
 .../EFI/Generic/SbbrSmbios/BlackBoxTest/Guid.c     |  61 ++++++
 .../EFI/Generic/SbbrSmbios/BlackBoxTest/Guid.h     |  66 ++++++
 .../SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTest.inf   |  84 ++++++++
 .../BlackBoxTest/SbbrSmbiosBBTestFunction.c        | 222 +++++++++++++++++++++
 .../BlackBoxTest/SbbrSmbiosBBTestFunction.h        |  69 +++++++
 .../SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestMain.c | 181 +++++++++++++++++
 .../SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestMain.h |  90 +++++++++
 uefi-sct/SctPkg/UEFI/SBBR_SCT.dsc                  |   5 +
 10 files changed, 788 insertions(+)
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/Guid.c
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/Guid.h
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTest.inf
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestFunction.c
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestFunction.h
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestMain.c
 create mode 100644 uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestMain.h

diff --git a/uefi-sct/SctPkg/CommonGenFramework.sh b/uefi-sct/SctPkg/CommonGenFramework.sh
index 7058111..8e7c7ca 100755
--- a/uefi-sct/SctPkg/CommonGenFramework.sh
+++ b/uefi-sct/SctPkg/CommonGenFramework.sh
@@ -370,6 +370,9 @@ then
     # Check if EFI Specification Version is 2.5 or greater
     cp $ProcessorType/EfiSpecVerLvlBBTest.efi                  $Framework/Test/ > NUL
 
+    # SMBIOS Requirements on UEFI - SBBR v1.0 5.1.1
+    cp $ProcessorType/SbbrSmbiosBBTest.efi                     $Framework/Test/ > NUL
+
     # Runtime Services Tests - SBBR v1.0 Appendix B
     cp $ProcessorType/VariableServicesBBTest.efi               $Framework/Test/ > NUL
     cp $ProcessorType/TimeServicesBBTest.efi                   $Framework/Test/ > NUL
diff --git a/uefi-sct/SctPkg/Config/Data/Category.ini b/uefi-sct/SctPkg/Config/Data/Category.ini
index 17ca639..66b2112 100644
--- a/uefi-sct/SctPkg/Config/Data/Category.ini
+++ b/uefi-sct/SctPkg/Config/Data/Category.ini
@@ -96,6 +96,13 @@ Description   = Checks that UEFI protocols required by ARM SBBR are present.
 
 [Category Data]
 Revision      = 0x00010000
+CategoryGuid  = 852e92eb-d7aa-4d61-84ef-d32dc5d545ec
+InterfaceGuid = 71652D04-BF38-434A-BCB8-6547D7FD8384
+Name          = GenericTest\SbbrSmbios
+Description   = Checks that SMBIOS on UEFI is implemented correctly.
+
+[Category Data]
+Revision      = 0x00010000
 CategoryGuid  = D84A6430-99F5-4660-8454-6E4C896A7E51
 InterfaceGuid = 71652D04-BF38-434a-BCB8-6547D7FD8384
 Name          = GenericTest\SbbrSysEnvConfig
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/Guid.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/Guid.c
new file mode 100644
index 0000000..5a685f6
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/Guid.c
@@ -0,0 +1,61 @@
+/*++
+  The material contained herein is not a license, either
+  expressly or impliedly, to any intellectual property owned
+  or controlled by any of the authors or developers of this
+  material or to any contribution thereto. The material
+  contained herein is provided on an "AS IS" basis and, to the
+  maximum extent permitted by applicable law, this information
+  is provided AS IS AND WITH ALL FAULTS, and the authors and
+  developers of this material hereby disclaim all other
+  warranties and conditions, either express, implied or
+  statutory, including, but not limited to, any (if any)
+  implied warranties, duties or conditions of merchantability,
+  of fitness for a particular purpose, of accuracy or
+  completeness of responses, of results, of workmanlike
+  effort, of lack of viruses and of lack of negligence, all
+  with regard to this material and any contribution thereto.
+  Designers must not rely on the absence or characteristics of
+  any features or instructions marked "reserved" or
+  "undefined." The Unified EFI Forum, Inc. reserves any
+  features or instructions so marked for future definition and
+  shall have no responsibility whatsoever for conflicts or
+  incompatibilities arising from future changes to them. ALSO,
+  THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
+  QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR
+  NON-INFRINGEMENT WITH REGARD TO THE TEST SUITE AND ANY
+  CONTRIBUTION THERETO.
+
+  IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THIS MATERIAL OR
+  ANY CONTRIBUTION THERETO BE LIABLE TO ANY OTHER PARTY FOR
+  THE COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST
+  PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY INCIDENTAL,
+  CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER
+  UNDER CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY
+  WAY OUT OF THIS OR ANY OTHER AGREEMENT RELATING TO THIS
+  DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF
+  THE POSSIBILITY OF SUCH DAMAGES.
+
+  Copyright 2006 - 2016 Unified EFI, Inc. All
+  Rights Reserved, subject to all existing rights in all
+  matters included within this Test Suite, to which United
+  EFI, Inc. makes no claim of right.
+
+  Copyright (c) 2016, ARM LTD. All rights reserved.
+
+--*/
+/*++
+
+Module Name:
+
+  Guid.c
+
+Abstract:
+
+  Global variable assignments for GUIDs used in test assertions.
+
+--*/
+
+#include "Efi.h"
+#include "Guid.h"
+
+EFI_GUID gSbbrSmbiosAssertion001Guid = SBBRSMBIOS_ASSERTION_001_GUID;
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/Guid.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/Guid.h
new file mode 100644
index 0000000..967be4d
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/Guid.h
@@ -0,0 +1,66 @@
+/*++
+  The material contained herein is not a license, either
+  expressly or impliedly, to any intellectual property owned
+  or controlled by any of the authors or developers of this
+  material or to any contribution thereto. The material
+  contained herein is provided on an "AS IS" basis and, to the
+  maximum extent permitted by applicable law, this information
+  is provided AS IS AND WITH ALL FAULTS, and the authors and
+  developers of this material hereby disclaim all other
+  warranties and conditions, either express, implied or
+  statutory, including, but not limited to, any (if any)
+  implied warranties, duties or conditions of merchantability,
+  of fitness for a particular purpose, of accuracy or
+  completeness of responses, of results, of workmanlike
+  effort, of lack of viruses and of lack of negligence, all
+  with regard to this material and any contribution thereto.
+  Designers must not rely on the absence or characteristics of
+  any features or instructions marked "reserved" or
+  "undefined." The Unified EFI Forum, Inc. reserves any
+  features or instructions so marked for future definition and
+  shall have no responsibility whatsoever for conflicts or
+  incompatibilities arising from future changes to them. ALSO,
+  THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
+  QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR
+  NON-INFRINGEMENT WITH REGARD TO THE TEST SUITE AND ANY
+  CONTRIBUTION THERETO.
+
+  IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THIS MATERIAL OR
+  ANY CONTRIBUTION THERETO BE LIABLE TO ANY OTHER PARTY FOR
+  THE COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST
+  PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY INCIDENTAL,
+  CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER
+  UNDER CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY
+  WAY OUT OF THIS OR ANY OTHER AGREEMENT RELATING TO THIS
+  DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF
+  THE POSSIBILITY OF SUCH DAMAGES.
+
+  Copyright 2006 - 2016 Unified EFI, Inc. All
+  Rights Reserved, subject to all existing rights in all
+  matters included within this Test Suite, to which United
+  EFI, Inc. makes no claim of right.
+
+  Copyright (c) 2016, ARM LTD. All rights reserved.
+
+--*/
+/*++
+
+Module Name:
+
+  Guid.h
+
+Abstract:
+
+  Definitions for GUIDs used in test assertions.
+
+--*/
+
+#ifndef _SBBRSMBIOS_GUID_H_
+#define _SBBRSMBIOS_GUID_H_
+
+#define SBBRSMBIOS_ASSERTION_001_GUID \
+  { 0xed2399ae, 0x416e, 0x46c6, {0xac, 0xa2, 0xd9, 0xb1, 0xcf, 0x99, 0x75, 0xcd }}
+
+extern EFI_GUID gSbbrSmbiosAssertion001Guid;
+
+#endif /* _SBBRSMBIOS_GUID_H_ */
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTest.inf b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTest.inf
new file mode 100644
index 0000000..91c013f
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTest.inf
@@ -0,0 +1,84 @@
+#
+# The material contained herein is not a license, either
+# expressly or impliedly, to any intellectual property owned
+# or controlled by any of the authors or developers of this
+# material or to any contribution thereto. The material
+# contained herein is provided on an "AS IS" basis and, to the
+# maximum extent permitted by applicable law, this information
+# is provided AS IS AND WITH ALL FAULTS, and the authors and
+# developers of this material hereby disclaim all other
+# warranties and conditions, either express, implied or
+# statutory, including, but not limited to, any (if any)
+# implied warranties, duties or conditions of merchantability,
+# of fitness for a particular purpose, of accuracy or
+# completeness of responses, of results, of workmanlike
+# effort, of lack of viruses and of lack of negligence, all
+# with regard to this material and any contribution thereto.
+# Designers must not rely on the absence or characteristics of
+# any features or instructions marked "reserved" or
+# "undefined." The Unified EFI Forum, Inc. reserves any
+# features or instructions so marked for future definition and
+# shall have no responsibility whatsoever for conflicts or
+# incompatibilities arising from future changes to them. ALSO,
+# THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
+# QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR
+# NON-INFRINGEMENT WITH REGARD TO THE TEST SUITE AND ANY
+# CONTRIBUTION THERETO.
+#
+# IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THIS MATERIAL OR
+# ANY CONTRIBUTION THERETO BE LIABLE TO ANY OTHER PARTY FOR
+# THE COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST
+# PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY INCIDENTAL,
+# CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER
+# UNDER CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY
+# WAY OUT OF THIS OR ANY OTHER AGREEMENT RELATING TO THIS
+# DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF
+# THE POSSIBILITY OF SUCH DAMAGES.
+#
+# Copyright 2006 - 2016 Unified EFI, Inc. All
+# Rights Reserved, subject to all existing rights in all
+# matters included within this Test Suite, to which United
+# EFI, Inc. makes no claim of right.
+#
+# Copyright (c) 2016, ARM LTD. All rights reserved.
+#
+#
+#/*++
+#
+# Module Name:
+#
+#   SbbrSmbiosBBTest.inf
+#
+# Abstract:
+#
+#   Component description file for SbbrSmbios tests.
+#
+#--*/
+
+[Defines]
+  INF_VERSION          = 0x00010019
+  BASE_NAME            = SbbrSmbiosBBTest
+  FILE_GUID            = 04a5d449-9c54-4937-8b83-142103adb759
+  MODULE_TYPE          = UEFI_DRIVER
+  VERSION_STRING       = 1.0
+  ENTRY_POINT          = InitializeBBTestSbbrSmbios
+
+[Sources.common]
+  Guid.c
+  SbbrSmbiosBBTestFunction.c
+  SbbrSmbiosBBTestMain.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  SctPkg/SctPkg.dec
+  SctPkg/UEFI/UEFI.dec
+
+[LibraryClasses]
+  EfiTestLib
+  SctLib
+  UefiDriverEntryPoint
+
+[Protocols]
+
+[Guids]
+  gEfiSmbios3TableGuid
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestFunction.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestFunction.c
new file mode 100644
index 0000000..7dca5ef
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestFunction.c
@@ -0,0 +1,222 @@
+/*++
+  The material contained herein is not a license, either
+  expressly or impliedly, to any intellectual property owned
+  or controlled by any of the authors or developers of this
+  material or to any contribution thereto. The material
+  contained herein is provided on an "AS IS" basis and, to the
+  maximum extent permitted by applicable law, this information
+  is provided AS IS AND WITH ALL FAULTS, and the authors and
+  developers of this material hereby disclaim all other
+  warranties and conditions, either express, implied or
+  statutory, including, but not limited to, any (if any)
+  implied warranties, duties or conditions of merchantability,
+  of fitness for a particular purpose, of accuracy or
+  completeness of responses, of results, of workmanlike
+  effort, of lack of viruses and of lack of negligence, all
+  with regard to this material and any contribution thereto.
+  Designers must not rely on the absence or characteristics of
+  any features or instructions marked "reserved" or
+  "undefined." The Unified EFI Forum, Inc. reserves any
+  features or instructions so marked for future definition and
+  shall have no responsibility whatsoever for conflicts or
+  incompatibilities arising from future changes to them. ALSO,
+  THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
+  QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR
+  NON-INFRINGEMENT WITH REGARD TO THE TEST SUITE AND ANY
+  CONTRIBUTION THERETO.
+
+  IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THIS MATERIAL OR
+  ANY CONTRIBUTION THERETO BE LIABLE TO ANY OTHER PARTY FOR
+  THE COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST
+  PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY INCIDENTAL,
+  CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER
+  UNDER CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY
+  WAY OUT OF THIS OR ANY OTHER AGREEMENT RELATING TO THIS
+  DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF
+  THE POSSIBILITY OF SUCH DAMAGES.
+
+  Copyright 2006 - 2016 Unified EFI, Inc. All
+  Rights Reserved, subject to all existing rights in all
+  matters included within this Test Suite, to which United
+  EFI, Inc. makes no claim of right.
+
+  Copyright (c) 2016, ARM LTD. All rights reserved.
+
+--*/
+/*++
+
+Module Name:
+
+  SbbrSmbiosBBTestFunction.c
+
+Abstract:
+
+  Test case function definitions for SbbrSmbios.
+
+--*/
+
+#include "SbbrSmbiosBBTestMain.h"
+#include "SbbrSmbiosBBTestFunction.h"
+#include "SctLib.h"
+#include "Guid.h"
+#include <IndustryStandard/SmBios.h>
+#include <Library/EfiTestLib.h>
+
+/**
+ *  Entrypoint for UefiSmbios Test.
+ *  @param This a pointer of EFI_BB_TEST_PROTOCOL.
+ *  @param ClientInterface a pointer to the interface to be tested.
+ *  @param TestLevel test "thoroughness" control.
+ *  @param SupportHandle a handle containing protocols required.
+ *  @return EFI_SUCCESS Finish the test successfully.
+ */
+
+EFI_STATUS
+BBTestUefiSmbiosTest (
+  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;
+  SMBIOS_TABLE_3_0_ENTRY_POINT        *SmbiosTable;
+  UINTN                               MemoryMapSize;
+  VOID                                *MemoryMap;
+  EFI_MEMORY_DESCRIPTOR               *MemoryMapDescriptor;
+  UINTN                               MapKey;
+  UINTN                               DescriptorSize;
+  UINT32                              DescriptorVersion;
+  UINT32                              i;
+  UINT64                              EndAddress;
+
+  //
+  // Get the Standard Library Interface
+  //
+  Status = gtBS->HandleProtocol (
+                   SupportHandle,
+                   &gEfiStandardTestLibraryGuid,
+                   (VOID **) &StandardLib
+                   );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  //
+  // Looking for SMBIOS table
+  //
+  Status = SctGetSystemConfigurationTable (
+              &gEfiSmbios3TableGuid,
+              (VOID **)&SmbiosTable
+              );
+  if (EFI_ERROR(Status)) {
+    StandardLib->RecordAssertion (
+                StandardLib,
+                EFI_TEST_ASSERTION_FAILED,
+                gSbbrSmbiosAssertion001Guid,
+                L"UefiSmbios",
+                L"%a:%d - SMBIOS30 Table Not Found",
+                __FILE__,
+                __LINE__
+                );
+    return EFI_SUCCESS;
+  }
+
+  //
+  // Checking SMBIOS table version
+  //
+  if (SmbiosTable->MajorVersion != SBBRSMBIOS_MAJOR_VERSION) {
+    StandardLib->RecordAssertion (
+                StandardLib,
+                EFI_TEST_ASSERTION_FAILED,
+                gSbbrSmbiosAssertion001Guid,
+                L"UefiSmbios",
+                L"%a:%d - SMBIOS30 table invalid version. %d",
+                __FILE__,
+                __LINE__,
+                SmbiosTable->MajorVersion
+                );
+    return EFI_SUCCESS;
+  }
+
+  //
+  // Getting Memory Map
+  //
+  Status = SbbrAllocAndGetMemoryMap (
+              &MemoryMapSize,
+              &MemoryMap,
+              &MapKey,
+              &DescriptorSize,
+              &DescriptorVersion
+              );
+  if (EFI_ERROR (Status)) {
+    StandardLib->RecordAssertion (
+                StandardLib,
+                EFI_TEST_ASSERTION_FAILED,
+                gTestGenericFailureGuid,
+                L"MemoryMap",
+                L"%a:%d - Could not retrieve memory map. 0x%X",
+                __FILE__,
+                __LINE__,
+                Status
+                );
+    return EFI_NOT_FOUND;
+  }
+
+  //
+  // Looping through memory map descriptors to find the one containing SMBIOS table
+  //
+  for (i = 0; i < MemoryMapSize / DescriptorSize; i++) {
+    MemoryMapDescriptor = (EFI_MEMORY_DESCRIPTOR *)(MemoryMap + (i * DescriptorSize));
+    EndAddress = MemoryMapDescriptor->PhysicalStart + (MemoryMapDescriptor->NumberOfPages * EFI_PAGE_SIZE);
+    if ( (SmbiosTable->TableAddress >= MemoryMapDescriptor->PhysicalStart) &&
+         ((SmbiosTable->TableAddress + SmbiosTable->TableMaximumSize) < EndAddress))
+    {
+      //
+      // Memory region containing SMBIOS table found
+      //
+      if (MemoryMapDescriptor->Type != EfiRuntimeServicesData) {
+        StandardLib->RecordAssertion (
+                    StandardLib,
+                    EFI_TEST_ASSERTION_FAILED,
+                    gSbbrSmbiosAssertion001Guid,
+                    L"UefiSmbios",
+                    L"%a:%d - Wrong SMBIOS30 Memory Type. 0x%X",
+                    __FILE__,
+                    __LINE__,
+                    MemoryMapDescriptor->Type
+                    );
+      } else {
+        StandardLib->RecordAssertion (
+                    StandardLib,
+                    EFI_TEST_ASSERTION_PASSED,
+                    gSbbrSmbiosAssertion001Guid,
+                    L"UefiSmbios",
+                    L"%a:%d",
+                    __FILE__,
+                    __LINE__
+                    );
+      }
+
+      SctFreePool(MemoryMap);
+      return EFI_SUCCESS;
+    }
+
+  }
+
+  //
+  // Memory region not found.
+  //
+  StandardLib->RecordAssertion (
+              StandardLib,
+              EFI_TEST_ASSERTION_FAILED,
+              gSbbrSmbiosAssertion001Guid,
+              L"UefiSmbios",
+              L"%a:%d - Memory region not found in map.",
+              __FILE__,
+              __LINE__
+              );
+  SctFreePool(MemoryMap);
+  return EFI_SUCCESS;
+}
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestFunction.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestFunction.h
new file mode 100644
index 0000000..1de882c
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestFunction.h
@@ -0,0 +1,69 @@
+/*++
+  The material contained herein is not a license, either
+  expressly or impliedly, to any intellectual property owned
+  or controlled by any of the authors or developers of this
+  material or to any contribution thereto. The material
+  contained herein is provided on an "AS IS" basis and, to the
+  maximum extent permitted by applicable law, this information
+  is provided AS IS AND WITH ALL FAULTS, and the authors and
+  developers of this material hereby disclaim all other
+  warranties and conditions, either express, implied or
+  statutory, including, but not limited to, any (if any)
+  implied warranties, duties or conditions of merchantability,
+  of fitness for a particular purpose, of accuracy or
+  completeness of responses, of results, of workmanlike
+  effort, of lack of viruses and of lack of negligence, all
+  with regard to this material and any contribution thereto.
+  Designers must not rely on the absence or characteristics of
+  any features or instructions marked "reserved" or
+  "undefined." The Unified EFI Forum, Inc. reserves any
+  features or instructions so marked for future definition and
+  shall have no responsibility whatsoever for conflicts or
+  incompatibilities arising from future changes to them. ALSO,
+  THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
+  QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR
+  NON-INFRINGEMENT WITH REGARD TO THE TEST SUITE AND ANY
+  CONTRIBUTION THERETO.
+
+  IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THIS MATERIAL OR
+  ANY CONTRIBUTION THERETO BE LIABLE TO ANY OTHER PARTY FOR
+  THE COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST
+  PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY INCIDENTAL,
+  CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER
+  UNDER CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY
+  WAY OUT OF THIS OR ANY OTHER AGREEMENT RELATING TO THIS
+  DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF
+  THE POSSIBILITY OF SUCH DAMAGES.
+
+  Copyright 2006 - 2016 Unified EFI, Inc. All
+  Rights Reserved, subject to all existing rights in all
+  matters included within this Test Suite, to which United
+  EFI, Inc. makes no claim of right.
+
+  Copyright (c) 2016, ARM LTD. All rights reserved.
+
+--*/
+/*++
+
+Module Name:
+
+  SbbrSmbiosBBTestFunction.h
+
+Abstract:
+
+  Contains definitions and prototypes for test case functions.
+
+--*/
+
+#ifndef _SBBRSMBIOS_BB_TEST_FUNCTION_H_
+#define _SBBRSMBIOS_BB_TEST_FUNCTION_H_
+
+EFI_STATUS
+BBTestUefiSmbiosTest (
+  IN EFI_BB_TEST_PROTOCOL       *This,
+  IN VOID                       *ClientInterface,
+  IN EFI_TEST_LEVEL             TestLevel,
+  IN EFI_HANDLE                 SupportHandle
+  );
+
+#endif /* _SBBRSMBIOS_BB_TEST_FUNCTION_H_ */
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestMain.c b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestMain.c
new file mode 100644
index 0000000..d6ff5a0
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestMain.c
@@ -0,0 +1,181 @@
+/*++
+  The material contained herein is not a license, either
+  expressly or impliedly, to any intellectual property owned
+  or controlled by any of the authors or developers of this
+  material or to any contribution thereto. The material
+  contained herein is provided on an "AS IS" basis and, to the
+  maximum extent permitted by applicable law, this information
+  is provided AS IS AND WITH ALL FAULTS, and the authors and
+  developers of this material hereby disclaim all other
+  warranties and conditions, either express, implied or
+  statutory, including, but not limited to, any (if any)
+  implied warranties, duties or conditions of merchantability,
+  of fitness for a particular purpose, of accuracy or
+  completeness of responses, of results, of workmanlike
+  effort, of lack of viruses and of lack of negligence, all
+  with regard to this material and any contribution thereto.
+  Designers must not rely on the absence or characteristics of
+  any features or instructions marked "reserved" or
+  "undefined." The Unified EFI Forum, Inc. reserves any
+  features or instructions so marked for future definition and
+  shall have no responsibility whatsoever for conflicts or
+  incompatibilities arising from future changes to them. ALSO,
+  THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
+  QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR
+  NON-INFRINGEMENT WITH REGARD TO THE TEST SUITE AND ANY
+  CONTRIBUTION THERETO.
+
+  IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THIS MATERIAL OR
+  ANY CONTRIBUTION THERETO BE LIABLE TO ANY OTHER PARTY FOR
+  THE COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST
+  PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY INCIDENTAL,
+  CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER
+  UNDER CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY
+  WAY OUT OF THIS OR ANY OTHER AGREEMENT RELATING TO THIS
+  DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF
+  THE POSSIBILITY OF SUCH DAMAGES.
+
+  Copyright 2006 - 2016 Unified EFI, Inc. All
+  Rights Reserved, subject to all existing rights in all
+  matters included within this Test Suite, to which United
+  EFI, Inc. makes no claim of right.
+
+  Copyright (c) 2016, ARM LTD. All rights reserved.
+
+--*/
+/*++
+
+Module Name:
+
+  SbbrSmbiosBBTestMain.c
+
+Abstract:
+
+  Test driver for SbbrSmbios tests.
+
+--*/
+
+#include "SctLib.h"
+#include "SbbrSmbiosBBTestMain.h"
+#include "SbbrSmbiosBBTestFunction.h"
+
+EFI_BB_TEST_PROTOCOL_FIELD gBBTestProtocolField = {
+  SBBRSMBIOS_TEST_REVISION,
+  SBBRSMBIOS_TEST_GUID,
+  L"SbbrSmbios Tests",
+  L"Checks that SMBIOS on UEFI is implemented correctly."
+};
+
+EFI_GUID gSupportProtocolGuid1[2] = {
+  EFI_STANDARD_TEST_LIBRARY_GUID,
+  EFI_NULL_GUID
+};
+
+EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
+  {
+    SBBRSMBIOS_UEFISMBIOS_GUID,
+    L"UefiSmbios",
+    L"Checks that the SMBIOS3 table is accessible though its GUID and that it has the correct memory region settings.",
+    EFI_TEST_LEVEL_DEFAULT,
+    gSupportProtocolGuid1,
+    EFI_TEST_CASE_AUTO,
+    BBTestUefiSmbiosTest
+  },
+  EFI_NULL_GUID
+};
+
+EFI_BB_TEST_PROTOCOL *gBBTestProtocolInterface;
+
+/**
+ *  The driver's Unload function
+ *  @param  ImageHandle The test driver image handle
+ *  @return EFI_SUCCESS Indicates the interface was Uninstalled
+*/
+EFI_STATUS
+BBTestSbbrSmbiosUnload (
+  IN EFI_HANDLE       ImageHandle
+  )
+{
+  return EfiUninstallAndFreeBBTestInterface (
+              ImageHandle,
+              gBBTestProtocolInterface
+           );
+}
+
+/**
+ *  Creates/installs the BlackBox Interface and eminating Entry Point
+ *  node list.
+ *  @param  ImageHandle The test driver image handle
+ *  @param  SystemTable Pointer to System Table
+ *  @return EFI_SUCCESS Indicates the interface was installed
+ *  @return EFI_OUT_OF_RESOURCES Indicates space for the new handle could not be allocated
+ *  @return EFI_INVALID_PARAMETER: One of the parameters has an invalid value.
+ */
+EFI_STATUS
+InitializeBBTestSbbrSmbios (
+  IN EFI_HANDLE           ImageHandle,
+  IN EFI_SYSTEM_TABLE     *SystemTable
+  )
+{
+
+  EfiInitializeTestLib (ImageHandle, SystemTable);
+  SctInitializeLib (ImageHandle, SystemTable);
+
+  return EfiInitAndInstallBBTestInterface (
+              &ImageHandle,
+              &gBBTestProtocolField,
+              gBBTestEntryField,
+              BBTestSbbrSmbiosUnload,
+              &gBBTestProtocolInterface
+              );
+}
+
+/**
+ * SbbrGetMemoryMap function used by test cases.
+ */
+EFI_STATUS
+SbbrAllocAndGetMemoryMap (
+  UINTN                               *MemoryMapSize,
+  VOID                                **MemoryMap,
+  UINTN                               *MapKey,
+  UINTN                               *DescriptorSize,
+  UINT32                              *DescriptorVersion
+  )
+{
+  EFI_STATUS                          Status;
+
+  //
+  // Getting memory map
+  //
+  do {
+    *MemoryMapSize = 0;
+    // First call with a size of 0 so we can find out how big the memory map is.
+    Status = gtBS->GetMemoryMap (
+                MemoryMapSize,
+                *MemoryMap,
+                MapKey,
+                DescriptorSize,
+                DescriptorVersion
+                );
+    if (Status != EFI_BUFFER_TOO_SMALL){
+      return EFI_NOT_FOUND;
+    }
+    *MemoryMap = SctAllocatePool(*MemoryMapSize);
+    if (*MemoryMap == NULL) {
+      return EFI_OUT_OF_RESOURCES;
+    }
+    // Second call with our newly allocated buffer should work properly.
+    Status = gtBS->GetMemoryMap (
+                MemoryMapSize,
+                *MemoryMap,
+                MapKey,
+                DescriptorSize,
+                DescriptorVersion
+                );
+    if (EFI_ERROR (Status)) {
+      SctFreePool(*MemoryMap);
+    }
+  } while (EFI_ERROR (Status));
+
+  return EFI_SUCCESS;
+}
diff --git a/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestMain.h b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestMain.h
new file mode 100644
index 0000000..8884bdd
--- /dev/null
+++ b/uefi-sct/SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTestMain.h
@@ -0,0 +1,90 @@
+/*++
+  The material contained herein is not a license, either
+  expressly or impliedly, to any intellectual property owned
+  or controlled by any of the authors or developers of this
+  material or to any contribution thereto. The material
+  contained herein is provided on an "AS IS" basis and, to the
+  maximum extent permitted by applicable law, this information
+  is provided AS IS AND WITH ALL FAULTS, and the authors and
+  developers of this material hereby disclaim all other
+  warranties and conditions, either express, implied or
+  statutory, including, but not limited to, any (if any)
+  implied warranties, duties or conditions of merchantability,
+  of fitness for a particular purpose, of accuracy or
+  completeness of responses, of results, of workmanlike
+  effort, of lack of viruses and of lack of negligence, all
+  with regard to this material and any contribution thereto.
+  Designers must not rely on the absence or characteristics of
+  any features or instructions marked "reserved" or
+  "undefined." The Unified EFI Forum, Inc. reserves any
+  features or instructions so marked for future definition and
+  shall have no responsibility whatsoever for conflicts or
+  incompatibilities arising from future changes to them. ALSO,
+  THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
+  QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR
+  NON-INFRINGEMENT WITH REGARD TO THE TEST SUITE AND ANY
+  CONTRIBUTION THERETO.
+
+  IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THIS MATERIAL OR
+  ANY CONTRIBUTION THERETO BE LIABLE TO ANY OTHER PARTY FOR
+  THE COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST
+  PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY INCIDENTAL,
+  CONSEQUENTIAL, DIRECT, INDIRECT, OR SPECIAL DAMAGES WHETHER
+  UNDER CONTRACT, TORT, WARRANTY, OR OTHERWISE, ARISING IN ANY
+  WAY OUT OF THIS OR ANY OTHER AGREEMENT RELATING TO THIS
+  DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF
+  THE POSSIBILITY OF SUCH DAMAGES.
+
+  Copyright 2006 - 2016 Unified EFI, Inc. All
+  Rights Reserved, subject to all existing rights in all
+  matters included within this Test Suite, to which United
+  EFI, Inc. makes no claim of right.
+
+  Copyright (c) 2016, ARM LTD. All rights reserved.
+
+--*/
+/*++
+
+Module Name:
+
+  SbbrSmbiosBBTestMain.h
+
+Abstract:
+
+  Contains definitions for test information and test GUIDs.
+
+--*/
+
+#ifndef _SBBRSMBIOS_TEST_MAIN_H_
+#define _SBBRSMBIOS_TEST_MAIN_H_
+
+#include "Efi.h"
+#include "Guid.h"
+#include <Library/EfiTestLib.h>
+
+#define SBBRSMBIOS_TEST_REVISION 0x00010000
+
+#define SBBRSMBIOS_TEST_GUID     \
+  { 0x852e92eb, 0xd7aa, 0x4d61, {0x84, 0xef, 0xd3, 0x2d, 0xc5, 0xd5, 0x45, 0xec }}
+
+#define SBBRSMBIOS_MAJOR_VERSION 3
+
+EFI_STATUS
+InitializeBBTestSbbrSmbios (
+  IN EFI_HANDLE           ImageHandle,
+  IN EFI_SYSTEM_TABLE     *SystemTable
+  );
+
+EFI_STATUS
+BBTestSbbrSmbiosUnload (
+  IN EFI_HANDLE       ImageHandle
+  );
+
+//
+// Entry GUIDs
+//
+
+#define SBBRSMBIOS_UEFISMBIOS_GUID \
+  { 0x71b32221, 0x8b9d, 0x4b41, {0x8b, 0x04, 0xee, 0x6d, 0x18, 0xa6, 0xe5, 0x25 }}
+
+#endif /* _SBBRSMBIOS_TEST_MAIN_H_ */
diff --git a/uefi-sct/SctPkg/UEFI/SBBR_SCT.dsc b/uefi-sct/SctPkg/UEFI/SBBR_SCT.dsc
index 931b8da..bf010c9 100644
--- a/uefi-sct/SctPkg/UEFI/SBBR_SCT.dsc
+++ b/uefi-sct/SctPkg/UEFI/SBBR_SCT.dsc
@@ -258,6 +258,11 @@ SctPkg/TestCase/UEFI/EFI/BootServices/SbbrBootServices/BlackBoxTest/SbbrBootServ
 # End of UEFI Boot Services - SBBR v1.0 3.4
 
 #
+# SMBIOS Requirements on UEFI - SBBR v1.0 5.1.1
+#
+SctPkg/TestCase/UEFI/EFI/Generic/SbbrSmbios/BlackBoxTest/SbbrSmbiosBBTest.inf
+
+#
 # Required UEFI Runtime Services Tests - SBBR v1.0 Appendix B
 #
 ##  1. EFI_GET_TIME
-- 
2.7.4



  parent reply	other threads:[~2018-11-06  8:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-06  8:47 [edk2-test][RFC PATCH 01/12] uefi-sct/SctPkg: sbbr: Add support to build SBBR v1.0 test cases Sakar Arora
2018-11-06  8:47 ` [edk2-test][RFC PATCH 02/12] uefi-sct/SctPkg: sbbr: Add boot services test cases for SBBR v1.0 Sakar Arora
2018-11-06 17:30   ` Leif Lindholm
2018-11-06  8:47 ` [edk2-test][RFC PATCH 03/12] uefi-sct/SctPkg: sbbr: Add System Environment Configuration Test Cases Sakar Arora
2018-11-06 17:38   ` Leif Lindholm
2018-11-06  8:47 ` [edk2-test][RFC PATCH 04/12] uefi-sct/SctPkg: sbbr: Add Required UEFI Runtime Services tests Sakar Arora
2018-11-06 17:40   ` Leif Lindholm
2018-11-06  8:47 ` [edk2-test][RFC PATCH 05/12] uefi-sct/SctPkg: sbbr: Add test cases for SBBR v1.0 Appendix C Sakar Arora
2018-11-06  8:47 ` [edk2-test][RFC PATCH 06/12] uefi-sct/SctPkg: sbbr: Add test cases for SBBR v1.0 3.5.4 and 3.5.5 Sakar Arora
2018-11-06  8:47 ` [edk2-test][RFC PATCH 07/12] uefi-sct/SctPkg: sbbr: Add test cases for SBBR v1.0 boot services Sakar Arora
2018-11-06 17:46   ` Leif Lindholm
2018-11-07 20:55     ` Supreeth Venkatesh
2018-11-06  8:47 ` [edk2-test][RFC PATCH 08/12] uefi-sct/SctPkg: sbbr: UEFI Version Verification Test Sakar Arora
2018-11-06 17:48   ` Leif Lindholm
2018-11-06  8:47 ` Sakar Arora [this message]
2018-11-06  8:47 ` [edk2-test][RFC PATCH 10/12] uefi-sct/SctPkg: sbbr: Corrected path to ArmBaseLib.inf in SBBR_SCT.dsc Sakar Arora
2018-11-06 17:51   ` Leif Lindholm
2018-11-06  8:47 ` [edk2-test][RFC PATCH 11/12] uefi-sct/SctPkg: sbbr: Bugfix for MemoryMap Check Test Sakar Arora
2018-11-06 17:53   ` Leif Lindholm
2018-11-20  7:55   ` Jin, Eric
2018-11-06  8:47 ` [edk2-test][RFC PATCH 12/12] uefi-sct/SctPkg: sbbr: Modify SBBR description file to add missing dependencies Sakar Arora
2018-11-06 17:56   ` Leif Lindholm
2018-11-06 12:45 ` [edk2-test][RFC PATCH 01/12] uefi-sct/SctPkg: sbbr: Add support to build SBBR v1.0 test cases Leif Lindholm
2018-11-06 17:39   ` Supreeth Venkatesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1541494066-16288-9-git-send-email-sakar.arora@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox