2 DiskIo driver that layers it's self on every Block IO protocol in the system.
3 DiskIo converts a block oriented device to a byte oriented device.
5 Copyright (c) 2006 - 2007, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include <Protocol/BlockIo.h>
21 #include <Protocol/ComponentName.h>
22 #include <Protocol/DriverBinding.h>
23 #include <Protocol/DiskIo.h>
24 #include <Library/DebugLib.h>
25 #include <Library/UefiDriverEntryPoint.h>
26 #include <Library/UefiLib.h>
27 #include <Library/BaseLib.h>
28 #include <Library/BaseMemoryLib.h>
29 #include <Library/MemoryAllocationLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
33 #define DISK_IO_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('d', 's', 'k', 'I')
35 #define DATA_BUFFER_BLOCK_NUM (64)
39 EFI_DISK_IO_PROTOCOL DiskIo
;
40 EFI_BLOCK_IO_PROTOCOL
*BlockIo
;
41 } DISK_IO_PRIVATE_DATA
;
43 #define DISK_IO_PRIVATE_DATA_FROM_THIS(a) CR (a, DISK_IO_PRIVATE_DATA, DiskIo, DISK_IO_PRIVATE_DATA_SIGNATURE)
48 extern EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding
;
49 extern EFI_COMPONENT_NAME_PROTOCOL gDiskIoComponentName
;
50 extern EFI_COMPONENT_NAME2_PROTOCOL gDiskIoComponentName2
;
54 // Driver model protocol interface
58 DiskIoDriverBindingSupported (
59 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
60 IN EFI_HANDLE ControllerHandle
,
61 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
66 DiskIoDriverBindingStart (
67 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
68 IN EFI_HANDLE ControllerHandle
,
69 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
74 DiskIoDriverBindingStop (
75 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
76 IN EFI_HANDLE ControllerHandle
,
77 IN UINTN NumberOfChildren
,
78 IN EFI_HANDLE
*ChildHandleBuffer
82 // Disk I/O Protocol Interface
87 IN EFI_DISK_IO_PROTOCOL
*This
,
97 IN EFI_DISK_IO_PROTOCOL
*This
,
105 // EFI Component Name Functions
108 Retrieves a Unicode string that is the user readable name of the driver.
110 This function retrieves the user readable name of a driver in the form of a
111 Unicode string. If the driver specified by This has a user readable name in
112 the language specified by Language, then a pointer to the driver name is
113 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
114 by This does not support the language specified by Language,
115 then EFI_UNSUPPORTED is returned.
117 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
118 EFI_COMPONENT_NAME_PROTOCOL instance.
120 @param Language[in] A pointer to a Null-terminated ASCII string
121 array indicating the language. This is the
122 language of the driver name that the caller is
123 requesting, and it must match one of the
124 languages specified in SupportedLanguages. The
125 number of languages supported by a driver is up
126 to the driver writer. Language is specified
127 in RFC 3066 or ISO 639-2 language code format.
129 @param DriverName[out] A pointer to the Unicode string to return.
130 This Unicode string is the name of the
131 driver specified by This in the language
132 specified by Language.
134 @retval EFI_SUCCESS The Unicode string for the Driver specified by
135 This and the language specified by Language was
136 returned in DriverName.
138 @retval EFI_INVALID_PARAMETER Language is NULL.
140 @retval EFI_INVALID_PARAMETER DriverName is NULL.
142 @retval EFI_UNSUPPORTED The driver specified by This does not support
143 the language specified by Language.
148 DiskIoComponentNameGetDriverName (
149 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
151 OUT CHAR16
**DriverName
156 Retrieves a Unicode string that is the user readable name of the controller
157 that is being managed by a driver.
159 This function retrieves the user readable name of the controller specified by
160 ControllerHandle and ChildHandle in the form of a Unicode string. If the
161 driver specified by This has a user readable name in the language specified by
162 Language, then a pointer to the controller name is returned in ControllerName,
163 and EFI_SUCCESS is returned. If the driver specified by This is not currently
164 managing the controller specified by ControllerHandle and ChildHandle,
165 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
166 support the language specified by Language, then EFI_UNSUPPORTED is returned.
168 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
169 EFI_COMPONENT_NAME_PROTOCOL instance.
171 @param ControllerHandle[in] The handle of a controller that the driver
172 specified by This is managing. This handle
173 specifies the controller whose name is to be
176 @param ChildHandle[in] The handle of the child controller to retrieve
177 the name of. This is an optional parameter that
178 may be NULL. It will be NULL for device
179 drivers. It will also be NULL for a bus drivers
180 that wish to retrieve the name of the bus
181 controller. It will not be NULL for a bus
182 driver that wishes to retrieve the name of a
185 @param Language[in] A pointer to a Null-terminated ASCII string
186 array indicating the language. This is the
187 language of the driver name that the caller is
188 requesting, and it must match one of the
189 languages specified in SupportedLanguages. The
190 number of languages supported by a driver is up
191 to the driver writer. Language is specified in
192 RFC 3066 or ISO 639-2 language code format.
194 @param ControllerName[out] A pointer to the Unicode string to return.
195 This Unicode string is the name of the
196 controller specified by ControllerHandle and
197 ChildHandle in the language specified by
198 Language from the point of view of the driver
201 @retval EFI_SUCCESS The Unicode string for the user readable name in
202 the language specified by Language for the
203 driver specified by This was returned in
206 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
208 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
211 @retval EFI_INVALID_PARAMETER Language is NULL.
213 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
215 @retval EFI_UNSUPPORTED The driver specified by This is not currently
216 managing the controller specified by
217 ControllerHandle and ChildHandle.
219 @retval EFI_UNSUPPORTED The driver specified by This does not support
220 the language specified by Language.
225 DiskIoComponentNameGetControllerName (
226 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
227 IN EFI_HANDLE ControllerHandle
,
228 IN EFI_HANDLE ChildHandle OPTIONAL
,
230 OUT CHAR16
**ControllerName