3 The internal header file includes the common header files, defines
4 internal structure and functions used by FTW module.
6 Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved. <BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #ifndef __SMM_FTW_DXE_H__
12 #define __SMM_FTW_DXE_H__
16 #include <Protocol/MmCommunication2.h>
18 #include <Library/UefiBootServicesTableLib.h>
19 #include <Library/UefiDriverEntryPoint.h>
20 #include <Library/DebugLib.h>
21 #include <Library/BaseMemoryLib.h>
22 #include <Library/UefiLib.h>
23 #include <Library/BaseLib.h>
24 #include <Library/MemoryAllocationLib.h>
26 #include <Guid/EventGroup.h>
28 #include "FaultTolerantWriteSmmCommon.h"
31 Get the size of the largest block that can be updated in a fault-tolerant manner.
33 @param[in] This Indicates a pointer to the calling context.
34 @param[out] BlockSize A pointer to a caller-allocated UINTN that is
35 updated to indicate the size of the largest block
38 @retval EFI_SUCCESS The function completed successfully.
39 @retval EFI_ABORTED The function could not complete successfully.
45 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
,
51 Allocates space for the protocol to maintain information about writes.
52 Since writes must be completed in a fault-tolerant manner and multiple
53 writes require more resources to be successful, this function
54 enables the protocol to ensure that enough space exists to track
55 information about upcoming writes.
57 @param[in] This A pointer to the calling context.
58 @param[in] CallerId The GUID identifying the write.
59 @param[in] PrivateDataSize The size of the caller's private data that must be
60 recorded for each write.
61 @param[in] NumberOfWrites The number of fault tolerant block writes that will
64 @retval EFI_SUCCESS The function completed successfully
65 @retval EFI_ABORTED The function could not complete successfully.
66 @retval EFI_ACCESS_DENIED Not all allocated writes have been completed. All
67 writes must be completed or aborted before another
68 fault tolerant write can occur.
74 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
,
75 IN EFI_GUID
*CallerId
,
76 IN UINTN PrivateDataSize
,
77 IN UINTN NumberOfWrites
82 Starts a target block update. This records information about the write
83 in fault tolerant storage, and will complete the write in a recoverable
84 manner, ensuring at all times that either the original contents or
85 the modified contents are available.
87 @param[in] This The calling context.
88 @param[in] Lba The logical block address of the target block.
89 @param[in] Offset The offset within the target block to place the
91 @param[in] Length The number of bytes to write to the target block.
92 @param[in] PrivateData A pointer to private data that the caller requires
93 to complete any pending writes in the event of a
95 @param[in] FvBlockHandle The handle of FVB protocol that provides services
96 for reading, writing, and erasing the target block.
97 @param[in] Buffer The data to write.
99 @retval EFI_SUCCESS The function completed successfully.
100 @retval EFI_ABORTED The function could not complete successfully.
101 @retval EFI_BAD_BUFFER_SIZE The write would span a block boundary, which is not
103 @retval EFI_ACCESS_DENIED No writes have been allocated.
104 @retval EFI_NOT_READY The last write has not been completed. Restart()
105 must be called to complete it.
111 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
,
115 IN VOID
*PrivateData
,
116 IN EFI_HANDLE FvBlockHandle
,
122 Restarts a previously interrupted write. The caller must provide the
123 block protocol needed to complete the interrupted write.
125 @param[in] This The calling context.
126 @param[in] FvBlockHandle The handle of FVB protocol that provides services.
128 @retval EFI_SUCCESS The function completed successfully.
129 @retval EFI_ABORTED The function could not complete successfully.
130 @retval EFI_ACCESS_DENIED No pending writes exist.
136 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
,
137 IN EFI_HANDLE FvBlockHandle
142 Aborts all previously allocated writes.
144 @param This The calling context.
146 @retval EFI_SUCCESS The function completed successfully.
147 @retval EFI_ABORTED The function could not complete successfully.
148 @retval EFI_NOT_FOUND No allocated writes exist.
154 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
159 Starts a target block update. This function records information about the write
160 in fault-tolerant storage and completes the write in a recoverable
161 manner, ensuring at all times that either the original contents or
162 the modified contents are available.
164 @param[in] This Indicates a pointer to the calling context.
165 @param[out] CallerId The GUID identifying the last write.
166 @param[out] Lba The logical block address of the last write.
167 @param[out] Offset The offset within the block of the last write.
168 @param[out] Length The length of the last write.
169 @param[in, out] PrivateDataSize On input, the size of the PrivateData buffer. On
170 output, the size of the private data stored for
172 @param[out] PrivateData A pointer to a buffer. The function will copy
173 PrivateDataSize bytes from the private data stored
175 @param[out] Complete A Boolean value with TRUE indicating that the write
178 @retval EFI_SUCCESS The function completed successfully.
179 @retval EFI_ABORTED The function could not complete successfully.
180 @retval EFI_NOT_FOUND No allocated writes exist.
186 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
,
187 OUT EFI_GUID
*CallerId
,
191 IN OUT UINTN
*PrivateDataSize
,
192 OUT VOID
*PrivateData
,
193 OUT BOOLEAN
*Complete