Incorporated the bug fix in unicode file parse
[mirror_edk2.git] / EdkUnixPkg / RuntimeDxe / FvbServices / 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 UINT8 *FvbScratchSpace[2];
42 } ESAL_FWB_GLOBAL;
43
44 //
45 // Fvb Protocol instance data
46 //
47 #define FVB_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FwVolBlockInstance, FVB_DEVICE_SIGNATURE)
48 #define FVB_EXTEND_DEVICE_FROM_THIS(a) CR (a, EFI_FW_VOL_BLOCK_DEVICE, FvbExtension, FVB_DEVICE_SIGNATURE)
49 #define FVB_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('F', 'V', 'B', 'N')
50
51 typedef struct {
52 MEMMAP_DEVICE_PATH MemMapDevPath;
53 EFI_DEVICE_PATH_PROTOCOL EndDevPath;
54 } FV_DEVICE_PATH;
55
56 typedef struct {
57 UINTN Signature;
58 FV_DEVICE_PATH DevicePath;
59 UINTN Instance;
60 EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL FwVolBlockInstance;
61 EFI_FVB_EXTENSION_PROTOCOL FvbExtension;
62 } EFI_FW_VOL_BLOCK_DEVICE;
63
64 EFI_STATUS
65 GetFvbInfo (
66 IN UINT64 FvLength,
67 OUT EFI_FIRMWARE_VOLUME_HEADER **FvbInfo
68 )
69 ;
70
71 EFI_STATUS
72 FvbReadBlock (
73 IN UINTN Instance,
74 IN EFI_LBA Lba,
75 IN UINTN BlockOffset,
76 IN OUT UINTN *NumBytes,
77 IN UINT8 *Buffer,
78 IN ESAL_FWB_GLOBAL *Global,
79 IN BOOLEAN Virtual
80 )
81 ;
82
83 EFI_STATUS
84 FvbWriteBlock (
85 IN UINTN Instance,
86 IN EFI_LBA Lba,
87 IN UINTN BlockOffset,
88 IN OUT UINTN *NumBytes,
89 IN UINT8 *Buffer,
90 IN ESAL_FWB_GLOBAL *Global,
91 IN BOOLEAN Virtual
92 )
93 ;
94
95 EFI_STATUS
96 FvbEraseBlock (
97 IN UINTN Instance,
98 IN EFI_LBA Lba,
99 IN ESAL_FWB_GLOBAL *Global,
100 IN BOOLEAN Virtual
101 )
102 ;
103
104 EFI_STATUS
105 FvbSetVolumeAttributes (
106 IN UINTN Instance,
107 IN OUT EFI_FVB_ATTRIBUTES *Attributes,
108 IN ESAL_FWB_GLOBAL *Global,
109 IN BOOLEAN Virtual
110 )
111 ;
112
113 EFI_STATUS
114 FvbGetVolumeAttributes (
115 IN UINTN Instance,
116 OUT EFI_FVB_ATTRIBUTES *Attributes,
117 IN ESAL_FWB_GLOBAL *Global,
118 IN BOOLEAN Virtual
119 )
120 ;
121
122 EFI_STATUS
123 FvbGetPhysicalAddress (
124 IN UINTN Instance,
125 OUT EFI_PHYSICAL_ADDRESS *Address,
126 IN ESAL_FWB_GLOBAL *Global,
127 IN BOOLEAN Virtual
128 )
129 ;
130
131 EFI_STATUS
132 EFIAPI
133 FvbInitialize (
134 IN EFI_HANDLE ImageHandle,
135 IN EFI_SYSTEM_TABLE *SystemTable
136 )
137 ;
138
139
140 VOID
141 EFIAPI
142 FvbClassAddressChangeEvent (
143 IN EFI_EVENT Event,
144 IN VOID *Context
145 )
146 ;
147
148 EFI_STATUS
149 FvbGetLbaAddress (
150 IN UINTN Instance,
151 IN EFI_LBA Lba,
152 OUT UINTN *LbaAddress,
153 OUT UINTN *LbaLength,
154 OUT UINTN *NumOfBlocks,
155 IN ESAL_FWB_GLOBAL *Global,
156 IN BOOLEAN Virtual
157 )
158 ;
159
160 //
161 // Protocol APIs
162 //
163 EFI_STATUS
164 EFIAPI
165 FvbProtocolGetAttributes (
166 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
167 OUT EFI_FVB_ATTRIBUTES *Attributes
168 )
169 ;
170
171 EFI_STATUS
172 EFIAPI
173 FvbProtocolSetAttributes (
174 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
175 IN OUT EFI_FVB_ATTRIBUTES *Attributes
176 )
177 ;
178
179 EFI_STATUS
180 EFIAPI
181 FvbProtocolGetPhysicalAddress (
182 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
183 OUT EFI_PHYSICAL_ADDRESS *Address
184 )
185 ;
186
187 EFI_STATUS
188 EFIAPI
189 FvbProtocolGetBlockSize (
190 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
191 IN EFI_LBA Lba,
192 OUT UINTN *BlockSize,
193 OUT UINTN *NumOfBlocks
194 )
195 ;
196
197 EFI_STATUS
198 EFIAPI
199 FvbProtocolRead (
200 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
201 IN EFI_LBA Lba,
202 IN UINTN Offset,
203 IN OUT UINTN *NumBytes,
204 IN UINT8 *Buffer
205 )
206 ;
207
208 EFI_STATUS
209 EFIAPI
210 FvbProtocolWrite (
211 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
212 IN EFI_LBA Lba,
213 IN UINTN Offset,
214 IN OUT UINTN *NumBytes,
215 IN UINT8 *Buffer
216 )
217 ;
218
219 EFI_STATUS
220 EFIAPI
221 FvbProtocolEraseBlocks (
222 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
223 ...
224 )
225 ;
226
227 EFI_STATUS
228 EFIAPI
229 FvbExtendProtocolEraseCustomBlockRange (
230 IN EFI_FVB_EXTENSION_PROTOCOL *This,
231 IN EFI_LBA StartLba,
232 IN UINTN OffsetStartLba,
233 IN EFI_LBA LastLba,
234 IN UINTN OffsetLastLba
235 )
236 ;
237
238 #endif