TianoCore EDK2 master
Loading...
Searching...
No Matches
FvbService.h
Go to the documentation of this file.
1
9#ifndef FW_BLOCK_SERVICE_H_
10#define FW_BLOCK_SERVICE_H_
11
12#include <Guid/EventGroup.h>
15#include <Guid/VariableFormat.h>
16#include <Protocol/DevicePath.h>
20#include <Library/UefiLib.h>
21#include <Library/BaseLib.h>
22#include <Library/DebugLib.h>
24#include <Library/IoLib.h>
27#include <Library/PcdLib.h>
30#include <Library/HobLib.h>
34
35//
36// Define two helper macro to extract the Capability field or Status field in FVB
37// bit fields
38//
39#define EFI_FVB2_CAPABILITIES (EFI_FVB2_READ_DISABLED_CAP |\
40 EFI_FVB2_READ_ENABLED_CAP | \
41 EFI_FVB2_WRITE_DISABLED_CAP | \
42 EFI_FVB2_WRITE_ENABLED_CAP | \
43 EFI_FVB2_LOCK_CAP \
44 )
45
46#define EFI_FVB2_STATUS (EFI_FVB2_READ_STATUS | EFI_FVB2_WRITE_STATUS | EFI_FVB2_LOCK_STATUS)
47
48typedef struct {
49 UINTN FvBase;
50 UINTN NumOfBlocks;
51 //
52 // Note!!!: VolumeHeader must be the last element
53 // of the structure.
54 //
55 EFI_FIRMWARE_VOLUME_HEADER VolumeHeader;
57
58typedef struct {
59 EFI_FW_VOL_INSTANCE *FvInstance;
60 UINT32 NumFv;
61 UINT32 Flags;
63
64//
65// Fvb Protocol instance data
66//
67#define FVB_DEVICE_FROM_THIS(a) CR(a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
68#define FVB_EXTEND_DEVICE_FROM_THIS(a) CR(a, EFI_FW_VOL_BLOCK_DEVICE, FvbExtension, FVB_DEVICE_SIGNATURE)
69#define FVB_DEVICE_SIGNATURE SIGNATURE_32('F','V','B','C')
70
71typedef struct {
73 EFI_DEVICE_PATH_PROTOCOL EndDevPath;
75
76typedef struct {
77 MEMMAP_DEVICE_PATH MemMapDevPath;
78 EFI_DEVICE_PATH_PROTOCOL EndDevPath;
80
81typedef struct {
82 UINT32 Signature;
83 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
84 UINTN Instance;
85 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
87
96 VOID
97 );
98
101 VOID
102 );
103
104//
105// Protocol APIs
106//
108EFIAPI
111 OUT EFI_FVB_ATTRIBUTES_2 *Attributes
112 );
113
115EFIAPI
118 IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
119 );
120
122EFIAPI
126 );
127
129EFIAPI
132 IN EFI_LBA Lba,
133 OUT UINTN *BlockSize,
134 OUT UINTN *NumOfBlocks
135 );
136
138EFIAPI
141 IN EFI_LBA Lba,
142 IN UINTN Offset,
143 IN OUT UINTN *NumBytes,
144 OUT UINT8 *Buffer
145 );
146
148EFIAPI
151 IN EFI_LBA Lba,
152 IN UINTN Offset,
153 IN OUT UINTN *NumBytes,
154 IN UINT8 *Buffer
155 );
156
158EFIAPI
161 ...
162 );
163
166 IN UINTN Instance
167 );
168
171 IN EFI_FW_VOL_INSTANCE *FwhInstance,
172 IN UINTN InstanceNum
173 );
174
177 VOID
178 );
179
180extern FWB_GLOBAL mFvbModuleGlobal;
181extern EFI_FW_VOL_BLOCK_DEVICE mFvbDeviceTemplate;
182extern FV_MEMMAP_DEVICE_PATH mFvMemmapDevicePathTemplate;
183extern FV_PIWG_DEVICE_PATH mFvPIWGDevicePathTemplate;
184
185#endif
UINT64 UINTN
EFI_STATUS EFIAPI FvbProtocolRead(IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN EFI_LBA Lba, IN UINTN Offset, IN OUT UINTN *NumBytes, OUT UINT8 *Buffer)
Definition: FvbService.c:858
EFI_STATUS EFIAPI FvbProtocolSetAttributes(IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes)
EFI_STATUS FvbInitialize(VOID)
Definition: FvbService.c:996
EFI_STATUS InstallFvbProtocol(IN EFI_FW_VOL_INSTANCE *FwhInstance, IN UINTN InstanceNum)
Definition: FvbServiceSmm.c:28
EFI_FW_VOL_INSTANCE * GetFvbInstance(IN UINTN Instance)
Definition: FvbService.c:91
EFI_STATUS EFIAPI FvbProtocolEraseBlocks(IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,...)
EFI_STATUS EFIAPI FvbProtocolGetPhysicalAddress(IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, OUT EFI_PHYSICAL_ADDRESS *Address)
EFI_STATUS EFIAPI FvbProtocolWrite(IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN EFI_LBA Lba, IN UINTN Offset, IN OUT UINTN *NumBytes, IN UINT8 *Buffer)
EFI_STATUS EFIAPI FvbProtocolGetBlockSize(IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN EFI_LBA Lba, OUT UINTN *BlockSize, OUT UINTN *NumOfBlocks)
EFI_STATUS InitVariableStore(VOID)
Definition: FvbInfo.c:63
EFI_FIRMWARE_VOLUME_HEADER * GetFvHeaderTemplate(VOID)
Definition: FvbInfo.c:136
EFI_STATUS EFIAPI FvbProtocolGetAttributes(IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, OUT EFI_FVB_ATTRIBUTES_2 *Attributes)
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
UINT32 EFI_FVB_ATTRIBUTES_2
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
UINT64 EFI_LBA
Definition: UefiBaseType.h:45
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29