]> git.proxmox.com Git - mirror_edk2.git/blob - Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.h
Update to support to produce Component Name and & Component Name 2 protocol based...
[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
103 //
104 // EFI Driver Binding Functions
105 //
106 EFI_STATUS
107 EFIAPI
108 WinNtBlockIoDriverBindingSupported (
109 IN EFI_DRIVER_BINDING_PROTOCOL *This,
110 IN EFI_HANDLE Handle,
111 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
112 )
113 /*++
114
115 Routine Description:
116
117 TODO: Add function description
118
119 Arguments:
120
121 This - TODO: add argument description
122 Handle - TODO: add argument description
123 RemainingDevicePath - TODO: add argument description
124
125 Returns:
126
127 TODO: add return values
128
129 --*/
130 ;
131
132 EFI_STATUS
133 EFIAPI
134 WinNtBlockIoDriverBindingStart (
135 IN EFI_DRIVER_BINDING_PROTOCOL *This,
136 IN EFI_HANDLE Handle,
137 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
138 )
139 /*++
140
141 Routine Description:
142
143 TODO: Add function description
144
145 Arguments:
146
147 This - TODO: add argument description
148 Handle - TODO: add argument description
149 RemainingDevicePath - TODO: add argument description
150
151 Returns:
152
153 TODO: add return values
154
155 --*/
156 ;
157
158 EFI_STATUS
159 EFIAPI
160 WinNtBlockIoDriverBindingStop (
161 IN EFI_DRIVER_BINDING_PROTOCOL *This,
162 IN EFI_HANDLE Handle,
163 IN UINTN NumberOfChildren,
164 IN EFI_HANDLE *ChildHandleBuffer
165 )
166 /*++
167
168 Routine Description:
169
170 TODO: Add function description
171
172 Arguments:
173
174 This - TODO: add argument description
175 Handle - TODO: add argument description
176 NumberOfChildren - TODO: add argument description
177 ChildHandleBuffer - TODO: add argument description
178
179 Returns:
180
181 TODO: add return values
182
183 --*/
184 ;
185
186 //
187 // Block IO protocol member functions
188 //
189 STATIC
190 EFI_STATUS
191 EFIAPI
192 WinNtBlockIoReadBlocks (
193 IN EFI_BLOCK_IO_PROTOCOL *This,
194 IN UINT32 MediaId,
195 IN EFI_LBA Lba,
196 IN UINTN BufferSize,
197 OUT VOID *Buffer
198 )
199 /*++
200
201 Routine Description:
202
203 TODO: Add function description
204
205 Arguments:
206
207 This - TODO: add argument description
208 MediaId - TODO: add argument description
209 Lba - TODO: add argument description
210 BufferSize - TODO: add argument description
211 Buffer - TODO: add argument description
212
213 Returns:
214
215 TODO: add return values
216
217 --*/
218 ;
219
220 STATIC
221 EFI_STATUS
222 EFIAPI
223 WinNtBlockIoWriteBlocks (
224 IN EFI_BLOCK_IO_PROTOCOL *This,
225 IN UINT32 MediaId,
226 IN EFI_LBA Lba,
227 IN UINTN BufferSize,
228 IN VOID *Buffer
229 )
230 /*++
231
232 Routine Description:
233
234 TODO: Add function description
235
236 Arguments:
237
238 This - TODO: add argument description
239 MediaId - TODO: add argument description
240 Lba - TODO: add argument description
241 BufferSize - TODO: add argument description
242 Buffer - TODO: add argument description
243
244 Returns:
245
246 TODO: add return values
247
248 --*/
249 ;
250
251 STATIC
252 EFI_STATUS
253 EFIAPI
254 WinNtBlockIoFlushBlocks (
255 IN EFI_BLOCK_IO_PROTOCOL *This
256 )
257 /*++
258
259 Routine Description:
260
261 TODO: Add function description
262
263 Arguments:
264
265 This - TODO: add argument description
266
267 Returns:
268
269 TODO: add return values
270
271 --*/
272 ;
273
274 STATIC
275 EFI_STATUS
276 EFIAPI
277 WinNtBlockIoResetBlock (
278 IN EFI_BLOCK_IO_PROTOCOL *This,
279 IN BOOLEAN ExtendedVerification
280 )
281 /*++
282
283 Routine Description:
284
285 TODO: Add function description
286
287 Arguments:
288
289 This - TODO: add argument description
290 ExtendedVerification - TODO: add argument description
291
292 Returns:
293
294 TODO: add return values
295
296 --*/
297 ;
298
299 //
300 // Private Worker functions
301 //
302 STATIC
303 EFI_STATUS
304 WinNtBlockIoCreateMapping (
305 IN EFI_WIN_NT_IO_PROTOCOL *WinNtIo,
306 IN EFI_HANDLE EfiDeviceHandle,
307 IN CHAR16 *Filename,
308 IN BOOLEAN ReadOnly,
309 IN BOOLEAN RemovableMedia,
310 IN UINTN NumberOfBlocks,
311 IN UINTN BlockSize,
312 IN WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType
313 )
314 /*++
315
316 Routine Description:
317
318 TODO: Add function description
319
320 Arguments:
321
322 WinNtIo - TODO: add argument description
323 EfiDeviceHandle - TODO: add argument description
324 Filename - TODO: add argument description
325 ReadOnly - TODO: add argument description
326 RemovableMedia - TODO: add argument description
327 NumberOfBlocks - TODO: add argument description
328 BlockSize - TODO: add argument description
329 DeviceType - TODO: add argument description
330
331 Returns:
332
333 TODO: add return values
334
335 --*/
336 ;
337
338 STATIC
339 EFI_STATUS
340 WinNtBlockIoReadWriteCommon (
341 IN WIN_NT_BLOCK_IO_PRIVATE *Private,
342 IN UINT32 MediaId,
343 IN EFI_LBA Lba,
344 IN UINTN BufferSize,
345 IN VOID *Buffer,
346 IN CHAR8 *CallerName
347 )
348 /*++
349
350 Routine Description:
351
352 TODO: Add function description
353
354 Arguments:
355
356 Private - TODO: add argument description
357 MediaId - TODO: add argument description
358 Lba - TODO: add argument description
359 BufferSize - TODO: add argument description
360 Buffer - TODO: add argument description
361 CallerName - TODO: add argument description
362
363 Returns:
364
365 TODO: add return values
366
367 --*/
368 ;
369
370 STATIC
371 EFI_STATUS
372 WinNtBlockIoError (
373 IN WIN_NT_BLOCK_IO_PRIVATE *Private
374 )
375 /*++
376
377 Routine Description:
378
379 TODO: Add function description
380
381 Arguments:
382
383 Private - TODO: add argument description
384
385 Returns:
386
387 TODO: add return values
388
389 --*/
390 ;
391
392 STATIC
393 EFI_STATUS
394 WinNtBlockIoOpenDevice (
395 WIN_NT_BLOCK_IO_PRIVATE *Private
396 )
397 /*++
398
399 Routine Description:
400
401 TODO: Add function description
402
403 Arguments:
404
405 Private - TODO: add argument description
406
407 Returns:
408
409 TODO: add return values
410
411 --*/
412 ;
413
414 STATIC
415 CHAR16 *
416 GetNextElementPastTerminator (
417 IN CHAR16 *EnvironmentVariable,
418 IN CHAR16 Terminator
419 )
420 /*++
421
422 Routine Description:
423
424 TODO: Add function description
425
426 Arguments:
427
428 EnvironmentVariable - TODO: add argument description
429 Terminator - TODO: add argument description
430
431 Returns:
432
433 TODO: add return values
434
435 --*/
436 ;
437
438
439
440 EFI_STATUS
441 SetFilePointer64 (
442 IN WIN_NT_BLOCK_IO_PRIVATE *Private,
443 IN INT64 DistanceToMove,
444 OUT UINT64 *NewFilePointer,
445 IN DWORD MoveMethod
446 )
447 /*++
448
449 Routine Description:
450
451 TODO: Add function description
452
453 Arguments:
454
455 Private - TODO: add argument description
456 DistanceToMove - TODO: add argument description
457 NewFilePointer - TODO: add argument description
458 MoveMethod - TODO: add argument description
459
460 Returns:
461
462 TODO: add return values
463
464 --*/
465 ;
466
467 UINTN
468 Atoi (
469 CHAR16 *String
470 )
471 /*++
472
473 Routine Description:
474
475 TODO: Add function description
476
477 Arguments:
478
479 String - TODO: add argument description
480
481 Returns:
482
483 TODO: add return values
484
485 --*/
486 ;
487
488 #endif