3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
12 Produce block IO abstractions for real devices on your PC using Win32 APIs.
13 The configuration of what devices to mount or emulate comes from NT
14 environment variables. The variables must be visible to the Microsoft*
15 Developer Studio for them to work.
17 * Other names and brands may be claimed as the property of others.
21 #ifndef _WIN_NT_BLOCK_IO_H_
22 #define _WIN_NT_BLOCK_IO_H_
26 #include <Protocol/WinNtThunk.h>
27 #include <Protocol/WinNtIo.h>
28 #include <Protocol/BlockIo.h>
29 #include <Protocol/ComponentName.h>
30 #include <Protocol/DriverBinding.h>
32 // The Library classes this module consumes
34 #include <Library/DebugLib.h>
35 #include <Library/BaseLib.h>
36 #include <Library/UefiDriverEntryPoint.h>
37 #include <Library/UefiLib.h>
38 #include <Library/BaseMemoryLib.h>
39 #include <Library/UefiBootServicesTableLib.h>
40 #include <Library/MemoryAllocationLib.h>
42 #define FILENAME_BUFFER_SIZE 80
45 // Language supported for driverconfiguration protocol
47 #define LANGUAGESUPPORTED "eng"
51 EfiWinNtPhysicalDisks
,
53 } WIN_NT_RAW_DISK_DEVICE_TYPE
;
55 #define WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE SIGNATURE_32 ('N', 'T', 'b', 'k')
61 CHAR16 Filename
[FILENAME_BUFFER_SIZE
];
67 WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType
;
71 UINT64 NumberOfBlocks
;
74 EFI_BLOCK_IO_PROTOCOL BlockIo
;
75 EFI_BLOCK_IO_MEDIA Media
;
77 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
79 EFI_WIN_NT_THUNK_PROTOCOL
*WinNtThunk
;
81 } WIN_NT_BLOCK_IO_PRIVATE
;
83 #define WIN_NT_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
84 CR(a, WIN_NT_BLOCK_IO_PRIVATE, BlockIo, WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE)
86 #define LIST_BUFFER_SIZE 512
89 // Block I/O Global Variables
91 extern EFI_DRIVER_BINDING_PROTOCOL gWinNtBlockIoDriverBinding
;
92 extern EFI_COMPONENT_NAME_PROTOCOL gWinNtBlockIoComponentName
;
93 extern EFI_COMPONENT_NAME2_PROTOCOL gWinNtBlockIoComponentName2
;
94 extern EFI_DRIVER_CONFIGURATION_PROTOCOL gWinNtBlockIoDriverConfiguration
;
95 extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics
;
96 extern EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gWinNtBlockIoDriverDiagnostics2
;
99 // EFI Driver Binding Functions
103 WinNtBlockIoDriverBindingSupported (
104 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
105 IN EFI_HANDLE Handle
,
106 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
112 TODO: Add function description
116 This - TODO: add argument description
117 Handle - TODO: add argument description
118 RemainingDevicePath - TODO: add argument description
122 TODO: add return values
129 WinNtBlockIoDriverBindingStart (
130 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
131 IN EFI_HANDLE Handle
,
132 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
138 TODO: Add function description
142 This - TODO: add argument description
143 Handle - TODO: add argument description
144 RemainingDevicePath - TODO: add argument description
148 TODO: add return values
155 WinNtBlockIoDriverBindingStop (
156 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
157 IN EFI_HANDLE Handle
,
158 IN UINTN NumberOfChildren
,
159 IN EFI_HANDLE
*ChildHandleBuffer
165 TODO: Add function description
169 This - TODO: add argument description
170 Handle - TODO: add argument description
171 NumberOfChildren - TODO: add argument description
172 ChildHandleBuffer - TODO: add argument description
176 TODO: add return values
182 // Block IO protocol member functions
186 WinNtBlockIoReadBlocks (
187 IN EFI_BLOCK_IO_PROTOCOL
*This
,
197 TODO: Add function description
201 This - TODO: add argument description
202 MediaId - TODO: add argument description
203 Lba - TODO: add argument description
204 BufferSize - TODO: add argument description
205 Buffer - TODO: add argument description
209 TODO: add return values
216 WinNtBlockIoWriteBlocks (
217 IN EFI_BLOCK_IO_PROTOCOL
*This
,
227 TODO: Add function description
231 This - TODO: add argument description
232 MediaId - TODO: add argument description
233 Lba - TODO: add argument description
234 BufferSize - TODO: add argument description
235 Buffer - TODO: add argument description
239 TODO: add return values
246 WinNtBlockIoFlushBlocks (
247 IN EFI_BLOCK_IO_PROTOCOL
*This
253 TODO: Add function description
257 This - TODO: add argument description
261 TODO: add return values
268 WinNtBlockIoResetBlock (
269 IN EFI_BLOCK_IO_PROTOCOL
*This
,
270 IN BOOLEAN ExtendedVerification
276 TODO: Add function description
280 This - TODO: add argument description
281 ExtendedVerification - TODO: add argument description
285 TODO: add return values
291 // Private Worker functions
294 WinNtBlockIoCreateMapping (
295 IN EFI_WIN_NT_IO_PROTOCOL
*WinNtIo
,
296 IN EFI_HANDLE EfiDeviceHandle
,
299 IN BOOLEAN RemovableMedia
,
300 IN UINTN NumberOfBlocks
,
302 IN WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType
308 TODO: Add function description
312 WinNtIo - TODO: add argument description
313 EfiDeviceHandle - TODO: add argument description
314 Filename - TODO: add argument description
315 ReadOnly - TODO: add argument description
316 RemovableMedia - TODO: add argument description
317 NumberOfBlocks - TODO: add argument description
318 BlockSize - TODO: add argument description
319 DeviceType - TODO: add argument description
323 TODO: add return values
329 WinNtBlockIoReadWriteCommon (
330 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
,
341 TODO: Add function description
345 Private - TODO: add argument description
346 MediaId - TODO: add argument description
347 Lba - TODO: add argument description
348 BufferSize - TODO: add argument description
349 Buffer - TODO: add argument description
350 CallerName - TODO: add argument description
354 TODO: add return values
361 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
367 TODO: Add function description
371 Private - TODO: add argument description
375 TODO: add return values
381 WinNtBlockIoOpenDevice (
382 WIN_NT_BLOCK_IO_PRIVATE
*Private
388 TODO: Add function description
392 Private - TODO: add argument description
396 TODO: add return values
402 GetNextElementPastTerminator (
403 IN CHAR16
*EnvironmentVariable
,
410 TODO: Add function description
414 EnvironmentVariable - TODO: add argument description
415 Terminator - TODO: add argument description
419 TODO: add return values
428 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
,
429 IN INT64 DistanceToMove
,
430 OUT UINT64
*NewFilePointer
,
437 TODO: Add function description
441 Private - TODO: add argument description
442 DistanceToMove - TODO: add argument description
443 NewFilePointer - TODO: add argument description
444 MoveMethod - TODO: add argument description
448 TODO: add return values
461 TODO: Add function description
465 String - TODO: add argument description
469 TODO: add return values