3 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Defines data structure that is the volume header found.These data is intent
19 to decouple FVB driver with FV header.
23 #include <Guid/EventGroup.h>
24 #include <Protocol/FirmwareVolumeBlock.h>
25 #include <Protocol/DevicePath.h>
27 #include <Library/UefiLib.h>
28 #include <Library/UefiDriverEntryPoint.h>
29 #include <Library/BaseLib.h>
30 #include <Library/DxeServicesTableLib.h>
31 #include <Library/UefiRuntimeLib.h>
32 #include <Library/DebugLib.h>
33 #include <Library/HobLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/MemoryAllocationLib.h>
36 #include <Library/UefiBootServicesTableLib.h>
37 #include <Library/PcdLib.h>
38 #include <Library/DevicePathLib.h>
40 #include <Guid/FirmwareFileSystem2.h>
41 #include <Guid/SystemNvDataGuid.h>
45 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
47 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
49 EFI_FV_BLOCK_MAP_ENTRY End
[1];
52 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
57 FixedPcdGet32 (PcdUnixFlashFvRecoverySize
),
62 EFI_FIRMWARE_FILE_SYSTEM2_GUID
,
63 FixedPcdGet32 (PcdUnixFlashFvRecoverySize
),
65 EFI_FVB2_READ_ENABLED_CAP
|
66 EFI_FVB2_READ_STATUS
|
67 EFI_FVB2_WRITE_ENABLED_CAP
|
68 EFI_FVB2_WRITE_STATUS
|
69 EFI_FVB2_ERASE_POLARITY
,
70 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
79 FixedPcdGet32 (PcdUnixFlashFvRecoverySize
)/FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
80 FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
92 // Systen NvStorage FVB
95 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
96 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
97 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
98 FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize
),
103 EFI_SYSTEM_NV_DATA_FV_GUID
,
104 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
105 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
106 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
107 FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize
),
109 EFI_FVB2_READ_ENABLED_CAP
|
110 EFI_FVB2_READ_STATUS
|
111 EFI_FVB2_WRITE_ENABLED_CAP
|
112 EFI_FVB2_WRITE_STATUS
|
113 EFI_FVB2_ERASE_POLARITY
,
114 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
116 0, // ExtHeaderOffset
123 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
124 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
125 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
126 FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize
)) / FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
127 FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
143 OUT EFI_FIRMWARE_VOLUME_HEADER
**FvbInfo
148 for (Index
= 0; Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
); Index
+= 1) {
149 if (mPlatformFvbMediaInfo
[Index
].FvLength
== FvLength
) {
150 *FvbInfo
= &mPlatformFvbMediaInfo
[Index
].FvbInfo
;
155 return EFI_NOT_FOUND
;