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