]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Network/IScsiDxe/IScsiDriver.h
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6892 6f19259b...
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiDriver.h
CommitLineData
12618416 1/** @file\r
94451634 2 The header file of IScsiDriver.c.\r
6a690e23 3\r
94451634 4Copyright (c) 2004 - 2008, Intel Corporation.<BR>\r
7a444476 5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
6a690e23 12\r
12618416 13**/\r
6a690e23 14\r
15#ifndef _ISCSI_DRIVER_H_\r
16#define _ISCSI_DRIVER_H_\r
17\r
18#include <PiDxe.h>\r
19#include <Protocol/DevicePath.h>\r
20#include <Protocol/LoadedImage.h>\r
5451bd96 21#include <Protocol/HiiConfigAccess.h>\r
22#include <Protocol/HiiDatabase.h>\r
6a690e23 23#include <Library/UefiDriverEntryPoint.h>\r
24#include <Library/UefiBootServicesTableLib.h>\r
25#include <Library/UefiLib.h>\r
26#include <Library/DevicePathLib.h>\r
9cb8724d 27#include <Protocol/DriverBinding.h>\r
28#include <Protocol/ScsiPassThruExt.h>\r
29#include <Protocol/IScsiInitiatorName.h>\r
30#include <Protocol/Ip4Config.h>\r
31#include <Protocol/ComponentName.h>\r
32#include <Protocol/ComponentName2.h>\r
6a690e23 33\r
94451634 34\r
6a690e23 35#define ISCSI_PRIVATE_GUID \\r
36a975dd 36 { 0xfa3cde4c, 0x87c2, 0x427d, {0xae, 0xde, 0x7d, 0xd0, 0x96, 0xc8, 0x8c, 0x58} }\r
6a690e23 37\r
38#define ISCSI_INITIATOR_NAME_VAR_NAME L"I_NAME"\r
39\r
40extern EFI_COMPONENT_NAME2_PROTOCOL gIScsiComponentName2;\r
41extern EFI_COMPONENT_NAME_PROTOCOL gIScsiComponentName;\r
42\r
e492d1bb 43extern EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName;\r
44\r
6a690e23 45\r
46extern EFI_GUID mIScsiPrivateGuid;\r
47\r
48typedef struct _ISCSI_PRIVATE_PROTOCOL {\r
49 UINT32 Reserved;\r
50} ISCSI_PRIVATE_PROTOCOL;\r
51\r
52//\r
53// EFI Driver Binding Protocol for iSCSI driver.\r
54//\r
12618416 55\r
94451634 56/**\r
57 Tests to see if this driver supports a given controller. If a child device is provided, \r
58 it further tests to see if this driver supports creating a handle for the specified child device.\r
59\r
60 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
61 @param ControllerHandle The handle of the controller to test. This handle \r
62 must support a protocol interface that supplies \r
63 an I/O abstraction to the driver.\r
64 @param RemainingDevicePath A pointer to the remaining portion of a device path. \r
65 This parameter is ignored by device drivers, and is optional for bus drivers.\r
66\r
67\r
68 @retval EFI_SUCCESS The device specified by ControllerHandle and\r
69 RemainingDevicePath is supported by the driver specified by This.\r
70 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r
71 RemainingDevicePath is already being managed by the driver\r
72 specified by This.\r
73 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r
74 RemainingDevicePath is already being managed by a different\r
75 driver or an application that requires exclusive acces.\r
76 Currently not implemented.\r
77 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r
78 RemainingDevicePath is not supported by the driver specified by This.\r
12618416 79**/\r
6a690e23 80EFI_STATUS\r
81EFIAPI\r
82IScsiDriverBindingSupported (\r
83 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
84 IN EFI_HANDLE ControllerHandle,\r
85 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
86 );\r
87\r
12618416 88/**\r
94451634 89 Start this driver on ControllerHandle. The Start() function is designed to be \r
90 invoked from the EFI boot service ConnectController(). As a result, much of \r
91 the error checking on the parameters to Start() has been moved into this \r
92 common boot service. It is legal to call Start() from other locations, \r
93 but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
94 1. ControllerHandle must be a valid EFI_HANDLE.\r
95 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
96 EFI_DEVICE_PATH_PROTOCOL.\r
97 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
98 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. \r
99\r
100 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
101 @param ControllerHandle The handle of the controller to start. This handle \r
102 must support a protocol interface that supplies \r
103 an I/O abstraction to the driver.\r
104 @param RemainingDevicePath A pointer to the remaining portion of a device path. \r
105 This parameter is ignored by device drivers, and is optional for bus drivers.\r
106\r
107 @retval EFI_SUCCESS The device was started.\r
108 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r
109 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
110 @retval other The driver failded to start the device.\r
12618416 111**/\r
6a690e23 112EFI_STATUS\r
113EFIAPI\r
114IScsiDriverBindingStart (\r
115 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
116 IN EFI_HANDLE ControllerHandle,\r
117 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
118 );\r
119\r
12618416 120/**\r
94451634 121 Stop this driver on ControllerHandle. \r
122 \r
123 Release the control of this controller and remove the IScsi functions. The Stop()\r
124 function is designed to be invoked from the EFI boot service DisconnectController(). \r
125 As a result, much of the error checking on the parameters to Stop() has been moved \r
126 into this common boot service. It is legal to call Stop() from other locations, \r
127 but the following calling restrictions must be followed or the system behavior will not be deterministic.\r
128 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
129 same driver's Start() function.\r
130 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
131 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
132 Start() function, and the Start() function must have called OpenProtocol() on\r
133 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
134 \r
135 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
136 @param ControllerHandle A handle to the device being stopped. The handle must \r
137 support a bus specific I/O protocol for the driver \r
138 to use to stop the device.\r
139 @param NumberOfChildren The number of child device handles in ChildHandleBuffer.Not used.\r
140 @param ChildHandleBuffer An array of child handles to be freed. May be NULL \r
141 if NumberOfChildren is 0.Not used.\r
142\r
143 @retval EFI_SUCCESS The device was stopped.\r
144 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
12618416 145**/\r
6a690e23 146EFI_STATUS\r
147EFIAPI\r
148IScsiDriverBindingStop (\r
149 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
150 IN EFI_HANDLE ControllerHandle,\r
151 IN UINTN NumberOfChildren,\r
152 IN EFI_HANDLE *ChildHandleBuffer\r
153 );\r
154\r
155//\r
12618416 156// EFI Component Name Protocol for IScsi driver.\r
6a690e23 157//\r
12618416 158/**\r
159 Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
160\r
161 This function retrieves the user readable name of a driver in the form of a\r
162 Unicode string. If the driver specified by This has a user readable name in\r
163 the language specified by Language, then a pointer to the driver name is\r
164 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
165 by This does not support the language specified by Language,\r
166 then EFI_UNSUPPORTED is returned.\r
167\r
168 @param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL\r
169 instance.\r
170\r
171 @param Language[in] A pointer to a three character ISO 639-2 language\r
172 identifier.\r
173 This is the language of the driver name that that\r
174 the caller is requesting, and it must match one of\r
175 the languages specified in SupportedLanguages. \r
176 The number of languages supported by a driver is up\r
177 to the driver writer.\r
178\r
179 @param DriverName[out] A pointer to the Unicode string to return.\r
180 This Unicode string is the name of the\r
181 driver specified by This in the language\r
182 specified by Language.\r
183\r
184 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
185 This and the language specified by Language was\r
186 returned in DriverName.\r
187\r
188 @retval EFI_INVALID_PARAMETER Language is NULL.\r
189\r
190 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
191\r
192 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
193 the language specified by Language.\r
194\r
195**/\r
6a690e23 196EFI_STATUS\r
197EFIAPI\r
198IScsiComponentNameGetDriverName (\r
199 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
200 IN CHAR8 *Language,\r
201 OUT CHAR16 **DriverName\r
202 );\r
203\r
12618416 204/**\r
205 Retrieves a Unicode string that is the user readable name of the controller\r
206 that is being managed by an EFI Driver.\r
207\r
208 @param This[in] A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
209\r
210 @param ControllerHandle[in] The handle of a controller that the driver specified by\r
211 This is managing. This handle specifies the controller\r
212 whose name is to be returned.\r
213\r
214 @param ChildHandle[in] The handle of the child controller to retrieve the name\r
215 of. This is an optional parameter that may be NULL. It\r
216 will be NULL for device drivers. It will also be NULL\r
217 for a bus drivers that wish to retrieve the name of the\r
218 bus controller. It will not be NULL for a bus driver\r
219 that wishes to retrieve the name of a child controller.\r
220\r
221 @param Language[in] A pointer to a three character ISO 639-2 language \r
222 identifier. This is the language of the controller name\r
223 that that the caller is requesting, and it must match one\r
224 of the languages specified in SupportedLanguages. The\r
225 number of languages supported by a driver is up to the\r
226 driver writer.\r
227\r
228 @param ControllerName[out] A pointer to the Unicode string to return. This Unicode\r
229 string is the name of the controller specified by \r
230 ControllerHandle and ChildHandle in the language \r
231 specified by Language from the point of view of the \r
232 driver specified by This. \r
233\r
234 @retval EFI_SUCCESS The Unicode string for the user readable name in the \r
235 language specified by Language for the driver \r
236 specified by This was returned in DriverName.\r
237\r
238 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
239\r
240 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid EFI_HANDLE.\r
241\r
242 @retval EFI_INVALID_PARAMETER Language is NULL.\r
243\r
244 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
245\r
246 @retval EFI_UNSUPPORTED The driver specified by This is not currently managing\r
247 the controller specified by ControllerHandle and ChildHandle.\r
248\r
249 @retval EFI_UNSUPPORTED The driver specified by This does not support the \r
250 language specified by Language.\r
251\r
252**/\r
6a690e23 253EFI_STATUS\r
254EFIAPI\r
255IScsiComponentNameGetControllerName (\r
256 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
257 IN EFI_HANDLE ControllerHandle,\r
258 IN EFI_HANDLE ChildHandle OPTIONAL,\r
259 IN CHAR8 *Language,\r
260 OUT CHAR16 **ControllerName\r
261 );\r
e492d1bb 262 \r
263//\r
264// EFI IScsi Initiator Name Protocol for IScsi driver.\r
265//\r
266/**\r
267 Retrieves the current set value of iSCSI Initiator Name. \r
268\r
269 @param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.\r
270\r
271 @param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer / Actual\r
272 size of the variable data buffer.\r
273\r
274 @param Buffer[out] Pointer to the buffer for data to be read.\r
275\r
276 @retval EFI_SUCCESS Data was successfully retrieved into the provided \r
277 buffer and the BufferSize was sufficient to handle the\r
278 iSCSI initiator name.\r
279 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. BufferSize will\r
280 be updated with the size required to complete the request.\r
281 Buffer will not be affected.\r
282\r
283 @retval EFI_INVALID_PARAMETER BufferSize is NULL. BufferSize and Buffer will not be\r
284 affected.\r
285\r
286 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be\r
287 affected.\r
288\r
289 @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved due to\r
290 a hardware error.\r
291\r
292**/\r
293EFI_STATUS\r
294EFIAPI\r
295IScsiGetInitiatorName (\r
296 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,\r
297 IN OUT UINTN *BufferSize,\r
298 OUT VOID *Buffer\r
299 );\r
300\r
301/**\r
302 Sets the iSCSI Initiator Name. \r
303\r
304 @param This[in] Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL instance.\r
305\r
306 @param BufferSize[in][out] Size of the buffer in bytes pointed to by Buffer.\r
307\r
308 @param Buffer[out] Pointer to the buffer for data to be written.\r
309 \r
310 @retval EFI_SUCCESS Data was successfully stored by the protocol.\r
311\r
312 @retval EFI_UNSUPPORTED Platform policies do not allow for data to be written.\r
313\r
314 @retval EFI_INVALID_PARAMETER BufferSize exceeds the maximum allowed limit.\r
315 BufferSize will be updated with the maximum size\r
316 required to complete the request.\r
317\r
318 @retval EFI_INVALID_PARAMETER Buffersize is NULL. BufferSize and Buffer will not be\r
319 affected.\r
320\r
321 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be affected.\r
322\r
323 @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware error.\r
324\r
325 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data.\r
326\r
327 @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC 3720.\r
328\r
329**/\r
330EFI_STATUS\r
331EFIAPI\r
332IScsiSetInitiatorName (\r
333 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL *This,\r
334 IN OUT UINTN *BufferSize,\r
335 IN VOID *Buffer\r
336 );\r
6a690e23 337\r
6a690e23 338#endif\r