]>
Commit | Line | Data |
---|---|---|
6cc9ca32 | 1 | /** @file\r |
d7dec593 | 2 | \r |
6cc9ca32 LG |
3 | The internal header file includes the common header files, defines\r |
4 | internal structure and functions used by FtwLite module.\r | |
5 | \r | |
6 | Copyright (c) 2006 - 2008, Intel Corporation \r | |
d7dec593 | 7 | All rights reserved. This program and the accompanying materials \r |
8 | are licensed and made available under the terms and conditions of the BSD License \r | |
9 | which accompanies this distribution. The full text of the license may be found at \r | |
10 | http://opensource.org/licenses/bsd-license.php \r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
14 | \r | |
6cc9ca32 | 15 | **/\r |
d7dec593 | 16 | \r |
17 | #ifndef _EFI_FAULT_TOLERANT_WRITE_LITE_H_\r | |
18 | #define _EFI_FAULT_TOLERANT_WRITE_LITE_H_\r | |
19 | \r | |
ed7748fe | 20 | \r |
d7dec593 | 21 | #include <PiDxe.h>\r |
ed7748fe | 22 | \r |
d7dec593 | 23 | #include <Guid/SystemNvDataGuid.h>\r |
24 | #include <Protocol/FaultTolerantWriteLite.h>\r | |
25 | #include <Protocol/FirmwareVolumeBlock.h>\r | |
ed7748fe | 26 | \r |
d7dec593 | 27 | #include <Library/PcdLib.h>\r |
28 | #include <Library/DebugLib.h>\r | |
29 | #include <Library/UefiDriverEntryPoint.h>\r | |
30 | #include <Library/BaseMemoryLib.h>\r | |
31 | #include <Library/MemoryAllocationLib.h>\r | |
32 | #include <Library/UefiBootServicesTableLib.h>\r | |
1232b214 | 33 | #include <Library/DevicePathLib.h>\r |
d7dec593 | 34 | \r |
d7dec593 | 35 | //\r |
36 | // Flash erase polarity is 1\r | |
37 | //\r | |
38 | #define FTW_ERASE_POLARITY 1\r | |
39 | \r | |
40 | #define FTW_VALID_STATE 0\r | |
41 | #define FTW_INVALID_STATE 1\r | |
42 | \r | |
43 | #define FTW_ERASED_BYTE ((UINT8) (255))\r | |
44 | #define FTW_POLARITY_REVERT ((UINT8) (255))\r | |
45 | \r | |
46 | typedef struct {\r | |
47 | UINT8 WriteAllocated : 1;\r | |
48 | UINT8 SpareCompleted : 1;\r | |
49 | UINT8 WriteCompleted : 1;\r | |
50 | UINT8 Reserved : 5;\r | |
51 | #define WRITE_ALLOCATED 0x1\r | |
52 | #define SPARE_COMPLETED 0x2\r | |
53 | #define WRITE_COMPLETED 0x4\r | |
54 | \r | |
55 | EFI_DEV_PATH DevPath;\r | |
56 | EFI_LBA Lba;\r | |
57 | UINTN Offset;\r | |
58 | UINTN NumBytes;\r | |
59 | //\r | |
60 | // UINTN SpareAreaOffset;\r | |
61 | //\r | |
62 | } EFI_FTW_LITE_RECORD;\r | |
63 | \r | |
f3f2e05d | 64 | #define FTW_LITE_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'T', 'W', 'L')\r |
d7dec593 | 65 | \r |
d7dec593 | 66 | //\r |
67 | // MACRO for FTW header and record\r | |
68 | //\r | |
d7dec593 | 69 | #define FTW_LITE_RECORD_SIZE (sizeof (EFI_FTW_LITE_RECORD))\r |
d7dec593 | 70 | \r |
71 | //\r | |
72 | // EFI Fault tolerant protocol private data structure\r | |
73 | //\r | |
74 | typedef struct {\r | |
75 | UINTN Signature;\r | |
76 | EFI_HANDLE Handle;\r | |
77 | EFI_FTW_LITE_PROTOCOL FtwLiteInstance;\r | |
276a49b6 LG |
78 | EFI_PHYSICAL_ADDRESS WorkSpaceAddress; // Base address of working space range in flash.\r |
79 | UINTN WorkSpaceLength; // Size of working space range in flash.\r | |
80 | EFI_PHYSICAL_ADDRESS SpareAreaAddress; // Base address of spare range in flash.\r | |
81 | UINTN SpareAreaLength; // Size of spare range in flash.\r | |
82 | UINTN NumberOfSpareBlock; // Number of the blocks in spare block.\r | |
83 | UINTN BlockSize; // Block size in bytes of the blocks in flash\r | |
84 | EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *FtwWorkSpaceHeader;// Pointer to Working Space Header in memory buffer\r | |
85 | EFI_FTW_LITE_RECORD *FtwLastRecord; // Pointer to last record in memory buffer\r | |
d7dec593 | 86 | EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FtwFvBlock; // FVB of working block\r |
87 | EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FtwBackupFvb; // FVB of spare block\r | |
276a49b6 LG |
88 | EFI_LBA FtwSpareLba; // Start LBA of spare block\r |
89 | EFI_LBA FtwWorkBlockLba; // Start LBA of working block that contains working space in its last block.\r | |
d7dec593 | 90 | EFI_LBA FtwWorkSpaceLba; // Start LBA of working space\r |
276a49b6 LG |
91 | UINTN FtwWorkSpaceBase; // Offset into the FtwWorkSpaceLba block.\r |
92 | UINTN FtwWorkSpaceSize; // Size of working space range that stores write record.\r | |
93 | UINT8 *FtwWorkSpace; // Point to Work Space in memory buffer \r | |
d7dec593 | 94 | //\r |
95 | // Following a buffer of FtwWorkSpace[FTW_WORK_SPACE_SIZE],\r | |
96 | // Allocated with EFI_FTW_LITE_DEVICE.\r | |
97 | //\r | |
98 | } EFI_FTW_LITE_DEVICE;\r | |
99 | \r | |
100 | #define FTW_LITE_CONTEXT_FROM_THIS(a) CR (a, EFI_FTW_LITE_DEVICE, FtwLiteInstance, FTW_LITE_DEVICE_SIGNATURE)\r | |
101 | \r | |
102 | //\r | |
103 | // Driver entry point\r | |
104 | //\r | |
6aab8214 | 105 | /**\r |
106 | This function is the entry point of the Fault Tolerant Write driver.\r | |
107 | \r | |
108 | \r | |
5944a83b | 109 | @param ImageHandle A handle for the image that is initializing\r |
6aab8214 | 110 | this driver\r |
5944a83b | 111 | @param SystemTable A pointer to the EFI system table\r |
6aab8214 | 112 | \r |
113 | @retval EFI_SUCCESS FTW has finished the initialization\r | |
114 | @retval EFI_ABORTED FTW initialization error\r | |
115 | \r | |
116 | **/\r | |
d7dec593 | 117 | EFI_STATUS\r |
118 | EFIAPI\r | |
119 | InitializeFtwLite (\r | |
120 | IN EFI_HANDLE ImageHandle,\r | |
121 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
ed66e1bc | 122 | );\r |
d7dec593 | 123 | \r |
124 | //\r | |
125 | // Fault Tolerant Write Protocol API\r | |
126 | //\r | |
6aab8214 | 127 | /**\r |
128 | Starts a target block update. This function will record data about write\r | |
129 | in fault tolerant storage and will complete the write in a recoverable\r | |
130 | manner, ensuring at all times that either the original contents or\r | |
131 | the modified contents are available.\r | |
132 | \r | |
133 | \r | |
134 | @param This Calling context\r | |
135 | @param FvbHandle The handle of FVB protocol that provides services for\r | |
136 | reading, writing, and erasing the target block.\r | |
137 | @param Lba The logical block address of the target block.\r | |
138 | @param Offset The offset within the target block to place the data.\r | |
139 | @param NumBytes The number of bytes to write to the target block.\r | |
140 | @param Buffer The data to write.\r | |
141 | \r | |
142 | @retval EFI_SUCCESS The function completed successfully\r | |
143 | @retval EFI_BAD_BUFFER_SIZE The write would span a target block, which is not\r | |
144 | a valid action.\r | |
145 | @retval EFI_ACCESS_DENIED No writes have been allocated.\r | |
146 | @retval EFI_NOT_FOUND Cannot find FVB by handle.\r | |
147 | @retval EFI_OUT_OF_RESOURCES Cannot allocate memory.\r | |
148 | @retval EFI_ABORTED The function could not complete successfully.\r | |
149 | \r | |
150 | **/\r | |
d7dec593 | 151 | EFI_STATUS\r |
152 | EFIAPI\r | |
153 | FtwLiteWrite (\r | |
6aab8214 | 154 | IN EFI_FTW_LITE_PROTOCOL *This,\r |
155 | IN EFI_HANDLE FvbHandle,\r | |
156 | IN EFI_LBA Lba,\r | |
157 | IN UINTN Offset,\r | |
158 | IN OUT UINTN *NumBytes,\r | |
159 | IN VOID *Buffer\r | |
ed66e1bc | 160 | );\r |
d7dec593 | 161 | \r |
162 | //\r | |
163 | // Internal functions\r | |
164 | //\r | |
6aab8214 | 165 | /**\r |
166 | Restarts a previously interrupted write. The caller must provide the\r | |
167 | block protocol needed to complete the interrupted write.\r | |
168 | \r | |
169 | \r | |
170 | @param FtwLiteDevice The private data of FTW_LITE driver\r | |
171 | FvbHandle - The handle of FVB protocol that provides services for\r | |
172 | reading, writing, and erasing the target block.\r | |
173 | \r | |
174 | @retval EFI_SUCCESS The function completed successfully\r | |
175 | @retval EFI_ACCESS_DENIED No pending writes exist\r | |
176 | @retval EFI_NOT_FOUND FVB protocol not found by the handle\r | |
177 | @retval EFI_ABORTED The function could not complete successfully\r | |
178 | \r | |
179 | **/\r | |
d7dec593 | 180 | EFI_STATUS\r |
181 | FtwRestart (\r | |
182 | IN EFI_FTW_LITE_DEVICE *FtwLiteDevice\r | |
ed66e1bc | 183 | );\r |
d7dec593 | 184 | \r |
6aab8214 | 185 | /**\r |
186 | Aborts all previous allocated writes.\r | |
d7dec593 | 187 | \r |
d7dec593 | 188 | \r |
6aab8214 | 189 | @param FtwLiteDevice The private data of FTW_LITE driver\r |
d7dec593 | 190 | \r |
6aab8214 | 191 | @retval EFI_SUCCESS The function completed successfully\r |
192 | @retval EFI_ABORTED The function could not complete successfully.\r | |
193 | @retval EFI_NOT_FOUND No allocated writes exist.\r | |
d7dec593 | 194 | \r |
6aab8214 | 195 | **/\r |
d7dec593 | 196 | EFI_STATUS\r |
197 | FtwAbort (\r | |
198 | IN EFI_FTW_LITE_DEVICE *FtwLiteDevice\r | |
ed66e1bc | 199 | );\r |
d7dec593 | 200 | \r |
d7dec593 | 201 | \r |
6aab8214 | 202 | /**\r |
203 | Write a record with fault tolerant mannaer.\r | |
204 | Since the content has already backuped in spare block, the write is\r | |
205 | guaranteed to be completed with fault tolerant manner.\r | |
d7dec593 | 206 | \r |
d7dec593 | 207 | \r |
6aab8214 | 208 | @param FtwLiteDevice The private data of FTW_LITE driver\r |
209 | @param Fvb The FVB protocol that provides services for\r | |
210 | reading, writing, and erasing the target block.\r | |
d7dec593 | 211 | \r |
6aab8214 | 212 | @retval EFI_SUCCESS The function completed successfully\r |
213 | @retval EFI_ABORTED The function could not complete successfully\r | |
d7dec593 | 214 | \r |
6aab8214 | 215 | **/\r |
d7dec593 | 216 | EFI_STATUS\r |
217 | FtwWriteRecord (\r | |
218 | IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r | |
219 | IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb\r | |
ed66e1bc | 220 | );\r |
d7dec593 | 221 | \r |
6aab8214 | 222 | /**\r |
8986b8cd | 223 | To erase the block with the spare block size.\r |
d7dec593 | 224 | \r |
d7dec593 | 225 | \r |
6aab8214 | 226 | @param FtwLiteDevice Calling context\r |
227 | @param FvBlock FVB Protocol interface\r | |
228 | @param Lba Lba of the firmware block\r | |
d7dec593 | 229 | \r |
6aab8214 | 230 | @retval EFI_SUCCESS Block LBA is Erased successfully\r |
231 | @retval Others Error occurs\r | |
d7dec593 | 232 | \r |
6aab8214 | 233 | **/\r |
d7dec593 | 234 | EFI_STATUS\r |
235 | FtwEraseBlock (\r | |
236 | IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r | |
237 | EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,\r | |
238 | EFI_LBA Lba\r | |
ed66e1bc | 239 | );\r |
d7dec593 | 240 | \r |
6aab8214 | 241 | /**\r |
d7dec593 | 242 | \r |
6aab8214 | 243 | Erase spare block.\r |
d7dec593 | 244 | \r |
d7dec593 | 245 | \r |
6aab8214 | 246 | @param FtwLiteDevice Calling context\r |
d7dec593 | 247 | \r |
6aab8214 | 248 | @retval EFI_SUCCESS The erase request was successfully\r |
249 | completed.\r | |
250 | \r | |
251 | @retval EFI_ACCESS_DENIED The firmware volume is in the\r | |
252 | WriteDisabled state.\r | |
253 | @retval EFI_DEVICE_ERROR The block device is not functioning\r | |
254 | correctly and could not be written.\r | |
255 | The firmware device may have been\r | |
256 | partially erased.\r | |
257 | @retval EFI_INVALID_PARAMETER One or more of the LBAs listed\r | |
258 | in the variable argument list do\r | |
259 | not exist in the firmware volume. \r | |
260 | \r | |
261 | **/\r | |
d7dec593 | 262 | EFI_STATUS\r |
263 | FtwEraseSpareBlock (\r | |
264 | IN EFI_FTW_LITE_DEVICE *FtwLiteDevice\r | |
ed66e1bc | 265 | );\r |
d7dec593 | 266 | \r |
6aab8214 | 267 | /**\r |
268 | Retrive the proper FVB protocol interface by HANDLE.\r | |
d7dec593 | 269 | \r |
d7dec593 | 270 | \r |
6aab8214 | 271 | @param FvBlockHandle The handle of FVB protocol that provides services for\r |
272 | reading, writing, and erasing the target block.\r | |
273 | @param FvBlock The interface of FVB protocol\r | |
d7dec593 | 274 | \r |
6aab8214 | 275 | @retval EFI_SUCCESS The function completed successfully\r |
276 | @retval EFI_ABORTED The function could not complete successfully\r | |
d7dec593 | 277 | \r |
6aab8214 | 278 | **/\r |
d7dec593 | 279 | EFI_STATUS\r |
280 | FtwGetFvbByHandle (\r | |
281 | IN EFI_HANDLE FvBlockHandle,\r | |
282 | OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock\r | |
ed66e1bc | 283 | );\r |
d7dec593 | 284 | \r |
6aab8214 | 285 | /**\r |
d7dec593 | 286 | \r |
6aab8214 | 287 | Get firmware block by address.\r |
d7dec593 | 288 | \r |
d7dec593 | 289 | \r |
6aab8214 | 290 | @param Address Address specified the block\r |
291 | @param FvBlock The block caller wanted\r | |
292 | \r | |
293 | @retval EFI_SUCCESS The protocol instance if found.\r | |
294 | @retval EFI_NOT_FOUND Block not found\r | |
295 | \r | |
296 | **/\r | |
d7dec593 | 297 | EFI_STATUS\r |
298 | GetFvbByAddress (\r | |
299 | IN EFI_PHYSICAL_ADDRESS Address,\r | |
300 | OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **FvBlock\r | |
ed66e1bc | 301 | );\r |
d7dec593 | 302 | \r |
6aab8214 | 303 | /**\r |
d7dec593 | 304 | \r |
6aab8214 | 305 | Is it in working block?\r |
d7dec593 | 306 | \r |
d7dec593 | 307 | \r |
6aab8214 | 308 | @param FtwLiteDevice Calling context\r |
309 | @param FvBlock Fvb protocol instance\r | |
310 | @param Lba The block specified\r | |
d7dec593 | 311 | \r |
6aab8214 | 312 | @return A BOOLEAN value indicating in working block or not.\r |
d7dec593 | 313 | \r |
6aab8214 | 314 | **/\r |
d7dec593 | 315 | BOOLEAN\r |
316 | IsInWorkingBlock (\r | |
317 | EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r | |
318 | EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,\r | |
319 | EFI_LBA Lba\r | |
ed66e1bc | 320 | );\r |
d7dec593 | 321 | \r |
6aab8214 | 322 | /**\r |
323 | Copy the content of spare block to a target block. Size is FTW_BLOCK_SIZE.\r | |
324 | Spare block is accessed by FTW backup FVB protocol interface. LBA is\r | |
325 | FtwLiteDevice->FtwSpareLba.\r | |
326 | Target block is accessed by FvBlock protocol interface. LBA is Lba.\r | |
d7dec593 | 327 | \r |
d7dec593 | 328 | \r |
6aab8214 | 329 | @param FtwLiteDevice The private data of FTW_LITE driver\r |
330 | @param FvBlock FVB Protocol interface to access target block\r | |
331 | @param Lba Lba of the target block\r | |
d7dec593 | 332 | \r |
6aab8214 | 333 | @retval EFI_SUCCESS Spare block content is copied to target block\r |
334 | @retval EFI_INVALID_PARAMETER Input parameter error\r | |
335 | @retval EFI_OUT_OF_RESOURCES Allocate memory error\r | |
336 | @retval EFI_ABORTED The function could not complete successfully\r | |
d7dec593 | 337 | \r |
6aab8214 | 338 | **/\r |
d7dec593 | 339 | EFI_STATUS\r |
340 | FlushSpareBlockToTargetBlock (\r | |
341 | EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r | |
342 | EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,\r | |
343 | EFI_LBA Lba\r | |
ed66e1bc | 344 | );\r |
d7dec593 | 345 | \r |
6aab8214 | 346 | /**\r |
347 | Copy the content of spare block to working block. Size is FTW_BLOCK_SIZE.\r | |
348 | Spare block is accessed by FTW backup FVB protocol interface. LBA is\r | |
349 | FtwLiteDevice->FtwSpareLba.\r | |
350 | Working block is accessed by FTW working FVB protocol interface. LBA is\r | |
351 | FtwLiteDevice->FtwWorkBlockLba.\r | |
352 | \r | |
353 | \r | |
354 | @param FtwLiteDevice The private data of FTW_LITE driver\r | |
355 | \r | |
356 | @retval EFI_SUCCESS Spare block content is copied to target block\r | |
357 | @retval EFI_OUT_OF_RESOURCES Allocate memory error\r | |
358 | @retval EFI_ABORTED The function could not complete successfully\r | |
359 | Notes:\r | |
360 | Since the working block header is important when FTW initializes, the\r | |
361 | state of the operation should be handled carefully. The Crc value is\r | |
362 | calculated without STATE element.\r | |
363 | \r | |
364 | **/\r | |
d7dec593 | 365 | EFI_STATUS\r |
366 | FlushSpareBlockToWorkingBlock (\r | |
367 | EFI_FTW_LITE_DEVICE *FtwLiteDevice\r | |
ed66e1bc | 368 | );\r |
d7dec593 | 369 | \r |
6aab8214 | 370 | /**\r |
371 | Update a bit of state on a block device. The location of the bit is\r | |
372 | calculated by the (Lba, Offset, bit). Here bit is determined by the\r | |
373 | the name of a certain bit.\r | |
d7dec593 | 374 | \r |
d7dec593 | 375 | \r |
6aab8214 | 376 | @param FvBlock FVB Protocol interface to access SrcBlock and DestBlock\r |
377 | @param Lba Lba of a block\r | |
378 | @param Offset Offset on the Lba\r | |
379 | @param NewBit New value that will override the old value if it can be change\r | |
d7dec593 | 380 | \r |
6aab8214 | 381 | @retval EFI_SUCCESS A state bit has been updated successfully\r |
382 | @retval Others Access block device error.\r | |
383 | Notes:\r | |
384 | Assume all bits of State are inside the same BYTE.\r | |
385 | @retval EFI_ABORTED Read block fail\r | |
d7dec593 | 386 | \r |
6aab8214 | 387 | **/\r |
d7dec593 | 388 | EFI_STATUS\r |
389 | FtwUpdateFvState (\r | |
390 | IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvBlock,\r | |
391 | IN EFI_LBA Lba,\r | |
392 | IN UINTN Offset,\r | |
393 | IN UINT8 NewBit\r | |
ed66e1bc | 394 | );\r |
d7dec593 | 395 | \r |
6aab8214 | 396 | /**\r |
397 | Get the last Write record pointer.\r | |
398 | The last record is the record whose 'complete' state hasn't been set.\r | |
399 | After all, this header may be a EMPTY header entry for next Allocate.\r | |
d7dec593 | 400 | \r |
d7dec593 | 401 | \r |
6aab8214 | 402 | @param FtwLiteDevice Private data of this driver\r |
403 | @param FtwLastRecord Pointer to retrieve the last write record\r | |
d7dec593 | 404 | \r |
6aab8214 | 405 | @retval EFI_SUCCESS Get the last write record successfully\r |
406 | @retval EFI_ABORTED The FTW work space is damaged\r | |
d7dec593 | 407 | \r |
6aab8214 | 408 | **/\r |
d7dec593 | 409 | EFI_STATUS\r |
410 | FtwGetLastRecord (\r | |
411 | IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r | |
412 | OUT EFI_FTW_LITE_RECORD **FtwLastRecord\r | |
ed66e1bc | 413 | );\r |
d7dec593 | 414 | \r |
6aab8214 | 415 | /**\r |
d7dec593 | 416 | \r |
6aab8214 | 417 | Check whether a flash buffer is erased.\r |
d7dec593 | 418 | \r |
d7dec593 | 419 | \r |
6aab8214 | 420 | @param Polarity All 1 or all 0\r |
421 | @param Buffer Buffer to check\r | |
422 | @param BufferSize Size of the buffer\r | |
d7dec593 | 423 | \r |
6aab8214 | 424 | @return A BOOLEAN value indicating erased or not.\r |
425 | \r | |
426 | **/\r | |
d7dec593 | 427 | BOOLEAN\r |
428 | IsErasedFlashBuffer (\r | |
429 | IN BOOLEAN Polarity,\r | |
430 | IN UINT8 *Buffer,\r | |
431 | IN UINTN BufferSize\r | |
ed66e1bc | 432 | );\r |
d7dec593 | 433 | \r |
6aab8214 | 434 | /**\r |
435 | Initialize a work space when there is no work space.\r | |
d7dec593 | 436 | \r |
d7dec593 | 437 | \r |
6aab8214 | 438 | @param WorkingHeader Pointer of working block header\r |
d7dec593 | 439 | \r |
6aab8214 | 440 | @retval EFI_SUCCESS The function completed successfully\r |
441 | @retval EFI_ABORTED The function could not complete successfully.\r | |
d7dec593 | 442 | \r |
6aab8214 | 443 | **/\r |
d7dec593 | 444 | EFI_STATUS\r |
445 | InitWorkSpaceHeader (\r | |
446 | IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader\r | |
ed66e1bc | 447 | );\r |
d7dec593 | 448 | \r |
6aab8214 | 449 | /**\r |
450 | Read from working block to refresh the work space in memory.\r | |
d7dec593 | 451 | \r |
d7dec593 | 452 | \r |
6aab8214 | 453 | @param FtwLiteDevice Point to private data of FTW driver\r |
d7dec593 | 454 | \r |
6aab8214 | 455 | @retval EFI_SUCCESS The function completed successfully\r |
456 | @retval EFI_ABORTED The function could not complete successfully.\r | |
d7dec593 | 457 | \r |
6aab8214 | 458 | **/\r |
d7dec593 | 459 | EFI_STATUS\r |
460 | WorkSpaceRefresh (\r | |
461 | IN EFI_FTW_LITE_DEVICE *FtwLiteDevice\r | |
ed66e1bc | 462 | );\r |
d7dec593 | 463 | \r |
6aab8214 | 464 | /**\r |
465 | Check to see if it is a valid work space.\r | |
d7dec593 | 466 | \r |
d7dec593 | 467 | \r |
6aab8214 | 468 | @param WorkingHeader Pointer of working block header\r |
d7dec593 | 469 | \r |
6aab8214 | 470 | @retval EFI_SUCCESS The function completed successfully\r |
471 | @retval EFI_ABORTED The function could not complete successfully.\r | |
d7dec593 | 472 | \r |
6aab8214 | 473 | **/\r |
d7dec593 | 474 | BOOLEAN\r |
475 | IsValidWorkSpace (\r | |
476 | IN EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *WorkingHeader\r | |
ed66e1bc | 477 | );\r |
d7dec593 | 478 | \r |
6aab8214 | 479 | /**\r |
480 | Reclaim the work space on the working block.\r | |
d7dec593 | 481 | \r |
d7dec593 | 482 | \r |
6aab8214 | 483 | @param FtwLiteDevice Point to private data of FTW driver\r |
e11ae3a5 | 484 | @param PreserveRecord Whether to preserve the working record is needed\r |
d7dec593 | 485 | \r |
6aab8214 | 486 | @retval EFI_SUCCESS The function completed successfully\r |
487 | @retval EFI_OUT_OF_RESOURCES Allocate memory error\r | |
488 | @retval EFI_ABORTED The function could not complete successfully\r | |
d7dec593 | 489 | \r |
6aab8214 | 490 | **/\r |
d7dec593 | 491 | EFI_STATUS\r |
492 | FtwReclaimWorkSpace (\r | |
e11ae3a5 LG |
493 | IN EFI_FTW_LITE_DEVICE *FtwLiteDevice,\r |
494 | IN BOOLEAN PreserveRecord\r | |
ed66e1bc | 495 | );\r |
d7dec593 | 496 | \r |
497 | #endif\r |