]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Dxe/FwVol/FwVol.c
MdeModulePkg DxeCore: Don't cache memory mapped IO FV.
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / FwVol / FwVol.c
1 /** @file
2 Firmware File System driver that produce Firmware Volume protocol.
3 Layers on top of Firmware Block protocol to produce a file abstraction
4 of FV based files.
5
6 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 **/
16
17 #include "DxeMain.h"
18 #include "FwVolDriver.h"
19
20
21 //
22 // Protocol notify related globals
23 //
24 VOID *gEfiFwVolBlockNotifyReg;
25 EFI_EVENT gEfiFwVolBlockEvent;
26
27 FV_DEVICE mFvDevice = {
28 FV2_DEVICE_SIGNATURE,
29 NULL,
30 NULL,
31 {
32 FvGetVolumeAttributes,
33 FvSetVolumeAttributes,
34 FvReadFile,
35 FvReadFileSection,
36 FvWriteFile,
37 FvGetNextFile,
38 sizeof (UINTN),
39 NULL,
40 FvGetVolumeInfo,
41 FvSetVolumeInfo
42 },
43 NULL,
44 NULL,
45 NULL,
46 NULL,
47 { NULL, NULL },
48 0,
49 0,
50 FALSE,
51 FALSE
52 };
53
54
55 //
56 // FFS helper functions
57 //
58 /**
59 Read data from Firmware Block by FVB protocol Read.
60 The data may cross the multi block ranges.
61
62 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.
63 @param StartLba Pointer to StartLba.
64 On input, the start logical block index from which to read.
65 On output,the end logical block index after reading.
66 @param Offset Pointer to Offset
67 On input, offset into the block at which to begin reading.
68 On output, offset into the end block after reading.
69 @param DataSize Size of data to be read.
70 @param Data Pointer to Buffer that the data will be read into.
71
72 @retval EFI_SUCCESS Successfully read data from firmware block.
73 @retval others
74 **/
75 EFI_STATUS
76 ReadFvbData (
77 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,
78 IN OUT EFI_LBA *StartLba,
79 IN OUT UINTN *Offset,
80 IN UINTN DataSize,
81 OUT UINT8 *Data
82 )
83 {
84 UINTN BlockSize;
85 UINTN NumberOfBlocks;
86 UINTN BlockIndex;
87 UINTN ReadDataSize;
88 EFI_STATUS Status;
89
90 //
91 // Try read data in current block
92 //
93 BlockIndex = 0;
94 ReadDataSize = DataSize;
95 Status = Fvb->Read (Fvb, *StartLba, *Offset, &ReadDataSize, Data);
96 if (Status == EFI_SUCCESS) {
97 *Offset += DataSize;
98 return EFI_SUCCESS;
99 } else if (Status != EFI_BAD_BUFFER_SIZE) {
100 //
101 // other error will direct return
102 //
103 return Status;
104 }
105
106 //
107 // Data crosses the blocks, read data from next block
108 //
109 DataSize -= ReadDataSize;
110 Data += ReadDataSize;
111 *StartLba = *StartLba + 1;
112 while (DataSize > 0) {
113 Status = Fvb->GetBlockSize (Fvb, *StartLba, &BlockSize, &NumberOfBlocks);
114 if (EFI_ERROR (Status)) {
115 return Status;
116 }
117
118 //
119 // Read data from the crossing blocks
120 //
121 BlockIndex = 0;
122 while (BlockIndex < NumberOfBlocks && DataSize >= BlockSize) {
123 Status = Fvb->Read (Fvb, *StartLba + BlockIndex, 0, &BlockSize, Data);
124 if (EFI_ERROR (Status)) {
125 return Status;
126 }
127 Data += BlockSize;
128 DataSize -= BlockSize;
129 BlockIndex ++;
130 }
131
132 //
133 // Data doesn't exceed the current block range.
134 //
135 if (DataSize < BlockSize) {
136 break;
137 }
138
139 //
140 // Data must be got from the next block range.
141 //
142 *StartLba += NumberOfBlocks;
143 }
144
145 //
146 // read the remaining data
147 //
148 if (DataSize > 0) {
149 Status = Fvb->Read (Fvb, *StartLba + BlockIndex, 0, &DataSize, Data);
150 if (EFI_ERROR (Status)) {
151 return Status;
152 }
153 }
154
155 //
156 // Update Lba and Offset used by the following read.
157 //
158 *StartLba += BlockIndex;
159 *Offset = DataSize;
160
161 return EFI_SUCCESS;
162 }
163
164 /**
165 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
166 copy the real length volume header into it.
167
168 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
169 read the volume header
170 @param FwVolHeader Pointer to pointer to allocated buffer in which
171 the volume header is returned.
172
173 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
174 @retval EFI_SUCCESS Successfully read volume header to the allocated
175 buffer.
176
177 **/
178 EFI_STATUS
179 GetFwVolHeader (
180 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,
181 OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
182 )
183 {
184 EFI_STATUS Status;
185 EFI_FIRMWARE_VOLUME_HEADER TempFvh;
186 UINTN FvhLength;
187 EFI_LBA StartLba;
188 UINTN Offset;
189 UINT8 *Buffer;
190
191 //
192 // Read the standard FV header
193 //
194 StartLba = 0;
195 Offset = 0;
196 FvhLength = sizeof (EFI_FIRMWARE_VOLUME_HEADER);
197 Status = ReadFvbData (Fvb, &StartLba, &Offset, FvhLength, (UINT8 *)&TempFvh);
198 if (EFI_ERROR (Status)) {
199 return Status;
200 }
201
202 //
203 // Allocate a buffer for the caller
204 //
205 *FwVolHeader = AllocatePool (TempFvh.HeaderLength);
206 if (*FwVolHeader == NULL) {
207 return EFI_OUT_OF_RESOURCES;
208 }
209
210 //
211 // Copy the standard header into the buffer
212 //
213 CopyMem (*FwVolHeader, &TempFvh, sizeof (EFI_FIRMWARE_VOLUME_HEADER));
214
215 //
216 // Read the rest of the header
217 //
218 FvhLength = TempFvh.HeaderLength - sizeof (EFI_FIRMWARE_VOLUME_HEADER);
219 Buffer = (UINT8 *)*FwVolHeader + sizeof (EFI_FIRMWARE_VOLUME_HEADER);
220 Status = ReadFvbData (Fvb, &StartLba, &Offset, FvhLength, Buffer);
221 if (EFI_ERROR (Status)) {
222 //
223 // Read failed so free buffer
224 //
225 CoreFreePool (*FwVolHeader);
226 }
227
228 return Status;
229 }
230
231
232
233 /**
234 Free FvDevice resource when error happens
235
236 @param FvDevice pointer to the FvDevice to be freed.
237
238 **/
239 VOID
240 FreeFvDeviceResource (
241 IN FV_DEVICE *FvDevice
242 )
243 {
244 FFS_FILE_LIST_ENTRY *FfsFileEntry;
245 LIST_ENTRY *NextEntry;
246
247 //
248 // Free File List Entry
249 //
250 FfsFileEntry = (FFS_FILE_LIST_ENTRY *)FvDevice->FfsFileListHeader.ForwardLink;
251 while (&FfsFileEntry->Link != &FvDevice->FfsFileListHeader) {
252 NextEntry = (&FfsFileEntry->Link)->ForwardLink;
253
254 if (FfsFileEntry->StreamHandle != 0) {
255 //
256 // Close stream and free resources from SEP
257 //
258 CloseSectionStream (FfsFileEntry->StreamHandle, FALSE);
259 }
260
261 if (FfsFileEntry->FileCached) {
262 //
263 // Free the cached file buffer.
264 //
265 CoreFreePool (FfsFileEntry->FfsHeader);
266 }
267
268 CoreFreePool (FfsFileEntry);
269
270 FfsFileEntry = (FFS_FILE_LIST_ENTRY *) NextEntry;
271 }
272
273 if (!FvDevice->IsMemoryMapped) {
274 //
275 // Free the cached FV buffer.
276 //
277 CoreFreePool (FvDevice->CachedFv);
278 }
279
280 //
281 // Free Volume Header
282 //
283 CoreFreePool (FvDevice->FwVolHeader);
284
285 return;
286 }
287
288
289
290 /**
291 Check if an FV is consistent and allocate cache for it.
292
293 @param FvDevice A pointer to the FvDevice to be checked.
294
295 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
296 @retval EFI_SUCCESS FV is consistent and cache is allocated.
297 @retval EFI_VOLUME_CORRUPTED File system is corrupted.
298
299 **/
300 EFI_STATUS
301 FvCheck (
302 IN OUT FV_DEVICE *FvDevice
303 )
304 {
305 EFI_STATUS Status;
306 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
307 EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
308 EFI_FIRMWARE_VOLUME_EXT_HEADER *FwVolExtHeader;
309 EFI_FVB_ATTRIBUTES_2 FvbAttributes;
310 EFI_FV_BLOCK_MAP_ENTRY *BlockMap;
311 FFS_FILE_LIST_ENTRY *FfsFileEntry;
312 EFI_FFS_FILE_HEADER *FfsHeader;
313 UINT8 *CacheLocation;
314 UINTN LbaOffset;
315 UINTN HeaderSize;
316 UINTN Index;
317 EFI_LBA LbaIndex;
318 UINTN Size;
319 EFI_FFS_FILE_STATE FileState;
320 UINT8 *TopFvAddress;
321 UINTN TestLength;
322 EFI_PHYSICAL_ADDRESS PhysicalAddress;
323
324 Fvb = FvDevice->Fvb;
325 FwVolHeader = FvDevice->FwVolHeader;
326
327 Status = Fvb->GetAttributes (Fvb, &FvbAttributes);
328 if (EFI_ERROR (Status)) {
329 return Status;
330 }
331
332 //
333 // Size is the size of the FV minus the head. We have already allocated
334 // the header to check to make sure the volume is valid
335 //
336 Size = (UINTN)(FwVolHeader->FvLength - FwVolHeader->HeaderLength);
337 if ((FvbAttributes & EFI_FVB2_MEMORY_MAPPED) != 0) {
338 FvDevice->IsMemoryMapped = TRUE;
339
340 Status = Fvb->GetPhysicalAddress (Fvb, &PhysicalAddress);
341 if (EFI_ERROR (Status)) {
342 return Status;
343 }
344
345 //
346 // Don't cache memory mapped FV really.
347 //
348 FvDevice->CachedFv = (UINT8 *) (UINTN) (PhysicalAddress + FwVolHeader->HeaderLength);
349 } else {
350 FvDevice->IsMemoryMapped = FALSE;
351 FvDevice->CachedFv = AllocatePool (Size);
352
353 if (FvDevice->CachedFv == NULL) {
354 return EFI_OUT_OF_RESOURCES;
355 }
356 }
357
358 //
359 // Remember a pointer to the end fo the CachedFv
360 //
361 FvDevice->EndOfCachedFv = FvDevice->CachedFv + Size;
362
363 if (!FvDevice->IsMemoryMapped) {
364 //
365 // Copy FV minus header into memory using the block map we have all ready
366 // read into memory.
367 //
368 BlockMap = FwVolHeader->BlockMap;
369 CacheLocation = FvDevice->CachedFv;
370 LbaIndex = 0;
371 LbaOffset = 0;
372 HeaderSize = FwVolHeader->HeaderLength;
373 while ((BlockMap->NumBlocks != 0) || (BlockMap->Length != 0)) {
374 Index = 0;
375 Size = BlockMap->Length;
376 if (HeaderSize > 0) {
377 //
378 // Skip header size
379 //
380 for (; Index < BlockMap->NumBlocks && HeaderSize >= BlockMap->Length; Index ++) {
381 HeaderSize -= BlockMap->Length;
382 LbaIndex ++;
383 }
384
385 //
386 // Check whether FvHeader is crossing the multi block range.
387 //
388 if (Index >= BlockMap->NumBlocks) {
389 BlockMap++;
390 continue;
391 } else if (HeaderSize > 0) {
392 LbaOffset = HeaderSize;
393 Size = BlockMap->Length - HeaderSize;
394 HeaderSize = 0;
395 }
396 }
397
398 //
399 // read the FV data
400 //
401 for (; Index < BlockMap->NumBlocks; Index ++) {
402 Status = Fvb->Read (Fvb,
403 LbaIndex,
404 LbaOffset,
405 &Size,
406 CacheLocation
407 );
408
409 //
410 // Not check EFI_BAD_BUFFER_SIZE, for Size = BlockMap->Length
411 //
412 if (EFI_ERROR (Status)) {
413 goto Done;
414 }
415
416 LbaIndex++;
417 CacheLocation += Size;
418
419 //
420 // After we skip Fv Header always read from start of block
421 //
422 LbaOffset = 0;
423 Size = BlockMap->Length;
424 }
425
426 BlockMap++;
427 }
428 }
429
430 //
431 // Scan to check the free space & File list
432 //
433 if ((FvbAttributes & EFI_FVB2_ERASE_POLARITY) != 0) {
434 FvDevice->ErasePolarity = 1;
435 } else {
436 FvDevice->ErasePolarity = 0;
437 }
438
439
440 //
441 // go through the whole FV cache, check the consistence of the FV.
442 // Make a linked list of all the Ffs file headers
443 //
444 Status = EFI_SUCCESS;
445 InitializeListHead (&FvDevice->FfsFileListHeader);
446
447 //
448 // Build FFS list
449 //
450 if (FwVolHeader->ExtHeaderOffset != 0) {
451 //
452 // Searching for files starts on an 8 byte aligned boundary after the end of the Extended Header if it exists.
453 //
454 FwVolExtHeader = (EFI_FIRMWARE_VOLUME_EXT_HEADER *) (FvDevice->CachedFv + (FwVolHeader->ExtHeaderOffset - FwVolHeader->HeaderLength));
455 FfsHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FwVolExtHeader + FwVolExtHeader->ExtHeaderSize);
456 FfsHeader = (EFI_FFS_FILE_HEADER *) ALIGN_POINTER (FfsHeader, 8);
457 } else {
458 FfsHeader = (EFI_FFS_FILE_HEADER *) (FvDevice->CachedFv);
459 }
460 TopFvAddress = FvDevice->EndOfCachedFv;
461 while ((UINT8 *) FfsHeader < TopFvAddress) {
462
463 TestLength = TopFvAddress - ((UINT8 *) FfsHeader);
464 if (TestLength > sizeof (EFI_FFS_FILE_HEADER)) {
465 TestLength = sizeof (EFI_FFS_FILE_HEADER);
466 }
467
468 if (IsBufferErased (FvDevice->ErasePolarity, FfsHeader, TestLength)) {
469 //
470 // We have found the free space so we are done!
471 //
472 goto Done;
473 }
474
475 if (!IsValidFfsHeader (FvDevice->ErasePolarity, FfsHeader, &FileState)) {
476 if ((FileState == EFI_FILE_HEADER_INVALID) ||
477 (FileState == EFI_FILE_HEADER_CONSTRUCTION)) {
478 if (IS_FFS_FILE2 (FfsHeader)) {
479 if (!FvDevice->IsFfs3Fv) {
480 DEBUG ((EFI_D_ERROR, "Found a FFS3 formatted file: %g in a non-FFS3 formatted FV.\n", &FfsHeader->Name));
481 }
482 FfsHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsHeader + sizeof (EFI_FFS_FILE_HEADER2));
483 } else {
484 FfsHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsHeader + sizeof (EFI_FFS_FILE_HEADER));
485 }
486 continue;
487 } else {
488 //
489 // File system is corrputed
490 //
491 Status = EFI_VOLUME_CORRUPTED;
492 goto Done;
493 }
494 }
495
496 if (!IsValidFfsFile (FvDevice->ErasePolarity, FfsHeader)) {
497 //
498 // File system is corrupted
499 //
500 Status = EFI_VOLUME_CORRUPTED;
501 goto Done;
502 }
503
504 if (IS_FFS_FILE2 (FfsHeader)) {
505 ASSERT (FFS_FILE2_SIZE (FfsHeader) > 0x00FFFFFF);
506 if (!FvDevice->IsFfs3Fv) {
507 DEBUG ((EFI_D_ERROR, "Found a FFS3 formatted file: %g in a non-FFS3 formatted FV.\n", &FfsHeader->Name));
508 FfsHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsHeader + FFS_FILE2_SIZE (FfsHeader));
509 //
510 // Adjust pointer to the next 8-byte aligned boundry.
511 //
512 FfsHeader = (EFI_FFS_FILE_HEADER *) (((UINTN) FfsHeader + 7) & ~0x07);
513 continue;
514 }
515 }
516
517 FileState = GetFileState (FvDevice->ErasePolarity, FfsHeader);
518
519 //
520 // check for non-deleted file
521 //
522 if (FileState != EFI_FILE_DELETED) {
523 //
524 // Create a FFS list entry for each non-deleted file
525 //
526 FfsFileEntry = AllocateZeroPool (sizeof (FFS_FILE_LIST_ENTRY));
527 if (FfsFileEntry == NULL) {
528 Status = EFI_OUT_OF_RESOURCES;
529 goto Done;
530 }
531
532 FfsFileEntry->FfsHeader = FfsHeader;
533 InsertTailList (&FvDevice->FfsFileListHeader, &FfsFileEntry->Link);
534 }
535
536 if (IS_FFS_FILE2 (FfsHeader)) {
537 FfsHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsHeader + FFS_FILE2_SIZE (FfsHeader));
538 } else {
539 FfsHeader = (EFI_FFS_FILE_HEADER *) ((UINT8 *) FfsHeader + FFS_FILE_SIZE (FfsHeader));
540 }
541
542 //
543 // Adjust pointer to the next 8-byte aligned boundry.
544 //
545 FfsHeader = (EFI_FFS_FILE_HEADER *)(((UINTN)FfsHeader + 7) & ~0x07);
546
547 }
548
549 Done:
550 if (EFI_ERROR (Status)) {
551 FreeFvDeviceResource (FvDevice);
552 }
553
554 return Status;
555 }
556
557
558
559 /**
560 This notification function is invoked when an instance of the
561 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL is produced. It layers an instance of the
562 EFI_FIRMWARE_VOLUME2_PROTOCOL on the same handle. This is the function where
563 the actual initialization of the EFI_FIRMWARE_VOLUME2_PROTOCOL is done.
564
565 @param Event The event that occured
566 @param Context For EFI compatiblity. Not used.
567
568 **/
569 VOID
570 EFIAPI
571 NotifyFwVolBlock (
572 IN EFI_EVENT Event,
573 IN VOID *Context
574 )
575 {
576 EFI_HANDLE Handle;
577 EFI_STATUS Status;
578 UINTN BufferSize;
579 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb;
580 EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
581 FV_DEVICE *FvDevice;
582 EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
583 //
584 // Examine all new handles
585 //
586 for (;;) {
587 //
588 // Get the next handle
589 //
590 BufferSize = sizeof (Handle);
591 Status = CoreLocateHandle (
592 ByRegisterNotify,
593 NULL,
594 gEfiFwVolBlockNotifyReg,
595 &BufferSize,
596 &Handle
597 );
598
599 //
600 // If not found, we're done
601 //
602 if (EFI_NOT_FOUND == Status) {
603 break;
604 }
605
606 if (EFI_ERROR (Status)) {
607 continue;
608 }
609
610 //
611 // Get the FirmwareVolumeBlock protocol on that handle
612 //
613 Status = CoreHandleProtocol (Handle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **)&Fvb);
614 ASSERT_EFI_ERROR (Status);
615 ASSERT (Fvb != NULL);
616
617 //
618 // Make sure the Fv Header is O.K.
619 //
620 Status = GetFwVolHeader (Fvb, &FwVolHeader);
621 if (EFI_ERROR (Status)) {
622 return;
623 }
624 ASSERT (FwVolHeader != NULL);
625
626 if (!VerifyFvHeaderChecksum (FwVolHeader)) {
627 CoreFreePool (FwVolHeader);
628 continue;
629 }
630
631
632 //
633 // Check to see that the file system is indeed formatted in a way we can
634 // understand it...
635 //
636 if ((!CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiFirmwareFileSystem2Guid)) &&
637 (!CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiFirmwareFileSystem3Guid))) {
638 continue;
639 }
640
641 //
642 // Check if there is an FV protocol already installed in that handle
643 //
644 Status = CoreHandleProtocol (Handle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);
645 if (!EFI_ERROR (Status)) {
646 //
647 // Update Fv to use a new Fvb
648 //
649 FvDevice = BASE_CR (Fv, FV_DEVICE, Fv);
650 if (FvDevice->Signature == FV2_DEVICE_SIGNATURE) {
651 //
652 // Only write into our device structure if it's our device structure
653 //
654 FvDevice->Fvb = Fvb;
655 }
656
657 } else {
658 //
659 // No FwVol protocol on the handle so create a new one
660 //
661 FvDevice = AllocateCopyPool (sizeof (FV_DEVICE), &mFvDevice);
662 if (FvDevice == NULL) {
663 return;
664 }
665
666 FvDevice->Fvb = Fvb;
667 FvDevice->Handle = Handle;
668 FvDevice->FwVolHeader = FwVolHeader;
669 FvDevice->IsFfs3Fv = CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiFirmwareFileSystem3Guid);
670 FvDevice->Fv.ParentHandle = Fvb->ParentHandle;
671
672 if (Fvb->ParentHandle != NULL) {
673 //
674 // Inherit the authentication status from FVB.
675 //
676 FvDevice->AuthenticationStatus = GetFvbAuthenticationStatus (Fvb);
677 }
678
679 if (!EFI_ERROR (FvCheck (FvDevice))) {
680 //
681 // Install an New FV protocol on the existing handle
682 //
683 Status = CoreInstallProtocolInterface (
684 &Handle,
685 &gEfiFirmwareVolume2ProtocolGuid,
686 EFI_NATIVE_INTERFACE,
687 &FvDevice->Fv
688 );
689 ASSERT_EFI_ERROR (Status);
690 } else {
691 //
692 // Free FvDevice Buffer for the corrupt FV image.
693 //
694 CoreFreePool (FvDevice);
695 }
696 }
697 }
698
699 return;
700 }
701
702
703
704 /**
705 This routine is the driver initialization entry point. It registers
706 a notification function. This notification function are responsible
707 for building the FV stack dynamically.
708
709 @param ImageHandle The image handle.
710 @param SystemTable The system table.
711
712 @retval EFI_SUCCESS Function successfully returned.
713
714 **/
715 EFI_STATUS
716 EFIAPI
717 FwVolDriverInit (
718 IN EFI_HANDLE ImageHandle,
719 IN EFI_SYSTEM_TABLE *SystemTable
720 )
721 {
722 gEfiFwVolBlockEvent = EfiCreateProtocolNotifyEvent (
723 &gEfiFirmwareVolumeBlockProtocolGuid,
724 TPL_CALLBACK,
725 NotifyFwVolBlock,
726 NULL,
727 &gEfiFwVolBlockNotifyReg
728 );
729 return EFI_SUCCESS;
730 }
731
732