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/FirmwareVolumeBlock.h>
35 #include <Protocol/DevicePath.h>
37 // The Library classes this module consumes
39 #include <Library/UefiLib.h>
40 #include <Library/UefiDriverEntryPoint.h>
41 #include <Library/BaseLib.h>
42 #include <Library/DxeServicesTableLib.h>
43 #include <Library/UefiRuntimeLib.h>
44 #include <Library/DebugLib.h>
45 #include <Library/HobLib.h>
46 #include <Library/BaseMemoryLib.h>
47 #include <Library/MemoryAllocationLib.h>
48 #include <Library/UefiBootServicesTableLib.h>
49 #include <Library/PcdLib.h>
53 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
55 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
57 EFI_FV_BLOCK_MAP_ENTRY End
[1];
60 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
65 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize
),
70 EFI_FIRMWARE_FILE_SYSTEM2_GUID
,
71 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize
),
73 EFI_FVB2_READ_ENABLED_CAP
|
74 EFI_FVB2_READ_STATUS
|
75 EFI_FVB2_WRITE_ENABLED_CAP
|
76 EFI_FVB2_WRITE_STATUS
|
77 EFI_FVB2_ERASE_POLARITY
,
78 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
86 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize
)/FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
87 FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
96 // Systen NvStorage FVB
99 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
100 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
101 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
102 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize
),
107 EFI_SYSTEM_NV_DATA_FV_GUID
,
108 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
109 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
110 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
111 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize
),
113 EFI_FVB2_READ_ENABLED_CAP
|
114 EFI_FVB2_READ_STATUS
|
115 EFI_FVB2_WRITE_ENABLED_CAP
|
116 EFI_FVB2_WRITE_STATUS
|
117 EFI_FVB2_ERASE_POLARITY
,
118 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
120 0, // ExtHeaderOffset
126 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
127 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
128 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
129 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize
)) / FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
130 FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
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
;