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
29 // The protocols, PPI and GUID defintions for this module
31 #include <Guid/EventGroup.h>
32 #include <Guid/FirmwareFileSystem2.h>
33 #include <Guid/SystemNvDataGuid.h>
34 #include <Protocol/FirmwareVolumeBlock.h>
35 #include <Protocol/DevicePath.h>
37 // The Library classes this module consumes
39 #include <Library/UefiLib.h>
40 #include <Library/UefiDriverEntryPoint.h>
41 #include <Library/BaseLib.h>
42 #include <Library/DxeServicesTableLib.h>
43 #include <Library/UefiRuntimeLib.h>
44 #include <Library/DebugLib.h>
45 #include <Library/HobLib.h>
46 #include <Library/BaseMemoryLib.h>
47 #include <Library/MemoryAllocationLib.h>
48 #include <Library/UefiBootServicesTableLib.h>
49 #include <Library/PcdLib.h>
53 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
55 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
57 EFI_FV_BLOCK_MAP_ENTRY End
[1];
60 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
62 // Systen NvStorage FVB
65 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
66 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
67 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
68 FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize
),
73 EFI_SYSTEM_NV_DATA_FV_GUID
,
74 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
75 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
76 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
77 FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize
),
79 EFI_FVB2_MEMORY_MAPPED
|
80 EFI_FVB2_READ_ENABLED_CAP
|
81 EFI_FVB2_READ_STATUS
|
82 EFI_FVB2_WRITE_ENABLED_CAP
|
83 EFI_FVB2_WRITE_STATUS
|
84 EFI_FVB2_ERASE_POLARITY
|
85 EFI_FVB2_ALIGNMENT_16
,
86 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
95 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
96 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
97 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
98 FixedPcdGet32 (PcdOvmfFlashNvStorageEventLogSize
)) /
99 FixedPcdGet32 (PcdOvmfFirmwareBlockSize
),
100 FixedPcdGet32 (PcdOvmfFirmwareBlockSize
),
116 OUT EFI_FIRMWARE_VOLUME_HEADER
**FvbInfo
119 STATIC BOOLEAN Checksummed
= FALSE
;
124 Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
);
127 mPlatformFvbMediaInfo
[Index
].FvbInfo
.Checksum
= 0;
128 Checksum
= CalculateCheckSum16 (
129 (UINT16
*) &mPlatformFvbMediaInfo
[Index
].FvbInfo
,
130 mPlatformFvbMediaInfo
[Index
].FvbInfo
.HeaderLength
132 mPlatformFvbMediaInfo
[Index
].FvbInfo
.Checksum
= Checksum
;
138 Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
);
140 if (mPlatformFvbMediaInfo
[Index
].FvLength
== FvLength
) {
141 *FvbInfo
= &mPlatformFvbMediaInfo
[Index
].FvbInfo
;
146 return EFI_NOT_FOUND
;