3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
13 Defines data structure that is the volume header found.These data is intent
14 to decouple FVB driver with FV header.
19 // The package level header files this module uses
21 #include <Pi/PiFirmwareVolume.h>
24 // The protocols, PPI and GUID definitions for this module
26 #include <Guid/SystemNvDataGuid.h>
28 // The Library classes this module consumes
30 #include <Library/BaseLib.h>
31 #include <Library/PcdLib.h>
35 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
37 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
39 EFI_FV_BLOCK_MAP_ENTRY End
[1];
42 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
44 // System NvStorage FVB
47 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
48 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
49 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
50 FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize
),
55 EFI_SYSTEM_NV_DATA_FV_GUID
,
56 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
57 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
58 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
59 FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize
),
61 EFI_FVB2_MEMORY_MAPPED
|
62 EFI_FVB2_READ_ENABLED_CAP
|
63 EFI_FVB2_READ_STATUS
|
64 EFI_FVB2_WRITE_ENABLED_CAP
|
65 EFI_FVB2_WRITE_STATUS
|
66 EFI_FVB2_ERASE_POLARITY
|
67 EFI_FVB2_ALIGNMENT_16
,
68 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
77 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
78 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
79 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
80 FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize
)) /
81 FixedPcdGet32 (PcdOvmfFirmwareBlockSize
),
82 FixedPcdGet32 (PcdOvmfFirmwareBlockSize
),
98 OUT EFI_FIRMWARE_VOLUME_HEADER
**FvbInfo
101 STATIC BOOLEAN Checksummed
= FALSE
;
106 Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
);
109 mPlatformFvbMediaInfo
[Index
].FvbInfo
.Checksum
= 0;
110 Checksum
= CalculateCheckSum16 (
111 (UINT16
*) &mPlatformFvbMediaInfo
[Index
].FvbInfo
,
112 mPlatformFvbMediaInfo
[Index
].FvbInfo
.HeaderLength
114 mPlatformFvbMediaInfo
[Index
].FvbInfo
.Checksum
= Checksum
;
120 Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
);
122 if (mPlatformFvbMediaInfo
[Index
].FvLength
== FvLength
) {
123 *FvbInfo
= &mPlatformFvbMediaInfo
[Index
].FvbInfo
;
128 return EFI_NOT_FOUND
;