3 Copyright (c) 2006, 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.
24 // 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/FvbExtension.h>
35 #include <Protocol/FirmwareVolumeBlock.h>
36 #include <Guid/AlternateFvBlock.h>
37 #include <Protocol/DevicePath.h>
39 // The Library classes this module consumes
41 #include <Library/UefiLib.h>
42 #include <Library/UefiDriverEntryPoint.h>
43 #include <Library/BaseLib.h>
44 #include <Library/DxeServicesTableLib.h>
45 #include <Library/UefiRuntimeLib.h>
46 #include <Library/DebugLib.h>
47 #include <Library/HobLib.h>
48 #include <Library/BaseMemoryLib.h>
49 #include <Library/MemoryAllocationLib.h>
50 #include <Library/UefiBootServicesTableLib.h>
51 #include <Library/PcdLib.h>
55 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
57 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
59 EFI_FV_BLOCK_MAP_ENTRY End
[1];
62 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
67 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize
),
72 EFI_FIRMWARE_FILE_SYSTEM2_GUID
,
73 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize
),
75 EFI_FVB2_READ_ENABLED_CAP
|
76 EFI_FVB2_READ_STATUS
|
77 EFI_FVB2_WRITE_ENABLED_CAP
|
78 EFI_FVB2_WRITE_STATUS
|
79 EFI_FVB2_ERASE_POLARITY
,
80 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
88 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize
)/FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
89 FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
98 // Systen NvStorage FVB
101 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
102 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
103 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
104 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize
),
109 EFI_SYSTEM_NV_DATA_HOB_GUID
,
110 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
111 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
112 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
113 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize
),
115 EFI_FVB2_READ_ENABLED_CAP
|
116 EFI_FVB2_READ_STATUS
|
117 EFI_FVB2_WRITE_ENABLED_CAP
|
118 EFI_FVB2_WRITE_STATUS
|
119 EFI_FVB2_ERASE_POLARITY
,
120 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
122 0, // ExtHeaderOffset
128 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
129 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
130 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
131 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize
)) / FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
132 FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
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
;