3 Copyright (c) 2006 - 2008, Intel Corporation
4 All rights reserved. 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 <Guid/AlternateFvBlock.h>
26 #include <Protocol/DevicePath.h>
28 #include <Library/UefiLib.h>
29 #include <Library/UefiDriverEntryPoint.h>
30 #include <Library/BaseLib.h>
31 #include <Library/DxeServicesTableLib.h>
32 #include <Library/UefiRuntimeLib.h>
33 #include <Library/DebugLib.h>
34 #include <Library/HobLib.h>
35 #include <Library/BaseMemoryLib.h>
36 #include <Library/MemoryAllocationLib.h>
37 #include <Library/UefiBootServicesTableLib.h>
38 #include <Library/PcdLib.h>
39 #include <Library/DevicePathLib.h>
41 #include <Guid/FirmwareFileSystem2.h>
42 #include <Guid/SystemNvDataGuid.h>
46 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
48 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
50 EFI_FV_BLOCK_MAP_ENTRY End
[1];
53 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
58 FixedPcdGet32 (PcdUnixFlashFvRecoverySize
),
63 EFI_FIRMWARE_FILE_SYSTEM2_GUID
,
64 FixedPcdGet32 (PcdUnixFlashFvRecoverySize
),
66 EFI_FVB2_READ_ENABLED_CAP
|
67 EFI_FVB2_READ_STATUS
|
68 EFI_FVB2_WRITE_ENABLED_CAP
|
69 EFI_FVB2_WRITE_STATUS
|
70 EFI_FVB2_ERASE_POLARITY
,
71 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
80 FixedPcdGet32 (PcdUnixFlashFvRecoverySize
)/FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
81 FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
93 // Systen NvStorage FVB
96 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
97 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
98 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
99 FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize
),
104 EFI_SYSTEM_NV_DATA_FV_GUID
,
105 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
106 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
107 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
108 FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize
),
110 EFI_FVB2_READ_ENABLED_CAP
|
111 EFI_FVB2_READ_STATUS
|
112 EFI_FVB2_WRITE_ENABLED_CAP
|
113 EFI_FVB2_WRITE_STATUS
|
114 EFI_FVB2_ERASE_POLARITY
,
115 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
117 0, // ExtHeaderOffset
124 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
125 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
126 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
127 FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize
)) / FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
128 FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
144 OUT EFI_FIRMWARE_VOLUME_HEADER
**FvbInfo
149 for (Index
= 0; Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
); Index
+= 1) {
150 if (mPlatformFvbMediaInfo
[Index
].FvLength
== FvLength
) {
151 *FvbInfo
= &mPlatformFvbMediaInfo
[Index
].FvbInfo
;
156 return EFI_NOT_FOUND
;