]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/EdkFvbServiceLib/Fvb.c
Add comments and DoxyGen format for these files.
[mirror_edk2.git] / MdeModulePkg / Library / EdkFvbServiceLib / Fvb.c
CommitLineData
a190687a 1/**@file\r
2\r
504214c4
LG
3 Firmware Volume Block Protocol Runtime Interface Abstraction\r
4 And FVB Extension protocol Runtime Interface Abstraction\r
a190687a 5\r
6 mFvbEntry is an array of Handle Fvb pairs. The Fvb Lib Instance matches the\r
7 index in the mFvbEntry array. This should be the same sequence as the FVB's\r
8 were described in the HOB. We have to remember the handle so we can tell if\r
9 the protocol has been reinstalled and it needs updateing.\r
10\r
11 If you are using any of these lib functions.you must first call FvbInitialize ().\r
12\r
504214c4 13Copyright (c) 2006 - 2008, Intel Corporation\r
a190687a 14All rights reserved. This program and the accompanying materials\r
15are licensed and made available under the terms and conditions of the BSD License\r
16which accompanies this distribution. The full text of the license may be found at\r
17http://opensource.org/licenses/bsd-license.php\r
18\r
19THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
20WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
21\r
22**/\r
23\r
24\r
25#include "Fvb.h"\r
26\r
27//\r
85363c1e 28// Event for Set Virtual Map Changed Event\r
a190687a 29//\r
85363c1e 30STATIC EFI_EVENT mSetVirtualMapChangedEvent = NULL;\r
a190687a 31\r
32//\r
33// Lib will ASSERT if more FVB devices than this are added to the system.\r
34//\r
35STATIC FVB_ENTRY *mFvbEntry;\r
36STATIC EFI_EVENT mFvbRegistration;\r
a190687a 37STATIC UINTN mFvbCount;\r
38\r
39/**\r
40 Check whether an address is runtime memory or not.\r
41\r
42 @param Address The Address being checked.\r
43\r
44 @retval TRUE The address is runtime memory.\r
45 @retval FALSE The address is not runtime memory.\r
46**/\r
47BOOLEAN\r
48IsRuntimeMemory (\r
49 IN VOID *Address\r
50 )\r
51{\r
52 EFI_STATUS Status;\r
53 UINT8 TmpMemoryMap[1];\r
54 UINTN MapKey;\r
55 UINTN DescriptorSize;\r
56 UINT32 DescriptorVersion;\r
57 UINTN MemoryMapSize;\r
58 EFI_MEMORY_DESCRIPTOR *MemoryMap;\r
59 EFI_MEMORY_DESCRIPTOR *MemoryMapPtr;\r
60 BOOLEAN IsRuntime;\r
61 UINTN Index;\r
62\r
63 IsRuntime = FALSE;\r
64\r
65 //\r
66 // Get System MemoryMapSize\r
67 //\r
68 MemoryMapSize = 1;\r
69 Status = gBS->GetMemoryMap (\r
70 &MemoryMapSize,\r
71 (EFI_MEMORY_DESCRIPTOR *)TmpMemoryMap,\r
72 &MapKey,\r
73 &DescriptorSize,\r
74 &DescriptorVersion\r
75 );\r
76 ASSERT (Status == EFI_BUFFER_TOO_SMALL);\r
77 //\r
78 // Enlarge space here, because we will allocate pool now.\r
79 //\r
80 MemoryMapSize += EFI_PAGE_SIZE;\r
81 Status = gBS->AllocatePool (\r
82 EfiBootServicesData,\r
83 MemoryMapSize,\r
84 (VOID**)&MemoryMap\r
85 );\r
86 ASSERT_EFI_ERROR (Status);\r
87\r
88 //\r
89 // Get System MemoryMap\r
90 //\r
91 Status = gBS->GetMemoryMap (\r
92 &MemoryMapSize,\r
93 MemoryMap,\r
94 &MapKey,\r
95 &DescriptorSize,\r
96 &DescriptorVersion\r
97 );\r
98 ASSERT_EFI_ERROR (Status);\r
99\r
100 MemoryMapPtr = MemoryMap;\r
101 //\r
102 // Search the request Address\r
103 //\r
104 for (Index = 0; Index < (MemoryMapSize / DescriptorSize); Index++) {\r
105 if (((EFI_PHYSICAL_ADDRESS)(UINTN)Address >= MemoryMap->PhysicalStart) &&\r
106 ((EFI_PHYSICAL_ADDRESS)(UINTN)Address < MemoryMap->PhysicalStart\r
107 + LShiftU64 (MemoryMap->NumberOfPages, EFI_PAGE_SHIFT))) {\r
108 //\r
109 // Found it\r
110 //\r
111 if (MemoryMap->Attribute & EFI_MEMORY_RUNTIME) {\r
112 IsRuntime = TRUE;\r
113 }\r
114 break;\r
115 }\r
116 //\r
117 // Get next item\r
118 //\r
119 MemoryMap = (EFI_MEMORY_DESCRIPTOR *)((UINTN)MemoryMap + DescriptorSize);\r
120 }\r
121\r
122 //\r
123 // Done\r
124 //\r
125 gBS->FreePool (MemoryMapPtr);\r
126\r
127 return IsRuntime;\r
128}\r
129\r
130/**\r
131 Update mFvbEntry. Add new entry, or update existing entry if Fvb protocol is\r
132 reinstalled.\r
133\r
134 @param Event The Event that is being processed\r
135 @param Context Event Context\r
136\r
137**/\r
138STATIC\r
139VOID\r
140EFIAPI\r
141FvbNotificationEvent (\r
142 IN EFI_EVENT Event,\r
143 IN VOID *Context\r
144 )\r
145{\r
146 EFI_STATUS Status;\r
147 UINTN BufferSize;\r
148 EFI_HANDLE Handle;\r
149 UINTN Index;\r
150 UINTN UpdateIndex;\r
151\r
152 while (TRUE) {\r
153 BufferSize = sizeof (Handle);\r
154 Status = gBS->LocateHandle (\r
155 ByRegisterNotify,\r
156 &gEfiFirmwareVolumeBlockProtocolGuid,\r
157 mFvbRegistration,\r
158 &BufferSize,\r
159 &Handle\r
160 );\r
161 if (EFI_ERROR (Status)) {\r
162 //\r
163 // Exit Path of While Loop....\r
164 //\r
165 break;\r
166 }\r
167\r
168 UpdateIndex = MAX_FVB_COUNT;\r
169 for (Index = 0; Index < mFvbCount; Index++) {\r
170 if (mFvbEntry[Index].Handle == Handle) {\r
171 //\r
172 // If the handle is already in the table just update the protocol\r
173 //\r
174 UpdateIndex = Index;\r
175 break;\r
176 }\r
177 }\r
178\r
179 if (UpdateIndex == MAX_FVB_COUNT) {\r
180 //\r
181 // Use the next free slot for a new entry\r
182 //\r
183 UpdateIndex = mFvbCount++;\r
184 //\r
185 // Check the UpdateIndex whether exceed the maximum value.\r
186 //\r
187 ASSERT (UpdateIndex < MAX_FVB_COUNT);\r
188 mFvbEntry[UpdateIndex].Handle = Handle;\r
189 }\r
190 //\r
191 // The array does not have enough entries\r
192 //\r
193 ASSERT (UpdateIndex < MAX_FVB_COUNT);\r
194\r
195 //\r
196 // Get the interface pointer and if it's ours, skip it\r
197 //\r
198 Status = gBS->HandleProtocol (\r
199 Handle,\r
200 &gEfiFirmwareVolumeBlockProtocolGuid,\r
201 (VOID **) &mFvbEntry[UpdateIndex].Fvb\r
202 );\r
203 ASSERT_EFI_ERROR (Status);\r
204\r
205 Status = gBS->HandleProtocol (\r
206 Handle,\r
207 &gEfiFvbExtensionProtocolGuid,\r
208 (VOID **) &mFvbEntry[UpdateIndex].FvbExtension\r
209 );\r
210 if (Status != EFI_SUCCESS) {\r
211 mFvbEntry[UpdateIndex].FvbExtension = NULL;\r
212 }\r
213\r
214 //\r
215 // Check the FVB can be accessed in RUNTIME, The FVBs in FVB handle list comes\r
216 // from two way:\r
217 // 1) Dxe Core. (FVB information is transferred from FV HOB).\r
218 // 2) FVB driver.\r
219 // The FVB produced Dxe core is used for discoverying DXE driver and dispatch. These\r
220 // FVBs can only be accessed in boot time.\r
221 // FVB driver will discovery all FV in FLASH and these FVBs can be accessed in runtime.\r
222 // The FVB itself produced by FVB driver is allocated in runtime memory. So we can\r
223 // determine the what FVB can be accessed in RUNTIME by judging whether FVB itself is allocated\r
224 // in RUNTIME memory.\r
225 //\r
226 mFvbEntry[UpdateIndex].IsRuntimeAccess = IsRuntimeMemory (mFvbEntry[UpdateIndex].Fvb);\r
227 }\r
228}\r
229\r
230/**\r
231 Convert all pointers in mFvbEntry after ExitBootServices.\r
232\r
233 @param Event The Event that is being processed\r
234 @param Context Event Context\r
235\r
236**/\r
237VOID\r
238EFIAPI\r
239FvbVirtualAddressChangeNotifyEvent (\r
240 IN EFI_EVENT Event,\r
241 IN VOID *Context\r
242 )\r
243{\r
244 UINTN Index;\r
245 if (mFvbEntry != NULL) {\r
246 for (Index = 0; Index < MAX_FVB_COUNT; Index++) {\r
247 if (!mFvbEntry[Index].IsRuntimeAccess) {\r
248 continue;\r
249 }\r
250\r
251 if (NULL != mFvbEntry[Index].Fvb) {\r
252 EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetBlockSize);\r
253 EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetPhysicalAddress);\r
254 EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->GetAttributes);\r
255 EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->SetAttributes);\r
256 EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Read);\r
257 EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->Write);\r
258 EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb->EraseBlocks);\r
259 EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].Fvb);\r
260 }\r
261\r
262 if (NULL != mFvbEntry[Index].FvbExtension) {\r
263 EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].FvbExtension->EraseFvbCustomBlock);\r
264 EfiConvertPointer (0x0, (VOID **) &mFvbEntry[Index].FvbExtension);\r
265 }\r
266 }\r
267\r
268 EfiConvertPointer (0x0, (VOID **) &mFvbEntry);\r
269 }\r
270}\r
271\r
272/**\r
273 Library constructor function entry.\r
274\r
275 @param ImageHandle The handle of image who call this libary.\r
276 @param SystemTable The point of System Table.\r
277\r
278 @retval EFI_SUCESS Sucess construct this library.\r
279 @retval Others Fail to contruct this libary.\r
280**/\r
281EFI_STATUS\r
282EFIAPI\r
283FvbLibInitialize (\r
284 IN EFI_HANDLE ImageHandle,\r
285 IN EFI_SYSTEM_TABLE *SystemTable\r
286 )\r
287{\r
288 UINTN Status;\r
289 mFvbCount = 0;\r
290\r
291 Status = gBS->AllocatePool (\r
292 EfiRuntimeServicesData,\r
293 (UINTN) sizeof (FVB_ENTRY) * MAX_FVB_COUNT,\r
294 (VOID *) &mFvbEntry\r
295 );\r
296\r
297 if (EFI_ERROR (Status)) {\r
298 return Status;\r
299 }\r
300\r
301 ZeroMem (mFvbEntry, sizeof (FVB_ENTRY) * MAX_FVB_COUNT);\r
302\r
303 EfiCreateProtocolNotifyEvent (\r
304 &gEfiFirmwareVolumeBlockProtocolGuid,\r
305 TPL_CALLBACK,\r
306 FvbNotificationEvent,\r
307 NULL,\r
308 &mFvbRegistration\r
309 );\r
310\r
311 //\r
312 // Register SetVirtualAddressMap () notify function\r
313 //\r
314 Status = gBS->CreateEvent (\r
85363c1e 315 EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
a190687a 316 TPL_NOTIFY,\r
317 FvbVirtualAddressChangeNotifyEvent,\r
318 NULL,\r
85363c1e 319 &mSetVirtualMapChangedEvent\r
a190687a 320 );\r
321 ASSERT_EFI_ERROR (Status);\r
322\r
a190687a 323 return EFI_SUCCESS;\r
324}\r
325\r
326//\r
327// =============================================================================\r
328// The following functions wrap Fvb protocol in the Runtime Lib functions.\r
329// The Instance translates into Fvb instance. The Fvb order defined by HOBs and\r
330// thus the sequence of FVB protocol addition define Instance.\r
331//\r
332// EfiFvbInitialize () must be called before any of the following functions\r
333// must be called.\r
334// =============================================================================\r
335//\r
336\r
337/**\r
338 Reads specified number of bytes into a buffer from the specified block\r
339\r
340 @param Instance The FV instance to be read from.\r
341 @param Lba The logical block address to be read from\r
342 @param Offset Offset into the block at which to begin reading\r
343 @param NumBytes Pointer that on input contains the total size of\r
344 the buffer. On output, it contains the total number\r
345 of bytes read\r
346 @param Buffer Pointer to a caller allocated buffer that will be\r
347 used to hold the data read\r
348\r
349 @retval EFI_INVALID_PARAMETER Invalid parameter\r
350 @retval EFI_SUCESS Sucess to Read block\r
351 @retval Others Fail to read block\r
352**/\r
353EFI_STATUS\r
354EfiFvbReadBlock (\r
355 IN UINTN Instance,\r
356 IN EFI_LBA Lba,\r
357 IN UINTN Offset,\r
358 IN OUT UINTN *NumBytes,\r
2ae8963c 359 OUT UINT8 *Buffer\r
a190687a 360 )\r
361{\r
2ae8963c
LG
362 ASSERT (NumBytes != NULL);\r
363 ASSERT (Buffer != NULL);\r
364 \r
a190687a 365 if (Instance >= mFvbCount) {\r
366 return EFI_INVALID_PARAMETER;\r
367 }\r
368\r
369 if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {\r
370 return EFI_INVALID_PARAMETER;\r
371 }\r
372\r
373 return mFvbEntry[Instance].Fvb->Read (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);\r
374}\r
375\r
376/**\r
377 Writes specified number of bytes from the input buffer to the block\r
378\r
379 @param Instance The FV instance to be written to\r
380 @param Lba The starting logical block index to write to\r
381 @param Offset Offset into the block at which to begin writing\r
382 @param NumBytes Pointer that on input contains the total size of\r
383 the buffer. On output, it contains the total number\r
384 of bytes actually written\r
385 @param Buffer Pointer to a caller allocated buffer that contains\r
386 the source for the write\r
387\r
388 @retval EFI_INVALID_PARAMETER Invalid parameter\r
389 @retval EFI_SUCESS Sucess to write block\r
390 @retval Others Fail to write block\r
391**/\r
392EFI_STATUS\r
393EfiFvbWriteBlock (\r
394 IN UINTN Instance,\r
395 IN EFI_LBA Lba,\r
396 IN UINTN Offset,\r
397 IN OUT UINTN *NumBytes,\r
398 IN UINT8 *Buffer\r
399 )\r
400{\r
2ae8963c
LG
401 ASSERT (NumBytes != NULL);\r
402 \r
a190687a 403 if (Instance >= mFvbCount) {\r
404 return EFI_INVALID_PARAMETER;\r
405 }\r
406\r
407 if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {\r
408 return EFI_INVALID_PARAMETER;\r
409 }\r
410\r
411 return mFvbEntry[Instance].Fvb->Write (mFvbEntry[Instance].Fvb, Lba, Offset, NumBytes, Buffer);\r
412}\r
413\r
414/**\r
415 Erases and initializes a firmware volume block\r
416\r
417 @param Instance The FV instance to be erased\r
418 @param Lba The logical block index to be erased\r
419\r
420 @retval EFI_INVALID_PARAMETER Invalid parameter\r
421 @retval EFI_SUCESS Sucess to erase block\r
422 @retval Others Fail to erase block\r
423**/\r
424EFI_STATUS\r
425EfiFvbEraseBlock (\r
426 IN UINTN Instance,\r
427 IN EFI_LBA Lba\r
428 )\r
429{\r
430 if (Instance >= mFvbCount) {\r
431 return EFI_INVALID_PARAMETER;\r
432 }\r
433\r
434 if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {\r
435 return EFI_INVALID_PARAMETER;\r
436 }\r
437\r
e2591cb2 438 return mFvbEntry[Instance].Fvb->EraseBlocks (mFvbEntry[Instance].Fvb, Lba, 1, EFI_LBA_LIST_TERMINATOR);\r
a190687a 439}\r
440\r
441/**\r
442 Retrieves attributes, insures positive polarity of attribute bits, returns\r
443 resulting attributes in output parameter\r
444\r
445 @param Instance The FV instance whose attributes is going to be returned\r
446 @param Attributes Output buffer which contains attributes\r
447\r
448 @retval EFI_INVALID_PARAMETER Invalid parameter\r
449 @retval EFI_SUCESS Sucess to get Fv attribute\r
450 @retval Others Fail to get Fv attribute\r
451**/\r
452EFI_STATUS\r
453EfiFvbGetVolumeAttributes (\r
454 IN UINTN Instance,\r
455 OUT EFI_FVB_ATTRIBUTES *Attributes\r
456 )\r
457{\r
2ae8963c
LG
458 ASSERT (Attributes != NULL);\r
459 \r
a190687a 460 if (Instance >= mFvbCount) {\r
461 return EFI_INVALID_PARAMETER;\r
462 }\r
463\r
464 if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {\r
465 return EFI_INVALID_PARAMETER;\r
466 }\r
467\r
468 return mFvbEntry[Instance].Fvb->GetAttributes (mFvbEntry[Instance].Fvb, Attributes);\r
469}\r
470\r
471/**\r
472 Modifies the current settings of the firmware volume according to the\r
473 input parameter, and returns the new setting of the volume\r
474\r
475 @param Instance The FV instance whose attributes is going to be\r
476 modified\r
477 @param Attributes On input, it is a pointer to EFI_FVB_ATTRIBUTES\r
478 containing the desired firmware volume settings.\r
479 On successful return, it contains the new settings\r
480 of the firmware volume\r
481\r
482 @retval EFI_INVALID_PARAMETER Invalid parameter\r
483 @retval EFI_SUCESS Sucess to set Fv attribute\r
484 @retval Others Fail to set Fv attribute\r
485**/\r
486EFI_STATUS\r
487EfiFvbSetVolumeAttributes (\r
d3a58e2d 488 IN UINTN Instance,\r
489 IN OUT EFI_FVB_ATTRIBUTES *Attributes\r
a190687a 490 )\r
491{\r
2ae8963c
LG
492 ASSERT (Attributes != NULL);\r
493 \r
a190687a 494 if (Instance >= mFvbCount) {\r
495 return EFI_INVALID_PARAMETER;\r
496 }\r
497\r
498 if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {\r
499 return EFI_INVALID_PARAMETER;\r
500 }\r
501\r
d3a58e2d 502 return mFvbEntry[Instance].Fvb->SetAttributes (mFvbEntry[Instance].Fvb, Attributes);\r
a190687a 503}\r
504\r
505/**\r
506 Retrieves the physical address of a memory mapped FV\r
507\r
508 @param Instance The FV instance whose base address is going to be\r
509 returned\r
510 @param BaseAddress Pointer to a caller allocated EFI_PHYSICAL_ADDRESS\r
511 that on successful return, contains the base address\r
512 of the firmware volume.\r
513\r
514 @retval EFI_INVALID_PARAMETER Invalid parameter\r
515 @retval EFI_SUCESS Sucess to get physical address\r
516 @retval Others Fail to get physical address\r
517**/\r
518EFI_STATUS\r
519EfiFvbGetPhysicalAddress (\r
520 IN UINTN Instance,\r
521 OUT EFI_PHYSICAL_ADDRESS *BaseAddress\r
522 )\r
523{\r
2ae8963c
LG
524 ASSERT (BaseAddress != NULL);\r
525 \r
a190687a 526 if (Instance >= mFvbCount) {\r
527 return EFI_INVALID_PARAMETER;\r
528 }\r
529\r
530 if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {\r
531 return EFI_INVALID_PARAMETER;\r
532 }\r
533\r
534 return mFvbEntry[Instance].Fvb->GetPhysicalAddress (mFvbEntry[Instance].Fvb, BaseAddress);\r
535}\r
536\r
537/**\r
538 Retrieve the size of a logical block\r
539\r
540 @param Instance The FV instance whose block size is going to be\r
541 returned\r
542 @param Lba Indicates which block to return the size for.\r
543 @param BlockSize A pointer to a caller allocated UINTN in which\r
544 the size of the block is returned\r
545 @param NumOfBlocks a pointer to a caller allocated UINTN in which the\r
546 number of consecutive blocks starting with Lba is\r
547 returned. All blocks in this range have a size of\r
548 BlockSize\r
549\r
550 @retval EFI_INVALID_PARAMETER Invalid parameter\r
551 @retval EFI_SUCESS Sucess to get block size\r
552 @retval Others Fail to get block size\r
553**/\r
554EFI_STATUS\r
555EfiFvbGetBlockSize (\r
556 IN UINTN Instance,\r
557 IN EFI_LBA Lba,\r
558 OUT UINTN *BlockSize,\r
559 OUT UINTN *NumOfBlocks\r
560 )\r
561{\r
2ae8963c
LG
562 ASSERT (BlockSize != NULL);\r
563 ASSERT (NumOfBlocks != NULL);\r
564 \r
a190687a 565 if (Instance >= mFvbCount) {\r
566 return EFI_INVALID_PARAMETER;\r
567 }\r
568\r
569 if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {\r
570 return EFI_INVALID_PARAMETER;\r
571 }\r
572\r
573 return mFvbEntry[Instance].Fvb->GetBlockSize (mFvbEntry[Instance].Fvb, Lba, BlockSize, NumOfBlocks);\r
574}\r
575\r
576/**\r
577 Erases and initializes a specified range of a firmware volume\r
578\r
579 @param Instance The FV instance to be erased\r
580 @param StartLba The starting logical block index to be erased\r
581 @param OffsetStartLba Offset into the starting block at which to\r
582 begin erasing\r
583 @param LastLba The last logical block index to be erased\r
584 @param OffsetLastLba Offset into the last block at which to end erasing\r
585\r
586 @retval EFI_INVALID_PARAMETER Invalid parameter\r
587 @retval EFI_SUCESS Sucess to erase custom block range\r
588 @retval Others Fail to erase custom block range\r
589**/\r
590EFI_STATUS\r
591EfiFvbEraseCustomBlockRange (\r
592 IN UINTN Instance,\r
593 IN EFI_LBA StartLba,\r
594 IN UINTN OffsetStartLba,\r
595 IN EFI_LBA LastLba,\r
596 IN UINTN OffsetLastLba\r
597 )\r
598{\r
599 if (Instance >= mFvbCount) {\r
600 return EFI_INVALID_PARAMETER;\r
601 }\r
602\r
603 if (EfiAtRuntime() && !mFvbEntry[Instance].IsRuntimeAccess) {\r
604 return EFI_INVALID_PARAMETER;\r
605 }\r
606\r
607 if (!(mFvbEntry[Instance].FvbExtension)) {\r
608 return EFI_UNSUPPORTED;\r
609 }\r
610\r
611 if (!(mFvbEntry[Instance].FvbExtension->EraseFvbCustomBlock)) {\r
612 return EFI_UNSUPPORTED;\r
613 }\r
614\r
615 return mFvbEntry[Instance].FvbExtension->EraseFvbCustomBlock (\r
616 mFvbEntry[Instance].FvbExtension,\r
617 StartLba,\r
618 OffsetStartLba,\r
619 LastLba,\r
620 OffsetLastLba\r
621 );\r
622}\r