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>
37 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
39 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
41 EFI_FV_BLOCK_MAP_ENTRY End
[1];
44 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
49 FixedPcdGet32 (PcdEmuFlashFvRecoverySize
),
54 EFI_FIRMWARE_FILE_SYSTEM2_GUID
,
55 FixedPcdGet32 (PcdEmuFlashFvRecoverySize
),
57 EFI_FVB2_READ_ENABLED_CAP
|
58 EFI_FVB2_READ_STATUS
|
59 EFI_FVB2_WRITE_ENABLED_CAP
|
60 EFI_FVB2_WRITE_STATUS
|
61 EFI_FVB2_ERASE_POLARITY
,
62 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
71 FixedPcdGet32 (PcdEmuFlashFvRecoverySize
)/FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
72 FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
84 // Systen NvStorage FVB
87 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
88 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
89 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
90 FixedPcdGet32 (PcdEmuFlashNvStorageEventLogSize
),
95 EFI_SYSTEM_NV_DATA_FV_GUID
,
96 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
97 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
98 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
99 FixedPcdGet32 (PcdEmuFlashNvStorageEventLogSize
),
101 EFI_FVB2_READ_ENABLED_CAP
|
102 EFI_FVB2_READ_STATUS
|
103 EFI_FVB2_WRITE_ENABLED_CAP
|
104 EFI_FVB2_WRITE_STATUS
|
105 EFI_FVB2_ERASE_POLARITY
,
106 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
108 0, // ExtHeaderOffset
115 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
116 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
117 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
118 FixedPcdGet32 (PcdEmuFlashNvStorageEventLogSize
)) / FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
119 FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
135 OUT EFI_FIRMWARE_VOLUME_HEADER
**FvbInfo
140 for (Index
= 0; Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
); Index
+= 1) {
141 if (mPlatformFvbMediaInfo
[Index
].FvLength
== FvLength
) {
142 *FvbInfo
= &mPlatformFvbMediaInfo
[Index
].FvbInfo
;
147 return EFI_NOT_FOUND
;