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