2 Defines data structure that is the volume header found.These data is intent
3 to decouple FVB driver with FV header.
5 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
6 Portions copyright (c) 2011, Apple Inc. All rights reserved.
7 SPDX-License-Identifier: BSD-2-Clause-Patent
14 #include <Guid/EventGroup.h>
15 #include <Guid/FirmwareFileSystem2.h>
16 #include <Guid/SystemNvDataGuid.h>
18 #include <Protocol/FirmwareVolumeBlock.h>
19 #include <Protocol/DevicePath.h>
21 #include <Library/UefiLib.h>
22 #include <Library/UefiDriverEntryPoint.h>
23 #include <Library/BaseLib.h>
24 #include <Library/DxeServicesTableLib.h>
25 #include <Library/UefiRuntimeLib.h>
26 #include <Library/DebugLib.h>
27 #include <Library/HobLib.h>
28 #include <Library/BaseMemoryLib.h>
29 #include <Library/MemoryAllocationLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
31 #include <Library/PcdLib.h>
32 #include <Library/DevicePathLib.h>
36 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
38 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
40 EFI_FV_BLOCK_MAP_ENTRY End
[1];
43 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
48 FixedPcdGet32 (PcdEmuFlashFvRecoverySize
),
53 EFI_FIRMWARE_FILE_SYSTEM2_GUID
,
54 FixedPcdGet32 (PcdEmuFlashFvRecoverySize
),
56 EFI_FVB2_READ_ENABLED_CAP
|
57 EFI_FVB2_READ_STATUS
|
58 EFI_FVB2_WRITE_ENABLED_CAP
|
59 EFI_FVB2_WRITE_STATUS
|
60 EFI_FVB2_ERASE_POLARITY
,
61 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
70 FixedPcdGet32 (PcdEmuFlashFvRecoverySize
)/FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
71 FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
83 // Systen NvStorage FVB
86 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
87 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
88 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
89 FixedPcdGet32 (PcdEmuFlashNvStorageEventLogSize
),
94 EFI_SYSTEM_NV_DATA_FV_GUID
,
95 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
96 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
97 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
98 FixedPcdGet32 (PcdEmuFlashNvStorageEventLogSize
),
100 EFI_FVB2_READ_ENABLED_CAP
|
101 EFI_FVB2_READ_STATUS
|
102 EFI_FVB2_WRITE_ENABLED_CAP
|
103 EFI_FVB2_WRITE_STATUS
|
104 EFI_FVB2_ERASE_POLARITY
,
105 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
107 0, // ExtHeaderOffset
114 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
115 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
116 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
117 FixedPcdGet32 (PcdEmuFlashNvStorageEventLogSize
)) / FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
118 FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
134 OUT EFI_FIRMWARE_VOLUME_HEADER
**FvbInfo
139 for (Index
= 0; Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
); Index
+= 1) {
140 if (mPlatformFvbMediaInfo
[Index
].FvLength
== FvLength
) {
141 *FvbInfo
= &mPlatformFvbMediaInfo
[Index
].FvbInfo
;
146 return EFI_NOT_FOUND
;