3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 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 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
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
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
252 WinNtBlockIoFlushBlocks (
253 IN EFI_BLOCK_IO_PROTOCOL
*This
259 TODO: Add function description
263 This - TODO: add argument description
267 TODO: add return values
274 WinNtBlockIoResetBlock (
275 IN EFI_BLOCK_IO_PROTOCOL
*This
,
276 IN BOOLEAN ExtendedVerification
282 TODO: Add function description
286 This - TODO: add argument description
287 ExtendedVerification - TODO: add argument description
291 TODO: add return values
297 // Private Worker functions
300 WinNtBlockIoCreateMapping (
301 IN EFI_WIN_NT_IO_PROTOCOL
*WinNtIo
,
302 IN EFI_HANDLE EfiDeviceHandle
,
305 IN BOOLEAN RemovableMedia
,
306 IN UINTN NumberOfBlocks
,
308 IN WIN_NT_RAW_DISK_DEVICE_TYPE DeviceType
314 TODO: Add function description
318 WinNtIo - TODO: add argument description
319 EfiDeviceHandle - TODO: add argument description
320 Filename - TODO: add argument description
321 ReadOnly - TODO: add argument description
322 RemovableMedia - TODO: add argument description
323 NumberOfBlocks - TODO: add argument description
324 BlockSize - TODO: add argument description
325 DeviceType - TODO: add argument description
329 TODO: add return values
335 WinNtBlockIoReadWriteCommon (
336 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
,
347 TODO: Add function description
351 Private - TODO: add argument description
352 MediaId - TODO: add argument description
353 Lba - TODO: add argument description
354 BufferSize - TODO: add argument description
355 Buffer - TODO: add argument description
356 CallerName - TODO: add argument description
360 TODO: add return values
367 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
373 TODO: Add function description
377 Private - TODO: add argument description
381 TODO: add return values
387 WinNtBlockIoOpenDevice (
388 WIN_NT_BLOCK_IO_PRIVATE
*Private
394 TODO: Add function description
398 Private - TODO: add argument description
402 TODO: add return values
408 GetNextElementPastTerminator (
409 IN CHAR16
*EnvironmentVariable
,
416 TODO: Add function description
420 EnvironmentVariable - TODO: add argument description
421 Terminator - TODO: add argument description
425 TODO: add return values
434 IN WIN_NT_BLOCK_IO_PRIVATE
*Private
,
435 IN INT64 DistanceToMove
,
436 OUT UINT64
*NewFilePointer
,
443 TODO: Add function description
447 Private - TODO: add argument description
448 DistanceToMove - TODO: add argument description
449 NewFilePointer - TODO: add argument description
450 MoveMethod - TODO: add argument description
454 TODO: add return values
467 TODO: Add function description
471 String - TODO: add argument description
475 TODO: add return values