]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg: Add PlatformSecLib
authorMichael Kinney <michael.d.kinney@intel.com>
Mon, 19 Oct 2015 19:09:56 +0000 (19:09 +0000)
committermdkinney <mdkinney@Edk2>
Mon, 19 Oct 2015 19:09:56 +0000 (19:09 +0000)
Add PlatformSecLib class and PlatformSecLibNull instance
that is used by the SecCore.  PlatformSecLibNull should
not be used in a platform build.  Instead, it should be
used as a template for implementing a platform specific
instance of the PlatformSecLib library class.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18635 6f19259b-4bc3-4df7-8a09-765794883524

UefiCpuPkg/Include/Library/PlatformSecLib.h [new file with mode: 0644]
UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.c [new file with mode: 0644]
UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.inf [new file with mode: 0644]
UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.uni [new file with mode: 0644]

diff --git a/UefiCpuPkg/Include/Library/PlatformSecLib.h b/UefiCpuPkg/Include/Library/PlatformSecLib.h
new file mode 100644 (file)
index 0000000..0af7781
--- /dev/null
@@ -0,0 +1,70 @@
+/** @file\r
+This library class defines interface for platform to perform platform\r
+specific initialization in SEC phase.\r
+\r
+Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __PLATFORM_SEC_LIB_H__\r
+#define __PLATFORM_SEC_LIB_H__\r
+\r
+/**\r
+  A developer supplied function to perform platform specific operations.\r
+\r
+  It's a developer supplied function to perform any operations appropriate to a\r
+  given platform. It's invoked just before passing control to PEI core by SEC\r
+  core. Platform developer may modify the SecCoreData passed to PEI Core.\r
+  It returns a platform specific PPI list that platform wishes to pass to PEI core.\r
+  The Generic SEC core module will merge this list to join the final list passed to\r
+  PEI core.\r
+\r
+  @param  SecCoreData           The same parameter as passing to PEI core. It\r
+                                could be overridden by this function.\r
+\r
+  @return The platform specific PPI list to be passed to PEI core or\r
+          NULL if there is no need of such platform specific PPI list.\r
+\r
+**/\r
+EFI_PEI_PPI_DESCRIPTOR *\r
+EFIAPI\r
+SecPlatformMain (\r
+  IN OUT   EFI_SEC_PEI_HAND_OFF        *SecCoreData\r
+  );\r
+\r
+/**\r
+  This interface conveys state information out of the Security (SEC) phase into PEI.\r
+\r
+  @param  PeiServices               Pointer to the PEI Services Table.\r
+  @param  StructureSize             Pointer to the variable describing size of the input buffer.\r
+  @param  PlatformInformationRecord Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.\r
+\r
+  @retval EFI_SUCCESS           The data was successfully returned.\r
+  @retval EFI_BUFFER_TOO_SMALL  The buffer was too small.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SecPlatformInformation (\r
+  IN CONST EFI_PEI_SERVICES                     **PeiServices,\r
+  IN OUT   UINT64                               *StructureSize,\r
+     OUT   EFI_SEC_PLATFORM_INFORMATION_RECORD  *PlatformInformationRecord\r
+  );\r
+\r
+/**\r
+  This interface disables temporary memory in SEC Phase.\r
+**/\r
+VOID\r
+EFIAPI\r
+SecPlatformDisableTemporaryMemory (\r
+  VOID\r
+  );\r
+\r
+#endif\r
diff --git a/UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.c b/UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.c
new file mode 100644 (file)
index 0000000..ad3e909
--- /dev/null
@@ -0,0 +1,90 @@
+/** @file\r
+Null instance of Platform Sec Lib.\r
+\r
+Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <PiPei.h>\r
+\r
+#include <Ppi/SecPlatformInformation.h>\r
+\r
+/**\r
+  A developer supplied function to perform platform specific operations.\r
+\r
+  It's a developer supplied function to perform any operations appropriate to a\r
+  given platform. It's invoked just before passing control to PEI core by SEC\r
+  core. Platform developer may modify the SecCoreData passed to PEI Core.\r
+  It returns a platform specific PPI list that platform wishes to pass to PEI core.\r
+  The Generic SEC core module will merge this list to join the final list passed to\r
+  PEI core.\r
+\r
+  @param  SecCoreData           The same parameter as passing to PEI core. It\r
+                                could be overridden by this function.\r
+\r
+  @return The platform specific PPI list to be passed to PEI core or\r
+          NULL if there is no need of such platform specific PPI list.\r
+\r
+**/\r
+EFI_PEI_PPI_DESCRIPTOR *\r
+EFIAPI\r
+SecPlatformMain (\r
+  IN OUT   EFI_SEC_PEI_HAND_OFF        *SecCoreData\r
+  )\r
+{\r
+  return NULL;\r
+}\r
+\r
+/**\r
+  This interface conveys state information out of the Security (SEC) phase into PEI.\r
+\r
+  @param  PeiServices               Pointer to the PEI Services Table.\r
+  @param  StructureSize             Pointer to the variable describing size of the input buffer.\r
+  @param  PlatformInformationRecord Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.\r
+\r
+  @retval EFI_SUCCESS           The data was successfully returned.\r
+  @retval EFI_BUFFER_TOO_SMALL  The buffer was too small.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SecPlatformInformation (\r
+  IN CONST EFI_PEI_SERVICES                     **PeiServices,\r
+  IN OUT   UINT64                               *StructureSize,\r
+     OUT   EFI_SEC_PLATFORM_INFORMATION_RECORD  *PlatformInformationRecord\r
+  )\r
+{\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  This interface disables temporary memory in SEC Phase.\r
+**/\r
+VOID\r
+EFIAPI\r
+SecPlatformDisableTemporaryMemory (\r
+  VOID\r
+  )\r
+{\r
+}\r
+\r
+/**\r
+  This function provides dummy function so that SecCore can pass build\r
+  validation. All real platform library instances need to implement the real\r
+  entry point in assembly.\r
+**/\r
+VOID\r
+EFIAPI\r
+_ModuleEntryPoint (\r
+  VOID\r
+  )\r
+{\r
+  return;\r
+}\r
diff --git a/UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.inf b/UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.inf
new file mode 100644 (file)
index 0000000..3f8868a
--- /dev/null
@@ -0,0 +1,37 @@
+## @file\r
+#  Library functions for PlatformSecLib.\r
+#\r
+#  Null instance of Platform Sec Lib.\r
+#\r
+#  Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
+#  This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution.  The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = PlatformSecLibNull\r
+  MODULE_UNI_FILE                = PlatformSecLibNull.uni\r
+  FILE_GUID                      = 6695974D-968C-420b-80B9-7870CD20118F\r
+  MODULE_TYPE                    = SEC\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = PlatformSecLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64\r
+#\r
+\r
+[Sources]\r
+  PlatformSecLibNull.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  UefiCpuPkg/UefiCpuPkg.dec\r
diff --git a/UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.uni b/UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.uni
new file mode 100644 (file)
index 0000000..352ede7
Binary files /dev/null and b/UefiCpuPkg/Library/PlatformSecLibNull/PlatformSecLibNull.uni differ