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
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.
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.
23 * Other names and brands may be claimed as the property of others.
27 #ifndef _WIN_NT_BLOCK_IO_H_
28 #define _WIN_NT_BLOCK_IO_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>
38 // The Library classes this module consumes
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>
48 #define FILENAME_BUFFER_SIZE 80
51 // Language supported for driverconfiguration protocol
53 #define LANGUAGESUPPORTED "eng"
57 EfiWinNtPhysicalDisks
,
59 } WIN_NT_RAW_DISK_DEVICE_TYPE
;
61 #define WIN_NT_BLOCK_IO_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'b', 'k')
67 CHAR16 Filename
[FILENAME_BUFFER_SIZE
];
73 WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType
;
77 UINT64 NumberOfBlocks
;
80 EFI_BLOCK_IO_PROTOCOL BlockIo
;
81 EFI_BLOCK_IO_MEDIA Media
;
83 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
85 EFI_WIN_NT_THUNK_PROTOCOL
*WinNtThunk
;
87 } WIN_NT_BLOCK_IO_PRIVATE
;
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)
92 #define LIST_BUFFER_SIZE 512
95 // Block I/O Global Variables
97 extern EFI_DRIVER_BINDING_PROTOCOL gWinNtBlockIoDriverBinding
;
98 extern EFI_COMPONENT_NAME_PROTOCOL gWinNtBlockIoComponentName
;
99 extern EFI_DRIVER_CONFIGURATION_PROTOCOL gWinNtBlockIoDriverConfiguration
;
100 extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL gWinNtBlockIoDriverDiagnostics
;
103 // EFI Driver Binding Functions
107 WinNtBlockIoDriverBindingSupported (
108 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
109 IN EFI_HANDLE Handle
,
110 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
116 TODO: Add function description
120 This - TODO: add argument description
121 Handle - TODO: add argument description
122 RemainingDevicePath - TODO: add argument description
126 TODO: add return values
133 WinNtBlockIoDriverBindingStart (
134 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
135 IN EFI_HANDLE Handle
,
136 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
142 TODO: Add function description
146 This - TODO: add argument description
147 Handle - TODO: add argument description
148 RemainingDevicePath - TODO: add argument description
152 TODO: add return values
159 WinNtBlockIoDriverBindingStop (
160 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
161 IN EFI_HANDLE Handle
,
162 IN UINTN NumberOfChildren
,
163 IN EFI_HANDLE
*ChildHandleBuffer
169 TODO: Add function description
173 This - TODO: add argument description
174 Handle - TODO: add argument description
175 NumberOfChildren - TODO: add argument description
176 ChildHandleBuffer - TODO: add argument description
180 TODO: add return values
186 // Block IO protocol member functions
191 WinNtBlockIoReadBlocks (
192 IN EFI_BLOCK_IO_PROTOCOL
*This
,
202 TODO: Add function description
206 This - TODO: add argument description
207 MediaId - TODO: add argument description
208 Lba - TODO: add argument description
209 BufferSize - TODO: add argument description
210 Buffer - TODO: add argument description
214 TODO: add return values
222 WinNtBlockIoWriteBlocks (
223 IN EFI_BLOCK_IO_PROTOCOL
*This
,
233 TODO: Add function description
237 This - TODO: add argument description
238 MediaId - TODO: add argument description
239 Lba - TODO: add argument description
240 BufferSize - TODO: add argument description
241 Buffer - TODO: add argument description
245 TODO: add return values
253 WinNtBlockIoFlushBlocks (
254 IN EFI_BLOCK_IO_PROTOCOL
*This
260 TODO: Add function description
264 This - TODO: add argument description
268 TODO: add return values
276 WinNtBlockIoResetBlock (
277 IN EFI_BLOCK_IO_PROTOCOL
*This
,
278 IN BOOLEAN ExtendedVerification
284 TODO: Add function description
288 This - TODO: add argument description
289 ExtendedVerification - TODO: add argument description
293 TODO: add return values
299 // Private Worker functions
303 WinNtBlockIoCreateMapping (
304 IN EFI_WIN_NT_IO_PROTOCOL
*WinNtIo
,
305 IN EFI_HANDLE EfiDeviceHandle
,
308 IN BOOLEAN RemovableMedia
,
309 IN UINTN NumberOfBlocks
,
311 IN WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType
317 TODO: Add function description
321 WinNtIo - TODO: add argument description
322 EfiDeviceHandle - TODO: add argument description
323 Filename - TODO: add argument description
324 ReadOnly - TODO: add argument description
325 RemovableMedia - TODO: add argument description
326 NumberOfBlocks - TODO: add argument description
327 BlockSize - TODO: add argument description
328 DeviceType - TODO: add argument description
332 TODO: add return values
339 WinNtBlockIoReadWriteCommon (
340 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
,
351 TODO: Add function description
355 Private - TODO: add argument description
356 MediaId - TODO: add argument description
357 Lba - TODO: add argument description
358 BufferSize - TODO: add argument description
359 Buffer - TODO: add argument description
360 CallerName - TODO: add argument description
364 TODO: add return values
372 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
378 TODO: Add function description
382 Private - TODO: add argument description
386 TODO: add return values
393 WinNtBlockIoOpenDevice (
394 WIN_NT_BLOCK_IO_PRIVATE
*Private
400 TODO: Add function description
404 Private - TODO: add argument description
408 TODO: add return values
415 GetNextElementPastTerminator (
416 IN CHAR16
*EnvironmentVariable
,
423 TODO: Add function description
427 EnvironmentVariable - TODO: add argument description
428 Terminator - TODO: add argument description
432 TODO: add return values
441 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
,
442 IN INT64 DistanceToMove
,
443 OUT UINT64
*NewFilePointer
,
450 TODO: Add function description
454 Private - TODO: add argument description
455 DistanceToMove - TODO: add argument description
456 NewFilePointer - TODO: add argument description
457 MoveMethod - TODO: add argument description
461 TODO: add return values
474 TODO: Add function description
478 String - TODO: add argument description
482 TODO: add return values