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