2 Fault Tolerant Write protocol provides boot-time service for fault tolerant
3 write capability for block devices. The protocol provides for non-volatile
4 storage of the intermediate data and private information a caller would need to
5 recover from a critical fault, such as a power failure.
7 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #ifndef _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_
13 #define _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_
15 #define EFI_FAULT_TOLERANT_WRITE_PROTOCOL_GUID \
17 0x3ebd9e82, 0x2c78, 0x4de6, {0x97, 0x86, 0x8d, 0x4b, 0xfc, 0xb7, 0xc8, 0x81 } \
21 // Forward reference for pure ANSI compatability
23 typedef struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL EFI_FAULT_TOLERANT_WRITE_PROTOCOL
;
26 Get the size of the largest block that can be updated in a fault-tolerant manner.
28 @param This Indicates a pointer to the calling context.
29 @param BlockSize A pointer to a caller-allocated UINTN that is
30 updated to indicate the size of the largest block
33 @retval EFI_SUCCESS The function completed successfully.
34 @retval EFI_ABORTED The function could not complete successfully.
39 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE
)(
40 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
,
45 Allocates space for the protocol to maintain information about writes.
46 Since writes must be completed in a fault-tolerant manner and multiple
47 writes require more resources to be successful, this function
48 enables the protocol to ensure that enough space exists to track
49 information about upcoming writes.
51 @param This A pointer to the calling context.
52 @param CallerId The GUID identifying the write.
53 @param PrivateDataSize The size of the caller's private data that must be
54 recorded for each write.
55 @param NumberOfWrites The number of fault tolerant block writes that will
58 @retval EFI_SUCCESS The function completed successfully
59 @retval EFI_ABORTED The function could not complete successfully.
60 @retval EFI_ACCESS_DENIED Not all allocated writes have been completed. All
61 writes must be completed or aborted before another
62 fault tolerant write can occur.
67 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_ALLOCATE
)(
68 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
,
69 IN EFI_GUID
*CallerId
,
70 IN UINTN PrivateDataSize
,
71 IN UINTN NumberOfWrites
75 Starts a target block update. This records information about the write
76 in fault tolerant storage, and will complete the write in a recoverable
77 manner, ensuring at all times that either the original contents or
78 the modified contents are available.
80 @param This The calling context.
81 @param Lba The logical block address of the target block.
82 @param Offset The offset within the target block to place the
84 @param Length The number of bytes to write to the target block.
85 @param PrivateData A pointer to private data that the caller requires
86 to complete any pending writes in the event of a
88 @param FvBlockHandle The handle of FVB protocol that provides services
89 for reading, writing, and erasing the target block.
90 @param Buffer The data to write.
92 @retval EFI_SUCCESS The function completed successfully.
93 @retval EFI_ABORTED The function could not complete successfully.
94 @retval EFI_BAD_BUFFER_SIZE The write would span a block boundary, which is not
96 @retval EFI_ACCESS_DENIED No writes have been allocated.
97 @retval EFI_NOT_READY The last write has not been completed. Restart()
98 must be called to complete it.
103 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_WRITE
)(
104 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
,
108 IN VOID
*PrivateData
,
109 IN EFI_HANDLE FvbHandle
,
114 Restarts a previously interrupted write. The caller must provide the
115 block protocol needed to complete the interrupted write.
117 @param This The calling context.
118 @param FvBlockProtocol The handle of FVB protocol that provides services.
119 for reading, writing, and erasing the target block.
121 @retval EFI_SUCCESS The function completed successfully.
122 @retval EFI_ABORTED The function could not complete successfully.
123 @retval EFI_ACCESS_DENIED No pending writes exist.
128 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_RESTART
)(
129 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
,
130 IN EFI_HANDLE FvbHandle
134 Aborts all previously allocated writes.
136 @param This The calling context.
138 @retval EFI_SUCCESS The function completed successfully.
139 @retval EFI_ABORTED The function could not complete successfully.
140 @retval EFI_NOT_FOUND No allocated writes exist.
145 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_ABORT
)(
146 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
150 Starts a target block update. This function records information about the write
151 in fault-tolerant storage and completes the write in a recoverable
152 manner, ensuring at all times that either the original contents or
153 the modified contents are available.
155 @param This Indicates a pointer to the calling context.
156 @param CallerId The GUID identifying the last write.
157 @param Lba The logical block address of the last write.
158 @param Offset The offset within the block of the last write.
159 @param Length The length of the last write.
160 @param PrivateDataSize On input, the size of the PrivateData buffer. On
161 output, the size of the private data stored for
163 @param PrivateData A pointer to a buffer. The function will copy
164 PrivateDataSize bytes from the private data stored
166 @param Complete A Boolean value with TRUE indicating that the write
169 @retval EFI_SUCCESS The function completed successfully.
170 @retval EFI_ABORTED The function could not complete successfully.
171 @retval EFI_NOT_FOUND No allocated writes exist.
176 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE
)(
177 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
*This
,
178 OUT EFI_GUID
*CallerId
,
182 IN OUT UINTN
*PrivateDataSize
,
183 OUT VOID
*PrivateData
,
184 OUT BOOLEAN
*Complete
188 // Protocol declaration
190 struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL
{
191 EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE GetMaxBlockSize
;
192 EFI_FAULT_TOLERANT_WRITE_ALLOCATE Allocate
;
193 EFI_FAULT_TOLERANT_WRITE_WRITE Write
;
194 EFI_FAULT_TOLERANT_WRITE_RESTART Restart
;
195 EFI_FAULT_TOLERANT_WRITE_ABORT Abort
;
196 EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE GetLastWrite
;
199 extern EFI_GUID gEfiFaultTolerantWriteProtocolGuid
;