Fix VS 2005 compatibility issue
[mirror_edk2.git] / EdkNt32Pkg / Dxe / WinNtThunk / Bus / BlockIo / WinNtBlockIo.h
CommitLineData
878ddf1f 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 WinNtBlockIo.h\r
15\r
16Abstract:\r
17\r
18 Produce block IO abstractions for real devices on your PC using Win32 APIs.\r
19 The configuration of what devices to mount or emulate comes from NT \r
20 environment variables. The variables must be visible to the Microsoft* \r
21 Developer Studio for them to work.\r
22\r
23 * Other names and brands may be claimed as the property of others.\r
24\r
25--*/\r
26\r
27#ifndef _WIN_NT_BLOCK_IO_H_\r
28#define _WIN_NT_BLOCK_IO_H_\r
29\r
30\r
31\r
32#define FILENAME_BUFFER_SIZE 80\r
33\r
34//\r
35// Language supported for driverconfiguration protocol\r
36//\r
37#define LANGUAGESUPPORTED "eng"\r
38\r
39typedef enum {\r
40 EfiWinNtVirtualDisks,\r
41 EfiWinNtPhysicalDisks,\r
42 EifWinNtMaxTypeDisks\r
43} WIN_NT_RAW_DISK_DEVICE_TYPE;\r
44\r
45#define WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'b', 'k')\r
46typedef struct {\r
47 UINTN Signature;\r
48\r
49 EFI_LOCK Lock;\r
50\r
51 CHAR16 Filename[FILENAME_BUFFER_SIZE];\r
52 UINTN ReadMode;\r
53 UINTN ShareMode;\r
54 UINTN OpenMode;\r
55\r
56 HANDLE NtHandle;\r
57 WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType;\r
58\r
59 UINT64 LastBlock;\r
60 UINTN BlockSize;\r
61 UINT64 NumberOfBlocks;\r
62\r
63 EFI_HANDLE EfiHandle;\r
64 EFI_BLOCK_IO_PROTOCOL BlockIo;\r
65 EFI_BLOCK_IO_MEDIA Media;\r
66\r
67 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
68\r
69 EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;\r
70\r
71} WIN_NT_BLOCK_IO_PRIVATE;\r
72\r
73#define WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \\r
74 CR(a, WIN_NT_BLOCK_IO_PRIVATE, BlockIo, WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE)\r
75\r
76#define LIST_BUFFER_SIZE 512\r
77\r
78//\r
79// Block I/O Global Variables\r
80//\r
81extern EFI_DRIVER_BINDING_PROTOCOL gWinNtBlockIoDriverBinding;\r
82extern EFI_COMPONENT_NAME_PROTOCOL gWinNtBlockIoComponentName;\r
83extern EFI_DRIVER_CONFIGURATION_PROTOCOL gWinNtBlockIoDriverConfiguration;\r
84extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics;\r
85\r
86//\r
87// EFI Driver Binding Functions\r
88//\r
89EFI_STATUS\r
90EFIAPI\r
91WinNtBlockIoDriverBindingSupported (\r
92 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
93 IN EFI_HANDLE Handle,\r
94 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
95 )\r
96/*++\r
97\r
98Routine Description:\r
99\r
100 TODO: Add function description\r
101\r
102Arguments:\r
103\r
104 This - TODO: add argument description\r
105 Handle - TODO: add argument description\r
106 RemainingDevicePath - TODO: add argument description\r
107\r
108Returns:\r
109\r
110 TODO: add return values\r
111\r
112--*/\r
113;\r
114\r
115EFI_STATUS\r
116EFIAPI\r
117WinNtBlockIoDriverBindingStart (\r
118 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
119 IN EFI_HANDLE Handle,\r
120 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
121 )\r
122/*++\r
123\r
124Routine Description:\r
125\r
126 TODO: Add function description\r
127\r
128Arguments:\r
129\r
130 This - TODO: add argument description\r
131 Handle - TODO: add argument description\r
132 RemainingDevicePath - TODO: add argument description\r
133\r
134Returns:\r
135\r
136 TODO: add return values\r
137\r
138--*/\r
139;\r
140\r
141EFI_STATUS\r
142EFIAPI\r
143WinNtBlockIoDriverBindingStop (\r
144 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
145 IN EFI_HANDLE Handle,\r
146 IN UINTN NumberOfChildren,\r
147 IN EFI_HANDLE *ChildHandleBuffer\r
148 )\r
149/*++\r
150\r
151Routine Description:\r
152\r
153 TODO: Add function description\r
154\r
155Arguments:\r
156\r
157 This - TODO: add argument description\r
158 Handle - TODO: add argument description\r
159 NumberOfChildren - TODO: add argument description\r
160 ChildHandleBuffer - TODO: add argument description\r
161\r
162Returns:\r
163\r
164 TODO: add return values\r
165\r
166--*/\r
167;\r
168\r
169//\r
170// Block IO protocol member functions\r
171//\r
172STATIC\r
173EFI_STATUS\r
174EFIAPI\r
175WinNtBlockIoReadBlocks (\r
176 IN EFI_BLOCK_IO_PROTOCOL *This,\r
177 IN UINT32 MediaId,\r
178 IN EFI_LBA Lba,\r
179 IN UINTN BufferSize,\r
180 OUT VOID *Buffer\r
181 )\r
182/*++\r
183\r
184Routine Description:\r
185\r
186 TODO: Add function description\r
187\r
188Arguments:\r
189\r
190 This - TODO: add argument description\r
191 MediaId - TODO: add argument description\r
192 Lba - TODO: add argument description\r
193 BufferSize - TODO: add argument description\r
194 Buffer - TODO: add argument description\r
195\r
196Returns:\r
197\r
198 TODO: add return values\r
199\r
200--*/\r
201;\r
202\r
203STATIC\r
204EFI_STATUS\r
205EFIAPI\r
206WinNtBlockIoWriteBlocks (\r
207 IN EFI_BLOCK_IO_PROTOCOL *This,\r
208 IN UINT32 MediaId,\r
209 IN EFI_LBA Lba,\r
210 IN UINTN BufferSize,\r
211 IN VOID *Buffer\r
212 )\r
213/*++\r
214\r
215Routine Description:\r
216\r
217 TODO: Add function description\r
218\r
219Arguments:\r
220\r
221 This - TODO: add argument description\r
222 MediaId - TODO: add argument description\r
223 Lba - TODO: add argument description\r
224 BufferSize - TODO: add argument description\r
225 Buffer - TODO: add argument description\r
226\r
227Returns:\r
228\r
229 TODO: add return values\r
230\r
231--*/\r
232;\r
233\r
234STATIC\r
235EFI_STATUS\r
236EFIAPI\r
237WinNtBlockIoFlushBlocks (\r
238 IN EFI_BLOCK_IO_PROTOCOL *This\r
239 )\r
240/*++\r
241\r
242Routine Description:\r
243\r
244 TODO: Add function description\r
245\r
246Arguments:\r
247\r
248 This - TODO: add argument description\r
249\r
250Returns:\r
251\r
252 TODO: add return values\r
253\r
254--*/\r
255;\r
256\r
257STATIC\r
258EFI_STATUS\r
259EFIAPI\r
260WinNtBlockIoResetBlock (\r
261 IN EFI_BLOCK_IO_PROTOCOL *This,\r
262 IN BOOLEAN ExtendedVerification\r
263 )\r
264/*++\r
265\r
266Routine Description:\r
267\r
268 TODO: Add function description\r
269\r
270Arguments:\r
271\r
272 This - TODO: add argument description\r
273 ExtendedVerification - TODO: add argument description\r
274\r
275Returns:\r
276\r
277 TODO: add return values\r
278\r
279--*/\r
280;\r
281\r
282//\r
283// Private Worker functions\r
284//\r
285STATIC\r
286EFI_STATUS\r
287WinNtBlockIoCreateMapping (\r
288 IN EFI_WIN_NT_IO_PROTOCOL *WinNtIo,\r
289 IN EFI_HANDLE EfiDeviceHandle,\r
290 IN CHAR16 *Filename,\r
291 IN BOOLEAN ReadOnly,\r
292 IN BOOLEAN RemovableMedia,\r
293 IN UINTN NumberOfBlocks,\r
294 IN UINTN BlockSize,\r
295 IN WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType\r
296 )\r
297/*++\r
298\r
299Routine Description:\r
300\r
301 TODO: Add function description\r
302\r
303Arguments:\r
304\r
305 WinNtIo - TODO: add argument description\r
306 EfiDeviceHandle - TODO: add argument description\r
307 Filename - TODO: add argument description\r
308 ReadOnly - TODO: add argument description\r
309 RemovableMedia - TODO: add argument description\r
310 NumberOfBlocks - TODO: add argument description\r
311 BlockSize - TODO: add argument description\r
312 DeviceType - TODO: add argument description\r
313\r
314Returns:\r
315\r
316 TODO: add return values\r
317\r
318--*/\r
319;\r
320\r
321STATIC\r
322EFI_STATUS\r
323WinNtBlockIoReadWriteCommon (\r
324 IN WIN_NT_BLOCK_IO_PRIVATE *Private,\r
325 IN UINT32 MediaId,\r
326 IN EFI_LBA Lba,\r
327 IN UINTN BufferSize,\r
328 IN VOID *Buffer,\r
329 IN CHAR8 *CallerName\r
330 )\r
331/*++\r
332\r
333Routine Description:\r
334\r
335 TODO: Add function description\r
336\r
337Arguments:\r
338\r
339 Private - TODO: add argument description\r
340 MediaId - TODO: add argument description\r
341 Lba - TODO: add argument description\r
342 BufferSize - TODO: add argument description\r
343 Buffer - TODO: add argument description\r
344 CallerName - TODO: add argument description\r
345\r
346Returns:\r
347\r
348 TODO: add return values\r
349\r
350--*/\r
351;\r
352\r
353STATIC\r
354EFI_STATUS\r
355WinNtBlockIoError (\r
356 IN WIN_NT_BLOCK_IO_PRIVATE *Private\r
357 )\r
358/*++\r
359\r
360Routine Description:\r
361\r
362 TODO: Add function description\r
363\r
364Arguments:\r
365\r
366 Private - TODO: add argument description\r
367\r
368Returns:\r
369\r
370 TODO: add return values\r
371\r
372--*/\r
373;\r
374\r
375STATIC\r
376EFI_STATUS\r
377WinNtBlockIoOpenDevice (\r
378 WIN_NT_BLOCK_IO_PRIVATE *Private\r
379 )\r
380/*++\r
381\r
382Routine Description:\r
383\r
384 TODO: Add function description\r
385\r
386Arguments:\r
387\r
388 Private - TODO: add argument description\r
389\r
390Returns:\r
391\r
392 TODO: add return values\r
393\r
394--*/\r
395;\r
396\r
397STATIC\r
398CHAR16 *\r
399GetNextElementPastTerminator (\r
400 IN CHAR16 *EnvironmentVariable,\r
401 IN CHAR16 Terminator\r
402 )\r
403/*++\r
404\r
405Routine Description:\r
406\r
407 TODO: Add function description\r
408\r
409Arguments:\r
410\r
411 EnvironmentVariable - TODO: add argument description\r
412 Terminator - TODO: add argument description\r
413\r
414Returns:\r
415\r
416 TODO: add return values\r
417\r
418--*/\r
419;\r
420\r
421\r
422\r
423EFI_STATUS\r
424SetFilePointer64 (\r
425 IN WIN_NT_BLOCK_IO_PRIVATE *Private,\r
426 IN INT64 DistanceToMove,\r
427 OUT UINT64 *NewFilePointer,\r
428 IN DWORD MoveMethod\r
429 )\r
430/*++\r
431\r
432Routine Description:\r
433\r
434 TODO: Add function description\r
435\r
436Arguments:\r
437\r
438 Private - TODO: add argument description\r
439 DistanceToMove - TODO: add argument description\r
440 NewFilePointer - TODO: add argument description\r
441 MoveMethod - TODO: add argument description\r
442\r
443Returns:\r
444\r
445 TODO: add return values\r
446\r
447--*/\r
448;\r
449\r
450UINTN\r
451Atoi (\r
452 CHAR16 *String\r
453 )\r
454/*++\r
455\r
456Routine Description:\r
457\r
458 TODO: Add function description\r
459\r
460Arguments:\r
461\r
462 String - TODO: add argument description\r
463\r
464Returns:\r
465\r
466 TODO: add return values\r
467\r
468--*/\r
469;\r
470\r
471#endif\r