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