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 <Guid/AlternateFvBlock.h>
36 #include <Protocol/DevicePath.h>
38 // The Library classes this module consumes
40 #include <Library/UefiLib.h>
41 #include <Library/UefiDriverEntryPoint.h>
42 #include <Library/BaseLib.h>
43 #include <Library/DxeServicesTableLib.h>
44 #include <Library/UefiRuntimeLib.h>
45 #include <Library/DebugLib.h>
46 #include <Library/HobLib.h>
47 #include <Library/BaseMemoryLib.h>
48 #include <Library/MemoryAllocationLib.h>
49 #include <Library/UefiBootServicesTableLib.h>
50 #include <Library/PcdLib.h>
54 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
56 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
58 EFI_FV_BLOCK_MAP_ENTRY End
[1];
61 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
66 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize
),
71 EFI_FIRMWARE_FILE_SYSTEM2_GUID
,
72 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize
),
74 EFI_FVB2_READ_ENABLED_CAP
|
75 EFI_FVB2_READ_STATUS
|
76 EFI_FVB2_WRITE_ENABLED_CAP
|
77 EFI_FVB2_WRITE_STATUS
|
78 EFI_FVB2_ERASE_POLARITY
,
79 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
87 FixedPcdGet32 (PcdWinNtFlashFvRecoverySize
)/FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
88 FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
97 // Systen NvStorage FVB
100 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
101 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
102 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
103 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize
),
108 EFI_SYSTEM_NV_DATA_FV_GUID
,
109 FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
110 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
111 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
112 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize
),
114 EFI_FVB2_READ_ENABLED_CAP
|
115 EFI_FVB2_READ_STATUS
|
116 EFI_FVB2_WRITE_ENABLED_CAP
|
117 EFI_FVB2_WRITE_STATUS
|
118 EFI_FVB2_ERASE_POLARITY
,
119 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
121 0, // ExtHeaderOffset
127 (FixedPcdGet32 (PcdFlashNvStorageVariableSize
) +
128 FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize
) +
129 FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize
) +
130 FixedPcdGet32 (PcdWinNtFlashNvStorageEventLogSize
)) / FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
131 FixedPcdGet32 (PcdWinNtFirmwareBlockSize
),
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
;