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>
52 #include "FlashLayout.h"
54 #define FIRMWARE_BLOCK_SIZE 0x10000
58 EFI_FIRMWARE_VOLUME_HEADER FvbInfo
;
60 // EFI_FV_BLOCK_MAP_ENTRY ExtraBlockMap[n];//n=0
62 EFI_FV_BLOCK_MAP_ENTRY End
[1];
65 #define FVB_MEDIA_BLOCK_SIZE FIRMWARE_BLOCK_SIZE
66 #define RECOVERY_BOIS_BLOCK_NUM FIRMWARE_BLOCK_NUMBER
67 #define SYSTEM_NV_BLOCK_NUM 2
69 EFI_FVB_MEDIA_INFO mPlatformFvbMediaInfo
[] = {
74 EFI_WINNT_FIRMWARE_LENGTH
,
79 EFI_FIRMWARE_FILE_SYSTEM2_GUID
,
80 FVB_MEDIA_BLOCK_SIZE
* RECOVERY_BOIS_BLOCK_NUM
,
82 EFI_FVB2_READ_ENABLED_CAP
|
83 EFI_FVB2_READ_STATUS
|
84 EFI_FVB2_WRITE_ENABLED_CAP
|
85 EFI_FVB2_WRITE_STATUS
|
86 EFI_FVB2_ERASE_POLARITY
,
87 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
95 RECOVERY_BOIS_BLOCK_NUM
,
105 // Systen NvStorage FVB
108 EFI_WINNT_RUNTIME_UPDATABLE_LENGTH
+ EFI_WINNT_FTW_SPARE_BLOCK_LENGTH
,
113 EFI_SYSTEM_NV_DATA_HOB_GUID
,
114 FVB_MEDIA_BLOCK_SIZE
* SYSTEM_NV_BLOCK_NUM
,
116 EFI_FVB2_READ_ENABLED_CAP
|
117 EFI_FVB2_READ_STATUS
|
118 EFI_FVB2_WRITE_ENABLED_CAP
|
119 EFI_FVB2_WRITE_STATUS
|
120 EFI_FVB2_ERASE_POLARITY
,
121 sizeof (EFI_FIRMWARE_VOLUME_HEADER
) + sizeof (EFI_FV_BLOCK_MAP_ENTRY
),
123 0, // ExtHeaderOffset
130 FVB_MEDIA_BLOCK_SIZE
,
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
;