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 - 2010, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available under
9 the terms and conditions of the BSD License that accompanies this distribution.
10 The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #ifndef _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_
19 #define _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_
21 #define EFI_FAULT_TOLERANT_WRITE_PROTOCOL_GUID \
23 0x3ebd9e82, 0x2c78, 0x4de6, {0x97, 0x86, 0x8d, 0x4b, 0xfc, 0xb7, 0xc8, 0x81 } \
27 // Forward reference for pure ANSI compatability
29 typedef struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL EFI_FAULT_TOLERANT_WRITE_PROTOCOL
;
32 Get the size of the largest block that can be updated in a fault-tolerant manner.
34 @param This Indicates a pointer to the calling context.
35 @param BlockSize A pointer to a caller-allocated UINTN that is
36 updated to indicate the size of the largest block
39 @retval EFI_SUCCESS The function completed successfully.
40 @retval EFI_ABORTED The function could not complete successfully.
45 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE
)(
46 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 This A pointer to the calling context.
58 @param CallerId The GUID identifying the write.
59 @param PrivateDataSize The size of the caller's private data that must be
60 recorded for each write.
61 @param 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.
73 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_ALLOCATE
)(
74 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
* This
,
75 IN EFI_GUID
* CallerId
,
76 IN UINTN PrivateDataSize
,
77 IN UINTN NumberOfWrites
81 Starts a target block update. This records information about the write
82 in fault tolerant storage, and will complete the write in a recoverable
83 manner, ensuring at all times that either the original contents or
84 the modified contents are available.
86 @param This The calling context.
87 @param Lba The logical block address of the target block.
88 @param Offset The offset within the target block to place the
90 @param Length The number of bytes to write to the target block.
91 @param PrivateData A pointer to private data that the caller requires
92 to complete any pending writes in the event of a
94 @param FvBlockHandle The handle of FVB protocol that provides services
95 for reading, writing, and erasing the target block.
96 @param Buffer The data to write.
98 @retval EFI_SUCCESS The function completed successfully.
99 @retval EFI_ABORTED The function could not complete successfully.
100 @retval EFI_BAD_BUFFER_SIZE The write would span a block boundary, which is not
102 @retval EFI_ACCESS_DENIED No writes have been allocated.
103 @retval EFI_NOT_READY The last write has not been completed. Restart()
104 must be called to complete it.
109 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_WRITE
)(
110 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
* This
,
114 IN VOID
*PrivateData
,
115 IN EFI_HANDLE FvbHandle
,
120 Restarts a previously interrupted write. The caller must provide the
121 block protocol needed to complete the interrupted write.
123 @param This The calling context.
124 @param FvBlockProtocol The handle of FVB protocol that provides services.
125 for reading, writing, and erasing the target block.
127 @retval EFI_SUCCESS The function completed successfully.
128 @retval EFI_ABORTED The function could not complete successfully.
129 @retval EFI_ACCESS_DENIED No pending writes exist.
134 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_RESTART
)(
135 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
* This
,
136 IN EFI_HANDLE FvbHandle
140 Aborts all previously allocated writes.
142 @param This The calling context.
144 @retval EFI_SUCCESS The function completed successfully.
145 @retval EFI_ABORTED The function could not complete successfully.
146 @retval EFI_NOT_FOUND No allocated writes exist.
151 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_ABORT
)(
152 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
* This
156 Starts a target block update. This function records information about the write
157 in fault-tolerant storage and completes the write in a recoverable
158 manner, ensuring at all times that either the original contents or
159 the modified contents are available.
161 @param This Indicates a pointer to the calling context.
162 @param CallerId The GUID identifying the last write.
163 @param Lba The logical block address of the last write.
164 @param Offset The offset within the block of the last write.
165 @param Length The length of the last write.
166 @param PrivateDataSize On input, the size of the PrivateData buffer. On
167 output, the size of the private data stored for
169 @param PrivateData A pointer to a buffer. The function will copy
170 PrivateDataSize bytes from the private data stored
172 @param Complete A Boolean value with TRUE indicating that the write
175 @retval EFI_SUCCESS The function completed successfully.
176 @retval EFI_ABORTED The function could not complete successfully.
177 @retval EFI_NOT_FOUND No allocated writes exist.
182 (EFIAPI
*EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE
)(
183 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL
* This
,
184 OUT EFI_GUID
* CallerId
,
188 IN OUT UINTN
*PrivateDataSize
,
189 OUT VOID
*PrivateData
,
190 OUT BOOLEAN
*Complete
194 // Protocol declaration
196 struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL
{
197 EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE GetMaxBlockSize
;
198 EFI_FAULT_TOLERANT_WRITE_ALLOCATE Allocate
;
199 EFI_FAULT_TOLERANT_WRITE_WRITE Write
;
200 EFI_FAULT_TOLERANT_WRITE_RESTART Restart
;
201 EFI_FAULT_TOLERANT_WRITE_ABORT Abort
;
202 EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE GetLastWrite
;
205 extern EFI_GUID gEfiFaultTolerantWriteProtocolGuid
;