]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Library/LockBoxLib.h
MdeModulePkg: Change OPTIONAL keyword usage style
[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
99383667 5Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>\r
1c837cd5 6\r
9d510e61 7SPDX-License-Identifier: BSD-2-Clause-Patent\r
1c837cd5 8\r
9**/\r
10\r
11#ifndef _LOCK_BOX_LIB_H_\r
12#define _LOCK_BOX_LIB_H_\r
13\r
14/**\r
15 This function will save confidential information to lockbox.\r
16\r
17 @param Guid the guid to identify the confidential information\r
18 @param Buffer the address of the confidential information\r
19 @param Length the length of the confidential information\r
20\r
21 @retval RETURN_SUCCESS the information is saved successfully.\r
22 @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0\r
23 @retval RETURN_ALREADY_STARTED the requested GUID already exist.\r
24 @retval RETURN_OUT_OF_RESOURCES no enough resource to save the information.\r
25 @retval RETURN_ACCESS_DENIED it is too late to invoke this interface\r
26 @retval RETURN_NOT_STARTED it is too early to invoke this interface\r
27 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.\r
28**/\r
29RETURN_STATUS\r
30EFIAPI\r
31SaveLockBox (\r
32 IN GUID *Guid,\r
33 IN VOID *Buffer,\r
34 IN UINTN Length\r
35 );\r
36\r
37/**\r
38 This function will set lockbox attributes.\r
39\r
40 @param Guid the guid to identify the confidential information\r
41 @param Attributes the attributes of the lockbox\r
42\r
43 @retval RETURN_SUCCESS the information is saved successfully.\r
44 @retval RETURN_INVALID_PARAMETER attributes is invalid.\r
45 @retval RETURN_NOT_FOUND the requested GUID not found.\r
46 @retval RETURN_ACCESS_DENIED it is too late to invoke this interface\r
47 @retval RETURN_NOT_STARTED it is too early to invoke this interface\r
48 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.\r
49**/\r
50RETURN_STATUS\r
51EFIAPI\r
52SetLockBoxAttributes (\r
53 IN GUID *Guid,\r
54 IN UINT64 Attributes\r
55 );\r
56\r
57//\r
6bd4af30
SZ
58// With this flag, this LockBox can be restored to this Buffer\r
59// with RestoreAllLockBoxInPlace()\r
1c837cd5 60//\r
6bd4af30
SZ
61#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE BIT0\r
62//\r
63// With this flag, this LockBox can be restored in S3 resume only.\r
64// This LockBox can not be restored after SmmReadyToLock in normal boot\r
65// and after EndOfS3Resume in S3 resume.\r
66// It can not be set together with LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE.\r
67//\r
68#define LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY BIT1\r
1c837cd5 69\r
70/**\r
71 This function will update confidential information to lockbox.\r
72\r
73 @param Guid the guid to identify the original confidential information\r
74 @param Offset the offset of the original confidential information\r
75 @param Buffer the address of the updated confidential information\r
76 @param Length the length of the updated confidential information\r
77\r
78 @retval RETURN_SUCCESS the information is saved successfully.\r
79 @retval RETURN_INVALID_PARAMETER the Guid is NULL, or Buffer is NULL, or Length is 0.\r
80 @retval RETURN_NOT_FOUND the requested GUID not found.\r
99383667
HW
81 @retval RETURN_BUFFER_TOO_SMALL for lockbox without attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY,\r
82 the original buffer to too small to hold new information.\r
83 @retval RETURN_OUT_OF_RESOURCES for lockbox with attribute LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY,\r
84 no enough resource to save the information.\r
1c837cd5 85 @retval RETURN_ACCESS_DENIED it is too late to invoke this interface\r
86 @retval RETURN_NOT_STARTED it is too early to invoke this interface\r
87 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.\r
88**/\r
89RETURN_STATUS\r
90EFIAPI\r
91UpdateLockBox (\r
92 IN GUID *Guid,\r
93 IN UINTN Offset,\r
94 IN VOID *Buffer,\r
95 IN UINTN Length\r
96 );\r
97\r
98/**\r
99 This function will restore confidential information from lockbox.\r
100\r
101 @param Guid the guid to identify the confidential information\r
102 @param Buffer the address of the restored confidential information\r
103 NULL means restored to original address, Length MUST be NULL at same time.\r
104 @param Length the length of the restored confidential information\r
105\r
106 @retval RETURN_SUCCESS the information is restored successfully.\r
107 @retval RETURN_INVALID_PARAMETER the Guid is NULL, or one of Buffer and Length is NULL.\r
d1102dba 108 @retval RETURN_WRITE_PROTECTED Buffer and Length are NULL, but the LockBox has no\r
1c837cd5 109 LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE attribute.\r
110 @retval RETURN_BUFFER_TOO_SMALL the Length is too small to hold the confidential information.\r
111 @retval RETURN_NOT_FOUND the requested GUID not found.\r
112 @retval RETURN_NOT_STARTED it is too early to invoke this interface\r
113 @retval RETURN_ACCESS_DENIED not allow to restore to the address\r
114 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.\r
115**/\r
116RETURN_STATUS\r
117EFIAPI\r
118RestoreLockBox (\r
119 IN GUID *Guid,\r
e3917e22 120 IN VOID *Buffer OPTIONAL,\r
1c837cd5 121 IN OUT UINTN *Length OPTIONAL\r
122 );\r
123\r
124/**\r
125 This function will restore confidential information from all lockbox which have RestoreInPlace attribute.\r
126\r
127 @retval RETURN_SUCCESS the information is restored successfully.\r
128 @retval RETURN_NOT_STARTED it is too early to invoke this interface\r
129 @retval RETURN_UNSUPPORTED the service is not supported by implementaion.\r
130**/\r
131RETURN_STATUS\r
132EFIAPI\r
133RestoreAllLockBoxInPlace (\r
134 VOID\r
135 );\r
136\r
137#endif\r