2 The header file of IScsiDriver.c
4 Copyright (c) 2004 - 2008, Intel Corporation
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.
18 The header file of IScsiDriver.c
22 #ifndef _ISCSI_DRIVER_H_
23 #define _ISCSI_DRIVER_H_
26 #include <Protocol/DevicePath.h>
27 #include <Protocol/LoadedImage.h>
28 #include <Protocol/HiiConfigAccess.h>
29 #include <Protocol/HiiDatabase.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/UefiLib.h>
33 #include <Library/DevicePathLib.h>
34 #include <Protocol/DriverBinding.h>
35 #include <Protocol/ScsiPassThruExt.h>
36 #include <Protocol/IScsiInitiatorName.h>
37 #include <Protocol/Ip4Config.h>
38 #include <Protocol/ComponentName.h>
39 #include <Protocol/ComponentName2.h>
41 #define ISCSI_PRIVATE_GUID \
42 { 0xfa3cde4c, 0x87c2, 0x427d, {0xae, 0xde, 0x7d, 0xd0, 0x96, 0xc8, 0x8c, 0x58} }
44 #define ISCSI_INITIATOR_NAME_VAR_NAME L"I_NAME"
46 extern EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentName2
;
47 extern EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName
;
49 extern EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName
;
51 extern EFI_GUID mIScsiPrivateGuid
;
53 typedef struct _ISCSI_PRIVATE_PROTOCOL
{
55 } ISCSI_PRIVATE_PROTOCOL
;
58 // EFI Driver Binding Protocol for iSCSI driver.
61 Test to see if IScsi driver supports the given controller.
63 @param This[in] Protocol instance pointer.
65 @param ControllerHandle[in] Handle of controller to test.
67 @param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.
69 @retval EFI_SUCCES This driver supports the controller.
71 @retval EFI_ALREADY_STARTED This driver is already running on this device.
73 @retval EFI_UNSUPPORTED This driver doesn't support the controller.
78 IScsiDriverBindingSupported (
79 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
80 IN EFI_HANDLE ControllerHandle
,
81 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
85 Start to manage the controller.
87 @param This[in] Protocol instance pointer.
89 @param ControllerHandle[in] Handle of the controller.
91 @param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.
93 @retval EFI_SUCCES This driver supports this device.
95 @retval EFI_ALREADY_STARTED This driver is already running on this device.
100 IScsiDriverBindingStart (
101 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
102 IN EFI_HANDLE ControllerHandle
,
103 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
107 Release the control of this controller and remove the IScsi functions.
109 @param This[in] Protocol instance pointer.
111 @param ControllerHandle[in] Handle of controller to stop.
113 @param NumberOfChildren[in] Not used.
115 @param ChildHandleBuffer[in] Not used.
117 @retval EFI_SUCCES This driver supports this device.
122 IScsiDriverBindingStop (
123 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
124 IN EFI_HANDLE ControllerHandle
,
125 IN UINTN NumberOfChildren
,
126 IN EFI_HANDLE
*ChildHandleBuffer
130 // EFI Component Name Protocol for IScsi driver.
133 Retrieves a Unicode string that is the user readable name of the EFI Driver.
135 This function retrieves the user readable name of a driver in the form of a
136 Unicode string. If the driver specified by This has a user readable name in
137 the language specified by Language, then a pointer to the driver name is
138 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
139 by This does not support the language specified by Language,
140 then EFI_UNSUPPORTED is returned.
142 @param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL
145 @param Language[in] A pointer to a three character ISO 639-2 language
147 This is the language of the driver name that that
148 the caller is requesting, and it must match one of
149 the languages specified in SupportedLanguages.
150 The number of languages supported by a driver is up
151 to the driver writer.
153 @param DriverName[out] A pointer to the Unicode string to return.
154 This Unicode string is the name of the
155 driver specified by This in the language
156 specified by Language.
158 @retval EFI_SUCCESS The Unicode string for the Driver specified by
159 This and the language specified by Language was
160 returned in DriverName.
162 @retval EFI_INVALID_PARAMETER Language is NULL.
164 @retval EFI_INVALID_PARAMETER DriverName is NULL.
166 @retval EFI_UNSUPPORTED The driver specified by This does not support
167 the language specified by Language.
172 IScsiComponentNameGetDriverName (
173 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
175 OUT CHAR16
**DriverName
179 Retrieves a Unicode string that is the user readable name of the controller
180 that is being managed by an EFI Driver.
182 @param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
184 @param ControllerHandle[in] The handle of a controller that the driver specified by
185 This is managing. This handle specifies the controller
186 whose name is to be returned.
188 @param ChildHandle[in] The handle of the child controller to retrieve the name
189 of. This is an optional parameter that may be NULL. It
190 will be NULL for device drivers. It will also be NULL
191 for a bus drivers that wish to retrieve the name of the
192 bus controller. It will not be NULL for a bus driver
193 that wishes to retrieve the name of a child controller.
195 @param Language[in] A pointer to a three character ISO 639-2 language
196 identifier. This is the language of the controller name
197 that that the caller is requesting, and it must match one
198 of the languages specified in SupportedLanguages. The
199 number of languages supported by a driver is up to the
202 @param ControllerName[out] A pointer to the Unicode string to return. This Unicode
203 string is the name of the controller specified by
204 ControllerHandle and ChildHandle in the language
205 specified by Language from the point of view of the
206 driver specified by This.
208 @retval EFI_SUCCESS The Unicode string for the user readable name in the
209 language specified by Language for the driver
210 specified by This was returned in DriverName.
212 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
214 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
216 @retval EFI_INVALID_PARAMETER Language is NULL.
218 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
220 @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
221 the controller specified by ControllerHandle and ChildHandle.
223 @retval EFI_UNSUPPORTED The driver specified by This does not support the
224 language specified by Language.
229 IScsiComponentNameGetControllerName (
230 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
231 IN EFI_HANDLE ControllerHandle
,
232 IN EFI_HANDLE ChildHandle OPTIONAL
,
234 OUT CHAR16
**ControllerName
238 // EFI IScsi Initiator Name Protocol for IScsi driver.
241 Retrieves the current set value of iSCSI Initiator Name.
243 @param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
245 @param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer / Actual
246 size of the variable data buffer.
248 @param Buffer[out] Pointer to the buffer for data to be read.
250 @retval EFI_SUCCESS Data was successfully retrieved into the provided
251 buffer and the BufferSize was sufficient to handle the
252 iSCSI initiator name.
253 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. BufferSize will
254 be updated with the size required to complete the request.
255 Buffer will not be affected.
257 @retval EFI_INVALID_PARAMETER BufferSize is NULL. BufferSize and Buffer will not be
260 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
263 @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved due to
269 IScsiGetInitiatorName (
270 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL
*This
,
271 IN OUT UINTN
*BufferSize
,
276 Sets the iSCSI Initiator Name.
278 @param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
280 @param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer.
282 @param Buffer[out] Pointer to the buffer for data to be written.
284 @retval EFI_SUCCESS Data was successfully stored by the protocol.
286 @retval EFI_UNSUPPORTED Platform policies do not allow for data to be written.
288 @retval EFI_INVALID_PARAMETER BufferSize exceeds the maximum allowed limit.
289 BufferSize will be updated with the maximum size
290 required to complete the request.
292 @retval EFI_INVALID_PARAMETER Buffersize is NULL. BufferSize and Buffer will not be
295 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be affected.
297 @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware error.
299 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data.
301 @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC 3720.
306 IScsiSetInitiatorName (
307 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL
*This
,
308 IN OUT UINTN
*BufferSize
,