]>
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 | |
45 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r | |
46 | OUT UINTN *BlockSize\r | |
47 | );\r | |
48 | \r | |
49 | \r | |
50 | /**\r | |
51 | Allocates space for the protocol to maintain information about writes.\r | |
52 | Since writes must be completed in a fault-tolerant manner and multiple\r | |
53 | writes require more resources to be successful, this function\r | |
54 | enables the protocol to ensure that enough space exists to track\r | |
55 | information about upcoming writes.\r | |
56 | \r | |
57 | @param[in] This A pointer to the calling context.\r | |
58 | @param[in] CallerId The GUID identifying the write.\r | |
59 | @param[in] PrivateDataSize The size of the caller's private data that must be\r | |
60 | recorded for each write.\r | |
61 | @param[in] NumberOfWrites The number of fault tolerant block writes that will\r | |
62 | need to occur.\r | |
63 | \r | |
64 | @retval EFI_SUCCESS The function completed successfully\r | |
65 | @retval EFI_ABORTED The function could not complete successfully.\r | |
66 | @retval EFI_ACCESS_DENIED Not all allocated writes have been completed. All\r | |
67 | writes must be completed or aborted before another\r | |
68 | fault tolerant write can occur.\r | |
69 | \r | |
70 | **/\r | |
71 | EFI_STATUS\r | |
72 | EFIAPI\r | |
73 | FtwAllocate (\r | |
74 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r | |
75 | IN EFI_GUID *CallerId,\r | |
76 | IN UINTN PrivateDataSize,\r | |
77 | IN UINTN NumberOfWrites\r | |
78 | );\r | |
79 | \r | |
80 | \r | |
81 | /**\r | |
82 | Starts a target block update. This records information about the write\r | |
83 | in fault tolerant storage, and will complete the write in a recoverable\r | |
84 | manner, ensuring at all times that either the original contents or\r | |
85 | the modified contents are available.\r | |
86 | \r | |
87 | @param[in] This The calling context.\r | |
88 | @param[in] Lba The logical block address of the target block.\r | |
89 | @param[in] Offset The offset within the target block to place the\r | |
90 | data.\r | |
91 | @param[in] Length The number of bytes to write to the target block.\r | |
92 | @param[in] PrivateData A pointer to private data that the caller requires\r | |
93 | to complete any pending writes in the event of a\r | |
94 | fault.\r | |
95 | @param[in] FvBlockHandle The handle of FVB protocol that provides services\r | |
96 | for reading, writing, and erasing the target block.\r | |
97 | @param[in] Buffer The data to write.\r | |
98 | \r | |
99 | @retval EFI_SUCCESS The function completed successfully.\r | |
100 | @retval EFI_ABORTED The function could not complete successfully.\r | |
101 | @retval EFI_BAD_BUFFER_SIZE The write would span a block boundary, which is not\r | |
102 | a valid action.\r | |
103 | @retval EFI_ACCESS_DENIED No writes have been allocated.\r | |
104 | @retval EFI_NOT_READY The last write has not been completed. Restart()\r | |
105 | must be called to complete it.\r | |
106 | \r | |
107 | **/\r | |
108 | EFI_STATUS\r | |
109 | EFIAPI\r | |
110 | FtwWrite (\r | |
111 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r | |
112 | IN EFI_LBA Lba,\r | |
113 | IN UINTN Offset,\r | |
114 | IN UINTN Length,\r | |
115 | IN VOID *PrivateData,\r | |
116 | IN EFI_HANDLE FvBlockHandle,\r | |
117 | IN VOID *Buffer\r | |
118 | );\r | |
119 | \r | |
120 | \r | |
121 | /**\r | |
122 | Restarts a previously interrupted write. The caller must provide the\r | |
123 | block protocol needed to complete the interrupted write.\r | |
124 | \r | |
125 | @param[in] This The calling context.\r | |
126 | @param[in] FvBlockHandle The handle of FVB protocol that provides services.\r | |
127 | \r | |
128 | @retval EFI_SUCCESS The function completed successfully.\r | |
129 | @retval EFI_ABORTED The function could not complete successfully.\r | |
130 | @retval EFI_ACCESS_DENIED No pending writes exist.\r | |
131 | \r | |
132 | **/\r | |
133 | EFI_STATUS\r | |
134 | EFIAPI\r | |
135 | FtwRestart (\r | |
136 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r | |
137 | IN EFI_HANDLE FvBlockHandle\r | |
138 | );\r | |
139 | \r | |
140 | \r | |
141 | /**\r | |
142 | Aborts all previously allocated writes.\r | |
143 | \r | |
144 | @param This The calling context.\r | |
145 | \r | |
146 | @retval EFI_SUCCESS The function completed successfully.\r | |
147 | @retval EFI_ABORTED The function could not complete successfully.\r | |
148 | @retval EFI_NOT_FOUND No allocated writes exist.\r | |
149 | \r | |
150 | **/\r | |
151 | EFI_STATUS\r | |
152 | EFIAPI\r | |
153 | FtwAbort (\r | |
154 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This\r | |
155 | );\r | |
156 | \r | |
157 | \r | |
158 | /**\r | |
159 | Starts a target block update. This function records information about the write\r | |
160 | in fault-tolerant storage and completes the write in a recoverable\r | |
161 | manner, ensuring at all times that either the original contents or\r | |
162 | the modified contents are available.\r | |
163 | \r | |
164 | @param[in] This Indicates a pointer to the calling context.\r | |
165 | @param[out] CallerId The GUID identifying the last write.\r | |
166 | @param[out] Lba The logical block address of the last write.\r | |
167 | @param[out] Offset The offset within the block of the last write.\r | |
168 | @param[out] Length The length of the last write.\r | |
169 | @param[in, out] PrivateDataSize On input, the size of the PrivateData buffer. On\r | |
170 | output, the size of the private data stored for\r | |
171 | this write.\r | |
172 | @param[out] PrivateData A pointer to a buffer. The function will copy\r | |
173 | PrivateDataSize bytes from the private data stored\r | |
174 | for this write.\r | |
175 | @param[out] Complete A Boolean value with TRUE indicating that the write\r | |
176 | was completed.\r | |
177 | \r | |
178 | @retval EFI_SUCCESS The function completed successfully.\r | |
179 | @retval EFI_ABORTED The function could not complete successfully.\r | |
180 | @retval EFI_NOT_FOUND No allocated writes exist.\r | |
181 | \r | |
182 | **/\r | |
183 | EFI_STATUS\r | |
184 | EFIAPI\r | |
185 | FtwGetLastWrite (\r | |
186 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r | |
187 | OUT EFI_GUID *CallerId,\r | |
188 | OUT EFI_LBA *Lba,\r | |
189 | OUT UINTN *Offset,\r | |
190 | OUT UINTN *Length,\r | |
191 | IN OUT UINTN *PrivateDataSize,\r | |
192 | OUT VOID *PrivateData,\r | |
193 | OUT BOOLEAN *Complete\r | |
194 | );\r | |
195 | \r | |
196 | #endif\r |