2 The header file of IScsiDriver.c.
4 Copyright (c) 2004 - 2008, Intel Corporation.<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _ISCSI_DRIVER_H_
16 #define _ISCSI_DRIVER_H_
19 #include <Protocol/DevicePath.h>
20 #include <Protocol/LoadedImage.h>
21 #include <Protocol/HiiConfigAccess.h>
22 #include <Protocol/HiiDatabase.h>
23 #include <Library/UefiDriverEntryPoint.h>
24 #include <Library/UefiBootServicesTableLib.h>
25 #include <Library/UefiLib.h>
26 #include <Library/DevicePathLib.h>
27 #include <Protocol/DriverBinding.h>
28 #include <Protocol/ScsiPassThruExt.h>
29 #include <Protocol/IScsiInitiatorName.h>
30 #include <Protocol/ComponentName.h>
31 #include <Protocol/ComponentName2.h>
34 #define ISCSI_PRIVATE_GUID \
35 { 0xfa3cde4c, 0x87c2, 0x427d, {0xae, 0xde, 0x7d, 0xd0, 0x96, 0xc8, 0x8c, 0x58} }
37 #define ISCSI_INITIATOR_NAME_VAR_NAME L"I_NAME"
39 extern EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentName2
;
40 extern EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName
;
42 extern EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName
;
44 extern EFI_GUID gIScsiPrivateGuid
;
46 typedef struct _ISCSI_PRIVATE_PROTOCOL
{
48 } ISCSI_PRIVATE_PROTOCOL
;
51 // EFI Driver Binding Protocol for iSCSI driver.
55 Tests to see if this driver supports a given controller. If a child device is provided,
56 it further tests to see if this driver supports creating a handle for the specified child device.
58 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
59 @param[in] ControllerHandle The handle of the controller to test. This handle
60 must support a protocol interface that supplies
61 an I/O abstraction to the driver.
62 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
63 This parameter is ignored by device drivers, and is optional for bus drivers.
66 @retval EFI_SUCCESS The device specified by ControllerHandle and
67 RemainingDevicePath is supported by the driver specified by This.
68 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
69 RemainingDevicePath is already being managed by the driver
71 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
72 RemainingDevicePath is already being managed by a different
73 driver or an application that requires exclusive acces.
74 Currently not implemented.
75 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
76 RemainingDevicePath is not supported by the driver specified by This.
80 IScsiDriverBindingSupported (
81 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
82 IN EFI_HANDLE ControllerHandle
,
83 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
87 Start this driver on ControllerHandle. The Start() function is designed to be
88 invoked from the EFI boot service ConnectController(). As a result, much of
89 the error checking on the parameters to Start() has been moved into this
90 common boot service. It is legal to call Start() from other locations,
91 but the following calling restrictions must be followed or the system behavior will not be deterministic.
92 1. ControllerHandle must be a valid EFI_HANDLE.
93 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
94 EFI_DEVICE_PATH_PROTOCOL.
95 3. Prior to calling Start(), the Supported() function for the driver specified by This must
96 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
98 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
99 @param[in] ControllerHandle The handle of the controller to start. This handle
100 must support a protocol interface that supplies
101 an I/O abstraction to the driver.
102 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
103 This parameter is ignored by device drivers, and is optional for bus drivers.
105 @retval EFI_SUCCESS The device was started.
106 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.
107 Currently not implemented.
108 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
109 @retval Others The driver failded to start the device.
113 IScsiDriverBindingStart (
114 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
115 IN EFI_HANDLE ControllerHandle
,
116 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
120 Stop this driver on ControllerHandle.
122 Release the control of this controller and remove the IScsi functions. The Stop()
123 function is designed to be invoked from the EFI boot service DisconnectController().
124 As a result, much of the error checking on the parameters to Stop() has been moved
125 into this common boot service. It is legal to call Stop() from other locations,
126 but the following calling restrictions must be followed or the system behavior will not be deterministic.
127 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
128 same driver's Start() function.
129 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
130 EFI_HANDLE. In addition, all of these handles must have been created in this driver's
131 Start() function, and the Start() function must have called OpenProtocol() on
132 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
134 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
135 @param[in] ControllerHandle A handle to the device being stopped. The handle must
136 support a bus specific I/O protocol for the driver
137 to use to stop the device.
138 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.Not used.
139 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
140 if NumberOfChildren is 0.Not used.
142 @retval EFI_SUCCESS The device was stopped.
143 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
147 IScsiDriverBindingStop (
148 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
149 IN EFI_HANDLE ControllerHandle
,
150 IN UINTN NumberOfChildren
,
151 IN EFI_HANDLE
*ChildHandleBuffer OPTIONAL
155 // EFI Component Name Protocol for IScsi driver.
159 Retrieves a Unicode string that is the user readable name of the EFI Driver.
161 This function retrieves the user readable name of a driver in the form of a
162 Unicode string. If the driver specified by This has a user readable name in
163 the language specified by Language, then a pointer to the driver name is
164 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
165 by This does not support the language specified by Language,
166 then EFI_UNSUPPORTED is returned.
168 @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
169 @param[in] Language A pointer to a three character ISO 639-2 language identifier.
170 This is the language of the driver name that that the caller
171 is requesting, and it must match one of the languages specified
172 in SupportedLanguages. The number of languages supported by a
173 driver is up to the driver writer.
174 @param[out] DriverName A pointer to the Unicode string to return. This Unicode string
175 is the name of the driver specified by This in the language
176 specified by Language.
178 @retval EFI_SUCCESS The Unicode string for the Driver specified by This
179 and the language specified by Language was returned
181 @retval EFI_INVALID_PARAMETER Language is NULL.
182 @retval EFI_INVALID_PARAMETER DriverName is NULL.
183 @retval EFI_UNSUPPORTED The driver specified by This does not support the
184 language specified by Language.
188 IScsiComponentNameGetDriverName (
189 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
191 OUT CHAR16
**DriverName
195 Retrieves a Unicode string that is the user readable name of the controller
196 that is being managed by an EFI Driver.Currently not implemented.
198 @param[in] This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
199 @param[in] ControllerHandle The handle of a controller that the driver specified by
200 This is managing. This handle specifies the controller
201 whose name is to be returned.
202 @param[in] ChildHandle The handle of the child controller to retrieve the name
203 of. This is an optional parameter that may be NULL. It
204 will be NULL for device drivers. It will also be NULL
205 for a bus drivers that wish to retrieve the name of the
206 bus controller. It will not be NULL for a bus driver
207 that wishes to retrieve the name of a child controller.
208 @param[in] Language A pointer to a three character ISO 639-2 language
209 identifier. This is the language of the controller name
210 that that the caller is requesting, and it must match one
211 of the languages specified in SupportedLanguages. The
212 number of languages supported by a driver is up to the
214 @param[out] ControllerName A pointer to the Unicode string to return. This Unicode
215 string is the name of the controller specified by
216 ControllerHandle and ChildHandle in the language specified
217 by Language from the point of view of the driver specified
220 @retval EFI_SUCCESS The Unicode string for the user readable name in the
221 language specified by Language for the driver
222 specified by This was returned in DriverName.
223 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
224 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
225 @retval EFI_INVALID_PARAMETER Language is NULL.
226 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
227 @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
228 the controller specified by ControllerHandle and
230 @retval EFI_UNSUPPORTED The driver specified by This does not support the
231 language specified by Language.
235 IScsiComponentNameGetControllerName (
236 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
237 IN EFI_HANDLE ControllerHandle
,
238 IN EFI_HANDLE ChildHandle OPTIONAL
,
240 OUT CHAR16
**ControllerName
244 // EFI IScsi Initiator Name Protocol for IScsi driver.
248 Retrieves the current set value of iSCSI Initiator Name.
250 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
251 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer / Actual size of the
252 variable data buffer.
253 @param[out] Buffer Pointer to the buffer for data to be read.
255 @retval EFI_SUCCESS Data was successfully retrieved into the provided buffer and the
256 BufferSize was sufficient to handle the iSCSI initiator name
257 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result.
258 @retval EFI_INVALID_PARAMETER BufferSize or Buffer is NULL.
259 @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved due to a hardware error.
260 @retval Others Other errors as indicated.
264 IScsiGetInitiatorName (
265 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL
*This
,
266 IN OUT UINTN
*BufferSize
,
271 Sets the iSCSI Initiator Name.
273 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
274 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer.
275 @param[in] Buffer Pointer to the buffer for data to be written.
277 @retval EFI_SUCCESS Data was successfully stored by the protocol.
278 @retval EFI_UNSUPPORTED Platform policies do not allow for data to be written.
279 Currently not implemented.
280 @retval EFI_INVALID_PARAMETER BufferSize or Buffer is NULL, or BufferSize exceeds the maximum allowed limit.
281 @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware error.
282 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data.
283 @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC 3720
284 (and other related protocols)
285 @retval Others Other errors as indicated.
289 IScsiSetInitiatorName (
290 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL
*This
,
291 IN OUT UINTN
*BufferSize
,