]>
Commit | Line | Data |
---|---|---|
f3b80a8e | 1 | /** @file\r |
2 | \r | |
3 | The internal header file includes the common header files, defines\r | |
4 | internal structure and functions used by FTW module.\r | |
5 | \r | |
d1102dba | 6 | Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved. <BR>\r |
9d510e61 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
f3b80a8e | 8 | \r |
9 | **/\r | |
10 | \r | |
11 | #ifndef __SMM_FTW_DXE_H__\r | |
12 | #define __SMM_FTW_DXE_H__\r | |
13 | \r | |
14 | #include <PiDxe.h>\r | |
15 | \r | |
fa37a846 | 16 | #include <Protocol/MmCommunication2.h>\r |
f3b80a8e | 17 | \r |
18 | #include <Library/UefiBootServicesTableLib.h>\r | |
19 | #include <Library/UefiDriverEntryPoint.h>\r | |
20 | #include <Library/DebugLib.h>\r | |
21 | #include <Library/BaseMemoryLib.h>\r | |
22 | #include <Library/UefiLib.h>\r | |
23 | #include <Library/BaseLib.h>\r | |
24 | #include <Library/MemoryAllocationLib.h>\r | |
25 | \r | |
26 | #include <Guid/EventGroup.h>\r | |
27 | \r | |
28 | #include "FaultTolerantWriteSmmCommon.h"\r | |
29 | \r | |
30 | /**\r | |
31 | Get the size of the largest block that can be updated in a fault-tolerant manner.\r | |
32 | \r | |
33 | @param[in] This Indicates a pointer to the calling context.\r | |
34 | @param[out] BlockSize A pointer to a caller-allocated UINTN that is\r | |
35 | updated to indicate the size of the largest block\r | |
36 | that can be updated.\r | |
37 | \r | |
38 | @retval EFI_SUCCESS The function completed successfully.\r | |
39 | @retval EFI_ABORTED The function could not complete successfully.\r | |
40 | \r | |
41 | **/\r | |
42 | EFI_STATUS\r | |
43 | EFIAPI\r | |
44 | FtwGetMaxBlockSize (\r | |
1436aea4 MK |
45 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r |
46 | OUT UINTN *BlockSize\r | |
f3b80a8e | 47 | );\r |
48 | \r | |
f3b80a8e | 49 | /**\r |
50 | Allocates space for the protocol to maintain information about writes.\r | |
51 | Since writes must be completed in a fault-tolerant manner and multiple\r | |
52 | writes require more resources to be successful, this function\r | |
53 | enables the protocol to ensure that enough space exists to track\r | |
54 | information about upcoming writes.\r | |
55 | \r | |
56 | @param[in] This A pointer to the calling context.\r | |
57 | @param[in] CallerId The GUID identifying the write.\r | |
58 | @param[in] PrivateDataSize The size of the caller's private data that must be\r | |
59 | recorded for each write.\r | |
60 | @param[in] NumberOfWrites The number of fault tolerant block writes that will\r | |
61 | need to occur.\r | |
62 | \r | |
63 | @retval EFI_SUCCESS The function completed successfully\r | |
64 | @retval EFI_ABORTED The function could not complete successfully.\r | |
65 | @retval EFI_ACCESS_DENIED Not all allocated writes have been completed. All\r | |
66 | writes must be completed or aborted before another\r | |
67 | fault tolerant write can occur.\r | |
68 | \r | |
69 | **/\r | |
70 | EFI_STATUS\r | |
71 | EFIAPI\r | |
72 | FtwAllocate (\r | |
1436aea4 MK |
73 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r |
74 | IN EFI_GUID *CallerId,\r | |
75 | IN UINTN PrivateDataSize,\r | |
76 | IN UINTN NumberOfWrites\r | |
f3b80a8e | 77 | );\r |
78 | \r | |
f3b80a8e | 79 | /**\r |
80 | Starts a target block update. This records information about the write\r | |
81 | in fault tolerant storage, and will complete the write in a recoverable\r | |
82 | manner, ensuring at all times that either the original contents or\r | |
83 | the modified contents are available.\r | |
84 | \r | |
85 | @param[in] This The calling context.\r | |
86 | @param[in] Lba The logical block address of the target block.\r | |
87 | @param[in] Offset The offset within the target block to place the\r | |
88 | data.\r | |
89 | @param[in] Length The number of bytes to write to the target block.\r | |
90 | @param[in] PrivateData A pointer to private data that the caller requires\r | |
91 | to complete any pending writes in the event of a\r | |
92 | fault.\r | |
93 | @param[in] FvBlockHandle The handle of FVB protocol that provides services\r | |
94 | for reading, writing, and erasing the target block.\r | |
95 | @param[in] Buffer The data to write.\r | |
96 | \r | |
97 | @retval EFI_SUCCESS The function completed successfully.\r | |
98 | @retval EFI_ABORTED The function could not complete successfully.\r | |
99 | @retval EFI_BAD_BUFFER_SIZE The write would span a block boundary, which is not\r | |
100 | a valid action.\r | |
101 | @retval EFI_ACCESS_DENIED No writes have been allocated.\r | |
102 | @retval EFI_NOT_READY The last write has not been completed. Restart()\r | |
103 | must be called to complete it.\r | |
104 | \r | |
105 | **/\r | |
106 | EFI_STATUS\r | |
107 | EFIAPI\r | |
108 | FtwWrite (\r | |
1436aea4 MK |
109 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r |
110 | IN EFI_LBA Lba,\r | |
111 | IN UINTN Offset,\r | |
112 | IN UINTN Length,\r | |
113 | IN VOID *PrivateData,\r | |
114 | IN EFI_HANDLE FvBlockHandle,\r | |
115 | IN VOID *Buffer\r | |
f3b80a8e | 116 | );\r |
117 | \r | |
f3b80a8e | 118 | /**\r |
119 | Restarts a previously interrupted write. The caller must provide the\r | |
120 | block protocol needed to complete the interrupted write.\r | |
121 | \r | |
122 | @param[in] This The calling context.\r | |
123 | @param[in] FvBlockHandle The handle of FVB protocol that provides services.\r | |
124 | \r | |
125 | @retval EFI_SUCCESS The function completed successfully.\r | |
126 | @retval EFI_ABORTED The function could not complete successfully.\r | |
127 | @retval EFI_ACCESS_DENIED No pending writes exist.\r | |
128 | \r | |
129 | **/\r | |
130 | EFI_STATUS\r | |
131 | EFIAPI\r | |
132 | FtwRestart (\r | |
1436aea4 MK |
133 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r |
134 | IN EFI_HANDLE FvBlockHandle\r | |
f3b80a8e | 135 | );\r |
136 | \r | |
f3b80a8e | 137 | /**\r |
138 | Aborts all previously allocated writes.\r | |
139 | \r | |
140 | @param This The calling context.\r | |
141 | \r | |
142 | @retval EFI_SUCCESS The function completed successfully.\r | |
143 | @retval EFI_ABORTED The function could not complete successfully.\r | |
144 | @retval EFI_NOT_FOUND No allocated writes exist.\r | |
145 | \r | |
146 | **/\r | |
147 | EFI_STATUS\r | |
148 | EFIAPI\r | |
149 | FtwAbort (\r | |
1436aea4 | 150 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This\r |
f3b80a8e | 151 | );\r |
152 | \r | |
f3b80a8e | 153 | /**\r |
154 | Starts a target block update. This function records information about the write\r | |
155 | in fault-tolerant storage and completes the write in a recoverable\r | |
156 | manner, ensuring at all times that either the original contents or\r | |
157 | the modified contents are available.\r | |
158 | \r | |
159 | @param[in] This Indicates a pointer to the calling context.\r | |
160 | @param[out] CallerId The GUID identifying the last write.\r | |
161 | @param[out] Lba The logical block address of the last write.\r | |
162 | @param[out] Offset The offset within the block of the last write.\r | |
163 | @param[out] Length The length of the last write.\r | |
164 | @param[in, out] PrivateDataSize On input, the size of the PrivateData buffer. On\r | |
165 | output, the size of the private data stored for\r | |
166 | this write.\r | |
167 | @param[out] PrivateData A pointer to a buffer. The function will copy\r | |
168 | PrivateDataSize bytes from the private data stored\r | |
169 | for this write.\r | |
170 | @param[out] Complete A Boolean value with TRUE indicating that the write\r | |
171 | was completed.\r | |
172 | \r | |
173 | @retval EFI_SUCCESS The function completed successfully.\r | |
174 | @retval EFI_ABORTED The function could not complete successfully.\r | |
175 | @retval EFI_NOT_FOUND No allocated writes exist.\r | |
176 | \r | |
177 | **/\r | |
178 | EFI_STATUS\r | |
179 | EFIAPI\r | |
180 | FtwGetLastWrite (\r | |
1436aea4 MK |
181 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r |
182 | OUT EFI_GUID *CallerId,\r | |
183 | OUT EFI_LBA *Lba,\r | |
184 | OUT UINTN *Offset,\r | |
185 | OUT UINTN *Length,\r | |
186 | IN OUT UINTN *PrivateDataSize,\r | |
187 | OUT VOID *PrivateData,\r | |
188 | OUT BOOLEAN *Complete\r | |
f3b80a8e | 189 | );\r |
190 | \r | |
191 | #endif\r |