]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
Code scrub for DiskIo, Partition & Unicode Collation
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / FwVolBlock / FwVolBlock.c
CommitLineData
162ed594 1/** @file\r
2 Firmware Volume Block protocol. Consumes FV hobs and creates\r
797a9d67 3 appropriate block protocols.\r
28a00297 4\r
797a9d67 5 Also consumes NT_NON_MM_FV envinronment variable and produces appropriate\r
6 block protocols fro them also... (this is TBD)\r
23c98c94 7\r
8Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
9All rights reserved. This program and the accompanying materials\r
10are licensed and made available under the terms and conditions of the BSD License\r
11which accompanies this distribution. The full text of the license may be found at\r
12http://opensource.org/licenses/bsd-license.php\r
13\r
14THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
28a00297 16\r
797a9d67 17**/\r
28a00297 18\r
19#include <DxeMain.h>\r
20\r
21\r
22EFI_FW_VOL_BLOCK_DEVICE mFwVolBlock = {\r
23 FVB_DEVICE_SIGNATURE,\r
24 NULL,\r
25 {\r
26 {\r
27 {\r
28 HARDWARE_DEVICE_PATH,\r
29 HW_MEMMAP_DP,\r
30 { (UINT8)(sizeof (MEMMAP_DEVICE_PATH)), (UINT8)(sizeof (MEMMAP_DEVICE_PATH) >> 8) }\r
31 },\r
32 EfiMemoryMappedIO,\r
33 (EFI_PHYSICAL_ADDRESS)0,\r
34 (EFI_PHYSICAL_ADDRESS)0,\r
35 },\r
36 {\r
37 END_DEVICE_PATH_TYPE,\r
38 END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
39 { END_DEVICE_PATH_LENGTH, 0 } \r
40 },\r
41 },\r
42 {\r
43 FwVolBlockGetAttributes,\r
44 (EFI_FVB_SET_ATTRIBUTES)FwVolBlockSetAttributes,\r
45 FwVolBlockGetPhysicalAddress,\r
46 FwVolBlockGetBlockSize,\r
47 FwVolBlockReadBlock,\r
48 (EFI_FVB_WRITE)FwVolBlockWriteBlock,\r
49 (EFI_FVB_ERASE_BLOCKS)FwVolBlockEraseBlock,\r
50 NULL \r
51 },\r
52 0,\r
53 NULL,\r
54 0,\r
55 0\r
56};\r
57\r
58\r
59\r
60\r
162ed594 61\r
62/**\r
63 Retrieves Volume attributes. No polarity translations are done.\r
64\r
65 @param This Calling context \r
66 @param Attributes output buffer which contains attributes \r
67\r
68 @retval EFI_SUCCESS The firmware volume attributes were returned.\r
69\r
70**/\r
28a00297 71EFI_STATUS\r
72EFIAPI\r
73FwVolBlockGetAttributes (\r
74 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
75 OUT EFI_FVB_ATTRIBUTES *Attributes\r
76 )\r
28a00297 77{\r
78 EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;\r
79 \r
80 FvbDevice = FVB_DEVICE_FROM_THIS (This);\r
81\r
82 //\r
83 // Since we are read only, it's safe to get attributes data from our in-memory copy.\r
84 //\r
85 *Attributes = FvbDevice->FvbAttributes;\r
86\r
87 return EFI_SUCCESS;\r
88}\r
89\r
90\r
162ed594 91\r
92/**\r
93 Modifies the current settings of the firmware volume according to the input parameter.\r
94\r
95 @param This Calling context \r
96 @param Attributes input buffer which contains attributes \r
97\r
98 @retval EFI_SUCCESS The firmware volume attributes were returned. \r
99 @retval EFI_INVALID_PARAMETER The attributes requested are in conflict with \r
100 the capabilities as declared in the firmware \r
101 volume header. \r
102 @retval EFI_UNSUPPORTED Not supported.\r
103\r
104**/\r
28a00297 105EFI_STATUS\r
106EFIAPI\r
107FwVolBlockSetAttributes (\r
108 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
109 IN CONST EFI_FVB_ATTRIBUTES *Attributes\r
110 )\r
28a00297 111{\r
112 return EFI_UNSUPPORTED;\r
113}\r
114\r
115\r
162ed594 116\r
117/**\r
118 The EraseBlock() function erases one or more blocks as denoted by the\r
119 variable argument list. The entire parameter list of blocks must be verified\r
120 prior to erasing any blocks. If a block is requested that does not exist\r
121 within the associated firmware volume (it has a larger index than the last\r
122 block of the firmware volume), the EraseBlock() function must return\r
123 EFI_INVALID_PARAMETER without modifying the contents of the firmware volume.\r
124\r
125 @param This Calling context \r
126 @param ... Starting LBA followed by Number of Lba to erase. \r
127 a -1 to terminate the list. \r
128\r
129 @retval EFI_SUCCESS The erase request was successfully completed. \r
130 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled \r
131 state. \r
132 @retval EFI_DEVICE_ERROR The block device is not functioning correctly \r
133 and could not be written. The firmware device \r
134 may have been partially erased. \r
135 @retval EFI_INVALID_PARAMETER One or more of the LBAs listed in the variable \r
136 argument list do \r
137 @retval EFI_UNSUPPORTED Not supported.\r
138\r
139**/\r
28a00297 140EFI_STATUS\r
141EFIAPI\r
142FwVolBlockEraseBlock (\r
143 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
144 ...\r
145 )\r
28a00297 146{\r
147 return EFI_UNSUPPORTED;\r
148}\r
149\r
150\r
162ed594 151\r
152/**\r
153 Read the specified number of bytes from the block to the input buffer.\r
154\r
155 @param This Indicates the calling context. \r
156 @param Lba The starting logical block index to read. \r
157 @param Offset Offset into the block at which to begin reading. \r
158 @param NumBytes Pointer to a UINT32. At entry, *NumBytes \r
159 contains the total size of the buffer. At exit, \r
160 *NumBytes contains the total number of bytes \r
161 actually read. \r
162 @param Buffer Pinter to a caller-allocated buffer that \r
163 contains the destine for the read. \r
164\r
165 @retval EFI_SUCCESS The firmware volume was read successfully. \r
166 @retval EFI_BAD_BUFFER_SIZE The read was attempted across an LBA boundary. \r
167 @retval EFI_ACCESS_DENIED Access denied. \r
168 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not \r
169 be read.\r
170\r
171**/\r
28a00297 172EFI_STATUS\r
173EFIAPI\r
174FwVolBlockReadBlock (\r
175 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
176 IN CONST EFI_LBA Lba,\r
177 IN CONST UINTN Offset,\r
178 IN OUT UINTN *NumBytes,\r
179 IN OUT UINT8 *Buffer\r
180 )\r
28a00297 181{\r
182 EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;\r
183 EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;\r
184 UINT8 *LbaOffset;\r
185 UINTN LbaStart;\r
186 UINTN NumOfBytesRead;\r
187 UINTN LbaIndex;\r
188 \r
189 FvbDevice = FVB_DEVICE_FROM_THIS (This);\r
190\r
191 //\r
192 // Check if This FW can be read\r
193 //\r
797a9d67 194 if ((FvbDevice->FvbAttributes & EFI_FVB2_READ_STATUS) == 0) {\r
28a00297 195 return EFI_ACCESS_DENIED;\r
196 }\r
197 \r
198 LbaIndex = (UINTN)Lba;\r
199 if (LbaIndex >= FvbDevice->NumBlocks) {\r
200 //\r
201 // Invalid Lba, read nothing.\r
202 //\r
203 *NumBytes = 0;\r
204 return EFI_BAD_BUFFER_SIZE;\r
205 }\r
206 \r
207 if (Offset > FvbDevice->LbaCache[LbaIndex].Length) {\r
208 //\r
209 // all exceed boundry, read nothing.\r
210 //\r
211 *NumBytes = 0;\r
212 return EFI_BAD_BUFFER_SIZE;\r
213 }\r
214 \r
215 NumOfBytesRead = *NumBytes;\r
216 if (Offset + NumOfBytesRead > FvbDevice->LbaCache[LbaIndex].Length) {\r
217 //\r
218 // partial exceed boundry, read data from current postion to end.\r
219 //\r
220 NumOfBytesRead = FvbDevice->LbaCache[LbaIndex].Length - Offset;\r
221 }\r
222 \r
223 LbaStart = FvbDevice->LbaCache[LbaIndex].Base;\r
224 FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN)FvbDevice->BaseAddress);\r
225 LbaOffset = (UINT8 *)FwVolHeader + LbaStart + Offset;\r
226\r
227 //\r
228 // Perform read operation\r
229 //\r
230 CopyMem (Buffer, LbaOffset, NumOfBytesRead);\r
231 \r
232 if (NumOfBytesRead == *NumBytes) {\r
233 return EFI_SUCCESS;\r
234 }\r
235 \r
236 *NumBytes = NumOfBytesRead;\r
237 return EFI_BAD_BUFFER_SIZE;\r
238}\r
239 \r
240\r
162ed594 241\r
242/**\r
243 Writes the specified number of bytes from the input buffer to the block.\r
244\r
245 @param This Indicates the calling context. \r
246 @param Lba The starting logical block index to write to. \r
247 @param Offset Offset into the block at which to begin writing. \r
248 @param NumBytes Pointer to a UINT32. At entry, *NumBytes \r
249 contains the total size of the buffer. At exit, \r
250 *NumBytes contains the total number of bytes \r
251 actually written. \r
252 @param Buffer Pinter to a caller-allocated buffer that \r
253 contains the source for the write. \r
254\r
255 @retval EFI_SUCCESS The firmware volume was written successfully. \r
256 @retval EFI_BAD_BUFFER_SIZE The write was attempted across an LBA boundary. \r
257 On output, NumBytes contains the total number of \r
258 bytes actually written. \r
259 @retval EFI_ACCESS_DENIED The firmware volume is in the WriteDisabled \r
260 state. \r
261 @retval EFI_DEVICE_ERROR The block device is malfunctioning and could not \r
262 be written. \r
263 @retval EFI_UNSUPPORTED Not supported.\r
264\r
265**/\r
28a00297 266EFI_STATUS\r
267EFIAPI\r
268FwVolBlockWriteBlock (\r
269 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
270 IN EFI_LBA Lba,\r
271 IN UINTN Offset,\r
272 IN OUT UINTN *NumBytes,\r
273 IN UINT8 *Buffer\r
274 )\r
28a00297 275{\r
276 return EFI_UNSUPPORTED;\r
277}\r
278 \r
279\r
162ed594 280\r
281/**\r
282 Get Fvb's base address.\r
283\r
284 @param This Indicates the calling context. \r
285 @param Address Fvb device base address. \r
286\r
287 @retval EFI_SUCCESS Successfully got Fvb's base address. \r
288 @retval EFI_UNSUPPORTED Not supported.\r
289\r
290**/\r
28a00297 291EFI_STATUS\r
292EFIAPI\r
293FwVolBlockGetPhysicalAddress (\r
294 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
295 OUT EFI_PHYSICAL_ADDRESS *Address\r
296 )\r
28a00297 297{\r
298 EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;\r
299 \r
300 FvbDevice = FVB_DEVICE_FROM_THIS (This);\r
301 \r
797a9d67 302 if (FvbDevice->FvbAttributes & EFI_FVB2_MEMORY_MAPPED) {\r
28a00297 303 *Address = FvbDevice->BaseAddress;\r
304 return EFI_SUCCESS;\r
305 }\r
306 \r
307 return EFI_UNSUPPORTED;\r
308}\r
309\r
310\r
162ed594 311\r
312/**\r
313 Retrieves the size in bytes of a specific block within a firmware volume.\r
314\r
315 @param This Indicates the calling context. \r
316 @param Lba Indicates the block for which to return the \r
317 size. \r
318 @param BlockSize Pointer to a caller-allocated UINTN in which the \r
319 size of the block is returned. \r
320 @param NumberOfBlocks Pointer to a caller-allocated UINTN in which the \r
321 number of consecutive blocks starting with Lba \r
322 is returned. All blocks in this range have a \r
323 size of BlockSize. \r
324\r
325 @retval EFI_SUCCESS The firmware volume base address is returned. \r
326 @retval EFI_INVALID_PARAMETER The requested LBA is out of range.\r
327\r
328**/\r
28a00297 329EFI_STATUS\r
330EFIAPI\r
331FwVolBlockGetBlockSize (\r
332 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,\r
333 IN CONST EFI_LBA Lba,\r
334 IN OUT UINTN *BlockSize,\r
335 IN OUT UINTN *NumberOfBlocks\r
336 )\r
28a00297 337{\r
338 UINTN TotalBlocks;\r
339 EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;\r
340 EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;\r
341 EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;\r
342 \r
343 FvbDevice = FVB_DEVICE_FROM_THIS (This);\r
344 \r
345 //\r
346 // Do parameter checking\r
347 //\r
348 if (Lba >= FvbDevice->NumBlocks) {\r
349 return EFI_INVALID_PARAMETER;\r
350 }\r
351 \r
352 FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)((UINTN)FvbDevice->BaseAddress);\r
353 \r
354 PtrBlockMapEntry = FwVolHeader->BlockMap;\r
355 \r
356 //\r
357 // Search the block map for the given block\r
358 //\r
359 TotalBlocks = 0;\r
360 while ((PtrBlockMapEntry->NumBlocks != 0) || (PtrBlockMapEntry->Length !=0 )) {\r
361 TotalBlocks += PtrBlockMapEntry->NumBlocks;\r
362 if (Lba < TotalBlocks) {\r
363 //\r
364 // We find the range\r
365 //\r
366 break;\r
367 }\r
368 \r
369 PtrBlockMapEntry++;\r
370 }\r
371 \r
372 *BlockSize = PtrBlockMapEntry->Length;\r
373 *NumberOfBlocks = TotalBlocks - (UINTN)Lba;\r
374 \r
375 return EFI_SUCCESS;\r
376}\r
377\r
378\r
162ed594 379\r
380/**\r
381 This routine produces a firmware volume block protocol on a given\r
382 buffer.\r
383\r
384 @param BaseAddress base address of the firmware volume image \r
385 @param Length length of the firmware volume image \r
386 @param ParentHandle handle of parent firmware volume, if this image \r
387 came from an FV image file in another firmware \r
388 volume (ala capsules) \r
389 @param FvProtocol Firmware volume block protocol produced. \r
390\r
391 @retval EFI_VOLUME_CORRUPTED Volume corrupted. \r
392 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated. \r
393 @retval EFI_SUCCESS Successfully produced a FVB protocol on given \r
394 buffer.\r
395\r
396**/\r
28a00297 397EFI_STATUS\r
398ProduceFVBProtocolOnBuffer (\r
399 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
400 IN UINT64 Length,\r
401 IN EFI_HANDLE ParentHandle,\r
402 OUT EFI_HANDLE *FvProtocol OPTIONAL\r
403 )\r
28a00297 404{\r
405 EFI_STATUS Status;\r
406 EFI_FW_VOL_BLOCK_DEVICE *FvbDev;\r
407 EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;\r
408 UINTN BlockIndex;\r
409 UINTN BlockIndex2;\r
410 UINTN LinearOffset;\r
38837959 411 UINT32 FvAlignment;\r
28a00297 412 EFI_FV_BLOCK_MAP_ENTRY *PtrBlockMapEntry;\r
38837959
LG
413 \r
414 FvAlignment = 0;\r
28a00297 415 FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)BaseAddress;\r
416 //\r
417 // Validate FV Header, if not as expected, return\r
418 //\r
419 if (FwVolHeader->Signature != EFI_FVH_SIGNATURE) {\r
420 return EFI_VOLUME_CORRUPTED;\r
421 }\r
422 //\r
38837959
LG
423 // Get FvHeader alignment\r
424 //\r
425 FvAlignment = 1 << ((FwVolHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);\r
426 if (FvAlignment < 8) {\r
427 FvAlignment = 8;\r
428 }\r
429 if ((UINTN)BaseAddress % FvAlignment != 0) {\r
430 //\r
431 // FvImage buffer is not at its required alignment.\r
432 //\r
433 return EFI_VOLUME_CORRUPTED;\r
434 }\r
435 //\r
28a00297 436 // Allocate EFI_FW_VOL_BLOCK_DEVICE \r
437 //\r
438 FvbDev = CoreAllocateCopyPool (sizeof (EFI_FW_VOL_BLOCK_DEVICE), &mFwVolBlock);\r
439 if (FvbDev == NULL) {\r
440 return EFI_OUT_OF_RESOURCES;\r
441 }\r
442\r
443 FvbDev->BaseAddress = BaseAddress;\r
444 FvbDev->FvbAttributes = FwVolHeader->Attributes;\r
445 FvbDev->FwVolBlockInstance.ParentHandle = ParentHandle;\r
446\r
447 //\r
448 // Init the block caching fields of the device\r
449 // First, count the number of blocks\r
450 //\r
451 FvbDev->NumBlocks = 0;\r
452 for (PtrBlockMapEntry = FwVolHeader->BlockMap;\r
453 PtrBlockMapEntry->NumBlocks != 0;\r
454 PtrBlockMapEntry++) {\r
455 FvbDev->NumBlocks += PtrBlockMapEntry->NumBlocks;\r
456 }\r
457 //\r
458 // Second, allocate the cache\r
459 //\r
460 FvbDev->LbaCache = CoreAllocateBootServicesPool (FvbDev->NumBlocks * sizeof (LBA_CACHE));\r
461 if (FvbDev->LbaCache == NULL) {\r
462 CoreFreePool (FvbDev);\r
463 return EFI_OUT_OF_RESOURCES;\r
464 }\r
465 //\r
466 // Last, fill in the cache with the linear address of the blocks\r
467 //\r
468 BlockIndex = 0;\r
469 LinearOffset = 0;\r
470 for (PtrBlockMapEntry = FwVolHeader->BlockMap;\r
471 PtrBlockMapEntry->NumBlocks != 0; PtrBlockMapEntry++) {\r
472 for (BlockIndex2 = 0; BlockIndex2 < PtrBlockMapEntry->NumBlocks; BlockIndex2++) {\r
473 FvbDev->LbaCache[BlockIndex].Base = LinearOffset;\r
474 FvbDev->LbaCache[BlockIndex].Length = PtrBlockMapEntry->Length;\r
475 LinearOffset += PtrBlockMapEntry->Length;\r
476 BlockIndex++;\r
477 }\r
478 }\r
479\r
480 //\r
481 // Set up the devicepath\r
482 //\r
483 FvbDev->DevicePath.MemMapDevPath.StartingAddress = BaseAddress;\r
484 FvbDev->DevicePath.MemMapDevPath.EndingAddress = BaseAddress + FwVolHeader->FvLength - 1;\r
485\r
486 //\r
487 //\r
488 // Attach FvVolBlock Protocol to new handle\r
489 //\r
490 Status = CoreInstallMultipleProtocolInterfaces (\r
491 &FvbDev->Handle,\r
492 &gEfiFirmwareVolumeBlockProtocolGuid, &FvbDev->FwVolBlockInstance,\r
493 &gEfiDevicePathProtocolGuid, &FvbDev->DevicePath,\r
494 &gEfiFirmwareVolumeDispatchProtocolGuid, NULL,\r
495 NULL\r
496 );\r
497\r
498 //\r
499 // If they want the handle back, set it.\r
500 //\r
501 if (FvProtocol != NULL) {\r
502 *FvProtocol = FvbDev->Handle;\r
503 }\r
504\r
505 return Status;\r
506}\r
507\r
508\r
162ed594 509\r
510/**\r
511 This routine is the driver initialization entry point. It initializes the\r
512 libraries, consumes FV hobs and NT_NON_MM_FV environment variable and\r
513 produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\r
514\r
515 @param ImageHandle The image handle. \r
516 @param SystemTable The system table. \r
517\r
518 @retval EFI_SUCCESS Successfully initialized firmware volume block \r
519 driver.\r
520\r
521**/\r
28a00297 522EFI_STATUS\r
523EFIAPI\r
524FwVolBlockDriverInit (\r
525 IN EFI_HANDLE ImageHandle,\r
526 IN EFI_SYSTEM_TABLE *SystemTable\r
527 )\r
28a00297 528{\r
529 EFI_PEI_HOB_POINTERS FvHob;\r
530 //\r
531 // Core Needs Firmware Volumes to function\r
532 //\r
533 FvHob.Raw = GetHobList ();\r
534 while ((FvHob.Raw = GetNextHob (EFI_HOB_TYPE_FV, FvHob.Raw)) != NULL) {\r
535 //\r
536 // Produce an FVB protocol for it\r
537 //\r
538 ProduceFVBProtocolOnBuffer (FvHob.FirmwareVolume->BaseAddress, FvHob.FirmwareVolume->Length, NULL, NULL); \r
539 FvHob.Raw = GET_NEXT_HOB (FvHob);\r
540 }\r
541 return EFI_SUCCESS;\r
542}\r
543\r
544\r
162ed594 545\r
546/**\r
547 This DXE service routine is used to process a firmware volume. In\r
548 particular, it can be called by BDS to process a single firmware\r
549 volume found in a capsule.\r
550\r
551 @param FvHeader pointer to a firmware volume header \r
552 @param Size the size of the buffer pointed to by FvHeader \r
553 @param FVProtocolHandle the handle on which a firmware volume protocol \r
554 was produced for the firmware volume passed in. \r
555\r
556 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of \r
557 system resources \r
558 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted \r
559 @retval EFI_SUCCESS a firmware volume protocol was produced for the \r
560 firmware volume\r
561\r
562**/\r
28a00297 563EFI_STATUS\r
564CoreProcessFirmwareVolume (\r
565 IN VOID *FvHeader,\r
566 IN UINTN Size, \r
567 OUT EFI_HANDLE *FVProtocolHandle\r
568 )\r
28a00297 569{\r
570 VOID *Ptr;\r
571 EFI_STATUS Status;\r
572\r
573 *FVProtocolHandle = NULL;\r
574 Status = ProduceFVBProtocolOnBuffer ( \r
575 (EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader, \r
576 (UINT64)Size, \r
577 NULL, \r
578 FVProtocolHandle\r
579 );\r
580 //\r
581 // Since in our implementation we use register-protocol-notify to put a\r
582 // FV protocol on the FVB protocol handle, we can't directly verify that\r
583 // the FV protocol was produced. Therefore here we will check the handle\r
584 // and make sure an FV protocol is on it. This indicates that all went \r
585 // well. Otherwise we have to assume that the volume was corrupted \r
586 // somehow.\r
587 //\r
588 if (!EFI_ERROR(Status)) {\r
589 Ptr = NULL;\r
0c2b5da8 590 Status = CoreHandleProtocol (*FVProtocolHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Ptr);\r
28a00297 591 if (EFI_ERROR(Status) || (Ptr == NULL)) {\r
592 return EFI_VOLUME_CORRUPTED;\r
593 }\r
594 return EFI_SUCCESS;\r
595 }\r
596 return Status;\r
597}\r
598\r
599\r
162ed594 600\r