]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/FvbServicesRuntimeDxe/FwBlockService.h
EmulatorPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / EmulatorPkg / FvbServicesRuntimeDxe / FwBlockService.h
1 /*++ @file
2 Firmware volume block driver for Intel Firmware Hub (FWH) device
3
4 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
5 Portions copyright (c) 2011, Apple Inc. All rights reserved.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef _FW_BLOCK_SERVICE_H
11 #define _FW_BLOCK_SERVICE_H
12
13 //
14 // BugBug: Add documentation here for data structure!!!!
15 //
16 #define FVB_PHYSICAL 0
17 #define FVB_VIRTUAL 1
18
19 typedef struct {
20 EFI_LOCK FvbDevLock;
21 UINTN FvBase[2];
22 UINTN NumOfBlocks;
23 EFI_FIRMWARE_VOLUME_HEADER VolumeHeader;
24 } EFI_FW_VOL_INSTANCE;
25
26 typedef struct {
27 UINT32 NumFv;
28 EFI_FW_VOL_INSTANCE *FvInstance[2];
29 } ESAL_FWB_GLOBAL;
30
31 //
32 // Fvb Protocol instance data
33 //
34 #define FVB_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
35 #define FVB_EXTEND_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FvbExtension, FVB_DEVICE_SIGNATURE)
36 #define FVB_DEVICE_SIGNATURE SIGNATURE_32 ('F', 'V', 'B', 'N')
37
38 typedef struct {
39 MEMMAP_DEVICE_PATH MemMapDevPath;
40 EFI_DEVICE_PATH_PROTOCOL EndDevPath;
41 } FV_DEVICE_PATH;
42
43 typedef struct {
44 UINTN Signature;
45 FV_DEVICE_PATH DevicePath;
46 UINTN Instance;
47 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
48 } EFI_FW_VOL_BLOCK_DEVICE;
49
50 EFI_STATUS
51 GetFvbInfo (
52 IN UINT64 FvLength,
53 OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo
54 )
55 ;
56
57 EFI_STATUS
58 FvbReadBlock (
59 IN UINTN Instance,
60 IN EFI_LBA Lba,
61 IN UINTN BlockOffset,
62 IN OUT UINTN *NumBytes,
63 IN UINT8 *Buffer,
64 IN ESAL_FWB_GLOBAL *Global,
65 IN BOOLEAN Virtual
66 )
67 ;
68
69 EFI_STATUS
70 FvbWriteBlock (
71 IN UINTN Instance,
72 IN EFI_LBA Lba,
73 IN UINTN BlockOffset,
74 IN OUT UINTN *NumBytes,
75 IN UINT8 *Buffer,
76 IN ESAL_FWB_GLOBAL *Global,
77 IN BOOLEAN Virtual
78 )
79 ;
80
81 EFI_STATUS
82 FvbEraseBlock (
83 IN UINTN Instance,
84 IN EFI_LBA Lba,
85 IN ESAL_FWB_GLOBAL *Global,
86 IN BOOLEAN Virtual
87 )
88 ;
89
90 EFI_STATUS
91 FvbSetVolumeAttributes (
92 IN UINTN Instance,
93 IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes,
94 IN ESAL_FWB_GLOBAL *Global,
95 IN BOOLEAN Virtual
96 )
97 ;
98
99 EFI_STATUS
100 FvbGetVolumeAttributes (
101 IN UINTN Instance,
102 OUT EFI_FVB_ATTRIBUTES_2 *Attributes,
103 IN ESAL_FWB_GLOBAL *Global,
104 IN BOOLEAN Virtual
105 )
106 ;
107
108 EFI_STATUS
109 FvbGetPhysicalAddress (
110 IN UINTN Instance,
111 OUT EFI_PHYSICAL_ADDRESS *Address,
112 IN ESAL_FWB_GLOBAL *Global,
113 IN BOOLEAN Virtual
114 )
115 ;
116
117 EFI_STATUS
118 EFIAPI
119 FvbInitialize (
120 IN EFI_HANDLE ImageHandle,
121 IN EFI_SYSTEM_TABLE *SystemTable
122 )
123 ;
124
125
126 VOID
127 EFIAPI
128 FvbClassAddressChangeEvent (
129 IN EFI_EVENT Event,
130 IN VOID *Context
131 )
132 ;
133
134 EFI_STATUS
135 FvbGetLbaAddress (
136 IN UINTN Instance,
137 IN EFI_LBA Lba,
138 OUT UINTN *LbaAddress,
139 OUT UINTN *LbaLength,
140 OUT UINTN *NumOfBlocks,
141 IN ESAL_FWB_GLOBAL *Global,
142 IN BOOLEAN Virtual
143 )
144 ;
145
146 //
147 // Protocol APIs
148 //
149 EFI_STATUS
150 EFIAPI
151 FvbProtocolGetAttributes (
152 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
153 OUT EFI_FVB_ATTRIBUTES_2 *Attributes
154 )
155 ;
156
157 EFI_STATUS
158 EFIAPI
159 FvbProtocolSetAttributes (
160 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
161 IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
162 )
163 ;
164
165 EFI_STATUS
166 EFIAPI
167 FvbProtocolGetPhysicalAddress (
168 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
169 OUT EFI_PHYSICAL_ADDRESS *Address
170 )
171 ;
172
173 EFI_STATUS
174 EFIAPI
175 FvbProtocolGetBlockSize (
176 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
177 IN EFI_LBA Lba,
178 OUT UINTN *BlockSize,
179 OUT UINTN *NumOfBlocks
180 )
181 ;
182
183 EFI_STATUS
184 EFIAPI
185 FvbProtocolRead (
186 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
187 IN EFI_LBA Lba,
188 IN UINTN Offset,
189 IN OUT UINTN *NumBytes,
190 IN UINT8 *Buffer
191 )
192 ;
193
194 EFI_STATUS
195 EFIAPI
196 FvbProtocolWrite (
197 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
198 IN EFI_LBA Lba,
199 IN UINTN Offset,
200 IN OUT UINTN *NumBytes,
201 IN UINT8 *Buffer
202 )
203 ;
204
205 EFI_STATUS
206 EFIAPI
207 FvbProtocolEraseBlocks (
208 IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
209 ...
210 )
211 ;
212
213 #endif