]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Library/LockBoxLib.h
MdeModulePkg LockBoxLib: Support LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY
[mirror_edk2.git] / MdeModulePkg / Include / Library / LockBoxLib.h
CommitLineData
1c837cd5 1/** @file\r
2 This library is only intended to be used by DXE modules that need save\r
3 confidential information to LockBox and get it by PEI modules in S3 phase.\r
4\r
6bd4af30 5Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
1c837cd5 6\r
7This program and the accompanying materials\r
8are licensed and made available under the terms and conditions\r
9of the BSD License which accompanies this distribution. The\r
10full text of the license may be found at\r
11http://opensource.org/licenses/bsd-license.php\r
12\r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18#ifndef _LOCK_BOX_LIB_H_\r
19#define _LOCK_BOX_LIB_H_\r
20\r
21/**\r
22 This function will save confidential information to lockbox.\r
23\r
24 @param Guid the guid to identify the confidential information\r
25 @param Buffer the address of the confidential information\r
26 @param Length the length of the confidential information\r
27\r
28 @retval RETURN_SUCCESS the information is saved successfully.\r
29 @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0\r
30 @retval RETURN_ALREADY_STARTED the requested GUID already exist.\r
31 @retval RETURN_OUT_OF_RESOURCES no enough resource to save the information.\r
32 @retval RETURN_ACCESS_DENIED it is too late to invoke this interface\r
33 @retval RETURN_NOT_STARTED it is too early to invoke this interface\r
34 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.\r
35**/\r
36RETURN_STATUS\r
37EFIAPI\r
38SaveLockBox (\r
39 IN GUID *Guid,\r
40 IN VOID *Buffer,\r
41 IN UINTN Length\r
42 );\r
43\r
44/**\r
45 This function will set lockbox attributes.\r
46\r
47 @param Guid the guid to identify the confidential information\r
48 @param Attributes the attributes of the lockbox\r
49\r
50 @retval RETURN_SUCCESS the information is saved successfully.\r
51 @retval RETURN_INVALID_PARAMETER attributes is invalid.\r
52 @retval RETURN_NOT_FOUND the requested GUID not found.\r
53 @retval RETURN_ACCESS_DENIED it is too late to invoke this interface\r
54 @retval RETURN_NOT_STARTED it is too early to invoke this interface\r
55 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.\r
56**/\r
57RETURN_STATUS\r
58EFIAPI\r
59SetLockBoxAttributes (\r
60 IN GUID *Guid,\r
61 IN UINT64 Attributes\r
62 );\r
63\r
64//\r
6bd4af30
SZ
65// With this flag, this LockBox can be restored to this Buffer\r
66// with RestoreAllLockBoxInPlace()\r
1c837cd5 67//\r
6bd4af30
SZ
68#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE BIT0\r
69//\r
70// With this flag, this LockBox can be restored in S3 resume only.\r
71// This LockBox can not be restored after SmmReadyToLock in normal boot\r
72// and after EndOfS3Resume in S3 resume.\r
73// It can not be set together with LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE.\r
74//\r
75#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY BIT1\r
1c837cd5 76\r
77/**\r
78 This function will update confidential information to lockbox.\r
79\r
80 @param Guid the guid to identify the original confidential information\r
81 @param Offset the offset of the original confidential information\r
82 @param Buffer the address of the updated confidential information\r
83 @param Length the length of the updated confidential information\r
84\r
85 @retval RETURN_SUCCESS the information is saved successfully.\r
86 @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0.\r
87 @retval RETURN_NOT_FOUND the requested GUID not found.\r
88 @retval RETURN_BUFFER_TOO_SMALL the original buffer to too small to hold new information.\r
89 @retval RETURN_ACCESS_DENIED it is too late to invoke this interface\r
90 @retval RETURN_NOT_STARTED it is too early to invoke this interface\r
91 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.\r
92**/\r
93RETURN_STATUS\r
94EFIAPI\r
95UpdateLockBox (\r
96 IN GUID *Guid,\r
97 IN UINTN Offset,\r
98 IN VOID *Buffer,\r
99 IN UINTN Length\r
100 );\r
101\r
102/**\r
103 This function will restore confidential information from lockbox.\r
104\r
105 @param Guid the guid to identify the confidential information\r
106 @param Buffer the address of the restored confidential information\r
107 NULL means restored to original address, Length MUST be NULL at same time.\r
108 @param Length the length of the restored confidential information\r
109\r
110 @retval RETURN_SUCCESS the information is restored successfully.\r
111 @retval RETURN_INVALID_PARAMETER the Guid is NULL, or one of Buffer and Length is NULL.\r
112 @retval RETURN_WRITE_PROTECTED Buffer and Length are NULL, but the LockBox has no \r
113 LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE attribute.\r
114 @retval RETURN_BUFFER_TOO_SMALL the Length is too small to hold the confidential information.\r
115 @retval RETURN_NOT_FOUND the requested GUID not found.\r
116 @retval RETURN_NOT_STARTED it is too early to invoke this interface\r
117 @retval RETURN_ACCESS_DENIED not allow to restore to the address\r
118 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.\r
119**/\r
120RETURN_STATUS\r
121EFIAPI\r
122RestoreLockBox (\r
123 IN GUID *Guid,\r
124 IN VOID *Buffer, OPTIONAL\r
125 IN OUT UINTN *Length OPTIONAL\r
126 );\r
127\r
128/**\r
129 This function will restore confidential information from all lockbox which have RestoreInPlace attribute.\r
130\r
131 @retval RETURN_SUCCESS the information is restored successfully.\r
132 @retval RETURN_NOT_STARTED it is too early to invoke this interface\r
133 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.\r
134**/\r
135RETURN_STATUS\r
136EFIAPI\r
137RestoreAllLockBoxInPlace (\r
138 VOID\r
139 );\r
140\r
141#endif\r