3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available
6 under the terms and conditions of the BSD License which accompanies this
7 distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 Defines data structure that is the volume header found.These data is intent
20 to decouple FVB driver with FV header.
25 // The package level header files this module uses
27 #include <Pi/PiFirmwareVolume.h>
30 // The protocols, PPI and GUID defintions for this module
32 #include <Guid/SystemNvDataGuid.h>
34 // The Library classes this module consumes
36 #include <Library/BaseLib.h>
37 #include <Library/PcdLib.h>
41 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
43 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
45 EFI_FV_BLOCK_MAP_ENTRY End
[1];
48 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
50 // Systen NvStorage FVB
53 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
54 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
55 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
56 FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize
),
61 EFI_SYSTEM_NV_DATA_FV_GUID
,
62 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
63 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
64 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
65 FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize
),
67 EFI_FVB2_MEMORY_MAPPED
|
68 EFI_FVB2_READ_ENABLED_CAP
|
69 EFI_FVB2_READ_STATUS
|
70 EFI_FVB2_WRITE_ENABLED_CAP
|
71 EFI_FVB2_WRITE_STATUS
|
72 EFI_FVB2_ERASE_POLARITY
|
73 EFI_FVB2_ALIGNMENT_16
,
74 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
83 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
84 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
85 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
86 FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize
)) /
87 FixedPcdGet32 (PcdOvmfFirmwareBlockSize
),
88 FixedPcdGet32 (PcdOvmfFirmwareBlockSize
),
104 OUT EFI_FIRMWARE_VOLUME_HEADER
**FvbInfo
107 STATIC BOOLEAN Checksummed
= FALSE
;
112 Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
);
115 mPlatformFvbMediaInfo
[Index
].FvbInfo
.Checksum
= 0;
116 Checksum
= CalculateCheckSum16 (
117 (UINT16
*) &mPlatformFvbMediaInfo
[Index
].FvbInfo
,
118 mPlatformFvbMediaInfo
[Index
].FvbInfo
.HeaderLength
120 mPlatformFvbMediaInfo
[Index
].FvbInfo
.Checksum
= Checksum
;
126 Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
);
128 if (mPlatformFvbMediaInfo
[Index
].FvLength
== FvLength
) {
129 *FvbInfo
= &mPlatformFvbMediaInfo
[Index
].FvbInfo
;
134 return EFI_NOT_FOUND
;