2 Defines data structure that is the volume header found.These data is intent
3 to decouple FVB driver with FV header.
5 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
6 Portions copyright (c) 2011, Apple Inc. All rights reserved.
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include <Guid/EventGroup.h>
21 #include <Guid/FirmwareFileSystem2.h>
22 #include <Guid/SystemNvDataGuid.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>
43 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
45 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
47 EFI_FV_BLOCK_MAP_ENTRY End
[1];
50 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
55 FixedPcdGet32 (PcdEmuFlashFvRecoverySize
),
60 EFI_FIRMWARE_FILE_SYSTEM2_GUID
,
61 FixedPcdGet32 (PcdEmuFlashFvRecoverySize
),
63 EFI_FVB2_READ_ENABLED_CAP
|
64 EFI_FVB2_READ_STATUS
|
65 EFI_FVB2_WRITE_ENABLED_CAP
|
66 EFI_FVB2_WRITE_STATUS
|
67 EFI_FVB2_ERASE_POLARITY
,
68 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
77 FixedPcdGet32 (PcdEmuFlashFvRecoverySize
)/FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
78 FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
90 // Systen NvStorage FVB
93 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
94 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
95 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
96 FixedPcdGet32 (PcdEmuFlashNvStorageEventLogSize
),
101 EFI_SYSTEM_NV_DATA_FV_GUID
,
102 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
103 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
104 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
105 FixedPcdGet32 (PcdEmuFlashNvStorageEventLogSize
),
107 EFI_FVB2_READ_ENABLED_CAP
|
108 EFI_FVB2_READ_STATUS
|
109 EFI_FVB2_WRITE_ENABLED_CAP
|
110 EFI_FVB2_WRITE_STATUS
|
111 EFI_FVB2_ERASE_POLARITY
,
112 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
114 0, // ExtHeaderOffset
121 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) + \
122 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) + \
123 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) + \
124 FixedPcdGet32 (PcdEmuFlashNvStorageEventLogSize
)) / FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
125 FixedPcdGet32 (PcdEmuFirmwareBlockSize
),
141 OUT EFI_FIRMWARE_VOLUME_HEADER
**FvbInfo
146 for (Index
= 0; Index
< sizeof (mPlatformFvbMediaInfo
) / sizeof (EFI_FVB_MEDIA_INFO
); Index
+= 1) {
147 if (mPlatformFvbMediaInfo
[Index
].FvLength
== FvLength
) {
148 *FvbInfo
= &mPlatformFvbMediaInfo
[Index
].FvbInfo
;
153 return EFI_NOT_FOUND
;