]>
Commit | Line | Data |
---|---|---|
85e923a5 | 1 | /** @file\r |
d1102dba LG |
2 | Fault Tolerant Write protocol provides boot-time service for fault tolerant\r |
3 | write capability for block devices. The protocol provides for non-volatile\r | |
4 | storage of the intermediate data and private information a caller would need to\r | |
5 | recover from a critical fault, such as a power failure.\r | |
6 | \r | |
7 | Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
9d510e61 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
85e923a5 LG |
9 | \r |
10 | **/\r | |
11 | \r | |
12 | #ifndef _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_\r | |
13 | #define _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_\r | |
14 | \r | |
15 | #define EFI_FAULT_TOLERANT_WRITE_PROTOCOL_GUID \\r | |
16 | { \\r | |
17 | 0x3ebd9e82, 0x2c78, 0x4de6, {0x97, 0x86, 0x8d, 0x4b, 0xfc, 0xb7, 0xc8, 0x81 } \\r | |
18 | }\r | |
19 | \r | |
20 | //\r | |
21 | // Forward reference for pure ANSI compatability\r | |
22 | //\r | |
1436aea4 | 23 | typedef struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL EFI_FAULT_TOLERANT_WRITE_PROTOCOL;\r |
85e923a5 LG |
24 | \r |
25 | /**\r | |
e9b67286 | 26 | Get the size of the largest block that can be updated in a fault-tolerant manner.\r |
85e923a5 LG |
27 | \r |
28 | @param This Indicates a pointer to the calling context.\r | |
e9b67286 | 29 | @param BlockSize A pointer to a caller-allocated UINTN that is\r |
30 | updated to indicate the size of the largest block\r | |
85e923a5 LG |
31 | that can be updated.\r |
32 | \r | |
64a80549 | 33 | @retval EFI_SUCCESS The function completed successfully.\r |
85e923a5 LG |
34 | @retval EFI_ABORTED The function could not complete successfully.\r |
35 | \r | |
36 | **/\r | |
37 | typedef\r | |
38 | EFI_STATUS\r | |
0c1a4aa6 | 39 | (EFIAPI *EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE)(\r |
1436aea4 | 40 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r |
85e923a5 LG |
41 | OUT UINTN *BlockSize\r |
42 | );\r | |
43 | \r | |
44 | /**\r | |
45 | Allocates space for the protocol to maintain information about writes.\r | |
e9b67286 | 46 | Since writes must be completed in a fault-tolerant manner and multiple\r |
47 | writes require more resources to be successful, this function\r | |
85e923a5 | 48 | enables the protocol to ensure that enough space exists to track\r |
e9b67286 | 49 | information about upcoming writes.\r |
85e923a5 | 50 | \r |
e9b67286 | 51 | @param This A pointer to the calling context.\r |
85e923a5 LG |
52 | @param CallerId The GUID identifying the write.\r |
53 | @param PrivateDataSize The size of the caller's private data that must be\r | |
54 | recorded for each write.\r | |
e9b67286 | 55 | @param NumberOfWrites The number of fault tolerant block writes that will\r |
85e923a5 LG |
56 | need to occur.\r |
57 | \r | |
58 | @retval EFI_SUCCESS The function completed successfully\r | |
59 | @retval EFI_ABORTED The function could not complete successfully.\r | |
e9b67286 | 60 | @retval EFI_ACCESS_DENIED Not all allocated writes have been completed. All\r |
61 | writes must be completed or aborted before another\r | |
85e923a5 LG |
62 | fault tolerant write can occur.\r |
63 | \r | |
64 | **/\r | |
65 | typedef\r | |
66 | EFI_STATUS\r | |
0c1a4aa6 | 67 | (EFIAPI *EFI_FAULT_TOLERANT_WRITE_ALLOCATE)(\r |
1436aea4 MK |
68 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r |
69 | IN EFI_GUID *CallerId,\r | |
85e923a5 LG |
70 | IN UINTN PrivateDataSize,\r |
71 | IN UINTN NumberOfWrites\r | |
72 | );\r | |
73 | \r | |
74 | /**\r | |
75 | Starts a target block update. This records information about the write\r | |
e9b67286 | 76 | in fault tolerant storage, and will complete the write in a recoverable\r |
85e923a5 LG |
77 | manner, ensuring at all times that either the original contents or\r |
78 | the modified contents are available.\r | |
79 | \r | |
64a80549 | 80 | @param This The calling context.\r |
85e923a5 LG |
81 | @param Lba The logical block address of the target block.\r |
82 | @param Offset The offset within the target block to place the\r | |
83 | data.\r | |
84 | @param Length The number of bytes to write to the target block.\r | |
85 | @param PrivateData A pointer to private data that the caller requires\r | |
e9b67286 | 86 | to complete any pending writes in the event of a\r |
85e923a5 LG |
87 | fault.\r |
88 | @param FvBlockHandle The handle of FVB protocol that provides services\r | |
e9b67286 | 89 | for reading, writing, and erasing the target block.\r |
85e923a5 LG |
90 | @param Buffer The data to write.\r |
91 | \r | |
64a80549 | 92 | @retval EFI_SUCCESS The function completed successfully.\r |
85e923a5 | 93 | @retval EFI_ABORTED The function could not complete successfully.\r |
e9b67286 | 94 | @retval EFI_BAD_BUFFER_SIZE The write would span a block boundary, which is not\r |
85e923a5 LG |
95 | a valid action.\r |
96 | @retval EFI_ACCESS_DENIED No writes have been allocated.\r | |
e9b67286 | 97 | @retval EFI_NOT_READY The last write has not been completed. Restart()\r |
85e923a5 LG |
98 | must be called to complete it.\r |
99 | \r | |
100 | **/\r | |
101 | typedef\r | |
102 | EFI_STATUS\r | |
0c1a4aa6 | 103 | (EFIAPI *EFI_FAULT_TOLERANT_WRITE_WRITE)(\r |
1436aea4 | 104 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r |
85e923a5 LG |
105 | IN EFI_LBA Lba,\r |
106 | IN UINTN Offset,\r | |
107 | IN UINTN Length,\r | |
108 | IN VOID *PrivateData,\r | |
109 | IN EFI_HANDLE FvbHandle,\r | |
110 | IN VOID *Buffer\r | |
111 | );\r | |
112 | \r | |
113 | /**\r | |
114 | Restarts a previously interrupted write. The caller must provide the\r | |
115 | block protocol needed to complete the interrupted write.\r | |
116 | \r | |
64a80549 | 117 | @param This The calling context.\r |
118 | @param FvBlockProtocol The handle of FVB protocol that provides services.\r | |
e9b67286 | 119 | for reading, writing, and erasing the target block.\r |
85e923a5 | 120 | \r |
64a80549 | 121 | @retval EFI_SUCCESS The function completed successfully.\r |
85e923a5 LG |
122 | @retval EFI_ABORTED The function could not complete successfully.\r |
123 | @retval EFI_ACCESS_DENIED No pending writes exist.\r | |
124 | \r | |
125 | **/\r | |
126 | typedef\r | |
127 | EFI_STATUS\r | |
0c1a4aa6 | 128 | (EFIAPI *EFI_FAULT_TOLERANT_WRITE_RESTART)(\r |
1436aea4 | 129 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r |
85e923a5 LG |
130 | IN EFI_HANDLE FvbHandle\r |
131 | );\r | |
132 | \r | |
133 | /**\r | |
e9b67286 | 134 | Aborts all previously allocated writes.\r |
85e923a5 | 135 | \r |
64a80549 | 136 | @param This The calling context.\r |
85e923a5 | 137 | \r |
64a80549 | 138 | @retval EFI_SUCCESS The function completed successfully.\r |
85e923a5 LG |
139 | @retval EFI_ABORTED The function could not complete successfully.\r |
140 | @retval EFI_NOT_FOUND No allocated writes exist.\r | |
141 | \r | |
142 | **/\r | |
143 | typedef\r | |
144 | EFI_STATUS\r | |
0c1a4aa6 | 145 | (EFIAPI *EFI_FAULT_TOLERANT_WRITE_ABORT)(\r |
1436aea4 | 146 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This\r |
85e923a5 LG |
147 | );\r |
148 | \r | |
149 | /**\r | |
e9b67286 | 150 | Starts a target block update. This function records information about the write\r |
64a80549 | 151 | in fault-tolerant storage and completes the write in a recoverable\r |
85e923a5 LG |
152 | manner, ensuring at all times that either the original contents or\r |
153 | the modified contents are available.\r | |
154 | \r | |
155 | @param This Indicates a pointer to the calling context.\r | |
156 | @param CallerId The GUID identifying the last write.\r | |
157 | @param Lba The logical block address of the last write.\r | |
158 | @param Offset The offset within the block of the last write.\r | |
159 | @param Length The length of the last write.\r | |
e9b67286 | 160 | @param PrivateDataSize On input, the size of the PrivateData buffer. On\r |
161 | output, the size of the private data stored for\r | |
85e923a5 LG |
162 | this write.\r |
163 | @param PrivateData A pointer to a buffer. The function will copy\r | |
e9b67286 | 164 | PrivateDataSize bytes from the private data stored\r |
85e923a5 | 165 | for this write.\r |
e9b67286 | 166 | @param Complete A Boolean value with TRUE indicating that the write\r |
85e923a5 LG |
167 | was completed.\r |
168 | \r | |
64a80549 | 169 | @retval EFI_SUCCESS The function completed successfully.\r |
85e923a5 LG |
170 | @retval EFI_ABORTED The function could not complete successfully.\r |
171 | @retval EFI_NOT_FOUND No allocated writes exist.\r | |
172 | \r | |
173 | **/\r | |
174 | typedef\r | |
175 | EFI_STATUS\r | |
0c1a4aa6 | 176 | (EFIAPI *EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE)(\r |
1436aea4 MK |
177 | IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL *This,\r |
178 | OUT EFI_GUID *CallerId,\r | |
85e923a5 LG |
179 | OUT EFI_LBA *Lba,\r |
180 | OUT UINTN *Offset,\r | |
181 | OUT UINTN *Length,\r | |
182 | IN OUT UINTN *PrivateDataSize,\r | |
183 | OUT VOID *PrivateData,\r | |
184 | OUT BOOLEAN *Complete\r | |
185 | );\r | |
186 | \r | |
187 | //\r | |
188 | // Protocol declaration\r | |
189 | //\r | |
190 | struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL {\r | |
1436aea4 MK |
191 | EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE GetMaxBlockSize;\r |
192 | EFI_FAULT_TOLERANT_WRITE_ALLOCATE Allocate;\r | |
193 | EFI_FAULT_TOLERANT_WRITE_WRITE Write;\r | |
194 | EFI_FAULT_TOLERANT_WRITE_RESTART Restart;\r | |
195 | EFI_FAULT_TOLERANT_WRITE_ABORT Abort;\r | |
196 | EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE GetLastWrite;\r | |
85e923a5 LG |
197 | };\r |
198 | \r | |
1436aea4 | 199 | extern EFI_GUID gEfiFaultTolerantWriteProtocolGuid;\r |
85e923a5 LG |
200 | \r |
201 | #endif\r |