]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Protocol/FaultTolerantWrite.h
1. retired console control protocol.
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / FaultTolerantWrite.h
CommitLineData
85e923a5
LG
1/** @file\r
2Fault Tolerant Write protocol provides boot-time service to do fault tolerant \r
3write capability for block devices. The protocol provides for non-volatile \r
4intermediate storage of the data and private information a caller would need to \r
5recover from a critical fault, such as power failure. \r
6\r
7Copyright (c) 2009, Intel Corporation \r
8All rights reserved. This program and the accompanying materials \r
9are licensed and made available under the terms and conditions of the BSD License \r
10which accompanies this distribution. The full text of the license may be found at \r
11http://opensource.org/licenses/bsd-license.php \r
12 \r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
15\r
16**/\r
17\r
18#ifndef _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_\r
19#define _FW_FAULT_TOLERANT_WRITE_PROTOCOL_H_\r
20\r
21#define EFI_FAULT_TOLERANT_WRITE_PROTOCOL_GUID \\r
22 { \\r
23 0x3ebd9e82, 0x2c78, 0x4de6, {0x97, 0x86, 0x8d, 0x4b, 0xfc, 0xb7, 0xc8, 0x81 } \\r
24 }\r
25\r
26//\r
27// Forward reference for pure ANSI compatability\r
28//\r
29typedef struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL EFI_FAULT_TOLERANT_WRITE_PROTOCOL;\r
30\r
31/**\r
32 Query the largest block that may be updated in a fault tolerant manner.\r
33\r
34 @param This Indicates a pointer to the calling context.\r
35 @param BlockSize A pointer to a caller allocated UINTN that is\r
36 updated to indicate the size of the largest block\r
37 that can be updated.\r
38\r
39 @retval EFI_SUCCESS The function completed successfully\r
40 @retval EFI_ABORTED The function could not complete successfully.\r
41\r
42**/\r
43typedef\r
44EFI_STATUS\r
45(EFIAPI *EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE) (\r
46 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL * This,\r
47 OUT UINTN *BlockSize\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 updates will 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 the upcoming writes.\r
56\r
57 @param This Indicates a pointer to the calling context.\r
58 @param CallerId The GUID identifying the write.\r
59 @param PrivateDataSize The size of the caller's private data that must be\r
60 recorded for each write.\r
61 @param 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 All allocated writes have not 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
71typedef\r
72EFI_STATUS\r
73(EFIAPI *EFI_FAULT_TOLERANT_WRITE_ALLOCATE) (\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 Starts a target block update. This records information about the write\r
82 in fault tolerant storage and will complete the write in a recoverable\r
83 manner, ensuring at all times that either the original contents or\r
84 the modified contents are available.\r
85\r
86 @param This Calling context\r
87 @param Lba The logical block address of the target block.\r
88 @param Offset The offset within the target block to place the\r
89 data.\r
90 @param Length The number of bytes to write to the target block.\r
91 @param PrivateData A pointer to private data that the caller requires\r
92 to complete any pending writes in the event of a\r
93 fault.\r
94 @param FvBlockHandle The handle of FVB protocol that provides services\r
95 for reading, writing, and erasing the target block.\r
96 @param Buffer The data to write.\r
97\r
98 @retval EFI_SUCCESS The function completed successfully\r
99 @retval EFI_ABORTED The function could not complete successfully.\r
100 @retval EFI_BAD_BUFFER_SIZE The write would span a block boundary, which is not\r
101 a valid action.\r
102 @retval EFI_ACCESS_DENIED No writes have been allocated.\r
103 @retval EFI_NOT_READY The last write has not been completed. Restart ()\r
104 must be called to complete it.\r
105\r
106**/\r
107typedef\r
108EFI_STATUS\r
109(EFIAPI *EFI_FAULT_TOLERANT_WRITE_WRITE) (\r
110 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL * This,\r
111 IN EFI_LBA Lba,\r
112 IN UINTN Offset,\r
113 IN UINTN Length,\r
114 IN VOID *PrivateData,\r
115 IN EFI_HANDLE FvbHandle,\r
116 IN VOID *Buffer\r
117 );\r
118\r
119/**\r
120 Restarts a previously interrupted write. The caller must provide the\r
121 block protocol needed to complete the interrupted write.\r
122\r
123 @param This Calling context.\r
124 @param FvBlockProtocol The handle of FVB protocol that provides services\r
125 for reading, writing, and erasing the target block.\r
126\r
127 @retval EFI_SUCCESS The function completed successfully\r
128 @retval EFI_ABORTED The function could not complete successfully.\r
129 @retval EFI_ACCESS_DENIED No pending writes exist.\r
130\r
131**/\r
132typedef\r
133EFI_STATUS\r
134(EFIAPI *EFI_FAULT_TOLERANT_WRITE_RESTART) (\r
135 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL * This,\r
136 IN EFI_HANDLE FvbHandle\r
137 );\r
138\r
139/**\r
140 Aborts all previous allocated writes.\r
141\r
142 @param This Calling context\r
143\r
144 @retval EFI_SUCCESS The function completed successfully\r
145 @retval EFI_ABORTED The function could not complete successfully.\r
146 @retval EFI_NOT_FOUND No allocated writes exist.\r
147\r
148**/\r
149typedef\r
150EFI_STATUS\r
151(EFIAPI *EFI_FAULT_TOLERANT_WRITE_ABORT) (\r
152 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL * This\r
153 );\r
154\r
155/**\r
156 Starts a target block update. This records information about the write\r
157 in fault tolerant storage and will complete the write in a recoverable\r
158 manner, ensuring at all times that either the original contents or\r
159 the modified contents are available.\r
160\r
161 @param This Indicates a pointer to the calling context.\r
162 @param CallerId The GUID identifying the last write.\r
163 @param Lba The logical block address of the last write.\r
164 @param Offset The offset within the block of the last write.\r
165 @param Length The length of the last write.\r
166 @param PrivateDataSize On input, the size of the PrivateData buffer. On\r
167 output, the size of the private data stored for\r
168 this write.\r
169 @param PrivateData A pointer to a buffer. The function will copy\r
170 PrivateDataSize bytes from the private data stored\r
171 for this write.\r
172 @param Complete A Boolean value with TRUE indicating that the write\r
173 was completed.\r
174\r
175 @retval EFI_SUCCESS The function completed successfully\r
176 @retval EFI_ABORTED The function could not complete successfully.\r
177 @retval EFI_NOT_FOUND No allocated writes exist.\r
178\r
179**/\r
180typedef\r
181EFI_STATUS\r
182(EFIAPI *EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE) (\r
183 IN EFI_FAULT_TOLERANT_WRITE_PROTOCOL * This,\r
184 OUT EFI_GUID * CallerId,\r
185 OUT EFI_LBA *Lba,\r
186 OUT UINTN *Offset,\r
187 OUT UINTN *Length,\r
188 IN OUT UINTN *PrivateDataSize,\r
189 OUT VOID *PrivateData,\r
190 OUT BOOLEAN *Complete\r
191 );\r
192\r
193//\r
194// Protocol declaration\r
195//\r
196struct _EFI_FAULT_TOLERANT_WRITE_PROTOCOL {\r
197 EFI_FAULT_TOLERANT_WRITE_GET_MAX_BLOCK_SIZE GetMaxBlockSize;\r
198 EFI_FAULT_TOLERANT_WRITE_ALLOCATE Allocate;\r
199 EFI_FAULT_TOLERANT_WRITE_WRITE Write;\r
200 EFI_FAULT_TOLERANT_WRITE_RESTART Restart;\r
201 EFI_FAULT_TOLERANT_WRITE_ABORT Abort;\r
202 EFI_FAULT_TOLERANT_WRITE_GET_LAST_WRITE GetLastWrite;\r
203};\r
204\r
205extern EFI_GUID gEfiFaultTolerantWriteProtocolGuid;\r
206\r
207#endif\r