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
;
104 // EFI Driver Binding Functions
108 WinNtBlockIoDriverBindingSupported (
109 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
110 IN EFI_HANDLE Handle
,
111 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
117 TODO: Add function description
121 This - TODO: add argument description
122 Handle - TODO: add argument description
123 RemainingDevicePath - TODO: add argument description
127 TODO: add return values
134 WinNtBlockIoDriverBindingStart (
135 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
136 IN EFI_HANDLE Handle
,
137 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
143 TODO: Add function description
147 This - TODO: add argument description
148 Handle - TODO: add argument description
149 RemainingDevicePath - TODO: add argument description
153 TODO: add return values
160 WinNtBlockIoDriverBindingStop (
161 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
162 IN EFI_HANDLE Handle
,
163 IN UINTN NumberOfChildren
,
164 IN EFI_HANDLE
*ChildHandleBuffer
170 TODO: Add function description
174 This - TODO: add argument description
175 Handle - TODO: add argument description
176 NumberOfChildren - TODO: add argument description
177 ChildHandleBuffer - TODO: add argument description
181 TODO: add return values
187 // Block IO protocol member functions
192 WinNtBlockIoReadBlocks (
193 IN EFI_BLOCK_IO_PROTOCOL
*This
,
203 TODO: Add function description
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
215 TODO: add return values
223 WinNtBlockIoWriteBlocks (
224 IN EFI_BLOCK_IO_PROTOCOL
*This
,
234 TODO: Add function description
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
246 TODO: add return values
254 WinNtBlockIoFlushBlocks (
255 IN EFI_BLOCK_IO_PROTOCOL
*This
261 TODO: Add function description
265 This - TODO: add argument description
269 TODO: add return values
277 WinNtBlockIoResetBlock (
278 IN EFI_BLOCK_IO_PROTOCOL
*This
,
279 IN BOOLEAN ExtendedVerification
285 TODO: Add function description
289 This - TODO: add argument description
290 ExtendedVerification - TODO: add argument description
294 TODO: add return values
300 // Private Worker functions
304 WinNtBlockIoCreateMapping (
305 IN EFI_WIN_NT_IO_PROTOCOL
*WinNtIo
,
306 IN EFI_HANDLE EfiDeviceHandle
,
309 IN BOOLEAN RemovableMedia
,
310 IN UINTN NumberOfBlocks
,
312 IN WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType
318 TODO: Add function description
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
333 TODO: add return values
340 WinNtBlockIoReadWriteCommon (
341 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
,
352 TODO: Add function description
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
365 TODO: add return values
373 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
379 TODO: Add function description
383 Private - TODO: add argument description
387 TODO: add return values
394 WinNtBlockIoOpenDevice (
395 WIN_NT_BLOCK_IO_PRIVATE
*Private
401 TODO: Add function description
405 Private - TODO: add argument description
409 TODO: add return values
416 GetNextElementPastTerminator (
417 IN CHAR16
*EnvironmentVariable
,
424 TODO: Add function description
428 EnvironmentVariable - TODO: add argument description
429 Terminator - TODO: add argument description
433 TODO: add return values
442 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
,
443 IN INT64 DistanceToMove
,
444 OUT UINT64
*NewFilePointer
,
451 TODO: Add function description
455 Private - TODO: add argument description
456 DistanceToMove - TODO: add argument description
457 NewFilePointer - TODO: add argument description
458 MoveMethod - TODO: add argument description
462 TODO: add return values
475 TODO: Add function description
479 String - TODO: add argument description
483 TODO: add return values