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_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
;
105 // EFI Driver Binding Functions
109 WinNtBlockIoDriverBindingSupported (
110 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
111 IN EFI_HANDLE Handle
,
112 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
118 TODO: Add function description
122 This - TODO: add argument description
123 Handle - TODO: add argument description
124 RemainingDevicePath - TODO: add argument description
128 TODO: add return values
135 WinNtBlockIoDriverBindingStart (
136 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
137 IN EFI_HANDLE Handle
,
138 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
144 TODO: Add function description
148 This - TODO: add argument description
149 Handle - TODO: add argument description
150 RemainingDevicePath - TODO: add argument description
154 TODO: add return values
161 WinNtBlockIoDriverBindingStop (
162 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
163 IN EFI_HANDLE Handle
,
164 IN UINTN NumberOfChildren
,
165 IN EFI_HANDLE
*ChildHandleBuffer
171 TODO: Add function description
175 This - TODO: add argument description
176 Handle - TODO: add argument description
177 NumberOfChildren - TODO: add argument description
178 ChildHandleBuffer - TODO: add argument description
182 TODO: add return values
188 // Block IO protocol member functions
193 WinNtBlockIoReadBlocks (
194 IN EFI_BLOCK_IO_PROTOCOL
*This
,
204 TODO: Add function description
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
216 TODO: add return values
224 WinNtBlockIoWriteBlocks (
225 IN EFI_BLOCK_IO_PROTOCOL
*This
,
235 TODO: Add function description
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
247 TODO: add return values
255 WinNtBlockIoFlushBlocks (
256 IN EFI_BLOCK_IO_PROTOCOL
*This
262 TODO: Add function description
266 This - TODO: add argument description
270 TODO: add return values
278 WinNtBlockIoResetBlock (
279 IN EFI_BLOCK_IO_PROTOCOL
*This
,
280 IN BOOLEAN ExtendedVerification
286 TODO: Add function description
290 This - TODO: add argument description
291 ExtendedVerification - TODO: add argument description
295 TODO: add return values
301 // Private Worker functions
305 WinNtBlockIoCreateMapping (
306 IN EFI_WIN_NT_IO_PROTOCOL
*WinNtIo
,
307 IN EFI_HANDLE EfiDeviceHandle
,
310 IN BOOLEAN RemovableMedia
,
311 IN UINTN NumberOfBlocks
,
313 IN WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType
319 TODO: Add function description
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
334 TODO: add return values
341 WinNtBlockIoReadWriteCommon (
342 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
,
353 TODO: Add function description
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
366 TODO: add return values
374 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
380 TODO: Add function description
384 Private - TODO: add argument description
388 TODO: add return values
395 WinNtBlockIoOpenDevice (
396 WIN_NT_BLOCK_IO_PRIVATE
*Private
402 TODO: Add function description
406 Private - TODO: add argument description
410 TODO: add return values
417 GetNextElementPastTerminator (
418 IN CHAR16
*EnvironmentVariable
,
425 TODO: Add function description
429 EnvironmentVariable - TODO: add argument description
430 Terminator - TODO: add argument description
434 TODO: add return values
443 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
,
444 IN INT64 DistanceToMove
,
445 OUT UINT64
*NewFilePointer
,
452 TODO: Add function description
456 Private - TODO: add argument description
457 DistanceToMove - TODO: add argument description
458 NewFilePointer - TODO: add argument description
459 MoveMethod - TODO: add argument description
463 TODO: add return values
476 TODO: Add function description
480 String - TODO: add argument description
484 TODO: add return values