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 <Library/UefiDriverEntryPoint.h>
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/UefiLib.h>
31 #include <Library/DevicePathLib.h>
32 #include <Protocol/DriverBinding.h>
33 #include <Protocol/ScsiPassThruExt.h>
34 #include <Protocol/IScsiInitiatorName.h>
35 #include <Protocol/Ip4Config.h>
36 #include <Protocol/ComponentName.h>
37 #include <Protocol/ComponentName2.h>
39 #define ISCSI_PRIVATE_GUID \
40 { 0xfa3cde4c, 0x87c2, 0x427d, {0xae, 0xde, 0x7d, 0xd0, 0x96, 0xc8, 0x8c, 0x58} }
42 #define ISCSI_INITIATOR_NAME_VAR_NAME L"I_NAME"
44 extern EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentName2
;
45 extern EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName
;
47 extern EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName
;
49 extern EFI_GUID mIScsiPrivateGuid
;
51 typedef struct _ISCSI_PRIVATE_PROTOCOL
{
53 } ISCSI_PRIVATE_PROTOCOL
;
56 // EFI Driver Binding Protocol for iSCSI driver.
59 Test to see if IScsi driver supports the given controller.
61 @param This[in] Protocol instance pointer.
63 @param ControllerHandle[in] Handle of controller to test.
65 @param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.
67 @retval EFI_SUCCES This driver supports the controller.
69 @retval EFI_ALREADY_STARTED This driver is already running on this device.
71 @retval EFI_UNSUPPORTED This driver doesn't support the controller.
76 IScsiDriverBindingSupported (
77 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
78 IN EFI_HANDLE ControllerHandle
,
79 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
83 Start to manage the controller.
85 @param This[in] Protocol instance pointer.
87 @param ControllerHandle[in] Handle of the controller.
89 @param RemainingDevicePath[in] Optional parameter use to pick a specific child device to start.
91 @retval EFI_SUCCES This driver supports this device.
93 @retval EFI_ALREADY_STARTED This driver is already running on this device.
98 IScsiDriverBindingStart (
99 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
100 IN EFI_HANDLE ControllerHandle
,
101 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
105 Release the control of this controller and remove the IScsi functions.
107 @param This[in] Protocol instance pointer.
109 @param ControllerHandle[in] Handle of controller to stop.
111 @param NumberOfChildren[in] Not used.
113 @param ChildHandleBuffer[in] Not used.
115 @retval EFI_SUCCES This driver supports this device.
120 IScsiDriverBindingStop (
121 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
122 IN EFI_HANDLE ControllerHandle
,
123 IN UINTN NumberOfChildren
,
124 IN EFI_HANDLE
*ChildHandleBuffer
128 // EFI Component Name Protocol for IScsi driver.
131 Retrieves a Unicode string that is the user readable name of the EFI Driver.
133 This function retrieves the user readable name of a driver in the form of a
134 Unicode string. If the driver specified by This has a user readable name in
135 the language specified by Language, then a pointer to the driver name is
136 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
137 by This does not support the language specified by Language,
138 then EFI_UNSUPPORTED is returned.
140 @param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL
143 @param Language[in] A pointer to a three character ISO 639-2 language
145 This is the language of the driver name that that
146 the caller is requesting, and it must match one of
147 the languages specified in SupportedLanguages.
148 The number of languages supported by a driver is up
149 to the driver writer.
151 @param DriverName[out] A pointer to the Unicode string to return.
152 This Unicode string is the name of the
153 driver specified by This in the language
154 specified by Language.
156 @retval EFI_SUCCESS The Unicode string for the Driver specified by
157 This and the language specified by Language was
158 returned in DriverName.
160 @retval EFI_INVALID_PARAMETER Language is NULL.
162 @retval EFI_INVALID_PARAMETER DriverName is NULL.
164 @retval EFI_UNSUPPORTED The driver specified by This does not support
165 the language specified by Language.
170 IScsiComponentNameGetDriverName (
171 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
173 OUT CHAR16
**DriverName
177 Retrieves a Unicode string that is the user readable name of the controller
178 that is being managed by an EFI Driver.
180 @param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
182 @param ControllerHandle[in] The handle of a controller that the driver specified by
183 This is managing. This handle specifies the controller
184 whose name is to be returned.
186 @param ChildHandle[in] The handle of the child controller to retrieve the name
187 of. This is an optional parameter that may be NULL. It
188 will be NULL for device drivers. It will also be NULL
189 for a bus drivers that wish to retrieve the name of the
190 bus controller. It will not be NULL for a bus driver
191 that wishes to retrieve the name of a child controller.
193 @param Language[in] A pointer to a three character ISO 639-2 language
194 identifier. This is the language of the controller name
195 that that the caller is requesting, and it must match one
196 of the languages specified in SupportedLanguages. The
197 number of languages supported by a driver is up to the
200 @param ControllerName[out] A pointer to the Unicode string to return. This Unicode
201 string is the name of the controller specified by
202 ControllerHandle and ChildHandle in the language
203 specified by Language from the point of view of the
204 driver specified by This.
206 @retval EFI_SUCCESS The Unicode string for the user readable name in the
207 language specified by Language for the driver
208 specified by This was returned in DriverName.
210 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
212 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.
214 @retval EFI_INVALID_PARAMETER Language is NULL.
216 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
218 @retval EFI_UNSUPPORTED The driver specified by This is not currently managing
219 the controller specified by ControllerHandle and ChildHandle.
221 @retval EFI_UNSUPPORTED The driver specified by This does not support the
222 language specified by Language.
227 IScsiComponentNameGetControllerName (
228 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
229 IN EFI_HANDLE ControllerHandle
,
230 IN EFI_HANDLE ChildHandle OPTIONAL
,
232 OUT CHAR16
**ControllerName
236 // EFI IScsi Initiator Name Protocol for IScsi driver.
239 Retrieves the current set value of iSCSI Initiator Name.
241 @param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
243 @param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer / Actual
244 size of the variable data buffer.
246 @param Buffer[out] Pointer to the buffer for data to be read.
248 @retval EFI_SUCCESS Data was successfully retrieved into the provided
249 buffer and the BufferSize was sufficient to handle the
250 iSCSI initiator name.
251 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. BufferSize will
252 be updated with the size required to complete the request.
253 Buffer will not be affected.
255 @retval EFI_INVALID_PARAMETER BufferSize is NULL. BufferSize and Buffer will not be
258 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
261 @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved due to
267 IScsiGetInitiatorName (
268 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL
*This
,
269 IN OUT UINTN
*BufferSize
,
274 Sets the iSCSI Initiator Name.
276 @param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.
278 @param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer.
280 @param Buffer[out] Pointer to the buffer for data to be written.
282 @retval EFI_SUCCESS Data was successfully stored by the protocol.
284 @retval EFI_UNSUPPORTED Platform policies do not allow for data to be written.
286 @retval EFI_INVALID_PARAMETER BufferSize exceeds the maximum allowed limit.
287 BufferSize will be updated with the maximum size
288 required to complete the request.
290 @retval EFI_INVALID_PARAMETER Buffersize is NULL. BufferSize and Buffer will not be
293 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be affected.
295 @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware error.
297 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data.
299 @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC 3720.
304 IScsiSetInitiatorName (
305 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL
*This
,
306 IN OUT UINTN
*BufferSize
,