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/FvbExtension.h>
25 #include <Protocol/FirmwareVolumeBlock.h>
26 #include <Guid/AlternateFvBlock.h>
27 #include <Protocol/DevicePath.h>
29 #include <Library/UefiLib.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Library/BaseLib.h>
32 #include <Library/DxeServicesTableLib.h>
33 #include <Library/UefiRuntimeLib.h>
34 #include <Library/DebugLib.h>
35 #include <Library/HobLib.h>
36 #include <Library/BaseMemoryLib.h>
37 #include <Library/MemoryAllocationLib.h>
38 #include <Library/UefiBootServicesTableLib.h>
39 #include <Library/PcdLib.h>
40 #include <Library/DevicePathLib.h>
42 #include <Guid/FirmwareFileSystem2.h>
43 #include <Guid/SystemNvDataGuid.h>
47 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
49 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
51 EFI_FV_BLOCK_MAP_ENTRY End
[1];
54 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
59 FixedPcdGet32 (PcdUnixFlashFvRecoverySize
),
64 EFI_FIRMWARE_FILE_SYSTEM2_GUID
,
65 FixedPcdGet32 (PcdUnixFlashFvRecoverySize
),
67 EFI_FVB2_READ_ENABLED_CAP
|
68 EFI_FVB2_READ_STATUS
|
69 EFI_FVB2_WRITE_ENABLED_CAP
|
70 EFI_FVB2_WRITE_STATUS
|
71 EFI_FVB2_ERASE_POLARITY
,
72 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
81 FixedPcdGet32 (PcdUnixFlashFvRecoverySize
)/FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
82 FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
94 // Systen NvStorage FVB
97 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
98 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
99 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
100 FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize
),
105 EFI_SYSTEM_NV_DATA_HOB_GUID
,
106 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
107 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
108 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
109 FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize
),
111 EFI_FVB2_READ_ENABLED_CAP
|
112 EFI_FVB2_READ_STATUS
|
113 EFI_FVB2_WRITE_ENABLED_CAP
|
114 EFI_FVB2_WRITE_STATUS
|
115 EFI_FVB2_ERASE_POLARITY
,
116 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
118 0, // ExtHeaderOffset
125 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
126 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
127 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
128 FixedPcdGet32 (PcdUnixFlashNvStorageEventLogSize
)) / FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
129 FixedPcdGet32 (PcdUnixFirmwareBlockSize
),
145 OUT EFI_FIRMWARE_VOLUME_HEADER
**FvbInfo
150 for (Index
= 0; Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
); Index
+= 1) {
151 if (mPlatformFvbMediaInfo
[Index
].FvLength
== FvLength
) {
152 *FvbInfo
= &mPlatformFvbMediaInfo
[Index
].FvbInfo
;
157 return EFI_NOT_FOUND
;