]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Library/LockBoxLib.h
MdeModulePkg: Add SMM LockBox
[mirror_edk2.git] / MdeModulePkg / Include / Library / LockBoxLib.h
diff --git a/MdeModulePkg/Include/Library/LockBoxLib.h b/MdeModulePkg/Include/Library/LockBoxLib.h
new file mode 100644 (file)
index 0000000..db7fd05
--- /dev/null
@@ -0,0 +1,133 @@
+/** @file\r
+  This library is only intended to be used by DXE modules that need save\r
+  confidential information to LockBox and get it by PEI modules in S3 phase.\r
+\r
+Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions\r
+of the BSD License which accompanies this distribution.  The\r
+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 _LOCK_BOX_LIB_H_\r
+#define _LOCK_BOX_LIB_H_\r
+\r
+/**\r
+  This function will save confidential information to lockbox.\r
+\r
+  @param Guid       the guid to identify the confidential information\r
+  @param Buffer     the address of the confidential information\r
+  @param Length     the length of the confidential information\r
+\r
+  @retval RETURN_SUCCESS            the information is saved successfully.\r
+  @retval RETURN_INVALID_PARAMETER  the Guid is NULL, or Buffer is NULL, or Length is 0\r
+  @retval RETURN_ALREADY_STARTED    the requested GUID already exist.\r
+  @retval RETURN_OUT_OF_RESOURCES   no enough resource to save the information.\r
+  @retval RETURN_ACCESS_DENIED      it is too late to invoke this interface\r
+  @retval RETURN_NOT_STARTED        it is too early to invoke this interface\r
+  @retval RETURN_UNSUPPORTED        the service is not supported by implementaion.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+SaveLockBox (\r
+  IN  GUID                        *Guid,\r
+  IN  VOID                        *Buffer,\r
+  IN  UINTN                       Length\r
+  );\r
+\r
+/**\r
+  This function will set lockbox attributes.\r
+\r
+  @param Guid       the guid to identify the confidential information\r
+  @param Attributes the attributes of the lockbox\r
+\r
+  @retval RETURN_SUCCESS            the information is saved successfully.\r
+  @retval RETURN_INVALID_PARAMETER  attributes is invalid.\r
+  @retval RETURN_NOT_FOUND          the requested GUID not found.\r
+  @retval RETURN_ACCESS_DENIED      it is too late to invoke this interface\r
+  @retval RETURN_NOT_STARTED        it is too early to invoke this interface\r
+  @retval RETURN_UNSUPPORTED        the service is not supported by implementaion.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+SetLockBoxAttributes (\r
+  IN  GUID                        *Guid,\r
+  IN  UINT64                      Attributes\r
+  );\r
+\r
+//\r
+// With this flag, this LockBox can be restored to this Buffer with RestoreAllLockBoxInPlace()\r
+//\r
+#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE  BIT0\r
+\r
+/**\r
+  This function will update confidential information to lockbox.\r
+\r
+  @param Guid   the guid to identify the original confidential information\r
+  @param Offset the offset of the original confidential information\r
+  @param Buffer the address of the updated confidential information\r
+  @param Length the length of the updated confidential information\r
+\r
+  @retval RETURN_SUCCESS            the information is saved successfully.\r
+  @retval RETURN_INVALID_PARAMETER  the Guid is NULL, or Buffer is NULL, or Length is 0.\r
+  @retval RETURN_NOT_FOUND          the requested GUID not found.\r
+  @retval RETURN_BUFFER_TOO_SMALL   the original buffer to too small to hold new information.\r
+  @retval RETURN_ACCESS_DENIED      it is too late to invoke this interface\r
+  @retval RETURN_NOT_STARTED        it is too early to invoke this interface\r
+  @retval RETURN_UNSUPPORTED        the service is not supported by implementaion.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+UpdateLockBox (\r
+  IN  GUID                        *Guid,\r
+  IN  UINTN                       Offset,\r
+  IN  VOID                        *Buffer,\r
+  IN  UINTN                       Length\r
+  );\r
+\r
+/**\r
+  This function will restore confidential information from lockbox.\r
+\r
+  @param Guid   the guid to identify the confidential information\r
+  @param Buffer the address of the restored confidential information\r
+                NULL means restored to original address, Length MUST be NULL at same time.\r
+  @param Length the length of the restored confidential information\r
+\r
+  @retval RETURN_SUCCESS            the information is restored successfully.\r
+  @retval RETURN_INVALID_PARAMETER  the Guid is NULL, or one of Buffer and Length is NULL.\r
+  @retval RETURN_WRITE_PROTECTED    Buffer and Length are NULL, but the LockBox has no \r
+                                    LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE attribute.\r
+  @retval RETURN_BUFFER_TOO_SMALL   the Length is too small to hold the confidential information.\r
+  @retval RETURN_NOT_FOUND          the requested GUID not found.\r
+  @retval RETURN_NOT_STARTED        it is too early to invoke this interface\r
+  @retval RETURN_ACCESS_DENIED      not allow to restore to the address\r
+  @retval RETURN_UNSUPPORTED        the service is not supported by implementaion.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+RestoreLockBox (\r
+  IN  GUID                        *Guid,\r
+  IN  VOID                        *Buffer, OPTIONAL\r
+  IN  OUT UINTN                   *Length  OPTIONAL\r
+  );\r
+\r
+/**\r
+  This function will restore confidential information from all lockbox which have RestoreInPlace attribute.\r
+\r
+  @retval RETURN_SUCCESS            the information is restored successfully.\r
+  @retval RETURN_NOT_STARTED        it is too early to invoke this interface\r
+  @retval RETURN_UNSUPPORTED        the service is not supported by implementaion.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+RestoreAllLockBoxInPlace (\r
+  VOID\r
+  );\r
+\r
+#endif\r