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